alter item limiting
This commit is contained in:
parent
cb88dc3a4f
commit
27bd576c6e
78 changed files with 234 additions and 933 deletions
|
@ -6,8 +6,6 @@ import common.block.artificial.BlockStairs;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.pathfinding.WalkNodeProcessor;
|
||||
import common.util.LocalPos;
|
||||
import common.util.ExtMath;
|
||||
|
@ -170,16 +168,6 @@ public class EntityAIControlledByPlayer extends EntityAIBase
|
|||
}
|
||||
}
|
||||
|
||||
if (/* !entityplayer.creative && */ this.currentSpeed >= this.maxSpeed * 0.5F && this.thisEntity.getRNG().floatv() < 0.006F && !this.speedBoosted)
|
||||
{
|
||||
ItemStack itemstack = entityplayer.getHeldItem();
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == Items.whip)
|
||||
{
|
||||
itemstack.damage(1, entityplayer);
|
||||
}
|
||||
}
|
||||
|
||||
this.thisEntity.moveEntityWithHeading(0.0F, f1);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class EntityAITakePlace extends EntityAIBase
|
|||
Block block = state.getBlock();
|
||||
|
||||
if (STEALABLE.containsKey(state) &&
|
||||
(this.entity.getHeldItem() == null || (STEALABLE.get(state) == this.entity.getHeldItem().getItem() && !this.entity.getHeldItem().isFull())))
|
||||
(this.entity.getHeldItem() == null || (STEALABLE.get(state) == this.entity.getHeldItem().getItem())))
|
||||
{
|
||||
this.entity.getLookHelper().setLookPosition((double)i + 0.5, (double)j + 0.5, (double)k + 0.5, 10.0F,
|
||||
(float)this.entity.getVerticalFaceSpeed());
|
||||
|
|
|
@ -35,7 +35,6 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.ItemWeight;
|
||||
import common.log.Log;
|
||||
import common.model.Model;
|
||||
import common.model.Model.ModelProvider;
|
||||
import common.model.GuiPosition;
|
||||
|
|
|
@ -2,7 +2,6 @@ package common.block.natural;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
|
|
|
@ -8,7 +8,7 @@ import common.entity.item.EntityFalling;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.inventory.Container;
|
||||
import common.inventory.ContainerRepair;
|
||||
import common.inventory.ContainerMagicCombiner;
|
||||
import common.item.CheatTab;
|
||||
import common.model.Model;
|
||||
import common.model.Model.ModelProvider;
|
||||
|
@ -16,7 +16,6 @@ import common.model.ModelRotation;
|
|||
import common.properties.Property;
|
||||
import common.util.LocalPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
|
@ -153,7 +152,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable
|
|||
|
||||
public Container createContainer(EntityNPC playerInventory)
|
||||
{
|
||||
return new ContainerRepair(playerInventory, this.world, this.position);
|
||||
return new ContainerMagicCombiner(playerInventory, this.world, this.position);
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
|
|
|
@ -96,11 +96,7 @@ public class BlockTNT extends Block
|
|||
this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn);
|
||||
worldIn.setBlockToAir(pos);
|
||||
|
||||
if (item == Items.lighter)
|
||||
{
|
||||
playerIn.getHeldItem().damage(1, playerIn);
|
||||
}
|
||||
else // if (!playerIn.creative)
|
||||
if (item == Items.fireball)
|
||||
{
|
||||
playerIn.getHeldItem().decrSize();
|
||||
}
|
||||
|
|
|
@ -32,9 +32,7 @@ public class BlockToggleableLight extends Block {
|
|||
Item item = player.getHeldItem().getItem();
|
||||
if(item != Items.lighter && item != Items.fireball)
|
||||
return super.onUse(worldIn, pos, state, player, side, hitX, hitY, hitZ);
|
||||
if(item == Items.lighter)
|
||||
player.getHeldItem().damage(1, player);
|
||||
else
|
||||
if(item == Items.fireball)
|
||||
player.getHeldItem().decrSize();
|
||||
}
|
||||
this.toggle(worldIn, pos);
|
||||
|
|
|
@ -35,12 +35,8 @@ public class BlockUnlitTorch extends BlockTorch {
|
|||
worldIn.setState(pos, this.lit.getState().withProperty(FACING, state.getValue(FACING)).withProperty(BlockLitTorch.FUEL, 7), 3);
|
||||
worldIn.playEffect(playerIn, 1007, pos, 0);
|
||||
|
||||
if(item == Items.lighter) {
|
||||
playerIn.getHeldItem().damage(1, playerIn);
|
||||
}
|
||||
else {
|
||||
if(item == Items.fireball)
|
||||
playerIn.getHeldItem().decrSize();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -147,33 +147,16 @@ public enum Effect {
|
|||
int k = 40 >> amp;
|
||||
if(k > 0 && duration % k != 0)
|
||||
return;
|
||||
for(ItemStack stack : npc.getInventory()) {
|
||||
int n = entity.worldObj.rand.zrange(npc.getInventory().length);
|
||||
for(int z = 0; z < npc.getInventory().length; z++) {
|
||||
ItemStack stack = npc.getInventory()[n];
|
||||
if(++n >= npc.getInventory().length)
|
||||
n = 0;
|
||||
if(stack != null && !stack.isEmpty()) {
|
||||
if(!stack.isFull())
|
||||
if(stack.getSize() < 100) {
|
||||
stack.incrSize();
|
||||
if(stack.getRepairCost() > 0)
|
||||
stack.setRepairCost(stack.getRepairCost() - 1);
|
||||
if(stack.isItemStackDamageable() && stack.getItemDamage() > 0)
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
if(!npc.isPlayer() && npc.getHeldItem() != null && !npc.getHeldItem().isEmpty()) {
|
||||
ItemStack stack = npc.getHeldItem();
|
||||
if(!stack.isFull())
|
||||
stack.incrSize();
|
||||
if(stack.getRepairCost() > 0)
|
||||
stack.setRepairCost(stack.getRepairCost() - 1);
|
||||
if(stack.isItemStackDamageable() && stack.getItemDamage() > 0)
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
for(ItemStack stack : npc.getArmor()) {
|
||||
if(stack != null && !stack.isEmpty()) {
|
||||
if(!stack.isFull())
|
||||
stack.incrSize();
|
||||
if(stack.getRepairCost() > 0)
|
||||
stack.setRepairCost(stack.getRepairCost() - 1);
|
||||
if(stack.isItemStackDamageable() && stack.getItemDamage() > 0)
|
||||
stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,15 +196,6 @@ public enum Enchantment implements Displayable, Identifyable
|
|||
attacker.attackEntityFrom(DamageSource.causeThornsDamage(user), getThornsDamage(level, random));
|
||||
// attacker.playSound("damage.thorns", 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
itemstack.damage(3, user);
|
||||
}
|
||||
}
|
||||
else if (itemstack != null)
|
||||
{
|
||||
itemstack.damage(1, user);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -320,27 +311,6 @@ public enum Enchantment implements Displayable, Identifyable
|
|||
return super.canApplyTogether(ench) && ench != FORTUNE;
|
||||
}
|
||||
},
|
||||
UNBREAKING("unbreaking", 5, EnchantmentType.BREAKABLE, "Haltbarkeit") {
|
||||
public int getMinEnchantability(int enchantmentLevel)
|
||||
{
|
||||
return 5 + (enchantmentLevel - 1) * 8;
|
||||
}
|
||||
|
||||
public int getMaxEnchantability(int enchantmentLevel)
|
||||
{
|
||||
return super.getMinEnchantability(enchantmentLevel) + 50;
|
||||
}
|
||||
|
||||
public int getMaxLevel()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public boolean canApply(ItemStack stack)
|
||||
{
|
||||
return stack.isItemStackDamageable() || super.canApply(stack);
|
||||
}
|
||||
},
|
||||
FORTUNE("fortune", 2, EnchantmentType.DIGGER, "Glück") {
|
||||
public int getMinEnchantability(int enchantmentLevel)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@ public enum EnchantmentType
|
|||
WEAPON,
|
||||
DIGGER,
|
||||
FISHING_ROD,
|
||||
BREAKABLE,
|
||||
BOW;
|
||||
|
||||
public boolean canEnchantItem(Item item)
|
||||
|
@ -29,10 +28,6 @@ public enum EnchantmentType
|
|||
{
|
||||
return true;
|
||||
}
|
||||
else if (this == BREAKABLE && item.isDamageable())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (item instanceof ItemArmor armor)
|
||||
{
|
||||
return (this == ARMOR && armor.getArmorType().isMainArmor()) || armor.getArmorType().getEnchantmentType() == this;
|
||||
|
|
|
@ -7,7 +7,6 @@ import common.entity.EntityType;
|
|||
import common.entity.npc.Alignment;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.SoundEvent;
|
||||
import common.tags.TagObject;
|
||||
import common.util.LocalPos;
|
||||
import common.util.ExtMath;
|
||||
|
|
|
@ -21,7 +21,6 @@ import common.entity.types.EntityAnimal;
|
|||
import common.entity.types.EntityLiving;
|
||||
import common.entity.types.EntityTameable;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.consumable.ItemFishFood;
|
||||
|
|
|
@ -12,7 +12,6 @@ import common.entity.npc.EntityNPC;
|
|||
import common.entity.types.EntityAnimal;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.pathfinding.PathNavigateGround;
|
||||
|
|
|
@ -15,7 +15,6 @@ import common.entity.npc.Alignment;
|
|||
import common.entity.types.EntityAnimal;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.pathfinding.PathNavigateGround;
|
||||
|
|
|
@ -10,7 +10,6 @@ import common.ai.EntityAIRunAroundLikeCrazy;
|
|||
import common.ai.EntityAISwimming;
|
||||
import common.ai.EntityAIWander;
|
||||
import common.ai.EntityAIWatchClosest;
|
||||
import common.block.Block;
|
||||
import common.collect.Lists;
|
||||
import common.effect.Effect;
|
||||
import common.entity.DamageSource;
|
||||
|
|
|
@ -10,13 +10,11 @@ import common.ai.EntityAISwimming;
|
|||
import common.ai.EntityAITempt;
|
||||
import common.ai.EntityAIWander;
|
||||
import common.ai.EntityAIWatchClosest;
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityAnimal;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.ItemStack;
|
||||
import common.util.LocalPos;
|
||||
import common.world.World;
|
||||
|
|
|
@ -13,7 +13,6 @@ import common.entity.npc.EntityNPC;
|
|||
import common.entity.types.EntityAnimal;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.pathfinding.PathNavigateGround;
|
||||
|
|
|
@ -28,7 +28,6 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.pathfinding.PathEntity;
|
||||
|
|
|
@ -172,7 +172,6 @@ public class EntitySheep extends EntityAnimal
|
|||
}
|
||||
}
|
||||
|
||||
itemstack.damage(1, player);
|
||||
this.playSound(SoundEvent.POP, 0.25F);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import common.entity.types.EntityAnimal;
|
|||
import common.entity.types.EntityLiving;
|
||||
import common.entity.types.EntityTameable;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.consumable.ItemFood;
|
||||
|
|
|
@ -219,10 +219,6 @@ public class EntityItem extends Entity
|
|||
{
|
||||
return other.combineItems(this);
|
||||
}
|
||||
else if (otherStack.getSize() + stack.getSize() > otherStack.getMaxStackSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
otherStack.incrSize(stack.getSize());
|
||||
|
@ -431,7 +427,7 @@ public class EntityItem extends Entity
|
|||
public String getName()
|
||||
{
|
||||
ItemStack stack = this.getEntityItem();
|
||||
return this.getTypeName() + " (" + (stack.isStacked() ? stack.getSize() + " * " : "") + stack.getItem().getDisplay() + ")";
|
||||
return this.getTypeName() + " (" + (stack.getSize() > 1 ? stack.getSize() + " * " : "") + stack.getItem().getDisplay() + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -577,7 +573,7 @@ public class EntityItem extends Entity
|
|||
public String getLabel()
|
||||
{
|
||||
ItemStack stack = this.getEntityItem();
|
||||
if(!stack.isStacked())
|
||||
if(stack.getSize() <= 1)
|
||||
return null;
|
||||
return Color.DARK_GREEN + "" + stack.getSize();
|
||||
}
|
||||
|
|
|
@ -236,7 +236,6 @@ public class EntityHaunter extends EntityNPC {
|
|||
if (!this.worldObj.client)
|
||||
{
|
||||
this.ignite();
|
||||
itemstack.damage(1, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1313,7 +1313,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
accept = itemsword.getAttackDamageBonus(stack) > itemsword1.getAttackDamageBonus(old);
|
||||
}
|
||||
else {
|
||||
accept = stack.getItemDamage() > old.getItemDamage() || stack.isItemEnchanted() && !old.isItemEnchanted();
|
||||
accept = stack.isItemEnchanted() && !old.isItemEnchanted();
|
||||
}
|
||||
}
|
||||
else if(stack.getItem() instanceof ItemBow && old.getItem() instanceof ItemBow) {
|
||||
|
@ -1340,7 +1340,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
accept = itemarmor.getArmorValue() > itemarmor1.getArmorValue();
|
||||
}
|
||||
else {
|
||||
accept = stack.getItemDamage() > old.getItemDamage() || stack.isItemEnchanted() && !old.isItemEnchanted();
|
||||
accept = stack.isItemEnchanted() && !old.isItemEnchanted();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -2566,7 +2566,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
{
|
||||
for (int i = 0; i < Equipment.INVENTORY_SLOTS; ++i)
|
||||
{
|
||||
if (this.getInventory()[i] != null && this.getInventory()[i].getItem() == itemStackIn.getItem() && this.getInventory()[i].isStackable() && !this.getInventory()[i].isFull() && ItemStack.dataEquals(this.getInventory()[i], itemStackIn))
|
||||
if (this.getInventory()[i] != null && this.getInventory()[i].getItem() == itemStackIn.getItem() && ItemStack.dataEquals(this.getInventory()[i], itemStackIn))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
@ -2614,11 +2614,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
|
||||
int k = i;
|
||||
|
||||
if (i > this.getInventory()[j].getMaxStackSize() - this.getInventory()[j].getSize())
|
||||
{
|
||||
k = this.getInventory()[j].getMaxStackSize() - this.getInventory()[j].getSize();
|
||||
}
|
||||
|
||||
if (k == 0)
|
||||
{
|
||||
return i;
|
||||
|
@ -2661,38 +2656,20 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
{
|
||||
if (itemStackIn != null && !itemStackIn.isEmpty() && itemStackIn.getItem() != null)
|
||||
{
|
||||
if (itemStackIn.isItemDamaged())
|
||||
{
|
||||
int j = this.getFirstEmptyStack();
|
||||
int i;
|
||||
|
||||
if (j >= 0)
|
||||
while (true)
|
||||
{
|
||||
i = itemStackIn.getSize();
|
||||
itemStackIn.setSize(this.storePartialItemStack(itemStackIn));
|
||||
|
||||
if (itemStackIn.isEmpty() || itemStackIn.getSize() >= i)
|
||||
{
|
||||
this.getInventory()[j] = ItemStack.copy(itemStackIn);
|
||||
itemStackIn.setSize(0);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
while (true)
|
||||
{
|
||||
i = itemStackIn.getSize();
|
||||
itemStackIn.setSize(this.storePartialItemStack(itemStackIn));
|
||||
|
||||
if (itemStackIn.isEmpty() || itemStackIn.getSize() >= i)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return itemStackIn.getSize() < i;
|
||||
}
|
||||
return itemStackIn.getSize() < i;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2715,8 +2692,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
|
||||
if (ItemStack.itemEquals(itemstack1, itemstack))
|
||||
{
|
||||
int j = itemstack1.getMaxStackSize();
|
||||
int k = Math.min(itemstack.getSize(), j - itemstack1.getSize());
|
||||
int k = itemstack.getSize();
|
||||
|
||||
if (k > 0)
|
||||
{
|
||||
|
@ -3445,25 +3421,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
}
|
||||
}
|
||||
|
||||
protected void damageArmor(int damage)
|
||||
{
|
||||
if(this.isPlayer() || this.dummy) {
|
||||
damage = damage / 4;
|
||||
if (damage < 1)
|
||||
damage = 1;
|
||||
for (Equipment slot : Equipment.ARMOR)
|
||||
{
|
||||
ItemStack stack = this.getArmor(slot);
|
||||
if (stack != null && stack.getItem() instanceof ItemArmor && stack.isItemStackDamageable())
|
||||
{
|
||||
stack.damage(damage, this);
|
||||
if (stack.isEmpty())
|
||||
this.setArmor(slot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getTotalArmorValue()
|
||||
{
|
||||
int value = 0;
|
||||
|
|
|
@ -6,16 +6,16 @@ import common.rng.WeightedList;
|
|||
|
||||
public abstract class FishConstants {
|
||||
public static final WeightedList<RngFishable> FISHING_JUNK = new WeightedList<RngFishable>(
|
||||
(new RngFishable(new ItemStack(Items.leather_boots), 10)).setMaxDamagePercent(0.9F), new RngFishable(new ItemStack(Items.leather), 10),
|
||||
(new RngFishable(new ItemStack(Items.leather_boots), 10)), new RngFishable(new ItemStack(Items.leather), 10),
|
||||
new RngFishable(new ItemStack(Items.bone), 10), new RngFishable(new ItemStack(Items.water_bottle), 10),
|
||||
new RngFishable(new ItemStack(Items.string), 5), (new RngFishable(new ItemStack(Items.fishing_rod), 2)).setMaxDamagePercent(0.9F),
|
||||
new RngFishable(new ItemStack(Items.string), 5), (new RngFishable(new ItemStack(Items.fishing_rod), 2)),
|
||||
new RngFishable(new ItemStack(Items.stick), 5), new RngFishable(new ItemStack(Items.ink_sack, 10), 1),
|
||||
new RngFishable(new ItemStack(Items.hook), 10), new RngFishable(new ItemStack(Items.rotten_flesh), 10));
|
||||
public static final WeightedList<RngFishable> FISHING_TREASURE = new WeightedList<RngFishable>(
|
||||
new RngFishable(new ItemStack(Items.waterlily), 1), new RngFishable(new ItemStack(Items.name_tag), 1),
|
||||
new RngFishable(new ItemStack(Items.saddle), 1),
|
||||
(new RngFishable(new ItemStack(Items.bow), 1)).setMaxDamagePercent(0.25F).setEnchantable(),
|
||||
(new RngFishable(new ItemStack(Items.fishing_rod), 1)).setMaxDamagePercent(0.25F).setEnchantable(),
|
||||
(new RngFishable(new ItemStack(Items.bow), 1)).setEnchantable(),
|
||||
(new RngFishable(new ItemStack(Items.fishing_rod), 1)).setEnchantable(),
|
||||
(new RngFishable(new ItemStack(Items.book), 1)).setEnchantable());
|
||||
public static final WeightedList<RngFishable> FISH_TYPES = new WeightedList<RngFishable>(
|
||||
new RngFishable(new ItemStack(Items.cod), 60),
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.rng.RngItem;
|
|||
public class RngFishable extends RngItem
|
||||
{
|
||||
private final ItemStack returnStack;
|
||||
private float maxDamagePercent;
|
||||
private boolean enchantable;
|
||||
|
||||
public RngFishable(ItemStack returnStackIn, int itemWeightIn)
|
||||
|
@ -21,24 +20,6 @@ public class RngFishable extends RngItem
|
|||
{
|
||||
ItemStack itemstack = this.returnStack.copy();
|
||||
|
||||
if (this.maxDamagePercent > 0.0F)
|
||||
{
|
||||
int i = (int)(this.maxDamagePercent * (float)this.returnStack.getMaxDamage());
|
||||
int j = itemstack.getMaxDamage() - random.zrange(random.zrange(i) + 1);
|
||||
|
||||
if (j > i)
|
||||
{
|
||||
j = i;
|
||||
}
|
||||
|
||||
if (j < 1)
|
||||
{
|
||||
j = 1;
|
||||
}
|
||||
|
||||
itemstack.setItemDamage(j);
|
||||
}
|
||||
|
||||
if (this.enchantable)
|
||||
{
|
||||
EnchantmentHelper.addRandomEnchantment(random, itemstack, 30);
|
||||
|
@ -47,12 +28,6 @@ public class RngFishable extends RngItem
|
|||
return itemstack;
|
||||
}
|
||||
|
||||
public RngFishable setMaxDamagePercent(float maxDamagePercentIn)
|
||||
{
|
||||
this.maxDamagePercent = maxDamagePercentIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RngFishable setEnchantable()
|
||||
{
|
||||
this.enchantable = true;
|
||||
|
|
|
@ -33,7 +33,6 @@ import common.entity.projectile.EntityArrow;
|
|||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
|
@ -51,7 +50,6 @@ import common.util.LocalPos;
|
|||
import common.util.BoundingBox;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Equipment;
|
||||
import common.util.ParticleType;
|
||||
import common.util.Serverside;
|
||||
import common.util.Color;
|
||||
|
@ -871,12 +869,6 @@ public abstract class EntityLiving extends Entity
|
|||
}
|
||||
else
|
||||
{
|
||||
if (this instanceof EntityNPC npc && (source == DamageSource.anvil || source == DamageSource.fallingBlock) && npc.getArmor(Equipment.HELMET) != null)
|
||||
{
|
||||
npc.getArmor(Equipment.HELMET).damage((int)(amount * 4.0F + this.rand.floatv() * (float)amount * 2.0F), this);
|
||||
amount = (int)((float)amount * 0.75F);
|
||||
}
|
||||
|
||||
this.lswingAmount = 1.5F;
|
||||
boolean flag = true;
|
||||
|
||||
|
@ -980,27 +972,6 @@ public abstract class EntityLiving extends Entity
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders broken item particles using the given ItemStack
|
||||
*/
|
||||
public void renderBrokenItemStack(ItemStack stack)
|
||||
{
|
||||
this.playSound(SoundEvent.BREAK, 0.8F);
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
Vec3 vec3 = new Vec3(((double)this.rand.floatv() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
|
||||
vec3 = vec3.pitch(-this.rotPitch * (float)Math.PI / 180.0F);
|
||||
vec3 = vec3.yaw(-this.rotYaw * (float)Math.PI / 180.0F);
|
||||
double d0 = (double)(-this.rand.floatv()) * 0.6D - 0.3D;
|
||||
Vec3 vec31 = new Vec3(((double)this.rand.floatv() - 0.5D) * 0.3D, d0, 0.6D);
|
||||
vec31 = vec31.pitch(-this.rotPitch * (float)Math.PI / 180.0F);
|
||||
vec31 = vec31.yaw(-this.rotYaw * (float)Math.PI / 180.0F);
|
||||
vec31 = vec31.add(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
|
||||
this.worldObj.clientParticle(ParticleType.ITEM_CRACK, vec31.x, vec31.y, vec31.z, ItemRegistry.getId(stack.getItem()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mob's health reaches 0.
|
||||
*/
|
||||
|
|
|
@ -329,12 +329,8 @@ public abstract class CraftingRegistry
|
|||
break;
|
||||
}
|
||||
else if(current != null && stack.itemEquals(current) && stack.dataEquals(current)) {
|
||||
int incr = Math.min(amount, current.getMaxStackSize() - current.getSize());
|
||||
if(incr > 0) {
|
||||
amount -= incr;
|
||||
if(amount <= 0)
|
||||
break;
|
||||
}
|
||||
amount = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(amount > 0)
|
||||
|
@ -392,14 +388,10 @@ public abstract class CraftingRegistry
|
|||
break;
|
||||
}
|
||||
else if(current != null && stack.itemEquals(current) && stack.dataEquals(current)) {
|
||||
int incr = Math.min(amount, current.getMaxStackSize() - current.getSize());
|
||||
if(incr > 0) {
|
||||
current.incrSize(incr);
|
||||
output.setInventorySlotContents(z, current);
|
||||
amount -= incr;
|
||||
if(amount <= 0)
|
||||
break;
|
||||
}
|
||||
current.incrSize(amount);
|
||||
output.setInventorySlotContents(z, current);
|
||||
amount = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(amount > 0 && output instanceof EntityNPC entity)
|
||||
|
|
|
@ -139,8 +139,6 @@ public abstract class ItemRegistry {
|
|||
if(item != null) {
|
||||
if(item.getTab() == null || !item.getTab().isBlockTab())
|
||||
throw new IllegalArgumentException("Gegenstand für " + BlockRegistry.getName(block) + " muss einen Block-Tab besitzen");
|
||||
if(item.getMaxAmount() == 1)
|
||||
throw new IllegalArgumentException("Gegenstand für " + BlockRegistry.getName(block) + " muss stapelbar sein");
|
||||
ITEMS.add(item);
|
||||
ITEM_MAP.put(BlockRegistry.getName(block), item);
|
||||
ITEM_IDS.put(item, ITEMS.size());
|
||||
|
@ -286,11 +284,11 @@ public abstract class ItemRegistry {
|
|||
register("whip", (new ItemWhip()).setDisplay("Peitsche"));
|
||||
register("charge_crystal", (new Item()).setDisplay("Energiekristall").setTab(CheatTab.MATERIALS).setColor(Color.DARK_MAGENTA).setFuelAmount(120000));
|
||||
for(Enchantment ench : Enchantment.values()) {
|
||||
register("enchanted_book_" + ench.getName(), (new ItemEnchantedBook(ench, 1)).setUnstackable().setDisplay("Verzaubertes Buch mit " + ench.getFormattedName(1)).setTab(CheatTab.ENCHANTMENTS));
|
||||
register("enchanted_book_" + ench.getName(), (new ItemEnchantedBook(ench, 1)).setDisplay("Verzaubertes Buch mit " + ench.getFormattedName(1)).setTab(CheatTab.ENCHANTMENTS));
|
||||
int max = ench.getMaxLevel();
|
||||
for(int level = 2; level <= max; level++) {
|
||||
if((level % 2 == 1 || level == max) && (level != max - 1))
|
||||
register("enchanted_book_" + ench.getName() + "_" + level, (new ItemEnchantedBook(ench, level)).setUnstackable().setDisplay("Verzaubertes Buch mit " + ench.getFormattedName(level)).setTab(CheatTab.ENCHANTMENTS));
|
||||
register("enchanted_book_" + ench.getName() + "_" + level, (new ItemEnchantedBook(ench, level)).setDisplay("Verzaubertes Buch mit " + ench.getFormattedName(level)).setTab(CheatTab.ENCHANTMENTS));
|
||||
}
|
||||
}
|
||||
register("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS));
|
||||
|
|
|
@ -858,8 +858,6 @@ public abstract class Items {
|
|||
public static final ItemEnchantedBook enchanted_book_silk_touch = get("enchanted_book_silk_touch");
|
||||
public static final ItemEnchantedBook enchanted_book_thorns = get("enchanted_book_thorns");
|
||||
public static final ItemEnchantedBook enchanted_book_thorns_3 = get("enchanted_book_thorns_3");
|
||||
public static final ItemEnchantedBook enchanted_book_unbreaking = get("enchanted_book_unbreaking");
|
||||
public static final ItemEnchantedBook enchanted_book_unbreaking_3 = get("enchanted_book_unbreaking_3");
|
||||
public static final ItemEnchantedBook enchanted_book_vanity = get("enchanted_book_vanity");
|
||||
public static final ItemRocketLauncher rocket_launcher = get("rocket_launcher");
|
||||
public static final ItemAmmo rocket = get("rocket");
|
||||
|
|
|
@ -8,12 +8,10 @@ import common.util.Equipment;
|
|||
|
||||
public class ToolMaterial {
|
||||
private final int harvestLevel;
|
||||
private final int durability;
|
||||
private final int damage;
|
||||
private final float radiationResistance;
|
||||
private final float magicResistance;
|
||||
private final int enchantability;
|
||||
private final int maxDamageFactor;
|
||||
private final int[] damageReduction;
|
||||
private final int armorEnchantability;
|
||||
private final Set<Item> repair = Sets.newHashSet();
|
||||
|
@ -23,10 +21,8 @@ public class ToolMaterial {
|
|||
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, int d, int damage, int ench, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this.harvestLevel = level;
|
||||
this.durability = uses;
|
||||
this.damage = damage;
|
||||
this.enchantability = ench;
|
||||
this.maxDamageFactor = auses;
|
||||
this.damageReduction = new int[] {r1, r2, r3, r4};
|
||||
this.armorEnchantability = aench;
|
||||
this.radiationResistance = rad;
|
||||
|
@ -47,10 +43,6 @@ public class ToolMaterial {
|
|||
this.repair.add(item);
|
||||
}
|
||||
|
||||
public int getDurability() {
|
||||
return this.durability;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return this.damage;
|
||||
}
|
||||
|
@ -67,10 +59,6 @@ public class ToolMaterial {
|
|||
return this.repair.contains(item);
|
||||
}
|
||||
|
||||
public int getDurability(Equipment armorType) {
|
||||
return armorType.getDamage() * this.maxDamageFactor;
|
||||
}
|
||||
|
||||
public float getRadiationReduction(Equipment armorType) {
|
||||
return armorType.getPhysicalResistance() * this.radiationResistance;
|
||||
}
|
||||
|
|
|
@ -284,11 +284,6 @@ public abstract class Container
|
|||
i2 = slot7.getItemStackLimit(itemstack10) - itemstack9.getSize();
|
||||
}
|
||||
|
||||
if (i2 > itemstack10.getMaxStackSize() - itemstack9.getSize())
|
||||
{
|
||||
i2 = itemstack10.getMaxStackSize() - itemstack9.getSize();
|
||||
}
|
||||
|
||||
itemstack10.split(i2);
|
||||
|
||||
if (itemstack10.isEmpty())
|
||||
|
@ -304,11 +299,11 @@ public abstract class Container
|
|||
playerIn.setMouseItem(itemstack9);
|
||||
}
|
||||
}
|
||||
else if (itemstack9.getItem() == itemstack10.getItem() && itemstack10.getMaxStackSize() > 1 && ItemStack.dataEquals(itemstack9, itemstack10))
|
||||
else if (itemstack9.getItem() == itemstack10.getItem() && ItemStack.dataEquals(itemstack9, itemstack10))
|
||||
{
|
||||
int l1 = itemstack9.getSize();
|
||||
|
||||
if (l1 > 0 && l1 + itemstack10.getSize() <= itemstack10.getMaxStackSize())
|
||||
if (l1 > 0)
|
||||
{
|
||||
itemstack10.incrSize(l1);
|
||||
itemstack9 = slot7.decrStackSize(l1);
|
||||
|
@ -404,15 +399,15 @@ public abstract class Container
|
|||
int i1 = clickedButton == 0 ? 0 : this.inventorySlots.size() - 1;
|
||||
int j1 = clickedButton == 0 ? 1 : -1;
|
||||
|
||||
for (int l2 = 0; l2 < 2; ++l2)
|
||||
for (int l2 = 0; l2 < 2; ++l2) //TODO: check if still necessary
|
||||
{
|
||||
for (int i3 = i1; i3 >= 0 && i3 < this.inventorySlots.size() && !itemstack4.isFull(); i3 += j1)
|
||||
for (int i3 = i1; i3 >= 0 && i3 < this.inventorySlots.size(); i3 += j1)
|
||||
{
|
||||
Slot slot8 = (Slot)this.inventorySlots.get(i3);
|
||||
|
||||
if (slot8.getHasStack() && canAddItemToSlot(slot8, itemstack4, true) && slot8.canTakeStack(playerIn) && this.canMergeSlot(itemstack4, slot8) && (l2 != 0 || !slot8.getStack().isFull()))
|
||||
if (slot8.getHasStack() && canAddItemToSlot(slot8, itemstack4) && slot8.canTakeStack(playerIn) && this.canMergeSlot(itemstack4, slot8))
|
||||
{
|
||||
int l = Math.min(itemstack4.getMaxStackSize() - itemstack4.getSize(), slot8.getStack().getSize());
|
||||
int l = slot8.getStack().getSize();
|
||||
ItemStack itemstack2 = slot8.decrStackSize(l);
|
||||
itemstack4.incrSize(l);
|
||||
|
||||
|
@ -603,35 +598,22 @@ public abstract class Container
|
|||
boolean flag = false;
|
||||
int i = startIndex;
|
||||
|
||||
if (stack.isStackable())
|
||||
while (!stack.isEmpty() && i < endIndex)
|
||||
{
|
||||
while (!stack.isEmpty() && i < endIndex)
|
||||
Slot slot = (Slot)this.inventorySlots.get(i);
|
||||
ItemStack itemstack = slot.getStack();
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == stack.getItem() && ItemStack.dataEquals(stack, itemstack))
|
||||
{
|
||||
Slot slot = (Slot)this.inventorySlots.get(i);
|
||||
ItemStack itemstack = slot.getStack();
|
||||
int j = itemstack.getSize() + stack.getSize();
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == stack.getItem() && ItemStack.dataEquals(stack, itemstack))
|
||||
{
|
||||
int j = itemstack.getSize() + stack.getSize();
|
||||
|
||||
if (j <= stack.getMaxStackSize())
|
||||
{
|
||||
stack.setSize(0);
|
||||
itemstack.setSize(j);
|
||||
slot.onSlotChanged();
|
||||
flag = true;
|
||||
}
|
||||
else if (itemstack.getSize() < stack.getMaxStackSize())
|
||||
{
|
||||
stack.decrSize(stack.getMaxStackSize() - itemstack.getSize());
|
||||
itemstack.setSize(stack.getMaxStackSize());
|
||||
slot.onSlotChanged();
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
++i;
|
||||
stack.setSize(0);
|
||||
itemstack.setSize(j);
|
||||
slot.onSlotChanged();
|
||||
flag = true;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
if (!stack.isEmpty())
|
||||
|
@ -663,16 +645,13 @@ public abstract class Container
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if it's possible to add the given itemstack to the given slot.
|
||||
*/
|
||||
public static boolean canAddItemToSlot(Slot slotIn, ItemStack stack, boolean stackSizeMatters)
|
||||
public static boolean canAddItemToSlot(Slot slotIn, ItemStack stack)
|
||||
{
|
||||
boolean flag = slotIn == null || !slotIn.getHasStack();
|
||||
|
||||
if (slotIn != null && slotIn.getHasStack() && stack != null && stack.itemEquals(slotIn.getStack()) && ItemStack.dataEquals(slotIn.getStack(), stack))
|
||||
{
|
||||
flag |= slotIn.getStack().getSize() + (stackSizeMatters ? 0 : stack.getSize()) <= stack.getMaxStackSize();
|
||||
flag = true;
|
||||
}
|
||||
|
||||
return flag;
|
||||
|
|
|
@ -129,7 +129,7 @@ public class ContainerEnchantment extends Container
|
|||
{
|
||||
ItemStack itemstack = inventoryIn.getStackInSlot(0);
|
||||
|
||||
if (itemstack != null && itemstack.isItemEnchantable())
|
||||
if (itemstack != null && itemstack.getSize() == 1 && !itemstack.isItemEnchanted())
|
||||
{
|
||||
if (!this.world.client)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,10 @@ public class ContainerEntityInventory extends Container
|
|||
final EntityHorse horse = (EntityHorse)this.entity;
|
||||
this.addSlotToContainer(new Slot(entityInv, 0, false)
|
||||
{
|
||||
public boolean canStackItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isItemValid(ItemStack stack)
|
||||
{
|
||||
return super.isItemValid(stack) && stack.getItem() == Items.saddle && !this.getHasStack();
|
||||
|
@ -29,6 +33,10 @@ public class ContainerEntityInventory extends Container
|
|||
});
|
||||
this.addSlotToContainer(new Slot(entityInv, 1, false)
|
||||
{
|
||||
public boolean canStackItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isItemValid(ItemStack stack)
|
||||
{
|
||||
return super.isItemValid(stack) && horse.canWearArmor() && EntityHorse.isArmorItem(stack.getItem());
|
||||
|
|
|
@ -15,7 +15,7 @@ import common.vars.Vars;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class ContainerRepair extends Container
|
||||
public class ContainerMagicCombiner extends Container
|
||||
{
|
||||
private class InventoryCraftResult implements IInventory
|
||||
{
|
||||
|
@ -96,12 +96,12 @@ public class ContainerRepair extends Container
|
|||
public int maximumCost;
|
||||
private int materialCost;
|
||||
|
||||
public ContainerRepair(EntityNPC playerInventory, World worldIn)
|
||||
public ContainerMagicCombiner(EntityNPC playerInventory, World worldIn)
|
||||
{
|
||||
this(playerInventory, worldIn, LocalPos.ORIGIN);
|
||||
}
|
||||
|
||||
public ContainerRepair(EntityNPC playerInventory, final World worldIn, final LocalPos blockPosIn)
|
||||
public ContainerMagicCombiner(EntityNPC playerInventory, final World worldIn, final LocalPos blockPosIn)
|
||||
{
|
||||
this.outputSlot = new InventoryCraftResult();
|
||||
this.inputSlots = new InventoryBasic(2)
|
||||
|
@ -109,17 +109,25 @@ public class ContainerRepair extends Container
|
|||
public void markDirty()
|
||||
{
|
||||
super.markDirty();
|
||||
ContainerRepair.this.onChanged(this);
|
||||
ContainerMagicCombiner.this.onChanged();
|
||||
}
|
||||
};
|
||||
this.selfPosition = blockPosIn;
|
||||
this.theWorld = worldIn;
|
||||
this.addSlotToContainer(new Slot(this.inputSlots, 0, false) {
|
||||
public boolean canStackItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEditItem() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
this.addSlotToContainer(new Slot(this.inputSlots, 1, false) {
|
||||
public boolean canStackItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEditItem() {
|
||||
return false;
|
||||
}
|
||||
|
@ -132,38 +140,38 @@ public class ContainerRepair extends Container
|
|||
}
|
||||
public boolean canTakeStack(EntityNPC playerIn)
|
||||
{
|
||||
return /* (playerIn.creative || */ playerIn.getManaPoints() >= ContainerRepair.this.maximumCost /* ) */ && ContainerRepair.this.maximumCost > 0 && this.getHasStack();
|
||||
return /* (playerIn.creative || */ (playerIn.getManaPoints() >= ContainerMagicCombiner.this.maximumCost || !Vars.magicComboMana) /* ) */ && ContainerMagicCombiner.this.maximumCost > 0 && this.getHasStack();
|
||||
}
|
||||
public void onPickupFromSlot(EntityNPC playerIn, ItemStack stack)
|
||||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
if(!playerIn.worldObj.client)
|
||||
playerIn.useMana(ContainerRepair.this.maximumCost);
|
||||
if(!playerIn.worldObj.client && Vars.magicComboMana)
|
||||
playerIn.useMana(ContainerMagicCombiner.this.maximumCost);
|
||||
// }
|
||||
|
||||
ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null);
|
||||
ContainerMagicCombiner.this.inputSlots.setInventorySlotContents(0, (ItemStack)null);
|
||||
|
||||
if (ContainerRepair.this.materialCost > 0)
|
||||
if (ContainerMagicCombiner.this.materialCost > 0)
|
||||
{
|
||||
ItemStack itemstack = ContainerRepair.this.inputSlots.getStackInSlot(1);
|
||||
ItemStack itemstack = ContainerMagicCombiner.this.inputSlots.getStackInSlot(1);
|
||||
|
||||
if (itemstack != null && itemstack.getSize() > ContainerRepair.this.materialCost)
|
||||
if (itemstack != null && itemstack.getSize() > ContainerMagicCombiner.this.materialCost)
|
||||
{
|
||||
itemstack.decrSize(ContainerRepair.this.materialCost);
|
||||
ContainerRepair.this.inputSlots.setInventorySlotContents(1, itemstack);
|
||||
itemstack.decrSize(ContainerMagicCombiner.this.materialCost);
|
||||
ContainerMagicCombiner.this.inputSlots.setInventorySlotContents(1, itemstack);
|
||||
}
|
||||
else
|
||||
{
|
||||
ContainerRepair.this.inputSlots.setInventorySlotContents(1, (ItemStack)null);
|
||||
ContainerMagicCombiner.this.inputSlots.setInventorySlotContents(1, (ItemStack)null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ContainerRepair.this.inputSlots.setInventorySlotContents(1, (ItemStack)null);
|
||||
ContainerMagicCombiner.this.inputSlots.setInventorySlotContents(1, (ItemStack)null);
|
||||
}
|
||||
|
||||
ContainerRepair.this.maximumCost = 0;
|
||||
ContainerMagicCombiner.this.maximumCost = 0;
|
||||
State iblockstate = worldIn.getState(blockPosIn);
|
||||
|
||||
if (/* !playerIn.creative && */ !worldIn.client && Vars.anvilRepairDecay && iblockstate.getBlock() instanceof BlockAnvil anvil && playerIn.getRNG().floatv() < 0.12F)
|
||||
|
@ -196,17 +204,9 @@ public class ContainerRepair extends Container
|
|||
this.addPlayerSlots(playerInventory);
|
||||
}
|
||||
|
||||
private void onChanged(IInventory inventoryIn)
|
||||
private void onChanged()
|
||||
{
|
||||
this.detectAndSendChanges();
|
||||
this.updateRepairOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* called when the Anvil Input Slot changes, calculates the new result and puts it in the output slot
|
||||
*/
|
||||
public void updateRepairOutput()
|
||||
{
|
||||
// int i = 0;
|
||||
// int j = 1;
|
||||
// int k = 1;
|
||||
|
@ -217,8 +217,6 @@ public class ContainerRepair extends Container
|
|||
ItemStack stack = this.inputSlots.getStackInSlot(0);
|
||||
this.maximumCost = 1;
|
||||
int totalCost = 0;
|
||||
int repairCost = 0;
|
||||
int renameCost = 0;
|
||||
|
||||
if (stack == null)
|
||||
{
|
||||
|
@ -231,152 +229,105 @@ public class ContainerRepair extends Container
|
|||
ItemStack repStack = this.inputSlots.getStackInSlot(1);
|
||||
Map<Enchantment, Integer> newEnch = EnchantmentHelper.getEnchantments(newStack);
|
||||
boolean isBook = false;
|
||||
repairCost = repairCost + stack.getRepairCost() + (repStack == null ? 0 : repStack.getRepairCost());
|
||||
this.materialCost = 0;
|
||||
|
||||
if (repStack != null)
|
||||
{
|
||||
isBook = repStack.getItem() instanceof ItemEnchantedBook;
|
||||
|
||||
if (newStack.isItemStackDamageable() && newStack.getItem().getIsRepairable(stack, repStack))
|
||||
if (!isBook && (newStack.getItem() != repStack.getItem()))
|
||||
{
|
||||
int damage = Math.min(newStack.getItemDamage(), newStack.getMaxDamage() / 4);
|
||||
|
||||
if (damage <= 0)
|
||||
{
|
||||
this.outputSlot.setInventorySlotContents(0, (ItemStack)null);
|
||||
this.maximumCost = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
int cost;
|
||||
|
||||
for (cost = 0; damage > 0 && cost < repStack.getSize(); ++cost)
|
||||
{
|
||||
int j5 = newStack.getItemDamage() - damage;
|
||||
newStack.setItemDamage(j5);
|
||||
++totalCost;
|
||||
damage = Math.min(newStack.getItemDamage(), newStack.getMaxDamage() / 4);
|
||||
}
|
||||
|
||||
this.materialCost = cost;
|
||||
this.outputSlot.setInventorySlotContents(0, (ItemStack)null);
|
||||
this.maximumCost = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
Map<Enchantment, Integer> ench = EnchantmentHelper.getEnchantments(repStack);
|
||||
Iterator<Enchantment> enchs = ench.keySet().iterator();
|
||||
|
||||
while (enchs.hasNext())
|
||||
{
|
||||
if (!isBook && (newStack.getItem() != repStack.getItem() || !newStack.isItemStackDamageable()))
|
||||
{
|
||||
this.outputSlot.setInventorySlotContents(0, (ItemStack)null);
|
||||
this.maximumCost = 0;
|
||||
return;
|
||||
}
|
||||
Enchantment enchantment = enchs.next();
|
||||
|
||||
if (newStack.isItemStackDamageable() && !isBook)
|
||||
if (enchantment != null)
|
||||
{
|
||||
int mainDmg = stack.getMaxDamage() - stack.getItemDamage();
|
||||
int repDmg = repStack.getMaxDamage() - repStack.getItemDamage();
|
||||
int repair = repDmg + newStack.getMaxDamage() * 12 / 100;
|
||||
int newDmg = mainDmg + repair;
|
||||
int damage = newStack.getMaxDamage() - newDmg;
|
||||
int newLevel = newEnch.containsKey(enchantment) ? newEnch.get(enchantment) : 0;
|
||||
int level = ench.get(enchantment);
|
||||
int diff;
|
||||
|
||||
if (damage < 0)
|
||||
if (newLevel == level)
|
||||
{
|
||||
damage = 0;
|
||||
++level;
|
||||
diff = level;
|
||||
}
|
||||
else
|
||||
{
|
||||
diff = Math.max(level, newLevel);
|
||||
}
|
||||
|
||||
if (damage < newStack.getItemDamage())
|
||||
level = diff;
|
||||
boolean applies = enchantment.canApply(stack);
|
||||
|
||||
if (/* this.thePlayer.creative || */ stack.getItem() instanceof ItemEnchantedBook)
|
||||
{
|
||||
newStack.setItemDamage(damage);
|
||||
totalCost += 2;
|
||||
applies = true;
|
||||
}
|
||||
}
|
||||
|
||||
Map<Enchantment, Integer> ench = EnchantmentHelper.getEnchantments(repStack);
|
||||
Iterator<Enchantment> enchs = ench.keySet().iterator();
|
||||
Iterator<Enchantment> newEnchs = newEnch.keySet().iterator();
|
||||
|
||||
while (enchs.hasNext())
|
||||
{
|
||||
Enchantment enchantment = enchs.next();
|
||||
|
||||
if (enchantment != null)
|
||||
while (newEnchs.hasNext())
|
||||
{
|
||||
int newLevel = newEnch.containsKey(enchantment) ? newEnch.get(enchantment) : 0;
|
||||
int level = ench.get(enchantment);
|
||||
int diff;
|
||||
Enchantment nEid = newEnchs.next();
|
||||
|
||||
if (newLevel == level)
|
||||
if (nEid != enchantment && !enchantment.canApplyTogether(nEid))
|
||||
{
|
||||
++level;
|
||||
diff = level;
|
||||
applies = false;
|
||||
++totalCost;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
if (applies)
|
||||
{
|
||||
if (level > enchantment.getMaxLevel())
|
||||
{
|
||||
diff = Math.max(level, newLevel);
|
||||
level = enchantment.getMaxLevel();
|
||||
}
|
||||
|
||||
level = diff;
|
||||
boolean applies = enchantment.canApply(stack);
|
||||
newEnch.put(enchantment, level);
|
||||
int cost = 0;
|
||||
|
||||
if (/* this.thePlayer.creative || */ stack.getItem() instanceof ItemEnchantedBook)
|
||||
switch (enchantment.getWeight())
|
||||
{
|
||||
applies = true;
|
||||
case 1:
|
||||
cost = 8;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
cost = 4;
|
||||
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
default:
|
||||
break;
|
||||
|
||||
case 5:
|
||||
cost = 2;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
cost = 1;
|
||||
}
|
||||
|
||||
Iterator<Enchantment> newEnchs = newEnch.keySet().iterator();
|
||||
|
||||
while (newEnchs.hasNext())
|
||||
if (isBook)
|
||||
{
|
||||
Enchantment nEid = newEnchs.next();
|
||||
|
||||
if (nEid != enchantment && !enchantment.canApplyTogether(nEid))
|
||||
{
|
||||
applies = false;
|
||||
++totalCost;
|
||||
}
|
||||
cost = Math.max(1, cost / 2);
|
||||
}
|
||||
|
||||
if (applies)
|
||||
{
|
||||
if (level > enchantment.getMaxLevel())
|
||||
{
|
||||
level = enchantment.getMaxLevel();
|
||||
}
|
||||
|
||||
newEnch.put(enchantment, level);
|
||||
int cost = 0;
|
||||
|
||||
switch (enchantment.getWeight())
|
||||
{
|
||||
case 1:
|
||||
cost = 8;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
cost = 4;
|
||||
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
default:
|
||||
break;
|
||||
|
||||
case 5:
|
||||
cost = 2;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
cost = 1;
|
||||
}
|
||||
|
||||
if (isBook)
|
||||
{
|
||||
cost = Math.max(1, cost / 2);
|
||||
}
|
||||
|
||||
totalCost += cost * level;
|
||||
}
|
||||
totalCost += cost * level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -398,18 +349,13 @@ public class ContainerRepair extends Container
|
|||
// newStack.setStackDisplayName(this.repairedItemName);
|
||||
// }
|
||||
|
||||
this.maximumCost = repairCost + totalCost;
|
||||
this.maximumCost = totalCost;
|
||||
|
||||
if (totalCost <= 0)
|
||||
{
|
||||
newStack = null;
|
||||
}
|
||||
|
||||
if (renameCost == totalCost && renameCost > 0 && this.maximumCost >= 40)
|
||||
{
|
||||
this.maximumCost = 39;
|
||||
}
|
||||
|
||||
if (/* Config.repairExperience && */ this.maximumCost >= 40) // && !this.thePlayer.creative)
|
||||
{
|
||||
newStack = null;
|
||||
|
@ -417,17 +363,6 @@ public class ContainerRepair extends Container
|
|||
|
||||
if (newStack != null)
|
||||
{
|
||||
if(!this.theWorld.client && Vars.repairXP) {
|
||||
int cost = newStack.getRepairCost();
|
||||
|
||||
if (repStack != null && cost < repStack.getRepairCost())
|
||||
{
|
||||
cost = repStack.getRepairCost();
|
||||
}
|
||||
|
||||
cost = cost * 2 + 1;
|
||||
newStack.setRepairCost(cost);
|
||||
}
|
||||
EnchantmentHelper.setEnchantments(newEnch, newStack);
|
||||
}
|
||||
|
||||
|
@ -529,42 +464,4 @@ public class ContainerRepair extends Container
|
|||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
/**
|
||||
* used by the Anvil GUI to update the Item Name being typed by the player
|
||||
*/
|
||||
// public void updateItemName(String newName)
|
||||
// {
|
||||
// this.repairedItemName = newName;
|
||||
//
|
||||
// if (this.getSlot(2).getHasStack())
|
||||
// {
|
||||
// ItemStack itemstack = this.getSlot(2).getStack();
|
||||
//
|
||||
// if (isBlank(newName))
|
||||
// {
|
||||
// itemstack.clearCustomName();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// itemstack.setStackDisplayName(this.repairedItemName);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// this.updateRepairOutput();
|
||||
// }
|
||||
|
||||
// private static boolean isBlank(String s) {
|
||||
// if(s != null && !s.isEmpty()) {
|
||||
// for(int i = 0; i < s.length(); ++i) {
|
||||
// if(!Character.isWhitespace(s.charAt(i))) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// else {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -52,7 +52,7 @@ public class ContainerPlayer extends Container {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
else if(itemstack.getItem() instanceof ItemArmor armor && (idx = this.getFreeSlotFor(playerIn, armor.getArmorType())) >= 0) {
|
||||
else if(itemstack.getItem() instanceof ItemArmor armor && itemstack.getSize() == 1 && (idx = this.getFreeSlotFor(playerIn, armor.getArmorType())) >= 0) {
|
||||
if(!this.mergeItemStack(itemstack1, idx, idx + 1)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -78,9 +78,9 @@ public class Slot
|
|||
return true;
|
||||
}
|
||||
|
||||
public int getItemStackLimit(ItemStack stack)
|
||||
public final int getItemStackLimit(ItemStack stack)
|
||||
{
|
||||
return this.canStackItems() ? 1000000000 : 1;
|
||||
return this.canStackItems() ? Integer.MAX_VALUE : 1;
|
||||
}
|
||||
|
||||
public ItemStack decrStackSize(int amount)
|
||||
|
|
|
@ -99,7 +99,7 @@ public enum CheatTab {
|
|||
},
|
||||
ENCHANTMENTS("Verzauberungen", false) {
|
||||
protected Item getIconItem() {
|
||||
return Items.enchanted_book_unbreaking;
|
||||
return Items.enchanted_book_protection;
|
||||
}
|
||||
},
|
||||
MAGIC("Magie", false) {
|
||||
|
|
|
@ -25,9 +25,7 @@ import common.world.World;
|
|||
public class Item {
|
||||
private final Block block;
|
||||
|
||||
private boolean stackable = true;
|
||||
private int weight = ItemWeight.M.getWeight();
|
||||
private int maxDamage = 0;
|
||||
private Item containerItem;
|
||||
private String display;
|
||||
private String[] description;
|
||||
|
@ -59,12 +57,6 @@ public class Item {
|
|||
this.setFuelAmount(this.block.getFuelAmount());
|
||||
}
|
||||
|
||||
public final Item setUnstackable() {
|
||||
this.stackable = false;
|
||||
this.maxDamage = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Item setWeight(int weight) {
|
||||
this.weight = weight;
|
||||
return this;
|
||||
|
@ -74,12 +66,6 @@ public class Item {
|
|||
return this.setWeight(size.getWeight());
|
||||
}
|
||||
|
||||
public final Item setMaxDamage(int max) {
|
||||
this.stackable = false;
|
||||
this.maxDamage = max;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Item setDisplay(String name) {
|
||||
this.display = name;
|
||||
return this;
|
||||
|
@ -135,18 +121,6 @@ public class Item {
|
|||
return this.weight;
|
||||
}
|
||||
|
||||
public final int getMaxAmount() {
|
||||
return this.stackable ? 67108864 : 1;
|
||||
}
|
||||
|
||||
public final int getMaxDamage() {
|
||||
return this.maxDamage;
|
||||
}
|
||||
|
||||
public final boolean isDamageable() {
|
||||
return this.maxDamage > 0;
|
||||
}
|
||||
|
||||
public final int getFuelAmount() {
|
||||
return this.fuelAmount;
|
||||
}
|
||||
|
@ -241,12 +215,10 @@ public class Item {
|
|||
return stack;
|
||||
}
|
||||
|
||||
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) {
|
||||
return false;
|
||||
public void hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) {
|
||||
}
|
||||
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, LocalPos pos, EntityLiving playerIn) {
|
||||
return false;
|
||||
public void onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, LocalPos pos, EntityLiving playerIn) {
|
||||
}
|
||||
|
||||
public boolean itemInteractionForEntity(ItemStack stack, EntityNPC playerIn, EntityLiving target) {
|
||||
|
@ -264,10 +236,6 @@ public class Item {
|
|||
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityNPC playerIn, int timeLeft) {
|
||||
}
|
||||
|
||||
public boolean canEnchant(ItemStack stack) {
|
||||
return this.getMaxAmount() == 1 && this.isDamageable();
|
||||
}
|
||||
|
||||
public int getItemEnchantability() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,52 +8,27 @@ import java.util.Set;
|
|||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.enchantment.Enchantment;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.npc.Attribute;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.material.ItemArmor;
|
||||
import common.item.weapon.ItemBow;
|
||||
import common.rng.Random;
|
||||
import common.tags.TagObject;
|
||||
import common.util.Color;
|
||||
import common.util.Equipment;
|
||||
|
||||
public final class ItemStack {
|
||||
public class ItemKey {
|
||||
public ItemStack getStack() {
|
||||
return ItemStack.this;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ItemStack.this.item.hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(Object other) {
|
||||
if(other == this)
|
||||
return true;
|
||||
if(other instanceof ItemKey key)
|
||||
return ItemStack.this == key.getStack() || (ItemStack.this.isStackable() && key.getStack().isStackable() && ItemStack.this.itemEquals(key.getStack()) && ItemStack.this.dataEquals(key.getStack()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private Item item;
|
||||
private int size;
|
||||
private String name;
|
||||
private int color = 0xffffffff;
|
||||
private int damage;
|
||||
private int repairCost;
|
||||
private Map<Enchantment, Integer> enchantments;
|
||||
private ItemKey key;
|
||||
|
||||
public static ItemStack readFromTag(TagObject tag) {
|
||||
Item item = tag.hasString("id") ? ItemRegistry.byName(tag.getString("id")) : null;
|
||||
int size = tag.hasInt("size") ? tag.getInt("size") : 1;
|
||||
if(item == null || size < 1)
|
||||
return null;
|
||||
ItemStack stack = new ItemStack(item, Math.min(item.getMaxAmount(), size));
|
||||
ItemStack stack = new ItemStack(item, size);
|
||||
stack.readTags(tag);
|
||||
return stack;
|
||||
}
|
||||
|
@ -90,10 +65,6 @@ public final class ItemStack {
|
|||
tag.setInt("size", this.size);
|
||||
if(this.color != 0xffffffff)
|
||||
tag.setInt("color", this.color);
|
||||
if(this.damage != 0)
|
||||
tag.setInt("dmg", this.damage);
|
||||
if(this.repairCost != 0)
|
||||
tag.setInt("cost", this.repairCost);
|
||||
if(this.name != null)
|
||||
tag.setString("name", this.name);
|
||||
if(this.enchantments != null) {
|
||||
|
@ -113,8 +84,6 @@ public final class ItemStack {
|
|||
public void readTags(TagObject tag) {
|
||||
this.color = tag.hasInt("color") ? tag.getInt("color") : 0xffffffff;
|
||||
this.color = (this.color & 0xff000000) != 0 ? 0xffffffff : this.color;
|
||||
this.damage = tag.hasInt("dmg") ? Math.max(0, tag.getInt("dmg")) : 0;
|
||||
this.repairCost = tag.hasInt("cost") ? Math.max(0, tag.getInt("cost")) : 0;
|
||||
this.name = tag.hasString("name") ? tag.getString("name") : null;
|
||||
this.name = this.name != null && this.name.length() > 32 ? this.name.substring(0, 32) : this.name;
|
||||
this.enchantments = tag.hasList("ench") ? Maps.newEnumMap(Enchantment.class) : null;
|
||||
|
@ -138,7 +107,7 @@ public final class ItemStack {
|
|||
}
|
||||
|
||||
public boolean dataEquals(ItemStack other) {
|
||||
if(this.color != other.color || this.damage != other.damage || this.repairCost != other.repairCost
|
||||
if(this.color != other.color
|
||||
|| (this.name != null) != (other.name != null) || (this.name != null && !this.name.equals(other.name))
|
||||
|| (this.enchantments != null) != (other.enchantments != null)
|
||||
|| (this.enchantments != null && this.enchantments.size() != other.enchantments.size()))
|
||||
|
@ -158,8 +127,6 @@ public final class ItemStack {
|
|||
|
||||
public void copyData(ItemStack stack) {
|
||||
this.color = stack.color;
|
||||
this.damage = stack.damage;
|
||||
this.repairCost = stack.repairCost;
|
||||
this.name = stack.name;
|
||||
this.enchantments = stack.enchantments == null ? null : Maps.newEnumMap(Enchantment.class);
|
||||
if(this.enchantments != null)
|
||||
|
@ -198,38 +165,6 @@ public final class ItemStack {
|
|||
return this.size <= 0;
|
||||
}
|
||||
|
||||
public boolean isStacked() {
|
||||
return this.size > 1;
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
return this.size >= this.getMaxStackSize();
|
||||
}
|
||||
|
||||
public boolean isOverLimit() {
|
||||
return this.size > this.getMaxStackSize();
|
||||
}
|
||||
|
||||
public int getMaxStackSize() {
|
||||
return this.item.getMaxAmount();
|
||||
}
|
||||
|
||||
public boolean isStackable() {
|
||||
return this.getMaxStackSize() > 1 && (!this.isItemStackDamageable() || !this.isItemDamaged());
|
||||
}
|
||||
|
||||
public boolean isItemStackDamageable() {
|
||||
return this.item != null && this.item.getMaxDamage() > 0;
|
||||
}
|
||||
|
||||
public boolean isItemDamaged() {
|
||||
return this.isItemStackDamageable() && this.getItemDamage() > 0;
|
||||
}
|
||||
|
||||
public int getMaxDamage() {
|
||||
return this.item.getMaxDamage();
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration() {
|
||||
return this.item.getMaxItemUseDuration(this);
|
||||
}
|
||||
|
@ -238,10 +173,6 @@ public final class ItemStack {
|
|||
return this.item.getItemUseAction();
|
||||
}
|
||||
|
||||
public int getItemDamage() {
|
||||
return this.isItemStackDamageable() ? this.damage : 0;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.name != null ? this.name : this.item.getDisplay();
|
||||
}
|
||||
|
@ -262,10 +193,6 @@ public final class ItemStack {
|
|||
return this.item.getColor(this);
|
||||
}
|
||||
|
||||
public boolean isItemEnchantable() {
|
||||
return !this.item.canEnchant(this) ? false : !this.isItemEnchanted();
|
||||
}
|
||||
|
||||
public Set<Entry<Enchantment, Integer>> getEnchantments() {
|
||||
return this.enchantments == null ? null : this.enchantments.entrySet();
|
||||
}
|
||||
|
@ -278,10 +205,6 @@ public final class ItemStack {
|
|||
return this.enchantments != null;
|
||||
}
|
||||
|
||||
public int getRepairCost() {
|
||||
return this.repairCost;
|
||||
}
|
||||
|
||||
public Map<Attribute, Float> getAttributeModifiers() {
|
||||
Map<Attribute, Float> map = Maps.newEnumMap(Attribute.class);
|
||||
this.item.getModifiers(map);
|
||||
|
@ -312,12 +235,6 @@ public final class ItemStack {
|
|||
}
|
||||
|
||||
|
||||
public void setItemDamage(int damage) {
|
||||
if(!this.isItemStackDamageable())
|
||||
return;
|
||||
this.damage = Math.max(0, damage);
|
||||
}
|
||||
|
||||
public void setStackDisplayName(String displayName) {
|
||||
this.name = displayName != null && !displayName.isEmpty() ? displayName : null;
|
||||
this.name = this.name != null && this.name.length() > 32 ? this.name.substring(0, 32) : this.name;
|
||||
|
@ -361,10 +278,6 @@ public final class ItemStack {
|
|||
this.enchantments.putAll(enchMap);
|
||||
}
|
||||
|
||||
public void setRepairCost(int cost) {
|
||||
this.repairCost = Math.max(0, cost);
|
||||
}
|
||||
|
||||
public void setItem(Item newItem) {
|
||||
this.item = newItem;
|
||||
}
|
||||
|
@ -393,46 +306,11 @@ public final class ItemStack {
|
|||
return (this.size = Math.max(this.size - amount, 0)) <= 0;
|
||||
}
|
||||
|
||||
public boolean incrSize() {
|
||||
return (this.size += 1) >= this.getMaxStackSize();
|
||||
public void incrSize() {
|
||||
this.size += 1;
|
||||
}
|
||||
|
||||
public boolean incrSize(int amount) {
|
||||
return (this.size += amount) >= this.getMaxStackSize();
|
||||
}
|
||||
|
||||
public void damage(int amount, EntityLiving entity, Random rand) {
|
||||
if(!this.isItemStackDamageable())
|
||||
return;
|
||||
if(amount > 0) {
|
||||
int unbreaking = EnchantmentHelper.getEnchantmentLevel(Enchantment.UNBREAKING, this);
|
||||
int negated = 0;
|
||||
for(int z = 0; unbreaking > 0 && z < amount; z++) {
|
||||
if(Enchantment.negateDamage(this, unbreaking, rand))
|
||||
++negated;
|
||||
}
|
||||
if((amount -= negated) <= 0)
|
||||
return;
|
||||
}
|
||||
int damage = this.getItemDamage() + amount;
|
||||
this.setItemDamage(damage);
|
||||
if(damage > this.getMaxDamage()) {
|
||||
if(entity != null)
|
||||
entity.renderBrokenItemStack(this);
|
||||
this.decrSize();
|
||||
if(entity != null && entity.isPlayer() && this.isEmpty() && this.item instanceof ItemBow)
|
||||
((EntityNPC)entity).clearHeldItem();
|
||||
this.setItemDamage(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void damage(int amount, EntityLiving entity) {
|
||||
this.damage(amount, entity, entity.getRNG());
|
||||
}
|
||||
|
||||
public ItemKey getKey() {
|
||||
if(this.key == null)
|
||||
this.key = new ItemKey();
|
||||
return this.key;
|
||||
public void incrSize(int amount) {
|
||||
this.size += amount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,17 +42,7 @@ public class RngLoot extends RngItem
|
|||
RngLoot loot = (RngLoot)list.pick(random);
|
||||
int j = loot.minStackSize + random.zrange(loot.maxStackSize - loot.minStackSize + 1);
|
||||
|
||||
if (loot.item.getMaxStackSize() >= j)
|
||||
{
|
||||
inv.setInventorySlotContents(random.zrange(inv.getSizeInventory()), loot.item.copy(j));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int k = 0; k < j; ++k)
|
||||
{
|
||||
inv.setInventorySlotContents(random.zrange(inv.getSizeInventory()), loot.item.copy(1));
|
||||
}
|
||||
}
|
||||
inv.setInventorySlotContents(random.zrange(inv.getSizeInventory()), loot.item.copy(j));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import common.world.World;
|
|||
|
||||
public class ItemMilkBottle extends Item {
|
||||
public ItemMilkBottle() {
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.FOOD);
|
||||
this.setMagnetic();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import common.init.Items;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.item.ItemCategory;
|
||||
|
|
|
@ -21,7 +21,6 @@ public class ItemAnimalArmor extends Item {
|
|||
this.material = material;
|
||||
this.texture = texture;
|
||||
this.type = type;
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.ARMOR);
|
||||
if(this.material.isMagnetic())
|
||||
this.setMagnetic();
|
||||
|
|
|
@ -31,11 +31,6 @@ public class ItemArmor extends Item {
|
|||
this.material = material;
|
||||
this.texture = texture;
|
||||
this.type = armorType;
|
||||
int dmg = material.getDurability(armorType);
|
||||
if(dmg <= 0)
|
||||
this.setUnstackable();
|
||||
else
|
||||
this.setMaxDamage(dmg);
|
||||
this.setTab(CheatTab.ARMOR);
|
||||
if(this.material.canBeDyed())
|
||||
this.setDefaultColor(this.material.getDefaultColor());
|
||||
|
@ -67,7 +62,7 @@ public class ItemArmor extends Item {
|
|||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
return this.material.isRepairItem(repair.getItem()) ? true : super.getIsRepairable(toRepair, repair);
|
||||
return this.material.isRepairItem(repair.getItem());
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package common.item.material;
|
||||
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
|
||||
public class ItemBook extends Item {
|
||||
public boolean canEnchant(ItemStack stack) {
|
||||
return stack.getSize() == 1;
|
||||
}
|
||||
|
||||
public int getItemEnchantability() {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -115,13 +115,10 @@ public class ItemBucket extends Item
|
|||
|
||||
public ItemBucket(BlockDynamicLiquid liquid, boolean recursive)
|
||||
{
|
||||
if(liquid != null) {
|
||||
this.setUnstackable();
|
||||
if(liquid != null)
|
||||
this.setDisplay((recursive ? "Flutender " : "") + "Eimer mit " + liquid.getDisplay(), liquid.getDescription());
|
||||
}
|
||||
else {
|
||||
else
|
||||
this.setDisplay((recursive ? "Unendlicher " : "") + "Eimer");
|
||||
}
|
||||
this.liquid = liquid;
|
||||
this.recursive = recursive;
|
||||
this.setTab(liquid == null ? CheatTab.TOOLS : CheatTab.LIQUIDS);
|
||||
|
|
|
@ -4,7 +4,6 @@ import common.block.artificial.BlockPortalFrame;
|
|||
import common.entity.item.EntityOrb;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
|
@ -22,7 +21,6 @@ public class ItemChargedOrb extends Item
|
|||
public ItemChargedOrb()
|
||||
{
|
||||
this.setTab(CheatTab.MAGIC);
|
||||
this.setMaxDamage(16);
|
||||
this.setColor(Color.DARK_MAGENTA);
|
||||
this.setFragile();
|
||||
}
|
||||
|
@ -37,9 +35,7 @@ public class ItemChargedOrb extends Item
|
|||
// {
|
||||
// --itemStackIn.stackSize;
|
||||
// }
|
||||
if(itemStackIn.getItemDamage() >= this.getMaxDamage())
|
||||
return itemStackIn;
|
||||
itemStackIn.damage(1, playerIn);
|
||||
itemStackIn.decrSize();
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F);
|
||||
|
||||
if (!worldIn.client)
|
||||
|
@ -48,14 +44,14 @@ public class ItemChargedOrb extends Item
|
|||
}
|
||||
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return itemStackIn.getItemDamage() >= this.getMaxDamage() ? new ItemStack(Items.orb) : itemStackIn;
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
|
||||
if (!stack.isItemDamaged() && playerIn.canPlayerEdit(pos.offset(side), side, stack) /* && worldIn.dimension.getDimensionId() == 0 || worldIn.dimension.getDimensionId() == 1) */ && iblockstate.getBlock() == Blocks.portal_frame && !((Boolean)iblockstate.getValue(BlockPortalFrame.ORB)).booleanValue())
|
||||
if (playerIn.canPlayerEdit(pos.offset(side), side, stack) /* && worldIn.dimension.getDimensionId() == 0 || worldIn.dimension.getDimensionId() == 1) */ && iblockstate.getBlock() == Blocks.portal_frame && !((Boolean)iblockstate.getValue(BlockPortalFrame.ORB)).booleanValue())
|
||||
{
|
||||
if (worldIn.client)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,6 @@ public class ItemBoat extends Item
|
|||
{
|
||||
public ItemBoat()
|
||||
{
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.VEHICLES);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ public class ItemMinecart extends Item
|
|||
{
|
||||
public ItemMinecart()
|
||||
{
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.VEHICLES);
|
||||
this.setMagnetic();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import common.world.World;
|
|||
|
||||
public class ItemCamera extends Item {
|
||||
public ItemCamera() {
|
||||
this.setUnstackable();
|
||||
this.setMagnetic();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import common.world.World;
|
|||
|
||||
public class ItemEditor extends Item {
|
||||
public ItemEditor() {
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ public class ItemFire extends Item
|
|||
public ItemFire(BlockFire fireBlock)
|
||||
{
|
||||
this.fireBlock = fireBlock;
|
||||
this.setMaxDamage(64);
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
this.setMagnetic();
|
||||
}
|
||||
|
@ -58,7 +57,6 @@ public class ItemFire extends Item
|
|||
worldIn.setState(pos, this.fireBlock.getState());
|
||||
}
|
||||
|
||||
stack.damage(1, playerIn);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +69,6 @@ public class ItemFire extends Item
|
|||
{
|
||||
world.setState(pos, this.fireBlock.getState());
|
||||
|
||||
stack.damage(1, null, world.rand);
|
||||
world.playEffect(1000, blockpos, 0);
|
||||
}
|
||||
else if (world.getState(pos).getBlock() instanceof BlockTNT tnt)
|
||||
|
|
|
@ -15,7 +15,6 @@ public class ItemFishingRod extends Item
|
|||
{
|
||||
public ItemFishingRod()
|
||||
{
|
||||
this.setMaxDamage(64);
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
}
|
||||
|
||||
|
@ -48,7 +47,6 @@ public class ItemFishingRod extends Item
|
|||
if (playerIn.fishEntity != null)
|
||||
{
|
||||
int i = playerIn.fishEntity.handleHookRetraction();
|
||||
itemStackIn.damage(i, playerIn);
|
||||
playerIn.swingItem();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -18,7 +18,6 @@ public class ItemHoe extends Item
|
|||
{
|
||||
public ItemHoe()
|
||||
{
|
||||
this.setMaxDamage(131);
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
}
|
||||
|
||||
|
@ -70,7 +69,6 @@ public class ItemHoe extends Item
|
|||
else
|
||||
{
|
||||
worldIn.setState(target, newState);
|
||||
stack.damage(1, player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ public class ItemMagnet extends Item {
|
|||
|
||||
public <T extends Entity> ItemMagnet(boolean chicken) {
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
this.setUnstackable();
|
||||
this.setMagnetic();
|
||||
this.chicken = chicken;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ public class ItemSaddle extends Item
|
|||
{
|
||||
public ItemSaddle()
|
||||
{
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
}
|
||||
|
||||
|
@ -43,14 +42,4 @@ public class ItemSaddle extends Item
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
|
||||
* the damage on the stack.
|
||||
*/
|
||||
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker)
|
||||
{
|
||||
this.itemInteractionForEntity(stack, (EntityNPC)null, target);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ public class ItemSpaceNavigator extends Item {
|
|||
private boolean local = true;
|
||||
|
||||
public ItemSpaceNavigator() {
|
||||
this.setUnstackable();
|
||||
this.setColor(Color.DARK_GREEN);
|
||||
this.setMagnetic();
|
||||
}
|
||||
|
|
|
@ -2,10 +2,8 @@ package common.item.tool;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ToolMaterial;
|
||||
import common.init.ToolType;
|
||||
import common.item.CheatTab;
|
||||
|
@ -14,7 +12,6 @@ import common.item.ItemAction;
|
|||
import common.item.ItemStack;
|
||||
import common.item.ItemCategory;
|
||||
import common.item.WieldType;
|
||||
import common.util.LocalPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.Color;
|
||||
import common.util.Equipment;
|
||||
|
@ -27,7 +24,6 @@ public class ItemTool extends Item {
|
|||
public ItemTool(ToolMaterial material, Equipment type) {
|
||||
this.material = material;
|
||||
this.type = type;
|
||||
this.setMaxDamage(material.getDurability());
|
||||
this.setTab(this.type.isWeapon() ? CheatTab.WEAPONS : CheatTab.TOOLS);
|
||||
if(this.material.isMagnetic())
|
||||
this.setMagnetic();
|
||||
|
@ -53,17 +49,6 @@ public class ItemTool extends Item {
|
|||
return this.type.getDamage() >= 0 ? (this.material.getDamage() + this.type.getDamage() + EnchantmentHelper.getDamageModifier(stack)) : 0;
|
||||
}
|
||||
|
||||
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) {
|
||||
stack.damage(this.type.isWeapon() ? 1 : 2, attacker);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, LocalPos pos, EntityLiving player) {
|
||||
if(block.getHardness() != 0)
|
||||
stack.damage(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Equipment getToolType() {
|
||||
return this.type;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import common.world.AWorldServer;
|
|||
|
||||
public abstract class ItemWand extends Item {
|
||||
public ItemWand() {
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ public class ItemWeatherToken extends Item {
|
|||
|
||||
public ItemWeatherToken(Weather weather) {
|
||||
this.weather = weather;
|
||||
this.setUnstackable();
|
||||
this.setColor(Color.VIOLET);
|
||||
this.setDisplay("Wetterkristall (" + this.weather.getDisplay() + ")");
|
||||
this.setMagnetic();
|
||||
|
|
|
@ -9,33 +9,20 @@ import common.item.ItemCategory;
|
|||
import common.item.WieldType;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemWhip extends Item
|
||||
{
|
||||
public ItemWhip()
|
||||
{
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
this.setMaxDamage(35);
|
||||
}
|
||||
public class ItemWhip extends Item {
|
||||
public ItemWhip() {
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
}
|
||||
|
||||
public ItemCategory getCategory() {
|
||||
return ItemCategory.USEABLE;
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
if (playerIn.isRiding() && playerIn.vehicle instanceof EntityPig)
|
||||
{
|
||||
EntityPig entitypig = (EntityPig)playerIn.vehicle;
|
||||
|
||||
if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getItemDamage() >= 7)
|
||||
{
|
||||
entitypig.getAIControlledByPlayer().boostSpeed();
|
||||
itemStackIn.damage(7, playerIn);
|
||||
}
|
||||
}
|
||||
|
||||
return itemStackIn;
|
||||
}
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityNPC player) {
|
||||
if(player.isRiding() && player.vehicle instanceof EntityPig pig && pig.getAIControlledByPlayer().isControlledByPlayer())
|
||||
pig.getAIControlledByPlayer().boostSpeed();
|
||||
return stack;
|
||||
}
|
||||
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.TOOL_FLIP;
|
||||
|
|
|
@ -19,7 +19,6 @@ public class ItemBow extends Item
|
|||
{
|
||||
public ItemBow()
|
||||
{
|
||||
this.setMaxDamage(384);
|
||||
this.setTab(CheatTab.WEAPONS);
|
||||
}
|
||||
|
||||
|
@ -76,7 +75,6 @@ public class ItemBow extends Item
|
|||
entityarrow.setFire(100);
|
||||
}
|
||||
|
||||
stack.damage(1, playerIn);
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 1.0F);
|
||||
|
||||
if (flag)
|
||||
|
|
|
@ -13,7 +13,6 @@ import common.world.AWorldServer;
|
|||
|
||||
public class ItemExterminator extends Item {
|
||||
public ItemExterminator() {
|
||||
this.setUnstackable();
|
||||
this.setColor(Color.DARK_RED);
|
||||
this.setTab(CheatTab.WEAPONS);
|
||||
this.setMagnetic();
|
||||
|
|
|
@ -23,7 +23,6 @@ public abstract class ItemGunBase extends Item
|
|||
|
||||
public ItemGunBase(int durability)
|
||||
{
|
||||
this.setMaxDamage(durability);
|
||||
this.setTab(CheatTab.WEAPONS);
|
||||
}
|
||||
|
||||
|
@ -39,8 +38,6 @@ public abstract class ItemGunBase extends Item
|
|||
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityNPC player)
|
||||
{
|
||||
if(stack.getItemDamage() >= this.getMaxDamage())
|
||||
return stack;
|
||||
boolean flag = EnchantmentHelper.getEnchantmentLevel(Enchantment.INFINITY, stack) > 0;
|
||||
if (flag || player.hasItem(this.getAmmo()))
|
||||
{
|
||||
|
@ -54,7 +51,6 @@ public abstract class ItemGunBase extends Item
|
|||
bullet.setDamage(bullet.getDamage() + j);
|
||||
}
|
||||
|
||||
stack.damage(1, player);
|
||||
world.playSoundAtEntity(player, this.getLaunchSound(), 1.0F);
|
||||
|
||||
if(!flag)
|
||||
|
|
|
@ -124,9 +124,6 @@ public class PacketBuffer {
|
|||
this.writeVarInt(stack.getSize());
|
||||
if(stack.getItem().canBeDyed())
|
||||
this.writeVarInt(stack.getRawColor());
|
||||
if(stack.getItem().isDamageable())
|
||||
this.writeVarInt(stack.getItemDamage());
|
||||
this.writeVarInt(stack.getRepairCost());
|
||||
this.writeString(stack.hasDisplayName() ? stack.getDisplayName() : "");
|
||||
Set<Entry<Enchantment, Integer>> ench = stack.getEnchantments();
|
||||
this.writeVarInt(ench == null ? 0 : ench.size());
|
||||
|
@ -145,9 +142,6 @@ public class PacketBuffer {
|
|||
ItemStack stack = new ItemStack(ItemRegistry.byId(id), this.readVarInt());
|
||||
if(stack.getItem().canBeDyed())
|
||||
stack.setColor(this.readVarInt());
|
||||
if(stack.getItem().isDamageable())
|
||||
stack.setItemDamage(this.readVarInt());
|
||||
stack.setRepairCost(this.readVarInt());
|
||||
stack.setStackDisplayName(this.readString(32));
|
||||
int num = this.readVarInt();
|
||||
for(int z = 0; z < num; z++) {
|
||||
|
|
|
@ -323,10 +323,6 @@ public abstract class Device extends TileEntity implements IInventory, ITickable
|
|||
return this.inventory[slot] != null && this.inventory[slot].getSize() >= amount;
|
||||
}
|
||||
|
||||
public boolean isOutputFull(int slot) {
|
||||
return this.inventory[slot - this.inputs] != null && this.inventory[slot - this.inputs].isFull();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for(int i = 0; i < this.inventory.length; ++i) {
|
||||
this.inventory[i] = null;
|
||||
|
|
|
@ -142,7 +142,7 @@ public class DeviceFurnace extends Device
|
|||
{
|
||||
ItemStack itemstack = SmeltingRegistry.getResult(this.getStackInSlot(0));
|
||||
ItemStack out = this.getStackInSlot(2);
|
||||
return itemstack == null ? false : (out == null ? true : (!out.itemEquals(itemstack) ? false : (!out.isFull() ? true : out.getSize() < itemstack.getMaxStackSize())));
|
||||
return itemstack != null && (out == null || out.itemEquals(itemstack));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ public class TileEntityItemPipe extends TileEntity implements IInventory, ITicka
|
|||
}
|
||||
if(--this.inCooldown <= 0) {
|
||||
this.inCooldown = 0;
|
||||
if((this.stack == null || !this.stack.isFull()) && this.transferIn()) {
|
||||
if(this.transferIn()) {
|
||||
this.inCooldown = Vars.pipeInDelay;
|
||||
changed = true;
|
||||
}
|
||||
|
@ -192,29 +192,13 @@ public class TileEntityItemPipe extends TileEntity implements IInventory, ITicka
|
|||
|
||||
// out
|
||||
|
||||
private static boolean isInventoryFull(IInventory inv, Facing side) {
|
||||
private static boolean canTransfer(IInventory inv, Facing side) {
|
||||
if(inv instanceof ISidedInventory sided) {
|
||||
int slot = sided.getSlotForFace(side);
|
||||
|
||||
if(slot >= 0) {
|
||||
ItemStack stack = sided.getStackInSlot(slot);
|
||||
if(stack == null || !stack.isFull())
|
||||
return false;
|
||||
}
|
||||
return sided.getSlotForFace(side) >= 0;
|
||||
}
|
||||
else {
|
||||
int i = inv.getSizeInventory();
|
||||
|
||||
for(int j = 0; j < i; ++j) {
|
||||
ItemStack stack = inv.getStackInSlot(j);
|
||||
|
||||
if(stack == null || !stack.isFull()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return inv.getSizeInventory() > 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean transferOut() {
|
||||
|
@ -223,7 +207,7 @@ public class TileEntityItemPipe extends TileEntity implements IInventory, ITicka
|
|||
if(iinventory == null)
|
||||
return false;
|
||||
Facing dir = state.getValue(BlockPipe.FACING).getOpposite();
|
||||
if(isInventoryFull(iinventory, dir))
|
||||
if(!canTransfer(iinventory, dir))
|
||||
return false;
|
||||
for(int i = 0; i < this.getSizeInventory(); ++i) {
|
||||
if(this.getStackInSlot(i) != null) {
|
||||
|
@ -362,10 +346,9 @@ public class TileEntityItemPipe extends TileEntity implements IInventory, ITicka
|
|||
add = null;
|
||||
flag = true;
|
||||
}
|
||||
else if(current.getItem() == add.getItem() && !current.isOverLimit() && ItemStack.dataEquals(current, add)) {
|
||||
int i = add.getMaxStackSize() - current.getSize();
|
||||
int j = Math.min(add.getSize(), i);
|
||||
add.decrSize(j);
|
||||
else if(current.getItem() == add.getItem() && ItemStack.dataEquals(current, add)) {
|
||||
int j = add.getSize();
|
||||
add.setSize(0);
|
||||
current.incrSize(j);
|
||||
flag = j > 0;
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ public abstract class Vars {
|
|||
public static boolean seasonLeaves = true;
|
||||
@Var(name = "leavesDecay")
|
||||
public static boolean leavesDecay = true;
|
||||
@Var(name = "repairExperience")
|
||||
public static boolean repairXP = true;
|
||||
@Var(name = "magicCombinationUsesMana")
|
||||
public static boolean magicComboMana = true;
|
||||
@Var(name = "mobTick")
|
||||
public static boolean mobTick = true;
|
||||
@Var(name = "mobAttacks")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue