2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 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
|
2020-11-12 01:48:12 +00:00
|
|
|
index e6894d2659ad400d333c72a0b736f02ab103264c..bdc8e4e30611dbe45f7a6a92de6508de5270821d 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
|
2020-11-12 01:48:12 +00:00
|
|
|
@@ -388,4 +388,10 @@ public class PaperWorldConfig {
|
2020-06-26 12:04:38 +00:00
|
|
|
this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
|
|
|
|
log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default");
|
2018-08-26 02:57:30 +00:00
|
|
|
}
|
2019-12-12 00:03:31 +00:00
|
|
|
+
|
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);
|
|
|
|
+ }
|
2019-12-12 00:03:31 +00:00
|
|
|
}
|
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
|
2020-08-25 02:22:08 +00:00
|
|
|
index 4c076dd29cc221b43f9a53e484594dbb4dee56f5..07a9d462abad9a432dd5a153277839feeabad4bf 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
|
2020-06-25 14:09:55 +00:00
|
|
|
@@ -76,11 +76,28 @@ public class BlockFluids extends Block implements IFluidSource {
|
2019-05-05 08:33:44 +00:00
|
|
|
@Override
|
|
|
|
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
2018-08-26 02:57:30 +00:00
|
|
|
if (this.a(world, blockposition, iblockdata)) {
|
2020-06-25 14:09:55 +00:00
|
|
|
- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.b.a((IWorldReader) world));
|
2019-12-12 00:03:31 +00:00
|
|
|
+ world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), 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
|
|
|
+ }
|
2020-06-25 14:09:55 +00:00
|
|
|
+ return this.b.a(world);
|
2018-08-26 02:57:30 +00:00
|
|
|
+ }
|
2018-08-26 18:11:49 +00:00
|
|
|
+ // Paper end
|
2019-12-12 00:03:31 +00:00
|
|
|
+
|
2018-08-26 02:57:30 +00:00
|
|
|
+
|
2019-05-05 08:33:44 +00:00
|
|
|
@Override
|
2018-08-26 02:57:30 +00:00
|
|
|
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
2019-12-12 00:03:31 +00:00
|
|
|
if (iblockdata.getFluid().isSource() || iblockdata1.getFluid().isSource()) {
|
2020-06-25 14:09:55 +00:00
|
|
|
@@ -93,7 +110,7 @@ public class BlockFluids extends Block implements IFluidSource {
|
2019-05-05 08:33:44 +00:00
|
|
|
@Override
|
|
|
|
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
2018-08-26 02:57:30 +00:00
|
|
|
if (this.a(world, blockposition, iblockdata)) {
|
2020-06-25 14:09:55 +00:00
|
|
|
- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.b.a((IWorldReader) world));
|
2019-12-12 00:03:31 +00:00
|
|
|
+ world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.getFlowSpeed(world, blockposition)); // Paper
|
2018-08-26 02:57:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|