fix inventories, add dynamically sized inventories
This commit is contained in:
parent
593e10c3cc
commit
9f6b049a78
8 changed files with 27 additions and 3 deletions
|
@ -9,6 +9,10 @@ public class EntityCameraHolder extends EntityNPC {
|
|||
super(world);
|
||||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getBaseHealth(Random rand) {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,10 @@ public class EntityDwarf extends EntityNPC {
|
|||
public EntityDwarf(World worldIn) {
|
||||
super(worldIn);
|
||||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
// public boolean isAggressive() {
|
||||
// return false;
|
||||
|
|
|
@ -13,6 +13,10 @@ public class EntityFireDemon extends EntityFlyingNPC {
|
|||
this.tasks.addTask(7, new AIFireballAttack(this, 3, 7, 64.0, 2.0));
|
||||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 48;
|
||||
}
|
||||
|
||||
// public boolean isAggressive() {
|
||||
// return true;
|
||||
// }
|
||||
|
|
|
@ -9,6 +9,10 @@ public class EntityGoblin extends EntityNPC {
|
|||
super(worldIn);
|
||||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 24;
|
||||
}
|
||||
|
||||
public boolean isAggressive(Class<? extends EntityNPC> clazz) {
|
||||
return clazz == EntityHuman.class || clazz == EntityElf.class || clazz == EntityWoodElf.class || clazz == EntityBloodElf.class;
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
private ItemStack mouseItem;
|
||||
private final ItemStack[] armor = new ItemStack[Equipment.ARMOR_SLOTS];
|
||||
private final ItemStack[] prevArmor = new ItemStack[this.armor.length];
|
||||
private final ItemStack[] items = new ItemStack[36];
|
||||
private final ItemStack[] items = new ItemStack[this.getInventoryCapacity()];
|
||||
private final ItemStack[] prevItems = new ItemStack[this.items.length];
|
||||
private int inLove;
|
||||
protected Alignment alignment = Alignment.NEUTRAL;
|
||||
|
@ -2753,7 +2753,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
|
||||
public int getInventoryCapacity()
|
||||
{
|
||||
return this.getInventory().length;
|
||||
return 36;
|
||||
}
|
||||
|
||||
// END OTHER
|
||||
|
|
|
@ -87,6 +87,10 @@ public class EntityPrimarch extends EntityMobNPC {
|
|||
super(worldIn);
|
||||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 48;
|
||||
}
|
||||
|
||||
// public boolean isAggressive() {
|
||||
// return false;
|
||||
// }
|
||||
|
|
|
@ -42,6 +42,10 @@ public class EntitySlime extends EntityNPC
|
|||
this.noPickup = true;
|
||||
}
|
||||
|
||||
public int getInventoryCapacity() {
|
||||
return 60;
|
||||
}
|
||||
|
||||
// public boolean isAggressive() {
|
||||
// return true;
|
||||
// }
|
||||
|
|
|
@ -1981,7 +1981,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
if(msg.length() > 30)
|
||||
throw new IllegalArgumentException("Ungültiger Name");
|
||||
if(packetIn.getArg() == -1)
|
||||
this.entity.inventoryContainer.renameItem(5 + Equipment.ARMOR_SLOTS + 27 + this.entity.getSelectedIndex(), msg);
|
||||
this.entity.inventoryContainer.renameItem(5 + Equipment.ARMOR_SLOTS + this.entity.getSelectedIndex(), msg);
|
||||
else
|
||||
this.entity.openContainer.renameItem(packetIn.getArg(), msg);
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue