Implement infinite liquids

This commit is contained in:
William Blake Galbreath
2025-01-05 16:29:08 -08:00
committed by granny
parent b12c969bc5
commit a9125253c6
5 changed files with 67 additions and 96 deletions

View File

@@ -0,0 +1,24 @@
--- a/net/minecraft/world/level/material/FlowingFluid.java
+++ b/net/minecraft/world/level/material/FlowingFluid.java
@@ -232,7 +_,7 @@
}
}
- if (i1 >= 2 && this.canConvertToSource(level)) {
+ if (i1 >= this.getRequiredSources(level) && this.canConvertToSource(level)) { // Purpur - Implement infinite liquids
BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(pos, Direction.DOWN));
FluidState fluidState1 = blockState1.getFluidState();
if (blockState1.isSolid() || this.isSourceBlockOfThisType(fluidState1)) {
@@ -319,6 +_,12 @@
}
protected abstract boolean canConvertToSource(ServerLevel level);
+
+ // Purpur start - Implement infinite liquids
+ protected int getRequiredSources(Level level) {
+ return 2;
+ }
+ // Purpur end - Implement infinite liquids
protected void spreadTo(LevelAccessor level, BlockPos pos, BlockState blockState, Direction direction, FluidState fluidState) {
if (blockState.getBlock() instanceof LiquidBlockContainer liquidBlockContainer) {

View File

@@ -0,0 +1,16 @@
--- a/net/minecraft/world/level/material/LavaFluid.java
+++ b/net/minecraft/world/level/material/LavaFluid.java
@@ -199,6 +_,13 @@
level.levelEvent(1501, pos, 0);
}
+ // Purpur start - Implement infinite liquids
+ @Override
+ protected int getRequiredSources(Level level) {
+ return level.purpurConfig.lavaInfiniteRequiredSources;
+ }
+ // Purpur end - Implement infinite liquids
+
@Override
protected boolean canConvertToSource(ServerLevel level) {
return level.getGameRules().getBoolean(GameRules.RULE_LAVA_SOURCE_CONVERSION);

View File

@@ -0,0 +1,17 @@
--- a/net/minecraft/world/level/material/WaterFluid.java
+++ b/net/minecraft/world/level/material/WaterFluid.java
@@ -74,6 +_,14 @@
protected boolean canConvertToSource(ServerLevel level) {
return level.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION);
}
+
+ // Purpur start - Implement infinite liquids
+ @Override
+ protected int getRequiredSources(Level level) {
+ return level.purpurConfig.waterInfiniteRequiredSources;
+ }
+ // Purpur end - Implement infinite liquids
+
// Paper start - Add BlockBreakBlockEvent
@Override
protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) {

View File

@@ -210,6 +210,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 = false;
public boolean turtleEggsBreakFromItems = false;
public boolean turtleEggsBreakFromMinecarts = false;
@@ -219,6 +224,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;