2018-09-11 05:38:16 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Mon, 10 Sep 2018 23:36:16 -0400
|
|
|
|
Subject: [PATCH] Prevent chunk loading from Fluid Flowing
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java b/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java
|
2018-09-11 05:38:16 +02:00
|
|
|
@@ -0,0 +0,0 @@ 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
|
|
|
|
|
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
|
|
|
|
@@ -0,0 +0,0 @@ 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
|
2019-12-12 17:20:43 +01:00
|
|
|
Fluid fluid = iblockdata1.getFluid();
|
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)) {
|
2018-09-11 05:38:16 +02:00
|
|
|
@@ -0,0 +0,0 @@ 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
|
|
|
|
2019-12-12 17:20:43 +01:00
|
|
|
- return Pair.of(iblockdata1, iblockdata1.getFluid());
|
2019-05-05 10:33:44 +02:00
|
|
|
- });
|
2019-12-12 17:20:43 +01:00
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.getFluid());
|
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
|
|
|
|
2018-09-11 05:38:16 +02:00
|
|
|
@@ -0,0 +0,0 @@ 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-12-12 17:20:43 +01:00
|
|
|
- return Pair.of(iblockdata1, iblockdata1.getFluid());
|
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-12-12 17:20:43 +01:00
|
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.getFluid());
|
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);
|