Paper/patches/server/0448-API-to-get-Material-from-Boats-and-Minecarts.patch

63 lines
3.1 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Madeline Miller <mnmiller1@me.com>
2021-06-11 14:02:28 +02:00
Date: Thu, 31 Dec 2020 12:48:19 +1000
Subject: [PATCH] API to get Material from Boats and Minecarts
2021-06-11 14:02:28 +02:00
2024-10-25 17:08:48 +02:00
== AT ==
public net.minecraft.world.entity.vehicle.AbstractBoat getDropItem()Lnet/minecraft/world/item/Item;
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index fb9f0a62201dfeccd0eec9bb399f9edc6a01f1f0..d01a588aea379c962dd63f1428f92cf2442f4d45 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -717,4 +717,5 @@ public abstract class AbstractMinecart extends VehicleEntity {
this.derailedZ = derailed.getZ();
}
// CraftBukkit end
+ public net.minecraft.world.item.Item publicGetDropItem() { return getDropItem(); } // Paper - api to get boat and minecart material - expose public drop item
}
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
2024-10-25 12:30:19 +02:00
index c101d01b55472efc9fc2829b8c17db5377ed57ff..5d51a49228eaee94f91cd04843e27c7918ca8796 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
2024-10-23 17:58:11 +02:00
@@ -78,6 +78,13 @@ public abstract class CraftBoat extends CraftVehicle implements Boat {
2021-06-14 20:50:22 +02:00
this.getHandle().landBoats = workOnLand;
2021-06-11 14:02:28 +02:00
}
+ // Paper start
+ @Override
2021-06-14 20:50:22 +02:00
+ public org.bukkit.Material getBoatMaterial() {
+ return org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this.getHandle().getDropItem());
2021-06-11 14:02:28 +02:00
+ }
+ // Paper end
+
@Override
public Status getStatus() {
return CraftBoat.boatStatusFromNms(this.getHandle().status);
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
index c4db7c00c66e064993b8b2158f226d063eea798c..e02ecbdc158311bdc7e4d13307de6e2a2cf54235 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
@@ -4,6 +4,7 @@ import net.minecraft.server.level.ServerLevel;
2021-06-11 14:02:28 +02:00
import net.minecraft.world.entity.vehicle.AbstractMinecart;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
+import org.bukkit.Material; // Paper
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -69,6 +70,13 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
2021-06-14 20:50:22 +02:00
this.getHandle().setDerailedVelocityMod(derailed);
2021-06-11 14:02:28 +02:00
}
+ // Paper start
+ @Override
+ public Material getMinecartMaterial() {
+ return CraftMagicNumbers.getMaterial(this.getHandle().publicGetDropItem());
2021-06-11 14:02:28 +02:00
+ }
+ // Paper end
+
@Override
public AbstractMinecart getHandle() {
2023-10-27 01:34:58 +02:00
return (AbstractMinecart) this.entity;