Jump to content

Recommended Posts

Posted

Hi there!

Just wanna ask you some help. I'd like to draw a red point (a small red circle) in the middle of a block face. I've been reading about quads, textures, and all that stuff, but I'm sure there must be an easy and quick way of doing what I want. Is it?

Thanks! :D

Posted (edited)

I have this. Now just trying to render a simple line xD. Anyone can help? Am I in the good way? Help!

Quote

public void render(Minecraft minecraft) {

        if (PyroCapability.PYRO.isRegistered()) {
            MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
            PlayerList players = server.getPlayerList();
            String[] names = server.getPlayerNames();

            RenderSystem.enableDepthTest();
            RenderSystem.setShader(GameRenderer::getPositionColorShader);

            RenderSystem.disableTexture();
            RenderSystem.disableBlend();

            for (String name : names) {
                Player player = players.getPlayerByName(name);
                PyroCapabilityInterface pyro = player.getCapability(PyroCapability.PYRO).orElse(null);
                if (pyro != null) {

                    ArrayList<Objectiu> objectius = pyro.getObjectius();
                    if (objectius != null) {

                        if (!objectius.isEmpty()) {
                            for (Objectiu obj : objectius) {
                                Tesselator tesselator = Tesselator.getInstance();
                                BufferBuilder bufferbuilder = tesselator.getBuilder();

                                BlockPos pos = obj.getPos();
                                RenderSystem.lineWidth(5.0F);
                                
                                double p1x = (double) pos.getX();
                                double p1y = (double) pos.getY();
                                double p1z = (double) pos.getZ();
                                
                                double p2x = (double) p1x;
                                double p2y = (double) p1y+10;
                                double p2z = (double) p1z;


                                bufferbuilder.begin(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION);

                                bufferbuilder.vertex(p1x, p1y, p1z)
                                        .color(1.0f, 1.0f, 0, 0).normal(0,0,0).endVertex();
                                bufferbuilder.vertex(p2x, p2y, p2z)
                                        .color(1.0f, 1.0f, 0, 0).normal(0,0,0).endVertex();

                                tesselator.end();
                                RenderSystem.lineWidth(1.0F);
                                RenderSystem.enableBlend();
                                RenderSystem.enableTexture();

                            }
                        }
                    }
                }
            }
        }
    }

 

Edited by baku

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.