Easier handling of meta blocks

This commit is contained in:
Nick 2015-11-17 15:52:31 -08:00
parent fb94914b91
commit 9035f800e2
16 changed files with 436 additions and 277 deletions

View file

@ -0,0 +1,34 @@
package WayofTime.bloodmagic.block.base;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public abstract class BlockStringContainer extends BlockString implements ITileEntityProvider {
public BlockStringContainer(Material material, String[] values, String propName) {
super(material, values, propName);
this.isBlockContainer = true;
}
public BlockStringContainer(Material material, String[] values) {
this(material, values, "type");
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
super.breakBlock(worldIn, pos, state);
worldIn.removeTileEntity(pos);
}
@Override
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) {
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
TileEntity tileentity = worldIn.getTileEntity(pos);
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
}
}