-
[1.16.5] Rendering text in world (Like hologram text)
bump
-
[1.16.5] Rendering text in world (Like hologram text)
Hello, sometime ago I asked help on this same thing and I figured something out, but the method I'm using is coming with a few problems. Foremost, it entirely breaks when using Optifine Shaders (I used the internal ones). And second of all, while it does render text the exact way I want it to, it doesn't have the transparent background like entity names would. Is there any better way to achieve what I'm trying to achieve? (This is all client side) Here is my current function: (I call it in RenderWorldLastEvent) protected void renderNameTag(MathUtils.Point pos, ITextComponent text, MatrixStack ms, IRenderTypeBuffer buffer, float partialTicks, float yOffset) { Minecraft mc = Minecraft.getInstance(); int combinedLightIn = mc.getEntityRenderDispatcher().getPackedLightCoords(mc.player, partialTicks); ms.pushPose(); ms.translate(pos.getX(), yOffset, pos.getY()); Quaternion q = mc.getEntityRenderDispatcher().cameraOrientation(); ms.mulPose(q); ms.scale(-0.025F, -0.025F, 0.025F); Matrix4f matrix4f = ms.last().pose(); float opacity = Minecraft.getInstance().options.getBackgroundOpacity(0.5F); int alpha = (int)(opacity * 255.0F) << 24; FontRenderer fontrenderer = Minecraft.getInstance().getEntityRenderDispatcher().getFont(); float width = (float)(-fontrenderer.width(text) / 2); //fontrenderer.drawInBatch(text, f2, i, 553648127, false, matrix4f, buffer, false, j, p_225629_5_); //fontrenderer.drawInBatch(text, width, 0f, 553648127, false, matrix4f, buffer, false, alpha, combinedLightIn); fontrenderer.drawInBatch(text, width, 0f, -1, false, matrix4f, buffer, true, 0, combinedLightIn); ms.popPose(); } If you need any additional information, please ask.
-
[1.16.5] JsonToNBT Textures
Oh, thanks. This also indeed fixed my texture problem. Thank you very much.
-
[1.16.5] JsonToNBT Textures
Alright, but how would I get the root NBT tag of an ItemStack? If I just use #getOrCreateTag it will just give me the tag and not the item ID etc right?
-
[1.16.5] JsonToNBT Textures
Okay let me explain a bit further: So the idea is you create a gui, it will then store all items from the gui as json and then you can load the exact same gui again. If that makes sense. As for how I create the ItemStack: ItemStack item = ItemStack.of(JsonToNBT.parseTag(itemObject.toString())); with itemObject being a JsonObject (the JSON for example showed in my OP)
-
[1.16.5] JsonToNBT Textures
Do you mean when going from ItemStack to JSON or from JSON to ItemStack?
-
[1.16.5] JsonToNBT Textures
I read them from a file, it's supposed to be like a customizable thing.
-
[1.16.5] JsonToNBT Textures
Because I have a bunch of JSON data of items and I want to turn them into actual ItemStacks. JsonToNBT is the first working class I found that does this.
-
[1.16.5] JsonToNBT Textures
[1.16.5] Hello, when I parse a JSON string to an ItemStack using JsonToNBT#parseTag with JSON seen beneath, the texture of the skull does not get applied. Any way to fix this? All other attributes / properties are being applied just fine. Here is the JSON I am using: { "id": "player_head", "Count": 1, "tag": { "CustomModelData": 100001, "HideFlags": -1, "SkullOwner": { "Id": [ 1334301174, 1630424667, -1957730237, 1373073981 ], "Properties": { "textures": [ { "Value": "ewogICJ0aW1lc3RhbXAiIDogMTYwMTU4MDc5MjcyMiwKICAicHJvZmlsZUlkIiA6ICJlZDUzZGQ4MTRmOWQ0YTNjYjRlYjY1MWRjYmE3N2U2NiIsCiAgInByb2ZpbGVOYW1lIiA6ICIwMTAwMDExMDAxMDAwMDExIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2FmMzgyMzQ1ZmQ3OWZjNzgzNjFjNjFjOTYyMzBjNjk0YzM0NDc5MzU4YWMwYWU0OWM0ZGI3YTYyNGE1YWZlNTQiCiAgICB9CiAgfQp9" } ] } }, "display": { "Name": "{\"italic\":false,\"color\":\"yellow\",\"text\":\"Next \\u003e\"}" } } } Kind regards, Kyllian
-
[1.16.5] In world rendered text using FontRenderer.renderInBatch cutting out part of block behind it
Sorry for replying to this old post, well not that old... I don't even have a solution for you but I'm trying to figure out this drawInBatch function out... What exactly is the combinedLightIn and how do you obtain it's value?
-
[1.16.5] Help with drawInBatch
Yeah, no problem, I'm just trying to see if anyone else on the forum knows any solutions since I really can't figure this out.
- [1.16.5] Help with drawInBatch
-
[1.16.5] Help with drawInBatch
I'm not sure if bumping is allowed on this forum, if not sorry. But was just wondering if anyone else got any ideas?
-
[1.16.5] Help with drawInBatch
It seems that the following post seemed to be trying to do about the same as I am. It had a simple solution of using EntityRenderer#drawNameplate, but that function doesn't exist in 1.16.5, and I can't find any renames or alternatives for it except for the original method I mentioned in my OP, but that method is protected and requires an entity.
-
[1.16.5] Help with drawInBatch
Problems 1 and 3 mentioned in the OP: 1) The text itself is kind of hard to see. I tried figuring out how to change the opacity for example, but I only managed to change the opacity of the box in its whole which did not help. 3) The text seems to be rotating in the wrong direction compared to the player's YAW.
IPS spam blocked by CleanTalk.