Fix deprecation warnings

This commit is contained in:
Raoul Van den Berge
2016-09-10 13:57:56 +02:00
parent 4f68f1047a
commit f3e983b6ca
11 changed files with 28 additions and 3 deletions

View File

@@ -105,7 +105,7 @@ public final class CompareUtils {
} }
if ((flags & COMPARE_NBT) == COMPARE_NBT) { if ((flags & COMPARE_NBT) == COMPARE_NBT) {
if (left.tag != null && !left.tag.equals(right)) { if (left.tag != null && !left.tag.equals(right.tag)) {
return false; return false;
} }
} }

View File

@@ -24,6 +24,7 @@ public final class FluidUtils {
return stack == null ? null : stack.copy(); return stack == null ? null : stack.copy();
} }
@SuppressWarnings("deprecation")
public static FluidStack getFluidFromStack(ItemStack stack, boolean simulate) { public static FluidStack getFluidFromStack(ItemStack stack, boolean simulate) {
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) { if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) {
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).drain(Fluid.BUCKET_VOLUME, !simulate); return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).drain(Fluid.BUCKET_VOLUME, !simulate);

View File

@@ -59,6 +59,7 @@ public abstract class BlockBase extends Block {
} }
@Override @Override
@SuppressWarnings("deprecation")
public IBlockState getStateFromMeta(int meta) { public IBlockState getStateFromMeta(int meta) {
return getDefaultState(); return getDefaultState();
} }
@@ -69,6 +70,7 @@ public abstract class BlockBase extends Block {
} }
@Override @Override
@SuppressWarnings("deprecation")
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
if (getPlacementType() != null) { if (getPlacementType() != null) {
return state.withProperty(DIRECTION, ((TileBase) world.getTileEntity(pos)).getDirection()); return state.withProperty(DIRECTION, ((TileBase) world.getTileEntity(pos)).getDirection());

View File

@@ -117,6 +117,7 @@ public class BlockCable extends BlockCoverable {
} }
@Override @Override
@SuppressWarnings("deprecation")
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
state = super.getActualState(state, world, pos) state = super.getActualState(state, world, pos)
.withProperty(NORTH, hasConnectionWith(world, pos, EnumFacing.NORTH)) .withProperty(NORTH, hasConnectionWith(world, pos, EnumFacing.NORTH))

View File

@@ -113,6 +113,7 @@ public class BlockController extends BlockBase {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) { public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) {
super.neighborChanged(state, world, pos, block); super.neighborChanged(state, world, pos, block);

View File

@@ -40,6 +40,7 @@ public class BlockDetector extends BlockNode {
} }
@Override @Override
@SuppressWarnings("deprecation")
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return AABB_DETECTOR; return AABB_DETECTOR;
} }
@@ -50,16 +51,19 @@ public class BlockDetector extends BlockNode {
} }
@Override @Override
@SuppressWarnings("deprecation")
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
return ((TileDetector) world.getTileEntity(pos)).isPowered() ? 15 : 0; return ((TileDetector) world.getTileEntity(pos)).isPowered() ? 15 : 0;
} }
@Override @Override
@SuppressWarnings("deprecation")
public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
return getWeakPower(state, world, pos, side); return getWeakPower(state, world, pos, side);
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean canProvidePower(IBlockState state) { public boolean canProvidePower(IBlockState state) {
return true; return true;
} }
@@ -74,11 +78,13 @@ public class BlockDetector extends BlockNode {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean isOpaqueCube(IBlockState state) { public boolean isOpaqueCube(IBlockState state) {
return false; return false;
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean isFullCube(IBlockState state) { public boolean isFullCube(IBlockState state) {
return false; return false;
} }

View File

@@ -40,6 +40,7 @@ public class BlockSolderer extends BlockNode {
} }
@Override @Override
@SuppressWarnings("deprecation")
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return AABB_SOLDERER; return AABB_SOLDERER;
} }
@@ -58,11 +59,13 @@ public class BlockSolderer extends BlockNode {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean isOpaqueCube(IBlockState state) { public boolean isOpaqueCube(IBlockState state) {
return false; return false;
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean isFullCube(IBlockState state) { public boolean isFullCube(IBlockState state) {
return false; return false;
} }

View File

@@ -40,6 +40,7 @@ public class BlockWirelessTransmitter extends BlockNode {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) { public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block) {
if (!canPlaceBlockAt(world, pos) && world.getBlockState(pos).getBlock() == this) { if (!canPlaceBlockAt(world, pos) && world.getBlockState(pos).getBlock() == this) {
dropBlockAsItem(world, pos, state, 0); dropBlockAsItem(world, pos, state, 0);
@@ -49,16 +50,19 @@ public class BlockWirelessTransmitter extends BlockNode {
} }
@Override @Override
@SuppressWarnings("deprecation")
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return WIRELESS_TRANSMITTER_AABB; return WIRELESS_TRANSMITTER_AABB;
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean isOpaqueCube(IBlockState state) { public boolean isOpaqueCube(IBlockState state) {
return false; return false;
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean isFullCube(IBlockState state) { public boolean isFullCube(IBlockState state) {
return false; return false;
} }

View File

@@ -221,6 +221,7 @@ public abstract class TileBase extends TileEntity implements ITickable {
return handler; return handler;
} }
@SuppressWarnings("deprecation")
protected IFluidHandler getFluidHandler(TileEntity tile, EnumFacing side) { protected IFluidHandler getFluidHandler(TileEntity tile, EnumFacing side) {
if (tile == null) { if (tile == null) {
return null; return null;

View File

@@ -77,9 +77,13 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
ItemStack took = network.extractItem(itemFilters.getStackInSlot(0), 1, compare); ItemStack took = network.extractItem(itemFilters.getStackInSlot(0), 1, compare);
if (took != null) { if (took != null) {
worldObj.setBlockState(front, block.getBlock().getStateFromMeta(took.getMetadata()), 1 | 2); @SuppressWarnings("deprecation")
IBlockState state = block.getBlock().getStateFromMeta(took.getMetadata());
worldObj.setBlockState(front, state, 1 | 2);
// From ItemBlock.onItemUse // From ItemBlock.onItemUse
SoundType blockSound = block.getBlock().getSoundType(); SoundType blockSound = block.getBlock().getSoundType(state, worldObj, pos, null);
worldObj.playSound(null, front, blockSound.getPlaceSound(), SoundCategory.BLOCKS, (blockSound.getVolume() + 1.0F) / 2.0F, blockSound.getPitch() * 0.8F); worldObj.playSound(null, front, blockSound.getPlaceSound(), SoundCategory.BLOCKS, (blockSound.getVolume() + 1.0F) / 2.0F, blockSound.getPitch() * 0.8F);
} else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) { } else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
ItemStack craft = itemFilters.getStackInSlot(0); ItemStack craft = itemFilters.getStackInSlot(0);

View File

@@ -73,6 +73,8 @@ public class TileDestructor extends TileMultipartNode implements IComparable, IF
BlockPos front = pos.offset(getDirection()); BlockPos front = pos.offset(getDirection());
IBlockState frontBlockState = worldObj.getBlockState(front); IBlockState frontBlockState = worldObj.getBlockState(front);
@SuppressWarnings("deprecation")
ItemStack frontStack = frontBlockState.getBlock().getItem(worldObj, front, frontBlockState); ItemStack frontStack = frontBlockState.getBlock().getItem(worldObj, front, frontBlockState);
if (frontStack != null) { if (frontStack != null) {