December 3, 201410 yr Author You need to add the metadata check, duh. I know that, but how do I check the metadata?
December 3, 201410 yr hand.getItemDamage() == 1 ? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 3, 201410 yr Describe how it doesn't work. What seems to be the issue? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 3, 201410 yr Author Describe how it doesn't work. What seems to be the issue? 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.
December 3, 201410 yr Just above that if statement, put this: System.out.println("Right clicked with: " + hand.getItem() + ":" + hand.getItemDamage()); System.out.println(hand.getItem() == Item.getItemFromBlock(Blocks.log)); System.out.println(hand.getItemDamage() == 0); System.out.println((hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 0)); Then tell me what it prints out when you use various blocks. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 3, 201410 yr For the love of god, why not just simply use java correctly? if(entityplayer.getCurrentEquippedItem() != null && (entityplayer.getCurrentEquippedItem().getItem() == Item.getItemFromBlock(Blocks.log) && entityplayer.getCurrentEquippedItem().getItemDamage() == 2)) Bugzoo i see you are new to this so i just give you a simple advice. Use the vanilla src!
December 3, 201410 yr Author Just above that if statement, put this: System.out.println("Right clicked with: " + hand.getItem() + ":" + hand.getItemDamage()); System.out.println(hand.getItem() == Item.getItemFromBlock(Blocks.log)); System.out.println(hand.getItemDamage() == 0); System.out.println((hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 0)); Then tell me what it prints out when you use various blocks. 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
December 3, 201410 yr Ok, now make your code look like this: System.out.println("Right clicked with: " + hand.getItem() + ":" + hand.getItemDamage()); System.out.println(hand.getItem() == Item.getItemFromBlock(Blocks.log)); System.out.println(hand.getItemDamage() == 0); System.out.println((hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 0)); if(hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 0) { System.out.println("Right clicked with the right block!");//this is the only new line And give me the output again. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 3, 201410 yr Author For the love of god, why not just simply use java correctly? if(entityplayer.getCurrentEquippedItem() != null && (entityplayer.getCurrentEquippedItem().getItem() == Item.getItemFromBlock(Blocks.log) && entityplayer.getCurrentEquippedItem().getItemDamage() == 2)) Bugzoo i see you are new to this so i just give you a simple advice. Use the vanilla src! 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.
December 3, 201410 yr And now you know why we use trace statements. They tell you what the program is doing as it does it, and lets you locate the problem area of code rather than BLINDLY GUESSING. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 3, 201410 yr Author And now you know why we use trace statements. They tell you what the program is doing as it does it, and lets you locate the problem area of code rather than BLINDLY GUESSING. Yea, so sorry about so much fuss over me being blind https://www.youtube.com/watch?v=YhSXAyybEIM
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.