mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 20:50:41 +01:00
ea855e2b46
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Developers!: You will need to clean up your work/Minecraft/1.13.2 folder for this Also, restore a patch that was dropped in the last upstream Bukkit Changes: 279eeab3 Fix command description not being set 96e2bb18 Remove debug print from SyntheticEventTest CraftBukkit Changes:d3ed1516
Fix dangerously threaded beacons217a293d
Don't relocate joptsimple to allow --help to work.1be05a21
Prepare for imminent Java 12 releasea49270b2
Mappings Update5259d80c
SPIGOT-4669: Fix PlayerTeleportEvent coordinates for relative teleports Spigot Changes: e6eb36f2 Rebuild patches
69 lines
2.3 KiB
Diff
69 lines
2.3 KiB
Diff
From 82398c9e4afd78705fc7d325811865fc13522765 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Wed, 25 Jul 2018 01:36:07 -0400
|
|
Subject: [PATCH] Expand Location Manipulation API
|
|
|
|
Adds set(x, y, z), add(base, x, y, z), subtract(base, x, y, z);
|
|
|
|
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
|
index e57e22a21..84b7d93cf 100644
|
|
--- a/src/main/java/org/bukkit/Location.java
|
|
+++ b/src/main/java/org/bukkit/Location.java
|
|
@@ -519,6 +519,54 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|
public boolean isChunkLoaded() { return world.isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
|
|
|
// Paper start
|
|
+
|
|
+ /**
|
|
+ * Sets the position of this Location and returns itself
|
|
+ *
|
|
+ * This mutates this object, clone first.
|
|
+ * @param x X coordinate
|
|
+ * @param y Y coordinate
|
|
+ * @param z Z coordinate
|
|
+ * @return self (not cloned)
|
|
+ */
|
|
+ @NotNull
|
|
+ public Location set(double x, double y, double z) {
|
|
+ this.x = x;
|
|
+ this.y = y;
|
|
+ this.z = z;
|
|
+ return this;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Takes the x/y/z from base and adds the specified x/y/z to it and returns self
|
|
+ *
|
|
+ * This mutates this object, clone first.
|
|
+ * @param base The base coordinate to modify
|
|
+ * @param x X coordinate to add to base
|
|
+ * @param y Y coordinate to add to base
|
|
+ * @param z Z coordinate to add to base
|
|
+ * @return self (not cloned)
|
|
+ */
|
|
+ @NotNull
|
|
+ public Location add(@NotNull Location base, double x, double y, double z) {
|
|
+ return this.set(base.x + x, base.y + y, base.z + z);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Takes the x/y/z from base and subtracts the specified x/y/z to it and returns self
|
|
+ *
|
|
+ * This mutates this object, clone first.
|
|
+ * @param base The base coordinate to modify
|
|
+ * @param x X coordinate to subtract from base
|
|
+ * @param y Y coordinate to subtract from base
|
|
+ * @param z Z coordinate to subtract from base
|
|
+ * @return self (not cloned)
|
|
+ */
|
|
+ @NotNull
|
|
+ public Location subtract(@NotNull Location base, double x, double y, double z) {
|
|
+ return this.set(base.x - x, base.y - y, base.z - z);
|
|
+ }
|
|
+
|
|
/**
|
|
* @return A new location where X/Y/Z are on the Block location (integer value of X/Y/Z)
|
|
*/
|
|
--
|
|
2.21.0
|
|
|