"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;
@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;
}

View file

@ -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";

View file

@ -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());
}
/**