You can now re-insert a Pattern in the pattern output slot in the Pattern Grid to modify an existing pattern

This commit is contained in:
raoulvdberge
2017-11-04 19:12:46 +01:00
parent 8b0d2255ad
commit 18b4fbe358
4 changed files with 16 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
### 1.5.22 ### 1.5.22
- Added oredict, blocking, processing, ore inputs access to OpenComputers API (raoulvdberge) - Added oredict, blocking, processing, ore inputs access to OpenComputers API (raoulvdberge)
- The Crafter can now only store 1 stack size pattern per slot (raoulvdberge) - The Crafter can now only store 1 stack size pattern per slot (raoulvdberge)
- You can now re-insert a Pattern in the pattern output slot in the Pattern Grid to modify an existing pattern (raoulvdberge)
- Fixed not being able to use JEI R and U keys on Grid with tabs (raoulvdberge) - Fixed not being able to use JEI R and U keys on Grid with tabs (raoulvdberge)
### 1.5.21 ### 1.5.21

View File

@@ -39,7 +39,6 @@ import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.wrapper.CombinedInvWrapper; import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import net.minecraftforge.items.wrapper.InvWrapper; import net.minecraftforge.items.wrapper.InvWrapper;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -74,10 +73,20 @@ public class NetworkNodeGrid extends NetworkNode implements IGrid {
private ItemHandlerBase matrixProcessing = new ItemHandlerBase(9 * 2, new ItemHandlerListenerNetworkNode(this)); private ItemHandlerBase matrixProcessing = new ItemHandlerBase(9 * 2, new ItemHandlerListenerNetworkNode(this));
private ItemHandlerBase patterns = new ItemHandlerBase(2, new ItemHandlerListenerNetworkNode(this), new ItemValidatorBasic(RSItems.PATTERN)) { private ItemHandlerBase patterns = new ItemHandlerBase(2, new ItemHandlerListenerNetworkNode(this), new ItemValidatorBasic(RSItems.PATTERN)) {
@Nonnull
@Override @Override
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { protected void onContentsChanged(int slot) {
return slot == 0 ? super.insertItem(slot, stack, simulate) : stack; super.onContentsChanged(slot);
if (slot == 1 && !processingPattern && !getStackInSlot(slot).isEmpty()) {
for (int i = 0; i < 9; ++i) {
matrix.setInventorySlotContents(i, StackUtils.nullToEmpty(ItemPattern.getSlot(getStackInSlot(slot), i)));
}
}
}
@Override
public int getSlotLimit(int slot) {
return slot == 1 ? 1 : super.getSlotLimit(slot);
} }
}; };
private List<IFilter> filters = new ArrayList<>(); private List<IFilter> filters = new ArrayList<>();

View File

@@ -61,7 +61,7 @@ public class ContainerGrid extends ContainerBase {
if (grid.getType() == GridType.PATTERN) { if (grid.getType() == GridType.PATTERN) {
addSlotToContainer(new SlotItemHandler(((NetworkNodeGrid) grid).getPatterns(), 0, 172, headerAndSlots + 4)); addSlotToContainer(new SlotItemHandler(((NetworkNodeGrid) grid).getPatterns(), 0, 172, headerAndSlots + 4));
addSlotToContainer(new SlotOutput(((NetworkNodeGrid) grid).getPatterns(), 1, 172, headerAndSlots + 40)); addSlotToContainer(new SlotItemHandler(((NetworkNodeGrid) grid).getPatterns(), 1, 172, headerAndSlots + 40));
} }
if (grid instanceof IPortableGrid) { if (grid instanceof IPortableGrid) {

View File

@@ -88,6 +88,7 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
pattern.getTagCompound().setTag(String.format(NBT_SLOT, slot), stack.serializeNBT()); pattern.getTagCompound().setTag(String.format(NBT_SLOT, slot), stack.serializeNBT());
} }
@Nullable
public static ItemStack getSlot(ItemStack pattern, int slot) { public static ItemStack getSlot(ItemStack pattern, int slot) {
String id = String.format(NBT_SLOT, slot); String id = String.format(NBT_SLOT, slot);