PaperMC/nms-patches/LootTableInfo.patch

54 lines
2.2 KiB
Diff
Raw Normal View History

2018-08-12 10:39:51 +02:00
--- 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
2018-12-13 01:00:00 +01:00
@@ -130,6 +133,7 @@
2018-08-12 10:39:51 +02:00
private final WorldServer a;
private float b;
2018-08-16 12:39:29 +02:00
+ private int lootingMod = org.bukkit.loot.LootContext.DEFAULT_LOOT_MODIFIER; // CraftBukkit
2018-08-12 10:39:51 +02:00
private Entity c;
private EntityHuman d;
private DamageSource e;
2018-12-13 01:00:00 +01:00
@@ -164,8 +168,15 @@
2018-08-12 10:39:51 +02:00
return this;
}
+ // CraftBukkit start - add looting modifier
2018-08-26 04:00:00 +02:00
+ public LootTableInfo.Builder lootingModifier(int modifier) {
2018-08-12 10:39:51 +02:00
+ this.lootingMod = modifier;
+ return this;
+ }
+ // CraftBukkit end
+
2018-08-26 04:00:00 +02:00
public LootTableInfo build() {
- return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().getLootTableRegistry(), this.c, this.d, this.e, this.f);
+ return new LootTableInfo(this.b, this.a, this.a.getMinecraftServer().getLootTableRegistry(), this.c, this.d, this.e, this.f, this.lootingMod); // CraftBukkit add looting modifier
2018-08-12 10:39:51 +02:00
}
}
}