papermc/Spigot-Server-Patches/0003-MC-Dev-fixes.patch
Aikar d089acb3bd
Switch to using ForgeFlower for Paper Only mc-dev imports
ForgeFlower is better than Spigots FernFlower at decompiling the source.

However, in order to maintain the CraftBukkit patches, we must keep
using spigots for the primary.

However, for any file that we import on top of Spigots imported files
there is nothing stopping us from using better decompiled files.

So these changes will use ForgeFlower to maintain a better set of
decomped files, so anything we add on top of Paper can start off
in a better spot.
2018-08-31 23:47:57 -04:00

478 lines
24 KiB
Diff

From a745d7718cedae36f6ec9cd4222da6e69e754ae1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 30 Mar 2016 19:36:20 -0400
Subject: [PATCH] MC Dev fixes
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index a553fb7476..4048937c63 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -99,7 +99,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
}
// $FF: synthetic method
- public int compareTo(Object object) {
+ public int compareTo(BaseBlockPosition object) { // Paper - decompile fix
return this.l((BaseBlockPosition)object);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 7f8802b2ef..6ffc535146 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -179,7 +179,7 @@ public class BlockPosition extends BaseBlockPosition {
}
// $FF: synthetic method
- protected Object computeNext() {
+ protected BlockPosition computeNext() { // Paper - decompile fix
return this.a();
}
};
@@ -209,8 +209,11 @@ public class BlockPosition extends BaseBlockPosition {
if (this.g.b < l) {
++this.g.b;
} else if (this.g.c < i1) {
+ this.g.b = ix; // Paper - decompile fix Readd line removed by the decompiler
++this.g.c;
} else if (this.g.d < j1) {
+ this.g.b = ix; // Paper - decompile fix Readd line removed by the decompiler
+ this.g.c = jx; // Paper - decompile fix Readd line removed by the decompiler
++this.g.d;
}
@@ -219,7 +222,7 @@ public class BlockPosition extends BaseBlockPosition {
}
// $FF: synthetic method
- protected Object computeNext() {
+ protected BlockPosition.MutableBlockPosition computeNext() { // Paper - decompile fix
return this.a();
}
};
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
index 3bd0c56d46..304e47bf20 100644
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
@@ -72,11 +72,11 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
public int onResize(int ix, T object) {
this.b();
DataBits databits = this.a;
- DataPalette datapalette = this.h;
+ DataPalette<T> datapalette = this.h; // Paper - decompile fix
this.b(ix);
for(int jx = 0; jx < databits.b(); ++jx) {
- Object object1 = datapalette.a(databits.a(jx));
+ T object1 = datapalette.a(databits.a(jx)); // Paper - decompile fix
if (object1 != null) {
this.setBlockIndex(jx, object1);
}
@@ -103,7 +103,7 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
}
protected T a(int ix) {
- Object object = this.h.a(this.a.a(ix));
+ T object = this.h.a(this.a.a(ix)); // Paper - decompile fix
return (T)(object == null ? this.g : object);
}
@@ -127,7 +127,7 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
long[] along = nbttagcompound.o(s1);
int jx = along.length * 64 / 4096;
if (this.h == this.b) {
- DataPaletteHash datapalettehash = new DataPaletteHash(this.d, ix, this.c, this.e, this.f);
+ DataPaletteHash<T> datapalettehash = new DataPaletteHash(this.d, ix, this.c, this.e, this.f); // Paper - decompile fix
datapalettehash.a(nbttaglist);
DataBits databits = new DataBits(ix, 4096, along);
diff --git a/src/main/java/net/minecraft/server/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/DedicatedPlayerList.java
index 5eded6dc20..11f9642e6e 100644
--- a/src/main/java/net/minecraft/server/DedicatedPlayerList.java
+++ b/src/main/java/net/minecraft/server/DedicatedPlayerList.java
@@ -136,7 +136,7 @@ public class DedicatedPlayerList extends PlayerList {
}
// $FF: synthetic method
- public MinecraftServer getServer() {
+ public MinecraftServer getMinecraftServer() { // Paper - decompile fix
return this.getServer();
}
}
diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java
index 4dd4b01c82..987d944dbd 100644
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
@@ -77,7 +77,7 @@ public class DefinedStructure {
}
private void a(World world, BlockPosition blockposition, BlockPosition blockposition1) {
- List list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1), (entity1) -> {
+ List<Entity> list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1),(java.util.function.Predicate<? super Entity>) (entity1) -> { // Paper - decompile fix
return !(entity1 instanceof EntityHuman);
});
this.b.clear();
@@ -145,12 +145,12 @@ public class DefinedStructure {
if (this.a.isEmpty()) {
return false;
} else {
- List list = definedstructureinfo.a(this.a, blockposition);
+ List<BlockInfo> list = definedstructureinfo.a(this.a, blockposition); // Paper - decompile fix
if ((!list.isEmpty() || !definedstructureinfo.h() && !this.b.isEmpty()) && this.c.getX() >= 1 && this.c.getY() >= 1 && this.c.getZ() >= 1) {
Block block = definedstructureinfo.i();
StructureBoundingBox structureboundingbox = definedstructureinfo.j();
- ArrayList arraylist = Lists.newArrayListWithCapacity(definedstructureinfo.m() ? list.size() : 0);
- ArrayList arraylist1 = Lists.newArrayListWithCapacity(list.size());
+ ArrayList<BlockPosition> arraylist = Lists.newArrayListWithCapacity(definedstructureinfo.m() ? list.size() : 0); // Paper - decompile fix
+ ArrayList<Pair> arraylist1 = Lists.newArrayListWithCapacity(list.size()); // Paper - decompile fix
int j = Integer.MAX_VALUE;
int k = Integer.MAX_VALUE;
int l = Integer.MAX_VALUE;
@@ -427,7 +427,7 @@ public class DefinedStructure {
nbttagcompound.set("blocks", new NBTTagList());
nbttagcompound.set("palette", new NBTTagList());
} else {
- ArrayList arraylist = Lists.newArrayList();
+ ArrayList<DefinedStructure.a> arraylist = Lists.newArrayList(); // Paper - decompile fix
DefinedStructure.a definedstructure$a = new DefinedStructure.a();
arraylist.add(definedstructure$a);
diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java
index 5c2d50f974..fd6df39f17 100644
--- a/src/main/java/net/minecraft/server/EnchantmentManager.java
+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java
@@ -51,7 +51,7 @@ public class EnchantmentManager {
public static void a(Map<Enchantment, Integer> map, ItemStack itemstack) {
NBTTagList nbttaglist = new NBTTagList();
- for(Entry entry : map.entrySet()) {
+ for(Entry<Enchantment, Integer> entry : map.entrySet()) { // Paper - decompile fix
Enchantment enchantment = (Enchantment)entry.getKey();
if (enchantment != null) {
int i = entry.getValue();
@@ -146,7 +146,7 @@ public class EnchantmentManager {
}
public static int a(Enchantment enchantment, EntityLiving entityliving) {
- List list = enchantment.a(entityliving);
+ List<ItemStack> list = enchantment.a(entityliving); // Paper - decompile fix
if (list == null) {
return 0;
} else {
@@ -224,7 +224,7 @@ public class EnchantmentManager {
}
public static ItemStack b(Enchantment enchantment, EntityLiving entityliving) {
- List list = enchantment.a(entityliving);
+ List<ItemStack> list = enchantment.a(entityliving);// Paper - decompile fix
if (list.isEmpty()) {
return ItemStack.a;
} else {
@@ -260,7 +260,7 @@ public class EnchantmentManager {
}
public static ItemStack a(Random random, ItemStack itemstack, int i, boolean flag) {
- List list = b(random, itemstack, i, flag);
+ List<WeightedRandomEnchant> list = b(random, itemstack, i, flag); // Paper - decompile fix
boolean flag1 = itemstack.getItem() == Items.BOOK;
if (flag1) {
itemstack = new ItemStack(Items.ENCHANTED_BOOK);
@@ -328,7 +328,7 @@ public class EnchantmentManager {
}
public static List<WeightedRandomEnchant> a(int i, ItemStack itemstack, boolean flag) {
- ArrayList arraylist = Lists.newArrayList();
+ ArrayList<WeightedRandomEnchant> arraylist = Lists.newArrayList();
Item item = itemstack.getItem();
boolean flag1 = itemstack.getItem() == Items.BOOK;
diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java
index 04cff50cb7..e746a6a0da 100644
--- a/src/main/java/net/minecraft/server/EntityDragonFireball.java
+++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java
@@ -14,7 +14,7 @@ public class EntityDragonFireball extends EntityFireball {
protected void a(MovingObjectPosition movingobjectposition) {
if (movingobjectposition.entity == null || !movingobjectposition.entity.s(this.shooter)) {
if (!this.world.isClientSide) {
- List list = this.world.a(EntityLiving.class, this.getBoundingBox().grow(4.0D, 2.0D, 4.0D));
+ List<EntityLiving> list = this.world.a(EntityLiving.class, this.getBoundingBox().grow(4.0D, 2.0D, 4.0D)); // Paper - decompile fix
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ);
entityareaeffectcloud.setSource(this.shooter);
entityareaeffectcloud.setParticle(Particles.j);
diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java
index 38c85f4ab7..c0853f0fcd 100644
--- a/src/main/java/net/minecraft/server/EnumDirection.java
+++ b/src/main/java/net/minecraft/server/EnumDirection.java
@@ -233,7 +233,7 @@ public enum EnumDirection implements INamable {
}
// $FF: synthetic method
- public boolean test(@Nullable Object object) {
+ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix
return super.a((EnumDirection)object);
}
},
@@ -247,7 +247,7 @@ public enum EnumDirection implements INamable {
}
// $FF: synthetic method
- public boolean test(@Nullable Object object) {
+ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix
return super.a((EnumDirection)object);
}
},
@@ -261,7 +261,7 @@ public enum EnumDirection implements INamable {
}
// $FF: synthetic method
- public boolean test(@Nullable Object object) {
+ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix
return super.a((EnumDirection)object);
}
};
@@ -316,7 +316,7 @@ public enum EnumDirection implements INamable {
public abstract double a(double var1, double var3, double var5);
// $FF: synthetic method
- public boolean test(@Nullable Object object) {
+ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix
return this.a((EnumDirection)object);
}
}
@@ -367,7 +367,7 @@ public enum EnumDirection implements INamable {
}
// $FF: synthetic method
- public boolean test(@Nullable Object object) {
+ public boolean test(@Nullable EnumDirection object) { // Paper - decompile fix
return this.a((EnumDirection)object);
}
}
diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java
index 0c9249cd8d..0648c76a07 100644
--- a/src/main/java/net/minecraft/server/LocaleLanguage.java
+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java
@@ -27,7 +27,7 @@ public class LocaleLanguage {
JsonElement jsonelement = (JsonElement)(new Gson()).fromJson(new InputStreamReader(inputstream, StandardCharsets.UTF_8), JsonElement.class);
JsonObject jsonobject = ChatDeserializer.m(jsonelement, "strings");
- for(Entry entry : jsonobject.entrySet()) {
+ for(Entry<String, JsonElement> entry : jsonobject.entrySet()) {// Paper - Decompile fix
String s = b.matcher(ChatDeserializer.a((JsonElement)entry.getValue(), (String)entry.getKey())).replaceAll("%$1s");
this.d.put(entry.getKey(), s);
}
diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java
index 9d01b70c7f..8daccdd6e9 100644
--- a/src/main/java/net/minecraft/server/LootSelectorEntry.java
+++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java
@@ -83,12 +83,12 @@ public abstract class LootSelectorEntry {
}
// $FF: synthetic method
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
+ public JsonElement serialize(LootSelectorEntry object, Type type, JsonSerializationContext jsonserializationcontext) {// Paper - Decompile fix
return this.a((LootSelectorEntry)object, type, jsonserializationcontext);
}
// $FF: synthetic method
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ public LootSelectorEntry deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {// Paper - Decompile fix
return this.a(jsonelement, type, jsondeserializationcontext);
}
}
diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java
index 7e88bcd6e4..b98dfe27d5 100644
--- a/src/main/java/net/minecraft/server/NBTBase.java
+++ b/src/main/java/net/minecraft/server/NBTBase.java
@@ -87,7 +87,7 @@ public interface NBTBase {
}
}
- NBTBase clone();
+ public NBTBase clone(); // Paper - decompile fix
default String b_() {
return this.toString();
diff --git a/src/main/java/net/minecraft/server/NBTList.java b/src/main/java/net/minecraft/server/NBTList.java
index 456b5f4925..54f2935c08 100644
--- a/src/main/java/net/minecraft/server/NBTList.java
+++ b/src/main/java/net/minecraft/server/NBTList.java
@@ -25,6 +25,7 @@ public abstract class NBTList<T extends NBTBase> extends AbstractList<T> impleme
public abstract void b(int var1);
// $FF: synthetic method
+ /* // Paper start- Decompile fix
public Object set(int i, Object object) {
return this.set(i, (NBTBase)object);
}
@@ -32,5 +33,9 @@ public abstract class NBTList<T extends NBTBase> extends AbstractList<T> impleme
// $FF: synthetic method
public Object get(int i) {
return this.get(i);
- }
+ }*/
+
+ @Override
+ public abstract NBTBase clone();
+ // Paper end- Decompile fix
}
diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java
index 11ffa6c342..5d61cf70bc 100644
--- a/src/main/java/net/minecraft/server/NBTTagByteArray.java
+++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java
@@ -66,7 +66,8 @@ public class NBTTagByteArray extends NBTList<NBTTagByte> {
return stringbuilder.append(']').toString();
}
- public NBTBase clone() {
+ @Override
+ public NBTTagByteArray clone() { // Paper - decompile fix
byte[] abyte = new byte[this.data.length];
System.arraycopy(this.data, 0, abyte, 0, this.data.length);
diff --git a/src/main/java/net/minecraft/server/NBTTagIntArray.java b/src/main/java/net/minecraft/server/NBTTagIntArray.java
index f5c9b97d5c..d121ad4f7a 100644
--- a/src/main/java/net/minecraft/server/NBTTagIntArray.java
+++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java
@@ -132,7 +132,7 @@ public class NBTTagIntArray extends NBTList<NBTTagInt> {
return this.a(i);
}
- public NBTBase clone() {
+ public NBTTagIntArray clone() { // Paper - decompile fix
return this.c();
}
}
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
index 5b54cbde18..769d599c59 100644
--- a/src/main/java/net/minecraft/server/NBTTagList.java
+++ b/src/main/java/net/minecraft/server/NBTTagList.java
@@ -12,7 +12,7 @@ import org.apache.logging.log4j.Logger;
public class NBTTagList extends NBTList<NBTBase> {
private static final Logger f = LogManager.getLogger();
- private List<NBTBase> list = Lists.newArrayList();
+ public List<NBTBase> list = Lists.newArrayList(); // Paper
private byte type = 0;
public NBTTagList() {
@@ -286,6 +286,7 @@ public class NBTTagList extends NBTList<NBTBase> {
return this.c();
}
+ /* // Paper start - Decompile fix
// $FF: synthetic method
public Object remove(int i) {
return this.remove(i);
@@ -305,4 +306,5 @@ public class NBTTagList extends NBTList<NBTBase> {
public boolean add(Object object) {
return this.add((NBTBase)object);
}
+ */ // Paper end - Decompile fix
}
diff --git a/src/main/java/net/minecraft/server/Registry.java b/src/main/java/net/minecraft/server/Registry.java
index 5be9f0ff2f..9efec49d66 100644
--- a/src/main/java/net/minecraft/server/Registry.java
+++ b/src/main/java/net/minecraft/server/Registry.java
@@ -1,4 +1,8 @@
package net.minecraft.server;
-public interface Registry extends Iterable {
+import java.util.Iterator;
+public interface Registry<T> extends Iterable<T> { // Paper - decompile fix
+
+ @Override
+ Iterator<T> iterator(); // Paper - decompile fix
}
diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java
index 8d1f9237aa..a21006290c 100644
--- a/src/main/java/net/minecraft/server/RegistryBlockID.java
+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java
@@ -26,7 +26,7 @@ public class RegistryBlockID<T> implements Registry<T> {
this.b.put(object, i);
while(this.c.size() <= i) {
- this.c.add((Object)null);
+ this.c.add(null); // Paper - decompile fix
}
this.c.set(i, object);
diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java
index 03c6033622..d03ac0e70c 100644
--- a/src/main/java/net/minecraft/server/RegistryID.java
+++ b/src/main/java/net/minecraft/server/RegistryID.java
@@ -49,7 +49,7 @@ public class RegistryID<K> implements Registry<K> {
}
private void d(int i) {
- Object[] aobject = this.b;
+ K[] aobject = this.b; // Paper - decompile fix
int[] aint = this.c;
this.b = (K[])(new Object[i]);
this.c = new int[i];
diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java
index 7b8a8064b8..615aa2cd04 100644
--- a/src/main/java/net/minecraft/server/ServerPing.java
+++ b/src/main/java/net/minecraft/server/ServerPing.java
@@ -101,12 +101,12 @@ public class ServerPing {
}
// $FF: synthetic method
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
+ public JsonElement serialize(ServerPing object, Type type, JsonSerializationContext jsonserializationcontext) {// Paper - Decompile fix
return this.a((ServerPing)object, type, jsonserializationcontext);
}
// $FF: synthetic method
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ public ServerPing deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {// Paper - Decompile fix
return this.a(jsonelement, type, jsondeserializationcontext);
}
}
@@ -145,12 +145,12 @@ public class ServerPing {
}
// $FF: synthetic method
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
+ public JsonElement serialize(ServerPing.ServerData object, Type type, JsonSerializationContext jsonserializationcontext) {// Paper - Decompile fix
return this.a((ServerPing.ServerData)object, type, jsonserializationcontext);
}
// $FF: synthetic method
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ public ServerPing.ServerData deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {// Paper - Decompile fix
return this.a(jsonelement, type, jsondeserializationcontext);
}
}
@@ -229,12 +229,12 @@ public class ServerPing {
}
// $FF: synthetic method
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
+ public JsonElement serialize(ServerPing.ServerPingPlayerSample object, Type type, JsonSerializationContext jsonserializationcontext) {// Paper - Decompile fix
return this.a((ServerPing.ServerPingPlayerSample)object, type, jsonserializationcontext);
}
// $FF: synthetic method
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ public ServerPing.ServerPingPlayerSample deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {// Paper - Decompile fix
return this.a(jsonelement, type, jsondeserializationcontext);
}
}
diff --git a/src/main/java/net/minecraft/server/ShapeDetector.java b/src/main/java/net/minecraft/server/ShapeDetector.java
index ef9d8e06fe..0c9910d9a5 100644
--- a/src/main/java/net/minecraft/server/ShapeDetector.java
+++ b/src/main/java/net/minecraft/server/ShapeDetector.java
@@ -107,7 +107,7 @@ public class ShapeDetector {
}
// $FF: synthetic method
- public Object load(Object object) throws Exception {
+ public ShapeDetectorBlock load(BlockPosition object) throws Exception {// Paper - Decompile fix
return this.a((BlockPosition)object);
}
}
--
2.18.0