2018-10-13 23:46:30 +02:00
|
|
|
package de.ellpeck.naturesaura.blocks.tiles;
|
|
|
|
|
2018-11-12 01:29:33 +01:00
|
|
|
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;
|
2019-10-20 22:30:49 +02:00
|
|
|
import net.minecraft.nbt.CompoundNBT;
|
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
|
|
|
|
2019-01-29 11:46:38 +01:00
|
|
|
private final NaturalAuraContainer container = new NaturalAuraContainer(NaturesAuraAPI.TYPE_OVERWORLD, 2000, 500) {
|
2018-10-14 14:27:18 +02:00
|
|
|
@Override
|
|
|
|
public int getAuraColor() {
|
2019-01-30 17:51:39 +01:00
|
|
|
return 0xCE5489;
|
2018-10-14 14:27:18 +02:00
|
|
|
}
|
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
|
|
|
};
|
|
|
|
|
2020-01-22 01:32:26 +01:00
|
|
|
public TileEntityAncientLeaves() {
|
|
|
|
super(ModTileEntities.ANCIENT_LEAVES);
|
2020-01-21 23:02:39 +01:00
|
|
|
}
|
|
|
|
|
2018-10-14 14:27:18 +02:00
|
|
|
@Override
|
2020-10-19 21:26:32 +02:00
|
|
|
public IAuraContainer getAuraContainer() {
|
2018-10-14 14:27:18 +02:00
|
|
|
return this.container;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-10-20 22:30:49 +02:00
|
|
|
public void writeNBT(CompoundNBT compound, SaveType type) {
|
2018-11-04 16:38:09 +01:00
|
|
|
super.writeNBT(compound, type);
|
|
|
|
if (type != SaveType.BLOCK)
|
|
|
|
this.container.writeNBT(compound);
|
2018-10-14 14:27:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-10-20 22:30:49 +02:00
|
|
|
public void readNBT(CompoundNBT compound, SaveType type) {
|
2018-11-04 16:38:09 +01:00
|
|
|
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
|
|
|
}
|