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

31 lines
918 B
Java
Raw Normal View History

2019-03-12 19:34:59 +01:00
package de.ellpeck.naturesaura.blocks.tiles;
2019-10-20 22:30:49 +02:00
import net.minecraft.nbt.CompoundNBT;
2020-01-21 21:04:44 +01:00
import net.minecraft.tileentity.TileEntityType;
2019-10-20 22:30:49 +02:00
import net.minecraft.util.Direction;
2019-03-12 19:34:59 +01:00
public class TileEntityProjectileGenerator extends TileEntityImpl {
2019-10-20 22:30:49 +02:00
public Direction nextSide = Direction.NORTH;
2019-03-12 19:34:59 +01:00
2020-01-21 21:04:44 +01:00
public TileEntityProjectileGenerator(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
2019-03-12 19:34:59 +01:00
@Override
2019-10-20 22:30:49 +02:00
public void writeNBT(CompoundNBT compound, SaveType type) {
2019-03-12 19:34:59 +01:00
super.writeNBT(compound, type);
if (type != SaveType.BLOCK) {
2020-01-21 21:04:44 +01:00
compound.putInt("next_side", this.nextSide.getHorizontalIndex());
2019-03-12 19:34:59 +01:00
}
}
@Override
2019-10-20 22:30:49 +02:00
public void readNBT(CompoundNBT compound, SaveType type) {
2019-03-12 19:34:59 +01:00
super.readNBT(compound, type);
if (type != SaveType.BLOCK) {
2020-01-21 21:04:44 +01:00
this.nextSide = Direction.byHorizontalIndex(compound.getInt("next_side"));
2019-03-12 19:34:59 +01:00
}
}
}