2021-06-11 12:02:28 +00: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
|
2022-06-09 08:51:45 +00:00
|
|
|
index 7d180d71d5b23319b26735e0d2fe187512a14842..43e8ef1d6a65d4fd3fe53a587639ffb814368217 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
2022-06-09 08:51:45 +00:00
|
|
|
@@ -106,11 +106,27 @@ public class LiquidBlock extends Block implements BucketPickup {
|
2021-06-11 12:02:28 +00:00
|
|
|
@Override
|
|
|
|
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
|
|
|
if (this.shouldSpreadLiquid(world, pos, state)) {
|
2021-11-23 15:50:18 +00:00
|
|
|
- world.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(world));
|
|
|
|
+ world.scheduleTick(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava
|
|
|
|
+ public int getFlowSpeed(Level world, BlockPos blockposition) {
|
2022-06-09 08:51:45 +00:00
|
|
|
+ if (this.material == net.minecraft.world.level.material.Material.WATER) {
|
2021-06-11 12:02:28 +00:00
|
|
|
+ if (
|
2022-06-09 08:51:45 +00:00
|
|
|
+ world.getMaterialIfLoaded(blockposition.north(1)) == net.minecraft.world.level.material.Material.LAVA ||
|
|
|
|
+ world.getMaterialIfLoaded(blockposition.south(1)) == net.minecraft.world.level.material.Material.LAVA ||
|
|
|
|
+ world.getMaterialIfLoaded(blockposition.west(1)) == net.minecraft.world.level.material.Material.LAVA ||
|
|
|
|
+ world.getMaterialIfLoaded(blockposition.east(1)) == net.minecraft.world.level.material.Material.LAVA
|
2021-06-11 12:02:28 +00:00
|
|
|
+ ) {
|
2022-06-09 08:51:45 +00:00
|
|
|
+ return world.paperConfig().environment.waterOverLavaFlowSpeed;
|
2021-06-11 12:02:28 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return this.fluid.getTickDelay(world);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
@Override
|
2021-06-12 23:45:00 +00:00
|
|
|
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
|
|
|
if (state.getFluidState().isSource() || neighborState.getFluidState().isSource()) {
|
2022-06-09 08:51:45 +00:00
|
|
|
@@ -123,7 +139,7 @@ public class LiquidBlock extends Block implements BucketPickup {
|
2021-06-11 12:02:28 +00:00
|
|
|
@Override
|
2022-06-07 21:45:11 +00:00
|
|
|
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
|
2021-06-11 12:02:28 +00:00
|
|
|
if (this.shouldSpreadLiquid(world, pos, state)) {
|
2021-11-23 15:50:18 +00:00
|
|
|
- world.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(world));
|
|
|
|
+ world.scheduleTick(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|