2019-05-30 23:22:34 +00:00
|
|
|
From 302dc659498a5c22ff5ec29c4d7fc463bca2ea0d Mon Sep 17 00:00:00 2001
|
2018-09-11 03:38:16 +00: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-05-27 09:13:41 +00:00
|
|
|
index c76fa0b4b..5f1514360 100644
|
2018-09-11 03:38:16 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
2019-05-05 08:33:44 +00:00
|
|
|
@@ -178,7 +178,8 @@ public abstract class FluidTypeFlowing extends FluidType {
|
2018-09-11 03:38:16 +00: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 08:33:44 +00:00
|
|
|
if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.getType())) {
|
2018-09-11 03:38:16 +00:00
|
|
|
// CraftBukkit start
|
2019-05-05 08:33:44 +00:00
|
|
|
@@ -205,7 +206,8 @@ public abstract class FluidTypeFlowing extends FluidType {
|
2018-09-11 03:38:16 +00: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 08:33:44 +00:00
|
|
|
Fluid fluid = iblockdata1.p();
|
2018-09-11 03:38:16 +00:00
|
|
|
|
2019-05-05 08:33:44 +00: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 03:15:55 +00:00
|
|
|
if (enumdirection1 != enumdirection) {
|
2018-09-11 03:38:16 +00:00
|
|
|
BlockPosition blockposition2 = blockposition.shift(enumdirection1);
|
|
|
|
short short0 = a(blockposition1, blockposition2);
|
2019-01-01 03:15:55 +00:00
|
|
|
- Pair<IBlockData, Fluid> pair = (Pair) short2objectmap.computeIfAbsent(short0, (k) -> {
|
|
|
|
- IBlockData iblockdata1 = iworldreader.getType(blockposition2);
|
2018-09-11 03:38:16 +00: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 08:33:44 +00:00
|
|
|
|
|
|
|
- return Pair.of(iblockdata1, iblockdata1.p());
|
|
|
|
- });
|
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.p());
|
2018-09-11 03:38:16 +00:00
|
|
|
+ short2objectmap.put(short0, pair);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
|
|
|
|
Fluid fluid = (Fluid) pair.getSecond();
|
2019-01-01 03:15:55 +00:00
|
|
|
|
2019-05-05 08:33:44 +00:00
|
|
|
@@ -398,11 +408,16 @@ public abstract class FluidTypeFlowing extends FluidType {
|
2019-01-01 03:15:55 +00:00
|
|
|
EnumDirection enumdirection = (EnumDirection) iterator.next();
|
2018-09-11 03:38:16 +00:00
|
|
|
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
|
|
|
short short0 = a(blockposition, blockposition1);
|
2019-01-01 03:15:55 +00:00
|
|
|
- Pair<IBlockData, Fluid> pair = (Pair) short2objectmap.computeIfAbsent(short0, (j) -> {
|
|
|
|
- IBlockData iblockdata1 = iworldreader.getType(blockposition1);
|
2018-09-11 03:38:16 +00:00
|
|
|
-
|
2019-05-05 08:33:44 +00:00
|
|
|
- return Pair.of(iblockdata1, iblockdata1.p());
|
2018-09-11 03:38:16 +00:00
|
|
|
- });
|
|
|
|
+ // Paper start
|
2019-01-01 03:15:55 +00:00
|
|
|
+ Pair pair = (Pair) short2objectmap.get(short0);
|
2018-09-11 03:38:16 +00:00
|
|
|
+ if (pair == null) {
|
|
|
|
+ IBlockData iblockdatax = iworldreader.getTypeIfLoaded(blockposition1);
|
|
|
|
+ if (iblockdatax == null) continue;
|
|
|
|
+
|
2019-05-05 08:33:44 +00:00
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.p());
|
2019-01-01 03:15:55 +00:00
|
|
|
+ short2objectmap.put(short0, pair);
|
2018-09-11 03:38:16 +00:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
|
|
|
|
Fluid fluid = (Fluid) pair.getSecond();
|
2019-01-01 03:15:55 +00:00
|
|
|
Fluid fluid1 = this.a(iworldreader, blockposition1, iblockdata1);
|
2018-09-11 03:38:16 +00:00
|
|
|
--
|
2019-05-05 11:32:20 +00:00
|
|
|
2.21.0
|
2018-09-11 03:38:16 +00:00
|
|
|
|