Jump to content

Display text on an custom GeckoLib entity?


RInventor7

Recommended Posts

  • RInventor7 changed the title to Display text on an custom GeckoLib entity?

This is not the Geckolib support forum.

Questions about geckolib should be asked wherever they provide support.

 

But you can display anything you like on any entity by writing your own layer and registering it using EntityRenderersEvent (see the subclasses).

There is no vanilla implementation of the behaviour you want, but you can find code to do it EntityRenderer.renderNameTag()

 

Layer is to EntityRenderer as Widget is to Screen.

Edited by warjort

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

  • 2 weeks later...

Given a GeoModel you can retrieve bone positions relative to the origin of the model. Here is a little example I made that was used to render an item that was "stuck to the bone":

- this is in kotlin and was for a tile entity. Use the concept behind this to render text at the positon of the desired bone

 

    /**
     * Add custom rendering code here outside geckolib's animation system
     */
    override fun renderFirst(
        tile: ChamberTile,
        model: GeoModel,
        stack: PoseStack,
        buffer: MultiBufferSource,
        packedLight: Int
    ) {
        val rootBone = model.getBone("root")
        rootBone.ifPresent { bone ->
            val rot = Math.toDegrees(abs(bone.rotationY).toDouble()) * 2
            stack.pushPose()
            stack.mulPose(Vector3f.YP.rotationDegrees(rot.toFloat()))
            stack.translate(bone.positionX.toDouble(), bone.positionY.toDouble(), bone.positionZ.toDouble())
            //Do world text rendering here (look at player name tag render code)
            //anything rendered at this point will be relative to the selected bone
            stack.popPose()
        }
    }

 

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



×
×
  • Create New...

Important Information

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