Do net reset block break progress upon item charge. Closes #1312

This commit is contained in:
drcrazy 2017-10-20 03:00:28 +03:00
parent 441ac4887a
commit 5702e79e7a
10 changed files with 49 additions and 16 deletions

View file

@ -217,6 +217,7 @@ public class ItemUpgrades extends ItemTR implements IUpgrade {
}
}
@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
public BuiltContainer getContainer(EntityPlayer player) {
return new ContainerBuilder("sides").create();

View file

@ -227,4 +227,15 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt
return new PoweredItemContainerProvider(stack);
}
/**
* Called when the player is mining a block and the item in his hand changes.
* Allows to not reset blockbreaking if only NBT or similar changes.
* @param oldStack The old stack that was used for mining. Item in players main hand
* @param newStack The new stack
* @return True to reset block break progress
*/
@Override
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
return !(newStack.isItemEqual(oldStack));
}
}

View file

@ -215,4 +215,16 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, IEnergyIn
return new PoweredItemContainerProvider(stack);
}
/**
* Called when the player is mining a block and the item in his hand changes.
* Allows to not reset blockbreaking if only NBT or similar changes.
* @param oldStack The old stack that was used for mining. Item in players main hand
* @param newStack The new stack
* @return True to reset block break progress
*/
@Override
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
return !(newStack.isItemEqual(oldStack));
}
}

View file

@ -234,4 +234,16 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, IEne
NBTTagCompound nbt) {
return new PoweredItemContainerProvider(stack);
}
/**
* Called when the player is mining a block and the item in his hand changes.
* Allows to not reset blockbreaking if only NBT or similar changes.
* @param oldStack The old stack that was used for mining. Item in players main hand
* @param newStack The new stack
* @return True to reset block break progress
*/
@Override
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
return !(newStack.isItemEqual(oldStack));
}
}

View file

@ -250,4 +250,16 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, IEne
return new PoweredItemContainerProvider(stack);
}
/**
* Called when the player is mining a block and the item in his hand changes.
* Allows to not reset blockbreaking if only NBT or similar changes.
* @param oldStack The old stack that was used for mining. Item in players main hand
* @param newStack The new stack
* @return True to reset block break progress
*/
@Override
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
return !(newStack.isItemEqual(oldStack));
}
}

View file

@ -29,13 +29,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRAxe extends ItemAxe {
private ToolMaterial material = ToolMaterial.WOOD;
public ItemTRAxe(ToolMaterial material) {
super(material, material.getDamageVsEntity() + 5.75F, (material.getDamageVsEntity() + 6.75F) * -0.344444F);
setUnlocalizedName(material.name().toLowerCase() + "Axe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.material = material;
TRRecipeHandler.hideEntry(this);
}
}

View file

@ -31,13 +31,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRHoe extends ItemHoe {
private ToolMaterial material = ToolMaterial.WOOD;
public ItemTRHoe(ToolMaterial material) {
super(material);
setUnlocalizedName(material.name().toLowerCase() + "Hoe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.material = material;
TRRecipeHandler.hideEntry(this);
}

View file

@ -29,13 +29,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRPickaxe extends ItemPickaxe {
private ToolMaterial material = ToolMaterial.WOOD;
public ItemTRPickaxe(ToolMaterial material) {
super(material);
setUnlocalizedName(material.name().toLowerCase() + "Pickaxe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.material = material;
TRRecipeHandler.hideEntry(this);
}
}

View file

@ -29,13 +29,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRSpade extends ItemSpade {
private ToolMaterial material = ToolMaterial.WOOD;
public ItemTRSpade(ToolMaterial material) {
super(material);
setUnlocalizedName(material.name().toLowerCase() + "Spade");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.material = material;
TRRecipeHandler.hideEntry(this);
}
}

View file

@ -29,13 +29,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.events.TRRecipeHandler;
public class ItemTRSword extends ItemSword {
private ToolMaterial material = ToolMaterial.WOOD;
public ItemTRSword(ToolMaterial material) {
super(material);
setUnlocalizedName(material.name().toLowerCase() + "Sword");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.material = material;
TRRecipeHandler.hideEntry(this);
}
}