Files
Purpur/patches/server/0056-Implement-infinite-liquids.patch
Krakenied fff2015d52 Updated Upstream (Paper) (#1174)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@7b3b593 [ci skip] Update checkout action in workflow (#8510)
PaperMC/Paper@36869cc Fix new block data in EntityChangeBlockEvent for silverfish when mobGriefing isn't enabled (#8099)
PaperMC/Paper@2432233 Add allow server listing & text filtering client options (#7595)
PaperMC/Paper@954e6f0 Fix a bunch more forceDrops for dropping items (#8095)
PaperMC/Paper@32d95e9 Track projectile source for fireworks from dispensers (#8044)
PaperMC/Paper@0249750 Fix EntityArgument suggestion permissions to align with EntitySelector#checkPermissions (#8511)
PaperMC/Paper@8acb05d Make CommandSyntaxException implement ComponentMessageThrowable (#8513)
PaperMC/Paper@c264018 [ci skip] Undo modification to removed patches in latest commit (#8512)
PaperMC/Paper@304ab35 [ci skip] Remove old todo file
PaperMC/Paper@8a4b752 Fix wrong descriptor in ASMEventExecutorGenerator (#8506)
PaperMC/Paper@b743144 Fix MC-147659 (#8423)
PaperMC/Paper@aaf5e39 Deprecate unused VehicleEntityCollisionEvent methods (#8498)
2022-10-29 22:47:43 -07:00

115 lines
5.1 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 c2c3ed6ba79f9f41497e042571f699a0fc6e9335..a1d0329401dbb9e5f0fd27bd42d1c5a7c40d1c03 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() && j >= 2) {
+ if (this.canConvertToSource(world) && j >= getRequiredSources(world)) {
BlockState iblockdata2 = world.getBlockState(pos.below());
FluidState fluid1 = iblockdata2.getFluidState();
@@ -322,6 +322,16 @@ public abstract class FlowingFluid extends Fluid {
return (FluidState) this.getSource().defaultFluidState().setValue(FlowingFluid.FALLING, falling);
}
+ // Purpur start
+ protected boolean canConvertToSource(LevelReader world) {
+ return canConvertToSource();
+ }
+
+ protected int getRequiredSources(LevelReader world) {
+ return 2;
+ }
+ // Purpur end
+
protected abstract boolean canConvertToSource();
protected void spreadTo(LevelAccessor world, BlockPos pos, BlockState state, Direction direction, FluidState 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 fb23e69e9d46f9c7d562be76e527050a949509cf..d96c52a55cad5f6127b17e1307fe341e8bdd1335 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,18 @@ public abstract class LavaFluid extends FlowingFluid {
world.levelEvent(1501, pos, 0);
}
+ // Purpur start
+ @Override
+ protected boolean canConvertToSource(LevelReader world) {
+ return world.getWorldBorder().world.purpurConfig.lavaInfinite;
+ }
+
+ @Override
+ protected int getRequiredSources(LevelReader world) {
+ return world.getWorldBorder().world.purpurConfig.lavaInfiniteRequiredSources;
+ }
+ // Purpur end
+
@Override
protected boolean canConvertToSource() {
return false;
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 ac33ba631f4b0ae0e08bff5748440ef5b76c2117..29068ca2df90ab0351b91cd0aa3e224c71cbec40 100644
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
@@ -63,6 +63,18 @@ public abstract class WaterFluid extends FlowingFluid {
return true;
}
+ // Purpur start
+ @Override
+ protected boolean canConvertToSource(LevelReader world) {
+ return world.getWorldBorder().world.purpurConfig.waterInfinite;
+ }
+
+ @Override
+ protected int getRequiredSources(LevelReader world) {
+ return world.getWorldBorder().world.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 8f21736b201948ae5970812de412a13b878f534e..317ba58b36bbb9a2430a763794c64e0e98f29f00 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -228,6 +228,13 @@ public class PurpurWorldConfig {
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
}
+ public boolean lavaInfinite = false;
+ public int lavaInfiniteRequiredSources = 2;
+ private void lavaSettings() {
+ lavaInfinite = getBoolean("blocks.lava.infinite-source", lavaInfinite);
+ 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 +249,13 @@ public class PurpurWorldConfig {
turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
}
+ public boolean waterInfinite = true;
+ public int waterInfiniteRequiredSources = 2;
+ private void waterSources() {
+ waterInfinite = getBoolean("blocks.water.infinite-source", waterInfinite);
+ waterInfiniteRequiredSources = getInt("blocks.water.infinite-required-sources", waterInfiniteRequiredSources);
+ }
+
public boolean babiesAreRidable = true;
public boolean untamedTamablesAreRidable = true;
public boolean useNightVisionWhenRiding = false;