This commit is contained in:
Brianna O'Keefe 2018-12-28 21:13:23 -05:00
parent a753c929f4
commit b13a02b6a5
3 changed files with 14 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package com.songoda.epichoppers.api.hopper;
import com.songoda.epichoppers.api.hopper.levels.Level;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -32,6 +33,8 @@ public interface Hopper {
*/
Location getLocation();
World getWorld();
/**
* Get the X coordinate for the hopper.
*

View File

@ -43,8 +43,10 @@ public class HopHandler {
for (com.songoda.epichoppers.api.hopper.Hopper hopper : new HashMap<>(instance.getHopperManager().getHoppers()).values()) {
Location location = hopper.getLocation();
if (!location.getWorld().isChunkLoaded(location.getBlockX(), location.getBlockZ()))
Bukkit.broadcastMessage("first");
if (!location.getWorld().isChunkLoaded(location.getBlockX() >> 4, location.getBlockZ() >> 4))
continue;
Bukkit.broadcastMessage("first2");
Block block = location.getBlock();
@ -53,6 +55,7 @@ public class HopHandler {
continue;
}
Bukkit.broadcastMessage("first2");
if (block.isBlockPowered() || block.isBlockIndirectlyPowered()) continue;
Hopper hopperBlock = hopper.getHopper();
@ -76,9 +79,11 @@ public class HopHandler {
for (Location destinationLocation : hopper.getLinkedBlocks()) {
if (destinationLocation == null) continue;
Bukkit.broadcastMessage("before");
if (!destinationLocation.getWorld().isChunkLoaded(destinationLocation.getBlockX(),
destinationLocation.getBlockZ()))
continue;
Bukkit.broadcastMessage("after");
Block destinationBlock = destinationLocation.getBlock();
if (!(destinationBlock.getState() instanceof InventoryHolder)) {

View File

@ -588,6 +588,11 @@ public class EHopper implements Hopper {
return location.clone();
}
@Override
public World getWorld() {
return location.getWorld();
}
@Override
public int getX() {
return location.getBlockX();