Add canWrench() checks to Block classes' onBlockActivated() methods
to fix the mmMPS powerFist always rotating Mekanism machines.
This commit is contained in:
parent
c27f4d06bc
commit
b2c32527c6
3 changed files with 186 additions and 162 deletions
|
@ -12,6 +12,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
|
@ -167,9 +168,12 @@ public class BlockEnergyCube extends BlockContainer
|
|||
|
||||
if(entityplayer.getCurrentEquippedItem() != null)
|
||||
{
|
||||
if(entityplayer.getCurrentEquippedItem().getItem() instanceof IToolConfigurator)
|
||||
Item tool = entityplayer.getCurrentEquippedItem().getItem();
|
||||
if(tool instanceof IToolConfigurator)
|
||||
{
|
||||
((IToolConfigurator)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z);
|
||||
if(((IToolConfigurator)tool).canWrench(entityplayer, x, y, z))
|
||||
{
|
||||
((IToolConfigurator)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
|
||||
int change = 0;
|
||||
|
||||
|
@ -199,7 +203,10 @@ public class BlockEnergyCube extends BlockContainer
|
|||
world.notifyBlocksOfNeighborChange(x, y, z, blockID);
|
||||
return true;
|
||||
}
|
||||
else if(entityplayer.getCurrentEquippedItem().getItem() instanceof IToolWrench && !entityplayer.getCurrentEquippedItem().getItemName().contains("omniwrench"))
|
||||
}
|
||||
else if(tool instanceof IToolWrench && !tool.getUnlocalizedName().contains("omniwrench"))
|
||||
{
|
||||
if(((IToolWrench)tool).canWrench(entityplayer, x, y, z))
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
|
@ -207,7 +214,7 @@ public class BlockEnergyCube extends BlockContainer
|
|||
return true;
|
||||
}
|
||||
|
||||
((IToolWrench)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z);
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
|
||||
int change = 0;
|
||||
|
||||
|
@ -238,6 +245,7 @@ public class BlockEnergyCube extends BlockContainer
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity != null)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.client.renderer.texture.IconRegister;
|
|||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -161,9 +162,12 @@ public class BlockGasTank extends BlockContainer
|
|||
|
||||
if(entityplayer.getCurrentEquippedItem() != null)
|
||||
{
|
||||
if(entityplayer.getCurrentEquippedItem().getItem() instanceof IToolConfigurator)
|
||||
Item tool = entityplayer.getCurrentEquippedItem().getItem();
|
||||
if(tool instanceof IToolConfigurator)
|
||||
{
|
||||
((IToolConfigurator)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z);
|
||||
if(((IToolConfigurator)tool).canWrench(entityplayer, x, y, z))
|
||||
{
|
||||
((IToolConfigurator)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
|
||||
int change = 0;
|
||||
|
||||
|
@ -187,7 +191,10 @@ public class BlockGasTank extends BlockContainer
|
|||
world.notifyBlocksOfNeighborChange(x, y, z, blockID);
|
||||
return true;
|
||||
}
|
||||
else if(entityplayer.getCurrentEquippedItem().getItem() instanceof IToolWrench && !entityplayer.getCurrentEquippedItem().getItemName().contains("omniwrench"))
|
||||
}
|
||||
else if(tool instanceof IToolWrench && !tool.getUnlocalizedName().contains("omniwrench"))
|
||||
{
|
||||
if(((IToolWrench)tool).canWrench(entityplayer, x, y, z))
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
|
@ -195,7 +202,7 @@ public class BlockGasTank extends BlockContainer
|
|||
return true;
|
||||
}
|
||||
|
||||
((IToolWrench)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z);
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
|
||||
int change = 0;
|
||||
|
||||
|
@ -220,6 +227,7 @@ public class BlockGasTank extends BlockContainer
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity != null)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.entity.EntityLiving;
|
|||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
@ -505,9 +506,12 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
|
||||
if(entityplayer.getCurrentEquippedItem() != null)
|
||||
{
|
||||
if(entityplayer.getCurrentEquippedItem().getItem() instanceof IToolConfigurator)
|
||||
Item tool = entityplayer.getCurrentEquippedItem().getItem();
|
||||
if(tool instanceof IToolConfigurator)
|
||||
{
|
||||
((IToolConfigurator)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z);
|
||||
if(((IToolConfigurator)tool).canWrench(entityplayer, x, y, z))
|
||||
{
|
||||
((IToolConfigurator)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
|
||||
int change = 0;
|
||||
|
||||
|
@ -531,7 +535,10 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
world.notifyBlocksOfNeighborChange(x, y, z, blockID);
|
||||
return true;
|
||||
}
|
||||
else if(entityplayer.getCurrentEquippedItem().getItem() instanceof IToolWrench && !entityplayer.getCurrentEquippedItem().getItemName().contains("omniwrench"))
|
||||
}
|
||||
else if(tool instanceof IToolWrench && !tool.getUnlocalizedName().contains("omniwrench"))
|
||||
{
|
||||
if(((IToolWrench)tool).canWrench(entityplayer, x, y, z))
|
||||
{
|
||||
if(entityplayer.isSneaking() && metadata != 13)
|
||||
{
|
||||
|
@ -539,7 +546,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
return true;
|
||||
}
|
||||
|
||||
((IToolWrench)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z);
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
|
||||
int change = 0;
|
||||
|
||||
|
@ -564,6 +571,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity != null)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue