PaperMC/Spigot-Server-Patches/0035-Configurable-lava-flow-speed.patch

52 lines
2.4 KiB
Diff
Raw Normal View History

2017-04-22 08:16:45 +02:00
From ec526d2a02bbc74f962bf21806940ad169baed8e Mon Sep 17 00:00:00 2001
2016-03-01 00:09:49 +01:00
From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 12:27:07 -0600
Subject: [PATCH] Configurable lava flow speed
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e093f7dc1..a197af84f 100644
2016-03-01 00:09:49 +01:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -192,4 +192,11 @@ public class PaperWorldConfig {
2016-03-01 00:09:49 +01:00
fastDrainLava = getBoolean("fast-drain.lava", false);
fastDrainWater = getBoolean("fast-drain.water", false);
}
+
+ public int lavaFlowSpeedNormal;
+ public int lavaFlowSpeedNether;
+ private void lavaFlowSpeeds() {
+ lavaFlowSpeedNormal = getInt("lava-flow-speed.normal", 30);
+ lavaFlowSpeedNether = getInt("lava-flow-speed.nether", 10);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index 8e9de3bcb..0a2823686 100644
2016-03-01 00:09:49 +01:00
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
2016-12-10 01:07:35 +01:00
@@ -272,6 +272,9 @@ public class BlockFlowing extends BlockFluids {
2016-03-01 00:09:49 +01:00
* Paper - Get flow speed. Throttle if its water and flowing adjacent to lava
*/
public int getFlowSpeed(World world, BlockPosition blockposition) {
+ if (this.material == Material.LAVA) {
+ return world.worldProvider.isSkyMissing() ? world.paperConfig.lavaFlowSpeedNether : world.paperConfig.lavaFlowSpeedNormal;
2016-03-01 00:09:49 +01:00
+ }
if (this.material == Material.WATER && (
world.getType(blockposition.north(1)).getBlock().material == Material.LAVA ||
world.getType(blockposition.south(1)).getBlock().material == Material.LAVA ||
diff --git a/src/main/java/net/minecraft/server/WorldProvider.java b/src/main/java/net/minecraft/server/WorldProvider.java
index 660f3bcce..a27512c0f 100644
--- a/src/main/java/net/minecraft/server/WorldProvider.java
+++ b/src/main/java/net/minecraft/server/WorldProvider.java
@@ -114,6 +114,7 @@ public abstract class WorldProvider {
return this.f;
}
+ public final boolean isSkyMissing() { return this.n(); } // Paper - OBFHELPER
public boolean n() {
return this.e;
}
2016-03-01 00:09:49 +01:00
--
2017-04-22 08:16:45 +02:00
2.12.2
2016-03-01 00:09:49 +01:00