Tool Repair Implemented

This commit is contained in:
Mohammad-Ali Minaie
2017-03-29 22:21:18 -04:00
parent beb6325ea0
commit 2e9f271818
9 changed files with 192 additions and 21 deletions

View File

@@ -13,7 +13,7 @@ To-Dos
- [ ] Gold Smelting - [ ] Gold Smelting
- [ ] Custom Tool Material - [ ] Custom Tool Material
- [ ] Add Iron to to Empty Crucible via right click - [ ] Add Iron to to Empty Crucible via right click
- [ ] Coal is not being removed from the forge or firebox
*** Backlog *** *** Backlog ***
- [ ] Create a method which adds the types of NBT upgrades and creates a unique float instead of using magic numbers - [ ] Create a method which adds the types of NBT upgrades and creates a unique float instead of using magic numbers

View File

@@ -7,6 +7,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.tools.CustomAxe;
import nmd.primal.forgecraft.items.tools.CustomHoe;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
import nmd.primal.forgecraft.items.tools.CustomShovel;
/** /**
* Created by mminaie on 3/15/17. * Created by mminaie on 3/15/17.
@@ -29,6 +33,7 @@ public class CommonEvents implements ToolNBT{
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
//if( getDiamondLevel(event.crafting) > 0 ){ //if( getDiamondLevel(event.crafting) > 0 ){
// event.crafting.getItem().setHarvestLevel("pickaxe", 3); // event.crafting.getItem().setHarvestLevel("pickaxe", 3);
//} //}
@@ -46,9 +51,7 @@ public class CommonEvents implements ToolNBT{
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
//if( getDiamondLevel(event.crafting) > 0 ){ event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
// event.crafting.getItem().setHarvestLevel("pickaxe", 3);
//}
} }
} }
} }
@@ -63,6 +66,7 @@ public class CommonEvents implements ToolNBT{
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
//if( getDiamondLevel(event.crafting) > 0 ){ //if( getDiamondLevel(event.crafting) > 0 ){
// event.crafting.getItem().setHarvestLevel("pickaxe", 3); // event.crafting.getItem().setHarvestLevel("pickaxe", 3);
//} //}
@@ -80,6 +84,7 @@ public class CommonEvents implements ToolNBT{
tempTag = a.getSubCompound("tags").copy(); tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag); event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound()); event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
//if( getDiamondLevel(event.crafting) > 0 ){ //if( getDiamondLevel(event.crafting) > 0 ){
// event.crafting.getItem().setHarvestLevel("pickaxe", 3); // event.crafting.getItem().setHarvestLevel("pickaxe", 3);
//} //}
@@ -87,6 +92,70 @@ public class CommonEvents implements ToolNBT{
} }
} }
} }
if (event.crafting.getItem() == ModItems.ironaxehead) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof CustomAxe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
}
}
}
if (event.crafting.getItem() == ModItems.pickaxehead) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof CustomPickaxe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
}
}
}
if (event.crafting.getItem() == ModItems.ironshovelhead) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof CustomShovel) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
}
}
}
if (event.crafting.getItem() == ModItems.ironhoehead) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof CustomHoe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
}
}
}
} }
} }

View File

@@ -131,19 +131,23 @@ public class Anvil extends CustomContainerFacing {
if (tile.getSlotStack(12).getItem().equals(recipe.getOutput().getItem())) { if (tile.getSlotStack(12).getItem().equals(recipe.getOutput().getItem())) {
NBTTagCompound tempNBT = tile.getSlotStack(12).getSubCompound("tags"); NBTTagCompound tempNBT = tile.getSlotStack(12).getSubCompound("tags");
ItemStack outputStack = recipe.getOutput(); ItemStack outputStack = recipe.getOutput();
outputStack.setTagCompound(new NBTTagCompound()); outputStack.setTagCompound(new NBTTagCompound());
outputStack.getTagCompound().setTag("tags", tempNBT); outputStack.getTagCompound().setTag("tags", tempNBT);
outputStack.getSubCompound("tags").setBoolean("hot", false); outputStack.getSubCompound("tags").setBoolean("hot", false);
if (recipe.getUpgrade() == "repair") {
CommonUtils.spawnItemEntityFromWorld(world, pos, outputStack);
}
if (outputStack.getSubCompound("tags").getInteger("modifiers") < 3) { if (outputStack.getSubCompound("tags").getInteger("modifiers") < 3) {
//Upgrade emerald //Upgrade emerald
if (recipe.getUpgrade() == "emerald") { if (recipe.getUpgrade() == "emerald") {
if (outputStack.getSubCompound("tags").getInteger("lapis") == 0) { if (outputStack.getSubCompound("tags").getInteger("lapis") == 0) {
if (outputStack.getSubCompound("tags").getBoolean("emerald") == false) { if (outputStack.getSubCompound("tags").getBoolean("emerald") == false) {
outputStack.setItemDamage(tile.getSlotStack(12).getItemDamage());
outputStack.getSubCompound("tags").setInteger("emerald", outputStack.getSubCompound("tags").setInteger("emerald",
(outputStack.getSubCompound("tags").getInteger("emerald") + 1)); (outputStack.getSubCompound("tags").getInteger("emerald") + 1));
outputStack.getSubCompound("tags").setInteger("modifiers", outputStack.getSubCompound("tags").setInteger("modifiers",
@@ -154,6 +158,7 @@ public class Anvil extends CustomContainerFacing {
//Upgrade diamond //Upgrade diamond
if (recipe.getUpgrade() == "diamond") { if (recipe.getUpgrade() == "diamond") {
outputStack.setItemDamage(tile.getSlotStack(12).getItemDamage());
outputStack.getSubCompound("tags").setInteger("diamond", outputStack.getSubCompound("tags").setInteger("diamond",
(outputStack.getSubCompound("tags").getInteger("diamond") + 1)); (outputStack.getSubCompound("tags").getInteger("diamond") + 1));
outputStack.getSubCompound("tags").setInteger("modifiers", outputStack.getSubCompound("tags").setInteger("modifiers",
@@ -162,6 +167,7 @@ public class Anvil extends CustomContainerFacing {
//Upgrade redstone //Upgrade redstone
if (recipe.getUpgrade() == "redstone") { if (recipe.getUpgrade() == "redstone") {
outputStack.setItemDamage(tile.getSlotStack(12).getItemDamage());
outputStack.getSubCompound("tags").setInteger("redstone", outputStack.getSubCompound("tags").setInteger("redstone",
(outputStack.getSubCompound("tags").getInteger("redstone") + 1)); (outputStack.getSubCompound("tags").getInteger("redstone") + 1));
outputStack.getSubCompound("tags").setInteger("modifiers", outputStack.getSubCompound("tags").setInteger("modifiers",
@@ -170,6 +176,7 @@ public class Anvil extends CustomContainerFacing {
//Upgrade lapis //Upgrade lapis
if (recipe.getUpgrade() == "lapis") { if (recipe.getUpgrade() == "lapis") {
outputStack.setItemDamage(tile.getSlotStack(12).getItemDamage());
if (outputStack.getSubCompound("tags").getBoolean("emerald") == false) { if (outputStack.getSubCompound("tags").getBoolean("emerald") == false) {
outputStack.getSubCompound("tags").setInteger("lapis", outputStack.getSubCompound("tags").setInteger("lapis",
(outputStack.getSubCompound("tags").getInteger("lapis") + 1)); (outputStack.getSubCompound("tags").getInteger("lapis") + 1));
@@ -321,6 +328,7 @@ public class Anvil extends CustomContainerFacing {
tempStack.setTagCompound(new NBTTagCompound()); tempStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = pItem.getSubCompound("tags").copy(); NBTTagCompound tags = pItem.getSubCompound("tags").copy();
tempStack.getTagCompound().setTag("tags", tags); tempStack.getTagCompound().setTag("tags", tags);
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
tile.setSlotStack((counter), tempStack); tile.setSlotStack((counter), tempStack);
pItem.getTagCompound().setInteger("type", 0); pItem.getTagCompound().setInteger("type", 0);
@@ -330,6 +338,7 @@ public class Anvil extends CustomContainerFacing {
pItem.getSubCompound("tags").setInteger("redstone", 0); pItem.getSubCompound("tags").setInteger("redstone", 0);
pItem.getSubCompound("tags").setInteger("lapis", 0); pItem.getSubCompound("tags").setInteger("lapis", 0);
pItem.getSubCompound("tags").setInteger("modifiers", 0); pItem.getSubCompound("tags").setInteger("modifiers", 0);
pItem.getTagCompound().setInteger("tempDamage", 0);
return true; return true;
} }
if (pItem.getTagCompound().getInteger("type") == 9) { if (pItem.getTagCompound().getInteger("type") == 9) {
@@ -337,6 +346,7 @@ public class Anvil extends CustomContainerFacing {
tempStack.setTagCompound(new NBTTagCompound()); tempStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = pItem.getSubCompound("tags").copy(); NBTTagCompound tags = pItem.getSubCompound("tags").copy();
tempStack.getTagCompound().setTag("tags", tags); tempStack.getTagCompound().setTag("tags", tags);
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
tile.setSlotStack((counter), tempStack); tile.setSlotStack((counter), tempStack);
pItem.getTagCompound().setInteger("type", 0); pItem.getTagCompound().setInteger("type", 0);
@@ -346,6 +356,7 @@ public class Anvil extends CustomContainerFacing {
pItem.getSubCompound("tags").setInteger("redstone", 0); pItem.getSubCompound("tags").setInteger("redstone", 0);
pItem.getSubCompound("tags").setInteger("lapis", 0); pItem.getSubCompound("tags").setInteger("lapis", 0);
pItem.getSubCompound("tags").setInteger("modifiers", 0); pItem.getSubCompound("tags").setInteger("modifiers", 0);
pItem.getTagCompound().setInteger("tempDamage", 0);
return true; return true;
} }
if (pItem.getTagCompound().getInteger("type") == 10) { if (pItem.getTagCompound().getInteger("type") == 10) {
@@ -353,6 +364,7 @@ public class Anvil extends CustomContainerFacing {
tempStack.setTagCompound(new NBTTagCompound()); tempStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = pItem.getSubCompound("tags").copy(); NBTTagCompound tags = pItem.getSubCompound("tags").copy();
tempStack.getTagCompound().setTag("tags", tags); tempStack.getTagCompound().setTag("tags", tags);
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
tile.setSlotStack((counter), tempStack); tile.setSlotStack((counter), tempStack);
pItem.getTagCompound().setInteger("type", 0); pItem.getTagCompound().setInteger("type", 0);
@@ -362,6 +374,7 @@ public class Anvil extends CustomContainerFacing {
pItem.getSubCompound("tags").setInteger("redstone", 0); pItem.getSubCompound("tags").setInteger("redstone", 0);
pItem.getSubCompound("tags").setInteger("lapis", 0); pItem.getSubCompound("tags").setInteger("lapis", 0);
pItem.getSubCompound("tags").setInteger("modifiers", 0); pItem.getSubCompound("tags").setInteger("modifiers", 0);
pItem.getTagCompound().setInteger("tempDamage", 0);
return true; return true;
} }
if (pItem.getTagCompound().getInteger("type") == 11) { if (pItem.getTagCompound().getInteger("type") == 11) {
@@ -369,6 +382,7 @@ public class Anvil extends CustomContainerFacing {
tempStack.setTagCompound(new NBTTagCompound()); tempStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = pItem.getSubCompound("tags").copy(); NBTTagCompound tags = pItem.getSubCompound("tags").copy();
tempStack.getTagCompound().setTag("tags", tags); tempStack.getTagCompound().setTag("tags", tags);
tempStack.setItemDamage(pItem.getTagCompound().getInteger("tempDamage"));
tile.setSlotStack((counter), tempStack); tile.setSlotStack((counter), tempStack);
pItem.getTagCompound().setInteger("type", 0); pItem.getTagCompound().setInteger("type", 0);
@@ -378,6 +392,7 @@ public class Anvil extends CustomContainerFacing {
pItem.getSubCompound("tags").setInteger("redstone", 0); pItem.getSubCompound("tags").setInteger("redstone", 0);
pItem.getSubCompound("tags").setInteger("lapis", 0); pItem.getSubCompound("tags").setInteger("lapis", 0);
pItem.getSubCompound("tags").setInteger("modifiers", 0); pItem.getSubCompound("tags").setInteger("modifiers", 0);
pItem.getTagCompound().setInteger("tempDamage", 0);
return true; return true;
} }
} }

View File

@@ -7,8 +7,13 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import nmd.primal.core.api.PrimalBlocks;
import nmd.primal.core.api.PrimalItems; import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.api.PrimalSounds;
import nmd.primal.core.common.crafting.ToolRecipe; import nmd.primal.core.common.crafting.ToolRecipe;
import nmd.primal.core.common.items.tools.PrimalTool; import nmd.primal.core.common.items.tools.PrimalTool;
import nmd.primal.forgecraft.blocks.Bloomery; import nmd.primal.forgecraft.blocks.Bloomery;
@@ -45,17 +50,17 @@ public class ModCrafting {
"X X", "X X", "XXX", 'X', PrimalItems.MUD_CLUMP); "X X", "X X", "XXX", 'X', PrimalItems.MUD_CLUMP);
/***Wooden PistonBellows***/ /***Wooden PistonBellows***/
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsoak), "XXX", "X Y", "XXX", GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsoak), "XXX", "X Y", "XXX",
'X', new ItemStack(Blocks.PLANKS, 1, 0), 'Y', ModItems.pistonbellows); 'X', new ItemStack(Blocks.PLANKS, 1, 0), 'Y', ModItems.pistonbellows);
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsspruce), "XXX", "X Y", "XXX", GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsspruce), "XXX", "X Y", "XXX",
'X', new ItemStack(Blocks.PLANKS, 1, 1), 'Y', ModItems.pistonbellows); 'X', new ItemStack(Blocks.PLANKS, 1, 1), 'Y', ModItems.pistonbellows);
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsbirch), "XXX", "X Y", "XXX", GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsbirch), "XXX", "X Y", "XXX",
'X', new ItemStack(Blocks.PLANKS, 1, 2), 'Y', ModItems.pistonbellows); 'X', new ItemStack(Blocks.PLANKS, 1, 2), 'Y', ModItems.pistonbellows);
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsjungle), "XXX", "X Y", "XXX", GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsjungle), "XXX", "X Y", "XXX",
'X', new ItemStack(Blocks.PLANKS, 1, 3), 'Y', ModItems.pistonbellows); 'X', new ItemStack(Blocks.PLANKS, 1, 3), 'Y', ModItems.pistonbellows);
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsacacia), "XXX", "X Y", "XXX", GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsacacia), "XXX", "X Y", "XXX",
'X', new ItemStack(Blocks.PLANKS, 1, 4), 'Y', ModItems.pistonbellows); 'X', new ItemStack(Blocks.PLANKS, 1, 4), 'Y', ModItems.pistonbellows);
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsdarkoak), "XXX", "X Y", "XXX", GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.pistonbellowsdarkoak), "XXX", "X Y", "XXX",
'X', new ItemStack(Blocks.PLANKS, 1, 5), 'Y', ModItems.pistonbellows); 'X', new ItemStack(Blocks.PLANKS, 1, 5), 'Y', ModItems.pistonbellows);
/***Bellows Handle***/ /***Bellows Handle***/
@@ -84,8 +89,10 @@ public class ModCrafting {
" X ", " Y ", 'X', ModItems.pickaxehead, 'Y', Items.STICK); " X ", " Y ", 'X', ModItems.pickaxehead, 'Y', Items.STICK);
/***Axe Crafting***/ /***Axe Crafting***/
GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironaxe, 1), //GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironaxe, 1),
" X ", " Y ", 'X', ModItems.ironaxehead, 'Y', Items.STICK); //" X ", " Y ", 'X', ModItems.ironaxehead, 'Y', Items.STICK);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironaxe, 1, OreDictionary.WILDCARD_VALUE),
true, "X", "Y", ('X'), new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE), ('Y'), Items.STICK));
/***Shovel Crafting***/ /***Shovel Crafting***/
GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironshovel, 1), GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironshovel, 1),
@@ -95,6 +102,31 @@ public class ModCrafting {
GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironhoe, 1), GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironhoe, 1),
" X ", " Y ", 'X', ModItems.ironhoehead, 'Y', Items.STICK); " X ", " Y ", 'X', ModItems.ironhoehead, 'Y', Items.STICK);
/***************************************************************
* TEMPORARY RECIPES
***************************************************************/
//GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE),
// " ", " X ", " ", 'X', ModItems.ironaxe);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironaxehead, 1, OreDictionary.WILDCARD_VALUE),
true, "X", ('X'), new ItemStack(ModItems.ironaxe, 1, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.pickaxehead, 1, OreDictionary.WILDCARD_VALUE),
true, "X", ('X'), new ItemStack(ModItems.ironpickaxe, 1, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironshovelhead, 1, OreDictionary.WILDCARD_VALUE),
true, "X", ('X'), new ItemStack(ModItems.ironshovel, 1, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ironhoehead, 1, OreDictionary.WILDCARD_VALUE),
true, "X", ('X'), new ItemStack(ModItems.ironhoe, 1, OreDictionary.WILDCARD_VALUE)));
/*GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(PrimalBlocks.SOULSTONE_CHISELED, 1), true, new Object[]{"S", "S",
('S'), PrimalBlocks.SLAB_SOULSTONE
}));*/
/***************************************************************/
/***Bloomery Crafting***/ /***Bloomery Crafting***/
//Makes the Empty Crucible //Makes the Empty Crucible
@@ -349,6 +381,18 @@ public class ModCrafting {
"null" "null"
); );
/*** REPAIR Pickaxe Head***/
AnvilCrafting.addRecipe(
new String[] {
empty,empty,empty,empty,empty,
empty,empty,hotChunk,empty,empty,
empty,empty,pickaxehead,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(ModItems.pickaxehead, 1),
"repair"
);
/*** Emerald Upgrade to Pickaxe Head ***/ /*** Emerald Upgrade to Pickaxe Head ***/
AnvilCrafting.addRecipe( AnvilCrafting.addRecipe(
new String[] { new String[] {
@@ -409,6 +453,18 @@ public class ModCrafting {
"null" "null"
); );
/*** REPAIR AXE Head***/
AnvilCrafting.addRecipe(
new String[] {
empty,empty,empty,empty,empty,
empty,empty,hotChunk,empty,empty,
empty,empty,ironaxehead,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(ModItems.ironaxehead, 1),
"repair"
);
/*** Emerald Upgrade to Axe Head ***/ /*** Emerald Upgrade to Axe Head ***/
AnvilCrafting.addRecipe( AnvilCrafting.addRecipe(
new String[] { new String[] {
@@ -469,6 +525,18 @@ public class ModCrafting {
"null" "null"
); );
/*** REPAIR SHOVEL Head***/
AnvilCrafting.addRecipe(
new String[] {
empty,empty,empty,empty,empty,
empty,empty,hotChunk,empty,empty,
empty,empty,ironshovelhead,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(ModItems.ironshovelhead, 1),
"repair"
);
/*** Emerald Upgrade to Shovel Head ***/ /*** Emerald Upgrade to Shovel Head ***/
AnvilCrafting.addRecipe( AnvilCrafting.addRecipe(
new String[] { new String[] {
@@ -529,6 +597,18 @@ public class ModCrafting {
"null" "null"
); );
/*** REPAIR HOE Head***/
AnvilCrafting.addRecipe(
new String[] {
empty,empty,empty,empty,empty,
empty,empty,hotChunk,empty,empty,
empty,empty,ironhoehead,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(ModItems.ironhoehead, 1),
"repair"
);
/*** Emerald Upgrade to Hoe Head ***/ /*** Emerald Upgrade to Hoe Head ***/
AnvilCrafting.addRecipe( AnvilCrafting.addRecipe(
new String[] { new String[] {

View File

@@ -62,10 +62,10 @@ public class ModItems {
softcrucible = new ItemSoftCrucible(); softcrucible = new ItemSoftCrucible();
stonetongs = new ItemStoneTongs("stonetongs"); stonetongs = new ItemStoneTongs("stonetongs");
pickaxehead = new ToolPart("ironpickaxehead"); pickaxehead = new ToolPart("ironpickaxehead", Item.ToolMaterial.IRON);
ironaxehead = new ToolPart("ironaxehead"); ironaxehead = new ToolPart("ironaxehead", Item.ToolMaterial.IRON);
ironshovelhead = new ToolPart("ironshovelhead"); ironshovelhead = new ToolPart("ironshovelhead", Item.ToolMaterial.IRON);
ironhoehead = new ToolPart("ironhoehead"); ironhoehead = new ToolPart("ironhoehead", Item.ToolMaterial.IRON);
ironpickaxe = new CustomPickaxe("ironpickaxe", Item.ToolMaterial.IRON); ironpickaxe = new CustomPickaxe("ironpickaxe", Item.ToolMaterial.IRON);
ironaxe = new CustomAxe("ironaxe", Item.ToolMaterial.IRON); ironaxe = new CustomAxe("ironaxe", Item.ToolMaterial.IRON);

View File

@@ -267,6 +267,7 @@ public class ItemStoneTongs extends Item {
itemstack.getTagCompound().setInteger("type", 8); itemstack.getTagCompound().setInteger("type", 8);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags); itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true); //itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY); tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
@@ -277,6 +278,7 @@ public class ItemStoneTongs extends Item {
itemstack.getTagCompound().setInteger("type", 9); itemstack.getTagCompound().setInteger("type", 9);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags); itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true); //itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY); tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
@@ -287,6 +289,7 @@ public class ItemStoneTongs extends Item {
itemstack.getTagCompound().setInteger("type", 10); itemstack.getTagCompound().setInteger("type", 10);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags); itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true); //itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY); tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
@@ -297,6 +300,7 @@ public class ItemStoneTongs extends Item {
itemstack.getTagCompound().setInteger("type", 11); itemstack.getTagCompound().setInteger("type", 11);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags); itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true); //itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY); tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;

View File

@@ -23,11 +23,13 @@ import java.util.List;
*/ */
public class ToolPart extends Item implements ToolNBT{ public class ToolPart extends Item implements ToolNBT{
public ToolPart(String name) { public ToolPart(String name, Item.ToolMaterial material) {
this.setMaxDamage(material.getMaxUses());
this.setUnlocalizedName(name); this.setUnlocalizedName(name);
this.setRegistryName(name); this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT); this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1); this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter()
{ {

View File

@@ -303,7 +303,7 @@ public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
{ {
if(!player.world.isRemote){ if(!player.world.isRemote){
World world = player.getEntityWorld(); World world = player.getEntityWorld();
System.out.println(world.getBlockState(pos).getBlock()); //System.out.println(world.getBlockState(pos).getBlock());
if(itemstack.getItem() instanceof CustomPickaxe){ if(itemstack.getItem() instanceof CustomPickaxe){
if( getEmerald(itemstack)){ if( getEmerald(itemstack)){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1); itemstack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
@@ -314,6 +314,7 @@ public class CustomPickaxe extends ItemPickaxe implements ToolNBT{
} }
if( getRedstoneLevel(itemstack) > 0 ){ if( getRedstoneLevel(itemstack) > 0 ){
itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack)); itemstack.addEnchantment(Enchantment.getEnchantmentByID(32), getRedstoneLevel(itemstack));
System.out.println(itemstack.getEnchantmentTagList());
} }
if ( getLapisLevel(itemstack) > 0) { if ( getLapisLevel(itemstack) > 0) {
itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack)); itemstack.addEnchantment(Enchantment.getEnchantmentByID(35), getLapisLevel(itemstack));

View File

@@ -143,8 +143,8 @@ public class TileForge extends TileBaseSlot implements ITickable {
if(this.getSlotStack(i).hasTagCompound()){ if(this.getSlotStack(i).hasTagCompound()){
if( this.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == false) { if( this.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == false) {
this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true); this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
System.out.println(this.getSlotStack(i).getSubCompound("tags")); //System.out.println(this.getSlotStack(i).getSubCompound("tags"));
System.out.println("its hot now"); //System.out.println("its hot now");
cookCounter4 = 0; cookCounter4 = 0;
} }
} else this.setSlotStack(i, recipe.getOutput()); } else this.setSlotStack(i, recipe.getOutput());