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

51 lines
1.6 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;
2019-10-20 22:30:49 +02:00
import net.minecraft.nbt.CompoundNBT;
2020-01-21 23:02:39 +01:00
import net.minecraft.tileentity.TileEntityType;
2019-10-20 22:30:49 +02:00
import net.minecraft.util.Direction;
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, 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-21 23:02:39 +01:00
public TileEntityAncientLeaves(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
2018-10-14 14:27:18 +02:00
@Override
2019-10-20 22:30:49 +02:00
public IAuraContainer getAuraContainer(Direction facing) {
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
}