diff --git a/src/main/java/techreborn/blocks/storage/BlockBatBox.java b/src/main/java/techreborn/blocks/storage/BlockBatBox.java index 9ac63c696..c18082aa0 100644 --- a/src/main/java/techreborn/blocks/storage/BlockBatBox.java +++ b/src/main/java/techreborn/blocks/storage/BlockBatBox.java @@ -9,6 +9,7 @@ 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; @@ -30,37 +31,11 @@ public class BlockBatBox extends BlockEnergyStorage { return new TileBatBox(); } - @Override - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { - ArrayList items = (ArrayList) dropInventory(worldIn, pos, new ItemStack(this)); - for(ItemStack itemStack : items){ - Random rand = new Random(); - - float dX = rand.nextFloat() * 0.8F + 0.1F; - float dY = rand.nextFloat() * 0.8F + 0.1F; - float dZ = rand.nextFloat() * 0.8F + 0.1F; - - EntityItem entityItem = new EntityItem(worldIn, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, - itemStack.copy()); - - if (itemStack.hasTagCompound()) - { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); - } - - float factor = 0.05F; - entityItem.motionX = rand.nextGaussian() * factor; - entityItem.motionY = rand.nextGaussian() * factor + 0.2F; - entityItem.motionZ = rand.nextGaussian() * factor; - worldIn.spawnEntityInWorld(entityItem); - itemStack.stackSize = 0; - } - } @Override public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { - - return new ArrayList(); + ArrayList list = new ArrayList<>(); + list.add(new ItemStack(this)); + return list; } } diff --git a/src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java b/src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java index 01815518c..a63287393 100644 --- a/src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java +++ b/src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java @@ -28,6 +28,7 @@ import techreborn.Core; import techreborn.client.TechRebornCreativeTab; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Random; @@ -131,14 +132,11 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat if (tileEntity == null) { - System.out.print("Null"); - return null; + return Collections.emptyList(); } if (!(tileEntity instanceof IInventory)) { - - System.out.print("Not INstance"); - return null; + return Collections.emptyList(); } IInventory inventory = (IInventory) tileEntity; @@ -183,7 +181,6 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat @Override public IBlockState getStateFromMeta(int meta) { - boolean active = false; EnumFacing facing = getSideFromint(meta); return this.getDefaultState().withProperty(FACING, facing); } diff --git a/src/main/java/techreborn/blocks/storage/BlockMFE.java b/src/main/java/techreborn/blocks/storage/BlockMFE.java index 1ee75d563..beb0409f3 100644 --- a/src/main/java/techreborn/blocks/storage/BlockMFE.java +++ b/src/main/java/techreborn/blocks/storage/BlockMFE.java @@ -12,6 +12,7 @@ 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; @@ -31,37 +32,11 @@ public class BlockMFE extends BlockEnergyStorage { return new TileMFE(); } - @Override - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { - ArrayList items = (ArrayList) dropInventory(worldIn, pos, new ItemStack(ModBlocks.machineframe, 1 , 6)); - for(ItemStack itemStack : items){ - Random rand = new Random(); - - float dX = rand.nextFloat() * 0.8F + 0.1F; - float dY = rand.nextFloat() * 0.8F + 0.1F; - float dZ = rand.nextFloat() * 0.8F + 0.1F; - - EntityItem entityItem = new EntityItem(worldIn, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, - itemStack.copy()); - - if (itemStack.hasTagCompound()) - { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); - } - - float factor = 0.05F; - entityItem.motionX = rand.nextGaussian() * factor; - entityItem.motionY = rand.nextGaussian() * factor + 0.2F; - entityItem.motionZ = rand.nextGaussian() * factor; - worldIn.spawnEntityInWorld(entityItem); - itemStack.stackSize = 0; - } - } @Override public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { - - return new ArrayList(); + ArrayList list = new ArrayList<>(); + list.add(new ItemStack(ModBlocks.machineframe, 1 , 6)); + return list; } } diff --git a/src/main/java/techreborn/blocks/storage/BlockMFSU.java b/src/main/java/techreborn/blocks/storage/BlockMFSU.java index a50ed75db..c7db862d7 100644 --- a/src/main/java/techreborn/blocks/storage/BlockMFSU.java +++ b/src/main/java/techreborn/blocks/storage/BlockMFSU.java @@ -33,37 +33,10 @@ public class BlockMFSU extends BlockEnergyStorage return new TileMFSU(); } - @Override - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { - ArrayList items = (ArrayList) dropInventory(worldIn, pos, new ItemStack(ModBlocks.machineframe, 1 , 7)); - for(ItemStack itemStack : items){ - Random rand = new Random(); - - float dX = rand.nextFloat() * 0.8F + 0.1F; - float dY = rand.nextFloat() * 0.8F + 0.1F; - float dZ = rand.nextFloat() * 0.8F + 0.1F; - - EntityItem entityItem = new EntityItem(worldIn, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, - itemStack.copy()); - - if (itemStack.hasTagCompound()) - { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); - } - - float factor = 0.05F; - entityItem.motionX = rand.nextGaussian() * factor; - entityItem.motionY = rand.nextGaussian() * factor + 0.2F; - entityItem.motionZ = rand.nextGaussian() * factor; - worldIn.spawnEntityInWorld(entityItem); - itemStack.stackSize = 0; - } - } - @Override public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { - - return new ArrayList(); + ArrayList list = new ArrayList<>(); + list.add(new ItemStack(ModBlocks.machineframe, 1 , 7)); + return list; } }