Jump to content

[1.19.4] How to prevent leash knots from disappearing?


JimiIT92

Recommended Posts

I want to make the player be able to attach a leash to a fence without a mob leashed to it.

So essentially have a fence persisting like this
t9GOX83.png

However when I realod the world the leash knot is gone, and I don't understand why (I know it's a vanilla feature, but even looking at the entity code I can't find out why it breaks so I can override it).

What I've tried so far is to intercept the EntityLeaveLevelEvent, but that seems to not be firing when reloading the world and removing the entity.
So what is actually been fired when the lead disappear, so I can prevent it? Where should I look into?

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

HangingEntity.survives() ?

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

27 minutes ago, warjort said:

HangingEntity.survives() ?

That was the first method I've looked into, but doesn't seem to be called on world reload. Also the leash knot entity overrides the base method by simply checking the block is "knotted" to is a fence block, which in this case it is

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Don't know then. Looks like a job for your debugger.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Unless what you are actually doing is just creating a ghost entity on the client?

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

I think I figured out what the problem is: the leash knot entity type has the noSave() attribute set
 

public static final EntityType<LeashFenceKnotEntity> LEASH_KNOT = register("leash_knot", EntityType.Builder.<LeashFenceKnotEntity>of(LeashFenceKnotEntity::new, MobCategory.MISC).noSave().sized(0.375F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE));

What I've tried is to create a custom entity that extends the LeashFenceKnotEntity class and when registering it I removed the noSave attribute, and sure enough it worked: the leash stayed through world reloads.
But that raises another question: can I remove this attribute from the vanilla entity? Since having to create a custom entity imply that I have to replace all vanilla leash knots with custom ones when they are added (which is not optimal I guess)

Don't blame me if i always ask for your help. I just want to learn to be better :)

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I think my save file was potentially corrupted (based on what I have been reading online). The world has loaded and saved perfectly fine for weeks. Today I added about 6 new mods and updated 3 mod libraries, and then encountered the following error: "Errors in currently selected data packs prevented the world from loading. You can either try to load it with only the vanilla data pack ("safe mode"), or go back to the title screen and fix it manually." I have tried changing to a newer Forge version, reverting the updated mods back to original versions, removing the new mods, removing and readding all mods, removing my world file and loading the forge profile and adding it back, renaming the level.dat_old file as level.dat... Nothing has worked yet. Forge loads fine and I don't want to risk trying to reload the world in "safe mode" in case I end up losing mod-related content. Not sure how that works. I am having trouble reading the output log to determine what is causing the error. Any advice is better than none!! Thank you!     Info: Minecraft 1.20.1 Forge 47.1.3 Mod list (includes which mods are disabled, newly added before this error, and any changes I found after the error) : https://pastebin.com/nquXY1Hj Latest log: https://pastebin.com/U4fD0kAt
    • It all began with a chance encounter with a testimonial shared by Olivia, a fellow traveler on the winding road of cryptocurrency. Her words spoke of a miraculous recovery orchestrated by Wizard Web Recovery, a beacon of hope in the murky waters of online fraud. Intrigued by her story, I reached out to Wizard Web Recovery, hoping they could work their magic on my blocked crypto recovery. With bated breath, I shared my plight, providing evidence of my dilemma and praying for a solution. To my astonishment, a prompt response came, swift and reassuring. Wizard Web Recovery wasted no time in assessing my situation, guiding me through the process with patience and expertise. and then like a ray of sunshine breaking through the clouds, came the news I had longed for – a new private key had been generated, restoring my precious bitcoins. It was a moment of jubilation, a triumph over adversity that filled me with newfound hope. At that moment, I realized the true power of Wizard Web Recovery, not just as skilled technicians, but as guardians of trust in the digital realm. With their assistance, I reclaimed what was rightfully mine, turning despair into determination and paving the way for a brighter future. But their capabilities did not end there. Delving deeper into their expertise, I discovered that Wizard Web Recovery possessed a wealth of knowledge in reclaiming lost stolen cryptocurrency, and even exposing fraudulent investment schemes. So to all those who find themselves entangled in the web of online fraud, take heart. With the guidance of Wizard Web Recovery, there is a path to redemption.     Write Mail; ( Wizard webrecovery AT  vprogrammer. net ) 
    • It all began with a chance encounter with a testimonial shared by Olivia, a fellow traveler on the winding road of cryptocurrency. Her words spoke of a miraculous recovery orchestrated by Wizard Web Recovery, a beacon of hope in the murky waters of online fraud. Intrigued by her story, I reached out to Wizard Web Recovery, hoping they could work their magic on my blocked crypto recovery. With bated breath, I shared my plight, providing evidence of my dilemma and praying for a solution. To my astonishment, a prompt response came, swift and reassuring. Wizard Web Recovery wasted no time in assessing my situation, guiding me through the process with patience and expertise. and then like a ray of sunshine breaking through the clouds, came the news I had longed for – a new private key had been generated, restoring my precious bitcoins. It was a moment of jubilation, a triumph over adversity that filled me with newfound hope. At that moment, I realized the true power of Wizard Web Recovery, not just as skilled technicians, but as guardians of trust in the digital realm. With their assistance, I reclaimed what was rightfully mine, turning despair into determination and paving the way for a brighter future. But their capabilities did not end there. Delving deeper into their expertise, I discovered that Wizard Web Recovery possessed a wealth of knowledge in reclaiming lost stolen cryptocurrency, and even exposing fraudulent investment schemes. So to all those who find themselves entangled in the web of online fraud, take heart. With the guidance of Wizard Web Recovery, there is a path to redemption.    
    • How can I add drops when killing an entity? Now there are no drops. How can I add an @override to change the attack speed to 1.6 and show "when in main hand...attack damage,...attack speed"? also, how can I make the item enchantable? 
    • Ok. Thanks. by the way, will this crash in any circumstances? public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) { if (entity instanceof LivingEntity){ LivingEntity victim = (LivingEntity) entity; if(!victim.isDeadOrDying() && victim.getHealth()>0){ victim.setHealth(0); return true; } } return false; }  
  • Topics

×
×
  • Create New...

Important Information

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