mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-15 23:20:44 +00:00
fix world centre
This commit is contained in:
@@ -5,6 +5,8 @@ transfer-failure-message: Unable to complete rocket transfer. Please reconnect a
|
|||||||
source-world: world
|
source-world: world
|
||||||
|
|
||||||
world-radius: 10000
|
world-radius: 10000
|
||||||
|
rocket-centre-x: 0
|
||||||
|
rocket-centre-z: 0
|
||||||
delta-v-meters-per-second: 10000
|
delta-v-meters-per-second: 10000
|
||||||
|
|
||||||
database:
|
database:
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ transfer-failure-message: Unable to complete rocket transfer. Please reconnect a
|
|||||||
source-world: world
|
source-world: world
|
||||||
|
|
||||||
world-radius: 7000
|
world-radius: 7000
|
||||||
|
rocket-centre-x: 0
|
||||||
|
rocket-centre-z: -20000
|
||||||
delta-v-meters-per-second: 6000
|
delta-v-meters-per-second: 6000
|
||||||
|
|
||||||
database:
|
database:
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ import vg.civcraft.mc.citadel.CitadelPermissionHandler;
|
|||||||
public final class DestinationTransferListener implements Listener {
|
public final class DestinationTransferListener implements Listener {
|
||||||
|
|
||||||
public static final int SPIRAL_ITERATION_DISTANCE = 8;
|
public static final int SPIRAL_ITERATION_DISTANCE = 8;
|
||||||
private static final int DESTINATION_CENTER_X = 0;
|
|
||||||
private static final int DESTINATION_CENTER_Z = -20_000;
|
|
||||||
private final ZorwethPlugin plugin;
|
private final ZorwethPlugin plugin;
|
||||||
private final Map<UUID, CompletableFuture<DestinationRocketTransfer>> futures = new ConcurrentHashMap<>();
|
private final Map<UUID, CompletableFuture<DestinationRocketTransfer>> futures = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@@ -225,8 +223,8 @@ public final class DestinationTransferListener implements Listener {
|
|||||||
if (distanceSquared > radiusSquared) {
|
if (distanceSquared > radiusSquared) {
|
||||||
final double distance = Math.sqrt(distanceSquared);
|
final double distance = Math.sqrt(distanceSquared);
|
||||||
final double scale = plugin.getWorldRadius() / distance;
|
final double scale = plugin.getWorldRadius() / distance;
|
||||||
rx = DESTINATION_CENTER_X + (int) ((rx - DESTINATION_CENTER_X) * scale);
|
rx = plugin.getRocketCentreX() + (int) ((rx - plugin.getRocketCentreX()) * scale);
|
||||||
rz = DESTINATION_CENTER_Z + (int) ((rz - DESTINATION_CENTER_Z) * scale);
|
rz = plugin.getRocketCentreZ() + (int) ((rz - plugin.getRocketCentreZ()) * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
final World world = Bukkit.getWorld(transfer.destinationWorld());
|
final World world = Bukkit.getWorld(transfer.destinationWorld());
|
||||||
@@ -302,8 +300,8 @@ public final class DestinationTransferListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double getDistanceSquaredFromCenter(final int x, final int z) {
|
private double getDistanceSquaredFromCenter(final int x, final int z) {
|
||||||
final double relativeX = x - DESTINATION_CENTER_X;
|
final double relativeX = x - plugin.getRocketCentreX();
|
||||||
final double relativeZ = z - DESTINATION_CENTER_Z;
|
final double relativeZ = z - plugin.getRocketCentreZ();
|
||||||
return relativeX * relativeX + relativeZ * relativeZ;
|
return relativeX * relativeX + relativeZ * relativeZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public final class ZorwethPlugin extends JavaPlugin {
|
|||||||
private String transferFailureMessage;
|
private String transferFailureMessage;
|
||||||
private long pioneerEndTimestampMillis;
|
private long pioneerEndTimestampMillis;
|
||||||
private int worldRadius;
|
private int worldRadius;
|
||||||
|
private int rocketCentreX;
|
||||||
|
private int rocketCentreZ;
|
||||||
private double deltaVMetersPerSecond;
|
private double deltaVMetersPerSecond;
|
||||||
private boolean researchEnabled;
|
private boolean researchEnabled;
|
||||||
private int researchPhaseOneRuns;
|
private int researchPhaseOneRuns;
|
||||||
@@ -180,6 +182,14 @@ public final class ZorwethPlugin extends JavaPlugin {
|
|||||||
return this.worldRadius;
|
return this.worldRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRocketCentreX() {
|
||||||
|
return rocketCentreX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRocketCentreZ() {
|
||||||
|
return rocketCentreZ;
|
||||||
|
}
|
||||||
|
|
||||||
public double getDeltaVMetersPerSecond() {
|
public double getDeltaVMetersPerSecond() {
|
||||||
return this.deltaVMetersPerSecond;
|
return this.deltaVMetersPerSecond;
|
||||||
}
|
}
|
||||||
@@ -193,6 +203,8 @@ public final class ZorwethPlugin extends JavaPlugin {
|
|||||||
"Unable to complete rocket transfer. Please reconnect and try again.");
|
"Unable to complete rocket transfer. Please reconnect and try again.");
|
||||||
this.pioneerEndTimestampMillis = getConfig().getLong("pioneer-end-timestamp", 0L);
|
this.pioneerEndTimestampMillis = getConfig().getLong("pioneer-end-timestamp", 0L);
|
||||||
this.worldRadius = getConfig().getInt("world-radius", 0);
|
this.worldRadius = getConfig().getInt("world-radius", 0);
|
||||||
|
this.rocketCentreX = getConfig().getInt("world-centre-x", 0);
|
||||||
|
this.rocketCentreZ = getConfig().getInt("world-centre-z", 0);
|
||||||
this.deltaVMetersPerSecond = getConfig().getDouble("delta-v-meters-per-second", 10_000.0);
|
this.deltaVMetersPerSecond = getConfig().getDouble("delta-v-meters-per-second", 10_000.0);
|
||||||
this.researchEnabled = getConfig().getBoolean("research.enabled", true);
|
this.researchEnabled = getConfig().getBoolean("research.enabled", true);
|
||||||
this.researchPhaseOneRuns = loadPositiveInt("research.phase-one-runs", 1);
|
this.researchPhaseOneRuns = loadPositiveInt("research.phase-one-runs", 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user