Paper/Spigot-Server-Patches/0028-Configurable-speed-for-water-flowing-over-lava.patch
Zach Brown a4647a8a71 Update from upstream SpigotMC
Fix empty `ench` tags being wiped by the meta system SpigotMC/Spigot@cc9a1a417f
Add Hunger Config Values SpigotMC/Spigot@2cd515e224
Make debug logging togglable SpigotMC/Spigot@d31b1d616f

Spigot has implemented a system of hunger exhaustion similar to ours, as such a lot of config values have been moved there.
Our exhaustion patch has been trimmed and only a few values for exhaustion remain in paper.yml, the others now sit in spigot.yml
2014-08-17 16:47:36 -05:00

67 lines
2.6 KiB
Diff

From 0fca3bbe6aed83859a5b107f58c74ee936f5736f Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sun, 3 Aug 2014 21:20:42 -0500
Subject: [PATCH] Configurable speed for water flowing over lava
Basic info: http://hastebin.com/axuzaralas.vhdl
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index cdce3ff..6409391 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -38,7 +38,7 @@ public class BlockFlowing extends BlockFluids {
}
boolean flag = true;
- int i1 = this.a(world);
+ int i1 = this.getFlowSpeed(world, i, j, k); // PaperSpigot
int j1;
if (l > 0) {
@@ -289,11 +289,25 @@ public class BlockFlowing extends BlockFluids {
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (world.getType(i, j, k) == this) {
- world.a(i, j, k, this, this.a(world));
+ world.a(i, j, k, this, this.getFlowSpeed(world, i, j, k)); // PaperSpigot
}
}
public boolean L() {
return true;
}
+
+ /**
+ * PaperSpigot - Get flow speed. Throttle if its water and flowing adjacent to lava
+ */
+ public int getFlowSpeed(World world, int x, int y, int z) {
+ if (this.getMaterial() == Material.WATER && (
+ world.getType(x, y, z - 1).getMaterial() == Material.LAVA ||
+ world.getType(x, y, z + 1).getMaterial() == Material.LAVA ||
+ world.getType(x - 1, y, z).getMaterial() == Material.LAVA ||
+ world.getType(x + 1, y, z).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 708318d..ce3fb73 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -164,4 +164,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