Jump to content

Recommended Posts

Posted

Hey I'm back again, so I have been working on a mod and while doing so have encountered several issues and difficult things to code the hardest that the people and I have thought about was basically freezing time for everything besides the player. I just started working on this and this is the code I've got for it so far so any help would be huge and greatly appreciated and I am modding for 1.18.

 

AttributeModifier timestop = new AttributeModifier(UUID.fromString("ce90df2c-feb2-4fb9-b98f-666a26458ed2"),
            "time_stop", 25.0D, AttributeModifier.Operation.ADDITION);
    
    
    public class FreezeEntities
    {
        public static void freezeAllEntities()
        {
            MinecraftForge.EVENT_BUS.register(new Object()
            {
                @SubscribeEvent
                public void onEntityTick(TickEvent.WorldTickEvent event)
                {
                    if (event.phase == TickEvent.Phase.END)
                    {
                        for (Entity entity : event.world.getEntities(null, null))
                        {
                            entity.setNoGravity(true);
                            entity.lerpMotion(0, 0, 0);
                        }
                    }
                }
            });
        }
    }

Posted

While this stops the entity movement, it doesn't stop an entity from ticking which means the logic is still happening. I think in 1.18 you could use the LivingUpdateEvent to cancel living entity logic, but for all other entities, you would need to use some kind of injection into the entity to achieve the desired result most likely.

Posted
5 minutes ago, ChampionAsh5357 said:

While this stops the entity movement, it doesn't stop an entity from ticking which means the logic is still happening. I think in 1.18 you could use the LivingUpdateEvent to cancel living entity logic, but for all other entities, you would need to use some kind of injection into the entity to achieve the desired result most likely.

so what I'm trying to do is stop all entity movement and make knockback and damage stack but allow the player to move this does help tho so thanks

Posted

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.

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



×
×
  • Create New...

Important Information

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