2018-10-05 05:18:46 +02:00
|
|
|
From a99f18b8f595114614470c2a507b27498d468194 Mon Sep 17 00:00:00 2001
|
2018-09-11 05:38:16 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Mon, 10 Sep 2018 23:36:16 -0400
|
|
|
|
Subject: [PATCH] Prevent chunk loading from Fluid Flowing
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/FluidTypeFlowing.java b/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
|
|
|
index 90ba7a346f..7f16dec688 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
|
|
|
@@ -186,7 +186,8 @@ public abstract class FluidTypeFlowing extends FluidType {
|
|
|
|
EnumDirection enumdirection = (EnumDirection) entry.getKey();
|
|
|
|
Fluid fluid1 = (Fluid) entry.getValue();
|
|
|
|
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
|
|
|
- IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
|
|
|
|
+ IBlockData iblockdata1 = generatoraccess.getTypeIfLoaded(blockposition1); // Paper
|
|
|
|
+ if (iblockdata1 == null) continue; // Paper
|
|
|
|
|
|
|
|
if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.b(blockposition1), fluid1.c())) {
|
|
|
|
// CraftBukkit start
|
|
|
|
@@ -213,7 +214,8 @@ public abstract class FluidTypeFlowing extends FluidType {
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
EnumDirection enumdirection = (EnumDirection) iterator.next();
|
|
|
|
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
|
|
|
- IBlockData iblockdata1 = iworldreader.getType(blockposition1);
|
|
|
|
+ IBlockData iblockdata1 = iworldreader.getTypeIfLoaded(blockposition1); // Paper
|
|
|
|
+ if (iblockdata1 == null) continue; // Paper
|
|
|
|
Fluid fluid = iblockdata1.s();
|
|
|
|
|
|
|
|
if (fluid.c().a((FluidType) this) && this.a(enumdirection, (IBlockAccess) iworldreader, blockposition, iblockdata, blockposition1, iblockdata1)) {
|
|
|
|
@@ -331,11 +333,19 @@ public abstract class FluidTypeFlowing extends FluidType {
|
|
|
|
BlockPosition blockposition2 = blockposition.shift(enumdirection1);
|
|
|
|
short short0 = a(blockposition1, blockposition2);
|
|
|
|
// CraftBukkit start - decompile errors
|
|
|
|
- Pair pair = (Pair) short2objectmap.computeIfAbsent(short0, (ix) -> {
|
|
|
|
- IBlockData iblockdatax = iworldreader.getType(blockposition2);
|
|
|
|
+ // Paper start - avoid loading chunks
|
|
|
|
+ Pair<IBlockData, Fluid> pair = short2objectmap.get(short0);
|
|
|
|
+ if (pair == null) {
|
|
|
|
+ IBlockData iblockdatax = iworldreader.getTypeIfLoaded(blockposition2);
|
|
|
|
+ if (iblockdatax == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- return Pair.of(iblockdatax, iblockdatax.s());
|
|
|
|
- });
|
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.s());
|
|
|
|
+ short2objectmap.put(short0, pair);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
// CraftBukkit end
|
|
|
|
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
|
|
|
|
Fluid fluid = (Fluid) pair.getSecond();
|
|
|
|
@@ -411,11 +421,16 @@ public abstract class FluidTypeFlowing extends FluidType {
|
|
|
|
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
|
|
|
short short0 = a(blockposition, blockposition1);
|
|
|
|
// CraftBukkit start - decompile errors
|
|
|
|
- Pair pair = (Pair) short2objectopenhashmap.computeIfAbsent(short0, (ix) -> {
|
|
|
|
- IBlockData iblockdatax = iworldreader.getType(blockposition1);
|
|
|
|
-
|
|
|
|
- return Pair.of(iblockdatax, iblockdatax.s());
|
|
|
|
- });
|
|
|
|
+ // Paper start
|
|
|
|
+ Pair pair = (Pair) short2objectopenhashmap.get(short0);
|
|
|
|
+ if (pair == null) {
|
|
|
|
+ IBlockData iblockdatax = iworldreader.getTypeIfLoaded(blockposition1);
|
|
|
|
+ if (iblockdatax == null) continue;
|
|
|
|
+
|
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.s());
|
|
|
|
+ short2objectopenhashmap.put(short0, pair);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
// CraftBukkit end
|
|
|
|
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
|
|
|
|
Fluid fluid = (Fluid) pair.getSecond();
|
|
|
|
--
|
2018-09-23 05:03:53 +02:00
|
|
|
2.19.0
|
2018-09-11 05:38:16 +02:00
|
|
|
|