geforkt von Mirrors/Paper
17f71ac87b
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 70d24eb8 SPIGOT-6587: Update documentation/error of drop chance API CraftBukkit Changes: 470050ad SPIGOT-6587: Update documentation/error of drop chance API 1c39efa3 Fix Inventory#getViewers on the player inventory not returning the player first time their inventory is opened d161627d Fix PrepareItemCraftEvent#isRepair aa1fae73 SPIGOT-6586: EntityChangeBlockEvent for falling block does not cancel properly 8a04072e SPIGOT-6583: Throwing eggs doesn't make sounds Spigot Changes: f773da84 Remove redundant patch cd367234 Rebuild patches
49 Zeilen
2.4 KiB
Diff
49 Zeilen
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Thu, 22 Apr 2021 00:28:11 -0700
|
|
Subject: [PATCH] add get-set drop chance to EntityEquipment
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java
|
|
index 5a22c089f8c2c58f577ee32caa9985fff112de3c..1a88eafcba718f0c307ef6fcde72f156f644766f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java
|
|
@@ -244,6 +244,17 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|
public void setBootsDropChance(float chance) {
|
|
this.setDropChance(net.minecraft.world.entity.EquipmentSlot.FEET, chance);
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public float getDropChance(EquipmentSlot slot) {
|
|
+ return getDropChance(CraftEquipmentSlot.getNMS(slot));
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setDropChance(EquipmentSlot slot, float chance) {
|
|
+ setDropChance(CraftEquipmentSlot.getNMS(slot), chance);
|
|
+ }
|
|
+ // Paper end
|
|
|
|
private void setDropChance(net.minecraft.world.entity.EquipmentSlot slot, float chance) {
|
|
Preconditions.checkArgument(this.entity.getHandle() instanceof Mob, "Cannot set drop chance for non-Mob entity");
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
|
|
index 5ae4f2b6cfa4067a0589d6f909ac6a7d9b48fd6f..3354d13f657cecfc3cc756a99accd5d481e8b1dd 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
|
|
@@ -354,4 +354,15 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
|
|
public void setBootsDropChance(float chance) {
|
|
throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public float getDropChance(EquipmentSlot slot) {
|
|
+ return 1;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setDropChance(EquipmentSlot slot, float chance) {
|
|
+ throw new UnsupportedOperationException("Cannot set drop chance for PlayerInventory");
|
|
+ }
|
|
+ // Paper end
|
|
}
|