"Removed" deprecated code.

This commit is contained in:
Michael Zanga 2017-01-11 15:27:06 -05:00
parent 108a290c93
commit 0624b9f76a
3 changed files with 16 additions and 16 deletions

View file

@ -27,6 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@SuppressWarnings("deprecation")
public class BlockDimWall extends Block { public class BlockDimWall extends Block {
public static final String ID = "blockDimWall"; public static final String ID = "blockDimWall";
public static final PropertyInteger TYPE = PropertyInteger.create("type", 0, 2); public static final PropertyInteger TYPE = PropertyInteger.create("type", 0, 2);
@ -107,19 +108,16 @@ public class BlockDimWall extends Block {
@Override @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) { 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 //Check if the metadata value is 0 -- we don't want the user to replace Ancient Fabric
ItemStack playerEquip = player.getHeldItemMainhand(); if (heldItem != null && state.getValue(TYPE) != 1) {
if (playerEquip != null && state.getValue(TYPE) != 1) { Block block = Block.getBlockFromItem(heldItem.getItem());
Block block = Block.getBlockFromItem(playerEquip.getItem()); if (!state.isNormalCube() || block instanceof BlockContainer || block == this)
if (block != null) {
if (!block.isNormalCube(state) || block instanceof BlockContainer || block == this)
return false; return false;
if (!world.isRemote) { if (!world.isRemote) {
if (!player.capabilities.isCreativeMode) playerEquip.stackSize--; if (!player.capabilities.isCreativeMode) heldItem.stackSize--;
world.setBlockState(pos, block.getStateFromMeta(playerEquip.getItemDamage())); world.setBlockState(pos, state);
} }
return true; return true;
} }
}
return false; return false;
} }
} }

View file

@ -30,6 +30,7 @@ import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@SuppressWarnings("deprecation")
public class BlockRift extends Block implements ITileEntityProvider { public class BlockRift extends Block implements ITileEntityProvider {
private static final float MIN_IMMUNE_RESISTANCE = 5000.0F; private static final float MIN_IMMUNE_RESISTANCE = 5000.0F;
public static final String ID = "blockRift"; public static final String ID = "blockRift";

View file

@ -7,6 +7,7 @@ import com.zixiken.dimdoors.DimDoors;
import com.zixiken.dimdoors.blocks.BlockDimDoorBase; import com.zixiken.dimdoors.blocks.BlockDimDoorBase;
import com.zixiken.dimdoors.blocks.ModBlocks; import com.zixiken.dimdoors.blocks.ModBlocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -75,8 +76,8 @@ public abstract class ItemDoorBase extends ItemDoor {
ItemDoorBase mappedItem = doorItemMapping.get(stack.getItem()); ItemDoorBase mappedItem = doorItemMapping.get(stack.getItem());
if (mappedItem == null) return false; if (mappedItem == null) return false;
BlockDimDoorBase doorBlock = mappedItem.getDoorBlock(); BlockDimDoorBase doorBlock = mappedItem.getDoorBlock();
if (ItemDoorBase.placeDoorOnBlock(doorBlock, stack, player, world, pos, side)) return true; return ItemDoorBase.placeDoorOnBlock(doorBlock, stack, player, world, pos, side) ||
return ItemDoorBase.placeDoorOnRift(doorBlock, world, player, stack); ItemDoorBase.placeDoorOnRift(doorBlock, world, player, stack);
} }
/** /**
@ -143,9 +144,9 @@ public abstract class ItemDoorBase extends ItemDoor {
} }
public static boolean canPlace(World world, BlockPos pos) { 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());
} }
/** /**