Do net reset block break progress upon item charge. Closes #1312
This commit is contained in:
parent
441ac4887a
commit
5702e79e7a
10 changed files with 49 additions and 16 deletions
|
@ -217,6 +217,7 @@ public class ItemUpgrades extends ItemTR implements IUpgrade {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public BuiltContainer getContainer(EntityPlayer player) {
|
public BuiltContainer getContainer(EntityPlayer player) {
|
||||||
return new ContainerBuilder("sides").create();
|
return new ContainerBuilder("sides").create();
|
||||||
|
|
|
@ -226,5 +226,16 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt
|
||||||
NBTTagCompound nbt) {
|
NBTTagCompound nbt) {
|
||||||
return new PoweredItemContainerProvider(stack);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,5 +214,17 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, IEnergyIn
|
||||||
NBTTagCompound nbt) {
|
NBTTagCompound nbt) {
|
||||||
return new PoweredItemContainerProvider(stack);
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,4 +234,16 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, IEne
|
||||||
NBTTagCompound nbt) {
|
NBTTagCompound nbt) {
|
||||||
return new PoweredItemContainerProvider(stack);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,5 +249,17 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, IEne
|
||||||
NBTTagCompound nbt) {
|
NBTTagCompound nbt) {
|
||||||
return new PoweredItemContainerProvider(stack);
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.events.TRRecipeHandler;
|
import techreborn.events.TRRecipeHandler;
|
||||||
|
|
||||||
public class ItemTRAxe extends ItemAxe {
|
public class ItemTRAxe extends ItemAxe {
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
|
||||||
|
|
||||||
public ItemTRAxe(ToolMaterial material) {
|
public ItemTRAxe(ToolMaterial material) {
|
||||||
super(material, material.getDamageVsEntity() + 5.75F, (material.getDamageVsEntity() + 6.75F) * -0.344444F);
|
super(material, material.getDamageVsEntity() + 5.75F, (material.getDamageVsEntity() + 6.75F) * -0.344444F);
|
||||||
setUnlocalizedName(material.name().toLowerCase() + "Axe");
|
setUnlocalizedName(material.name().toLowerCase() + "Axe");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
this.material = material;
|
|
||||||
TRRecipeHandler.hideEntry(this);
|
TRRecipeHandler.hideEntry(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.events.TRRecipeHandler;
|
import techreborn.events.TRRecipeHandler;
|
||||||
|
|
||||||
public class ItemTRHoe extends ItemHoe {
|
public class ItemTRHoe extends ItemHoe {
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
|
||||||
|
|
||||||
public ItemTRHoe(ToolMaterial material) {
|
public ItemTRHoe(ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
setUnlocalizedName(material.name().toLowerCase() + "Hoe");
|
setUnlocalizedName(material.name().toLowerCase() + "Hoe");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
this.material = material;
|
|
||||||
TRRecipeHandler.hideEntry(this);
|
TRRecipeHandler.hideEntry(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.events.TRRecipeHandler;
|
import techreborn.events.TRRecipeHandler;
|
||||||
|
|
||||||
public class ItemTRPickaxe extends ItemPickaxe {
|
public class ItemTRPickaxe extends ItemPickaxe {
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
|
||||||
|
|
||||||
public ItemTRPickaxe(ToolMaterial material) {
|
public ItemTRPickaxe(ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
setUnlocalizedName(material.name().toLowerCase() + "Pickaxe");
|
setUnlocalizedName(material.name().toLowerCase() + "Pickaxe");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
this.material = material;
|
|
||||||
TRRecipeHandler.hideEntry(this);
|
TRRecipeHandler.hideEntry(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.events.TRRecipeHandler;
|
import techreborn.events.TRRecipeHandler;
|
||||||
|
|
||||||
public class ItemTRSpade extends ItemSpade {
|
public class ItemTRSpade extends ItemSpade {
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
|
||||||
|
|
||||||
public ItemTRSpade(ToolMaterial material) {
|
public ItemTRSpade(ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
setUnlocalizedName(material.name().toLowerCase() + "Spade");
|
setUnlocalizedName(material.name().toLowerCase() + "Spade");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
this.material = material;
|
|
||||||
TRRecipeHandler.hideEntry(this);
|
TRRecipeHandler.hideEntry(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,10 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.events.TRRecipeHandler;
|
import techreborn.events.TRRecipeHandler;
|
||||||
|
|
||||||
public class ItemTRSword extends ItemSword {
|
public class ItemTRSword extends ItemSword {
|
||||||
private ToolMaterial material = ToolMaterial.WOOD;
|
|
||||||
|
|
||||||
public ItemTRSword(ToolMaterial material) {
|
public ItemTRSword(ToolMaterial material) {
|
||||||
super(material);
|
super(material);
|
||||||
setUnlocalizedName(material.name().toLowerCase() + "Sword");
|
setUnlocalizedName(material.name().toLowerCase() + "Sword");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
this.material = material;
|
|
||||||
TRRecipeHandler.hideEntry(this);
|
TRRecipeHandler.hideEntry(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue