mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-11 16:07:38 +00:00
updateBuildScript (#895)
This commit is contained in:
1 parent
1eaaac94bc
commit
ecdf7892ce
8 files changed
+33
-26
No files matched your search
@@ -98,10 +98,14 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
&& presenceOverlay(firstGui, handler, recipeIndex).stream().allMatch(state -> state.isPresent());
|
||||
}
|
||||
|
||||
protected Slot getCraftingResultSlot(GuiContainer gui) {
|
||||
return gui.inventorySlots.inventorySlots.stream().filter(slot -> slot instanceof SlotCrafting).findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean craft(GuiContainer firstGui, IRecipeHandler handler, int recipeIndex, int multiplier) {
|
||||
final Slot craftingSlot = firstGui.inventorySlots.inventorySlots.stream()
|
||||
.filter(slot -> slot instanceof SlotCrafting).findFirst().orElse(null);
|
||||
final Slot craftingSlot = getCraftingResultSlot(firstGui);
|
||||
|
||||
if (craftingSlot == null) {
|
||||
return false;
|
||||
@@ -145,7 +149,7 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
|
||||
/**
|
||||
* Gets the slots in the crafting matrix for the given GUI and recipe handler.
|
||||
*
|
||||
*
|
||||
* @param gui
|
||||
* @param handler
|
||||
* @return
|
||||
@@ -194,9 +198,10 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
}
|
||||
|
||||
private void moveIngredients(GuiContainer gui, List<IngredientDistribution> assignedIngredients, int multiplier) {
|
||||
final Slot craftingSlot = getCraftingResultSlot(gui);
|
||||
|
||||
for (Slot slot : gui.inventorySlots.inventorySlots) {
|
||||
if (slot instanceof SlotCrafting || !slot.getHasStack()
|
||||
if (slot == craftingSlot || !slot.getHasStack()
|
||||
|| !canMoveFrom(slot, gui)
|
||||
|| !slot.canTakeStack(gui.mc.thePlayer))
|
||||
continue;
|
||||
@@ -422,8 +427,8 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean canStack(ItemStack stack1, ItemStack stack2) {
|
||||
if (stack1 == null || stack2 == null) return true;
|
||||
return NEIClientUtils.areStacksSameTypeCraftingWithNBT(stack1, stack2);
|
||||
protected boolean canStack(ItemStack dst, ItemStack src) {
|
||||
if (dst == null || src == null) return true;
|
||||
return NEIClientUtils.areStacksSameTypeCraftingWithNBT(dst, src);
|
||||
}
|
||||
}
|
||||
@@ -96,10 +96,11 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
super(handlerRef, x, y, handlerRef.recipeIndex + BUTTON_ID_SHIFT, "+");
|
||||
this.firstGui = firstGui != null && firstGui.inventorySlots != null ? firstGui : null;
|
||||
|
||||
this.canUseOverlayRenderer = this.firstGui != null && handlerRef.getRecipeOverlayRenderer(firstGui) != null;
|
||||
this.canFillCraftingGrid = this.firstGui != null && this.handlerRef.canFillCraftingGrid(this.firstGui);
|
||||
this.hasOverlay = this.canUseOverlayRenderer
|
||||
|| this.firstGui != null && handlerRef.getOverlayHandler(firstGui) != null;
|
||||
if (this.firstGui != null) {
|
||||
this.canUseOverlayRenderer = this.handlerRef.getRecipeOverlayRenderer(this.firstGui) != null;
|
||||
this.canFillCraftingGrid = this.handlerRef.canFillCraftingGrid(this.firstGui);
|
||||
this.hasOverlay = this.canUseOverlayRenderer || this.handlerRef.getOverlayHandler(this.firstGui) != null;
|
||||
}
|
||||
|
||||
setRequireShiftForOverlayRecipe(NEIClientConfig.requireShiftForOverlayRecipe());
|
||||
ingredientsOverlay();
|
||||
|
||||
@@ -588,6 +588,7 @@ public class NEIRecipeWidget extends Widget {
|
||||
private void updatePermutationsFor(PositionedStack pStack) {
|
||||
List<ItemStack> perms = this.permutations.get(pStack);
|
||||
int favoriteIndex = this.favoriteIndexes.getOrDefault(pStack, -1);
|
||||
boolean needsUpdate = false;
|
||||
|
||||
if (perms == null) {
|
||||
perms = pStack.getFilteredPermutations();
|
||||
@@ -602,10 +603,10 @@ public class NEIRecipeWidget extends Widget {
|
||||
|
||||
this.permutations.put(pStack, perms);
|
||||
this.favoriteIndexes.put(pStack, favoriteIndex);
|
||||
pStack.setPermutationToRender(perms.get(0));
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
if (perms.size() > 1) {
|
||||
if (perms.size() > 1 || needsUpdate) {
|
||||
final int size = favoriteIndex != -1 ? favoriteIndex + 1 : perms.size();
|
||||
|
||||
if (size > 0) {
|
||||
|
||||
Reference in new issue
Block a user