NaturesAura/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java

46 lines
1.4 KiB
Java
Raw Normal View History

2018-10-13 23:46:30 +02:00
package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
2018-11-11 13:26:19 +01:00
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.api.aura.container.NaturalAuraContainer;
2018-10-14 14:27:18 +02:00
import net.minecraft.nbt.NBTTagCompound;
2018-10-20 21:19:08 +02:00
import net.minecraft.util.EnumFacing;
2018-10-14 14:27:18 +02:00
2018-10-20 21:19:08 +02:00
public class TileEntityAncientLeaves extends TileEntityImpl {
2018-10-14 14:27:18 +02:00
private final NaturalAuraContainer container = new NaturalAuraContainer(NaturesAuraAPI.TYPE_OVERWORLD, 20, 5) {
2018-10-14 14:27:18 +02:00
@Override
public int getAuraColor() {
return 0xc46df9;
}
2018-10-14 16:12:33 +02:00
@Override
public int drainAura(int amountToDrain, boolean simulate) {
int amount = super.drainAura(amountToDrain, simulate);
if (amount > 0 && !simulate) {
TileEntityAncientLeaves.this.sendToClients();
}
return amount;
}
2018-10-14 14:27:18 +02:00
};
@Override
2018-10-20 21:19:08 +02:00
public IAuraContainer getAuraContainer(EnumFacing facing) {
2018-10-14 14:27:18 +02:00
return this.container;
}
@Override
2018-11-04 16:38:09 +01:00
public void writeNBT(NBTTagCompound compound, SaveType type) {
super.writeNBT(compound, type);
if (type != SaveType.BLOCK)
this.container.writeNBT(compound);
2018-10-14 14:27:18 +02:00
}
@Override
2018-11-04 16:38:09 +01:00
public void readNBT(NBTTagCompound compound, SaveType type) {
super.readNBT(compound, type);
if (type != SaveType.BLOCK)
this.container.readNBT(compound);
2018-10-14 14:27:18 +02:00
}
2018-10-13 23:46:30 +02:00
}