-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash with assembler, closes #6093
- Loading branch information
Showing
6 changed files
with
67 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/blusunrize/immersiveengineering/common/util/InventoryCraftingFalse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* BluSunrize | ||
* Copyright (c) 2024 | ||
* | ||
* This code is licensed under "Blu's License of Common Sense" | ||
* Details can be found in the license file in the root folder of this project | ||
*/ | ||
|
||
package blusunrize.immersiveengineering.common.util; | ||
|
||
import net.minecraft.world.Container; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.inventory.AbstractContainerMenu; | ||
import net.minecraft.world.inventory.CraftingContainer; | ||
import net.minecraft.world.inventory.MenuType; | ||
import net.minecraft.world.inventory.TransientCraftingContainer; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.crafting.CraftingInput; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.List; | ||
|
||
public class InventoryCraftingFalse | ||
{ | ||
private static final AbstractContainerMenu NULL_CONTAINER = new AbstractContainerMenu(MenuType.CRAFTING, 0) | ||
{ | ||
@Override | ||
public ItemStack quickMoveStack(Player p_38941_, int p_38942_) | ||
{ | ||
return ItemStack.EMPTY; | ||
} | ||
|
||
@Override | ||
public void slotsChanged(Container paramIInventory) | ||
{ | ||
} | ||
|
||
@Override | ||
public boolean stillValid(@Nonnull Player playerIn) | ||
{ | ||
return false; | ||
} | ||
}; | ||
|
||
public static CraftingInput createFilledCraftingInventory(int w, int h, List<ItemStack> stacks) | ||
{ | ||
CraftingContainer invC = new TransientCraftingContainer(NULL_CONTAINER, w, h); | ||
for(int j = 0; j < w*h; j++) | ||
if(!stacks.get(j).isEmpty()) | ||
invC.setItem(j, stacks.get(j).copy()); | ||
return invC.asCraftInput(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters