Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
9ff01b16ab
This will be used by my next commit. But trying to get the build going since CI blew up
101 Zeilen
4.8 KiB
Diff
101 Zeilen
4.8 KiB
Diff
From c9e4fbbe1ceced99a47e76c5f7bcaad14d094d6e Mon Sep 17 00:00:00 2001
|
|
From: Byteflux <byte@byteflux.net>
|
|
Date: Wed, 2 Mar 2016 12:20:52 -0600
|
|
Subject: [PATCH] Fast draining
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 09b9867..658e430 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -207,4 +207,11 @@ public class PaperWorldConfig {
|
|
optimizeExplosions = getBoolean("optimize-explosions", false);
|
|
log("Optimize explosions: " + optimizeExplosions);
|
|
}
|
|
+
|
|
+ public boolean fastDrainLava;
|
|
+ public boolean fastDrainWater;
|
|
+ private void fastDrain() {
|
|
+ fastDrainLava = getBoolean("fast-drain.lava", false);
|
|
+ fastDrainWater = getBoolean("fast-drain.water", false);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
|
|
index 1f07f82..517c1e8 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
|
|
@@ -74,7 +74,7 @@ public class BlockFlowing extends BlockFluids {
|
|
}
|
|
}
|
|
|
|
- if (this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) {
|
|
+ if (!world.paperConfig.fastDrainLava && this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { // Paper
|
|
j *= 4;
|
|
}
|
|
|
|
@@ -82,7 +82,7 @@ public class BlockFlowing extends BlockFluids {
|
|
this.f(world, blockposition, iblockdata);
|
|
} else {
|
|
i = i1;
|
|
- if (i1 < 0) {
|
|
+ if (i1 < 0 || canFastDrain(world, blockposition)) { // Paper - Fast draining
|
|
world.setAir(blockposition);
|
|
} else {
|
|
iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1));
|
|
@@ -288,4 +288,52 @@ public class BlockFlowing extends BlockFluids {
|
|
}
|
|
return super.a(world);
|
|
}
|
|
+
|
|
+ /**
|
|
+ * Paper - Data check method for fast draining
|
|
+ */
|
|
+ public int getData(World world, BlockPosition position) {
|
|
+ int data = this.c((IBlockAccess) world, position);
|
|
+ return data < 8 ? data : 0;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Paper - Checks surrounding blocks to determine if block can be fast drained
|
|
+ */
|
|
+ public boolean canFastDrain(World world, BlockPosition position) {
|
|
+ boolean result = false;
|
|
+ int data = getData(world, position);
|
|
+ if (this.material == Material.WATER) {
|
|
+ if (world.paperConfig.fastDrainWater) {
|
|
+ result = true;
|
|
+ if (getData(world, position.down()) < 0) {
|
|
+ result = false;
|
|
+ } else if (world.getType(position.north()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.north()) < data) {
|
|
+ result = false;
|
|
+ } else if (world.getType(position.south()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.south()) < data) {
|
|
+ result = false;
|
|
+ } else if (world.getType(position.west()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.west()) < data) {
|
|
+ result = false;
|
|
+ } else if (world.getType(position.east()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.east()) < data) {
|
|
+ result = false;
|
|
+ }
|
|
+ }
|
|
+ } else if (this.material == Material.LAVA) {
|
|
+ if (world.paperConfig.fastDrainLava) {
|
|
+ result = true;
|
|
+ if (getData(world, position.down()) < 0 || world.getType(position.up()).getBlock().getBlockData().getMaterial() != Material.AIR) {
|
|
+ result = false;
|
|
+ } else if (world.getType(position.north()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.north()) < data) {
|
|
+ result = false;
|
|
+ } else if (world.getType(position.south()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.south()) < data) {
|
|
+ result = false;
|
|
+ } else if (world.getType(position.west()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.west()) < data) {
|
|
+ result = false;
|
|
+ } else if (world.getType(position.east()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.east()) < data) {
|
|
+ result = false;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return result;
|
|
+ }
|
|
}
|
|
--
|
|
2.7.4
|
|
|