add early escape for crafter pattern insertion (#2978)

This commit is contained in:
Darkere
2021-06-12 17:10:28 +02:00
committed by GitHub
parent e10f25938f
commit c4496c5702

View File

@@ -30,6 +30,7 @@ import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -67,6 +68,16 @@ public class CrafterNetworkNode extends NetworkNode implements ICraftingPatternC
public int getSlotLimit(int slot) {
return 1;
}
@Nonnull
@Override
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
if (!stacks.get(slot).isEmpty()) {
return stack;
}
return super.insertItem(slot, stack, simulate);
}
}
.addValidator(new PatternItemValidator(world))
.addListener(new NetworkNodeInventoryListener(this))