Advertisement
Guest User

Untitled

a guest
Jul 17th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. package com.natura.minestuckarsenal.tileentity;
  2.  
  3. import net.minecraft.item.ItemStack;
  4. import net.minecraft.nbt.NBTTagCompound;
  5. import net.minecraft.nbt.NBTTagList;
  6. import net.minecraftforge.common.util.Constants;
  7. import net.minecraftforge.energy.EnergyStorage;
  8.  
  9. public class EnergyMaster extends EnergyStorage {
  10.    
  11.     @Override
  12.     public int receiveEnergy(int maxReceive, boolean simulate) {
  13.         return 0;
  14.     }
  15.    
  16.     public EnergyMaster(int capacity) {
  17.         super(capacity);
  18.     }
  19.    
  20.     public void increaseEnergy(int amount) {
  21.         this.energy += amount;
  22.     }
  23.    
  24.     public void decreaseEnergy(int amount) {
  25.         this.energy -= amount;
  26.     }
  27.    
  28.     public void setEnergy(int energy) {
  29.         this.energy = energy;
  30.     }
  31.    
  32.     public NBTTagCompound serializeNBT()
  33.     {
  34.             NBTTagCompound nbt = new NBTTagCompound();
  35.             nbt.setInteger("energy", this.getEnergyStored());
  36.             return nbt;
  37.     }
  38.  
  39.     public void deserializeNBT(NBTTagCompound nbt)
  40.     {
  41.             setEnergy(nbt.hasKey("energy", Constants.NBT.TAG_INT) ? nbt.getInteger("energy") : this.energy);           
  42.             onLoad();
  43.     }
  44.      
  45.     protected void onLoad()
  46.     {
  47.  
  48.     }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement