Advertisement
Guest User

Untitled

a guest
Jun 30th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public class energyBlock extends BlockContainer {
  2. public World world1;
  3. public int x1;
  4. public int y1;
  5. public int z1;
  6.  
  7.  
  8. public energyBlock(){
  9. super(Material.iron);
  10. }
  11.  
  12.  
  13. @Override
  14. public int getLightValue(IBlockAccess world, int x, int y, int z) {
  15. if (world1 != null){
  16. light te = (light)world1.getTileEntity(x1, y1, z1);
  17. if (te.energy > 0.0D){
  18. te.energy = te.energy - 100;
  19. return 15;
  20. }else{
  21. return 0;
  22. }
  23. }else{
  24. return 0;
  25. }
  26.  
  27. }
  28.  
  29. @Override
  30. public boolean onBlockActivated(World world, int x,
  31. int y, int z, EntityPlayer player,
  32. int p_149727_6_, float p_149727_7_, float p_149727_8_,
  33. float p_149727_9_) {
  34. if(world.isRemote)return true;
  35. world1 = world;
  36. x1 = x;
  37. y1 = y;
  38. z1 = z;
  39. light te = (light)world.getTileEntity(x, y, z);
  40. if(te != null){
  41. if(player.isSneaking())te.energy=0.0D;
  42. player.addChatMessage(new ChatComponentText(te.energy+"EU"));
  43. }
  44. return true;
  45. }
  46. @Override
  47. public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
  48. // TODO Auto-generated method stub
  49. return new light();
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement