blob: 24cd3c0e342948ad6ec3eff16344f3b65481a49c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package cofh.energy;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEnergyHandler
extends TileEntity
implements IEnergyHandler
{
protected EnergyStorage storage = new EnergyStorage(32000);
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
this.storage.readFromNBT(nbt);
}
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
this.storage.writeToNBT(nbt);
}
public boolean canConnectEnergy(ForgeDirection from)
{
return true;
}
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
{
return this.storage.receiveEnergy(maxReceive, simulate);
}
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate)
{
return this.storage.extractEnergy(maxExtract, simulate);
}
public int getEnergyStored(ForgeDirection from)
{
return this.storage.getEnergyStored();
}
public int getMaxEnergyStored(ForgeDirection from)
{
return this.storage.getMaxEnergyStored();
}
}
|