make it compile \o/

This commit is contained in:
granny
2025-03-27 16:27:08 -07:00
parent f1e732aa3a
commit 73e0e17b6d
29 changed files with 134 additions and 147 deletions

View File

@@ -37,7 +37,7 @@ index 1a4f42c9e6012a6a074c9d5451d8dc11530a5c5b..67b9963afd91af84459d439697f6230f
+ // Purpur end - Ridables
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index a7e3afe04ffbb0fd5fa5fcf7cd15efd7cea1c4e0..9c88a5b6b054636a9f326d0253f65496cf3babc3 100644
index a7e3afe04ffbb0fd5fa5fcf7cd15efd7cea1c4e0..f32316b0357f1cb0501a052361a0221f8e9d1438 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -514,6 +514,15 @@ public class CraftEventFactory {
@@ -45,10 +45,10 @@ index a7e3afe04ffbb0fd5fa5fcf7cd15efd7cea1c4e0..9c88a5b6b054636a9f326d0253f65496
craftServer.getPluginManager().callEvent(event);
+ // Purpur start - Ridables
+ if (who != null) {
+ if (player != null) {
+ switch (action) {
+ case LEFT_CLICK_BLOCK, LEFT_CLICK_AIR -> who.processClick(InteractionHand.MAIN_HAND);
+ case RIGHT_CLICK_BLOCK, RIGHT_CLICK_AIR -> who.processClick(InteractionHand.OFF_HAND);
+ case LEFT_CLICK_BLOCK, LEFT_CLICK_AIR -> player.processClick(InteractionHand.MAIN_HAND);
+ case RIGHT_CLICK_BLOCK, RIGHT_CLICK_AIR -> player.processClick(InteractionHand.OFF_HAND);
+ }
+ }
+ // Purpur end - Ridables

View File

@@ -13,7 +13,7 @@
CompoundTag data = this.getData();
if (data == null) {
return null;
@@ -571,4 +_,191 @@
@@ -571,4 +_,183 @@
manager.save();
}
}
@@ -26,9 +26,8 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return false;
+ if (!data.contains("abilities")) return false;
+ CompoundTag abilities = data.getCompound("abilities");
+ return abilities.getByte("mayfly") == (byte) 1;
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return false;
+ return abilities.getByteOr("mayfly", (byte) 0) == (byte) 1;
+ }
+ }
+
@@ -39,8 +38,7 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return;
+ if (!data.contains("abilities")) return;
+ CompoundTag abilities = data.getCompound("abilities");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return;
+ abilities.putByte("mayfly", (byte) (flight ? 1 : 0));
+ data.put("abilities", abilities);
+ save(data);
@@ -54,9 +52,8 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return false;
+ if (!data.contains("abilities")) return false;
+ CompoundTag abilities = data.getCompound("abilities");
+ return abilities.getByte("flying") == (byte) 1;
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return false;
+ return abilities.getByteOr("flying", (byte) 0) == (byte) 1;
+ }
+ }
+
@@ -67,8 +64,7 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return;
+ if (!data.contains("abilities")) return;
+ CompoundTag abilities = data.getCompound("abilities");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return;
+ abilities.putByte("mayfly", (byte) (value ? 1 : 0));
+ data.put("abilities", abilities);
+ save(data);
@@ -83,8 +79,7 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return;
+ if (!data.contains("abilities")) return;
+ CompoundTag abilities = data.getCompound("abilities");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return;
+ abilities.putFloat("flySpeed", value);
+ data.put("abilities", abilities);
+ save(data);
@@ -98,9 +93,8 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return 0;
+ if (!data.contains("abilities")) return 0;
+ CompoundTag abilities = data.getCompound("abilities");
+ return abilities.getFloat("flySpeed");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return 0;
+ return abilities.getFloatOr("flySpeed", 0);
+ }
+ }
+
@@ -112,8 +106,7 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return;
+ if (!data.contains("abilities")) return;
+ CompoundTag abilities = data.getCompound("abilities");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return;
+ abilities.putFloat("walkSpeed", value);
+ data.put("abilities", abilities);
+ save(data);
@@ -127,9 +120,8 @@
+ } else {
+ CompoundTag data = this.getData();
+ if (data == null) return 0;
+ if (!data.contains("abilities")) return 0;
+ CompoundTag abilities = data.getCompound("abilities");
+ return abilities.getFloat("walkSpeed");
+ if (!(data.get("abilities") instanceof CompoundTag abilities)) return 0;
+ return abilities.getFloatOr("walkSpeed", 0);
+ }
+ }
+

View File

@@ -6,7 +6,7 @@
+ // Purpur start - Add local difficulty api
+ public float getLocalDifficultyAt(Location location) {
+ return getHandle().getCurrentDifficultyAt(io.papermc.paper.util.MCUtil.toBlockPosition(location)).getEffectiveDifficulty();
+ return getHandle().getCurrentDifficultyAt(org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(location)).getEffectiveDifficulty();
+ }
+ // Purpur end - Add local difficulty api
+
@@ -28,7 +28,7 @@
+
+ @Override
+ public void sendBlockHighlight(Location location, int duration, String text, int argb) {
+ net.minecraft.network.protocol.game.DebugPackets.sendGameTestAddMarker(getHandle(), io.papermc.paper.util.MCUtil.toBlockPosition(location), text, argb, duration);
+ net.minecraft.network.protocol.game.DebugPackets.sendGameTestAddMarker(getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(location), text, argb, duration);
+ }
+
+ @Override

View File

@@ -94,7 +94,7 @@
+ @Override
+ public void sendBlockHighlight(Location location, int duration, String text, int argb) {
+ if (this.getHandle().connection == null) return;
+ this.getHandle().connection.send(new net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket(new net.minecraft.network.protocol.common.custom.GameTestAddMarkerDebugPayload(io.papermc.paper.util.MCUtil.toBlockPosition(location), argb, text, duration)));
+ this.getHandle().connection.send(new net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket(new net.minecraft.network.protocol.common.custom.GameTestAddMarkerDebugPayload(org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(location), argb, text, duration)));
+ }
+
+ @Override