Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I succeeded in rendering quads. However, they go dark when players are above them. Like these picture 

https://drive.google.com/file/d/1zdbiE-pmGk3VuLy5ZSPtPDo-4UpHcKsa/view?usp=sharing

https://drive.google.com/file/d/1AgJv2ncXjqRGh_oTURNCtVdMfDWws8s2/view?usp=sharing

Is there something wrong with my codes?

public class RenderTester implements BlockEntityRenderer<BlockEntityTester> {
    private static final ResourceLocation GRAVEL_TEXTURE = new ResourceLocation("textures/block/gravel.png");

    public RenderTester (BlockEntityRendererProvider.Context context) {}

    @Override
    public void render(@NotNull BlockEntityTester pBlockEntity, float pPartialTick, @NotNull PoseStack pPoseStack, @NotNull MultiBufferSource pBuffer, int pPackedLight, int pPackedOverlay) {
        VertexConsumer builder = pBuffer.getBuffer(RenderType.entityCutoutNoCull(GRAVEL_TEXTURE));
        BufferUtil.drawQuad(builder, pPoseStack, 0.0F, 1.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, 0.0F, 1.0F, 1.0F, pPackedLight, pPackedOverlay, 0xFFFFFFFF);
    }
}
public class BufferUtil {
    public static void drawVertex(VertexConsumer builder, PoseStack poseStack, float x, float y, float z, float u, float v, int packedLight, int pPackedOverlay, int color) {
        builder.vertex(poseStack.last().pose(), x, y, z)
                .color(color)
                .uv(u, v)
                .overlayCoords(pPackedOverlay)
                .uv2(packedLight)
                .normal(0, 1, 0)
                .endVertex();
    }
    public static void drawQuad(VertexConsumer builder, PoseStack poseStack, float x0, float y0, float z0, float x1, float y1, float z1, float u0, float v0, float u1, float v1, int packedLight, int pPackedOverlay, int color) {
        drawVertex(builder, poseStack, x0, y0, z0, u0, v0, packedLight, pPackedOverlay, color);
        drawVertex(builder, poseStack, x0, y1, z1, u0, v1, packedLight, pPackedOverlay, color);
        drawVertex(builder, poseStack, x1, y1, z1, u1, v1, packedLight, pPackedOverlay, color);
        drawVertex(builder, poseStack, x1, y0, z0, u1, v0, packedLight, pPackedOverlay, color);
    }
}

 

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.