Files
Purpur/patches/server/0049-Implement-infinite-liquids.patch
2023-12-07 16:04:02 -08: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 e21f4c5aff3a8e97101f6efc1349fbecf326b5ea..ad077179fe5cf4acbfbe7572470201ab91817996 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -218,7 +218,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();
@@ -302,6 +302,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 c3f8e1e2dd89c168b8b4a15b589109db486bc8d7..2076e4b433e0a57e3ae7053c1df77e0cdc457fc9 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 d280c98aed5262c4ce39526c917de884f25a8584..e7d9f6802520620a1dcf0938256ffe80fc72a6f0 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 5ac666f1a71770891b3b437b2d68b0c5a952358f..e1fd29d376fc52e7519d93073b3823e616cea2c1 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -221,6 +221,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 turtleEggsBreakFromExpOrbs = true;
public boolean turtleEggsBreakFromItems = true;
public boolean turtleEggsBreakFromMinecarts = true;
@@ -230,6 +235,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;