mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Move getTypeIfLoaded and friends to IBlockAccess (#2077)
This commit is contained in:
parent
4a65bd4b04
commit
78a4e64734
38 changed files with 312 additions and 174 deletions
|
@ -40,7 +40,7 @@ index ed9e2e3e18..047d6df9c1 100644
|
|||
|
||||
protected void g() {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index e3de634893..db0c520394 100644
|
||||
index eed3fa615f..f93e3faae2 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add Heightmap API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index ad58d4fd63..c04d73e738 100644
|
||||
index 6a36c4467f..d4789478b6 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add World Util Methods
|
|||
Methods that can be used for other patches to help improve logic.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 36023073e9..4248a50142 100644
|
||||
index 879a491920..d246970d3e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -17,35 +17,8 @@ index 36023073e9..4248a50142 100644
|
|||
public int a(BlockPosition blockposition, int i) {
|
||||
return this.a(blockposition, i, this.world.getWorldProvider().g());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java
|
||||
index 9a98fb4af5..452b2b2d28 100644
|
||||
--- a/src/main/java/net/minecraft/server/IWorldReader.java
|
||||
+++ b/src/main/java/net/minecraft/server/IWorldReader.java
|
||||
@@ -0,0 +0,0 @@ public interface IWorldReader extends IIBlockAccess {
|
||||
}
|
||||
|
||||
int getLightLevel(BlockPosition blockposition, int i);
|
||||
+ // Paper start
|
||||
+ default @Nullable
|
||||
+ IBlockData getTypeIfLoaded(BlockPosition var1) {
|
||||
+ return isLoaded(var1) ? getType(var1) : null;
|
||||
+ }
|
||||
+
|
||||
+ default @Nullable
|
||||
+ Block getBlockIfLoaded(BlockPosition var1) {
|
||||
+ return isLoaded(var1) ? getType(var1).getBlock() : null;
|
||||
+ }
|
||||
+
|
||||
+ default @Nullable
|
||||
+ Material getMaterialIfLoaded(BlockPosition var1) {
|
||||
+ return isLoaded(var1) ? getType(var1).getMaterial() : null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
@Nullable
|
||||
IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag);
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index a50842b13a..d4be7e884d 100644
|
||||
index 373d08b23a..e43b1d27c3 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
@ -107,36 +80,6 @@ index a50842b13a..d4be7e884d 100644
|
|||
+ public IBlockData getTypeIfLoadedAndInBounds(BlockPosition blockposition) {
|
||||
+ return getWorldBorder().isInBounds(blockposition) ? getTypeIfLoaded(blockposition) : null;
|
||||
+ }
|
||||
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
|
||||
+ // CraftBukkit start - tree generation
|
||||
+ if (captureTreeGeneration) {
|
||||
+ for (CraftBlockState previous : capturedBlockStates) {
|
||||
+ if (previous.getX() == blockposition.getX() && previous.getY() == blockposition.getY() && previous.getZ() == blockposition.getZ()) {
|
||||
+ return previous.getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ Chunk chunk = this.getChunkIfLoaded(blockposition);
|
||||
+ if (chunk != null) {
|
||||
+ return isValidLocation(blockposition) ? chunk.getType(blockposition) : Blocks.AIR.getBlockData();
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ public Block getBlockIfLoaded(BlockPosition blockposition) {
|
||||
+ IBlockData type = getTypeIfLoaded(blockposition);
|
||||
+ if (type == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ return type.getBlock();
|
||||
+ }
|
||||
+ public Material getMaterialIfLoaded(BlockPosition blockposition) {
|
||||
+ IBlockData type = getTypeIfLoaded(blockposition);
|
||||
+ if (type == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ return type.getBlock().material;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public Chunk getChunkAtWorldCoords(BlockPosition blockposition) {
|
||||
|
|
|
@ -49,7 +49,7 @@ index 0000000000..f699ce18ca
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index ad2c49df52..36023073e9 100644
|
||||
index 318035a48e..879a491920 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
@ -216,7 +216,7 @@ index beeb9ccb8d..bb3aa4a376 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0749447184..a50842b13a 100644
|
||||
index 72435a2c07..373d08b23a 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
|
|
|
@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created
|
|||
if the entity was to end up in 2 different chunk slices
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 5a49b015c2..fc455e1f04 100644
|
||||
index f2ca391bfe..2cb3e36965 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
|
|
@ -17,7 +17,7 @@ index 11652628b1..90923c7536 100644
|
|||
if (this.world.J() && !this.world.isClientSide) {
|
||||
float f = this.aE();
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 5220ea0994..70e5552cd9 100644
|
||||
index 1f2e2cd873..163d7f37c9 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -11,7 +11,7 @@ floating in the air.
|
|||
This can replace many uses of BlockPhysicsEvent
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index d20077892b..774bb4d0d7 100644
|
||||
index 3425f034c8..4280fdf807 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -35,7 +35,7 @@ index 2a71381dae..e43866991c 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 82361fff08..2218552ba1 100644
|
||||
index c211f8a43f..2da7c4531f 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Disable spigot tick limiters
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 62098b2fc7..47defb2f0a 100644
|
||||
index c792b713fc..6d900669d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Do not load chunks for Pathfinding
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java
|
||||
index 2c9bf7d00..281f5f04f 100644
|
||||
index ccbc1dde09..34e743716b 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkCache.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkCache implements IWorldReader {
|
||||
|
@ -13,12 +13,21 @@ index 2c9bf7d00..281f5f04f 100644
|
|||
for (k = this.a; k <= i; ++k) {
|
||||
for (l = this.b; l <= j; ++l) {
|
||||
- this.c[k - this.a][l - this.b] = world.getChunkAt(k, l, ChunkStatus.FULL, false);
|
||||
+ this.c[k - this.a][l - this.b] = world.getChunkIfLoaded(k, l); // Paper
|
||||
+ this.c[k - this.a][l - this.b] = world.getChunkIfLoadedImmediately(k, l); // Paper
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ChunkCache implements IWorldReader {
|
||||
int k = i - this.a;
|
||||
int l = j - this.b;
|
||||
|
||||
- return k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length;
|
||||
+ return k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length && this.c[k][l] != null; // Paper - We don't always load chunks
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index d04eb1bbf..4a91e0d8c 100644
|
||||
index d04eb1bbfe..ed69eaa176 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
|
@ -28,28 +37,10 @@ index d04eb1bbf..4a91e0d8c 100644
|
|||
- private Pathfinder r;
|
||||
+ private Pathfinder r; public Pathfinder getPathfinder() { return r; } // Paper - OBFHELPER
|
||||
|
||||
+ private void setWorld() { if (getPathfinder() != null && getPathfinder().getPathfinder() != null) getPathfinder().getPathfinder().world = getEntity().world; } // Paper
|
||||
public NavigationAbstract(EntityInsentient entityinsentient, World world) {
|
||||
this.g = Vec3D.a;
|
||||
this.h = Vec3D.a;
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
this.b = world;
|
||||
this.p = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
|
||||
this.r = this.a(MathHelper.floor(this.p.getValue() * 16.0D));
|
||||
+ setWorld(); // Paper
|
||||
}
|
||||
|
||||
public BlockPosition h() {
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
}
|
||||
|
||||
public void c() {
|
||||
+ setWorld(); // Paper
|
||||
++this.e;
|
||||
if (this.m) {
|
||||
this.k();
|
||||
diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java
|
||||
index 359d9a11c..262fa5585 100644
|
||||
index 359d9a11c0..262fa55850 100644
|
||||
--- a/src/main/java/net/minecraft/server/Pathfinder.java
|
||||
+++ b/src/main/java/net/minecraft/server/Pathfinder.java
|
||||
@@ -0,0 +0,0 @@ public class Pathfinder {
|
||||
|
@ -61,28 +52,8 @@ index 359d9a11c..262fa5585 100644
|
|||
|
||||
public Pathfinder(PathfinderAbstract pathfinderabstract, int i) {
|
||||
this.e = pathfinderabstract;
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderAbstract.java b/src/main/java/net/minecraft/server/PathfinderAbstract.java
|
||||
index 92df34aba..e773bef61 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PathfinderAbstract {
|
||||
|
||||
protected IWorldReader a;
|
||||
protected EntityInsentient b;
|
||||
+ public World world; // Paper
|
||||
protected final Int2ObjectMap<PathPoint> c = new Int2ObjectOpenHashMap();
|
||||
protected int d;
|
||||
protected int e;
|
||||
@@ -0,0 +0,0 @@ public abstract class PathfinderAbstract {
|
||||
|
||||
public void a(IWorldReader iworldreader, EntityInsentient entityinsentient) {
|
||||
this.a = iworldreader;
|
||||
+ if (iworldreader instanceof World) world = (World) iworldreader; // Paper
|
||||
this.b = entityinsentient;
|
||||
this.c.clear();
|
||||
this.d = MathHelper.d(entityinsentient.getWidth() + 1.0F);
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
index d97166f8f..51991b8c8 100644
|
||||
index d97166f8f0..0cea9db8f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
@@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
|
@ -90,7 +61,7 @@ index d97166f8f..51991b8c8 100644
|
|||
|
||||
if (pathtype == PathType.OPEN && j >= 1) {
|
||||
- Block block = iblockaccess.getType(new BlockPosition(i, j - 1, k)).getBlock();
|
||||
+ Block block = world.getBlockIfLoaded(new BlockPosition(i, j - 1, k)); // Paper
|
||||
+ Block block = iblockaccess.getBlockIfLoaded(new BlockPosition(i, j - 1, k)); // Paper
|
||||
+ if (block == null) return PathType.BLOCKED; // Paper
|
||||
PathType pathtype1 = this.b(iblockaccess, i, j - 1, k);
|
||||
|
||||
|
@ -100,7 +71,7 @@ index d97166f8f..51991b8c8 100644
|
|||
for (int i1 = -1; i1 <= 1; ++i1) {
|
||||
if (l != 0 || i1 != 0) {
|
||||
- Block block = iblockaccess.getType(blockposition_pooledblockposition.d(l + i, j, i1 + k)).getBlock();
|
||||
+ Block block = world.getBlockIfLoaded(blockposition_pooledblockposition.d(l + i, j, i1 + k)); // Paper
|
||||
+ Block block = iblockaccess.getBlockIfLoaded(blockposition_pooledblockposition.d(l + i, j, i1 + k)); // Paper
|
||||
|
||||
- if (block == Blocks.CACTUS) {
|
||||
+ if (block == null) pathtype = PathType.BLOCKED; // Paper
|
||||
|
@ -113,7 +84,7 @@ index d97166f8f..51991b8c8 100644
|
|||
protected PathType b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
- IBlockData iblockdata = iblockaccess.getType(blockposition);
|
||||
+ IBlockData iblockdata = world.getTypeIfLoaded(blockposition); // Paper
|
||||
+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
|
||||
+ if (iblockdata == null) return PathType.BLOCKED; // Paper
|
||||
Block block = iblockdata.getBlock();
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
|
|
@ -7,7 +7,7 @@ Should only happen for blocks on the edge that uses neighbors light level
|
|||
(certain blocks). In that case, there will be 3-4 other neighbors to get a light level from.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index c31585f92f..801923c758 100644
|
||||
index 7f0a338d64..8ad4fbff21 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -81,7 +81,7 @@ index ef882b897f..385b3ac0ce 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 836b012474..c70c84c2a4 100644
|
||||
index 1ba855786c..1bbac46f6a 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 801923c758..d13cf1014d 100644
|
||||
index 8ad4fbff21..b5e8de64ce 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 8ac081bef..f9413dd68 100644
|
||||
index 6b2769343a..3e5c76d320 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -18,7 +18,7 @@ index 6aa0ca3959..ed9b5c63f0 100644
|
|||
private final MinecraftServer d;
|
||||
private final java.nio.file.Path e;
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index c04d73e738..e4f2aeed29 100644
|
||||
index d4789478b6..3110b510b0 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -23,7 +23,7 @@ index ce190d88d6..352a39dcb3 100644
|
|||
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
|
||||
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index fc455e1f04..836b012474 100644
|
||||
index 2cb3e36965..1ba855786c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
|
|
@ -19,6 +19,29 @@ index 2f2b103641..b1900ba364 100644
|
|||
void c(AttributeModifier attributemodifier);
|
||||
|
||||
void b(UUID uuid);
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockAccessAir.java b/src/main/java/net/minecraft/server/BlockAccessAir.java
|
||||
index e8ab5d3221..d7a68a1ef7 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockAccessAir.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockAccessAir.java
|
||||
@@ -0,0 +0,0 @@ public enum BlockAccessAir implements IBlockAccess {
|
||||
return null;
|
||||
}
|
||||
|
||||
+ // Paper start - If loaded util
|
||||
+ @Override
|
||||
+ public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
+ return this.getFluid(blockposition);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
|
||||
+ return this.getType(blockposition);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
return Blocks.AIR.getBlockData();
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockDataAbstract.java b/src/main/java/net/minecraft/server/BlockDataAbstract.java
|
||||
index b370316574..841c7d1904 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockDataAbstract.java
|
||||
|
@ -69,7 +92,7 @@ index dd47e9cbe4..c927d524a8 100644
|
|||
return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index ca73bfbd83..26414a07a2 100644
|
||||
index ca73bfbd83..2cbae8230f 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
|
||||
|
@ -81,6 +104,25 @@ index ca73bfbd83..26414a07a2 100644
|
|||
private final ChunkSection[] sections;
|
||||
private final BiomeBase[] d;
|
||||
private final Map<BlockPosition, NBTTagCompound> e;
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - If loaded util
|
||||
+ @Override
|
||||
+ public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
+ return this.getFluid(blockposition);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
|
||||
+ return this.getType(blockposition);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public Fluid getFluid(BlockPosition blockposition) {
|
||||
return this.a(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
return this.a(blockposition, Chunk.EnumTileEntityState.CHECK);
|
||||
}
|
||||
|
@ -89,6 +131,41 @@ index ca73bfbd83..26414a07a2 100644
|
|||
@Nullable
|
||||
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java
|
||||
index 2c9bf7d00f..ccbc1dde09 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkCache.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkCache implements IWorldReader {
|
||||
return this.e.getLightLevel(blockposition, i);
|
||||
}
|
||||
|
||||
+ // Paper start - if loaded util
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public IChunkAccess getChunkIfLoadedImmediately(int x, int z) {
|
||||
+ IChunkAccess chunk = this.getChunkAt(x, z, ChunkStatus.FULL, false);
|
||||
+ if (chunk instanceof ChunkEmpty) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ return chunk;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
+ IChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
+ return chunk == null ? null : chunk.getFluid(blockposition);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
|
||||
+ IChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
+ return chunk == null ? null : chunk.getType(blockposition);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) {
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
|
||||
index 857b2f8868..bbf136614c 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
|
||||
|
@ -267,6 +344,47 @@ index 4510018d6f..c0d5112444 100644
|
|||
public void a(R r0) {
|
||||
this.d.add(r0);
|
||||
LockSupport.unpark(this.getThread());
|
||||
diff --git a/src/main/java/net/minecraft/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java
|
||||
index 6e365f402c..577b227758 100644
|
||||
--- a/src/main/java/net/minecraft/server/IBlockAccess.java
|
||||
+++ b/src/main/java/net/minecraft/server/IBlockAccess.java
|
||||
@@ -0,0 +0,0 @@ public interface IBlockAccess {
|
||||
@Nullable
|
||||
TileEntity getTileEntity(BlockPosition blockposition);
|
||||
|
||||
+ IBlockData getTypeIfLoaded(BlockPosition blockposition); // Paper - if loaded util
|
||||
IBlockData getType(BlockPosition blockposition);
|
||||
|
||||
+ Fluid getFluidIfLoaded(BlockPosition blockposition); // Paper - if loaded util
|
||||
Fluid getFluid(BlockPosition blockposition);
|
||||
|
||||
+ // Paper start - if loaded util
|
||||
+ default Material getMaterialIfLoaded(BlockPosition blockposition) {
|
||||
+ IBlockData type = this.getTypeIfLoaded(blockposition);
|
||||
+ return type == null ? null : type.getMaterial();
|
||||
+ }
|
||||
+
|
||||
+ default Block getBlockIfLoaded(BlockPosition blockposition) {
|
||||
+ IBlockData type = this.getTypeIfLoaded(blockposition);
|
||||
+ return type == null ? null : type.getBlock();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
default int h(BlockPosition blockposition) {
|
||||
return this.getType(blockposition).h();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java
|
||||
index 9a98fb4af5..17dac8dfa4 100644
|
||||
--- a/src/main/java/net/minecraft/server/IWorldReader.java
|
||||
+++ b/src/main/java/net/minecraft/server/IWorldReader.java
|
||||
@@ -0,0 +0,0 @@ public interface IWorldReader extends IIBlockAccess {
|
||||
|
||||
int getLightLevel(BlockPosition blockposition, int i);
|
||||
|
||||
+ @Nullable IChunkAccess getChunkIfLoadedImmediately(int x, int z); // Paper - ifLoaded api (we need this since current impl blocks if the chunk is loading)
|
||||
@Nullable
|
||||
IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
index e975265a28..aa6a58dd88 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
||||
|
@ -805,6 +923,60 @@ index b3824898da..bf4172be52 100644
|
|||
public static ItemStack a(ItemStack itemstack, PotionRegistry potionregistry) {
|
||||
MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java
|
||||
index 6296611f19..807bd68485 100644
|
||||
--- a/src/main/java/net/minecraft/server/ProtoChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/ProtoChunk.java
|
||||
@@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess {
|
||||
|
||||
}
|
||||
|
||||
+ // Paper start - If loaded util
|
||||
+ @Override
|
||||
+ public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
+ return this.getFluid(blockposition);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
|
||||
+ return this.getType(blockposition);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
int i = blockposition.getY();
|
||||
diff --git a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
|
||||
index 33db1403fe..aff3591ec8 100644
|
||||
--- a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
|
||||
+++ b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java
|
||||
@@ -0,0 +0,0 @@ public class RegionLimitedWorldAccess implements GeneratorAccess {
|
||||
return i >= ichunkaccess.getPos().x && i <= ichunkaccess1.getPos().x && j >= ichunkaccess.getPos().z && j <= ichunkaccess1.getPos().z;
|
||||
}
|
||||
|
||||
+ // Paper start - if loaded util
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public IChunkAccess getChunkIfLoadedImmediately(int x, int z) {
|
||||
+ return this.getChunkAt(x, z, ChunkStatus.FULL, false);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
|
||||
+ IChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
+ return chunk == null ? null : chunk.getType(blockposition);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
+ IChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
+ return chunk == null ? null : chunk.getFluid(blockposition);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
return this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4).getType(blockposition);
|
||||
diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java
|
||||
index 4efcb8b595..60948afa4e 100644
|
||||
--- a/src/main/java/net/minecraft/server/RegistryBlockID.java
|
||||
|
@ -831,9 +1003,54 @@ index b3799ab564..5fae5a1233 100644
|
|||
|
||||
public static long getTimeMillis() {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 923d8e28e7..404d3d8c82 100644
|
||||
index 923d8e28e7..541fc0cf94 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
return (Chunk) this.getChunkAt(i, j, ChunkStatus.FULL);
|
||||
}
|
||||
|
||||
+ // Paper start - if loaded
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public IChunkAccess getChunkIfLoadedImmediately(int x, int z) {
|
||||
+ if (!((ChunkProviderServer)this.chunkProvider).isLoaded(x, z)) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ return this.chunkProvider.getChunkAt(x, z, ChunkStatus.FULL, true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
|
||||
+ // CraftBukkit start - tree generation
|
||||
+ if (captureTreeGeneration) {
|
||||
+ for (CraftBlockState previous : capturedBlockStates) {
|
||||
+ if (previous.getX() == blockposition.getX() && previous.getY() == blockposition.getY() && previous.getZ() == blockposition.getZ()) {
|
||||
+ return previous.getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ if (!isValidLocation(blockposition)) {
|
||||
+ return Blocks.AIR.getBlockData();
|
||||
+ }
|
||||
+ IChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
+
|
||||
+ return chunk == null ? null : chunk.getType(blockposition);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
+ IChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
+
|
||||
+ return chunk == null ? null : chunk.getFluid(blockposition);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) {
|
||||
IChunkAccess ichunkaccess = this.chunkProvider.getChunkAt(i, j, chunkstatus, flag);
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
||||
public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
|
@ -858,4 +1075,31 @@ index 42f7bb0f7d..5d71addb0c 100644
|
|||
|
||||
/**
|
||||
* Mirror
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
index 755f7f2649..cd910f3dcb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
@@ -0,0 +0,0 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
public boolean b(BlockPosition blockposition, boolean flag) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
+
|
||||
+ // Paper start - if loaded util
|
||||
+ @javax.annotation.Nullable
|
||||
+ @Override
|
||||
+ public IChunkAccess getChunkIfLoadedImmediately(int x, int z) {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 1964dd5faa..5a49b015c2 100644
|
||||
index 7bd5a0a8cd..f2ca391bfe 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
|
|
@ -123,7 +123,7 @@ index 0000000000..f68a07cb96
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index 6cc1423837..1bf7ead714 100644
|
||||
index a473c03b9d..856ff22b04 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
|
|||
Saves on some object allocation and processing when no plugin listens to this
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPlant.java b/src/main/java/net/minecraft/server/BlockPlant.java
|
||||
index 9bf42bb5e..0526af776 100644
|
||||
index 9bf42bb5ef..0526af776d 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPlant.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPlant.java
|
||||
@@ -0,0 +0,0 @@ public class BlockPlant extends Block {
|
||||
|
@ -19,7 +19,7 @@ index 9bf42bb5e..0526af776 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockTallPlant.java b/src/main/java/net/minecraft/server/BlockTallPlant.java
|
||||
index 469a3be05..f2c429f22 100644
|
||||
index 469a3be057..f2c429f22e 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockTallPlant.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockTallPlant.java
|
||||
@@ -0,0 +0,0 @@ public class BlockTallPlant extends BlockPlant {
|
||||
|
@ -32,7 +32,7 @@ index 469a3be05..f2c429f22 100644
|
|||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 31c9917f9..85b40ab7e 100644
|
||||
index 454e28fc47..40b9bff98f 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
@ -44,7 +44,7 @@ index 31c9917f9..85b40ab7e 100644
|
|||
if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit
|
||||
this.methodProfiler.a(() -> {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index aef9e2e75..668b64f42 100644
|
||||
index 6e655d292a..7f0a338d64 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
@ -66,7 +66,7 @@ index aef9e2e75..668b64f42 100644
|
|||
this.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 727faa35d..7c3d2d5de 100644
|
||||
index 727faa35db..7c3d2d5def 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
|
|
@ -10,7 +10,7 @@ Optimize to check if the captured list even has values in it, and also to
|
|||
just do a get call since the value can never be null.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 774bb4d0d7..ad58d4fd63 100644
|
||||
index 4280fdf807..6a36c4467f 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -52,7 +52,7 @@ index c927d524a8..64700b97c0 100644
|
|||
public MutableBlockPosition() {
|
||||
this(0, 0, 0);
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 4248a50142..82361fff08 100644
|
||||
index d246970d3e..c211f8a43f 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -98,7 +98,7 @@ index 30701fd7f3..43f75fc837 100644
|
|||
public ChunkSection(int i) {
|
||||
this(i, (short) 0, (short) 0, (short) 0);
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index d4be7e884d..aef9e2e753 100644
|
||||
index e43b1d27c3..6e655d292a 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -1124,7 +1124,7 @@ index da903f74b6..aa35e0d061 100644
|
|||
c(iblockdata, world, blockposition);
|
||||
world.a(blockposition, false);
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 70e5552cd9..d20077892b 100644
|
||||
index 163d7f37c9..3425f034c8 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -21,7 +21,7 @@ index 83e54cb904..f06bb3ae19 100644
|
|||
private void maxEntityCollision() {
|
||||
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index db0c520394..8bb2e1bf0f 100644
|
||||
index f93e3faae2..1f2e2cd873 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -19,7 +19,7 @@ index 92ab55182f..eed454bf40 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 2218552ba1..1964dd5faa 100644
|
||||
index 2da7c4531f..7bd5a0a8cd 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
|
|
@ -73,25 +73,4 @@ index b286934aa8..c7e25e2be8 100644
|
|||
+ return fluid != null && fluid.a(TagsFluid.WATER); // Paper
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 8bb2e1bf0f..5220ea0994 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
return chunk.getType(blockposition);
|
||||
}
|
||||
}
|
||||
+ // Paper start
|
||||
+ public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
+ if (blockposition.isInvalidYLocation()) { // Paper
|
||||
+ return getFluid(blockposition);
|
||||
+ } else {
|
||||
+ Chunk chunk = this.getChunkIfLoaded(blockposition);
|
||||
+ return chunk != null ? chunk.getFluid(blockposition) : null;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public Fluid getFluid(BlockPosition blockposition) {
|
||||
--
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Prevent Pathfinding out of World Border
|
|||
This prevents Entities from trying to run outside of the World Border
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index 4a91e0d8c..6cc142383 100644
|
||||
index ed69eaa176..a473c03b9d 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
|
|
|
@ -7,7 +7,7 @@ ray tracing into an unloaded chunk should be treated as a miss
|
|||
this saves a ton of lag for when AI tries to raytrace near unloaded chunks.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java
|
||||
index 6e365f402c..b1423a3c8d 100644
|
||||
index 577b227758..c5586e44d4 100644
|
||||
--- a/src/main/java/net/minecraft/server/IBlockAccess.java
|
||||
+++ b/src/main/java/net/minecraft/server/IBlockAccess.java
|
||||
@@ -0,0 +0,0 @@ public interface IBlockAccess {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Prevent tile entity and entity crashes
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
index 095ef9ba5..b99bcbf8a 100644
|
||||
index 095ef9ba51..b99bcbf8a4 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
||||
|
@ -23,7 +23,7 @@ index 095ef9ba5..b99bcbf8a 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index f9f14cc1f..cfbe3d592 100644
|
||||
index d659b7613f..4369574891 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Remove invalid mob spawner tile entities
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 0d1cafe3d8..ad2c49df52 100644
|
||||
index 4ec0c22233..318035a48e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Remove unused World Tile Entity List
|
|||
Massive hit to performance and it is completely unnecessary.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index be18e029d..02ef71bb4 100644
|
||||
index b5e8de64ce..aaf22401b0 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 05942fb7e..b97e34163 100644
|
||||
index 05942fb7ed..b97e341635 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
@ -72,7 +72,7 @@ index 05942fb7e..b97e34163 100644
|
|||
entity.extinguish();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 3fa218a32..37884a606 100644
|
||||
index 3e5c76d320..80e4b1184b 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Store counts for each Entity/Block Entity Type
|
|||
Opens door for future patches to optimize performance
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index ce40882b17..7bcbe601bc 100644
|
||||
index 4d1326efb4..787490faac 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
|
|
@ -8,7 +8,7 @@ This enables us a fast reference to the entities current chunk instead
|
|||
of having to look it up by hashmap lookups.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 26414a07a2..ce40882b17 100644
|
||||
index 2cbae8230f..4d1326efb4 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
|
|
@ -322,7 +322,7 @@ index afa9f0c1e6..85a5776b04 100644
|
|||
private final float frictionFactor;
|
||||
protected final BlockStateList<Block, IBlockData> blockStateList;
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 7bcbe601bc..0d1cafe3d8 100644
|
||||
index 787490faac..4ec0c22233 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -973,7 +973,7 @@ index 7546f6690b..095ef9ba51 100644
|
|||
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
|
||||
public final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 404d3d8c82..93fa091216 100644
|
||||
index 541fc0cf94..ecf334e535 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Vanished players don't have rights
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 54d025bf7..e3b1ebe62 100644
|
||||
index 54d025bf7d..e3b1ebe629 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -18,7 +18,7 @@ index 54d025bf7..e3b1ebe62 100644
|
|||
protected int j;
|
||||
private Entity vehicle;
|
||||
diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java
|
||||
index ee22bb038..e5a013ffd 100644
|
||||
index ee22bb0387..e5a013ffd2 100644
|
||||
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
|
||||
+++ b/src/main/java/net/minecraft/server/IEntityAccess.java
|
||||
@@ -0,0 +0,0 @@ public interface IEntityAccess {
|
||||
|
@ -41,7 +41,7 @@ index ee22bb038..e5a013ffd 100644
|
|||
return VoxelShapes.c(voxelshape, VoxelShapes.a(entity1.getBoundingBox()), OperatorBoolean.AND);
|
||||
});
|
||||
diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java
|
||||
index 452b2b2d2..7019d4ae9 100644
|
||||
index 17dac8dfa4..5b422eaa2d 100644
|
||||
--- a/src/main/java/net/minecraft/server/IWorldReader.java
|
||||
+++ b/src/main/java/net/minecraft/server/IWorldReader.java
|
||||
@@ -0,0 +0,0 @@ public interface IWorldReader extends IIBlockAccess {
|
||||
|
@ -58,7 +58,7 @@ index 452b2b2d2..7019d4ae9 100644
|
|||
|
||||
return voxelshape.isEmpty() || this.a((Entity) null, voxelshape.a((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()));
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
|
||||
index 59b1e6ce2..b90cc6652 100644
|
||||
index 59b1e6ce2e..b90cc6652b 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
|
||||
@@ -0,0 +0,0 @@ public class ItemBlock extends Item {
|
||||
|
@ -72,7 +72,7 @@ index 59b1e6ce2..b90cc6652 100644
|
|||
|
||||
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index dc83a90a4..063ad48ce 100644
|
||||
index dc83a90a4d..063ad48ce7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
|
|
|
@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping
|
|||
information on restoration when the event is cancelled.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 37884a606..e3de63489 100644
|
||||
index 80e4b1184b..eed3fa615f 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
|
|
|
@ -95,6 +95,7 @@ done
|
|||
# import FileName
|
||||
|
||||
|
||||
|
||||
########################################################
|
||||
########################################################
|
||||
########################################################
|
||||
|
|
Loading…
Reference in a new issue