package me.mackan.random_mod.blocks; import cpw.mods.fml.common.registry.GameRegistry; import me.mackan.random_mod.Main; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; public class BlackLight extends Block{ private String name = "blacklight"; IChatComponent cht; public BlackLight(){ super(Material.rock); this.setCreativeTab(CreativeTabs.tabBlock); this.setBlockName(Main.MODID+"_"+name); this.setBlockTextureName(Main.MODID+":"+name); this.setStepSound(soundTypeStone); this.lightValue = 15; this.blockHardness = (float)1.5; GameRegistry.registerBlock(this, name); } @Override public boolean onBlockActivated(World wor, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { int v = this.getLightValue(wor, x, y, z); if(player.isSneaking()){ cht.appendText("Light level is "+v); player.addChatComponentMessage(cht); }else{ if(v > 1){ v = v-1; this.lightValue = v; }else{ v = 15; this.lightValue = v; } } return true; } }