From a7fd72f76fc4796db6c1f9e6866b5d30edc1ea01 Mon Sep 17 00:00:00 2001 From: Vaern Date: Thu, 10 Mar 2022 17:10:37 -0800 Subject: [PATCH] Preliminary stuff gonna have to make a gui and do packet fuckery for this, shouldn't be too hard --- .../com/hbm/inventory/OreDictManager.java | 6 ++- .../inventory/recipes/CustomNukeRecipes.java | 23 ++++++++++- .../TileEntityCustomPartAssembler.java | 38 ++++++++++++++++--- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/hbm/inventory/OreDictManager.java b/src/main/java/com/hbm/inventory/OreDictManager.java index e7378d2cf..994771b2c 100644 --- a/src/main/java/com/hbm/inventory/OreDictManager.java +++ b/src/main/java/com/hbm/inventory/OreDictManager.java @@ -490,7 +490,11 @@ public class OreDictManager { public DictFrame(String... mats) { this.mats = mats; } - + + public String[] getMaterials() { + return this.mats; + } + /* * Quick access methods to grab ore names for recipes. */ diff --git a/src/main/java/com/hbm/inventory/recipes/CustomNukeRecipes.java b/src/main/java/com/hbm/inventory/recipes/CustomNukeRecipes.java index 977617081..1994dc23b 100644 --- a/src/main/java/com/hbm/inventory/recipes/CustomNukeRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CustomNukeRecipes.java @@ -22,8 +22,29 @@ public class CustomNukeRecipes { } } + /** + * Checks if the OreDict key fits the material, but not the form + * @param frame DictFrame + * @param key Input key + */ private static boolean containsMatch(DictFrame frame, String key) { - String[] mats = frame.anys(); + String[] mats = frame.getMaterials(); + + for(String mat : mats) { + if(key.contains(mat)) { + return true; + } + } + + return false; + } + + /** + * Checks if the OreDict key fits the material and the form thereof. + * @param mats Ore names + * @param key Input key + */ + private static boolean containsMatch(String[] mats, String key) { for(String mat : mats) { if(mat.contains(key)) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCustomPartAssembler.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCustomPartAssembler.java index e9508d324..60073a416 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCustomPartAssembler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCustomPartAssembler.java @@ -3,13 +3,18 @@ package com.hbm.tileentity.machine; import com.hbm.tileentity.TileEntityMachineBase; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; public class TileEntityCustomPartAssembler extends TileEntityMachineBase { - private static final int[] slot_io = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + //Save the item and the mode for automation purposes + public byte item; + public byte mode; + + private static final int[] slot_io = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; public TileEntityCustomPartAssembler() { - super(13); //12 input, 1 output + super(17); //16 input, 1 output } @Override @@ -19,7 +24,7 @@ public class TileEntityCustomPartAssembler extends TileEntityMachineBase { @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { - return i <= 11; + return i <= 15; } @Override @@ -29,14 +34,35 @@ public class TileEntityCustomPartAssembler extends TileEntityMachineBase { @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { - return i == 12; + return i == 16; } - + @Override public void updateEntity() { - + /* + * String troll = "trolling"; + * + * System.Console.WriteLine($"We do a little bit of {troll}!"); + */ } + @Override + public boolean canUpdate() { + return false; + } + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + item = nbt.getByte("item"); + mode = nbt.getByte("mode"); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setByte("item", item); + nbt.setByte("mode", mode); + } }