2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 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/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
2024-10-23 12:32:08 +02:00
|
|
|
index ac54fd2abb3334c16cba844aee38d7a6797046f3..a2d023ff011f71f80032f02430a53d6a08a23623 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
2024-10-23 12:32:08 +02:00
|
|
|
@@ -141,11 +141,31 @@ public class LiquidBlock extends Block implements BucketPickup {
|
2021-06-11 14:02:28 +02:00
|
|
|
@Override
|
2024-04-24 04:46:06 +02:00
|
|
|
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
2021-06-11 14:02:28 +02:00
|
|
|
if (this.shouldSpreadLiquid(world, pos, state)) {
|
2021-11-23 16:50:18 +01:00
|
|
|
- world.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(world));
|
2024-01-21 17:39:05 +01:00
|
|
|
+ world.scheduleTick(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper - Configurable speed for water flowing over lava
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-01-21 17:39:05 +01:00
|
|
|
+ // Paper start - Configurable speed for water flowing over lava
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public int getFlowSpeed(Level world, BlockPos blockposition) {
|
2023-06-07 23:46:56 +02:00
|
|
|
+ if (net.minecraft.core.registries.BuiltInRegistries.FLUID.wrapAsHolder(this.fluid).is(FluidTags.WATER)) {
|
2021-06-11 14:02:28 +02:00
|
|
|
+ if (
|
2023-06-07 23:46:56 +02:00
|
|
|
+ isLava(world, blockposition.north(1)) ||
|
|
|
|
+ isLava(world, blockposition.south(1)) ||
|
|
|
|
+ isLava(world, blockposition.west(1)) ||
|
|
|
|
+ isLava(world, blockposition.east(1))
|
2021-06-11 14:02:28 +02:00
|
|
|
+ ) {
|
2022-06-09 10:51:45 +02:00
|
|
|
+ return world.paperConfig().environment.waterOverLavaFlowSpeed;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return this.fluid.getTickDelay(world);
|
|
|
|
+ }
|
2023-06-07 23:46:56 +02:00
|
|
|
+ private static boolean isLava(Level world, BlockPos blockPos) {
|
|
|
|
+ final FluidState fluidState = world.getFluidIfLoaded(blockPos);
|
|
|
|
+ return fluidState != null && fluidState.is(FluidTags.LAVA);
|
|
|
|
+ }
|
2024-01-21 17:39:05 +01:00
|
|
|
+ // Paper end - Configurable speed for water flowing over lava
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
|
|
|
@Override
|
2024-10-23 12:32:08 +02:00
|
|
|
protected BlockState updateShape(BlockState state, LevelReader world, ScheduledTickAccess tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, RandomSource random) {
|
2021-06-13 01:45:00 +02:00
|
|
|
if (state.getFluidState().isSource() || neighborState.getFluidState().isSource()) {
|
2024-10-23 12:32:08 +02:00
|
|
|
@@ -158,7 +178,7 @@ public class LiquidBlock extends Block implements BucketPickup {
|
2021-06-11 14:02:28 +02:00
|
|
|
@Override
|
2024-10-23 12:32:08 +02:00
|
|
|
protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) {
|
2021-06-11 14:02:28 +02:00
|
|
|
if (this.shouldSpreadLiquid(world, pos, state)) {
|
2021-11-23 16:50:18 +01:00
|
|
|
- world.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(world));
|
2024-01-21 17:39:05 +01:00
|
|
|
+ world.scheduleTick(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper - Configurable speed for water flowing over lava
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|