mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-28 23:49:41 +02:00
* Decompile fixes for ProtoChunk and DataPaletteBlock * Do changes * final change * more changes * First Anti-Xray build * Fixes and cleanups * Cleanups and renamings * Cleanups renamings and move OBFHELPERs to 0004-MC-Utils.patch * Implement obfuscation for newly generated chunks * Implement chunk edge mode * Implement block updates * Cleanups * Rebuild patches
390 lines
19 KiB
Diff
390 lines
19 KiB
Diff
From 6691919def0c0a2eb8baccb043701888ab8b2044 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/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
|
index 002da2a19..9f3aa2459 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
|
@@ -150,7 +150,7 @@ public class BlockPosition extends BaseBlockPosition {
|
|
return a(Math.min(blockposition.getX(), blockposition1.getX()), Math.min(blockposition.getY(), blockposition1.getY()), Math.min(blockposition.getZ(), blockposition1.getZ()), Math.max(blockposition.getX(), blockposition1.getX()), Math.max(blockposition.getY(), blockposition1.getY()), Math.max(blockposition.getZ(), blockposition1.getZ()));
|
|
}
|
|
|
|
- public static Iterable<BlockPosition> a(int i, int j, int k, int l, int i1, int j1) {
|
|
+ public static Iterable<BlockPosition> a(int x0, int y0, int z0, int l, int i1, int j1) {
|
|
return () -> {
|
|
return new AbstractIterator() {
|
|
private boolean g = true;
|
|
@@ -161,21 +161,21 @@ public class BlockPosition extends BaseBlockPosition {
|
|
protected BlockPosition a() {
|
|
if (this.g) {
|
|
this.g = false;
|
|
- this.h = i;
|
|
- this.i = j;
|
|
- this.j = k;
|
|
- return new BlockPosition(i, j, k);
|
|
+ this.h = x0;
|
|
+ this.i = y0;
|
|
+ this.j = z0;
|
|
+ return new BlockPosition(x0, y0, z0);
|
|
} else if (this.h == l && this.i == i1 && this.j == j1) {
|
|
return (BlockPosition) this.endOfData();
|
|
} else {
|
|
if (this.h < l) {
|
|
++this.h;
|
|
} else if (this.i < i1) {
|
|
- this.h = i;
|
|
+ this.h = x0;
|
|
++this.i;
|
|
} else if (this.j < j1) {
|
|
- this.h = i;
|
|
- this.i = j;
|
|
+ this.h = x0;
|
|
+ this.i = y0;
|
|
++this.j;
|
|
}
|
|
|
|
@@ -213,8 +213,11 @@ public class BlockPosition extends BaseBlockPosition {
|
|
if (this.g.b < l) {
|
|
++this.g.b;
|
|
} else if (this.g.c < i1) {
|
|
+ this.g.b = i; // Paper - Readd line removed by the decompiler
|
|
++this.g.c;
|
|
} else if (this.g.d < j1) {
|
|
+ this.g.b = i; // Paper - Readd line removed by the decompiler
|
|
+ this.g.c = j; // Paper - Readd line removed by the decompiler
|
|
++this.g.d;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
|
|
index 650ef1475..35aea4829 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkSection.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
|
|
@@ -15,7 +15,7 @@ public class ChunkSection {
|
|
|
|
public ChunkSection(int i, boolean flag) {
|
|
this.yPos = i;
|
|
- this.blockIds = new DataPaletteBlock(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData());
|
|
+ this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // Paper - Decompile error
|
|
this.emittedLight = new NibbleArray();
|
|
if (flag) {
|
|
this.skyLight = new NibbleArray();
|
|
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
|
|
index 20b1bc1b4..030ec8704 100644
|
|
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
|
|
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
|
|
@@ -75,14 +75,14 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
|
|
public int onResize(int i, T t0) {
|
|
this.b();
|
|
DataBits databits = this.a;
|
|
- DataPalette datapalette = this.h;
|
|
+ DataPalette<T> datapalette = this.h; // Paper - decompile fix
|
|
|
|
this.b(i);
|
|
|
|
int j;
|
|
|
|
for (j = 0; j < databits.b(); ++j) {
|
|
- Object object = datapalette.a(databits.a(j));
|
|
+ T object = datapalette.a(databits.a(j)); // Paper - decompile fix
|
|
|
|
if (object != null) {
|
|
this.setBlockIndex(j, object);
|
|
@@ -111,7 +111,7 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
|
|
}
|
|
|
|
protected T a(int i) {
|
|
- Object object = this.h.a(this.a.a(i));
|
|
+ T object = this.h.a(this.a.a(i)); // Paper - decompile fix
|
|
|
|
return object == null ? this.g : object;
|
|
}
|
|
@@ -138,7 +138,7 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
|
|
int j = along.length * 64 / 4096;
|
|
|
|
if (this.h == this.b) {
|
|
- DataPaletteHash datapalettehash = new DataPaletteHash(this.d, i, this.c, this.e, this.f);
|
|
+ DataPaletteHash<T> datapalettehash = new DataPaletteHash<>(this.d, i, this.c, this.e, this.f); // Paper - decompile fix
|
|
|
|
datapalettehash.a(nbttaglist);
|
|
DataBits databits = new DataBits(i, 4096, along);
|
|
diff --git a/src/main/java/net/minecraft/server/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/DedicatedPlayerList.java
|
|
index 4997255c7..a5545bd4c 100644
|
|
--- a/src/main/java/net/minecraft/server/DedicatedPlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/DedicatedPlayerList.java
|
|
@@ -135,8 +135,4 @@ public class DedicatedPlayerList extends PlayerList {
|
|
public boolean f(GameProfile gameprofile) {
|
|
return this.getOPs().b(gameprofile);
|
|
}
|
|
-
|
|
- public MinecraftServer getServer() {
|
|
- return this.getServer();
|
|
- }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java
|
|
index a661789c1..785a1a218 100644
|
|
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
|
|
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
|
|
@@ -88,7 +88,7 @@ public class DefinedStructure {
|
|
}
|
|
|
|
private void a(World world, BlockPosition blockposition, BlockPosition blockposition1) {
|
|
- List list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1), (entity) -> {
|
|
+ List list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1),(Predicate<? super Entity>) (entity) -> { // Paper - decompile fix
|
|
return !(entity instanceof EntityHuman);
|
|
});
|
|
|
|
@@ -285,21 +285,24 @@ public class DefinedStructure {
|
|
voxelshapebitset.a(blockposition3.getX() - i2, blockposition3.getY() - j2, blockposition3.getZ() - l1, true, true);
|
|
}
|
|
|
|
- voxelshapebitset.a((enumdirection, i, j, k) -> {
|
|
- BlockPosition blockposition = new BlockPosition(l + i, i1 + j, j1 + k);
|
|
- BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
|
- IBlockData iblockdata = generatoraccess.getType(blockposition);
|
|
+ // Paper start - decompile fixes
|
|
+ int finalL = l1;
|
|
+ voxelshapebitset.a((enumdirection, i_, j_, k_) -> {
|
|
+ BlockPosition innerBlockposition = new BlockPosition(i2 + i_, j2 + j_, finalL + k_);
|
|
+ BlockPosition blockposition1 = innerBlockposition.shift(enumdirection);
|
|
+ IBlockData iblockdata = generatoraccess.getType(innerBlockposition);
|
|
IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
|
|
- IBlockData iblockdata2 = iblockdata.updateState(enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
|
+ IBlockData iblockdata2 = iblockdata.updateState(enumdirection, iblockdata1, generatoraccess, innerBlockposition, blockposition1);
|
|
|
|
if (iblockdata != iblockdata2) {
|
|
- generatoraccess.setTypeAndData(blockposition, iblockdata2, k1 & -2 | 16);
|
|
+ generatoraccess.setTypeAndData(innerBlockposition, iblockdata2, i & -2 | 16);
|
|
}
|
|
|
|
- IBlockData iblockdata3 = iblockdata1.updateState(enumdirection.opposite(), iblockdata2, generatoraccess, blockposition1, blockposition);
|
|
+ IBlockData iblockdata3 = iblockdata1.updateState(enumdirection.opposite(), iblockdata2, generatoraccess, blockposition1, innerBlockposition);
|
|
|
|
if (iblockdata1 != iblockdata3) {
|
|
- generatoraccess.setTypeAndData(blockposition1, iblockdata3, k1 & -2 | 16);
|
|
+ generatoraccess.setTypeAndData(blockposition1, iblockdata3, i & -2 | 16);
|
|
+ // Paper end - decompile fixes
|
|
}
|
|
|
|
});
|
|
@@ -734,7 +737,7 @@ public class DefinedStructure {
|
|
public IBlockData a(int i) {
|
|
IBlockData iblockdata = (IBlockData) this.b.fromId(i);
|
|
|
|
- return iblockdata == null ? DefinedStructure.a.a : iblockdata;
|
|
+ return iblockdata == null ? a : iblockdata; // Paper - decompile error - Blocks.AIR.getBlockData()
|
|
}
|
|
|
|
public Iterator<IBlockData> iterator() {
|
|
diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java
|
|
index 188d49d82..854ad49b6 100644
|
|
--- a/src/main/java/net/minecraft/server/EnumDirection.java
|
|
+++ b/src/main/java/net/minecraft/server/EnumDirection.java
|
|
@@ -255,7 +255,7 @@ public enum EnumDirection implements INamable {
|
|
return Iterators.forArray(this.c);
|
|
}
|
|
|
|
- public boolean test(@Nullable Object object) {
|
|
+ public boolean test(@Nullable EnumDirection object) { // Paper - Decompile fix
|
|
return this.a((EnumDirection) object);
|
|
}
|
|
}
|
|
@@ -293,9 +293,10 @@ public enum EnumDirection implements INamable {
|
|
return d0;
|
|
}
|
|
|
|
- public boolean test(@Nullable Object object) {
|
|
- return super.a((EnumDirection) object);
|
|
- }
|
|
+ // Paper - Decompile fix
|
|
+ //public boolean test(@Nullable Object object) {
|
|
+ // return super.a((EnumDirection) object);
|
|
+ //}
|
|
},
|
|
Y("y") {
|
|
;
|
|
@@ -307,9 +308,10 @@ public enum EnumDirection implements INamable {
|
|
return d1;
|
|
}
|
|
|
|
- public boolean test(@Nullable Object object) {
|
|
- return super.a((EnumDirection) object);
|
|
- }
|
|
+ // Paper - Decompile fix
|
|
+ //public boolean test(@Nullable Object object) {
|
|
+ // return super.a((EnumDirection) object);
|
|
+ //}
|
|
},
|
|
Z("z") {
|
|
;
|
|
@@ -321,9 +323,10 @@ public enum EnumDirection implements INamable {
|
|
return d2;
|
|
}
|
|
|
|
- public boolean test(@Nullable Object object) {
|
|
- return super.a((EnumDirection) object);
|
|
- }
|
|
+ // Paper - Decompile fix
|
|
+ //public boolean test(@Nullable Object object) {
|
|
+ // return super.a((EnumDirection) object);
|
|
+ //}
|
|
};
|
|
|
|
private static final Map<String, EnumDirection.EnumAxis> d = (Map) Arrays.stream(values()).collect(Collectors.toMap(EnumDirection.EnumAxis::a, (enumdirection_enumaxis) -> {
|
|
@@ -377,7 +380,7 @@ public enum EnumDirection implements INamable {
|
|
|
|
public abstract double a(double d0, double d1, double d2);
|
|
|
|
- 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 8f06c5848..4361b2cee 100644
|
|
--- a/src/main/java/net/minecraft/server/LocaleLanguage.java
|
|
+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java
|
|
@@ -34,7 +34,7 @@ public class LocaleLanguage {
|
|
Entry entry = (Entry) iterator.next();
|
|
String s = LocaleLanguage.b.matcher(ChatDeserializer.a((JsonElement) entry.getValue(), (String) entry.getKey())).replaceAll("%$1s");
|
|
|
|
- this.d.put(entry.getKey(), s);
|
|
+ this.d.put((String) entry.getKey(), s); // Paper - Decompile fix
|
|
}
|
|
|
|
this.e = SystemUtils.b();
|
|
diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java
|
|
index 86585a13f..f52b9c6f0 100644
|
|
--- a/src/main/java/net/minecraft/server/MathHelper.java
|
|
+++ b/src/main/java/net/minecraft/server/MathHelper.java
|
|
@@ -8,7 +8,7 @@ import java.util.function.IntPredicate;
|
|
public class MathHelper {
|
|
|
|
public static final float a = c(2.0F);
|
|
- private static final float[] b = (float[]) SystemUtils.a((Object) (new float[65536]), (afloat) -> {
|
|
+ private static final float[] b = (float[]) SystemUtils.a((new float[65536]), (afloat) -> { // Paper - Decompile fix
|
|
for (int i = 0; i < afloat.length; ++i) {
|
|
afloat[i] = (float) Math.sin((double) i * 3.141592653589793D * 2.0D / 65536.0D);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java
|
|
index 824e68b50..584a86c11 100644
|
|
--- a/src/main/java/net/minecraft/server/ProtoChunk.java
|
|
+++ b/src/main/java/net/minecraft/server/ProtoChunk.java
|
|
@@ -65,7 +65,7 @@ public class ProtoChunk implements IChunkAccess {
|
|
this.b = chunkcoordintpair;
|
|
this.p = chunkconverter;
|
|
Predicate predicate = (block) -> {
|
|
- return block == null || block.getBlockData().isAir();
|
|
+ return block == null || ((Block) block).getBlockData().isAir(); // Paper - decompile fix
|
|
};
|
|
RegistryBlocks registryblocks = Block.REGISTRY;
|
|
|
|
@@ -325,8 +325,8 @@ public class ProtoChunk implements IChunkAccess {
|
|
}
|
|
|
|
private HeightMap c(HeightMap.Type heightmap_type) {
|
|
- return (HeightMap) this.f.computeIfAbsent(heightmap_type, (heightmap_type) -> {
|
|
- HeightMap heightmap = new HeightMap(this, heightmap_type);
|
|
+ return (HeightMap) this.f.computeIfAbsent(heightmap_type, (heightmap_type1) -> { // Paper - decompile fix
|
|
+ HeightMap heightmap = new HeightMap(this, heightmap_type1); // Paper - decompile fix
|
|
|
|
heightmap.a();
|
|
return heightmap;
|
|
@@ -372,13 +372,13 @@ public class ProtoChunk implements IChunkAccess {
|
|
|
|
@Nullable
|
|
public LongSet b(String s) {
|
|
- return (LongSet) this.o.computeIfAbsent(s, (s) -> {
|
|
+ return (LongSet) this.o.computeIfAbsent(s, (s1) -> { // Paper - decompile fix
|
|
return new LongOpenHashSet();
|
|
});
|
|
}
|
|
|
|
public void a(String s, long i) {
|
|
- ((LongSet) this.o.computeIfAbsent(s, (s) -> {
|
|
+ ((LongSet) this.o.computeIfAbsent(s, (s1) -> { // Paper - decompile fix
|
|
return new LongOpenHashSet();
|
|
})).add(i);
|
|
this.c = true;
|
|
@@ -493,7 +493,7 @@ public class ProtoChunk implements IChunkAccess {
|
|
}
|
|
|
|
public BitSet a(WorldGenStage.Features worldgenstage_features) {
|
|
- return (BitSet) this.t.computeIfAbsent(worldgenstage_features, (worldgenstage_features) -> {
|
|
+ return (BitSet) this.t.computeIfAbsent(worldgenstage_features, (worldgenstage_features1) -> { // Paper - decompile fix
|
|
return new BitSet(65536);
|
|
});
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java
|
|
index 3b8f6ec16..bde5714dd 100644
|
|
--- a/src/main/java/net/minecraft/server/RegistryID.java
|
|
+++ b/src/main/java/net/minecraft/server/RegistryID.java
|
|
@@ -6,7 +6,7 @@ import java.util.Arrays;
|
|
import java.util.Iterator;
|
|
import javax.annotation.Nullable;
|
|
|
|
-public class RegistryID<K> implements Registry<K> {
|
|
+public class RegistryID<K> implements Registry { // Paper - decompile fix
|
|
|
|
private static final Object a = null;
|
|
private K[] b;
|
|
@@ -17,9 +17,9 @@ public class RegistryID<K> implements Registry<K> {
|
|
|
|
public RegistryID(int i) {
|
|
i = (int) ((float) i / 0.8F);
|
|
- this.b = (Object[]) (new Object[i]);
|
|
+ this.b = (K[]) (new Object[i]); // Paper - decompile fix
|
|
this.c = new int[i];
|
|
- this.d = (Object[]) (new Object[i]);
|
|
+ this.d = (K[]) (new Object[i]); // Paper - decompile fix
|
|
}
|
|
|
|
public int getId(@Nullable K k0) {
|
|
@@ -51,12 +51,12 @@ 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 = (Object[]) (new Object[i]);
|
|
+ this.b = (K[]) (new Object[i]); // Paper - decompile fix
|
|
this.c = new int[i];
|
|
- this.d = (Object[]) (new Object[i]);
|
|
+ this.d = (K[]) (new Object[i]); // Paper - decompile fix
|
|
this.e = 0;
|
|
this.f = 0;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ShapeDetector.java b/src/main/java/net/minecraft/server/ShapeDetector.java
|
|
index 43596cb2d..3faf74a22 100644
|
|
--- a/src/main/java/net/minecraft/server/ShapeDetector.java
|
|
+++ b/src/main/java/net/minecraft/server/ShapeDetector.java
|
|
@@ -171,7 +171,7 @@ public class ShapeDetector {
|
|
return new ShapeDetectorBlock(this.a, blockposition, this.b);
|
|
}
|
|
|
|
- public Object load(Object object) throws Exception {
|
|
+ public ShapeDetectorBlock load(BlockPosition object) throws Exception { // Paper - Decompile fix
|
|
return this.a((BlockPosition) object);
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
|
|
index 4b5463cca..53c9f2188 100644
|
|
--- a/src/main/java/net/minecraft/server/VoxelShape.java
|
|
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
|
|
@@ -67,7 +67,7 @@ public abstract class VoxelShape {
|
|
ArrayList arraylist = Lists.newArrayList();
|
|
|
|
this.b((d0, d1, d2, d3, d4, d5) -> {
|
|
- list.add(new AxisAlignedBB(d0, d1, d2, d3, d4, d5));
|
|
+ arraylist.add(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); // Paper - decompile fix
|
|
});
|
|
return arraylist;
|
|
}
|
|
--
|
|
2.18.0
|
|
|