From 9e97a5caf5df83303514d16fa6052c71d7b1874a Mon Sep 17 00:00:00 2001 From: Boblet Date: Tue, 14 Dec 2021 16:12:03 +0100 Subject: [PATCH] some slight code refactoring, fun with enums --- .../com/hbm/blocks/generic/BlockBobble.java | 50 +++++----- .../recipes/CrystallizerRecipes.java | 5 + .../inventory/recipes/ShredderRecipes.java | 9 ++ .../java/com/hbm/items/ItemEnumMulti.java | 88 ++++++++++++++++++ src/main/java/com/hbm/items/ModItems.java | 13 +++ .../special/ItemCircuitStarComponent.java | 16 ++++ .../java/com/hbm/items/special/ItemHot.java | 87 +++++++++-------- .../hbm/items/special/ItemPlasticScrap.java | 43 +++++++++ .../java/com/hbm/main/CraftingManager.java | 37 ++++++++ src/main/java/com/hbm/util/EnumUtil.java | 10 ++ .../hbm/textures/items/scrap_plastic.png | Bin 0 -> 232 bytes 11 files changed, 289 insertions(+), 69 deletions(-) create mode 100644 src/main/java/com/hbm/items/ItemEnumMulti.java create mode 100644 src/main/java/com/hbm/items/special/ItemCircuitStarComponent.java create mode 100644 src/main/java/com/hbm/items/special/ItemPlasticScrap.java create mode 100644 src/main/java/com/hbm/util/EnumUtil.java create mode 100644 src/main/resources/assets/hbm/textures/items/scrap_plastic.png diff --git a/src/main/java/com/hbm/blocks/generic/BlockBobble.java b/src/main/java/com/hbm/blocks/generic/BlockBobble.java index 6e4509dbd..e11fa1e57 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockBobble.java +++ b/src/main/java/com/hbm/blocks/generic/BlockBobble.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Random; import com.hbm.items.ModItems; +import com.hbm.items.special.ItemPlasticScrap.ScrapType; import com.hbm.main.MainRegistry; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; @@ -154,43 +155,42 @@ public class BlockBobble extends BlockContainer { public static enum BobbleType { - NONE("null", "null", null, null, false), - //vault tec bobbleheads - STRENGTH("Strength", "Strength", null, "It's essential to give your arguments impact.", false), - PERCEPTION("Perception", "Perception", null, "Only through observation will you perceive weakness.", false), - ENDURANCE("Endurance", "Endurance", null, "Always be ready to take one for the team.", false), - CHARISMA("Charisma", "Charisma", null, "Nothing says pizzaz like a winning smile.", false), - INTELLIGENCE("Intelligence", "Intelligence", null, "It takes the smartest individuals to realize$there's always more to learn.", false), - AGILITY("Agility", "Agility", null, "Never be afraid to dodge the sensitive issues.", false), - LUCK("Luck", "Luck", null, "There's only one way to give 110%.", false), - //contributor bobbles - BOB("Robert \"The Bobcat\" Katzinsky", "HbMinecraft", "Hbm's Nuclear Tech Mod", "I know where you live, " + System.getProperty("user.name"), false), - FRIZZLE("Frooz", "Frooz", "Weapon models", "BLOOD IS FUEL", true), - PU238("Pu-238", "Pu-238", "Improved Tom impact mechanics", null, false), - VT("VT-6/24", "VT-6/24", "Balefire warhead model and general texturework", "You cannot unfuck a horse.", true), - DOC("The Doctor", "Doctor17PH", "Russian localization, lunar miner", "Perhaps the moon rocks were too expensive", true), - BLUEHAT("The Blue Hat", "The Blue Hat", "Textures", "there's a listening device in this bobblehead$don't touch it thanks", true), - PHEO("Pheo", "Pheonix", "Deuterium machines, tantalium textures, Reliant Rocket", "RUN TO THE BEDROOM, ON THE SUITCASE ON THE LEFT,$YOU'LL FIND MY FAVORITE AXE", true), - ADAM29("Adam29", "Adam29", "Ethanol, liquid petroleum gas", "You know, nukes are really quite beatiful.$It's like watching a star be born for a split second.", true), - UFFR("UFFR", "UFFR", "All sorts of things from his PR", "fried shrimp", false), - VAER("vaer", "vaer", "ZIRNOX", "taken de family out to the weekend cigarette festival", true), - NOS("Dr Nostalgia", "Dr Nostalgia", "SSG and Vortex models", "Take a picture, I'ma pose, paparazzi$I've been drinking, moving like a zombie", true), - DRILLGON("Drillgon200", "Drillgon200", "1.12 Port", null, false), - //testing garbage. why is she so dumb? - CIRNO("Cirno", "Cirno", "being a dumb ice fairy", "No brain. Head empty.", true); + NONE( "null", "null", null, null, false, ScrapType.BOARD_BLANK), + STRENGTH( "Strength", "Strength", null, "It's essential to give your arguments impact.", false, ScrapType.BRIDGE_BIOS), + PERCEPTION( "Perception", "Perception", null, "Only through observation will you perceive weakness.", false, ScrapType.BRIDGE_NORTH), + ENDURANCE( "Endurance", "Endurance", null, "Always be ready to take one for the team.", false, ScrapType.BRIDGE_SOUTH), + CHARISMA( "Charisma", "Charisma", null, "Nothing says pizzaz like a winning smile.", false, ScrapType.BRIDGE_IO), + INTELLIGENCE( "Intelligence", "Intelligence", null, "It takes the smartest individuals to realize$there's always more to learn.", false, ScrapType.BRIDGE_BUS), + AGILITY( "Agility", "Agility", null, "Never be afraid to dodge the sensitive issues.", false, ScrapType.BRIDGE_CHIPSET), + LUCK( "Luck", "Luck", null, "There's only one way to give 110%.", false, ScrapType.BRIDGE_CMOS), + BOB( "Robert \"The Bobcat\" Katzinsky", "HbMinecraft", "Hbm's Nuclear Tech Mod", "I know where you live, " + System.getProperty("user.name"), false, ScrapType.CPU_SOCKET), + FRIZZLE( "Frooz", "Frooz", "Weapon models", "BLOOD IS FUEL", true, ScrapType.CPU_CLOCK), + PU238( "Pu-238", "Pu-238", "Improved Tom impact mechanics", null, false, ScrapType.CPU_REGISTER), + VT( "VT-6/24", "VT-6/24", "Balefire warhead model and general texturework", "You cannot unfuck a horse.", true, ScrapType.CPU_EXT), + DOC( "The Doctor", "Doctor17PH", "Russian localization, lunar miner", "Perhaps the moon rocks were too expensive", true, ScrapType.CPU_CACHE), + BLUEHAT( "The Blue Hat", "The Blue Hat", "Textures", "there's a listening device in this bobblehead$don't touch it thanks", true, ScrapType.MEM_16K_A), + PHEO( "Pheo", "Pheonix", "Deuterium machines, tantalium textures, Reliant Rocket", "RUN TO THE BEDROOM, ON THE SUITCASE ON THE LEFT,$YOU'LL FIND MY FAVORITE AXE", true, ScrapType.MEM_16K_B), + ADAM29( "Adam29", "Adam29", "Ethanol, liquid petroleum gas", "You know, nukes are really quite beatiful.$It's like watching a star be born for a split second.", true, ScrapType.MEM_16K_C), + UFFR( "UFFR", "UFFR", "All sorts of things from his PR", "fried shrimp", false, ScrapType.MEM_SOCKET), + VAER( "vaer", "vaer", "ZIRNOX", "taken de family out to the weekend cigarette festival", true, ScrapType.MEM_16K_D), + NOS( "Dr Nostalgia", "Dr Nostalgia", "SSG and Vortex models", "Take a picture, I'ma pose, paparazzi$I've been drinking, moving like a zombie", true, ScrapType.BOARD_TRANSISTOR), + DRILLGON( "Drillgon200", "Drillgon200", "1.12 Port", null, false, ScrapType.CPU_LOGIC), + CIRNO( "Cirno", "Cirno", "being a dumb ice fairy", "No brain. Head empty.", true, ScrapType.BOARD_BLANK); public String name; //the title of the tooltip public String label; //the name engraved in the socket public String contribution; //what contributions this person has made, if applicable public String inscription; //the flavor text public boolean skinLayers; + public ScrapType scrap; - private BobbleType(String name, String label, String contribution, String inscription, boolean layers) { + private BobbleType(String name, String label, String contribution, String inscription, boolean layers, ScrapType scrap) { this.name = name; this.label = label; this.contribution = contribution; this.inscription = inscription; this.skinLayers = layers; + this.scrap = scrap; } } } diff --git a/src/main/java/com/hbm/inventory/recipes/CrystallizerRecipes.java b/src/main/java/com/hbm/inventory/recipes/CrystallizerRecipes.java index 62b22a3fb..425c76909 100644 --- a/src/main/java/com/hbm/inventory/recipes/CrystallizerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CrystallizerRecipes.java @@ -10,6 +10,7 @@ import com.hbm.blocks.ModBlocks; import com.hbm.handler.imc.IMCCrystallizer; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ModItems; +import com.hbm.items.special.ItemPlasticScrap.ScrapType; import com.hbm.main.MainRegistry; import net.minecraft.init.Blocks; @@ -79,6 +80,10 @@ public class CrystallizerRecipes { recipes.put(new ComparableStack(ModItems.powder_impure_osmiridium), new ItemStack(ModItems.crystal_osmiridium)); + for(int i = 0; i < ScrapType.values().length; i++) { + recipes.put(new ComparableStack(ModItems.scrap_plastic, 1, i), new ItemStack(ModItems.circuit_star_piece, 1, i)); + } + List quartz = OreDictionary.getOres("crystalCertusQuartz"); if(quartz != null && !quartz.isEmpty()) { diff --git a/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java b/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java index f57dfab0a..d136cd2f7 100644 --- a/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/ShredderRecipes.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.generic.BlockBobble.BobbleType; import com.hbm.interfaces.Untested; import com.hbm.inventory.RecipesCommon; import com.hbm.inventory.RecipesCommon.ComparableStack; @@ -302,6 +303,14 @@ public class ShredderRecipes { ShredderRecipes.setRecipe(new ItemStack(Blocks.wool, 1, i), new ItemStack(Items.string, 4)); } + /* + * Shredding bobbleheads + */ + for(int i = 0; i < BobbleType.values().length; i++) { + BobbleType type = BobbleType.values()[i]; + ShredderRecipes.setRecipe(new ItemStack(ModBlocks.bobblehead, 1, i), new ItemStack(ModItems.scrap_plastic, 1, type.scrap.ordinal())); + } + /* * GC COMPAT */ diff --git a/src/main/java/com/hbm/items/ItemEnumMulti.java b/src/main/java/com/hbm/items/ItemEnumMulti.java new file mode 100644 index 000000000..50e667ec1 --- /dev/null +++ b/src/main/java/com/hbm/items/ItemEnumMulti.java @@ -0,0 +1,88 @@ +package com.hbm.items; + +import java.util.List; + +import com.hbm.lib.RefStrings; +import com.hbm.util.EnumUtil; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; + +public class ItemEnumMulti extends Item { + + //hell yes, now we're thinking with enums! + private Class theEnum; + private boolean multiTexture; + + public ItemEnumMulti(Class theEnum, boolean multiTexture) { + this.setHasSubtypes(true); + this.theEnum = theEnum; + this.multiTexture = multiTexture; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List list) { + for(int i = 0; i < theEnum.getEnumConstants().length; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public Item setUnlocalizedName(String unlocalizedName) { + super.setUnlocalizedName(unlocalizedName); + this.setTextureName(RefStrings.MODID + ":"+ unlocalizedName); + return this; + } + + private IIcon[] icons; + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + + if(multiTexture) { + Enum[] enums = theEnum.getEnumConstants(); + this.icons = new IIcon[enums.length]; + + for(int i = 0; i < icons.length; i++) { + Enum num = enums[i]; + this.icons[i] = reg.registerIcon(this.getIconString() + "." + num.name().toLowerCase()); + } + } else { + this.itemIcon = reg.registerIcon(this.getIconString()); + } + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + + if(multiTexture) { + Enum[] enums = theEnum.getEnumConstants(); + Enum num = EnumUtil.grabEnumSafely(theEnum, meta); + return this.icons[num.ordinal()]; + } else { + return this.itemIcon; + } + } + + /* + * Returns null when the wrong enum is passed. Only really used for recipes anyway so it's good. + */ + public ItemStack stackFromEnum(int count, Enum num) { + + if(num.getClass() != this.theEnum) + return null; + + return new ItemStack(this, count, num.ordinal()); + } + + public ItemStack stackFromEnum(Enum num) { + return stackFromEnum(1, num); + } +} diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 0b0743a4e..2a4cda75c 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -15,6 +15,7 @@ import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.items.machine.ItemRBMKRod.EnumBurnFunc; import com.hbm.items.machine.ItemStamp.StampType; import com.hbm.items.special.*; +import com.hbm.items.special.ItemPlasticScrap.ScrapType; import com.hbm.items.tool.*; import com.hbm.items.tool.ItemToolAbility.EnumToolType; import com.hbm.items.weapon.*; @@ -506,6 +507,9 @@ public class ModItems { public static Item circuit_bismuth; public static Item circuit_tantalium_raw; public static Item circuit_tantalium; + public static ItemEnumMulti circuit_star_piece; + public static ItemEnumMulti circuit_star_component; + public static Item circuit_star; public static Item mechanism_revolver_1; public static Item mechanism_revolver_2; @@ -1137,6 +1141,7 @@ public class ModItems { public static ItemRBMKPellet rbmk_pellet_zfb_am_mix; public static ItemRBMKPellet rbmk_pellet_drx; + public static Item scrap_plastic; public static Item scrap; public static Item scrap_nuclear; public static Item trinitite; @@ -3058,6 +3063,9 @@ public class ModItems { circuit_bismuth = new ItemCustomLore().setRarity(EnumRarity.uncommon).setUnlocalizedName("circuit_bismuth").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":circuit_bismuth"); circuit_tantalium_raw = new Item().setUnlocalizedName("circuit_tantalium_raw").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":circuit_tantalium_raw"); circuit_tantalium = new ItemCustomLore().setRarity(EnumRarity.uncommon).setUnlocalizedName("circuit_tantalium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":circuit_tantalium"); + circuit_star_piece = (ItemEnumMulti) new ItemEnumMulti(ScrapType.class, true).setUnlocalizedName("circuit_star_piece").setCreativeTab(null); + circuit_star_component = (ItemEnumMulti) new ItemCircuitStarComponent().setUnlocalizedName("circuit_star_component").setCreativeTab(null); + circuit_star = new ItemCustomLore().setRarity(EnumRarity.uncommon).setUnlocalizedName("circuit_star").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":circuit_star"); circuit_targeting_tier1 = new Item().setUnlocalizedName("circuit_targeting_tier1").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":circuit_targeting_tier1"); circuit_targeting_tier2 = new Item().setUnlocalizedName("circuit_targeting_tier2").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":circuit_targeting_tier2"); circuit_targeting_tier3 = new Item().setUnlocalizedName("circuit_targeting_tier3").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":circuit_targeting_tier3"); @@ -3862,6 +3870,7 @@ public class ModItems { nuclear_waste_tiny = new ItemNuclearWaste().setUnlocalizedName("nuclear_waste_tiny").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_tiny"); nuclear_waste_vitrified = new ItemNuclearWaste().setUnlocalizedName("nuclear_waste_vitrified").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_vitrified"); nuclear_waste_vitrified_tiny = new ItemNuclearWaste().setUnlocalizedName("nuclear_waste_vitrified_tiny").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_vitrified_tiny"); + scrap_plastic = new ItemPlasticScrap().setUnlocalizedName("scrap_plastic").setTextureName(RefStrings.MODID + ":scrap_plastic"); scrap = new Item().setUnlocalizedName("scrap").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":scrap"); scrap_nuclear = new Item().setUnlocalizedName("scrap_nuclear").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":scrap_nuclear"); containment_box = new ItemLeadBox().setUnlocalizedName("containment_box").setCreativeTab(null).setTextureName(RefStrings.MODID + ":containment_box"); @@ -6121,6 +6130,9 @@ public class ModItems { GameRegistry.registerItem(circuit_bismuth, circuit_bismuth.getUnlocalizedName()); GameRegistry.registerItem(circuit_tantalium_raw, circuit_tantalium_raw.getUnlocalizedName()); GameRegistry.registerItem(circuit_tantalium, circuit_tantalium.getUnlocalizedName()); + GameRegistry.registerItem(circuit_star_piece, circuit_star_piece.getUnlocalizedName()); + GameRegistry.registerItem(circuit_star_component, circuit_star_component.getUnlocalizedName()); + GameRegistry.registerItem(circuit_star, circuit_star.getUnlocalizedName()); //Military Circuits GameRegistry.registerItem(circuit_targeting_tier1, circuit_targeting_tier1.getUnlocalizedName()); @@ -6805,6 +6817,7 @@ public class ModItems { GameRegistry.registerItem(debris_element, debris_element.getUnlocalizedName()); GameRegistry.registerItem(undefined, undefined.getUnlocalizedName()); + GameRegistry.registerItem(scrap_plastic, scrap_plastic.getUnlocalizedName()); GameRegistry.registerItem(scrap, scrap.getUnlocalizedName()); GameRegistry.registerItem(scrap_nuclear, scrap_nuclear.getUnlocalizedName()); GameRegistry.registerItem(trinitite, trinitite.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/special/ItemCircuitStarComponent.java b/src/main/java/com/hbm/items/special/ItemCircuitStarComponent.java new file mode 100644 index 000000000..dd931b41e --- /dev/null +++ b/src/main/java/com/hbm/items/special/ItemCircuitStarComponent.java @@ -0,0 +1,16 @@ +package com.hbm.items.special; + +import com.hbm.items.ItemEnumMulti; + +public class ItemCircuitStarComponent extends ItemEnumMulti { + + public ItemCircuitStarComponent() { + super(CircuitComponentType.class, true); + } + + public static enum CircuitComponentType { + CHIPSET, + CPU, + RAM + } +} diff --git a/src/main/java/com/hbm/items/special/ItemHot.java b/src/main/java/com/hbm/items/special/ItemHot.java index c029482a5..50546b618 100644 --- a/src/main/java/com/hbm/items/special/ItemHot.java +++ b/src/main/java/com/hbm/items/special/ItemHot.java @@ -12,77 +12,76 @@ import net.minecraft.world.World; public class ItemHot extends Item { - @SideOnly(Side.CLIENT) - public IIcon hotIcon; + @SideOnly(Side.CLIENT) + public IIcon hotIcon; protected static int heat; - + public ItemHot(int heat) { - this.heat = heat; } - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister reg) { - super.registerIcons(reg); - this.hotIcon = reg.registerIcon(this.getIconString() + "_hot"); - } - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) { - return this.itemIcon; - } - - public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean bool) { - - if(!world.isRemote && stack.hasTagCompound()) { - - int h = stack.stackTagCompound.getInteger("heat"); - - if(h > 0) { - stack.stackTagCompound.setInteger("heat", h - 1); - } else { - stack.stackTagCompound = null; - } - } - } - + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + super.registerIcons(reg); + this.hotIcon = reg.registerIcon(this.getIconString() + "_hot"); + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + return this.itemIcon; + } + + public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean bool) { + + if(!world.isRemote && stack.hasTagCompound()) { + + int h = stack.stackTagCompound.getInteger("heat"); + + if(h > 0) { + stack.stackTagCompound.setInteger("heat", h - 1); + } else { + stack.stackTagCompound = null; + } + } + } + public static ItemStack heatUp(ItemStack stack) { - + if(!(stack.getItem() instanceof ItemHot)) return stack; - + if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); - + stack.stackTagCompound.setInteger("heat", getMaxHeat(stack)); return stack; } - + public static ItemStack heatUp(ItemStack stack, double d) { - + if(!(stack.getItem() instanceof ItemHot)) return stack; - + if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); - - stack.stackTagCompound.setInteger("heat", (int)(d * getMaxHeat(stack))); + + stack.stackTagCompound.setInteger("heat", (int) (d * getMaxHeat(stack))); return stack; } - + public static double getHeat(ItemStack stack) { - + if(!(stack.getItem() instanceof ItemHot)) return 0; - + if(!stack.hasTagCompound()) return 0; - + int h = stack.stackTagCompound.getInteger("heat"); - - return (double)h / (double)heat; + + return (double) h / (double) heat; } - + public static int getMaxHeat(ItemStack stack) { return heat; } diff --git a/src/main/java/com/hbm/items/special/ItemPlasticScrap.java b/src/main/java/com/hbm/items/special/ItemPlasticScrap.java new file mode 100644 index 000000000..312cae5dc --- /dev/null +++ b/src/main/java/com/hbm/items/special/ItemPlasticScrap.java @@ -0,0 +1,43 @@ +package com.hbm.items.special; + +import com.hbm.items.ItemEnumMulti; + +import net.minecraft.item.Item; + +public class ItemPlasticScrap extends ItemEnumMulti { + + public ItemPlasticScrap() { + super(ScrapType.class, false); + this.setCreativeTab(null); + } + + public static enum ScrapType { + //GENERAL BOARD + BOARD_BLANK, + BOARD_TRANSISTOR, + + //CHIPSET + BRIDGE_NORTH, + BRIDGE_SOUTH, + BRIDGE_IO, + BRIDGE_BUS, + BRIDGE_CHIPSET, + BRIDGE_CMOS, + BRIDGE_BIOS, + + //CPU + CPU_REGISTER, + CPU_CLOCK, + CPU_LOGIC, + CPU_CACHE, + CPU_EXT, + CPU_SOCKET, + + //RAM + MEM_SOCKET, + MEM_16K_A, + MEM_16K_B, + MEM_16K_C, + MEM_16K_D + } +} diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index ced36f665..79aebfa06 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -13,6 +13,8 @@ import com.hbm.inventory.OreDictManager; import static com.hbm.inventory.OreDictManager.*; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemBattery; +import com.hbm.items.special.ItemCircuitStarComponent.CircuitComponentType; +import com.hbm.items.special.ItemPlasticScrap.ScrapType; import com.hbm.util.EnchantmentUtil; import net.minecraft.block.Block; @@ -881,6 +883,41 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.rbmk_boiler, 1), new Object[] { "CPC", "CRC", "CPC", 'C', ModItems.board_copper, 'P', ModItems.pipes_steel, 'R', ModBlocks.rbmk_blank }); addRecipeAuto(new ItemStack(ModBlocks.rbmk_cooler, 1), new Object[] { "IGI", "GCG", "IGI", 'C', ModBlocks.rbmk_blank, 'I', ModItems.plate_polymer, 'G', ModBlocks.steel_grate }); } + + addShapelessAuto(ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.CHIPSET), new Object[] { + ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_BIOS), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_BUS), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_CHIPSET), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_CMOS), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_IO), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_NORTH), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_SOUTH) + }); + + addShapelessAuto(ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.CPU), new Object[] { + ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_CACHE), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_CLOCK), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_EXT), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_LOGIC), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_REGISTER), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_SOCKET) + }); + + addShapelessAuto(ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.RAM), new Object[] { + ModItems.circuit_star_piece.stackFromEnum(ScrapType.MEM_SOCKET), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.MEM_16K_A), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.MEM_16K_B), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.MEM_16K_C), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.MEM_16K_D) + }); + + addShapelessAuto(new ItemStack(ModItems.circuit_star), new Object[] { + ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.CHIPSET), + ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.CPU), + ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.RAM), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.BOARD_TRANSISTOR), + ModItems.circuit_star_piece.stackFromEnum(ScrapType.BOARD_BLANK) + }); } public static void crumple() { diff --git a/src/main/java/com/hbm/util/EnumUtil.java b/src/main/java/com/hbm/util/EnumUtil.java new file mode 100644 index 000000000..9b5eb3668 --- /dev/null +++ b/src/main/java/com/hbm/util/EnumUtil.java @@ -0,0 +1,10 @@ +package com.hbm.util; + +public class EnumUtil { + + public static T grabEnumSafely(Class theEnum, int index) { + Enum[] values = theEnum.getEnumConstants(); + index = Math.abs(index % values.length); + return (T)values[index]; + } +} diff --git a/src/main/resources/assets/hbm/textures/items/scrap_plastic.png b/src/main/resources/assets/hbm/textures/items/scrap_plastic.png new file mode 100644 index 0000000000000000000000000000000000000000..2922bab2f4bba29cc64e04bd51a460ada024b07e GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfcfYmW{oC-&e1VBa&pg(zkvYyY dkKx-k`>R!RG}dgI;0AOmgQu&X%Q~loCIB%URy6