Jump to content

How to get entity by its UUID (1.20.1)


techdev

Recommended Posts

ok so im trying to make a telescopic sight block, ive heard i need a entity to be used as the camera/renderer, i can get the entity spawning and UUID saving functional, but i cant seem to find a way to get the entity back with its UUID
ive searched a lot but all the methods i found seems to use the World class, which doesnt seem to be in 1.20

saving (zombie is a placeholder)

if (!level.isClientSide()){
            BlockEntity BE = level.getBlockEntity(pos);
            if(BE instanceof ScopeEntity blockEntity){
                Entity entity = new Zombie(EntityType.ZOMBIE, level);
                entity.moveTo(pos.getX() + 0.5f, pos.getY() + 1, pos.getZ() + 0.5f);
                level.addFreshEntity(entity);
                blockEntity.saveID(entity.getUUID());
            }
        }

 

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.



×
×
  • Create New...

Important Information

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