Ejectors placed by Schematicannon keep their targets

This commit is contained in:
reidbhuntley 2021-06-14 22:29:29 -04:00
parent d94a7faaa5
commit 550b456396

View file

@ -482,13 +482,20 @@ public class EjectorTileEntity extends KineticTileEntity {
} }
} }
@Override
public void writeSafe(CompoundNBT compound, boolean clientPacket) {
super.writeSafe(compound, clientPacket);
compound.putInt("HorizontalDistance", launcher.getHorizontalDistance());
compound.putInt("VerticalDistance", launcher.getVerticalDistance());
}
@Override @Override
protected void fromTag(BlockState blockState, CompoundNBT compound, boolean clientPacket) { protected void fromTag(BlockState blockState, CompoundNBT compound, boolean clientPacket) {
super.fromTag(blockState, compound, clientPacket); super.fromTag(blockState, compound, clientPacket);
int horizontalDistance = compound.getInt("HorizontalDistance"); int horizontalDistance = compound.getInt("HorizontalDistance");
int verticalDistance = compound.getInt("VerticalDistance"); int verticalDistance = compound.getInt("VerticalDistance");
if (launcher == null || launcher.getHorizontalDistance() != horizontalDistance if (launcher.getHorizontalDistance() != horizontalDistance
|| launcher.getVerticalDistance() != verticalDistance) { || launcher.getVerticalDistance() != verticalDistance) {
launcher.set(horizontalDistance, verticalDistance); launcher.set(horizontalDistance, verticalDistance);
launcher.clamp(AllConfigs.SERVER.kinetics.maxEjectorDistance.get()); launcher.clamp(AllConfigs.SERVER.kinetics.maxEjectorDistance.get());