3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0338-Configurable-speed-for-water-flowing-over-lava.patch
Zach Brown 1e38743b1d
Update upstream B/CB/S
Also fixes build as a result of an upstream force push

--- work/Bukkit
Submodule work/Bukkit 217dc08d..d13fdf8c:
  > SPIGOT-4637: Add source block to BlockPhysicsEvent.

--- work/CraftBukkit
Submodule work/CraftBukkit acbba8ba..cb98c6ea:
  > Fix line endings in CraftDefaultPermissions
  > SPIGOT-4637: Add source block to BlockPhysicsEvent.

--- work/Spigot
Submodule work/Spigot 75ee78a0c...4165cd8f4 (commits not present)
  > (Manually Added) - Appears to be a result of an upstream force push
  > (Manually Added) - Changed: SPIGOT-4636: Add creative mode NBT permissions
2019-02-25 04:39:24 -05:00

69 Zeilen
3.3 KiB
Diff

From e142de31a76e71e82432fee1cf0132ef972a430d Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 8 Aug 2018 16:33:21 -0600
Subject: [PATCH] Configurable speed for water flowing over lava
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 7b1e0d6f2..e04204055 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -472,6 +472,12 @@ public class PaperWorldConfig {
}
}
+ public int waterOverLavaFlowSpeed;
+ private void waterOverLavaFlowSpeed() {
+ waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5);
+ log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
+ }
+
public enum DuplicateUUIDMode {
SAFE_REGEN, DELETE, NOTHING, WARN
}
diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java
index e67238582..b53a88c33 100644
--- a/src/main/java/net/minecraft/server/BlockFluids.java
+++ b/src/main/java/net/minecraft/server/BlockFluids.java
@@ -77,11 +77,27 @@ public class BlockFluids extends Block implements IFluidSource {
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1) {
if (this.a(world, blockposition, iblockdata)) {
- world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.a((IWorldReader) world));
+ world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.getFlowSpeed(world, blockposition)); // Paper
}
}
+ // Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava
+ public int getFlowSpeed(World world, BlockPosition blockposition) {
+ if (this.material == Material.WATER) {
+ if (
+ world.getMaterialIfLoaded(blockposition.north(1)) == Material.LAVA ||
+ world.getMaterialIfLoaded(blockposition.south(1)) == Material.LAVA ||
+ world.getMaterialIfLoaded(blockposition.west(1)) == Material.LAVA ||
+ world.getMaterialIfLoaded(blockposition.east(1)) == Material.LAVA
+ ) {
+ return world.paperConfig.waterOverLavaFlowSpeed;
+ }
+ }
+ return this.a(world);
+ }
+ // Paper end
+
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
if (iblockdata.s().d() || iblockdata1.s().d()) {
generatoraccess.getFluidTickList().a(blockposition, iblockdata.s().c(), this.a((IWorldReader) generatoraccess));
@@ -92,7 +108,7 @@ public class BlockFluids extends Block implements IFluidSource {
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1) {
if (this.a(world, blockposition, iblockdata)) {
- world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.a((IWorldReader) world));
+ world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.getFlowSpeed(world, blockposition)); // Paper
}
}
--
2.20.1