Guest User

Untitled

a guest
May 30th, 2015
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1. package com.github.wolfiewaffle.hardcoretorches.tileentities;
  2.  
  3. import com.github.wolfiewaffle.hardcoretorches.init.ModBlocks;
  4. import com.github.wolfiewaffle.hardcoretorches.items.ItemBlockTorchLit;
  5.  
  6. import net.minecraft.nbt.NBTTagCompound;
  7. import net.minecraft.tileentity.TileEntity;
  8. import net.minecraft.world.World;
  9.  
  10. public class TileEntityTorchLit extends TileEntity
  11. {
  12.     public static final String publicName = "tileEntityTorchLit";
  13.     private String name = "tileEntityTorchLit";
  14.    
  15.     public String getName() {
  16.         return name;
  17.     }
  18.    
  19.     private int torchFuel;
  20.    
  21.     public int getFuelAmount() {
  22.         return this.torchFuel;
  23.     }
  24.    
  25.     @Override
  26.     public void writeToNBT(NBTTagCompound par1) {
  27.        super.writeToNBT(par1);
  28.        par1.setInteger("torchFuelNBT", getFuelAmount());
  29.     }
  30.    
  31.     @Override
  32.     public void readFromNBT(NBTTagCompound par1) {
  33.        super.readFromNBT(par1);
  34.        this.torchFuel = par1.getInteger("torchfuelNBT");
  35.     }
  36.    
  37.     @Override
  38.     public void updateEntity() {
  39.         int i = this.xCoord;
  40.         int j = this.yCoord;
  41.         int k = this.zCoord;
  42.         World world = this.worldObj;
  43.        
  44.         if (torchFuel < ItemBlockTorchLit.getTorchMaxDamage()) {
  45.             torchFuel = torchFuel - 1;
  46.         }
  47.         else if (torchFuel == ItemBlockTorchLit.getTorchMaxDamage()) {
  48.             this.worldObj.setBlock(i, j, k, ModBlocks.torchBurnt, world.getBlockMetadata(i, j, k), 3);
  49.         }
  50.        
  51.         System.out.println(/*"fuel: " + */torchFuel/* + " xyz: " + i + " " + j + " " + k*/);
  52.     }
  53.  
  54.     public void setFuel(int f) {
  55.         this.torchFuel = f;
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment