From 0624b9f76a2c611c77b5a1e1f02bd04b28c6b267 Mon Sep 17 00:00:00 2001 From: Michael Zanga Date: Wed, 11 Jan 2017 15:27:06 -0500 Subject: [PATCH] "Removed" deprecated code. --- .../zixiken/dimdoors/blocks/BlockDimWall.java | 22 +++++++++---------- .../zixiken/dimdoors/blocks/BlockRift.java | 1 + .../zixiken/dimdoors/items/ItemDoorBase.java | 9 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimWall.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimWall.java index 849b4280..a4019f33 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimWall.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimWall.java @@ -27,6 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; +@SuppressWarnings("deprecation") public class BlockDimWall extends Block { public static final String ID = "blockDimWall"; public static final PropertyInteger TYPE = PropertyInteger.create("type", 0, 2); @@ -107,18 +108,15 @@ public class BlockDimWall extends Block { @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { //Check if the metadata value is 0 -- we don't want the user to replace Ancient Fabric - ItemStack playerEquip = player.getHeldItemMainhand(); - if (playerEquip != null && state.getValue(TYPE) != 1) { - Block block = Block.getBlockFromItem(playerEquip.getItem()); - if (block != null) { - if (!block.isNormalCube(state) || block instanceof BlockContainer || block == this) - return false; - if (!world.isRemote) { - if (!player.capabilities.isCreativeMode) playerEquip.stackSize--; - world.setBlockState(pos, block.getStateFromMeta(playerEquip.getItemDamage())); - } - return true; - } + if (heldItem != null && state.getValue(TYPE) != 1) { + Block block = Block.getBlockFromItem(heldItem.getItem()); + if (!state.isNormalCube() || block instanceof BlockContainer || block == this) + return false; + if (!world.isRemote) { + if (!player.capabilities.isCreativeMode) heldItem.stackSize--; + world.setBlockState(pos, state); + } + return true; } return false; } diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockRift.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockRift.java index c2af8a49..d37a4716 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockRift.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockRift.java @@ -30,6 +30,7 @@ import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +@SuppressWarnings("deprecation") public class BlockRift extends Block implements ITileEntityProvider { private static final float MIN_IMMUNE_RESISTANCE = 5000.0F; public static final String ID = "blockRift"; diff --git a/src/main/java/com/zixiken/dimdoors/items/ItemDoorBase.java b/src/main/java/com/zixiken/dimdoors/items/ItemDoorBase.java index e86c0e65..d7bae9cf 100644 --- a/src/main/java/com/zixiken/dimdoors/items/ItemDoorBase.java +++ b/src/main/java/com/zixiken/dimdoors/items/ItemDoorBase.java @@ -7,6 +7,7 @@ import com.zixiken.dimdoors.DimDoors; import com.zixiken.dimdoors.blocks.BlockDimDoorBase; import com.zixiken.dimdoors.blocks.ModBlocks; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; @@ -75,8 +76,8 @@ public abstract class ItemDoorBase extends ItemDoor { ItemDoorBase mappedItem = doorItemMapping.get(stack.getItem()); if (mappedItem == null) return false; BlockDimDoorBase doorBlock = mappedItem.getDoorBlock(); - if (ItemDoorBase.placeDoorOnBlock(doorBlock, stack, player, world, pos, side)) return true; - return ItemDoorBase.placeDoorOnRift(doorBlock, world, player, stack); + return ItemDoorBase.placeDoorOnBlock(doorBlock, stack, player, world, pos, side) || + ItemDoorBase.placeDoorOnRift(doorBlock, world, player, stack); } /** @@ -143,9 +144,9 @@ public abstract class ItemDoorBase extends ItemDoor { } public static boolean canPlace(World world, BlockPos pos) { - Block block = world.getBlockState(pos).getBlock(); + IBlockState state = world.getBlockState(pos); - return (block == ModBlocks.blockRift || world.getBlockState(pos).equals(Blocks.AIR) || block.getMaterial(world.getBlockState(pos)).isReplaceable()); + return (state.getBlock() == ModBlocks.blockRift || state.equals(Blocks.AIR) || state.getMaterial().isReplaceable()); } /**