mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
toolbox, desh hand tools
This commit is contained in:
parent
481e28f68b
commit
f127621093
@ -0,0 +1,62 @@
|
||||
package com.hbm.crafting.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemKitNBT;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ToolboxCraftingHandler implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
|
||||
int itemCount = 0;
|
||||
int kitCount = 0;
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack stack = inventory.getStackInRowAndColumn(i % 3, i / 3);
|
||||
|
||||
if(stack != null) {
|
||||
itemCount++;
|
||||
|
||||
if(stack.getItem() == ModItems.kit_toolbox_empty) {
|
||||
kitCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemCount > 1 && kitCount == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
|
||||
List<ItemStack> stacks = new ArrayList();
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack stack = inventory.getStackInRowAndColumn(i % 3, i / 3);
|
||||
|
||||
if(stack != null) {
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
return ItemKitNBT.create(stacks.toArray(new ItemStack[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return new ItemStack(ModItems.kit_toolbox);
|
||||
}
|
||||
}
|
||||
@ -1863,7 +1863,11 @@ public class ModItems {
|
||||
public static Item redcoil_capacitor;
|
||||
public static Item titanium_filter;
|
||||
public static Item screwdriver;
|
||||
public static Item screwdriver_desh;
|
||||
public static Item hand_drill;
|
||||
public static Item hand_drill_desh;
|
||||
public static Item chemistry_set;
|
||||
public static Item chemistry_set_boron;
|
||||
public static Item overfuse;
|
||||
public static Item arc_electrode;
|
||||
public static Item arc_electrode_burnt;
|
||||
@ -2274,6 +2278,8 @@ public class ModItems {
|
||||
public static Item hazmat_red_kit;
|
||||
public static Item hazmat_grey_kit;
|
||||
public static Item kit_custom;
|
||||
public static Item kit_toolbox_empty;
|
||||
public static Item kit_toolbox;
|
||||
|
||||
public static Item loot_10;
|
||||
public static Item loot_15;
|
||||
@ -4516,8 +4522,12 @@ public class ModItems {
|
||||
fuse = new ItemCustomLore().setUnlocalizedName("fuse").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fuse");
|
||||
redcoil_capacitor = new ItemCapacitor(10).setUnlocalizedName("redcoil_capacitor").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":redcoil_capacitor");
|
||||
titanium_filter = new ItemCapacitor(6 * 60 * 60 * 20).setUnlocalizedName("titanium_filter").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":titanium_filter");
|
||||
screwdriver = new ItemTooling(ToolType.SCREWDRIVER, 100).setUnlocalizedName("screwdriver").setTextureName(RefStrings.MODID + ":screwdriver");
|
||||
hand_drill = new ItemTooling(ToolType.HAND_DRILL, 100).setUnlocalizedName("hand_drill").setTextureName(RefStrings.MODID + ":hand_drill");
|
||||
screwdriver = new ItemTooling(ToolType.SCREWDRIVER, 100).setUnlocalizedName("screwdriver");
|
||||
screwdriver_desh = new ItemTooling(ToolType.SCREWDRIVER, 0).setUnlocalizedName("screwdriver_desh");
|
||||
hand_drill = new ItemTooling(ToolType.HAND_DRILL, 100).setUnlocalizedName("hand_drill");
|
||||
hand_drill_desh = new ItemTooling(ToolType.HAND_DRILL, 0).setUnlocalizedName("hand_drill_desh");
|
||||
chemistry_set = new ItemCraftingDegradation(100).setUnlocalizedName("chemistry_set");
|
||||
chemistry_set_boron = new ItemCraftingDegradation(0).setUnlocalizedName("chemistry_set_boron");
|
||||
overfuse = new ItemCustomLore().setUnlocalizedName("overfuse").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":overfuse");
|
||||
arc_electrode = new ItemCustomLore().setUnlocalizedName("arc_electrode").setMaxDamage(250).setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode");
|
||||
arc_electrode_burnt = new Item().setUnlocalizedName("arc_electrode_burnt").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode_burnt");
|
||||
@ -4607,7 +4617,9 @@ public class ModItems {
|
||||
hazmat_kit = new ItemStarterKit().setUnlocalizedName("hazmat_kit").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":hazmat_kit");
|
||||
hazmat_red_kit = new ItemStarterKit().setUnlocalizedName("hazmat_red_kit").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":hazmat_red_kit");
|
||||
hazmat_grey_kit = new ItemStarterKit().setUnlocalizedName("hazmat_grey_kit").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":hazmat_grey_kit");
|
||||
kit_custom = new ItemKitCustom().setUnlocalizedName("kit_custom").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit");
|
||||
kit_custom = new ItemKitCustom().setUnlocalizedName("kit_custom").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit");
|
||||
kit_toolbox_empty = new Item().setUnlocalizedName("kit_toolbox_empty").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit_toolbox_empty");
|
||||
kit_toolbox = new ItemKitNBT().setUnlocalizedName("kit_toolbox").setCreativeTab(MainRegistry.consumableTab).setContainerItem(kit_toolbox_empty).setTextureName(RefStrings.MODID + ":kit_toolbox");
|
||||
|
||||
loot_10 = new ItemLootCrate().setUnlocalizedName("loot_10").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":loot_10");
|
||||
loot_15 = new ItemLootCrate().setUnlocalizedName("loot_15").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":loot_15");
|
||||
@ -6473,7 +6485,11 @@ public class ModItems {
|
||||
GameRegistry.registerItem(redcoil_capacitor, redcoil_capacitor.getUnlocalizedName());
|
||||
GameRegistry.registerItem(titanium_filter, titanium_filter.getUnlocalizedName());
|
||||
GameRegistry.registerItem(screwdriver, screwdriver.getUnlocalizedName());
|
||||
GameRegistry.registerItem(screwdriver_desh, screwdriver_desh.getUnlocalizedName());
|
||||
GameRegistry.registerItem(hand_drill, hand_drill.getUnlocalizedName());
|
||||
GameRegistry.registerItem(hand_drill_desh, hand_drill_desh.getUnlocalizedName());
|
||||
GameRegistry.registerItem(chemistry_set, chemistry_set.getUnlocalizedName());
|
||||
GameRegistry.registerItem(chemistry_set_boron, chemistry_set_boron.getUnlocalizedName());
|
||||
GameRegistry.registerItem(overfuse, overfuse.getUnlocalizedName());
|
||||
GameRegistry.registerItem(arc_electrode, arc_electrode.getUnlocalizedName());
|
||||
GameRegistry.registerItem(arc_electrode_burnt, arc_electrode_burnt.getUnlocalizedName());
|
||||
|
||||
@ -14,32 +14,13 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemKitCustom extends Item {
|
||||
public class ItemKitCustom extends ItemKitNBT {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon overlay1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon overlay2;
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(stack);
|
||||
|
||||
if(stacks != null) {
|
||||
|
||||
for(ItemStack item : stacks) {
|
||||
if(item != null) {
|
||||
player.inventory.addItemStackToInventory(item.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stack.stackSize--;
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderPasses(int metadata) {
|
||||
|
||||
51
src/main/java/com/hbm/items/special/ItemKitNBT.java
Normal file
51
src/main/java/com/hbm/items/special/ItemKitNBT.java
Normal file
@ -0,0 +1,51 @@
|
||||
package com.hbm.items.special;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemKitNBT extends Item {
|
||||
|
||||
public ItemKitNBT() {
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(stack);
|
||||
|
||||
if(stacks != null) {
|
||||
|
||||
for(ItemStack item : stacks) {
|
||||
if(item != null) {
|
||||
player.inventory.addItemStackToInventory(item.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack container = stack.getItem().getContainerItem(stack);
|
||||
|
||||
if(container != null) {
|
||||
player.inventory.addItemStackToInventory(container.copy());
|
||||
}
|
||||
|
||||
stack.stackSize--;
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack create(ItemStack... contents) {
|
||||
ItemStack stack = new ItemStack(ModItems.kit_custom);
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
ItemStackUtil.addStacksToNBT(stack, contents);
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemCraftingDegradation extends Item {
|
||||
|
||||
public ItemCraftingDegradation(int durability) {
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(durability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack stack) {
|
||||
if(this.getMaxDamage() > 0) {
|
||||
stack.setItemDamage(stack.getItemDamage() + 1);
|
||||
return stack;
|
||||
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item setUnlocalizedName(String unlocalizedName) {
|
||||
super.setUnlocalizedName(unlocalizedName);
|
||||
this.setTextureName(RefStrings.MODID + ":"+ unlocalizedName);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -10,16 +10,15 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemTooling extends Item {
|
||||
public class ItemTooling extends ItemCraftingDegradation {
|
||||
|
||||
ToolType type;
|
||||
|
||||
public ItemTooling(ToolType type, int durability) {
|
||||
super(durability);
|
||||
this.type = type;
|
||||
this.setMaxStackSize(1);
|
||||
this.setFull3D();
|
||||
this.setCreativeTab(MainRegistry.controlTab);
|
||||
this.setMaxDamage(durability);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -51,9 +51,11 @@ public class CraftingManager {
|
||||
|
||||
GameRegistry.addRecipe(new RBMKFuelCraftingHandler());
|
||||
GameRegistry.addRecipe(new MKUCraftingHandler());
|
||||
GameRegistry.addRecipe(new ToolboxCraftingHandler());
|
||||
|
||||
//TODO: find out what this actually did
|
||||
RecipeSorter.register("hbm:rbmk", RBMKFuelCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
||||
RecipeSorter.register("hbm:toolbox", ToolboxCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
||||
RecipeSorter.register("hbm:mku", MKUCraftingHandler.class, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless");
|
||||
}
|
||||
|
||||
@ -293,8 +295,8 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(ModItems.crystal_xen, 1), new Object[] { "EEE", "EIE", "EEE", 'E', ModItems.powder_power, 'I', EUPH.ingot() });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModItems.screwdriver, 1), new Object[] { " I", " I ", "S ", 'S', STEEL.ingot(), 'I', IRON.ingot() });
|
||||
addShapelessAuto(new ItemStack(ModItems.overfuse, 1), new Object[] { ModItems.screwdriver, NP237.dust(), I.dust(), TH232.dust(), AT.dust(), ND.dust(), ModItems.board_copper, ModItems.black_hole, CS.dust() });
|
||||
addShapelessAuto(new ItemStack(ModItems.overfuse, 1), new Object[] { ModItems.screwdriver, ST.dust(), BR.dust(), CO.dust(), TS.dust(), NB.dust(), ModItems.board_copper, ModItems.black_hole, CE.dust() });
|
||||
addShapelessAuto(new ItemStack(ModItems.overfuse, 1), new Object[] { ModItems.bolt_tungsten, NP237.dust(), I.dust(), TH232.dust(), AT.dust(), ND.dust(), ModItems.board_copper, ModItems.black_hole, CS.dust() });
|
||||
addShapelessAuto(new ItemStack(ModItems.overfuse, 1), new Object[] { ModItems.bolt_tungsten, ST.dust(), BR.dust(), CO.dust(), TS.dust(), NB.dust(), ModItems.board_copper, ModItems.black_hole, CE.dust() });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModItems.blades_aluminium, 1), new Object[] { " P ", "PIP", " P ", 'P', AL.plate(), 'I', AL.ingot() });
|
||||
addRecipeAuto(new ItemStack(ModItems.blades_gold, 1), new Object[] { " P ", "PIP", " P ", 'P', GOLD.plate(), 'I', GOLD.ingot() });
|
||||
@ -539,7 +541,7 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(ModItems.watch, 1), new Object[] { "LEL", "EWE", "LEL", 'E', EUPH.ingot(), 'L', KEY_BLUE, 'W', Items.clock });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModItems.key, 1), new Object[] { " B", " B ", "P ", 'P', STEEL.plate(), 'B', ModItems.bolt_tungsten });
|
||||
addRecipeAuto(new ItemStack(ModItems.key_kit, 1), new Object[] { "PKP", "DTD", "PKP", 'P', GOLD.plate(), 'K', ModItems.key, 'D', DIAMOND.dust(), 'T', ModItems.screwdriver });
|
||||
addRecipeAuto(new ItemStack(ModItems.key_kit, 1), new Object[] { "PKP", "DTD", "PKP", 'P', GOLD.plate(), 'K', ModItems.key, 'D', DESH.dust(), 'T', ModItems.screwdriver });
|
||||
addRecipeAuto(new ItemStack(ModItems.key_red, 1), new Object[] { "DSC", "SMS", "KSD", 'C', ModItems.circuit_targeting_tier4, 'M', Items.nether_star, 'K', ModItems.key, 'D', DESH.dust(), 'S', BIGMT.plate() });
|
||||
addRecipeAuto(new ItemStack(ModItems.pin, 1), new Object[] { "W ", " W", " W", 'W', ModItems.wire_copper });
|
||||
addRecipeAuto(new ItemStack(ModItems.padlock_rusty, 1), new Object[] { "I", "B", "I", 'I', IRON.ingot(), 'B', ModItems.bolt_tungsten });
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/items/chemistry_set.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/chemistry_set.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 217 B |
Binary file not shown.
|
After Width: | Height: | Size: 249 B |
BIN
src/main/resources/assets/hbm/textures/items/hand_drill_desh.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/hand_drill_desh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 226 B |
Binary file not shown.
|
After Width: | Height: | Size: 237 B |
Loading…
x
Reference in New Issue
Block a user