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

35 lines
1 KiB
Java
Raw Normal View History

2019-03-12 19:34:59 +01:00
package de.ellpeck.naturesaura.blocks.tiles;
2021-12-08 00:31:29 +01:00
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
2021-12-04 15:40:09 +01:00
import net.minecraft.nbt.CompoundTag;
2021-12-08 00:31:29 +01:00
import net.minecraft.world.level.block.state.BlockState;
2019-03-12 19:34:59 +01:00
2021-12-04 15:40:09 +01:00
public class BlockEntityProjectileGenerator extends BlockEntityImpl {
2019-03-12 19:34:59 +01:00
2019-10-20 22:30:49 +02:00
public Direction nextSide = Direction.NORTH;
2019-03-12 19:34:59 +01:00
2021-12-08 00:31:29 +01:00
public BlockEntityProjectileGenerator(BlockPos pos, BlockState state) {
2021-12-19 15:32:45 +01:00
super(ModBlockEntities.PROJECTILE_GENERATOR, pos, state);
2020-01-21 21:04:44 +01:00
}
2019-03-12 19:34:59 +01:00
@Override
2021-12-04 15:40:09 +01:00
public void writeNBT(CompoundTag compound, SaveType type) {
2019-03-12 19:34:59 +01:00
super.writeNBT(compound, type);
2021-12-08 00:31:29 +01:00
if (type != SaveType.BLOCK)
compound.putInt("next_side", this.nextSide.ordinal());
2019-03-12 19:34:59 +01:00
}
@Override
2021-12-04 15:40:09 +01:00
public void readNBT(CompoundTag compound, SaveType type) {
2019-03-12 19:34:59 +01:00
super.readNBT(compound, type);
2021-12-08 00:31:29 +01:00
if (type != SaveType.BLOCK)
this.nextSide = Direction.values()[compound.getInt("next_side")];
2019-03-12 19:34:59 +01:00
}
@Override
public boolean wantsLimitRemover() {
return true;
}
2019-03-12 19:34:59 +01:00
}