From f7eda0ac557fa8a7eb16b154c9cee3b273040d30 Mon Sep 17 00:00:00 2001 From: Mohammad-Ali Minaie Date: Sat, 11 Mar 2017 01:20:01 -0500 Subject: [PATCH] create model for modifying tool parts, rendering multiple textures for only one item based off NBT --- 1.11/To-Dos | 34 +- 1.11/e_particle.png | Bin 0 -> 159 bytes 1.11/e_texture.png | Bin 0 -> 141 bytes 1.11/pickaxe.json | 77 ++++ .../nmd/primal/forgecraft/CommonUtils.java | 2 +- .../nmd/primal/forgecraft/blocks/Anvil.java | 363 +++++++++++------- .../forgecraft/crafting/AnvilCrafting.java | 22 +- .../primal/forgecraft/init/ModCrafting.java | 80 +++- .../nmd/primal/forgecraft/init/ModItems.java | 19 +- .../items/toolparts/PickaxePart.java | 231 +++++++++++ .../forgecraft/items/toolparts/ToolPart.java | 48 ++- .../forgecraft/models/item/e_particle.png | Bin 0 -> 159 bytes .../forgecraft/models/item/e_texture.png | Bin 0 -> 141 bytes .../models/item/ironpickaxehead.json | 14 + .../forgecraft/models/item/pickaxehead.json | 51 +++ 15 files changed, 770 insertions(+), 171 deletions(-) create mode 100644 1.11/e_particle.png create mode 100644 1.11/e_texture.png create mode 100644 1.11/pickaxe.json create mode 100644 1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/PickaxePart.java create mode 100644 1.11/src/main/resources/assets/forgecraft/models/item/e_particle.png create mode 100644 1.11/src/main/resources/assets/forgecraft/models/item/e_texture.png create mode 100644 1.11/src/main/resources/assets/forgecraft/models/item/ironpickaxehead.json create mode 100644 1.11/src/main/resources/assets/forgecraft/models/item/pickaxehead.json diff --git a/1.11/To-Dos b/1.11/To-Dos index ea26a0df..5266ce0d 100644 --- a/1.11/To-Dos +++ b/1.11/To-Dos @@ -1,21 +1,43 @@ To-Dos *** Priority *** -- [ ] Tool Rendering -- [ ] Toolhead Recipes -- [ ] WeaponHead recipes + +- [ ] Allow redstone, lapis, and shards in the anvil +- [ ] Fix renderings in the anvil +- [ ] Create toolHead Item + - [ ] Give toolHead item NBT + - [x] Create pickaxehead Item + - [ ] Create pickaxehead SubNBTs +- [ ] Create Forging Recipe for toolHeads +- [ ] Create Anvil recipe for toolHeads + +- [ ] Create Slot for Firebox to accept toolheads + - [ ] Add forgehammer to oreDict -Only modifiable bit is the tool head or weapon blade +Make Iron like normal +make tool heads like normal +put tool heads in forge to get hot +take hot tool head and put in anvil +put upgrade material (redstone, lapis, emerald, diamond) above pick +hammer a few times to get cooled toolhead with new NBT changes -The modifier is a product of the tagCompounds are the material type +Repeat the above process to add-on or add-new upgrade + + +Tools are crafted in a workbench type block +The block takes an input toolhead and toolrod +when the block is right-clicked crafting is attempted. -the modifiers are transfered to the crafted item via NBT *** Backlog *** +- [ ] Tool Rendering +- [ ] Toolhead Recipes +- [ ] WeaponHead recipes + - [ ] Stone Anvil Bounding Box - [ ] Casting Table diff --git a/1.11/e_particle.png b/1.11/e_particle.png new file mode 100644 index 0000000000000000000000000000000000000000..e557878f9b0081df0e6c571ed915f4780bf1a2fc GIT binary patch literal 159 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|X`U{QAsV7vCj@daC~~-LPd)$i z?$?xTj^-IIp9ACFK7V={aJAiXe!J@v0mIGT4Z3dBCY+nlAN}mLRowa~J3GYg{eRVX zXUUaN&3PXSznt{pUt?*oMTj?KX|GSjMcIr5t;EiVqsx9UI;{|T9DHPlG0;W^Pgg&e IbxsLQ03WwL?f?J) literal 0 HcmV?d00001 diff --git a/1.11/e_texture.png b/1.11/e_texture.png new file mode 100644 index 0000000000000000000000000000000000000000..7291f2ea2b524eccecb6678f7bd40262c849bf2f GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|A)YRdAsV8|HWeQfm^B+%SKK&v zuFpfaoliDNDM&L$@~vsZp9Y?WbuQ1CZf4l2-1K~5=5VI@Msu3kk+ey<5-m~}Y= this.getNormalMin(x) && hitx <= this.getNormalMax(x)){ - if(hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { - if(!tile.getSlotStack(counter).isEmpty()) { - if (pItem.getTagCompound().getInteger("type") == 0) { - if(tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)){ - pItem.getTagCompound().setInteger("type", 6); - tile.setSlotStack(counter, ItemStack.EMPTY); - return true; - } - if(tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)){ - pItem.getTagCompound().setInteger("type", 7); - tile.setSlotStack(counter, ItemStack.EMPTY); - System.out.println(counter); - return true; + if (state.getValue(FACING) == EnumFacing.NORTH) { + int counter = 0; + for (int z = 0; z < 5; z++) { + for (int x = 0; x < 5; x++) { + if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) { + if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { + + if (pItem.getItem().equals(ModItems.stonetongs)) { + if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { + + if (!tile.getSlotStack(counter).isEmpty()) { + if (pItem.getTagCompound().getInteger("type") == 0) { + if (tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)) { + pItem.getTagCompound().setInteger("type", 6); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + if (tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)) { + pItem.getTagCompound().setInteger("type", 7); + tile.setSlotStack(counter, ItemStack.EMPTY); + //System.out.println(counter); + return true; + } } } - } - if(tile.getSlotStack(counter).isEmpty()) { - if (pItem.getTagCompound().getInteger("type") == 6) { - tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1)); - pItem.getTagCompound().setInteger("type", 0); - return true; - } - if (pItem.getTagCompound().getInteger("type") == 7) { - tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1)); - pItem.getTagCompound().setInteger("type", 0); - System.out.println(counter); - return true; + if (tile.getSlotStack(counter).isEmpty()) { + if (pItem.getTagCompound().getInteger("type") == 6) { + tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1)); + pItem.getTagCompound().setInteger("type", 0); + return true; + } + if (pItem.getTagCompound().getInteger("type") == 7) { + tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1)); + pItem.getTagCompound().setInteger("type", 0); + //System.out.println(counter); + return true; + } } } } + + if (pItem.equals(ItemStack.EMPTY)) { + if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) { + CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter)); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + } + + if (pItem.getItem().equals(Items.DIAMOND)) { + if (tile.getSlotStack(counter).isEmpty()) { + tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage())); + pItem.shrink(1); + return true; + } + } + } - counter++; } + counter++; } } - if(state.getValue(FACING) == EnumFacing.SOUTH) { - int counter = 0; - for(int z=0; z<5; z++){ - for(int x=0; x<5; x++){ - if(hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)){ - if(hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { - if(!tile.getSlotStack(counter).isEmpty()) { - if (pItem.getTagCompound().getInteger("type") == 0) { - if(tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)){ - pItem.getTagCompound().setInteger("type", 6); - tile.setSlotStack(counter, ItemStack.EMPTY); - return true; - } - if(tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)){ - pItem.getTagCompound().setInteger("type", 7); - tile.setSlotStack(counter, ItemStack.EMPTY); - System.out.println(counter); - return true; - } - } - } + } + if (state.getValue(FACING) == EnumFacing.SOUTH) { + int counter = 0; + for (int z = 0; z < 5; z++) { + for (int x = 0; x < 5; x++) { + if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) { + if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { - if(tile.getSlotStack(counter).isEmpty()) { - if (pItem.getTagCompound().getInteger("type") == 6) { - tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1)); - pItem.getTagCompound().setInteger("type", 0); - return true; + if (pItem.getItem().equals(ModItems.stonetongs)) { + if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { + + if (!tile.getSlotStack(counter).isEmpty()) { + if (pItem.getTagCompound().getInteger("type") == 0) { + if (tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)) { + pItem.getTagCompound().setInteger("type", 6); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + if (tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)) { + pItem.getTagCompound().setInteger("type", 7); + tile.setSlotStack(counter, ItemStack.EMPTY); + //System.out.println(counter); + return true; + } + } } - if (pItem.getTagCompound().getInteger("type") == 7) { - tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1)); - pItem.getTagCompound().setInteger("type", 0); - System.out.println(counter); - return true; + + if (tile.getSlotStack(counter).isEmpty()) { + if (pItem.getTagCompound().getInteger("type") == 6) { + tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1)); + pItem.getTagCompound().setInteger("type", 0); + return true; + } + if (pItem.getTagCompound().getInteger("type") == 7) { + tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1)); + pItem.getTagCompound().setInteger("type", 0); + //System.out.println(counter); + return true; + } } } } + + if (pItem.equals(ItemStack.EMPTY)) { + if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) { + CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter)); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + } + + if (pItem.getItem().equals(Items.DIAMOND)) { + if (tile.getSlotStack(counter).isEmpty()) { + tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage())); + pItem.shrink(1); + return true; + } + } + } - counter++; } + counter++; } } - if(state.getValue(FACING) == EnumFacing.WEST) { - int counter = 0; - for(int x=0; x<5; x++){ - for(int z=0; z<5; z++){ - if(hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)){ - if(hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { - if(!tile.getSlotStack(counter).isEmpty()) { - if (pItem.getTagCompound().getInteger("type") == 0) { - if(tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)){ - pItem.getTagCompound().setInteger("type", 6); - tile.setSlotStack(counter, ItemStack.EMPTY); - return true; - } - if(tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)){ - pItem.getTagCompound().setInteger("type", 7); - tile.setSlotStack(counter, ItemStack.EMPTY); - System.out.println(counter); - return true; - } - } - } + } + if (state.getValue(FACING) == EnumFacing.WEST) { + int counter = 0; + for (int x = 0; x < 5; x++) { + for (int z = 0; z < 5; z++) { + if (hitx >= this.getNormalMin(x) && hitx <= this.getNormalMax(x)) { + if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { - if(tile.getSlotStack(counter).isEmpty()) { - if (pItem.getTagCompound().getInteger("type") == 6) { - tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1)); - pItem.getTagCompound().setInteger("type", 0); - return true; + if (pItem.getItem().equals(ModItems.stonetongs)) { + if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { + + if (!tile.getSlotStack(counter).isEmpty()) { + if (pItem.getTagCompound().getInteger("type") == 0) { + if (tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)) { + pItem.getTagCompound().setInteger("type", 6); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + if (tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)) { + pItem.getTagCompound().setInteger("type", 7); + tile.setSlotStack(counter, ItemStack.EMPTY); + //System.out.println(counter); + return true; + } + } } - if (pItem.getTagCompound().getInteger("type") == 7) { - tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1)); - pItem.getTagCompound().setInteger("type", 0); - System.out.println(counter); - return true; + + if (tile.getSlotStack(counter).isEmpty()) { + if (pItem.getTagCompound().getInteger("type") == 6) { + tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1)); + pItem.getTagCompound().setInteger("type", 0); + return true; + } + if (pItem.getTagCompound().getInteger("type") == 7) { + tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1)); + pItem.getTagCompound().setInteger("type", 0); + //System.out.println(counter); + return true; + } } } } + + if (pItem.equals(ItemStack.EMPTY)) { + if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) { + CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter)); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + } + + if (pItem.getItem().equals(Items.DIAMOND)) { + if (tile.getSlotStack(counter).isEmpty()) { + tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage())); + pItem.shrink(1); + return true; + } + } + } - counter++; } + counter++; } } - if(state.getValue(FACING) == EnumFacing.EAST) { - int counter = 0; - for(int x=0; x<5; x++){ - for(int z=0; z<5; z++){ - if(hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)){ - if(hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { - if(!tile.getSlotStack(counter).isEmpty()) { - if (pItem.getTagCompound().getInteger("type") == 0) { - if(tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)){ - pItem.getTagCompound().setInteger("type", 6); - tile.setSlotStack(counter, ItemStack.EMPTY); - return true; - } - if(tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)){ - pItem.getTagCompound().setInteger("type", 7); - tile.setSlotStack(counter, ItemStack.EMPTY); - System.out.println(counter); - return true; - } - } - } + } + if (state.getValue(FACING) == EnumFacing.EAST) { + int counter = 0; + for (int x = 0; x < 5; x++) { + for (int z = 0; z < 5; z++) { + if (hitx >= this.getReverseMin(x) && hitx <= this.getReverseMax(x)) { + if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { - if(tile.getSlotStack(counter).isEmpty()) { - if (pItem.getTagCompound().getInteger("type") == 6) { - tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1)); - pItem.getTagCompound().setInteger("type", 0); - return true; + if (pItem.getItem().equals(ModItems.stonetongs)) { + if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { + + if (!tile.getSlotStack(counter).isEmpty()) { + if (pItem.getTagCompound().getInteger("type") == 0) { + if (tile.getSlotStack(counter).getItem().equals(ModItems.ironingotballhot)) { + pItem.getTagCompound().setInteger("type", 6); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + if (tile.getSlotStack(counter).getItem().equals(ModItems.ironchunkhot)) { + pItem.getTagCompound().setInteger("type", 7); + tile.setSlotStack(counter, ItemStack.EMPTY); + //System.out.println(counter); + return true; + } + } } - if (pItem.getTagCompound().getInteger("type") == 7) { - tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1)); - pItem.getTagCompound().setInteger("type", 0); - System.out.println(counter); - return true; + + if (tile.getSlotStack(counter).isEmpty()) { + if (pItem.getTagCompound().getInteger("type") == 6) { + tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1)); + pItem.getTagCompound().setInteger("type", 0); + return true; + } + if (pItem.getTagCompound().getInteger("type") == 7) { + tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1)); + pItem.getTagCompound().setInteger("type", 0); + //System.out.println(counter); + return true; + } } } } + + if (pItem.equals(ItemStack.EMPTY)) { + if (tile.getSlotStack(counter).getItem().equals(Items.DIAMOND)) { + CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter)); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + } + + if (pItem.getItem().equals(Items.DIAMOND)) { + if (tile.getSlotStack(counter).isEmpty()) { + tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage())); + pItem.shrink(1); + return true; + } + } + } - counter++; } + counter++; } } } } - return false; } } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/crafting/AnvilCrafting.java b/1.11/src/main/java/nmd/primal/forgecraft/crafting/AnvilCrafting.java index ebf0960c..38b71618 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/crafting/AnvilCrafting.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/crafting/AnvilCrafting.java @@ -2,6 +2,7 @@ package nmd.primal.forgecraft.crafting; import net.minecraft.block.Block; import net.minecraft.init.Blocks; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import java.util.ArrayList; @@ -21,15 +22,19 @@ public class AnvilCrafting { private static ArrayList anvilRecipes = new ArrayList<>(); - private Integer[] input = new Integer[25]; + //private Integer[] input = new Integer[25]; - private static ItemStack slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9, slot10, slot11, slot12, slot13, slot14, slot15, slot16, slot17, slot18, slot19, slot20, slot21, slot22, slot23, slot24; + private String[] input = new String[25]; - private static ItemStack [] slots = {slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9, slot10, slot11, slot12, slot13, slot14, slot15, slot16, slot17, slot18, slot19, slot20, slot21, slot22, slot23, slot24}; + //private ItemStack inputItem; + + //private static Item slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9, slot10, slot11, slot12, slot13, slot14, slot15, slot16, slot17, slot18, slot19, slot20, slot21, slot22, slot23, slot24; + + //private static Item[] input = {slot0, slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8, slot9, slot10, slot11, slot12, slot13, slot14, slot15, slot16, slot17, slot18, slot19, slot20, slot21, slot22, slot23, slot24}; private ItemStack output; - public AnvilCrafting(Integer[] input, ItemStack output){ + public AnvilCrafting(String[] input, ItemStack output){ this.input = input; this.output = output; @@ -40,21 +45,22 @@ public class AnvilCrafting { // Recipe Methods // ***************************************************************************** // - public static void addRecipe(Integer[] input, ItemStack output) + public static void addRecipe(String[] input, ItemStack output) { anvilRecipes.add(new AnvilCrafting(input, output)); } - public static boolean isRecipe(Integer[] array) + public static boolean isRecipe(String[] array) { for(AnvilCrafting recipe : anvilRecipes) { if (Arrays.equals(array, recipe.input)) + return true; } return false; } - public static AnvilCrafting getRecipe(Integer[] array) + public static AnvilCrafting getRecipe(String[] array) { for(AnvilCrafting recipe : anvilRecipes) { if (Arrays.equals(array, recipe.input)) @@ -63,6 +69,8 @@ public class AnvilCrafting { return null; } + public String[] getInput() {return this.input;} + public ItemStack getOutput() {return this.output;} } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java b/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java index db118c64..2381223f 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java @@ -6,6 +6,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.common.registry.GameRegistry; import nmd.primal.core.api.PrimalItems; import nmd.primal.core.common.crafting.ToolRecipe; @@ -16,6 +17,9 @@ import nmd.primal.forgecraft.crafting.AnvilCrafting; import nmd.primal.forgecraft.crafting.BloomeryCrafting; import nmd.primal.forgecraft.crafting.ForgeCrafting; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; + /** * Created by kitsu on 11/30/2016. */ @@ -23,6 +27,8 @@ public class ModCrafting { public static void register() { + Random rand = new Random(); + /***Forge***/ GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.firebox), "X X", "XYX", "X X", 'X', Items.BRICK, 'Y', Blocks.FURNACE); @@ -50,9 +56,22 @@ public class ModCrafting { "X X", "YSY", 'X', Blocks.STONE, 'S', Items.STRING, 'Y', Items.STICK); /***Iron Crucible***/ - GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.rawironcrucible, 1), + + ItemStack iron0 = new ItemStack(ModBlocks.rawironcrucible, 1); + //iron0.getTagCompound().setBoolean("mod", false); + ///iron0.getTagCompound().setInteger("speed", 0); + //iron0.getTagCompound().setInteger("fortune", 0); + //iron0.getTagCompound().setInteger("durability", 0); + //iron0.getTagCompound().setBoolean("silk", false); + + //Regular Iron Ore + GameRegistry.addShapedRecipe(iron0, " X ", " Y ", 'X', Blocks.IRON_ORE, 'Y', ModBlocks.emptycrucible); + //Iron Ore speed +1 + + + /***Bloomery Crafting***/ //Makes the Empty Crucible @@ -154,26 +173,61 @@ public class ModCrafting { // ANVILING // ***************************************************************************** // + String empty = ItemStack.EMPTY.getItem().getRegistryName().toString(); + String hotChunk = ModItems.ironchunkhot.getRegistryName().toString(); + String diamond = Items.DIAMOND.getRegistryName().toString(); + String emerald = Items.EMERALD.getRegistryName().toString(); + + /* + Empty = 0 + hotChunk = 1 + diamond = 2 + */ + //Makes a ForgeHammer AnvilCrafting.addRecipe( - new Integer[] { - 0,1,1,1,0, - 0,1,1,0,0, - 0,0,1,0,0, - 0,0,1,0,0, - 0,0,1,0,0 }, + new String [] { + empty,hotChunk,hotChunk,hotChunk,empty, + empty,hotChunk,hotChunk,empty,empty, + empty,empty,hotChunk,empty,empty, + empty,empty,hotChunk,empty,empty, + empty,empty,hotChunk,empty,empty }, new ItemStack(ModItems.forgehammer, 1) ); + //Makes flaked diamond + AnvilCrafting.addRecipe( + new String[] { + empty,empty,empty,empty,empty, + empty,empty,empty,empty,empty, + empty,empty,diamond,empty,empty, + empty,empty,empty,empty,empty, + empty,empty,empty,empty,empty }, + new ItemStack(PrimalItems.DIAMOND_KNAPP, 1) + ); + + //Makes flaked emerald + AnvilCrafting.addRecipe( + new String[] { + empty,empty,empty,empty,empty, + empty,empty,empty,empty,empty, + empty,empty,emerald,empty,empty, + empty,empty,empty,empty,empty, + empty,empty,empty,empty,empty }, + new ItemStack(PrimalItems.EMERALD_KNAPP, 1) + ); + //Makes a Pickaxe Head AnvilCrafting.addRecipe( - new Integer[] { 0,0,0,0,0, - 0,1,1,1,0, - 1,0,0,0,1, - 0,0,0,0,0, - 0,0,0,0,0 }, - new ItemStack(Blocks.OBSIDIAN, 1) + new String[] { + empty,empty,empty,empty,empty, + empty,hotChunk,hotChunk,hotChunk,empty, + hotChunk,empty,empty,empty,hotChunk, + empty,empty,empty,empty,empty, + empty,empty,empty,empty,empty }, + new ItemStack(Blocks.OBSIDIAN, 1) ); + } } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/init/ModItems.java b/1.11/src/main/java/nmd/primal/forgecraft/init/ModItems.java index babff693..137e7bed 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/init/ModItems.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/init/ModItems.java @@ -24,6 +24,7 @@ import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.blocks.IngotBall; import nmd.primal.forgecraft.items.*; import nmd.primal.forgecraft.items.blocks.ItemBlockIngotBall; +import nmd.primal.forgecraft.items.toolparts.PickaxePart; /** * Created by kitsu on 11/26/2016. @@ -37,6 +38,9 @@ public class ModItems { public static Item stonetongs; public static Item ironingotballhot; public static Item ironchunkhot; + + public static Item pickaxehead; + //public static Item forgingmanual; public static void init() { @@ -44,8 +48,13 @@ public class ModItems { pistonbellows = new ItemBellowsHandle(); softcrucible = new ItemSoftCrucible(); stonetongs = new ItemStoneTongs("stonetongs"); + + pickaxehead = new PickaxePart("ironpickaxehead"); + + + //ironingotballcool = new BaseMultiItem("ironingotcool") {}; - test = new ItemTest(); + //test = new ItemTest(); ironingotballhot = new BaseMultiItem("ironingothot") { public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(!world.isRemote) { @@ -88,7 +97,10 @@ public class ModItems { GameRegistry.register(forgehammer); GameRegistry.register(ironingotballhot); GameRegistry.register(ironchunkhot); - GameRegistry.register(test); + //GameRegistry.register(test); + GameRegistry.register(pickaxehead); + + //GameRegistry.register(forgingmanual); } @@ -99,7 +111,8 @@ public class ModItems { registerRender(forgehammer); registerRender(ironingotballhot); registerRender(ironchunkhot); - registerRender(test); + //registerRender(test); + registerRender(pickaxehead); //registerRender(forgingmanual); } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/PickaxePart.java b/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/PickaxePart.java new file mode 100644 index 00000000..24fedb92 --- /dev/null +++ b/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/PickaxePart.java @@ -0,0 +1,231 @@ +package nmd.primal.forgecraft.items.toolparts; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.IItemPropertyGetter; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import javax.annotation.Nullable; + +/** + * Created by mminaie on 3/11/17. + */ +public class PickaxePart extends ToolPart { + + /*** + + Hot . Emerald . Diamond . Redstone . lapis + + ***/ + + public PickaxePart(String name) { + super(name); + + this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() + { + @SideOnly(Side.CLIENT) + public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) + { + if (item.hasTagCompound()) { + if (item.getTagCompound().getBoolean("hot") == true) { + return 1.0F; + } + + if (item.getTagCompound().getBoolean("hot") == false) { + if (item.getTagCompound().getInteger("modifiers") == 0) { + return 0.0F; + } + } + + if (item.getTagCompound().getBoolean("hot") == false) { + if (item.getTagCompound().getInteger("modifiers") != 0) { + if ((item.getTagCompound().getBoolean("emerald") == true) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.1F; + } + + if ((item.getTagCompound().getBoolean("emerald") == true) && + (item.getTagCompound().getInteger("diamond") == 1) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.11F; + } + + if ((item.getTagCompound().getBoolean("emerald") == true) && + (item.getTagCompound().getInteger("diamond") == 2) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.12F; + } + + if ((item.getTagCompound().getBoolean("emerald") == true) && + (item.getTagCompound().getInteger("diamond") == 1) && + (item.getTagCompound().getInteger("redstone") == 1) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.111F; + } + + if ((item.getTagCompound().getBoolean("emerald") == true) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 2) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.102F; + } + + // ============ + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 1) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.01F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 2) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.02F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 3) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.03F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 1) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.001F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 2) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.002F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 3) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.003F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 1)) { + return 0.0001F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 2)) { + return 0.0002F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 3)) { + return 0.0003F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 1) && + (item.getTagCompound().getInteger("redstone") == 1) && + (item.getTagCompound().getInteger("lapis") == 1)) { + return 0.0111F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 2) && + (item.getTagCompound().getInteger("redstone") == 1) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.021F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 1) && + (item.getTagCompound().getInteger("redstone") == 2) && + (item.getTagCompound().getInteger("lapis") == 0)) { + return 0.012F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 1) && + (item.getTagCompound().getInteger("lapis") == 2)) { + return 0.012F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 0) && + (item.getTagCompound().getInteger("redstone") == 1) && + (item.getTagCompound().getInteger("lapis") == 2)) { + return 0.0012F; + } + + if ((item.getTagCompound().getBoolean("emerald") == false) && + (item.getTagCompound().getInteger("diamond") == 1) && + (item.getTagCompound().getInteger("redstone") == 0) && + (item.getTagCompound().getInteger("lapis") == 2)) { + return 0.0102F; + } + } + } + } + return 0.0F; + } + }); + + } + + @Override + public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) { + + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + item.getTagCompound().setBoolean("hot", false); + + item.getTagCompound().setBoolean("emerald", false); + item.getTagCompound().setInteger("diamond", 0); + item.getTagCompound().setInteger("redstone", 0); + item.getTagCompound().setInteger("lapis", 0); + + item.getTagCompound().setInteger("modifiers", 0); + } + + } + + @Override + public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) { + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + item.getTagCompound().setBoolean("hot", false); + + item.getTagCompound().setBoolean("emerald", false); + item.getTagCompound().setInteger("diamond", 0); + item.getTagCompound().setInteger("redstone", 0); + item.getTagCompound().setInteger("lapis", 0); + + item.getTagCompound().setInteger("modifiers", 0); + } + } + + +} diff --git a/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/ToolPart.java b/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/ToolPart.java index 4daa2ec1..032fc403 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/ToolPart.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/ToolPart.java @@ -1,13 +1,20 @@ package nmd.primal.forgecraft.items.toolparts; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import nmd.primal.forgecraft.ModInfo; +import javax.annotation.Nullable; + /** * Created by mminaie on 3/9/17. */ @@ -18,14 +25,43 @@ public abstract class ToolPart extends Item { this.setRegistryName(name); this.setCreativeTab(ModInfo.TAB_FORGECRAFT); this.setMaxStackSize(1); + + /*this.addPropertyOverride(new ResourceLocation("upgrade"), new IItemPropertyGetter() + { + @SideOnly(Side.CLIENT) + public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) + { + if (entityIn == null) + { + return 0.0F; + } + else + { + return 1.0F; + } + } + });*/ + } + + public static boolean isHidden() { return false; } - @Override + /* + item.setTagCompound(new NBTTagCompound()); + item.getTagCompound().setBoolean("silk_touch", false); + item.getTagCompound().setInteger("durability", 50); + item.getTagCompound().setFloat("speed", 0.0F); + item.getTagCompound().setFloat("fortune", 0.0F); + item.getTagCompound().setInteger("modifiers", 0); + this.setMaxDamage(item.getTagCompound().getInteger("durability")); + */ + + /*@Override public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) { if (!item.hasTagCompound()) { @@ -34,8 +70,8 @@ public abstract class ToolPart extends Item { item.getTagCompound().setBoolean("silk_touch", false); item.getTagCompound().setInteger("durability", 50); - item.getTagCompound().setFloat("speed", 1.0F); - item.getTagCompound().setFloat("fortune", 1.0F); + item.getTagCompound().setFloat("speed", 0.0F); + item.getTagCompound().setFloat("fortune", 0.0F); item.getTagCompound().setInteger("modifiers", 0); this.setMaxDamage(item.getTagCompound().getInteger("durability")); } @@ -48,12 +84,12 @@ public abstract class ToolPart extends Item { item.setTagCompound(new NBTTagCompound()); item.getTagCompound().setBoolean("silk_touch", false); item.getTagCompound().setInteger("durability", 50); - item.getTagCompound().setFloat("speed", 1.0F); - item.getTagCompound().setFloat("fortune", 1.0F); + item.getTagCompound().setFloat("speed", 0.0F); + item.getTagCompound().setFloat("fortune", 0.0F); item.getTagCompound().setInteger("modifiers", 0); this.setMaxDamage(item.getTagCompound().getInteger("durability")); } - } + }*/ } diff --git a/1.11/src/main/resources/assets/forgecraft/models/item/e_particle.png b/1.11/src/main/resources/assets/forgecraft/models/item/e_particle.png new file mode 100644 index 0000000000000000000000000000000000000000..e557878f9b0081df0e6c571ed915f4780bf1a2fc GIT binary patch literal 159 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|X`U{QAsV7vCj@daC~~-LPd)$i z?$?xTj^-IIp9ACFK7V={aJAiXe!J@v0mIGT4Z3dBCY+nlAN}mLRowa~J3GYg{eRVX zXUUaN&3PXSznt{pUt?*oMTj?KX|GSjMcIr5t;EiVqsx9UI;{|T9DHPlG0;W^Pgg&e IbxsLQ03WwL?f?J) literal 0 HcmV?d00001 diff --git a/1.11/src/main/resources/assets/forgecraft/models/item/e_texture.png b/1.11/src/main/resources/assets/forgecraft/models/item/e_texture.png new file mode 100644 index 0000000000000000000000000000000000000000..7291f2ea2b524eccecb6678f7bd40262c849bf2f GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|A)YRdAsV8|HWeQfm^B+%SKK&v zuFpfaoliDNDM&L$@~vsZp9Y?WbuQ1CZf4l2-1K~5=5VI@Msu3kk+ey<5-m~}Y