Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Issue with Event (1.16.4)
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
Babelincoln1809

Issue with Event (1.16.4)

By Babelincoln1809, February 23 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Babelincoln1809    0

Babelincoln1809

Babelincoln1809    0

  • Stone Miner
  • Babelincoln1809
  • Members
  • 0
  • 88 posts
Posted February 23

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

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7699

diesieben07

diesieben07    7699

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7699
  • 56430 posts
Posted February 23

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.

  • Quote

Share this post


Link to post
Share on other sites

Babelincoln1809    0

Babelincoln1809

Babelincoln1809    0

  • Stone Miner
  • Babelincoln1809
  • Members
  • 0
  • 88 posts
Posted February 23 (edited)
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 February 23 by Babelincoln1809
  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7699

diesieben07

diesieben07    7699

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7699
  • 56430 posts
Posted February 24
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.

  • Quote

Share this post


Link to post
Share on other sites

Babelincoln1809    0

Babelincoln1809

Babelincoln1809    0

  • Stone Miner
  • Babelincoln1809
  • Members
  • 0
  • 88 posts
Posted February 24
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

  • Quote

Share this post


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.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • <Gl33p_0r4nge>
      [1.16.4] Screen Render

      By <Gl33p_0r4nge> · Posted 59 minutes ago

      Okay I see that no one probably know how but can you at least tell me where should I get the rendered player view?  
    • Luis_ST
      [1.16.5] Help with custom Backpack (slot background and mouse wheel move)

      By Luis_ST · Posted 2 hours ago

      I don't know what code I would still be helpful, so here are the relevant classes in my git repo: TextureStitchEvent: https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/events/other/OnTextureStitchEvent.java BackpackContainer (with custom slot subclass): https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/common/inventory/container/BackpackContainer.java   I think I understood after trying something: my message class requires 3 methods (encode, decode, handle) which I then have to specify when registering the message (parameter 3 - 6). Am I right?
    • troublemaker_47
      Teleport player in same direction as where he looks

      By troublemaker_47 · Posted 3 hours ago

      Can you please tell me how to use the teleportcommand method or its syntax. @diesieben07
    • Zemelua
      [1.16] Creating a Connection Texture

      By Zemelua · Posted 3 hours ago

      I'm working on creating a Connection Texture block. I knew I needed to use something like IModelGeometry for that, but I don't know exactly what to do. I would like to refer to ANDESITE_VARIANTS of Create mod ( https://github.com/Creators-of-Create/Create/tree/9d77f85b9442910a3f595c58f41cb3363093384e ). Could you please explain? 
    • DmitryLovin
      To do something after all mods have been loaded

      By DmitryLovin · Posted 3 hours ago

      Well, I kinda fixed it: for(HeadPack pack:ipack){ Minecraft.getInstance().getResourcePackList().addPackFinder( (infoConsumer, infoFactory) -> { infoConsumer.accept(infoFactory.create(pack.getName(), true,()->pack,pack, new PackMetadataSection(new StringTextComponent(pack.getName()),6),ResourcePackInfo.Priority.BOTTOM,IPackNameDecorator.BUILTIN)); } ); } But it works only after I reload packs or something, keep looking what I did wrong.   upd: I guess I still need to add it in ResourceManager manually like before as well: ((SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addResourcePack(pack); because minecraft do it only when you reload resourcepacks or change them. Can be closed.
  • Topics

    • <Gl33p_0r4nge>
      1
      [1.16.4] Screen Render

      By <Gl33p_0r4nge>
      Started Monday at 02:58 PM

    • Luis_ST
      9
      [1.16.5] Help with custom Backpack (slot background and mouse wheel move)

      By Luis_ST
      Started Wednesday at 07:47 AM

    • troublemaker_47
      7
      Teleport player in same direction as where he looks

      By troublemaker_47
      Started 20 hours ago

    • Zemelua
      0
      [1.16] Creating a Connection Texture

      By Zemelua
      Started 3 hours ago

    • DmitryLovin
      5
      To do something after all mods have been loaded

      By DmitryLovin
      Started Wednesday at 05:28 AM

  • Who's Online (See full list)

    • skeletal
    • Choonster
    • CookieLukas
    • Luis_ST
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Issue with Event (1.16.4)
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community