Files
Purpur/patches/server/0054-Implement-infinite-liquids.patch
granny 67066cdd46 [ci-skip] remove unused config option
not sure why we didn't do this during the 1.19.2 update
2023-03-14 21:56:53 -07:00

97 lines
4.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 23 Nov 2019 17:55:42 -0600
Subject: [PATCH] Implement infinite liquids
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index 3f72703d2063a082546305eeb0a1b21629ddb1b2..93f31a99363e73a24571b66cd5bbaf7b5b9084b2 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -226,7 +226,7 @@ public abstract class FlowingFluid extends Fluid {
}
}
- if (this.canConvertToSource(world) && j >= 2) {
+ if (this.canConvertToSource(world) && j >= getRequiredSources(world)) {
BlockState iblockdata2 = world.getBlockState(pos.below());
FluidState fluid1 = iblockdata2.getFluidState();
@@ -324,6 +324,12 @@ public abstract class FlowingFluid extends Fluid {
protected abstract boolean canConvertToSource(Level world);
+ // Purpur start
+ protected int getRequiredSources(Level level) {
+ return 2;
+ }
+ // Purpur end
+
protected void spreadTo(LevelAccessor world, BlockPos pos, BlockState state, Direction direction, FluidState fluidState) {
if (state.getBlock() instanceof LiquidBlockContainer) {
((LiquidBlockContainer) state.getBlock()).placeLiquid(world, pos, state, fluidState);
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
index 783e315d92227cbcb5cd207b0a06a12e0778d14b..e965d2cafdd887a7c61058ba2931596709e5aaa2 100644
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
@@ -198,6 +198,13 @@ public abstract class LavaFluid extends FlowingFluid {
world.levelEvent(1501, pos, 0);
}
+ // Purpur start
+ @Override
+ protected int getRequiredSources(Level level) {
+ return level.purpurConfig.lavaInfiniteRequiredSources;
+ }
+ // Purpur end
+
@Override
protected boolean canConvertToSource(Level world) {
return world.getGameRules().getBoolean(GameRules.RULE_LAVA_SOURCE_CONVERSION);
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
index 82e85fbbd45244d02df90fa00c9046e7f51275a2..ec6c63075306f9e5389e83641d2c8a82369ddc6b 100644
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
@@ -64,6 +64,13 @@ public abstract class WaterFluid extends FlowingFluid {
return world.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION);
}
+ // Purpur start
+ @Override
+ protected int getRequiredSources(Level level) {
+ return level.purpurConfig.waterInfiniteRequiredSources;
+ }
+ // Purpur end
+
// Paper start
@Override
protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 04c8e92e0037f95d2d390d3108cb4bbeb71d66c7..9ac56c86462119f861790c5dfd950a1622028cd7 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -228,6 +228,11 @@ public class PurpurWorldConfig {
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
}
+ public int lavaInfiniteRequiredSources = 2;
+ private void lavaSettings() {
+ lavaInfiniteRequiredSources = getInt("blocks.lava.infinite-required-sources", lavaInfiniteRequiredSources);
+ }
+
public boolean signRightClickEdit = false;
private void signSettings() {
signRightClickEdit = getBoolean("blocks.sign.right-click-edit", signRightClickEdit);
@@ -242,6 +247,11 @@ public class PurpurWorldConfig {
turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
}
+ public int waterInfiniteRequiredSources = 2;
+ private void waterSources() {
+ waterInfiniteRequiredSources = getInt("blocks.water.infinite-required-sources", waterInfiniteRequiredSources);
+ }
+
public boolean babiesAreRidable = true;
public boolean untamedTamablesAreRidable = true;
public boolean useNightVisionWhenRiding = false;