2019-04-22 21:36:14 +00:00
|
|
|
From 4fef830e9621867bc3af8bac7fa822e12adfed59 Mon Sep 17 00:00:00 2001
|
2018-08-26 02:57:30 +00:00
|
|
|
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
|
2019-04-22 21:36:14 +00:00
|
|
|
index 8f49262226..869bf8a9f9 100644
|
2018-08-26 02:57:30 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-04-05 05:27:37 +00:00
|
|
|
@@ -481,6 +481,12 @@ public class PaperWorldConfig {
|
2018-08-26 02:57:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public int waterOverLavaFlowSpeed;
|
|
|
|
+ private void waterOverLavaFlowSpeed() {
|
|
|
|
+ waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5);
|
|
|
|
+ log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
public enum DuplicateUUIDMode {
|
2018-10-07 18:58:53 +00:00
|
|
|
SAFE_REGEN, DELETE, NOTHING, WARN
|
2018-08-26 02:57:30 +00:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java
|
2019-04-22 21:36:14 +00:00
|
|
|
index e672385829..b53a88c33f 100644
|
2018-08-26 02:57:30 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockFluids.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockFluids.java
|
2019-01-01 03:15:55 +00:00
|
|
|
@@ -77,11 +77,27 @@ public class BlockFluids extends Block implements IFluidSource {
|
2018-08-26 02:57:30 +00:00
|
|
|
|
|
|
|
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1) {
|
|
|
|
if (this.a(world, blockposition, iblockdata)) {
|
2018-12-17 05:18:06 +00:00
|
|
|
- world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.a((IWorldReader) world));
|
|
|
|
+ world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.getFlowSpeed(world, blockposition)); // Paper
|
2018-08-26 02:57:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-08-26 18:11:49 +00:00
|
|
|
+ // Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava
|
2018-08-26 02:57:30 +00:00
|
|
|
+ public int getFlowSpeed(World world, BlockPosition blockposition) {
|
2018-08-26 18:11:49 +00:00
|
|
|
+ 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;
|
|
|
|
+ }
|
2018-08-26 02:57:30 +00:00
|
|
|
+ }
|
|
|
|
+ return this.a(world);
|
|
|
|
+ }
|
2018-08-26 18:11:49 +00:00
|
|
|
+ // Paper end
|
2018-08-26 02:57:30 +00:00
|
|
|
+
|
|
|
|
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
|
|
|
if (iblockdata.s().d() || iblockdata1.s().d()) {
|
2018-12-17 05:18:06 +00:00
|
|
|
generatoraccess.getFluidTickList().a(blockposition, iblockdata.s().c(), this.a((IWorldReader) generatoraccess));
|
2019-01-01 03:15:55 +00:00
|
|
|
@@ -92,7 +108,7 @@ public class BlockFluids extends Block implements IFluidSource {
|
2018-08-26 02:57:30 +00:00
|
|
|
|
|
|
|
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1) {
|
|
|
|
if (this.a(world, blockposition, iblockdata)) {
|
2018-12-17 05:18:06 +00:00
|
|
|
- world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.a((IWorldReader) world));
|
|
|
|
+ world.getFluidTickList().a(blockposition, iblockdata.s().c(), this.getFlowSpeed(world, blockposition)); // Paper
|
2018-08-26 02:57:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
--
|
2019-03-20 01:46:00 +00:00
|
|
|
2.21.0
|
2018-08-26 02:57:30 +00:00
|
|
|
|