Paper/Spigot-Server-Patches/0296-Configurable-speed-for-water-flowing-over-lava.patch
Zach Brown 70ce6ce831
Move version command update checking to the implementation
This makes it easier for downstream projects (forks) to replace the
version fetching system with their own. It is as simple as implementing
an interface and overriding the default implementation of
org.bukkit.UnsafeValues#getVersionFetcher()

It also makes it easier for us to organize things like the version
history feature.

Lastly I have updated the paper implementation to check against the site
API rather than against jenkins.
2019-05-27 04:13:41 -05:00

69 lines
3.3 KiB
Diff

From ee09a7f9177ec8f49cec7b223be7dee1e1224179 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 8 Aug 2018 16:33:21 -0600
Subject: [PATCH] Configurable speed for water flowing over lava
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2b5402b00..2c27be63e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -401,6 +401,12 @@ public class PaperWorldConfig {
}
}
+ public int waterOverLavaFlowSpeed;
+ private void waterOverLavaFlowSpeed() {
+ waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5);
+ log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
+ }
+
public boolean armorStandTick = true;
private void armorStandTick() {
this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java
index 44e00339f..b4616f259 100644
--- a/src/main/java/net/minecraft/server/BlockFluids.java
+++ b/src/main/java/net/minecraft/server/BlockFluids.java
@@ -70,11 +70,27 @@ public class BlockFluids extends Block implements IFluidSource {
@Override
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
if (this.a(world, blockposition, iblockdata)) {
- world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.a((IWorldReader) world));
+ world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.getFlowSpeed(world, blockposition)); // Paper
}
}
+ // Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava
+ public int getFlowSpeed(World world, BlockPosition blockposition) {
+ if (this.material == Material.WATER) {
+ if (
+ world.getMaterialIfLoaded(blockposition.north(1)) == Material.LAVA ||
+ world.getMaterialIfLoaded(blockposition.south(1)) == Material.LAVA ||
+ world.getMaterialIfLoaded(blockposition.west(1)) == Material.LAVA ||
+ world.getMaterialIfLoaded(blockposition.east(1)) == Material.LAVA
+ ) {
+ return world.paperConfig.waterOverLavaFlowSpeed;
+ }
+ }
+ return this.a(world);
+ }
+ // Paper end
+
@Override
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
if (iblockdata.p().isSource() || iblockdata1.p().isSource()) {
@@ -87,7 +103,7 @@ public class BlockFluids extends Block implements IFluidSource {
@Override
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
if (this.a(world, blockposition, iblockdata)) {
- world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.a((IWorldReader) world));
+ world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.getFlowSpeed(world, blockposition)); // Paper
}
}
--
2.21.0