Posted June 12, 20196 yr alright so I'm trying to make an event that basically "if conditions are met spawn sword in hand and if conditions are met for other if statement remove sword" but thing is when i tried the event it seemed to run both if statements at almost the same time making my sword invisible upon spawning it i basically had to throw the sword out of my inventory to see it then i tried checking if the world wasn't remote for it to work but when i do "if(!world.isRemote)" it basically completely stops working. no code is run. My event class. https://pastebin.com/Rr24Nj2g
June 12, 20196 yr 1) You have fields that you can't have (what happens when there's more than 1 player?) You shouldn't need either of these variables anyway. If the sword exists, it must be in the active hand to be removed (if the sword exists at all, and can be removed, then its been spawend). If the player moves the sword to a different slot then itemArea will be wrong. 2) RightClickEmpty already runs when the active hand slot is empty, so why are you checking to see if the active hand slot is empty? 3) And of course, if there's a sword in that slot, the event won't fire because you right clicked while not empty 4) Your code style is awful, please put the two if statements on line 38 on different lines and correctly indent things. 5) Don't check chest.getItem().equals(ModItems.HANZOS_CHESTPLATE) && playerIn.isSneaking() twice. Put those in the outer if statement. 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.
June 13, 20196 yr Author On 6/12/2019 at 7:05 PM, Draco18s said: 1) You have fields that you can't have (what happens when there's more than 1 player?) You shouldn't need either of these variables anyway. If the sword exists, it must be in the active hand to be removed (if the sword exists at all, and can be removed, then its been spawend). If the player moves the sword to a different slot then itemArea will be wrong. 2) RightClickEmpty already runs when the active hand slot is empty, so why are you checking to see if the active hand slot is empty? 3) And of course, if there's a sword in that slot, the event won't fire because you right clicked while not empty 4) Your code style is awful, please put the two if statements on line 38 on different lines and correctly indent things. 5) Don't check chest.getItem().equals(ModItems.HANZOS_CHESTPLATE) && playerIn.isSneaking() twice. Put those in the outer if statement. thanks, None of that would really fix my major problem but those are things i should've fixed either way, in the end i figured out the problem and im currently fixing it.
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.