add slots
This commit is contained in:
parent
3396dd73b2
commit
ad83255833
11 changed files with 185 additions and 115 deletions
|
@ -128,6 +128,12 @@ public class RenderItem
|
|||
case BOOTS:
|
||||
offset = 1.7f;
|
||||
break;
|
||||
case CROWN:
|
||||
offset = 0.0f;
|
||||
break;
|
||||
case SHIELD:
|
||||
offset = 0.0f;
|
||||
break;
|
||||
}
|
||||
GL11.glTranslatef(1.0f, offset, 0.0f);
|
||||
GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
@ -135,7 +141,12 @@ public class RenderItem
|
|||
boolean cull = GlState.isCullEnabled();
|
||||
if(cull)
|
||||
GlState.disableCull();
|
||||
if(armor.getArmorType().isMainArmor())
|
||||
this.armor.doRenderLayer(null, 0.0f, 0.0f, 0.0f, 0, 0, 0.0f, 0.0625F);
|
||||
// else if(armor.getArmorType() == Equipment.CROWN)
|
||||
//
|
||||
// else if(armor.getArmorType() == Equipment.SHIELD)
|
||||
//
|
||||
if(cull)
|
||||
GlState.enableCull();
|
||||
GL11.glPopMatrix();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package client.renderer.layers;
|
||||
|
||||
import client.renderer.entity.RendererLivingEntity;
|
||||
import client.renderer.model.ModelBiped;
|
||||
import client.renderer.model.ModelArmor;
|
||||
import common.util.Equipment;
|
||||
|
||||
public class LayerArachnoidArmor extends LayerArmor {
|
||||
|
@ -9,12 +9,10 @@ public class LayerArachnoidArmor extends LayerArmor {
|
|||
super(rendererIn, 12, 12);
|
||||
}
|
||||
|
||||
protected void setModelPartVisible(ModelBiped model, Equipment slot) {
|
||||
protected void setModelPartVisible(ModelArmor model, Equipment slot) {
|
||||
switch(slot) {
|
||||
case CHESTPLATE:
|
||||
case HELMET:
|
||||
super.setModelPartVisible(model, slot);
|
||||
break;
|
||||
default:
|
||||
model.setVisible(false);
|
||||
break;
|
||||
|
|
|
@ -8,7 +8,6 @@ import client.Client;
|
|||
import client.renderer.GlState;
|
||||
import client.renderer.entity.RendererLivingEntity;
|
||||
import client.renderer.model.ModelArmor;
|
||||
import client.renderer.model.ModelBiped;
|
||||
import common.collect.Lists;
|
||||
import common.enchantment.Enchantment;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
|
@ -182,7 +181,7 @@ public class LayerArmor implements LayerRenderer<EntityNPC>
|
|||
// this.modelArmor = new ModelBiped(1.0F);
|
||||
// }
|
||||
|
||||
protected void setModelPartVisible(ModelBiped model, Equipment slot)
|
||||
protected void setModelPartVisible(ModelArmor model, Equipment slot)
|
||||
{
|
||||
model.setVisible(false);
|
||||
|
||||
|
@ -208,6 +207,7 @@ public class LayerArmor implements LayerRenderer<EntityNPC>
|
|||
case HELMET:
|
||||
model.bipedHead.showModel = true;
|
||||
model.bipedHeadwear.showModel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ public enum EnchantmentType
|
|||
ARMOR_LEGS,
|
||||
ARMOR_TORSO,
|
||||
ARMOR_HEAD,
|
||||
NECKLACE,
|
||||
RING,
|
||||
SHIELD,
|
||||
WEAPON,
|
||||
DIGGER,
|
||||
FISHING_ROD,
|
||||
|
@ -35,7 +38,7 @@ public enum EnchantmentType
|
|||
return (this == ARMOR && armor.getArmorType().isMainArmor()) || armor.getArmorType().getEnchantmentType() == this;
|
||||
}
|
||||
else if(item instanceof ItemTool tool) {
|
||||
return this == DIGGER || (tool.getToolType().isMelee() && this == WEAPON);
|
||||
return this == DIGGER || (tool.getToolType().isWeapon() && this == WEAPON);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1353,17 +1353,18 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
ItemStack stack = itemEntity.getEntityItem();
|
||||
if(stack.getItem().getRadiation(stack) > 0.0f)
|
||||
return;
|
||||
Equipment slot = stack.getItem() instanceof ItemArmor armor ? armor.getArmorType() : null;
|
||||
Equipment[] slots = stack.getItem() instanceof ItemArmor armor ? armor.getArmorType().getPossibleSlots() : new Equipment[] {null};
|
||||
|
||||
for(Equipment slot : slots) {
|
||||
boolean flag = true;
|
||||
ItemStack old = slot == null ? this.getHeldItem() : this.getArmor(slot);
|
||||
|
||||
if(old != null) {
|
||||
if(slot == null) {
|
||||
if(stack.getItem() instanceof ItemTool t1 && t1.getToolType().isMelee() && !(old.getItem() instanceof ItemTool t2 && t2.getToolType().isMelee())) {
|
||||
if(stack.getItem() instanceof ItemTool t1 && t1.getToolType().isWeapon() && !(old.getItem() instanceof ItemTool t2 && t2.getToolType().isWeapon())) {
|
||||
flag = true;
|
||||
}
|
||||
else if(stack.getItem() instanceof ItemTool itemsword && itemsword.getToolType().isMelee() && old.getItem() instanceof ItemTool itemsword1 && itemsword1.getToolType().isMelee()) {
|
||||
else if(stack.getItem() instanceof ItemTool itemsword && itemsword.getToolType().isWeapon() && old.getItem() instanceof ItemTool itemsword1 && itemsword1.getToolType().isWeapon()) {
|
||||
if(itemsword.getAttackDamageBonus(stack) != itemsword1.getAttackDamageBonus(old)) {
|
||||
flag = itemsword.getAttackDamageBonus(stack) > itemsword1.getAttackDamageBonus(old);
|
||||
}
|
||||
|
@ -1377,7 +1378,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
else if(stack.getItem() instanceof ItemGunBase && !(old.getItem() instanceof ItemBow)) {
|
||||
flag = true;
|
||||
}
|
||||
else if(stack.getItem() instanceof ItemBow && !(old.getItem() instanceof ItemBow) && !(old.getItem() instanceof ItemTool tool && tool.getToolType().isMelee())) {
|
||||
else if(stack.getItem() instanceof ItemBow && !(old.getItem() instanceof ItemBow) && !(old.getItem() instanceof ItemTool tool && tool.getToolType().isWeapon())) {
|
||||
flag = true;
|
||||
}
|
||||
else {
|
||||
|
@ -1424,7 +1425,10 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
// this.noDespawn = true;
|
||||
this.onItemPickup(itemEntity, 1);
|
||||
itemEntity.setDead();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!itemEntity.dead) {
|
||||
stack = itemEntity.getEntityItem();
|
||||
Item item = stack.getItem();
|
||||
|
@ -3802,7 +3806,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
for (Equipment slot : Equipment.ARMOR)
|
||||
{
|
||||
ItemStack stack = this.getArmor(slot);
|
||||
if (stack != null && stack.getItem() instanceof ItemArmor)
|
||||
if (stack != null && stack.getItem() instanceof ItemArmor && stack.isItemStackDamageable())
|
||||
{
|
||||
stack.damage(damage, this);
|
||||
if (stack.isEmpty())
|
||||
|
@ -4498,14 +4502,22 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
if(!this.isPlayer()) {
|
||||
if(info.items != null) {
|
||||
for(ItemStack stack : info.items) {
|
||||
if(stack.getItem() instanceof ItemArmor)
|
||||
this.setArmor(((ItemArmor)stack.getItem()).getArmorType(), stack);
|
||||
else if(stack.getItem().getWieldType() != null)
|
||||
if(stack.getItem() instanceof ItemArmor armor) {
|
||||
for(Equipment slot : armor.getArmorType().getPossibleSlots()) {
|
||||
if(this.getArmor(slot) == null) {
|
||||
this.setArmor(slot, stack);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(stack.getItem().getWieldType() != null) {
|
||||
this.setHeldItem(stack);
|
||||
else
|
||||
}
|
||||
else {
|
||||
this.addStack(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.clear();
|
||||
this.setHeldItem(this.pickItem());
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ContainerPlayer extends Container {
|
|||
}
|
||||
public boolean isItemValid(ItemStack stack)
|
||||
{
|
||||
return stack != null && stack.getItem() instanceof ItemArmor armor && armor.getArmorType() == type;
|
||||
return stack != null && stack.getItem() instanceof ItemArmor armor && armor.getArmorType().canUseInSlot(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -113,13 +113,19 @@ public class ContainerPlayer extends Container {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Take a stack from the specified inventory slot.
|
||||
*/
|
||||
private int getFreeSlotFor(Equipment type) {
|
||||
for(Equipment slot : type.getPossibleSlots()) {
|
||||
if(!this.inventorySlots.get(5 + slot.getIndex()).getHasStack())
|
||||
return 5 + slot.getIndex();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public ItemStack transferStackInSlot(EntityNPC playerIn, int index)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)this.inventorySlots.get(index);
|
||||
int idx;
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
|
@ -149,10 +155,8 @@ public class ContainerPlayer extends Container {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
else if (itemstack.getItem() instanceof ItemArmor armor && !((Slot)this.inventorySlots.get(5 + armor.getArmorType().getIndex())).getHasStack())
|
||||
else if (itemstack.getItem() instanceof ItemArmor armor && (idx = this.getFreeSlotFor(armor.getArmorType())) >= 0)
|
||||
{
|
||||
int idx = 5 + armor.getArmorType().getIndex();
|
||||
|
||||
if (!this.mergeItemStack(itemstack1, idx, idx + 1, false))
|
||||
{
|
||||
return null;
|
||||
|
|
|
@ -273,7 +273,7 @@ public final class ItemStack {
|
|||
|
||||
public Map<Attribute, Float> getArmorModifiers(Equipment slot) {
|
||||
Map<Attribute, Float> map = Maps.newEnumMap(Attribute.class);
|
||||
if(this.item instanceof ItemArmor armor && (slot == null || armor.getArmorType() == slot))
|
||||
if(this.item instanceof ItemArmor armor && (slot == null || armor.getArmorType().canUseInSlot(slot)))
|
||||
armor.getArmorModifiers(map);
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -76,11 +76,12 @@ public class ItemArmor extends Item {
|
|||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
|
||||
ItemStack itemstack = playerIn.getArmor(this.type);
|
||||
|
||||
if(itemstack == null) {
|
||||
playerIn.setArmor(this.type, itemStackIn.copy());
|
||||
for(Equipment slot : this.type.getPossibleSlots()) {
|
||||
if(playerIn.getArmor(slot) == null) {
|
||||
playerIn.setArmor(slot, itemStackIn.copy(1));
|
||||
itemStackIn.decrSize();
|
||||
return itemStackIn;
|
||||
}
|
||||
}
|
||||
|
||||
return itemStackIn;
|
||||
|
@ -95,7 +96,7 @@ public class ItemArmor extends Item {
|
|||
|
||||
@Clientside
|
||||
public boolean hasBuiltinModel() {
|
||||
return this.type.isMainArmor();
|
||||
return this.type.isRenderedLayer();
|
||||
}
|
||||
|
||||
@Serverside
|
||||
|
@ -107,18 +108,26 @@ public class ItemArmor extends Item {
|
|||
BoundingBox axisalignedbb = new BoundingBox((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1));
|
||||
List<EntityNPC> list = world.<EntityNPC>getEntitiesWithinAABB(EntityNPC.class, axisalignedbb, new Predicate<EntityNPC>() {
|
||||
public boolean test(EntityNPC entity) {
|
||||
return entity.isEntityAlive() && entity.getArmor(ItemArmor.this.type) == null;
|
||||
if(!entity.isEntityAlive())
|
||||
return false;
|
||||
for(Equipment slot : ItemArmor.this.type.getPossibleSlots()) {
|
||||
if(entity.getArmor(slot) == null)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if(list.size() > 0) {
|
||||
EntityNPC entitylivingbase = list.get(0);
|
||||
entitylivingbase.setArmor(this.type, stack.copy(1));
|
||||
for(Equipment slot : this.type.getPossibleSlots()) {
|
||||
if(entitylivingbase.getArmor(slot) == null) {
|
||||
entitylivingbase.setArmor(slot, stack.copy(1));
|
||||
stack.decrSize();
|
||||
return stack;
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
return super.dispenseStack(world, source, position, blockpos, facing, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ItemTool extends Item {
|
|||
this.material = material;
|
||||
this.type = type;
|
||||
this.setMaxDamage(material.getDurability());
|
||||
this.setTab(this.type.isMelee() ? CheatTab.WEAPONS : CheatTab.TOOLS);
|
||||
this.setTab(this.type.isWeapon() ? CheatTab.WEAPONS : CheatTab.TOOLS);
|
||||
if(this.material.isMagnetic())
|
||||
this.setMagnetic();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class ItemTool extends Item {
|
|||
}
|
||||
|
||||
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) {
|
||||
stack.damage(this.type.isMelee() ? 1 : 2, attacker);
|
||||
stack.damage(this.type.isWeapon() ? 1 : 2, attacker);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -78,15 +78,15 @@ public class ItemTool extends Item {
|
|||
}
|
||||
|
||||
public ItemAction getItemUseAction() {
|
||||
return this.type.isMelee() ? ItemAction.BLOCK : super.getItemUseAction();
|
||||
return this.type.isWeapon() ? ItemAction.BLOCK : super.getItemUseAction();
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return this.type.isMelee() ? 72000 : super.getMaxItemUseDuration(stack);
|
||||
return this.type.isWeapon() ? 72000 : super.getMaxItemUseDuration(stack);
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
|
||||
if(this.type.isMelee())
|
||||
if(this.type.isWeapon())
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
}
|
||||
|
|
|
@ -6,18 +6,27 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.ToolMaterial;
|
||||
|
||||
public enum Equipment implements Identifyable, Displayable {
|
||||
PICKAXE("pickaxe", "Spitzhacke", ItemType.LEVELLED, 2, "XXX", " # ", " # "),
|
||||
AXE("axe", "Axt", ItemType.TOOL, 3, "XX", "X#", " #"),
|
||||
SHOVEL("shovel", "Schaufel", ItemType.TOOL, 1, "X", "#", "#"),
|
||||
SHEARS("shears", "Schere", ItemType.OPTIONAL, " X", "X "),
|
||||
PICKAXE("pickaxe", "Spitzhacke", ItemType.HARVEST_LEVELLED, 2, "XXX", " # ", " # "),
|
||||
AXE("axe", "Axt", ItemType.HARVEST_BASIC, 3, "XX", "X#", " #"),
|
||||
SHOVEL("shovel", "Schaufel", ItemType.HARVEST_BASIC, 1, "X", "#", "#"),
|
||||
SHEARS("shears", "Schere", ItemType.HARVEST_OPTIONAL, " X", "X "),
|
||||
|
||||
SWORD("sword", "Schwert", ItemType.MELEE, 4, "X", "X", "#"),
|
||||
SWORD("sword", "Schwert", ItemType.MELEE_WEAPON, 4, "X", "X", "#"),
|
||||
|
||||
HELMET("helmet", "Helm", "Kappe", 11, 0, EnchantmentType.ARMOR_HEAD, 1.0f, 1.0f, "XXX", "X X"),
|
||||
CHESTPLATE("chestplate", "Brustpanzer", "Jacke", 16, 1, EnchantmentType.ARMOR_TORSO, 1.7f, 1.2f, "X X", "XXX", "XXX"),
|
||||
LEGGINGS("leggings", "Beinschutz", "Hose", 15, 2, EnchantmentType.ARMOR_LEGS, 1.6f, 1.1f, "XXX", "X X", "X X"),
|
||||
BOOTS("boots", "Stiefel", "Stiefel", 13, 3, EnchantmentType.ARMOR_FEET, 1.4f, 1.0f, "X X", "X X"),
|
||||
|
||||
CROWN("crown", "Krone", 0, 4, null, 0.3f, 1.0f),
|
||||
RING_LEFT_A("ring_left_A", "Linker Ring 1", 0, 5, EnchantmentType.RING, 1.0f),
|
||||
RING_LEFT_B("ring_left_b", "Linker Ring 2", 0, 6, EnchantmentType.RING, 1.0f),
|
||||
SHIELD("shield", "Schild", 12, 7, EnchantmentType.SHIELD, 0.7f, 1.0f),
|
||||
NECKLACE("necklace", "Halskette", 0, 8, EnchantmentType.NECKLACE, 1.0f),
|
||||
RING_RIGHT_A("ring_right_a", "Rechter Ring 1", 0, 9, EnchantmentType.RING, 1.0f),
|
||||
RING_RIGHT_B("ring_right_a", "Rechter Ring 2", 0, 10, EnchantmentType.RING, 1.0f),
|
||||
BELT("belt", "Gürtel", 0, 11, null, 1.0f),
|
||||
|
||||
HORSE_ARMOR("horse_armor", "Pferderüstung", EntityHorse.class, "X X", "XXX", "XXX");
|
||||
|
||||
public static final int ARMOR_SLOTS;
|
||||
|
@ -72,15 +81,19 @@ public enum Equipment implements Identifyable, Displayable {
|
|||
}
|
||||
|
||||
private Equipment(String name, String display, Class<? extends EntityLiving> clazz, String... recipe) {
|
||||
this(name, display, null, ItemType.ANIMAL, -1, -1, null, 0.0f, 0.0f, clazz, recipe);
|
||||
this(name, display, null, ItemType.ANIMAL_ARMOR, -1, -1, null, 0.0f, 0.0f, clazz, recipe);
|
||||
}
|
||||
|
||||
private Equipment(String name, String display, String altDisplay, int damage, int index, EnchantmentType ench, float phy, float mag, String... recipe) {
|
||||
this(name, display, altDisplay, ItemType.ARMOR, damage, index, ench, phy, mag, null, recipe);
|
||||
this(name, display, altDisplay, ItemType.MAIN_ARMOR, damage, index, ench, phy, mag, null, recipe);
|
||||
}
|
||||
|
||||
private Equipment(String name, String display, int damage, int index, EnchantmentType ench, float mag, String... recipe) {
|
||||
this(name, display, null, ItemType.AUX, damage, index, ench, 0.0f, mag, null, recipe);
|
||||
private Equipment(String name, String display, int damage, int index, EnchantmentType ench, float mag) {
|
||||
this(name, display, null, ItemType.ACCESSORY, damage, index, ench, 0.0f, mag, null);
|
||||
}
|
||||
|
||||
private Equipment(String name, String display, int damage, int index, EnchantmentType ench, float phy, float mag) {
|
||||
this(name, display, null, ItemType.RENDERED_ACCESSORY, damage, index, ench, phy, mag, null);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -101,8 +114,8 @@ public enum Equipment implements Identifyable, Displayable {
|
|||
}
|
||||
|
||||
public boolean canRegister(ToolMaterial material) {
|
||||
return this.isArmor() ? material.hasArmor() && (!this.isAnimalArmor() || material.hasExtras())
|
||||
: (this.isMelee() ? material.hasWeapons() : (this.isOptional() ? material.hasExtras() : material.hasTools()));
|
||||
return !this.isAccessory() && (this.isArmor() ? material.hasArmor() && (!this.isAnimalArmor() || material.hasExtras())
|
||||
: (this.isWeapon() ? material.hasWeapons() : (this.isOptional() ? material.hasExtras() : material.hasTools())));
|
||||
}
|
||||
|
||||
public ItemType getType() {
|
||||
|
@ -110,27 +123,39 @@ public enum Equipment implements Identifyable, Displayable {
|
|||
}
|
||||
|
||||
public boolean isLevelled() {
|
||||
return this.type == ItemType.LEVELLED;
|
||||
return this.type == ItemType.HARVEST_LEVELLED;
|
||||
}
|
||||
|
||||
public boolean isMelee() {
|
||||
return this.type == ItemType.MELEE;
|
||||
public boolean isWeapon() {
|
||||
return this.type == ItemType.MELEE_WEAPON;
|
||||
}
|
||||
|
||||
public boolean isOptional() {
|
||||
return this.type == ItemType.OPTIONAL;
|
||||
return this.type == ItemType.HARVEST_OPTIONAL;
|
||||
}
|
||||
|
||||
public boolean isArmor() {
|
||||
return this.type == ItemType.ARMOR || this.type == ItemType.AUX || this.type == ItemType.ANIMAL;
|
||||
return this.type == ItemType.MAIN_ARMOR || this.type == ItemType.ACCESSORY || this.type == ItemType.RENDERED_ACCESSORY || this.type == ItemType.ANIMAL_ARMOR;
|
||||
}
|
||||
|
||||
public boolean isMainArmor() {
|
||||
return this.type == ItemType.ARMOR || this.type == ItemType.ANIMAL;
|
||||
return this.type == ItemType.MAIN_ARMOR || this.type == ItemType.ANIMAL_ARMOR;
|
||||
}
|
||||
|
||||
public boolean isRenderedLayer() {
|
||||
return this.type == ItemType.MAIN_ARMOR || this.type == ItemType.ANIMAL_ARMOR || this.type == ItemType.RENDERED_ACCESSORY;
|
||||
}
|
||||
|
||||
public boolean isAnimalArmor() {
|
||||
return this.type == ItemType.ANIMAL;
|
||||
return this.type == ItemType.ANIMAL_ARMOR;
|
||||
}
|
||||
|
||||
public boolean isAccessory() {
|
||||
return this.type == ItemType.ACCESSORY || this.type == ItemType.RENDERED_ACCESSORY;
|
||||
}
|
||||
|
||||
public boolean isRing() {
|
||||
return this == RING_LEFT_A || this == RING_LEFT_B || this == RING_RIGHT_A || this == RING_RIGHT_B;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
|
@ -160,4 +185,12 @@ public enum Equipment implements Identifyable, Displayable {
|
|||
public Class<? extends EntityLiving> getAnimalType() {
|
||||
return this.animalType;
|
||||
}
|
||||
|
||||
public Equipment[] getPossibleSlots() {
|
||||
return this.isRing() ? new Equipment[] {RING_LEFT_A, RING_LEFT_B, RING_RIGHT_A, RING_RIGHT_B} : new Equipment[] {this};
|
||||
}
|
||||
|
||||
public boolean canUseInSlot(Equipment slot) {
|
||||
return slot == null || !slot.isArmor() || this == slot || (this.isRing() && slot.isRing());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package common.util;
|
||||
|
||||
public enum ItemType {
|
||||
TOOL, LEVELLED, OPTIONAL, MELEE, ARMOR, AUX, ANIMAL;
|
||||
HARVEST_BASIC, HARVEST_LEVELLED, HARVEST_OPTIONAL, MELEE_WEAPON, MAIN_ARMOR, ACCESSORY, RENDERED_ACCESSORY, ANIMAL_ARMOR;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue