Readd allArgs and history place holder

This commit is contained in:
D4rkr34lm
2024-08-18 12:08:57 +02:00
parent fbb6d84dae
commit 3e6dd61428
2 changed files with 5 additions and 66 deletions
@@ -40,8 +40,9 @@ import java.util.Optional;
/** /**
* Recording of a tnt at a specific tick * Recording of a tnt at a specific tick
*/ */
@AllArgsConstructor
@Getter @Getter
public class TNTPoint implements Externalizable { public class TNTPoint{
/** /**
* Unique number to identify records being of the same tnt * Unique number to identify records being of the same tnt
*/ */
@@ -98,33 +99,9 @@ public class TNTPoint implements Externalizable {
private List<TNTPoint> history; private List<TNTPoint> history;
/** /**
* Constructor for deserialization only !! Do not Call !! * Constructor fo object creation in trace recording
*/ */
protected TNTPoint(int tntId, boolean explosion, protected TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart,
boolean inWater,
boolean afterFirstExplosion,
boolean destroyedBuildArea,
boolean destroyedTestBlock,
long ticksSinceStart,
int fuse,
Location location,
Vector velocity) {
this.tntId = tntId;
this.explosion = explosion;
this.inWater = inWater;
this.afterFirstExplosion = afterFirstExplosion;
this.destroyedBuildArea = destroyedBuildArea;
this.destroyedTestBlock = destroyedTestBlock;
this.ticksSinceStart = ticksSinceStart;
this.fuse = fuse;
this.location = location;
this.velocity = velocity;
}
/**
*
*/
public TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart,
List<TNTPoint> history, List<Block> destroyedBlocks) { List<TNTPoint> history, List<Block> destroyedBlocks) {
this.tntId = tntId; this.tntId = tntId;
this.explosion = explosion; this.explosion = explosion;
@@ -183,44 +160,6 @@ public class TNTPoint implements Externalizable {
this.history = history; this.history = history;
} }
@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
objectOutput.writeInt(tntId);
objectOutput.writeBoolean(explosion);
objectOutput.writeBoolean(inWater);
objectOutput.writeBoolean(afterFirstExplosion);
objectOutput.writeBoolean(destroyedBuildArea);
objectOutput.writeBoolean(destroyedTestBlock);
objectOutput.writeLong(ticksSinceStart);
objectOutput.writeInt(fuse);
objectOutput.writeDouble(location.getX());
objectOutput.writeDouble(location.getY());
objectOutput.writeDouble(location.getZ());
objectOutput.writeDouble(velocity.getX());
objectOutput.writeDouble(velocity.getY());
objectOutput.writeDouble(velocity.getZ());
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException {
tntId = objectInput.readInt();
explosion = objectInput.readBoolean();
inWater = objectInput.readBoolean();
afterFirstExplosion = objectInput.readBoolean();
destroyedBuildArea = objectInput.readBoolean();
destroyedTestBlock = objectInput.readBoolean();
ticksSinceStart = objectInput.readLong();
fuse = objectInput.readInt();
double locX = objectInput.readDouble();
double locY = objectInput.readDouble();
double locZ = objectInput.readDouble();
location = new Location(Bukkit.getWorlds().get(0), locX, locY, locZ);
double velX = objectInput.readDouble();
double velY = objectInput.readDouble();
double velZ = objectInput.readDouble();
velocity = new Vector(velX, velY, velZ);
}
@Override @Override
public String toString() { public String toString() {
return "TNTPoint{" + return "TNTPoint{" +
@@ -109,7 +109,7 @@ public class TraceRepository {
double velZ = objectInput.readDouble(); double velZ = objectInput.readDouble();
Vector velocity = new Vector(velX, velY, velZ); Vector velocity = new Vector(velX, velY, velZ);
return new TNTPoint(tntId, explosion, inWater, afterFirstExplosion, destroyedBuildArea, destroyedTestBlock, ticksSinceStart, fuse, location, velocity); return new TNTPoint(tntId, explosion, inWater, afterFirstExplosion, destroyedBuildArea, destroyedTestBlock, ticksSinceStart, fuse, location, velocity, Collections.emptyList());
} }
@SneakyThrows @SneakyThrows