Fixed a couple of bugs with items that need to be held not working

This commit is contained in:
Ellpeck 2016-05-02 07:50:13 +02:00
parent eed5cbdc92
commit bfc68919f3
6 changed files with 6 additions and 6 deletions

View file

@ -104,7 +104,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy());
}
else{
player.getActiveItemStack().stackSize += tile.slots[0].stackSize;
stackPlayer.stackSize += tile.slots[0].stackSize;
}
tile.slots[0] = null;
tile.markDirty();

View file

@ -111,7 +111,7 @@ public abstract class BlockContainerBase extends BlockContainer{
}
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
ItemStack stack = player.getActiveItemStack();
ItemStack stack = player.getHeldItemMainhand();
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle){

View file

@ -42,7 +42,7 @@ public class ItemGrowthRing extends ItemEnergy{
}
EntityPlayer player = (EntityPlayer)entity;
ItemStack equipped = player.getActiveItemStack();
ItemStack equipped = player.getHeldItemMainhand();
int energyUse = 300;
if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= energyUse){

View file

@ -63,7 +63,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem{
if(!world.isRemote && stack.getItemDamage() < allRings.length){
if(player instanceof EntityPlayer){
EntityPlayer thePlayer = (EntityPlayer)player;
ItemStack equippedStack = ((EntityPlayer)player).getActiveItemStack();
ItemStack equippedStack = ((EntityPlayer)player).getHeldItemMainhand();
ThePotionRings effect = ThePotionRings.values()[stack.getItemDamage()];
Potion potion = Potion.getPotionById(effect.effectID);

View file

@ -36,7 +36,7 @@ public class ItemWaterRemovalRing extends ItemEnergy{
}
EntityPlayer player = (EntityPlayer)entity;
ItemStack equipped = player.getActiveItemStack();
ItemStack equipped = player.getHeldItemMainhand();
int energyUse = 350;
if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= energyUse){

View file

@ -354,7 +354,7 @@ public class WorldUtil{
Block block = PosUtil.getBlock(pos, world);
IBlockState state = world.getBlockState(pos);
TileEntity tile = world.getTileEntity(pos);
ItemStack stack = player.getActiveItemStack();
ItemStack stack = player.getHeldItemMainhand();
//If the Block can be harvested or not
boolean canHarvest = block.canHarvestBlock(world, pos, player);