2019-01-17 02:02:56 +00:00
|
|
|
From 5a71847deef02674f0c90f28e19de4bbe3d1be27 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-01-17 02:02:56 +00:00
|
|
|
index 28edf37d0d..bbffeae3d0 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-01-08 16:57:27 +00:00
|
|
|
@@ -185,7 +185,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
|
|
|
|
|
2018-12-08 10:09:55 +00:00
|
|
|
if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.c())) {
|
2018-09-11 03:38:16 +00:00
|
|
|
// CraftBukkit start
|
2019-01-08 16:57:27 +00:00
|
|
|
@@ -212,7 +213,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
|
|
|
|
Fluid fluid = iblockdata1.s();
|
|
|
|
|
|
|
|
if (fluid.c().a((FluidType) this) && this.a(enumdirection, (IBlockAccess) iworldreader, blockposition, iblockdata, blockposition1, iblockdata1)) {
|
2019-01-08 16:57:27 +00:00
|
|
|
@@ -329,11 +331,20 @@ 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-01-01 03:15:55 +00:00
|
|
|
+
|
2018-09-11 03:38:16 +00:00
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.s());
|
|
|
|
+ short2objectmap.put(short0, pair);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2019-01-01 03:15:55 +00:00
|
|
|
|
|
|
|
- return Pair.of(iblockdata1, iblockdata1.s());
|
|
|
|
- });
|
2018-09-11 03:38:16 +00:00
|
|
|
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
|
|
|
|
Fluid fluid = (Fluid) pair.getSecond();
|
2019-01-01 03:15:55 +00:00
|
|
|
|
2019-01-08 16:57:27 +00:00
|
|
|
@@ -405,11 +416,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-01-01 03:15:55 +00:00
|
|
|
- return Pair.of(iblockdata1, iblockdata1.s());
|
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;
|
|
|
|
+
|
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.s());
|
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-01-01 03:15:55 +00:00
|
|
|
2.20.1
|
2018-09-11 03:38:16 +00:00
|
|
|
|