Auto remove un needed things in the code

This commit is contained in:
modmuss50 2016-04-03 14:34:39 +01:00
parent 7e7fcf2ad9
commit 510f969c94
105 changed files with 141 additions and 348 deletions

View file

@ -47,7 +47,7 @@ public class BlockMachineCasing extends BlockMultiblockBase implements ITextured
@Override
public int getMetaFromState(IBlockState state)
{
return (Integer) state.getValue(METADATA);
return state.getValue(METADATA);
}
protected BlockStateContainer createBlockState()
@ -104,12 +104,12 @@ public class BlockMachineCasing extends BlockMultiblockBase implements ITextured
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
Block b = worldIn.getBlockState(pos).getBlock();
return b == (Block) this ? false : super.shouldSideBeRendered(blockState, worldIn, pos, side);
return b != (Block) this && super.shouldSideBeRendered(blockState, worldIn, pos, side);
}
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta)
{
return block == (Block) this;
return block == this;
}
@Override

View file

@ -128,7 +128,7 @@ public class BlockNuke extends BaseBlock implements ITexturedBlock
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(OVERLAY, Boolean.valueOf((meta & 1) > 0));
return this.getDefaultState().withProperty(OVERLAY, (meta & 1) > 0);
}
protected BlockStateContainer createBlockState()

View file

@ -1,6 +1,5 @@
package techreborn.blocks;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@ -149,7 +148,7 @@ public class BlockOre extends BaseBlock implements ITexturedBlock, IOreNameProvi
return set.drop(fortune, random);
}
ArrayList<ItemStack> block = new ArrayList<ItemStack>();
ArrayList<ItemStack> block = new ArrayList<>();
block.add(new ItemStack(Item.getItemFromBlock(this), 1, metadata));
return block;
}

View file

@ -153,7 +153,7 @@ public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBl
@Override
public int getMetaFromState(IBlockState state)
{
return (Integer) state.getValue(METADATA);
return state.getValue(METADATA);
}
protected BlockStateContainer createBlockState()

View file

@ -35,8 +35,8 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
setUnlocalizedName("techreborn.rubberleaves");
setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this);
this.setDefaultState(this.getDefaultState().withProperty(CHECK_DECAY, Boolean.valueOf(true))
.withProperty(DECAYABLE, Boolean.valueOf(true)));
this.setDefaultState(this.getDefaultState().withProperty(CHECK_DECAY, true)
.withProperty(DECAYABLE, true));
}
@Override
@ -48,7 +48,7 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
@Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
{
List<ItemStack> list = new java.util.ArrayList<ItemStack>();
List<ItemStack> list = new java.util.ArrayList<>();
list.add(new ItemStack(this, 1, 0));
return list;
}
@ -73,8 +73,8 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
@Override
protected ItemStack createStackedBlock(IBlockState state)
{
IBlockState newState = state.withProperty(CHECK_DECAY, Boolean.valueOf(false)).withProperty(DECAYABLE,
Boolean.valueOf(false));
IBlockState newState = state.withProperty(CHECK_DECAY, false).withProperty(DECAYABLE,
false);
return super.createStackedBlock(newState);
}
@ -100,19 +100,19 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(DECAYABLE, Boolean.valueOf((meta & 1) == 0))
.withProperty(CHECK_DECAY, Boolean.valueOf((meta & 2) > 0));
return this.getDefaultState().withProperty(DECAYABLE, (meta & 1) == 0)
.withProperty(CHECK_DECAY, (meta & 2) > 0);
}
@Override
public int getMetaFromState(IBlockState state)
{
int meta = 0;
if (!((Boolean) state.getValue(DECAYABLE)).booleanValue())
if (!(Boolean) state.getValue(DECAYABLE))
{
meta |= 1;
}
if (((Boolean) state.getValue(CHECK_DECAY)).booleanValue())
if ((Boolean) state.getValue(CHECK_DECAY))
{
meta |= 2;
}

View file

@ -204,7 +204,7 @@ public class BlockRubberLog extends Block implements ITexturedBlock
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
List<ItemStack> drops = new ArrayList<ItemStack>();
List<ItemStack> drops = new ArrayList<>();
drops.add(new ItemStack(this));
if (state.getValue(HAS_SAP))
{

View file

@ -23,7 +23,7 @@ public class BlockRubberSapling extends BlockSapling
{
setUnlocalizedName("techreborn.rubbersapling");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.setDefaultState(this.getDefaultState().withProperty(STAGE, Integer.valueOf(0)));
this.setDefaultState(this.getDefaultState().withProperty(STAGE, 0));
}
@Override

View file

@ -91,7 +91,7 @@ public class BlockStorage2 extends BaseBlock implements ITexturedBlock
@Override
public int getMetaFromState(IBlockState state)
{
return (Integer) state.getValue(METADATA);
return state.getValue(METADATA);
}
protected BlockStateContainer createBlockState()

View file

@ -42,13 +42,13 @@ public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock
@Override
public IBlockState getStateFromMeta(int meta)
{
return getDefaultState().withProperty(ACTIVE, meta == 0 ? false : true);
return getDefaultState().withProperty(ACTIVE, meta != 0);
}
@Override
public int getMetaFromState(IBlockState state)
{
return state.getValue(ACTIVE) == true ? 1 : 0;
return state.getValue(ACTIVE) ? 1 : 0;
}
@Override

View file

@ -48,7 +48,7 @@ public class BlockAlloyFurnace extends BlockMachineBase implements IRotationText
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> items = new ArrayList<>();
items.add(new ItemStack(this));
return items;
}

View file

@ -52,7 +52,7 @@ public class BlockIronFurnace extends BlockMachineBase implements IRotationTextu
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> items = new ArrayList<>();
items.add(new ItemStack(this));
return items;
}
@ -63,7 +63,7 @@ public class BlockIronFurnace extends BlockMachineBase implements IRotationTextu
{
if (this.isActive(state))
{
EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
EnumFacing enumfacing = state.getValue(FACING);
double d0 = (double) pos.getX() + 0.5D;
double d1 = (double) pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
double d2 = (double) pos.getZ() + 0.5D;

View file

@ -1,20 +1,16 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.client.GuiHandler;
import techreborn.init.ModBlocks;
import techreborn.tiles.storage.TileBatBox;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Created by modmuss50 on 14/03/2016.

View file

@ -88,7 +88,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
Block block2 = state2.getBlock();
IBlockState state3 = worldIn.getBlockState(pos.east());
Block block3 = state3.getBlock();
EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
EnumFacing enumfacing = state.getValue(FACING);
if (enumfacing == EnumFacing.NORTH && block.isFullBlock(state) && !block1.isFullBlock(state1))
{
@ -141,7 +141,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
IInventory inventory = (IInventory) tileEntity;
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> items = new ArrayList<>();
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
@ -274,7 +274,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
{
if (this instanceof IRotationTexture)
{
IRotationTexture rotationTexture = (IRotationTexture) this;
IRotationTexture rotationTexture = this;
if (getFacing(blockState) == facing)
{
return rotationTexture.getFrontOff();

View file

@ -52,7 +52,7 @@ public class BlockLESUStorage extends BlockMachineBase implements IAdvancedRotat
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> items = new ArrayList<>();
items.add(new ItemStack(this));
return items;
}
@ -65,7 +65,7 @@ public class BlockLESUStorage extends BlockMachineBase implements IAdvancedRotat
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta)
{
return block == (Block) this;
return block == this;
}
@Override

View file

@ -1,9 +1,7 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@ -12,10 +10,8 @@ import techreborn.client.GuiHandler;
import techreborn.init.ModBlocks;
import techreborn.tiles.storage.TileMFE;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Created by modmuss50 on 14/03/2016.

View file

@ -1,9 +1,7 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@ -14,7 +12,6 @@ import techreborn.tiles.storage.TileMFSU;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Created by modmuss50 on 14/03/2016.

View file

@ -72,7 +72,7 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
Block block2 = state2.getBlock();
IBlockState state3 = worldIn.getBlockState(pos.east());
Block block3 = state3.getBlock();
EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
EnumFacing enumfacing = state.getValue(FACING);
if (enumfacing == EnumFacing.NORTH && block.isFullBlock(state) && !block1.isFullBlock(state1))
{
@ -128,7 +128,7 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
IInventory inventory = (IInventory) tileEntity;
List<ItemStack> items = new ArrayList<ItemStack>();
List<ItemStack> items = new ArrayList<>();
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
@ -262,7 +262,7 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
{
if (this instanceof IRotationTexture)
{
IRotationTexture rotationTexture = (IRotationTexture) this;
IRotationTexture rotationTexture = this;
if (getFacing(blockState) == facing)
{
return rotationTexture.getFrontOff();