pickaxe heads can be modified and heated up, see to-do for updated work

This commit is contained in:
Mohammad-Ali Minaie
2017-03-12 03:00:22 -04:00
parent d372b298dd
commit dd90ba382a
9 changed files with 366 additions and 199 deletions

View File

@@ -2,36 +2,13 @@ To-Dos
*** Priority *** *** Priority ***
- [ ] Allow redstone, lapis, and shards in the anvil
- [ ] Fix renderings in the Anvil - [ ] Fix renderings in the Anvil
- [ ] Fix Renderings in the Forge - [ ] Fix Renderings in the Forge
- [ ] Create toolHead Item - [ ] Fix StoneTongs rendering for NBT 8
- [ ] Give toolHead item NBT
- [x] Create pickaxehead Item
- [x] Create pickaxehead SubNBTs
- [ ] Create Forging Recipe for toolHeads
- [ ] Create Anvil recipe for toolHeads
- [ ] Create Slot for Forge to accept toolheads in slot 4
- [ ] Add forgehammer to oreDict - [ ] Add forgehammer to oreDict
- [ ] Create Crafting Block for Tools and Weapons
- [ ] Create PickAxe Tool which ingests NBT
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
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.
*** Backlog *** *** Backlog ***
@@ -53,6 +30,17 @@ when the block is right-clicked crafting is attempted.
*** Completed *** *** Completed ***
- [x] Allow redstone, lapis, and shards in the anvil
- [x] Create toolHead Item
- [x] Give toolHead item NBT
- [x] Create pickaxehead Item
- [x] Create pickaxehead SubNBTs
- [x] Create Forging Recipe for toolHeads
- [x] Create Anvil recipe for toolHeads
- [x] Create Slot for Forge to accept toolheads in slot 4
- [x] Stone Anvil - [x] Stone Anvil
- [x] Stone Anvil Inventory - [x] Stone Anvil Inventory
- [x] Stone Anvil Tile - [x] Stone Anvil Tile

View File

@@ -78,9 +78,9 @@ public class Anvil extends CustomContainerFacing {
if (tile != null) { if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem(); ItemStack pItem = player.inventory.getCurrentItem();
// ***************************************************************************** // /******************************************************************************
// Crafting Anvil Recipes Crafting Anvil Recipes
// ***************************************************************************** // *****************************************************************************/
if((pItem.getItem().equals(PrimalItems.STONE_GALLAGHER)) || (pItem.getItem() == ModItems.forgehammer)){ if((pItem.getItem().equals(PrimalItems.STONE_GALLAGHER)) || (pItem.getItem() == ModItems.forgehammer)){
String [] tempArray = new String[25]; String [] tempArray = new String[25];
for(int i=0; i < 25 ; i++){ for(int i=0; i < 25 ; i++){
@@ -102,12 +102,29 @@ public class Anvil extends CustomContainerFacing {
if(recipe.getOutput().getItem() instanceof ToolPart){ if(recipe.getOutput().getItem() instanceof ToolPart){
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.getTagCompound().setTag("tags", tempNBT); outputStack.getTagCompound().setTag("tags", tempNBT);
outputStack.getSubCompound("tags").setBoolean("hot", false); outputStack.getSubCompound("tags").setBoolean("hot", false);
if(outputStack.getSubCompound("tags").getInteger("modifiers") < 3){ if(outputStack.getSubCompound("tags").getInteger("modifiers") < 3){
//Upgrade Redstone //Upgrade emerald
if(recipe.getUpgrade() == "emerald"){
outputStack.getSubCompound("tags").setInteger("emerald",
(outputStack.getSubCompound("tags").getInteger("emerald") + 1) );
outputStack.getSubCompound("tags").setInteger("modifiers",
(outputStack.getSubCompound("tags").getInteger("modifiers") + 1) );
}
//Upgrade diamond
if(recipe.getUpgrade() == "diamond"){
outputStack.getSubCompound("tags").setInteger("diamond",
(outputStack.getSubCompound("tags").getInteger("diamond") + 1) );
outputStack.getSubCompound("tags").setInteger("modifiers",
(outputStack.getSubCompound("tags").getInteger("modifiers") + 1) );
}
//Upgrade redstone
if(recipe.getUpgrade() == "redstone"){ if(recipe.getUpgrade() == "redstone"){
outputStack.getSubCompound("tags").setInteger("redstone", outputStack.getSubCompound("tags").setInteger("redstone",
(outputStack.getSubCompound("tags").getInteger("redstone") + 1) ); (outputStack.getSubCompound("tags").getInteger("redstone") + 1) );
@@ -115,6 +132,16 @@ public class Anvil extends CustomContainerFacing {
(outputStack.getSubCompound("tags").getInteger("modifiers") + 1) ); (outputStack.getSubCompound("tags").getInteger("modifiers") + 1) );
} }
//Upgrade lapis
if(recipe.getUpgrade() == "lapis"){
if(outputStack.getSubCompound("tags").getInteger("emerald") == 0 ) {
outputStack.getSubCompound("tags").setInteger("lapis",
(outputStack.getSubCompound("tags").getInteger("lapis") + 1));
outputStack.getSubCompound("tags").setInteger("modifiers",
(outputStack.getSubCompound("tags").getInteger("modifiers") + 1));
}
}
} }
CommonUtils.spawnItemEntityFromWorld(world, pos, outputStack); CommonUtils.spawnItemEntityFromWorld(world, pos, outputStack);
@@ -142,9 +169,9 @@ public class Anvil extends CustomContainerFacing {
} }
// ***************************************************************************** // /*****************************************************************************
// Adding and Removing Inventory With Tongs Adding and Removing Inventory With Tongs
// ***************************************************************************** // *****************************************************************************/
if( (pItem.getItem() != PrimalItems.STONE_GALLAGHER) || (pItem.getItem() != ModItems.forgehammer) ) { if( (pItem.getItem() != PrimalItems.STONE_GALLAGHER) || (pItem.getItem() != ModItems.forgehammer) ) {
@@ -157,7 +184,7 @@ public class Anvil extends CustomContainerFacing {
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
if (pItem.getItem().equals(ModItems.stonetongs)) { if (pItem.getItem().equals(ModItems.stonetongs)) {
if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 8)|| (pItem.getTagCompound().getInteger("type") == 0)) {
if (!tile.getSlotStack(counter).isEmpty()) { if (!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) { if (pItem.getTagCompound().getInteger("type") == 0) {
@@ -190,11 +217,21 @@ public class Anvil extends CustomContainerFacing {
} }
if (pItem.getTagCompound().getInteger("type") == 8) { if (pItem.getTagCompound().getInteger("type") == 8) {
ItemStack tempStack = new ItemStack (ModItems.pickaxehead, 1); ItemStack tempStack = new ItemStack (ModItems.pickaxehead, 1);
//tempStack. tempStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tempNBT = pItem.getSubCompound("tags");
tempStack.getTagCompound().setTag("tags", tempNBT);
//tile.setSlotStack((counter), new ItemStack); tile.setSlotStack((counter), tempStack);
pItem.getTagCompound().setInteger("type", 0); pItem.getTagCompound().setInteger("type", 0);
//System.out.println(counter);
pItem.getSubCompound("tags").setBoolean("hot", false);
pItem.getSubCompound("tags").setBoolean("emerald", false);
pItem.getSubCompound("tags").setInteger("diamond", 0);
pItem.getSubCompound("tags").setInteger("redstone", 0);
pItem.getSubCompound("tags").setInteger("lapis", 0);
pItem.getSubCompound("tags").setInteger("modifiers", 0);
return true; return true;
} }
} }
@@ -207,6 +244,35 @@ public class Anvil extends CustomContainerFacing {
tile.setSlotStack(counter, ItemStack.EMPTY); tile.setSlotStack(counter, ItemStack.EMPTY);
return true; return true;
} }
if (tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP)) {
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if (tile.getSlotStack(counter).getItem().equals(Items.EMERALD)) {
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if (tile.getSlotStack(counter).getItem().equals(PrimalItems.EMERALD_KNAPP)) {
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if (tile.getSlotStack(counter).getItem().equals(Items.REDSTONE)) {
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
if (tile.getSlotStack(counter).getItem().equals(ModItems.pickaxehead)) {
if(tile.getSlotStack(counter).getSubCompound("tags").getBoolean("hot") == false){
CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter));
tile.setSlotStack(counter, ItemStack.EMPTY);
return true;
}
}
} }
if (pItem.getItem().equals(Items.DIAMOND)) { if (pItem.getItem().equals(Items.DIAMOND)) {
@@ -217,6 +283,48 @@ public class Anvil extends CustomContainerFacing {
} }
} }
if (pItem.getItem().equals(Items.EMERALD)) {
if (tile.getSlotStack(counter).isEmpty()) {
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
pItem.shrink(1);
return true;
}
}
if (pItem.getItem().equals(PrimalItems.EMERALD_KNAPP)) {
if (tile.getSlotStack(counter).isEmpty()) {
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
pItem.shrink(1);
return true;
}
}
if (pItem.getItem().equals(PrimalItems.DIAMOND_KNAPP)) {
if (tile.getSlotStack(counter).isEmpty()) {
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
pItem.shrink(1);
return true;
}
}
if (pItem.getItem().equals(Items.REDSTONE)) {
if (tile.getSlotStack(counter).isEmpty()) {
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
pItem.shrink(1);
return true;
}
}
if (pItem.equals(new ItemStack(Items.DYE, 1, 4))) {
if (tile.getSlotStack(counter).isEmpty()) {
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage()));
pItem.shrink(1);
return true;
}
}
//4
} }
} }
counter++; counter++;
@@ -231,7 +339,7 @@ public class Anvil extends CustomContainerFacing {
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
if (pItem.getItem().equals(ModItems.stonetongs)) { if (pItem.getItem().equals(ModItems.stonetongs)) {
if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 8)|| (pItem.getTagCompound().getInteger("type") == 0)) {
if (!tile.getSlotStack(counter).isEmpty()) { if (!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) { if (pItem.getTagCompound().getInteger("type") == 0) {
@@ -295,7 +403,7 @@ public class Anvil extends CustomContainerFacing {
if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) {
if (pItem.getItem().equals(ModItems.stonetongs)) { if (pItem.getItem().equals(ModItems.stonetongs)) {
if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 8) || (pItem.getTagCompound().getInteger("type") == 0)) {
if (!tile.getSlotStack(counter).isEmpty()) { if (!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) { if (pItem.getTagCompound().getInteger("type") == 0) {
@@ -359,7 +467,7 @@ public class Anvil extends CustomContainerFacing {
if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) {
if (pItem.getItem().equals(ModItems.stonetongs)) { if (pItem.getItem().equals(ModItems.stonetongs)) {
if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 8) || (pItem.getTagCompound().getInteger("type") == 0)) {
if (!tile.getSlotStack(counter).isEmpty()) { if (!tile.getSlotStack(counter).isEmpty()) {
if (pItem.getTagCompound().getInteger("type") == 0) { if (pItem.getTagCompound().getInteger("type") == 0) {

View File

@@ -15,6 +15,7 @@ import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents; import net.minecraft.init.SoundEvents;
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.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@@ -83,15 +84,10 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
if (tile != null) { if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem(); ItemStack pItem = player.inventory.getCurrentItem();
ItemStack fuelItem = tile.getSlotStack(0); ItemStack fuelItem = tile.getSlotStack(0);
/* //System.out.println(pItem.getItem().getRegistryName().toString());
System.out.println(tile.getSlotStack(0));
System.out.println(tile.getSlotStack(1));
System.out.println(tile.getSlotStack(2));
System.out.println(tile.getSlotStack(3));
System.out.println(tile.getSlotStack(4));
System.out.println(tile.getSlotStack(5));
System.out.println(tile.getSlotStack(6));
*/
/*********************** /***********************
FUEL SLOT CODE FUEL SLOT CODE
@@ -206,38 +202,25 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
} }
} }
if (pItem.getItem().equals(ModItems.stonetongs)) {
if (pItem.getTagCompound().getInteger("type") == 0) {
for (int i = 2; i < tile.getSlotListSize(); i++) {
if (tile.getSlotStack(i).getItem().equals(ModItems.ironchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
pItem.getTagCompound().setInteger("type", 7);
return true;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironingotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
pItem.getTagCompound().setInteger("type", 6);
return true;
}
/*
To-Do
Insert StoneTongs Code for ToolPart Hot
*/
}
}
}
if(pItem.getItem() instanceof ToolPart){ if(pItem.getItem() instanceof ToolPart){
if(tile.getSlotStack(4).isEmpty()){ if(tile.getSlotStack(4).isEmpty()){
System.out.println("Adding player Item to slot");
tile.setSlotStack(4, pItem); tile.setSlotStack(4, pItem);
pItem.shrink(1); System.out.println(tile.getSlotStack(4));
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true; return true;
} }
} }
} }
} }
System.out.println(tile.getSlotStack(0));
System.out.println(tile.getSlotStack(1));
System.out.println(tile.getSlotStack(2));
System.out.println(tile.getSlotStack(3));
System.out.println(tile.getSlotStack(4));
System.out.println(tile.getSlotStack(5));
System.out.println(tile.getSlotStack(6));
} }
return false; return false;
} }

View File

@@ -184,6 +184,13 @@ public class ModCrafting {
String diamond = Items.DIAMOND.getRegistryName().toString(); String diamond = Items.DIAMOND.getRegistryName().toString();
String emerald = Items.EMERALD.getRegistryName().toString(); String emerald = Items.EMERALD.getRegistryName().toString();
String emeraldShard = PrimalItems.EMERALD_KNAPP.getRegistryName().toString();
String diamondShard = PrimalItems.DIAMOND_KNAPP.getRegistryName().toString();
String redstone = Items.REDSTONE.getRegistryName().toString();
String lapis = Items.DYE.getRegistryName().toString();
String pickaxehead = ModItems.pickaxehead.getRegistryName().toString();
/* /*
Empty = 0 Empty = 0
hotChunk = 1 hotChunk = 1
@@ -237,17 +244,54 @@ public class ModCrafting {
new ItemStack(ModItems.pickaxehead, 1), new ItemStack(ModItems.pickaxehead, 1),
"null" "null"
); );
//Makes a emerald Upgrade to Pickaxe Head
AnvilCrafting.addRecipe(
new String[] {
empty,empty,empty,empty,empty,
empty,empty,emeraldShard,empty,empty,
empty,empty,pickaxehead,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(ModItems.pickaxehead, 1),
"emerald"
);
//Makes a diamond Upgrade to Pickaxe Head
AnvilCrafting.addRecipe(
new String[] {
empty,empty,empty,empty,empty,
empty,empty,diamondShard,empty,empty,
empty,empty,pickaxehead,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(ModItems.pickaxehead, 1),
"diamond"
);
//Makes a Redstone Upgrade to Pickaxe Head //Makes a Redstone Upgrade to Pickaxe Head
AnvilCrafting.addRecipe( AnvilCrafting.addRecipe(
new String[] { new String[] {
empty,empty,empty,empty,empty, empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty, empty,empty,redstone,empty,empty,
empty,empty,empty,empty,empty, empty,empty,pickaxehead,empty,empty,
empty,empty,empty,empty,empty, empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty }, empty,empty,empty,empty,empty },
new ItemStack(ModItems.pickaxehead, 1), new ItemStack(ModItems.pickaxehead, 1),
"redstone" "redstone"
); );
//Makes a lapis Upgrade to Pickaxe Head
AnvilCrafting.addRecipe(
new String[] {
empty,empty,empty,empty,empty,
empty,empty,lapis,empty,empty,
empty,empty,pickaxehead,empty,empty,
empty,empty,empty,empty,empty,
empty,empty,empty,empty,empty },
new ItemStack(ModItems.pickaxehead, 1),
"lapis"
);
} }
} }

View File

@@ -1,5 +1,6 @@
package nmd.primal.forgecraft.items; package nmd.primal.forgecraft.items;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -10,13 +11,19 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.Crucible; import nmd.primal.forgecraft.blocks.Crucible;
import nmd.primal.forgecraft.blocks.CrucibleHot; import nmd.primal.forgecraft.blocks.CrucibleHot;
import nmd.primal.forgecraft.blocks.IngotBall; import nmd.primal.forgecraft.blocks.IngotBall;
import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileBaseCrucible; import nmd.primal.forgecraft.tiles.TileBaseCrucible;
import nmd.primal.forgecraft.tiles.TileBloomery; import nmd.primal.forgecraft.tiles.TileBloomery;
import nmd.primal.forgecraft.tiles.TileForge;
import java.util.List;
/** /**
* Created by mminaie on 1/23/17. * Created by mminaie on 1/23/17.
@@ -36,25 +43,26 @@ public class ItemStoneTongs extends Item {
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) { public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) { if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound()); item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
//this.setDamage(item, 1000); //this.setDamage(item, 1000);
item.getTagCompound().setInteger("type", 0); item.getTagCompound().setInteger("type", 0);
item.getTagCompound().setInteger("cooldown", 0); item.getTagCompound().setInteger("cooldown", 0);
//item.getTagCompound().setTag("toolpart", ); item.getTagCompound().setTag("tags", tags);
//item.getTagCompound().setBoolean("hot", false); item.getSubCompound("tags").setBoolean("hot", false);
//item.getTagCompound().setBoolean("emerald", false); item.getSubCompound("tags").setBoolean("emerald", false);
//item.getTagCompound().setInteger("diamond", 0); item.getSubCompound("tags").setInteger("diamond", 0);
//item.getTagCompound().setInteger("redstone", 0); item.getSubCompound("tags").setInteger("redstone", 0);
//item.getTagCompound().setInteger("lapis", 0); item.getSubCompound("tags").setInteger("lapis", 0);
item.getSubCompound("tags").setInteger("modifiers", 0);
//item.getTagCompound().setInteger("modifiers", 0);
//item.getTagCompound().setBoolean("active", false);
} }
} }
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{ {
@@ -75,6 +83,8 @@ public class ItemStoneTongs extends Item {
if(!world.isRemote) { if(!world.isRemote) {
ItemStack itemstack = player.getHeldItem(hand); ItemStack itemstack = player.getHeldItem(hand);
System.out.println(itemstack.getTagCompound().getInteger("type"));
System.out.println(itemstack.getSubCompound("tags"));
/***** /*****
Picks Up Hot Ingots from the Ground Picks Up Hot Ingots from the Ground
@@ -233,6 +243,38 @@ public class ItemStoneTongs extends Item {
} }
/*****
Pulls the Tool Parts from the Forge
*****/
if(itemstack.getTagCompound().getInteger("type") == 0){
if (world.getBlockState(pos).getBlock() == ModBlocks.firebox) {
TileForge tile = (TileForge) world.getTileEntity(pos);
for (int i = 2; i < tile.getSlotListSize(); i++) {
if (tile.getSlotStack(i).getItem().equals(ModItems.ironchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 7);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironingotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 6);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.pickaxehead)) {
itemstack.getTagCompound().setInteger("type", 8);
NBTTagCompound tempNBT = tile.getSlotStack(i).getSubCompound("tags");
itemstack.getTagCompound().setTag("tags", tempNBT);
itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
}
}
else return EnumActionResult.FAIL; else return EnumActionResult.FAIL;
//System.out.println(itemstack.getTagCompound().getInteger("type")); //System.out.println(itemstack.getTagCompound().getInteger("type"));
} }
@@ -241,4 +283,12 @@ public class ItemStoneTongs extends Item {
} }
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags"));
//tooltip.add(ChatFormatting.RED + "Consumes sticks");
}
} }

View File

@@ -1,5 +1,6 @@
package nmd.primal.forgecraft.items.toolparts; package nmd.primal.forgecraft.items.toolparts;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -12,6 +13,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List;
/** /**
* Created by mminaie on 3/11/17. * Created by mminaie on 3/11/17.
@@ -33,157 +35,157 @@ public class PickaxePart extends ToolPart {
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{ {
if (item.hasTagCompound()) { if (item.hasTagCompound()) {
if (item.getTagCompound().getBoolean("hot") == true) { if (item.getSubCompound("tags").getBoolean("hot") == true) {
return 1.0F; return 1.0F;
} }
if (item.getTagCompound().getBoolean("hot") == false) { if (item.getSubCompound("tags").getBoolean("hot") == false) {
if (item.getTagCompound().getInteger("modifiers") == 0) { if (item.getSubCompound("tags").getInteger("modifiers") == 0) {
return 0.0F; return 0.0F;
} }
} }
if (item.getTagCompound().getBoolean("hot") == false) { if (item.getSubCompound("tags").getBoolean("hot") == false) {
if (item.getTagCompound().getInteger("modifiers") != 0) { if (item.getSubCompound("tags").getInteger("modifiers") != 0) {
if ((item.getTagCompound().getBoolean("emerald") == true) && if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.1F; return 0.1F;
} }
if ((item.getTagCompound().getBoolean("emerald") == true) && if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 1) && (item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.11F; return 0.11F;
} }
if ((item.getTagCompound().getBoolean("emerald") == true) && if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 2) && (item.getSubCompound("tags").getInteger("diamond") == 2) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.12F; return 0.12F;
} }
if ((item.getTagCompound().getBoolean("emerald") == true) && if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 1) && (item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 1) && (item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.111F; return 0.111F;
} }
if ((item.getTagCompound().getBoolean("emerald") == true) && if ((item.getSubCompound("tags").getBoolean("emerald") == true) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 2) && (item.getSubCompound("tags").getInteger("redstone") == 2) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.102F; return 0.102F;
} }
// ============ // ============
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 1) && (item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.01F; return 0.01F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 2) && (item.getSubCompound("tags").getInteger("diamond") == 2) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.02F; return 0.02F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 3) && (item.getSubCompound("tags").getInteger("diamond") == 3) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.03F; return 0.03F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 1) && (item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.001F; return 0.001F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 2) && (item.getSubCompound("tags").getInteger("redstone") == 2) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.002F; return 0.002F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 3) && (item.getSubCompound("tags").getInteger("redstone") == 3) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.003F; return 0.003F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 1)) { (item.getSubCompound("tags").getInteger("lapis") == 1)) {
return 0.0001F; return 0.0001F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 2)) { (item.getSubCompound("tags").getInteger("lapis") == 2)) {
return 0.0002F; return 0.0002F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 3)) { (item.getSubCompound("tags").getInteger("lapis") == 3)) {
return 0.0003F; return 0.0003F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 1) && (item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 1) && (item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 1)) { (item.getSubCompound("tags").getInteger("lapis") == 1)) {
return 0.0111F; return 0.0111F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 2) && (item.getSubCompound("tags").getInteger("diamond") == 2) &&
(item.getTagCompound().getInteger("redstone") == 1) && (item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.021F; return 0.021F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 1) && (item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 2) && (item.getSubCompound("tags").getInteger("redstone") == 2) &&
(item.getTagCompound().getInteger("lapis") == 0)) { (item.getSubCompound("tags").getInteger("lapis") == 0)) {
return 0.012F; return 0.012F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 1) && (item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 2)) { (item.getSubCompound("tags").getInteger("lapis") == 2)) {
return 0.012F; return 0.012F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 0) && (item.getSubCompound("tags").getInteger("diamond") == 0) &&
(item.getTagCompound().getInteger("redstone") == 1) && (item.getSubCompound("tags").getInteger("redstone") == 1) &&
(item.getTagCompound().getInteger("lapis") == 2)) { (item.getSubCompound("tags").getInteger("lapis") == 2)) {
return 0.0012F; return 0.0012F;
} }
if ((item.getTagCompound().getBoolean("emerald") == false) && if ((item.getSubCompound("tags").getBoolean("emerald") == false) &&
(item.getTagCompound().getInteger("diamond") == 1) && (item.getSubCompound("tags").getInteger("diamond") == 1) &&
(item.getTagCompound().getInteger("redstone") == 0) && (item.getSubCompound("tags").getInteger("redstone") == 0) &&
(item.getTagCompound().getInteger("lapis") == 2)) { (item.getSubCompound("tags").getInteger("lapis") == 2)) {
return 0.0102F; return 0.0102F;
} }
} }
@@ -235,5 +237,12 @@ public class PickaxePart extends ToolPart {
} }
} }
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags"));
//tooltip.add(ChatFormatting.RED + "Consumes sticks");
}
} }

View File

@@ -113,11 +113,7 @@ public class TileForge extends TileBaseSlot implements ITickable {
} }
if (cookCounter2 >= recipe.getIdealTime()) { if (cookCounter2 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){ if(this.getSlotStack(i).hasTagCompound()){
NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
ItemStack outputStack = recipe.getOutput();
outputStack.getTagCompound().setTag("tags", tempNBT);
outputStack.getSubCompound("tags").setBoolean("hot", true);
this.setSlotStack(i, outputStack);
} else this.setSlotStack(i, recipe.getOutput()); } else this.setSlotStack(i, recipe.getOutput());
cookCounter2 = 0; cookCounter2 = 0;
} }
@@ -131,11 +127,7 @@ public class TileForge extends TileBaseSlot implements ITickable {
} }
if (cookCounter3 >= recipe.getIdealTime()) { if (cookCounter3 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){ if(this.getSlotStack(i).hasTagCompound()){
NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
ItemStack outputStack = recipe.getOutput();
outputStack.getTagCompound().setTag("tags", tempNBT);
outputStack.getSubCompound("tags").setBoolean("hot", true);
this.setSlotStack(i, outputStack);
} else this.setSlotStack(i, recipe.getOutput()); } else this.setSlotStack(i, recipe.getOutput());
cookCounter3 = 0; cookCounter3 = 0;
} }
@@ -149,11 +141,8 @@ public class TileForge extends TileBaseSlot implements ITickable {
} }
if (cookCounter4 >= recipe.getIdealTime()) { if (cookCounter4 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){ if(this.getSlotStack(i).hasTagCompound()){
NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
ItemStack outputStack = recipe.getOutput(); System.out.println("its hot now");
outputStack.getTagCompound().setTag("tags", tempNBT);
outputStack.getSubCompound("tags").setBoolean("hot", true);
this.setSlotStack(i, outputStack);
} else this.setSlotStack(i, recipe.getOutput()); } else this.setSlotStack(i, recipe.getOutput());
cookCounter4 = 0; cookCounter4 = 0;
} }
@@ -167,11 +156,7 @@ public class TileForge extends TileBaseSlot implements ITickable {
} }
if (cookCounter5 >= recipe.getIdealTime()) { if (cookCounter5 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){ if(this.getSlotStack(i).hasTagCompound()){
NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
ItemStack outputStack = recipe.getOutput();
outputStack.getTagCompound().setTag("tags", tempNBT);
outputStack.getSubCompound("tags").setBoolean("hot", true);
this.setSlotStack(i, outputStack);
} else this.setSlotStack(i, recipe.getOutput()); } else this.setSlotStack(i, recipe.getOutput());
cookCounter5 = 0; cookCounter5 = 0;
} }
@@ -185,11 +170,7 @@ public class TileForge extends TileBaseSlot implements ITickable {
} }
if (cookCounter6 >= recipe.getIdealTime()) { if (cookCounter6 >= recipe.getIdealTime()) {
if(this.getSlotStack(i).hasTagCompound()){ if(this.getSlotStack(i).hasTagCompound()){
NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true);
ItemStack outputStack = recipe.getOutput();
outputStack.getTagCompound().setTag("tags", tempNBT);
outputStack.getSubCompound("tags").setBoolean("hot", true);
this.setSlotStack(i, outputStack);
} else this.setSlotStack(i, recipe.getOutput()); } else this.setSlotStack(i, recipe.getOutput());
cookCounter6 = 0; cookCounter6 = 0;
} }

View File

@@ -6,12 +6,8 @@
"texture1": "forgecraft:blocks/iron_ingot" "texture1": "forgecraft:blocks/iron_ingot"
}, },
"overrides": [ "overrides": [
{ {"predicate": {"type": 0.0},"model": "forgecraft:item/ironpickaxehead_0"},
"predicate": { {"predicate": {"type": 1.0},"model": "forgecraft:item/ironpickaxehead_1"}
"type": 0.0
},
"model": "forgecraft:item/ironpickaxehead_0"
}
] ]
} }

View File

@@ -0,0 +1,8 @@
{
"parent": "forgecraft:item/pickaxehead",
"textures": {
"particle": "forgecraft:blocks/iron_ingot_hot",
"texture": "blocks/planks_oak",
"texture1": "forgecraft:blocks/iron_ingot_hot"
}
}