Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Issue with Event (1.16.4)


Recommended Posts

I'm running into a bug with an event of mine where when a player has a certain item in their inventory it'll cause whatever mob they hit to set on fire. I set the setfire method to 3 ticks, but keeps on going infinitely until the mob is dead. If throw the item out of my inventory after I hit the mob, then it'll last the intended amount of time. I tried multiple ways on fixing the issue and trying different methods of getting this to work, but to no avail. Any help would be much appreciated.

 

Here's how I currently have it: https://pastebin.com/SHT97LJd

 

I'm also having thoughts that multiple players will be able to cause mobs to be set on fire if only one player as the item in their inventory on a server, but that has yet to be tested, and is another bug for another day

Link to post
Share on other sites

Please learn what static means, you cannot use it that way. Your hasItem field will be shared across the whole server between all players.

No idea why you are using two events here instead of just checking the held item in the attack event.

Link to post
Share on other sites
2 hours ago, diesieben07 said:

Please learn what static means, you cannot use it that way

I did not notice that was there! Probably made it's way back from undoing code so many times lol

 

2 hours ago, diesieben07 said:

No idea why you are using two events here instead of just checking the held item in the attack event.

Good point, for some reason thought it would fix the issue lol

 

2 hours ago, diesieben07 said:

Your hasItem field will be shared across the whole server between all players

What should I be looking for to get that to not be shared across players, but only to the one who has the item in their inventory? I haven't really thought about that being an issue until I made the post, and I'm focused on fixing that rather than the fire issue now

 

 

Edited by Babelincoln1809
Link to post
Share on other sites
8 hours ago, Babelincoln1809 said:

What should I be looking for to get that to not be shared across players, but only to the one who has the item in their inventory?

If you really would need that, you need to use a capability attached to the player. However here you do not need that.

Link to post
Share on other sites
6 hours ago, diesieben07 said:

If you really would need that, you need to use a capability attached to the player. However here you do not need that.

Alright, I rewrote the entire event, and fixed the infinite fire event and I believe it also fixes the multiple players issue as well. Although, I can't really test that at the moment.

 

Here's the code: https://pastebin.com/CTj6jbtY

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I just got started with modding and I'm trying to create one. I did everything that the Forge Documentation said, ran the Eclipse IDE launch configurations and after trying to run   gradlew build after 46% of the build I got an error:   > Task :compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find net.minecraftforge:forge:1.16.5-36.1.0_mapped_official_1.16.5. Searched in the following locations: - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.module - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - file:/C:/Users/Zalman/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom - file:/C:/Users/Zalman/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - https://libraries.minecraft.net/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - https://repo.maven.apache.org/maven2/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom Required by: project : * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.8.1/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 35s 1 actionable task: 1 executed I tried deleting the gradle cache (in C:\Users\username\.gradle) and building again, nothing. Tried deleting the whole project, putting the forge files back and generating the launch configurations again, still nothing. I'd appreciate some support with this.
    • Ugh, I posted in the wrong category, sorry.
    • I just got started with modding and I'm trying to create one. I did everything that the Forge Documentation said, ran the Eclipse IDE launch configurations and after trying to run   gradlew build after 46% of the build I got an error:   > Task :compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find net.minecraftforge:forge:1.16.5-36.1.0_mapped_official_1.16.5. Searched in the following locations: - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.module - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - file:/C:/Users/Zalman/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom - file:/C:/Users/Zalman/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - https://libraries.minecraft.net/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.jar - https://repo.maven.apache.org/maven2/net/minecraftforge/forge/1.16.5-36.1.0_mapped_official_1.16.5/forge-1.16.5-36.1.0_mapped_official_1.16.5.pom Required by: project : * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.8.1/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 35s 1 actionable task: 1 executed I tried deleting the gradle cache (in C:\Users\username\.gradle) and building again, nothing. Tried deleting the whole project, putting the forge files back and generating the launch configurations again, still nothing. I'd appreciate some support with this.  
    • This is the launcher log, it's the only place where I see any reference to an error.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.