mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-15 17:55:04 +00:00
* Some refactoring * Some refactoring Added some localization * Added some localization Fix wrong branch localization in page branch overview Simplify some localization * Simplify some localization * Removed unused localize method * Simplify some localization * Removed proxy.localise method * Simplify localization
147 lines
4.3 KiB
Java
147 lines
4.3 KiB
Java
package binnie.botany.ceramic;
|
|
|
|
import binnie.botany.Botany;
|
|
import binnie.botany.CreativeTabBotany;
|
|
import binnie.botany.genetics.EnumFlowerColor;
|
|
import binnie.core.block.BlockMetadata;
|
|
import binnie.core.block.IBlockMetadata;
|
|
import binnie.core.block.TileEntityMetadata;
|
|
import binnie.core.util.I18N;
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.EnumChatFormatting;
|
|
import net.minecraft.util.IIcon;
|
|
import net.minecraft.util.MovingObjectPosition;
|
|
import net.minecraft.world.IBlockAccess;
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class BlockCeramic extends Block implements IBlockMetadata {
|
|
public BlockCeramic() {
|
|
super(Material.rock);
|
|
setHardness(1.0f);
|
|
setResistance(5.0f);
|
|
setBlockName("ceramic");
|
|
setCreativeTab(CreativeTabBotany.instance);
|
|
}
|
|
|
|
@Override
|
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
|
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
|
}
|
|
|
|
@Override
|
|
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
|
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public TileEntity createNewTileEntity(World var1, int i) {
|
|
return new TileEntityMetadata();
|
|
}
|
|
|
|
@Override
|
|
public boolean hasTileEntity(int meta) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
|
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
|
TileEntity tileentity = world.getTileEntity(x, y, z);
|
|
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
|
}
|
|
|
|
@Override
|
|
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
|
return TileEntityMetadata.getItemDamage(itemStack);
|
|
}
|
|
|
|
@Override
|
|
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
|
return tileMeta;
|
|
}
|
|
|
|
@Override
|
|
public String getBlockName(ItemStack itemStack) {
|
|
return I18N.localise("botany.ceramicBlock");
|
|
}
|
|
|
|
@Override
|
|
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
|
int meta = TileEntityMetadata.getItemDamage(stack);
|
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
|
}
|
|
|
|
@Override
|
|
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
|
dropBlockAsItem(world, x, y, z, itemStack);
|
|
}
|
|
|
|
@Override
|
|
public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
|
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
|
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
|
}
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
|
if (tile != null) {
|
|
return getIcon(side, tile.getTileMetadata());
|
|
}
|
|
return super.getIcon(world, x, y, z, side);
|
|
}
|
|
|
|
@Override
|
|
public IIcon getIcon(int side, int meta) {
|
|
return blockIcon;
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister register) {
|
|
blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
|
if (tile != null) {
|
|
return getRenderColor(tile.getTileMetadata());
|
|
}
|
|
return 0xffffff;
|
|
}
|
|
|
|
@Override
|
|
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
|
super.breakBlock(world, x, y, z, block, side);
|
|
world.removeTileEntity(x, y, z);
|
|
}
|
|
|
|
@Override
|
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
|
return BlockMetadata.getPickBlock(world, x, y, z);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public int getRenderColor(int meta) {
|
|
return EnumFlowerColor.get(meta).getColor(false);
|
|
}
|
|
}
|