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
|
2021-01-11 01:44:06 +00:00
|
|
|
index 5ab0e7183e48134b7a0f736462516b1a8a333b04..f280dbff4a09bc611a9ca565c6d697d08801f53b 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
|
2021-01-11 01:44:06 +00:00
|
|
|
@@ -390,4 +390,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
|
|
|
}
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockFluids.java b/src/main/java/net/minecraft/world/level/block/BlockFluids.java
|
2021-03-16 15:50:45 +00:00
|
|
|
index 0654c77ab059dea2ad06cb16d07950e153d3f15d..0ed8d938b8fafdb03e01a00a201ba3f8597ac6e9 100644
|
2021-03-16 07:19:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockFluids.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockFluids.java
|
2021-03-16 15:50:45 +00:00
|
|
|
@@ -23,6 +23,7 @@ import net.minecraft.world.level.material.Fluid;
|
|
|
|
import net.minecraft.world.level.material.FluidType;
|
|
|
|
import net.minecraft.world.level.material.FluidTypeFlowing;
|
|
|
|
import net.minecraft.world.level.material.FluidTypes;
|
|
|
|
+import net.minecraft.world.level.material.Material;
|
|
|
|
import net.minecraft.world.level.pathfinder.PathMode;
|
|
|
|
import net.minecraft.world.level.storage.loot.LootTableInfo;
|
|
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
|
|
@@ -100,11 +101,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()) {
|
2021-03-16 15:50:45 +00:00
|
|
|
@@ -117,7 +135,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
|
|
|
}
|
|
|
|
|
|
|
|
}
|