3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00
Paper/Spigot-Server-Patches/0022-Configurable-speed-for-water-flowing-over-lava.patch
2014-11-28 15:01:21 -06:00

64 Zeilen
2.7 KiB
Diff

From 3f75698f2fa54576ea3fcc419632a11a8d561722 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Fri, 28 Nov 2014 02:31:02 -0600
Subject: [PATCH] Configurable speed for water flowing over lava
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index 5184715..bc4cee5 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -35,7 +35,7 @@ public class BlockFlowing extends BlockFluids {
b0 = 2;
}
- int j = this.a(world);
+ int j = this.getFlowSpeed(world, blockposition); // PaperSpigot
int k;
if (i > 0) {
@@ -259,8 +259,23 @@ public class BlockFlowing extends BlockFluids {
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (!this.e(world, blockposition, iblockdata)) {
- world.a(blockposition, (Block) this, this.a(world));
+ world.a(blockposition, (Block) this, this.getFlowSpeed(world, blockposition)); // PaperSpigot
}
}
+
+ /**
+ * PaperSpigot - Get flow speed. Throttle if its water and flowing adjacent to lava
+ */
+ public int getFlowSpeed(World world, BlockPosition blockposition) {
+ if (this.getMaterial() == Material.WATER && (
+ // TODO: Double check that this does what I think it does
+ world.getType(blockposition.north(1)).getBlock().getMaterial() == Material.LAVA ||
+ world.getType(blockposition.south(1)).getBlock().getMaterial() == Material.LAVA ||
+ world.getType(blockposition.west(1)).getBlock().getMaterial() == Material.LAVA ||
+ world.getType(blockposition.east(1)).getBlock().getMaterial() == Material.LAVA)) {
+ return world.paperSpigotConfig.waterOverLavaFlowSpeed;
+ }
+ return super.a(world);
+ }
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 5306e9a..670f78f 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -156,4 +156,11 @@ public class PaperSpigotWorldConfig
log( "TNT/Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
}
}
+
+ public int waterOverLavaFlowSpeed;
+ private void waterOverLavaFlowSpeed()
+ {
+ waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 );
+ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed );
+ }
}
--
1.9.1