Jump to content

Deforner

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Deforner's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello Guys, how do I delete an Item right after crafting. I made an IRecipe with my own Item and this should right after i click on the crafting result break randomly. I have a random number, which decides if the Item will break or not, but I don't know how I should delete it. I tried it with TagCompound (here a boolean "broken") and then I used the onUpdate method, but it's not working right after I get it out the crafting table and put it back in. It really should break right after the first click on the Item in the result field. And the best case would be without the boolean. I hope you can help me. yours Deforner Code:
  2. Hello guys, i am trying to learn modding with forge and got my first problem and i don't have a solution for this. I hope you can help me. I tried to make a sword, which can be "upgraded" by crafting it with a diamond. GameRegistry.addShapelessRecipe(stackSaphire_sword, stackSaphire_sword, stackDiamond); So I used the on-Crafted method in my SaphireSword class and nbt tags to make the "upgrade" become visible. But it should not everytime succeed. First you have a 50% to 50% chance to succeed. Got all this with the on-Crafted method but now I tried to delete the crafting result but only if it fails. The idea is that you have a 50% chance upgrading your item. On the other hand it could be deleted. And I don't know how i can do this. How do I delete a crafting result after getting it out of the craftingtable? I tried to dmg the Item to delete it but i was still there full damaged. Here is my Code Snippet. My whole class is on pastebin: http://pastebin.com/dGguFT5A @Override public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { tooltip.add("Dieses Item gehört: " + getNBTTag(stack, TAG_PLAYERNAME)); if(upgrade >= 1) { tooltip.add("Stufe: " + upgrade); } } @Override public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) { if(!playerIn.worldObj.isRemote) { checkUpdate(); if (getRandomNumber() == 2 && upgrade < 10) { addOneToUpgrade(); setNBTData(stack, playerIn); } else { //How do i delet the crafting result? } } } public static void addOneToUpgrade() { upgrade++; } public int getRandomNumber() { int zufallszahl = (int) ((Math.random()*range)+1); return zufallszahl; } public static void checkUpdate() { switch (upgrade) { case 0: range = 2; //50% break; case 1: range = 2; //50% break; case 2: range = 3; //33% break; case 3: range = 3; //33% break; case 4: range = 3; //33% break; case 5: range = 4; //25% break; case 6: range = 4; //25% break; case 7: range = 5; //20% break; case 8: range = 5; //20% break; case 9: range = 6; //17% break; default: break; } } I hope you can help me. Greeting Dennis
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.