API to get Material from Boats and Minecarts

== AT ==
public net.minecraft.world.entity.vehicle.AbstractBoat getDropItem()Lnet/minecraft/world/item/Item;
This commit is contained in:
Madeline Miller 2020-12-31 12:48:19 +10:00
parent 119c616ab9
commit 38ea31d1cb
3 changed files with 19 additions and 4 deletions

View file

@ -121,16 +121,15 @@
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = d0 * d0 + d1 * d1;
@@ -644,5 +694,27 @@
@@ -645,4 +695,27 @@
public boolean isFurnace() {
return false;
+ }
}
+
+ // CraftBukkit start - Methods for getting and setting flying and derailed velocity modifiers
+ public Vector getFlyingVelocityMod() {
+ return new Vector(this.flyingX, this.flyingY, this.flyingZ);
}
+ }
+
+ public void setFlyingVelocityMod(Vector flying) {
+ this.flyingX = flying.getX();
@ -148,4 +147,5 @@
+ 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
}

View file

@ -78,6 +78,13 @@ public abstract class CraftBoat extends CraftVehicle implements Boat {
this.getHandle().landBoats = workOnLand;
}
// Paper start
@Override
public org.bukkit.Material getBoatMaterial() {
return org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this.getHandle().getDropItem());
}
// Paper end
@Override
public Status getStatus() {
return CraftBoat.boatStatusFromNms(this.getHandle().status);

View file

@ -4,6 +4,7 @@ import net.minecraft.server.level.ServerLevel;
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 {
this.getHandle().setDerailedVelocityMod(derailed);
}
// Paper start
@Override
public Material getMinecartMaterial() {
return CraftMagicNumbers.getMaterial(this.getHandle().publicGetDropItem());
}
// Paper end
@Override
public AbstractMinecart getHandle() {
return (AbstractMinecart) this.entity;