Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchampions committed Jul 5, 2024
1 parent 400ec02 commit 418b2f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ private boolean charge(Block b, BlockMenu inv, int slot, ItemStack item) {
if (rechargeable.addItemCharge(item, charge)) {
removeCharge(b.getLocation(), getEnergyConsumption());
} else if (inv.fits(item, getOutputSlots())) {
inv.pushItem((SlimefunItemStack) sfItem.getItem(), getOutputSlots());
inv.pushSlimefunItem(item, getOutputSlots());
inv.replaceExistingItem(slot, null);
}

return true;
} else if (sfItem != null && inv.fits(item, getOutputSlots())) {
inv.pushItem((SlimefunItemStack) sfItem.getItem(), getOutputSlots());
inv.pushSlimefunItem(item, getOutputSlots());
inv.replaceExistingItem(slot, null);
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.github.thebusybiscuit.slimefun4.core.debug.TestCase;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -106,8 +107,8 @@ public boolean fits(ItemStack item, int... slots) {
Debug.log(TestCase.UTILS, "DirtyChestMenu#fits - Check slimefun item fits");

if (!slotItem.hasItemMeta()
|| item.getType() != slotItem.getType()
|| !SlimefunUtils.isItemSimilar(slotItem, wrapper, true, false)) {
|| item.getType() != slotItem.getType()
|| !SlimefunUtils.isItemSimilar(slotItem, wrapper, true, false)) {
continue;
}

Expand Down Expand Up @@ -148,7 +149,8 @@ public boolean fits(ItemStack item, int... slots) {
* @return {@link ItemStack} with any items that did not fit into the inventory
* or null when everything had fit
*/
@Nullable public ItemStack pushItem(ItemStack item, int... slots) {
@Nullable
public ItemStack pushItem(ItemStack item, int... slots) {
if (item == null || item.getType() == Material.AIR) {
throw new IllegalArgumentException("Cannot push null or AIR");
}
Expand Down Expand Up @@ -211,7 +213,8 @@ public boolean fits(ItemStack item, int... slots) {
* @return {@link ItemStack} with any items that did not fit into the inventory
* or null when everything had fit
*/
@Nullable public ItemStack pushItem(SlimefunItemStack item, int... slots) {
@Nullable
public ItemStack pushSlimefunItem(ItemStack item, int... slots) {
int amount = item.getAmount();

for (int slot : slots) {
Expand All @@ -227,7 +230,7 @@ public boolean fits(ItemStack item, int... slots) {
int maxStackSize =
Math.min(stack.getMaxStackSize(), toInventory().getMaxStackSize());
if (stack.getAmount() < maxStackSize) {
if (!SlimefunUtils.isSlimefunItemSimilar(item,stack)) {
if (!SlimefunUtils.isSlimefunItemSimilar((SlimefunItemStack) SlimefunItem.getByItem(item).getItem(), stack)) {
continue;
}

Expand Down

0 comments on commit 418b2f9

Please sign in to comment.