Fix liquids stuck in fast drain loop

This commit is contained in:
Byteflux 2015-07-03 12:38:43 -07:00
parent 7f032d52e6
commit 5ceee0e6e0

View file

@ -1,11 +1,11 @@
From 0e96ada80bf03572e4594a538dc20771c7cb0349 Mon Sep 17 00:00:00 2001
From f0ec2fb3eb0aea8c4baf86deef1e6c03b002fb3c Mon Sep 17 00:00:00 2001
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
index ab2e43f..33ff734 100644
index ab2e43f..fc3fc48 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 {
@ -44,34 +44,34 @@ index ab2e43f..33ff734 100644
+ */
+ public boolean canFastDrain(World world, BlockPosition position) {
+ boolean result = false;
+ int data = getData(world, position);
+ if (this.material == Material.WATER) {
+ if (world.paperSpigotConfig.fastDrainWater) {
+ result = true;
+ if (getData(world, position.down()) < 0) {
+ result = false;
+ } else if (world.getType(position.north()).getBlock().getMaterial() == Material.WATER && getData(world, position.north()) < 1) {
+ } else if (world.getType(position.north()).getBlock().getMaterial() == Material.WATER && getData(world, position.north()) < data) {
+ result = false;
+ } else if (world.getType(position.south()).getBlock().getMaterial() == Material.WATER && getData(world, position.south()) < 1) {
+ } else if (world.getType(position.south()).getBlock().getMaterial() == Material.WATER && getData(world, position.south()) < data) {
+ result = false;
+ } else if (world.getType(position.west()).getBlock().getMaterial() == Material.WATER && getData(world, position.west()) < 1) {
+ } else if (world.getType(position.west()).getBlock().getMaterial() == Material.WATER && getData(world, position.west()) < data) {
+ result = false;
+ } else if (world.getType(position.east()).getBlock().getMaterial() == Material.WATER && getData(world, position.east()) < 1) {
+ } else if (world.getType(position.east()).getBlock().getMaterial() == Material.WATER && getData(world, position.east()) < data) {
+ result = false;
+ }
+ }
+ } else if (this.material == Material.LAVA) {
+ if (world.paperSpigotConfig.fastDrainLava) {
+ Material m;
+ result = true;
+ if (getData(world, position.down()) < 0) {
+ if (getData(world, position.down()) < 0 || world.getType(position.up()).getBlock().getMaterial() != Material.AIR) {
+ result = false;
+ } else if ((m = world.getType(position.north()).getBlock().getMaterial()) == Material.WATER || (m == Material.LAVA && getData(world, position.north()) < 1)) {
+ } else if (world.getType(position.north()).getBlock().getMaterial() == Material.LAVA && getData(world, position.north()) < data) {
+ result = false;
+ } else if ((m = world.getType(position.south()).getBlock().getMaterial()) == Material.WATER || (m == Material.LAVA && getData(world, position.south()) < 1)) {
+ } else if (world.getType(position.south()).getBlock().getMaterial() == Material.LAVA && getData(world, position.south()) < data) {
+ result = false;
+ } else if ((m = world.getType(position.west()).getBlock().getMaterial()) == Material.WATER || (m == Material.LAVA && getData(world, position.west()) < 1)) {
+ } else if (world.getType(position.west()).getBlock().getMaterial() == Material.LAVA && getData(world, position.west()) < data) {
+ result = false;
+ } else if ((m = world.getType(position.east()).getBlock().getMaterial()) == Material.WATER || (m == Material.LAVA && getData(world, position.east()) < 1)) {
+ } else if (world.getType(position.east()).getBlock().getMaterial() == Material.LAVA && getData(world, position.east()) < data) {
+ result = false;
+ }
+ }