Jump to content

Bugzoo

Members
  • Posts

    268
  • Joined

  • Last visited

Everything posted by Bugzoo

  1. I know how to get the held item. I just want to know how I can decrease 1 item from that stack
  2. Or in other words, HOW do I decrement the stack size
  3. Ok, I've now got this code player.inventory.setInventorySlotContents(player.inventory.currentItem, null); But that takes the whole stack away, how do I only take 1 away?
  4. I want to consume one log (ex. spruce) everytime I right click on a block. Here is where I've got so far player.inventory.consumeInventoryItem(Item.getItemFromBlock(Blocks.log)); But that code consume only oak log, but I want it to consume spruce
  5. Yea, so sorry about so much fuss over me being blind https://www.youtube.com/watch?v=YhSXAyybEIM
  6. OMFG! I just realized I was running another if statement somewhere in the method which checked if the block was a log, and if it was it ran some code. That was the problem. But, on a sidenote, i'm not new to this. I have been programming in java for 4 years, programming minecraft mods for 2 years. Published 3 mods. So, i'm not really new to this.
  7. When I right click with oak it prints this [com.bugzoo.GranterMod.BlockGranter:onBlockActivated:50]: Right clicked with: net.minecraft.item.ItemMultiTexture@1c29de2:0 true true true When I right click with any other type of log it prints out this [com.bugzoo.GranterMod.BlockGranter:onBlockActivated:50]: Right clicked with: net.minecraft.item.ItemMultiTexture@1c29de2:3 true false false
  8. I just noticed something. That line of code does work. So if I did if(hand.getItemDamage() == 0) The if statement would run, only if the block is Spruce or Dark Oak. Though if I do this if(hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 0) It runs no-matter what log it is.
  9. ? That doesn't work.
  10. I know that, but how do I check the metadata?
  11. Yea, so this if statement if(hand.getItem() == Item.getItemFromBlock(Blocks.log)) Runs the code no-matter what log it is. I only want it to run if it is birch
  12. Yea, thats what i'm trying to do, but that code doesn't work. It runs the method no-matter what log it is
  13. Ok, the way my code works, is if you right click with a birch log it runs the code within the if statement, so why shouldn't it go in the if statement?
  14. public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(player.getCurrentEquippedItem() != null) { ItemStack hand = player.getCurrentEquippedItem(); if(hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 1) { player.inventory.addItemStackToInventory(new ItemStack(Blocks.log, 1, 1)); player.inventory.consumeInventoryItem(Item.getItemFromBlock(Blocks.log)); RenderGranter.isAnimated = true; RenderGranter.renderOak = true; System.out.println(hand.getItem().getMetadata(1)); world.spawnEntityInWorld((new EntityLightningBolt(world, x, y+1, z))); world.createExplosion((Entity)player, (double)x, (double)y, (double)z, 2F, false); } } }
  15. if(player.getCurrentEquippedItem() != null) { ItemStack hand = player.getCurrentEquippedItem(); if(hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 1) { player.inventory.addItemStackToInventory(new ItemStack(Blocks.log, 1, 1)); player.inventory.consumeInventoryItem(Item.getItemFromBlock(Blocks.log)); RenderGranter.isAnimated = true; RenderGranter.renderOak = true; System.out.println(hand.getItem().getMetadata(1)); world.spawnEntityInWorld((new EntityLightningBolt(world, x, y+1, z))); world.createExplosion((Entity)player, (double)x, (double)y, (double)z, 2F, false); } } }
  16. How do I check for birch specifically?
  17. It runs the method if you right click with any type of wood
  18. Thanks, that works, but now going back in time to this. I've got this code if(hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 1) But this doesn't work
  19. I've got this code player.inventory.setInventorySlotContents(int, itemstack); So what arguments do I have to put in?
  20. Lol, well how do I get the slot?
  21. Tried this and it crashed my game player.inventory.currentItem = (Integer) null;
  22. I've got that, but now I need to consume the birch wood player.inventory.consumeInventoryItem(Item.getItemFromBlock(Blocks.log));
  23. Ok, that works for oak wood, but how do I do it for birch using hand.getItemDamage?
  24. I want to check if Birch wood is in the players hand if(hand.getItem() == Blocks.log) I have this code, but I get an error and thats oak and not birch
  25. The diamond block that I render on my item
×
×
  • Create New...

Important Information

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