2019-07-20 06:01:24 +02:00
|
|
|
From a046292b3b54be6e6a242b791fa08039e4c3f4e0 Mon Sep 17 00:00:00 2001
|
2018-08-26 04:57:30 +02: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-07-20 06:01:24 +02:00
|
|
|
index ede558d029..7e031d18e0 100644
|
2018-08-26 04:57:30 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-07-03 22:44:07 +02:00
|
|
|
@@ -396,6 +396,12 @@ public class PaperWorldConfig {
|
2018-08-26 04:57:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public int waterOverLavaFlowSpeed;
|
|
|
|
+ private void waterOverLavaFlowSpeed() {
|
|
|
|
+ waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5);
|
|
|
|
+ log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
|
|
|
|
+ }
|
|
|
|
+
|
2019-05-05 10:33:44 +02:00
|
|
|
public boolean armorStandTick = true;
|
|
|
|
private void armorStandTick() {
|
|
|
|
this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
|
2018-08-26 04:57:30 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java
|
2019-07-20 06:01:24 +02:00
|
|
|
index cccdd13988..56bf0b1d81 100644
|
2018-08-26 04:57:30 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockFluids.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockFluids.java
|
2019-05-05 10:33:44 +02:00
|
|
|
@@ -70,11 +70,27 @@ public class BlockFluids extends Block implements IFluidSource {
|
|
|
|
@Override
|
|
|
|
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
2018-08-26 04:57:30 +02:00
|
|
|
if (this.a(world, blockposition, iblockdata)) {
|
2019-05-05 10:33:44 +02:00
|
|
|
- world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.a((IWorldReader) world));
|
|
|
|
+ world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.getFlowSpeed(world, blockposition)); // Paper
|
2018-08-26 04:57:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-08-26 20:11:49 +02:00
|
|
|
+ // Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava
|
2018-08-26 04:57:30 +02:00
|
|
|
+ public int getFlowSpeed(World world, BlockPosition blockposition) {
|
2018-08-26 20:11:49 +02: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 04:57:30 +02:00
|
|
|
+ }
|
|
|
|
+ return this.a(world);
|
|
|
|
+ }
|
2018-08-26 20:11:49 +02:00
|
|
|
+ // Paper end
|
2018-08-26 04:57:30 +02:00
|
|
|
+
|
2019-05-05 10:33:44 +02:00
|
|
|
@Override
|
2018-08-26 04:57:30 +02:00
|
|
|
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
2019-05-05 10:33:44 +02:00
|
|
|
if (iblockdata.p().isSource() || iblockdata1.p().isSource()) {
|
|
|
|
@@ -87,7 +103,7 @@ public class BlockFluids extends Block implements IFluidSource {
|
|
|
|
@Override
|
|
|
|
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
2018-08-26 04:57:30 +02:00
|
|
|
if (this.a(world, blockposition, iblockdata)) {
|
2019-05-05 10:33:44 +02:00
|
|
|
- world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.a((IWorldReader) world));
|
|
|
|
+ world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.getFlowSpeed(world, blockposition)); // Paper
|
2018-08-26 04:57:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
--
|
2019-06-25 21:18:50 +02:00
|
|
|
2.22.0
|
2018-08-26 04:57:30 +02:00
|
|
|
|