Guest User

Untitled

a guest
Jul 27th, 2014
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. package lavaInfusionTileEntity;
  2.  
  3. import lavaInfusionMain.Base;
  4. import lavaInfusionPackets.MagmaChargePacket;
  5. import net.minecraft.nbt.NBTTagCompound;
  6. import net.minecraft.tileentity.TileEntity;
  7.  
  8. public class TileEntityMagmaFoundation extends TileEntity
  9. {
  10.     private int chargeCount = 0; //Number of charges held
  11.    
  12.     public int getChargeCount()
  13.     {
  14.         return chargeCount;
  15.     }
  16.    
  17.     @Override
  18.     public void readFromNBT(NBTTagCompound nbt)
  19.     {
  20.         super.readFromNBT(nbt);
  21.         this.chargeCount = nbt.getInteger("chargeCount");
  22.        
  23.         Base.network.sendToServer(new MagmaChargePacket(chargeCount));
  24.     }
  25.  
  26.     @Override
  27.     public void writeToNBT(NBTTagCompound nbt)
  28.     {
  29.         super.writeToNBT(nbt);
  30.         nbt.setInteger("chargeCount", chargeCount);
  31.     }
  32.    
  33.     //Non Forge Related Methods Below
  34.     public void setChargeCount(int that)
  35.     {
  36.         this.chargeCount = that;
  37.     }
  38.    
  39.     public void addCharges(int amt)
  40.     {
  41.         this.chargeCount += amt;
  42.     }
  43.    
  44.     public void useCharges(int amt)
  45.     {
  46.         this.chargeCount -= amt;
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment