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.

mkk

Members
  • Joined

  • Last visited

Everything posted by mkk

  1. Hey, I wanted to modify a mod i found : Ping. It's built using forge_version=41.0.64. I'd like the non-hud ping icons to have constant size regardless of the player distance to them. I've found PingHandler.renderPing() , VertexHelper.renderPosTexColorNoZ() and PingRenderType.getPingIcon(): private static void renderPing(double px, double py, double pz, PoseStack poseStack, Camera camera, PingWrapper ping) { Minecraft mc = Minecraft.getInstance(); poseStack.pushPose(); poseStack.translate(px, py, pz); poseStack.mulPose(Vector3f.YP.rotationDegrees(-camera.getYRot())); poseStack.mulPose(Vector3f.XP.rotationDegrees(camera.getXRot())); poseStack.mulPose(Vector3f.ZP.rotationDegrees(180.0F)); PoseStack.Pose matrixEntry = poseStack.last(); Matrix4f matrix4f = matrixEntry.pose(); MultiBufferSource.BufferSource buffer = mc.renderBuffers().bufferSource(); RenderType pingType = PingRenderType.getPingIcon(TEXTURE); VertexConsumer vertexBuilder = buffer.getBuffer(pingType); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); float min = -0.25F - (0.25F * (float) ping.animationTimer / 20F); float max = 0.25F + (0.25F * (float) ping.animationTimer / 20F); // Block Overlay Background int r = ping.color >> 16 & 255; int g = ping.color >> 8 & 255; int b = ping.color & 255; VertexHelper.renderPosTexColorNoZ(vertexBuilder, matrix4f, min, max, PingType.BACKGROUND.getMinU(), PingType.BACKGROUND.getMaxV(), r, g, b, 255); VertexHelper.renderPosTexColorNoZ(vertexBuilder, matrix4f, max, max, PingType.BACKGROUND.getMaxU(), PingType.BACKGROUND.getMaxV(), r, g, b, 255); VertexHelper.renderPosTexColorNoZ(vertexBuilder, matrix4f, max, min, PingType.BACKGROUND.getMaxU(), PingType.BACKGROUND.getMinV(), r, g, b, 255); VertexHelper.renderPosTexColorNoZ(vertexBuilder, matrix4f, min, min, PingType.BACKGROUND.getMinU(), PingType.BACKGROUND.getMinV(), r, g, b, 255); // Block Overlay Icon float alpha = ping.type == PingType.ALERT ? mc.level != null ? (float) (1.0F + (0.01D * Math.sin(mc.level.getDayTime()))) : 0.85F : 0.85F; VertexHelper.renderPosTexColorNoZ(vertexBuilder, matrix4f, min, max, ping.type.getMinU(), ping.type.getMaxV(), 1.0F, 1.0F, 1.0F, alpha); VertexHelper.renderPosTexColorNoZ(vertexBuilder, matrix4f, max, max, ping.type.getMaxU(), ping.type.getMaxV(), 1.0F, 1.0F, 1.0F, alpha); VertexHelper.renderPosTexColorNoZ(vertexBuilder, matrix4f, max, min, ping.type.getMaxU(), ping.type.getMinV(), 1.0F, 1.0F, 1.0F, alpha); VertexHelper.renderPosTexColorNoZ(vertexBuilder, matrix4f, min, min, ping.type.getMinU(), ping.type.getMinV(), 1.0F, 1.0F, 1.0F, alpha); buffer.endBatch(pingType); poseStack.popPose(); } public static void renderPosTexColorNoZ(VertexConsumer builder, Matrix4f matrix4f, float x, float y, float u, float v, int r, int g, int b, int a) { builder.vertex(matrix4f, x, y, 0).uv(u, v).color(r, g, b, a).endVertex(); } public static void renderPosTexColorNoZ(VertexConsumer builder, Matrix4f matrix4f, float x, float y, float u, float v, float r, float g, float b, float a) { builder.vertex(matrix4f, x, y, 0).uv(u, v).color(r, g, b, a).endVertex(); } public static RenderType getPingIcon(ResourceLocation location) { RenderType.CompositeState renderTypeState = RenderType.CompositeState.builder().setShaderState(RENDERTYPE_PING).setTextureState(new RenderStateShard.TextureStateShard(location, false, true)).setTransparencyState(TRANSLUCENT_TRANSPARENCY).setLayeringState(DISABLE_DEPTH).createCompositeState(true); return RenderType.create("ping_icon", DefaultVertexFormat.POSITION_TEX_COLOR, VertexFormat.Mode.QUADS, RenderType.MEDIUM_BUFFER_SIZE, true, true, renderTypeState); } I thought that modifying the last method would be the solution but I don't know anything about graphics and Forge javadocs are empty. Would greatly appreciate any pointers on this.

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.