Simplify this method.

This commit is contained in:
koolkrafter5 committed 2025-04-10 16:44:54 -04:00
1 parent 1ea6d9c700
commit e153c70116
5 files changed
+10 -5

No files matched your search

@@ -17,12 +17,14 @@ public interface IBindable {
// The number of ticks between passive drains
int tickDelay = 200;
// Set this to true if the right click function should be disabled with the config disableBoundToolsRightClick
boolean isBoundTool = false;
/**
* Used by bound tools and the energy blaster/bazooka to check if they should skip their right click function.
*/
default boolean checkRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer,
int rightClickCost, boolean isBoundTool) {
int rightClickCost) {
if (toggle(par1ItemStack, par2World, par3EntityPlayer)) {
return true;
}
@@ -33,6 +33,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
public float efficiencyOnProperMaterial = 12.0F;
public float damageVsEntity;
public int rightClickCost = 10000;
public boolean isBoundTool = true;
@SideOnly(Side.CLIENT)
private IIcon activeIcon;
@@ -85,7 +86,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost, true)) {
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost)) {
return par1ItemStack;
}
@@ -34,6 +34,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
public float efficiencyOnProperMaterial = 12.0F;
public float damageVsEntity;
public int rightClickCost = 10000;
public boolean isBoundTool = true;
@SideOnly(Side.CLIENT)
private IIcon activeIcon;
@@ -87,7 +88,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost, true)) {
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost)) {
return par1ItemStack;
}
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
@@ -35,6 +35,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
public float efficiencyOnProperMaterial = 12.0F;
public float damageVsEntity;
public int rightClickCost = 10000;
public boolean isBoundTool = true;
@SideOnly(Side.CLIENT)
private IIcon activeIcon;
@@ -87,7 +88,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost, true)) {
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, rightClickCost)) {
return par1ItemStack;
}
@@ -91,7 +91,7 @@ public class EnergyBlast extends EnergyItems {
return par1ItemStack;
}
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed(), false)) {
if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer, getEnergyUsed())) {
setDelay(par1ItemStack, getMaxDelayAfterActivation());
return par1ItemStack;
}