Fixed Hopper Behaviour

Virtual Hoppers were ignoring redstone locking of Hoppers
This commit is contained in:
jameslfc19 2020-04-16 11:47:34 +01:00
parent bc6b57d8ed
commit 18e865d63e
2 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,9 @@ public class HopperListener implements Listener {
public void onHopperMoveEvent(InventoryMoveItemEvent event) {
//TO HOPPER
if(event.getDestination().getHolder() instanceof Hopper){
if(event.getDestination().getLocation() != null){
if(event.getDestination().getLocation().getBlock().isBlockPowered()) return;
}
event.setCancelled(!isItemInFilter(event.getDestination().getLocation().getBlock(),event.getItem()));
}
}

View File

@ -37,6 +37,9 @@ public class VirtualChestToHopper extends BukkitRunnable {
Location below = location.clone().subtract(0, 1, 0);
if (below.getBlock().getState() instanceof Hopper) {
Hopper hopper = (Hopper) below.getBlock().getState();
if(below.getBlock().isBlockIndirectlyPowered()|| below.getBlock().isBlockPowered()){
continue;
}
Utils.moveToOtherInventory(storage.getInventory(), 1, hopper.getInventory(), Utils.getHopperFilters(below.getBlock()));
}
}