Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.