reformat
This commit is contained in:
@@ -13,10 +13,12 @@ import storagecraft.StorageCraft;
|
||||
import storagecraft.tile.TileBase;
|
||||
import storagecraft.util.InventoryUtils;
|
||||
|
||||
public abstract class BlockBase extends Block {
|
||||
public abstract class BlockBase extends Block
|
||||
{
|
||||
private String name;
|
||||
|
||||
public BlockBase(String name) {
|
||||
public BlockBase(String name)
|
||||
{
|
||||
super(Material.rock);
|
||||
|
||||
this.name = name;
|
||||
@@ -26,20 +28,24 @@ public abstract class BlockBase extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
public String getUnlocalizedName()
|
||||
{
|
||||
return "block." + StorageCraft.ID + ":" + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis) {
|
||||
public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileBase) {
|
||||
if (tile instanceof TileBase)
|
||||
{
|
||||
ForgeDirection dir = ((TileBase) tile).getDirection();
|
||||
|
||||
int newDir = dir.ordinal() + 1;
|
||||
|
||||
if (newDir > ForgeDirection.VALID_DIRECTIONS.length - 1) {
|
||||
if (newDir > ForgeDirection.VALID_DIRECTIONS.length - 1)
|
||||
{
|
||||
newDir = 0;
|
||||
}
|
||||
|
||||
@@ -54,26 +60,31 @@ public abstract class BlockBase extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) {
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
||||
{
|
||||
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileBase) {
|
||||
if (tile instanceof TileBase)
|
||||
{
|
||||
((TileBase) tile).setDirection(ForgeDirection.getOrientation(BlockPistonBase.determineOrientation(world, x, y, z, entityLiving)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPreDestroy(World world, int x, int y, int z, int meta) {
|
||||
public void onBlockPreDestroy(World world, int x, int y, int z, int meta)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof IInventory) {
|
||||
if (tile instanceof IInventory)
|
||||
{
|
||||
InventoryUtils.dropInventory(world, (IInventory) tile, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user