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

[1.18] Add entity start and stop tick events


Brokkoli3000
 Share

Recommended Posts

Hi!

 

I am trying to implement villagers following the player and want this to be possible also across dimensions. Now the problem is that the villager can't follow into a portal if his dimension gets unloaded too quickly. That's why my idea is to watch out for an event where the villager gets unloaded and teleport him to the target dimension then. But I found out that the EntityLeaveWorldEvent is generated rather rarely, probably when some dedicated entity cache overflows or something and certainly not just when the player changes the dimension. If the event hasn't been generated yet, the entity might still not receive ticks anymore because of the quite sophisticated Minecraft ticking functionality.

I checked the code but couldn't find any Forge events generated when ticking of an entity starts and ends. From what I understand is that ticking entities are managed by net.minecraft.world.level.entity.EntityTickList. There, the events could maybe be generated. Of course, I could hack around it, but in my opinion a Forge event would be appropriate here. Am I missing something? If not, could you please introduce this?

Edited by Brokkoli3000
Link to comment
Share on other sites

  • Brokkoli3000 changed the title to [1.18] Add entity start and stop tick events

do you have a connection between the player and the villager (one knowing of other withing your mods logic)?

if so, try subscribing to player clone event. when the player is cloned (new entity for new dimension, old one is one that entered the portal), have the villager following the old player entity make note of new player entity. and when the new player enters the world (in other dimension), you can try to make a clone of the old villager a few blocks from the portal.

just make sure that the dimension change is the reason for cloning.

Link to comment
Share on other sites

I think this would not meet my requirements well enough, because then the villager would disappear in the old dimension as soon as the player changes his dimension. This would even happen if another player stands in the old dimension watching the portal and thus wondering where the villager who was several meters away suddenly disappeared to. So if somebody is watching the portal, the villager should fully get to the portal and disappear then. So I figured, the event I am actually looking for is when the villager gets removed from the world or does not get updated anymore.

Btw: In the meantime I found out that adding these startTick and endTick events to EntityTickList wouldn't suffice, because for example the whole level might not get ticked.

Edited by Brokkoli3000
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hi guys! I currently have a project that I've been developing in a 'vanilla' environment that I'm actually looking to transfer over to Forge, simply because of how much better the experience would be using Forge. Before starting on this Forge mod, I was planning ahead and was looking at options for proxies, of which I would greatly like to use Velocity. In their docs and by asking around their Discord, they don't support support versions of Forge of 1.13 or later because of changes in the "handshake protocol". But I also really don't want to use an unsupported version of Forge, such as 1.12.2, to be able to use a proxy. I was pointed in the direction of potentially making my own client-side mod to allow Forge to be compatible with an updated proxy, such as Velocity. When asking for a direction for achieving this, I was told to have a look at how the Forge server implements logins and that the discrepancy might be with how modified the handshake protocol is. This sounds like quite the challenge to me and I'm completely up for trying to accomplish it. So for the sake of planning ahead and having a rough idea of how I could accomplish that when the time comes to work on it, has anyone else had experience with trying to achieve this? I appreciate any help or direction offered! Thanks! 
    • Been trying to set up a server for myself and a few friends through BisectHosting. I ended up replicating the server on my own computer to see if the issue persisted (if it was on bisect's end) and it was still there. Every time a player tries to connect to the server they start connecting but after only around 2 seconds the player is disconnected with the error message Payload size exceeds 1048576 bytes.  Upon inspection of the server debug file, the player always disconnects while fmlhandshake ticking packet info is being sent, and I have repeatedly made sure the mods and their configs are identical. I tried to get RandomPatches to increase the max allowed byte size, as the default seems to be 32767, but either something is wrong with it or some other mod is limiting the packet size limit.     Server Debug: https://pastebin.com/xZLbtdQB (only includes portions from after the server launched as I couldn't upload the whole file) Server Log: https://pastebin.com/yrJ3tNaW (similarly only after server launched (hence the weird say commands) Client Log: https://pastebin.com/inSzZV96 (whole thing for once) Modlist: https://pastebin.com/Qvurg45j (All but Optifine and BetterFoliage are present on the server as they have caused issues during startup)   Honestly stumped on how to fix this, been working on it for 10 hours across two days to no avail.
    • quiero dormir uwu
    • Hi, mod called "charging gadgets" is crushing forge minecraft 1.18.1 when i place block from this mod, im temporary playing On 1.18 cuz its not happening on 1.18 but c'mon, pls fix it, 1.18.1 is better and I Wonder i could use this version
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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