70ce6ce831
This makes it easier for downstream projects (forks) to replace the version fetching system with their own. It is as simple as implementing an interface and overriding the default implementation of org.bukkit.UnsafeValues#getVersionFetcher() It also makes it easier for us to organize things like the version history feature. Lastly I have updated the paper implementation to check against the site API rather than against jenkins.
80 Zeilen
4.3 KiB
Diff
80 Zeilen
4.3 KiB
Diff
From 11644ed0883c8d95df9351037c9808358b246d17 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
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/FluidTypeFlowing.java b/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
|
index c76fa0b4b..5f1514360 100644
|
|
--- a/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
|
+++ b/src/main/java/net/minecraft/server/FluidTypeFlowing.java
|
|
@@ -178,7 +178,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.getFluid(blockposition1), fluid1.getType())) {
|
|
// CraftBukkit start
|
|
@@ -205,7 +206,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.p();
|
|
|
|
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 {
|
|
if (enumdirection1 != enumdirection) {
|
|
BlockPosition blockposition2 = blockposition.shift(enumdirection1);
|
|
short short0 = a(blockposition1, blockposition2);
|
|
- Pair<IBlockData, Fluid> pair = (Pair) short2objectmap.computeIfAbsent(short0, (k) -> {
|
|
- IBlockData iblockdata1 = 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(iblockdata1, iblockdata1.p());
|
|
- });
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.p());
|
|
+ short2objectmap.put(short0, pair);
|
|
+
|
|
+ }
|
|
+ // Paper end
|
|
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
|
|
Fluid fluid = (Fluid) pair.getSecond();
|
|
|
|
@@ -398,11 +408,16 @@ public abstract class FluidTypeFlowing extends FluidType {
|
|
EnumDirection enumdirection = (EnumDirection) iterator.next();
|
|
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
|
short short0 = a(blockposition, blockposition1);
|
|
- Pair<IBlockData, Fluid> pair = (Pair) short2objectmap.computeIfAbsent(short0, (j) -> {
|
|
- IBlockData iblockdata1 = iworldreader.getType(blockposition1);
|
|
-
|
|
- return Pair.of(iblockdata1, iblockdata1.p());
|
|
- });
|
|
+ // Paper start
|
|
+ Pair pair = (Pair) short2objectmap.get(short0);
|
|
+ if (pair == null) {
|
|
+ IBlockData iblockdatax = iworldreader.getTypeIfLoaded(blockposition1);
|
|
+ if (iblockdatax == null) continue;
|
|
+
|
|
+ pair = Pair.of(iblockdatax, iblockdatax.p());
|
|
+ short2objectmap.put(short0, pair);
|
|
+ }
|
|
+ // Paper end
|
|
IBlockData iblockdata1 = (IBlockData) pair.getFirst();
|
|
Fluid fluid = (Fluid) pair.getSecond();
|
|
Fluid fluid1 = this.a(iworldreader, blockposition1, iblockdata1);
|
|
--
|
|
2.21.0
|
|
|