Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.nextlevelminecraft.cad435.objloader.ColoredLamp;
- //Block_Class
- import com.nextlevelminecraft.cad435.TNL_Client_Dependencies.MoreStuff.MoreTab;
- import com.nextlevelminecraft.cad435.TNL_Client_Dependencies.libs.CLC_API_RGBWuerfel;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import net.minecraft.block.BlockContainer;
- import net.minecraft.block.material.Material;
- import net.minecraft.client.renderer.texture.IIconRegister;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.IIcon;
- import net.minecraft.world.IBlockAccess;
- import net.minecraft.world.World;
- public class LampBlock extends BlockContainer {
- public LampBlock(Material mat) {
- super(mat);
- this.setLightLevel(1.0F);
- this.setBlockTextureName("objloader:clear");
- this.setCreativeTab(MoreTab.MoreItemTab);
- this.setHardness(0.3F);
- this.lightValue = CLC_API_RGBWuerfel.makeRGBLightValue(255, 255, 255, 15);//this made all right, it returns the right int!
- this.needsRandomTick = true;
- }
- public TileEntity createNewTileEntity(World world, int i) {
- return new LampTileEntity();
- }
- @Override
- public boolean isOpaqueCube() {
- return false;
- }
- @Override
- public boolean renderAsNormalBlock() {
- return false;
- }
- @Override
- @SideOnly(Side.CLIENT)
- public int getLightValue(IBlockAccess world, int x, int y, int z)
- {
- try {
- LampTileEntity tile = (LampTileEntity) world.getTileEntity(x, y, z);
- if (tile.getWorldObj().isRemote)
- System.out.println(tile.RGB_VALUES.toString() + "@" + x + ";" + y + ";" + z + "@Server");
- else
- System.out.println(tile.RGB_VALUES.toString() + "@" + x + ";" + y + ";" + z + "@Client");
- int[] color = new int[]{255,255,255};
- if (tile != null) {
- color = tile.RGB_VALUES.toIntArray();
- }
- return CLC_API_RGBWuerfel.makeRGBLightValue(color[0], color[1], color[2], 15);
- }
- catch (Exception e)
- {
- System.out.println("ERORR!");
- return CLC_API_RGBWuerfel.makeRGBLightValue(255, 255, 255, 15);
- }
- finally {
- }
- }
- @Override
- public int damageDropped (int metadata) {
- return metadata;
- }
- public static IIcon[] icons = new IIcon[14];
- @Override
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister reg) {
- for (int i = 0; i < 13; i ++) {
- this.icons[i] = reg.registerIcon("objloader:ColoredLamp/" + i);
- }
- this.icons[13] = reg.registerIcon("objloader:clear");
- }
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(int side, int meta) {
- //if (meta > 12)
- // meta = 0;
- return icons[0];
- //return icons[13];
- }
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(IBlockAccess p_149673_1_, int p_149673_2_, int p_149673_3_, int p_149673_4_, int p_149673_5_)
- {
- return icons[13];
- }
- @Override
- public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
- {
- //super.onBlockPlaced(world,x,y,z,side,hitX,hitY,hitZ,metadata);
- try {
- LampTileEntity entity = (LampTileEntity) world.getTileEntity(x, y, z);
- entity.CustomupdateEntity();
- }
- catch (Exception e){}
- return metadata;
- }
- /*@Override
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item block, CreativeTabs p_149666_2_, List list) {
- for (int i = 0; i < ItemLampBlock.Colors.length; i++) {
- list.add(new ItemStack(block, 1, i));
- }
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement