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 (left.tag != null && !left.tag.equals(right)) {
if (left.tag != null && !left.tag.equals(right.tag)) {
return false;
}
}

View File

@@ -24,6 +24,7 @@ public final class FluidUtils {
return stack == null ? null : stack.copy();
}
@SuppressWarnings("deprecation")
public static FluidStack getFluidFromStack(ItemStack stack, boolean simulate) {
if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) {
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
@SuppressWarnings("deprecation")
public IBlockState getStateFromMeta(int meta) {
return getDefaultState();
}
@@ -69,6 +70,7 @@ public abstract class BlockBase extends Block {
}
@Override
@SuppressWarnings("deprecation")
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
if (getPlacementType() != null) {
return state.withProperty(DIRECTION, ((TileBase) world.getTileEntity(pos)).getDirection());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -221,6 +221,7 @@ public abstract class TileBase extends TileEntity implements ITickable {
return handler;
}
@SuppressWarnings("deprecation")
protected IFluidHandler getFluidHandler(TileEntity tile, EnumFacing side) {
if (tile == 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);
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
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);
} else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
ItemStack craft = itemFilters.getStackInSlot(0);

View File

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