Hoppers modules will now correctly account for stack amounts.

Module descriptions will now be displayed correctly.
This commit is contained in:
Brianna O'Keefe 2018-09-23 13:06:43 -04:00
parent 009f5569f8
commit 81e167dd46
4 changed files with 5 additions and 5 deletions

View File

@ -260,7 +260,7 @@ public class HopHandler {
return 0; return 0;
} }
public boolean canHop(Inventory i, ItemStack item, int hop) { private boolean canHop(Inventory i, ItemStack item, int hop) {
try { try {
if (i.firstEmpty() != -1) { if (i.firstEmpty() != -1) {
return true; return true;

View File

@ -85,7 +85,7 @@ public class ModuleAutoCrafting implements Module {
if (inventory.firstEmpty() != -1) return true; if (inventory.firstEmpty() != -1) return true;
for (ItemStack stack : inventory.getContents()) { for (ItemStack stack : inventory.getContents()) {
if (stack.isSimilar(item) && stack.getAmount() < stack.getMaxStackSize()) { if (stack.isSimilar(item) && (stack.getAmount() + item.getAmount()) < stack.getMaxStackSize()) {
return true; return true;
} }
} }

View File

@ -61,6 +61,6 @@ public class ModuleBlockBreak implements Module {
@Override @Override
public String getDescription() { public String getDescription() {
return EpicHoppersPlugin.getInstance().getLocale().getMessage("interface.hopper.blockbreak", true); return EpicHoppersPlugin.getInstance().getLocale().getMessage("interface.hopper.blockbreak", amount);
} }
} }

View File

@ -81,7 +81,7 @@ public class ModuleSuction implements Module {
@Override @Override
public String getDescription() { public String getDescription() {
return EpicHoppersPlugin.getInstance().getLocale().getMessage("interface.hopper.suction", true); return EpicHoppersPlugin.getInstance().getLocale().getMessage("interface.hopper.suction", amount);
} }
private boolean canMove(Inventory inventory, ItemStack item) { private boolean canMove(Inventory inventory, ItemStack item) {
@ -89,7 +89,7 @@ public class ModuleSuction implements Module {
if (inventory.firstEmpty() != -1) return true; if (inventory.firstEmpty() != -1) return true;
for (ItemStack stack : inventory.getContents()) { for (ItemStack stack : inventory.getContents()) {
if (stack.isSimilar(item) && stack.getAmount() < stack.getMaxStackSize()) { if (stack.isSimilar(item) && (stack.getAmount() + item.getAmount()) < stack.getMaxStackSize()) {
return true; return true;
} }
} }