Update the Tiles for Storage. Also work on Drops. Not Finished.
This commit is contained in:
parent
e6b1f4f07a
commit
c25ab8227a
11 changed files with 290 additions and 199 deletions
|
@ -1,6 +1,9 @@
|
|||
package techreborn.blocks.storage;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
|
@ -20,5 +23,9 @@ public class BlockBatBox extends BlockEnergyStorage
|
|||
{
|
||||
return new TileBatBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
dropInventory(worldIn, pos, new ItemStack(this));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import reborncore.common.BaseTileBlock;
|
|||
import reborncore.common.blocks.IRotationTexture;
|
||||
import techreborn.Core;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -48,6 +47,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
public BlockEnergyStorage(String name, int guiID)
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2f);
|
||||
setUnlocalizedName("techreborn." + name.toLowerCase());
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||
|
@ -125,23 +125,20 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
setFacing(facing, worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
dropInventory(worldIn, pos);
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
}
|
||||
|
||||
protected void dropInventory(World world, BlockPos pos)
|
||||
|
||||
protected void dropInventory(World world, BlockPos pos, ItemStack itemToDrop)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (tileEntity == null)
|
||||
{
|
||||
System.out.print("Null");
|
||||
return;
|
||||
}
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -171,7 +168,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
}
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
|
||||
items.add(itemToDrop);
|
||||
for (ItemStack itemStack : items)
|
||||
{
|
||||
Random rand = new Random();
|
||||
|
@ -195,6 +192,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
world.spawnEntityInWorld(entityItem);
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,7 +268,6 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
items.add(new ItemStack(ModBlocks.machineframe));
|
||||
return items;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package techreborn.blocks.storage;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.storage.TileMFE;
|
||||
|
||||
/**
|
||||
|
@ -20,5 +24,10 @@ public class BlockMFE extends BlockEnergyStorage
|
|||
{
|
||||
return new TileMFE();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
dropInventory(worldIn, pos, new ItemStack(ModBlocks.machineframe));
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package techreborn.blocks.storage;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.storage.TileMFSU;
|
||||
|
||||
/**
|
||||
|
@ -13,6 +17,7 @@ public class BlockMFSU extends BlockEnergyStorage
|
|||
public BlockMFSU()
|
||||
{
|
||||
super("MFSU", GuiHandler.mfsuID);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,4 +26,11 @@ public class BlockMFSU extends BlockEnergyStorage
|
|||
return new TileMFSU();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
dropInventory(worldIn, pos, new ItemStack(ModBlocks.machineframe, 1 ,7));
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue