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

2021-05-03_20_59.36_small.thumb.png.2aae2a7eece7b4bcdf20a07d9317342a.png

ย 

Note the clouds being rendered in front of the beam texture.

I am accomplishing this by extending RenderType to add my own static RenderType provider method:

public static RenderType getBeam(ResourceLocation locationIn) {
        RenderState.TextureState renderstate$texturestate = new RenderState.TextureState(locationIn, false, false);
        return RenderType.makeType("beam", DefaultVertexFormats.ENTITY, 7, 256, false, true,
                RenderType.State
                        .getBuilder()
                        .texture(renderstate$texturestate)
                        .transparency(LIGHTNING_TRANSPARENCY)
                        .writeMask(COLOR_WRITE)
                        .fog(BLACK_FOG)
                        .cull(CULL_DISABLED)
                        .build(false));
}

ย 

Is there a way to get around this? Or should I just not be rendering translucent things willy nilly?

Edited by Woodside
clarification of issue in title

  • Author

Actually it does not seem to have to do with the RenderType being transparent as even a fully opaque vanilla one still has clouds on top.

ย 

Here's the EntityRenderer class:

public class BeamAttackRenderer extends EntityRenderer<BeamAttackEntity>
{
    public static final ResourceLocation BEAM_TEXTURE = new ResourceLocation(CelticShift.MOD_ID, "textures/entity/lightning_beam.png");
    private static final RenderType BEAM_RENDERTYPE = ModRenderType.getEntityNoOutline(BEAM_TEXTURE);

    public BeamAttackRenderer(EntityRendererManager renderManager) {
        super(renderManager);
    }

    @Override
    public ResourceLocation getEntityTexture(BeamAttackEntity entity) {
        return BEAM_TEXTURE;
    }

    @Override
    public void render(BeamAttackEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
        super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);

        if (entityIn.getLifeTicksRemaining() > 0) {
            matrixStackIn.push();
            float f6 = (float)(entityIn.getTo().getX() - entityIn.getPosX());
            float f8 = (float)(entityIn.getTo().getY() - entityIn.getPosY());
            float f9 = (float)(entityIn.getTo().getZ() - entityIn.getPosZ());
            func_229059_a_(f6, f8, f9, partialTicks, entityIn.ticksExisted, matrixStackIn, bufferIn, packedLightIn);
            matrixStackIn.pop();
        }
    }

    public static void func_229059_a_(float X, float Y, float Z, float partialTicks, int lifeTicks, MatrixStack matrixStackIn, IRenderTypeBuffer renderTypeBuffer, int packedLight) {
        float f = MathHelper.sqrt(X * X + Z * Z);
        float length = MathHelper.sqrt(X * X + Y * Y + Z * Z);
        matrixStackIn.push();
        matrixStackIn.translate(0.0D, 2.0D, 0.0D);
        matrixStackIn.rotate(Vector3f.YP.rotation((float)(-Math.atan2(Z, X)) - ((float)Math.PI / 2F)));
        matrixStackIn.rotate(Vector3f.XP.rotation((float)(-Math.atan2(f, Y)) - ((float)Math.PI / 2F)));
        IVertexBuilder ivertexbuilder = renderTypeBuffer.getBuffer(BEAM_RENDERTYPE);
        float texBase = ((float)lifeTicks + partialTicks) * -0.1F;
        float texLength = length / 16.0F + texBase;
        float sqrt2_2 = (float)Math.sqrt(2.d)/2.f;
        MatrixStack.Entry matrixstack$entry = matrixStackIn.getLast();
        Matrix4f matrix4f = matrixstack$entry.getMatrix();
        Matrix3f matrix3f = matrixstack$entry.getNormal();

        ivertexbuilder
                .pos(matrix4f, sqrt2_2, sqrt2_2, 0.0f)
                .color(255, 255, 255, 255)
                .tex(0.0f, texBase)
                .overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(packedLight)
                .normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
        ivertexbuilder
                .pos(matrix4f, sqrt2_2, sqrt2_2, length)
                .color(255, 255, 255, 255)
                .tex(0.0f, texLength)
                .overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(packedLight)
                .normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
        ivertexbuilder
                .pos(matrix4f, -sqrt2_2, -sqrt2_2, length)
                .color(255, 255, 255, 255)
                .tex(1.0f, texLength)
                .overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(packedLight)
                .normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
        ivertexbuilder
                .pos(matrix4f, -sqrt2_2, -sqrt2_2, 0.0f)
                .color(255, 255, 255, 255)
                .tex(1.0f, texBase)
                .overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(packedLight)
                .normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();

        ivertexbuilder
                .pos(matrix4f, -sqrt2_2, sqrt2_2, 0.0f)
                .color(255, 255, 255, 255)
                .tex(0.0f, texBase)
                .overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(packedLight)
                .normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
        ivertexbuilder
                .pos(matrix4f, -sqrt2_2, sqrt2_2, length)
                .color(255, 255, 255, 255)
                .tex(0.0f, texLength)
                .overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(packedLight)
                .normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
        ivertexbuilder
                .pos(matrix4f, sqrt2_2, -sqrt2_2, length)
                .color(255, 255, 255, 255)
                .tex(1.0f, texLength)
                .overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(packedLight)
                .normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
        ivertexbuilder
                .pos(matrix4f, sqrt2_2, -sqrt2_2, 0.0f)
                .color(255, 255, 255, 255)
                .tex(1.0f, texBase)
                .overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(packedLight)
                .normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();

        matrixStackIn.pop();
    }
}

ย 

  • Woodside changed the title to [1.15.2] Custom Rendered Quads Not Layering With Clouds Properly

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.