summaryrefslogtreecommitdiffstats
path: root/nms-patches/LootTableInfo.patch
blob: 44c1d298b9c28d927b512ee298fd44c286a1e51c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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 = org.bukkit.loot.LootContext.DEFAULT_LOOT_MODIFIER; // CraftBukkit
         private Entity c;
         private EntityHuman d;
         private DamageSource e;
@@ -175,8 +179,15 @@
             return this;
         }
 
+        // CraftBukkit start - add looting modifier
+        public LootTableInfo.Builder lootingModifier(int modifier) {
+            this.lootingMod = modifier;
+            return this;
+        }
+        // CraftBukkit end
+
         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
         }
     }
 }