summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/EntityInsentient.patch36
-rw-r--r--nms-patches/EntityMinecartContainer.patch12
-rw-r--r--nms-patches/LootEnchantFunction.patch26
-rw-r--r--nms-patches/LootItemConditionRandomChanceWithLooting.patch23
-rw-r--r--nms-patches/LootTableInfo.patch67
5 files changed, 150 insertions, 14 deletions
diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch
index a93da205..d315fadb 100644
--- a/nms-patches/EntityInsentient.patch
+++ b/nms-patches/EntityInsentient.patch
@@ -19,7 +19,7 @@
public abstract class EntityInsentient extends EntityLiving {
private static final DataWatcherObject<Byte> a = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
-@@ -27,7 +39,7 @@
+@@ -27,11 +39,11 @@
public float[] dropChanceHand;
private final NonNullList<ItemStack> bE;
public float[] dropChanceArmor;
@@ -27,7 +27,13 @@
+ // public boolean canPickUpLoot; // CraftBukkit - moved up to EntityLiving
public boolean persistent;
private final Map<PathType, Float> bH;
- private MinecraftKey bI;
+- private MinecraftKey bI;
+- private long bJ;
++ public MinecraftKey bI; // CraftBukkit private -> public
++ public long bJ; // CraftBukkit private -> public
+ private boolean bK;
+ private Entity leashHolder;
+ private NBTTagCompound bM;
@@ -57,6 +69,9 @@
this.n();
}
@@ -100,7 +106,19 @@
NBTTagList nbttaglist;
int i;
-@@ -470,11 +525,21 @@
+@@ -394,6 +449,11 @@
+ protected MinecraftKey G() {
+ return null;
+ }
++ // CraftBukkit - start
++ public MinecraftKey getLootTable() {
++ return G();
++ }
++ // CraftBukkit - end
+
+ protected void a(boolean flag, int i, DamageSource damagesource) {
+ MinecraftKey minecraftkey = this.bI;
+@@ -470,11 +530,21 @@
ItemStack itemstack1 = this.getEquipment(enumitemslot);
boolean flag = this.a(itemstack, itemstack1, enumitemslot);
@@ -123,7 +141,7 @@
}
this.setSlot(enumitemslot, itemstack);
-@@ -554,11 +619,11 @@
+@@ -554,11 +624,11 @@
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
@@ -137,7 +155,7 @@
this.die();
} else if (d3 < 1024.0D) {
this.ticksFarFromPlayer = 0;
-@@ -946,12 +1011,24 @@
+@@ -946,12 +1016,24 @@
public final boolean b(EntityHuman entityhuman, EnumHand enumhand) {
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
@@ -162,7 +180,7 @@
this.setLeashHolder(entityhuman, true);
itemstack.subtract(1);
return true;
-@@ -972,10 +1049,12 @@
+@@ -972,10 +1054,12 @@
if (this.bK) {
if (!this.isAlive()) {
@@ -175,7 +193,7 @@
this.unleash(true, true);
}
}
-@@ -986,7 +1065,9 @@
+@@ -986,7 +1070,9 @@
this.bK = false;
this.leashHolder = null;
if (!this.world.isClientSide && flag1) {
@@ -185,7 +203,7 @@
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
-@@ -1056,6 +1137,7 @@
+@@ -1056,6 +1142,7 @@
this.setLeashHolder(entityleash, true);
} else {
@@ -193,7 +211,7 @@
this.unleash(false, true);
}
}
-@@ -1151,7 +1233,14 @@
+@@ -1151,7 +1238,14 @@
int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);
if (j > 0) {
diff --git a/nms-patches/EntityMinecartContainer.patch b/nms-patches/EntityMinecartContainer.patch
index 11d6d77e..b17c7c97 100644
--- a/nms-patches/EntityMinecartContainer.patch
+++ b/nms-patches/EntityMinecartContainer.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityMinecartContainer.java
+++ b/net/minecraft/server/EntityMinecartContainer.java
-@@ -3,6 +3,13 @@
+@@ -3,23 +3,66 @@
import java.util.Iterator;
import java.util.Random;
import javax.annotation.Nullable;
@@ -14,10 +14,12 @@
public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements ITileInventory, ILootable {
-@@ -11,15 +18,51 @@
+ private NonNullList<ItemStack> items;
+ private boolean b;
private MinecraftKey c;
- private long d;
-
+- private long d;
++ public long d; // CraftBukkit private -> public
++
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
@@ -53,7 +55,7 @@
+ return getBukkitEntity().getLocation();
+ }
+ // CraftBukkit end
-+
+
protected EntityMinecartContainer(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
- this.items = NonNullList.a(36, ItemStack.a);
diff --git a/nms-patches/LootEnchantFunction.patch b/nms-patches/LootEnchantFunction.patch
new file mode 100644
index 00000000..af3c6d1c
--- /dev/null
+++ b/nms-patches/LootEnchantFunction.patch
@@ -0,0 +1,26 @@
+--- a/net/minecraft/server/LootEnchantFunction.java
++++ b/net/minecraft/server/LootEnchantFunction.java
+@@ -21,8 +21,13 @@
+
+ if (entity instanceof EntityLiving) {
+ int i = EnchantmentManager.g((EntityLiving) entity);
++ // CraftBukkit start - use lootingModifier if set by plugin
++ if (loottableinfo.lootingMod > org.bukkit.loot.LootContext.DEFAULT_LOOT_MODIFIER) {
++ i = loottableinfo.lootingMod;
++ }
++ // CraftBukkit end
+
+- if (i == 0) {
++ if (i <= 0) { // CraftBukkit - account for possible negative looting values from Bukkit
+ return itemstack;
+ }
+
+@@ -57,7 +62,7 @@
+ return new LootEnchantFunction(alootitemcondition, (LootValueBounds) ChatDeserializer.a(jsonobject, "count", jsondeserializationcontext, LootValueBounds.class), i);
+ }
+
+- public LootItemFunction b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext, LootItemCondition[] alootitemcondition) {
++ public LootEnchantFunction b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext, LootItemCondition[] alootitemcondition) { // CraftBukkit - decompile error
+ return this.a(jsonobject, jsondeserializationcontext, alootitemcondition);
+ }
+ }
diff --git a/nms-patches/LootItemConditionRandomChanceWithLooting.patch b/nms-patches/LootItemConditionRandomChanceWithLooting.patch
new file mode 100644
index 00000000..078a8684
--- /dev/null
+++ b/nms-patches/LootItemConditionRandomChanceWithLooting.patch
@@ -0,0 +1,23 @@
+--- a/net/minecraft/server/LootItemConditionRandomChanceWithLooting.java
++++ b/net/minecraft/server/LootItemConditionRandomChanceWithLooting.java
+@@ -21,6 +21,11 @@
+ if (loottableinfo.c() instanceof EntityLiving) {
+ i = EnchantmentManager.g((EntityLiving) loottableinfo.c());
+ }
++ // CraftBukkit start - only use lootingModifier if set by Bukkit
++ if (loottableinfo.lootingMod > org.bukkit.loot.LootContext.DEFAULT_LOOT_MODIFIER) {
++ i = loottableinfo.lootingMod;
++ }
++ // CraftBukkit end
+
+ return random.nextFloat() < this.a + (float) i * this.b;
+ }
+@@ -40,7 +45,7 @@
+ return new LootItemConditionRandomChanceWithLooting(ChatDeserializer.l(jsonobject, "chance"), ChatDeserializer.l(jsonobject, "looting_multiplier"));
+ }
+
+- public LootItemCondition b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext) {
++ public LootItemConditionRandomChanceWithLooting b(JsonObject jsonobject, JsonDeserializationContext jsondeserializationcontext) { // CraftBukkit - decompile error
+ return this.a(jsonobject, jsondeserializationcontext);
+ }
+ }
diff --git a/nms-patches/LootTableInfo.patch b/nms-patches/LootTableInfo.patch
new file mode 100644
index 00000000..21221c0c
--- /dev/null
+++ b/nms-patches/LootTableInfo.patch
@@ -0,0 +1,67 @@
+--- a/net/minecraft/server/LootTableInfo.java
++++ b/net/minecraft/server/LootTableInfo.java
+@@ -11,6 +11,7 @@
+ public class LootTableInfo {
+
+ private final float a;
++ public final int lootingMod; // CraftBukkit - add field
+ private final WorldServer b;
+ private final LootTableRegistry c;
+ @Nullable
+@@ -23,7 +24,8 @@
+ private final BlockPosition g;
+ private final Set<LootTable> h = Sets.newLinkedHashSet();
+
+- public LootTableInfo(float f, WorldServer worldserver, LootTableRegistry loottableregistry, @Nullable Entity entity, @Nullable EntityHuman entityhuman, @Nullable DamageSource damagesource, @Nullable BlockPosition blockposition) {
++ // CraftBukkit - add looting modifier to constructor
++ public LootTableInfo(float f, WorldServer worldserver, LootTableRegistry loottableregistry, @Nullable Entity entity, @Nullable EntityHuman entityhuman, @Nullable DamageSource damagesource, @Nullable BlockPosition blockposition, int lootingModifier) {
+ this.a = f;
+ this.b = worldserver;
+ this.c = loottableregistry;
+@@ -31,6 +33,7 @@
+ this.e = entityhuman;
+ this.f = damagesource;
+ this.g = blockposition;
++ this.lootingMod = lootingModifier; // CraftBukkit
+ }
+
+ @Nullable
+@@ -127,11 +130,11 @@
+ return LootTableInfo.EntityTarget.a(jsonreader.nextString());
+ }
+
+- public Object read(JsonReader jsonreader) throws IOException {
++ public LootTableInfo.EntityTarget read(JsonReader jsonreader) throws IOException { // CraftBukkit - decompile error
+ return this.a(jsonreader);
+ }
+
+- public void write(JsonWriter jsonwriter, Object object) throws IOException {
++ public void write(JsonWriter jsonwriter, LootTableInfo.EntityTarget object) throws IOException { // CraftBukkit - decompile error
+ this.a(jsonwriter, (LootTableInfo.EntityTarget) object);
+ }
+ }
+@@ -141,6 +144,7 @@
+
+ private final WorldServer a;
+ private float b;
++ private int lootingMod; // CraftBukkit
+ private Entity c;
+ private EntityHuman d;
+ private DamageSource e;
+@@ -175,8 +179,15 @@
+ return this;
+ }
+
++ // CraftBukkit start - add looting modifier
++ public LootTableInfo.a lootingModifier(int modifier) {
++ this.lootingMod = modifier;
++ return this;
++ }
++ // CraftBukkit end
++
+ public LootTableInfo a() {
+- return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().aP(), this.c, this.d, this.e, this.f);
++ return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().aP(), this.c, this.d, this.e, this.f, this.lootingMod); // CraftBukkit add looting modifier
+ }
+ }
+ }