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.

Laipel

Members
  • Joined

  • Last visited

Everything posted by Laipel

  1. Why does depth and blending works so stange together. Does exist any way to fix it? https://imgur.com/Y4EoGoO I render it with EntityRenderer. My code: @Override public void render(SoulEntity soulEntity, float p_114486_, float pTicks, PoseStack poseStack, MultiBufferSource bufferSource, int p_114490_) { ISoul soul = soulEntity.getSoul(); if (soul == null) return; RenderSystem.enableDepthTest(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); poseStack.pushPose(); poseStack.scale(0.6f, 0.6f, 0.6f); poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); Minecraft.getInstance().textureManager.getTexture(getTextureLocation(soulEntity)).setBlurMipmap(true, false); Color color = soul.getColor(); Matrix4f matrix4f = poseStack.last().pose(); VertexConsumer bufferBuilder = bufferSource.getBuffer(EnsRenderType.SOUL_RENDER_TYPE); bufferBuilder.vertex(matrix4f, -1.2f, -1.2f, 0.0F).uv(0.0F, 1.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 70).uv2(p_114490_) .endVertex(); bufferBuilder.vertex(matrix4f, 1.2f, -1.2f, 0.0F).uv(1.0F, 1.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 70).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 1.2f, 1.2f, 0.0F).uv(1.0F, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 70).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, -1.2f, 1.2f, 0.0F).uv(0.0F, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 70).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, (float) (0f - 0.6), (float) (0.0f - 0.6), 0.0F).uv(0.0F, 1.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 100).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.4f, 0.0f - 0.6f, 0.0f).uv(1.0F, 1.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 100).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.4f, 1.0f - 0.4f, 0.0f).uv(1.0F, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 100).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 0f - 0.6f, 1.0f - 0.4f, 0.0f).uv(0.0F, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 100).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.13f, (0.0f - 0.5f) + 0.13f, 0.0f).uv(0.0F, 1.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 120).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.13f, (0.0f - 0.5f) + 0.13f, 0.0f).uv(1.0F, 1.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 120).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.13f, 1.0f - 0.5f - 0.13f, 0.0f).uv(1.0F, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 120).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.13f, 1.0f - 0.5f - 0.13f, 0.0f).uv(0.0F, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 120).uv2(p_114490_).endVertex(); Color color2 = Color.WHITE; bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.26f, (0.0f - 0.5f) + 0.26f, 0.0f).uv(0.0F, 1.0F).color(color2.getRed(), color2.getBlue(), color2.getGreen(), 130).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.26f, (0.0f - 0.5f) + 0.26f, 0.0f).uv(1.0F, 1.0F).color(color2.getRed(), color2.getBlue(), color2.getGreen(), 130).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.26f, 1.0f - 0.5f - 0.26f, 0.0f).uv(1.0F, 0.0F).color(color2.getRed(), color2.getBlue(), color2.getGreen(), 130).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.26f, 1.0f - 0.5f - 0.26f, 0.0f).uv(0.0F, 0.0F).color(color2.getRed(), color2.getBlue(), color2.getGreen(), 130).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.4f, (0.0f - 0.5f) + 0.4f, 0.0f).uv(0.0F, 1.0F).color(color2.getRed(), color2.getBlue(), color2.getGreen(), 80).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.4f, (0.0f - 0.5f) + 0.4f, 0.0f).uv(1.0F, 1.0F).color(color2.getRed(), color2.getBlue(), color2.getGreen(), 80).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.4f, 1.0f - 0.5f - 0.4f, 0.0f).uv(1.0F, 0.0F).color(color2.getRed(), color2.getBlue(), color2.getGreen(), 80).uv2(p_114490_).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.4f, 1.0f - 0.5f - 0.4f, 0.0f).uv(0.0F, 0.0F).color(color2.getRed(), color2.getBlue(), color2.getGreen(), 80).uv2(p_114490_).endVertex(); poseStack.popPose(); // RenderUtils.drawStreak(soulEntity, pTicks, poseStack, bufferSource, getStreaks(soulEntity)); super.render(soulEntity, p_114486_, pTicks, poseStack, bufferSource, p_114490_); } public static final RenderType SOUL_RENDER_TYPE = RenderType.create("soul_render_type", DefaultVertexFormat.POSITION_TEX_COLOR, VertexFormat.Mode.QUADS, 256, false, false, RenderType.CompositeState.builder() .setTextureState(new RenderStateShard.TextureStateShard(new ResourceLocation(MODID, "textures/particle/wisp.png"), true, true)) .setLightmapState(LIGHTMAP) .setTransparencyState(LIGHTNING_TRANSPARENCY) .setWriteMaskState(COLOR_DEPTH_WRITE) .setCullState(RenderStateShard.CULL) .setShaderState(new RenderStateShard.ShaderStateShard(ShaderRegistry::getSmoothPosTexColorShader)) .createCompositeState(true));
  2. I want to render my Entity like ExpOrb. There RenderType is used. However, I don't need to interract with light, therfore I don't need to specify normals, lightmap and other thinhs like it. I've decided to use RenderSystem.setShaderTexture(int, ResourceLocation) for this purpose. But it doesn't work. Code below just render some quads. @Override public void render(SoulEntity soulEntity, float p_114486_, float pTicks, PoseStack poseStack, MultiBufferSource bufferSource, int p_114490_) { ISoul soul = soulEntity.getSoul(); if(soul == null) return; RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); RenderSystem.setShader(GameRenderer::getPositionColorShader); RenderSystem.setShaderTexture(0, getTextureLocation(soulEntity)); Tesselator t = RenderSystem.renderThreadTesselator(); poseStack.pushPose(); poseStack.scale(0.6f, 0.6f, 0.6f); poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); Color color = soul.getColor(); Matrix4f matrix4f = poseStack.last().pose(); BufferBuilder bufferBuilder = t.getBuilder(); bufferBuilder.clear(); bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); bufferBuilder.vertex(matrix4f, -1.2f, -1.2f, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 90).uv(16, 16).endVertex(); bufferBuilder.vertex(matrix4f, 1.2f, -1.2f, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 90).uv(0, 16).endVertex(); bufferBuilder.vertex(matrix4f, 1.2f, 1.2f, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 90).uv(0, 0).endVertex(); bufferBuilder.vertex(matrix4f, -1.2f, 1.2f, 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 90).uv(16, 0).endVertex(); bufferBuilder.vertex(matrix4f, (float) (0f - 0.6), (float) (0.0f - 0.6), 0.0F).color(color.getRed(), color.getBlue(), color.getGreen(), 100).uv(1, 1).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.4f, 0.0f - 0.6f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 100).uv(0, 1).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.4f, 1.0f - 0.4f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 100).uv(0, 0).endVertex(); bufferBuilder.vertex(matrix4f, 0f - 0.6f, 1.0f - 0.4f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 100).uv(1, 0).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.13f, (0.0f - 0.5f) + 0.13f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 120).uv(1, 1).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.13f, (0.0f - 0.5f) + 0.13f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 120).uv(0, 1).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.13f, 1.0f - 0.5f - 0.13f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 120).uv(0, 0).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.13f, 1.0f - 0.5f - 0.13f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 120).uv(1, 0).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.26f, (0.0f - 0.5f) + 0.26f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 130).uv(1, 1).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.26f, (0.0f - 0.5f) + 0.26f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 130).uv(0, 1).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.26f, 1.0f - 0.5f - 0.26f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 130).uv(0, 0).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.26f, 1.0f - 0.5f - 0.26f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 130).uv(1, 0).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.4f, (0.0f - 0.5f) + 0.4f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 140).uv(1, 1).endVertex(); bufferBuilder.vertex(matrix4f, 1f - 0.5f - 0.4f, (0.0f - 0.5f) + 0.4f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 140).uv(0, 1).endVertex(); bufferBuilder.vertex(matrix4f,1f - 0.5f - 0.4f, 1.0f - 0.5f - 0.4f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 140).uv(0, 0).endVertex(); bufferBuilder.vertex(matrix4f, (0f - 0.5f) + 0.4f, 1.0f - 0.5f - 0.4f, 0.0f).color(color.getRed(), color.getBlue(), color.getGreen(), 140).uv(1, 0).endVertex(); t.end(); RenderSystem.disableBlend(); RenderSystem.depthMask(true); poseStack.popPose(); super.render(soulEntity, p_114486_, pTicks, poseStack, bufferSource, p_114490_); } What do I need to do to bind texture?

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.