2015-07-03 19:38:43 +00:00
|
|
|
From f0ec2fb3eb0aea8c4baf86deef1e6c03b002fb3c Mon Sep 17 00:00:00 2001
|
2015-07-01 03:22:24 +00:00
|
|
|
From: Byteflux <byte@byteflux.net>
|
|
|
|
Date: Tue, 30 Jun 2015 19:53:03 -0700
|
|
|
|
Subject: [PATCH] Fast draining
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
|
2015-07-03 19:38:43 +00:00
|
|
|
index ab2e43f..fc3fc48 100644
|
2015-07-01 03:22:24 +00:00
|
|
|
--- 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.paperSpigotConfig.fastDrainLava && this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { // PaperSpigot
|
|
|
|
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)) { // PaperSpigot - Fast draining
|
|
|
|
world.setAir(blockposition);
|
|
|
|
} else {
|
|
|
|
iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1));
|
|
|
|
@@ -285,4 +285,52 @@ public class BlockFlowing extends BlockFluids {
|
|
|
|
}
|
|
|
|
return super.a(world);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * PaperSpigot - Data check method for fast draining
|
|
|
|
+ */
|
|
|
|
+ public int getData(World world, BlockPosition position) {
|
|
|
|
+ int data = this.e(world, position);
|
|
|
|
+ return data < 8 ? data : 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * PaperSpigot - Checks surrounding blocks to determine if block can be fast drained
|
|
|
|
+ */
|
|
|
|
+ public boolean canFastDrain(World world, BlockPosition position) {
|
|
|
|
+ boolean result = false;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ int data = getData(world, position);
|
2015-07-01 03:22:24 +00:00
|
|
|
+ if (this.material == Material.WATER) {
|
|
|
|
+ if (world.paperSpigotConfig.fastDrainWater) {
|
|
|
|
+ result = true;
|
|
|
|
+ if (getData(world, position.down()) < 0) {
|
|
|
|
+ result = false;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ } else if (world.getType(position.north()).getBlock().getMaterial() == Material.WATER && getData(world, position.north()) < data) {
|
2015-07-01 03:22:24 +00:00
|
|
|
+ result = false;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ } else if (world.getType(position.south()).getBlock().getMaterial() == Material.WATER && getData(world, position.south()) < data) {
|
2015-07-01 03:22:24 +00:00
|
|
|
+ result = false;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ } else if (world.getType(position.west()).getBlock().getMaterial() == Material.WATER && getData(world, position.west()) < data) {
|
2015-07-01 03:22:24 +00:00
|
|
|
+ result = false;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ } else if (world.getType(position.east()).getBlock().getMaterial() == Material.WATER && getData(world, position.east()) < data) {
|
2015-07-01 03:22:24 +00:00
|
|
|
+ result = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if (this.material == Material.LAVA) {
|
|
|
|
+ if (world.paperSpigotConfig.fastDrainLava) {
|
|
|
|
+ result = true;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ if (getData(world, position.down()) < 0 || world.getType(position.up()).getBlock().getMaterial() != Material.AIR) {
|
2015-07-01 03:22:24 +00:00
|
|
|
+ result = false;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ } else if (world.getType(position.north()).getBlock().getMaterial() == Material.LAVA && getData(world, position.north()) < data) {
|
2015-07-01 03:22:24 +00:00
|
|
|
+ result = false;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ } else if (world.getType(position.south()).getBlock().getMaterial() == Material.LAVA && getData(world, position.south()) < data) {
|
2015-07-01 03:22:24 +00:00
|
|
|
+ result = false;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ } else if (world.getType(position.west()).getBlock().getMaterial() == Material.LAVA && getData(world, position.west()) < data) {
|
2015-07-01 03:22:24 +00:00
|
|
|
+ result = false;
|
2015-07-03 19:38:43 +00:00
|
|
|
+ } else if (world.getType(position.east()).getBlock().getMaterial() == Material.LAVA && getData(world, position.east()) < data) {
|
2015-07-01 03:22:24 +00:00
|
|
|
+ result = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
|
|
|
index 4596e9d..4c6bfb9 100644
|
|
|
|
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
|
|
|
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
|
|
|
@@ -344,4 +344,12 @@ public class PaperSpigotWorldConfig
|
|
|
|
{
|
|
|
|
optimizeExplosions = getBoolean( "optimize-explosions", false );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean fastDrainLava;
|
|
|
|
+ public boolean fastDrainWater;
|
|
|
|
+ private void fastDraining()
|
|
|
|
+ {
|
|
|
|
+ fastDrainLava = getBoolean( "fast-drain.lava", false );
|
|
|
|
+ fastDrainWater = getBoolean( "fast-drain.water", false );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
|
|
|
1.9.5.msysgit.1
|
|
|
|
|