SPIGOT-4166: Fix Tags being corrupted by early access (and not reflecting reloads)

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2018-07-28 14:39:35 +10:00
parent 609e8025ad
commit 90e0341727
6 changed files with 89 additions and 18 deletions

View File

@@ -0,0 +1,14 @@
--- a/net/minecraft/server/TagRegistry.java
+++ b/net/minecraft/server/TagRegistry.java
@@ -38,6 +38,11 @@
TagsBlock.a((Tags) this.a);
TagsItem.a((Tags) this.b);
TagsFluid.a((Tags) this.c);
+ // CraftBukkit start
+ this.a.version++;
+ this.b.version++;
+ this.c.version++;
+ // CraftBukkit end
}
public void a(PacketDataSerializer packetdataserializer) {

View File

@@ -0,0 +1,28 @@
--- a/net/minecraft/server/TagsServer.java
+++ b/net/minecraft/server/TagsServer.java
@@ -11,6 +11,7 @@
public class TagsServer<T> extends Tags<T> {
private final RegistryMaterials<MinecraftKey, T> a;
+ public int version; // CraftBukkit
public TagsServer(RegistryMaterials<MinecraftKey, T> registrymaterials, String s, String s1) {
super(registrymaterials::d, registrymaterials::get, s, false, s1);
@@ -31,7 +32,7 @@
while (iterator1.hasNext()) {
Object object = iterator1.next();
- packetdataserializer.d(this.a.a(object));
+ packetdataserializer.d(this.a.a((T) object)); // CraftBukkit - decompile error
}
}
@@ -49,7 +50,7 @@
arraylist.add(this.a.getId(packetdataserializer.g()));
}
- this.c().put(minecraftkey, Tag.a.a().a((Collection) arraylist).b(minecraftkey));
+ this.c().put(minecraftkey, (Tag<T>) Tag.a.a().a((Collection) arraylist).b(minecraftkey)); // CraftBukkit - decompile error
}
}