2019-07-20 06:01:24 +02:00
|
|
|
From 9a0285ff8bc70129a1256d0813806e88022e95da 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
|
2019-07-20 06:01:24 +02:00
|
|
|
index 3e9433e283..4660b95389 100644
|
2018-09-11 05:38:16 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
2019-05-05 10:33:44 +02:00
|
|
|
@@ -178,7 +178,8 @@ public abstract class FluidTypeFlowing extends FluidType {
|
2018-09-11 05:38:16 +02:00
|
|
|
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
|
|
|
|
|
2019-05-05 10:33:44 +02:00
|
|
|
if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.getType())) {
|
2018-09-11 05:38:16 +02:00
|
|
|
// CraftBukkit start
|
2019-05-05 10:33:44 +02:00
|
|
|
@@ -205,7 +206,8 @@ public abstract class FluidTypeFlowing extends FluidType {
|
2018-09-11 05:38:16 +02:00
|
|
|
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
|
2019-05-05 10:33:44 +02:00
|
|
|
Fluid fluid = iblockdata1.p();
|
2018-09-11 05:38:16 +02:00
|
|
|
|
2019-05-05 10:33:44 +02:00
|
|
|
if (fluid.getType().a((FluidType) this) && this.a(enumdirection, (IBlockAccess) iworldreader, blockposition, iblockdata, blockposition1, iblockdata1)) {
|
|
|
|
@@ -322,11 +324,19 @@ public abstract class FluidTypeFlowing extends FluidType {
|
2019-01-01 04:15:55 +01:00
|
|
|
if (enumdirection1 != enumdirection) {
|
2018-09-11 05:38:16 +02:00
|
|
|
BlockPosition blockposition2 = blockposition.shift(enumdirection1);
|
|
|
|
short short0 = a(blockposition1, blockposition2);
|
2019-01-01 04:15:55 +01:00
|
|
|
- Pair<IBlockData, Fluid> pair = (Pair) short2objectmap.computeIfAbsent(short0, (k) -> {
|
|
|
|
- IBlockData iblockdata1 = iworldreader.getType(blockposition2);
|
2018-09-11 05:38:16 +02:00
|
|
|
+ // Paper start - avoid loading chunks
|
|
|
|
+ Pair<IBlockData, Fluid> pair = short2objectmap.get(short0);
|
|
|
|
+ if (pair == null) {
|
|
|
|
+ IBlockData iblockdatax = iworldreader.getTypeIfLoaded(blockposition2);
|
|
|
|
+ if (iblockdatax == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
2019-05-05 10:33:44 +02:00
|
|
|
|
|
|
|
- return Pair.of(iblockdata1, iblockdata1.p());
|
|
|
|
- });
|
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.p());
|
2018-09-11 05:38:16 +02:00
|
|
|
+ short2objectmap.put(short0, pair);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
|
|
|
|
Fluid fluid = (Fluid) pair.getSecond();
|
2019-01-01 04:15:55 +01:00
|
|
|
|
2019-05-05 10:33:44 +02:00
|
|
|
@@ -398,11 +408,16 @@ public abstract class FluidTypeFlowing extends FluidType {
|
2019-01-01 04:15:55 +01:00
|
|
|
EnumDirection enumdirection = (EnumDirection) iterator.next();
|
2018-09-11 05:38:16 +02:00
|
|
|
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
|
|
|
short short0 = a(blockposition, blockposition1);
|
2019-01-01 04:15:55 +01:00
|
|
|
- Pair<IBlockData, Fluid> pair = (Pair) short2objectmap.computeIfAbsent(short0, (j) -> {
|
|
|
|
- IBlockData iblockdata1 = iworldreader.getType(blockposition1);
|
2018-09-11 05:38:16 +02:00
|
|
|
-
|
2019-05-05 10:33:44 +02:00
|
|
|
- return Pair.of(iblockdata1, iblockdata1.p());
|
2018-09-11 05:38:16 +02:00
|
|
|
- });
|
|
|
|
+ // Paper start
|
2019-01-01 04:15:55 +01:00
|
|
|
+ Pair pair = (Pair) short2objectmap.get(short0);
|
2018-09-11 05:38:16 +02:00
|
|
|
+ if (pair == null) {
|
|
|
|
+ IBlockData iblockdatax = iworldreader.getTypeIfLoaded(blockposition1);
|
|
|
|
+ if (iblockdatax == null) continue;
|
|
|
|
+
|
2019-05-05 10:33:44 +02:00
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.p());
|
2019-01-01 04:15:55 +01:00
|
|
|
+ short2objectmap.put(short0, pair);
|
2018-09-11 05:38:16 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
|
|
|
|
Fluid fluid = (Fluid) pair.getSecond();
|
2019-01-01 04:15:55 +01:00
|
|
|
Fluid fluid1 = this.a(iworldreader, blockposition1, iblockdata1);
|
2018-09-11 05:38:16 +02:00
|
|
|
--
|
2019-06-25 21:18:50 +02:00
|
|
|
2.22.0
|
2018-09-11 05:38:16 +02:00
|
|
|
|