mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
Implement infinite liquids
This commit is contained in:
committed by
granny
parent
b12c969bc5
commit
a9125253c6
@@ -1,96 +0,0 @@
|
|||||||
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/net/minecraft/world/level/material/FlowingFluid.java b/net/minecraft/world/level/material/FlowingFluid.java
|
|
||||||
index f4fbcbb8ff6d2677af1a02a0801a323c06dce9b1..6f024a29e8824a604ff0c74f88522d23423beb5c 100644
|
|
||||||
--- a/net/minecraft/world/level/material/FlowingFluid.java
|
|
||||||
+++ b/net/minecraft/world/level/material/FlowingFluid.java
|
|
||||||
@@ -266,7 +266,7 @@ public abstract class FlowingFluid extends Fluid {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (j >= 2 && this.canConvertToSource(world)) {
|
|
||||||
+ if (j >= getRequiredSources(world) && this.canConvertToSource(world)) { // Purpur
|
|
||||||
BlockState iblockdata2 = world.getBlockState(blockposition_mutableblockposition.setWithOffset(pos, Direction.DOWN));
|
|
||||||
FluidState fluid1 = iblockdata2.getFluidState();
|
|
||||||
|
|
||||||
@@ -356,6 +356,12 @@ public abstract class FlowingFluid extends Fluid {
|
|
||||||
|
|
||||||
protected abstract boolean canConvertToSource(ServerLevel 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) {
|
|
||||||
Block block = state.getBlock();
|
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java
|
|
||||||
index 884db3e64cb22ed765beec8f11ea309fcf810207..e9687c3580e5fff33ce902eb7b86eb815ca1072d 100644
|
|
||||||
--- a/net/minecraft/world/level/material/LavaFluid.java
|
|
||||||
+++ b/net/minecraft/world/level/material/LavaFluid.java
|
|
||||||
@@ -199,6 +199,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(ServerLevel world) {
|
|
||||||
return world.getGameRules().getBoolean(GameRules.RULE_LAVA_SOURCE_CONVERSION);
|
|
||||||
diff --git a/net/minecraft/world/level/material/WaterFluid.java b/net/minecraft/world/level/material/WaterFluid.java
|
|
||||||
index 552925ba47c7475e2e1ec2ded0966f28ed3e50a5..1e741f36b79585f33abe413beafe00cf5205d54f 100644
|
|
||||||
--- a/net/minecraft/world/level/material/WaterFluid.java
|
|
||||||
+++ b/net/minecraft/world/level/material/WaterFluid.java
|
|
||||||
@@ -81,6 +81,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 - Add BlockBreakBlockEvent
|
|
||||||
@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 1b96a84a1c81c075aa5f7308b89d396a4578be33..8221f383726a4d6aec895529f9330c64de286a35 100644
|
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
@@ -222,6 +222,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;
|
|
||||||
@@ -231,6 +236,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;
|
|
||||||
@@ -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) {
|
||||||
@@ -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);
|
||||||
@@ -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) {
|
||||||
@@ -210,6 +210,11 @@ public class PurpurWorldConfig {
|
|||||||
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
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 turtleEggsBreakFromExpOrbs = false;
|
||||||
public boolean turtleEggsBreakFromItems = false;
|
public boolean turtleEggsBreakFromItems = false;
|
||||||
public boolean turtleEggsBreakFromMinecarts = false;
|
public boolean turtleEggsBreakFromMinecarts = false;
|
||||||
@@ -219,6 +224,11 @@ public class PurpurWorldConfig {
|
|||||||
turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
|
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 babiesAreRidable = true;
|
||||||
public boolean untamedTamablesAreRidable = true;
|
public boolean untamedTamablesAreRidable = true;
|
||||||
public boolean useNightVisionWhenRiding = false;
|
public boolean useNightVisionWhenRiding = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user