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.

bradsk88

Members
  • Joined

  • Last visited

  1. Finally solved this after looking a bit closer at the `Monster` class. I needed to override the `aiStep` method, adding a call to `updateSwingTime`. This makes `entity.swing()` trigger an animation. @Override public void aiStep() { this.updateSwingTime(); super.aiStep(); }
  2. Bumping this. I've tried to solve it a few times, but I can't find anything that works
  3. I have a mob that uses the HumanoidMobRenderer. It is meant to look like another player. public class VisitorMobRenderer extends HumanoidMobRenderer<VisitorMobEntity, PlayerModel<VisitorMobEntity>> { I have basically no custom rendering code. Just some logic for loading custom skins. https://github.com/bradsk88/Questown/blob/0d913c9bf06bb6b2de981717d2a38e182d9669ca/src/main/java/ca/bradj/questown/mobs/visitor/VisitorMobRenderer.java#L14 I've tried to call the "swing" method from the server side, which should publish a message to the client side. But I'm not seeing any animation. ((LivingEntity)mcExtra.entity()).swing(InteractionHand.MAIN_HAND); https://github.com/bradsk88/Questown/blob/0770d0d161a92d69f0749832552671b781360a64/src/main/java/ca/bradj/questown/jobs/declarative/RealtimeWorldInteraction.java#L284 Any suggestions to get my mob's arm swinging?
  4. Ah, perfect. Thanks
  5. I'm trying to implement a custom item that can be used on doors. But, the `useOn` function does not fire when clicking on doors. It fires when you click on any normal block, but it seems like the door is consuming the click event before my item can do something. Any suggestions? Thanks.
  6. Turns out the order of calls in the chain is important. I had to update my calls to vertex to be in the same order as `VertexFormat BLOCK` VertexConsumer vertex = vc.vertex(matrix4f, f3, f1, f2); vertex = vertex.color(r, g2, b2, a); vertex = vertex.uv(0, 0); vertex = vertex.uv2(0, 0); vertex = vertex.normal(matrix3f, 1.0F, 0.0F, 0.0F); vertex.endVertex();
  7. Hello all, I have a mod that renders a cube the size of a chunk to simulate a "rain"-like effect. This worked well in 1.18.2 using borrowed code from the vanilla rain rendering. That stopped working, so I'm trying to actually understand the rendering process, rather than just copy-paste-praying. I copied the code from `LevelRenderer.renderLineBox` which worked perfectly in a `RenderLevelStageEvent` handler, but only rendered lines. I switched the RenderType to translucent and now I'm getting an IllegalStateException with the message "Not filled all elements of the vertex". I understand this means I am missing a value from the vertex builder chain, but I'm not sure what I'm missing here. The DefaultVertexFormat for "block" (used by RenderType.transparent) specifies that it needs 6 values: position, color, uv0, uv2, normal, and padding. public static final VertexFormat BLOCK = new VertexFormat(ImmutableMap.<String, VertexFormatElement>builder().put("Position", ELEMENT_POSITION).put("Color", ELEMENT_COLOR).put("UV0", ELEMENT_UV0).put("UV2", ELEMENT_UV2).put("Normal", ELEMENT_NORMAL).put("Padding", ELEMENT_PADDING).build()); In my code, I am providing 6 values: vertex, color, uv, uv2, normal, and I believe padding is automatically implied. VertexConsumer vertex = vc.vertex(matrix4f, f3, f1, f2); vertex = vertex.color(r, g2, b2, a); vertex = vertex.normal(matrix3f, 1.0F, 0.0F, 0.0F); vertex = vertex.uv(0, 0); vertex = vertex.uv2(0, 0); vertex.endVertex(); But my "elementIndex" ends up being "4", causing the exception. Here is the link to the entire file: - https://github.com/bradsk88/EurekaCraft/blob/c4a3eb76468fef861fbcfbe7423f59683f9537ec/src/main/java/ca/bradj/eurekacraft/client/ChunkStormCubeForgeRendering.java#L99 Can anyone spot what I'm doing wrong here?
  8. Rendering the level solved the problem for me in 1.18.2 But it looks like it causes an infinite recursion in 1.19. at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(ForgeHooksClient.java:280) at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(ForgeHooksClient.java:288) at TRANSFORMER/[email protected]/net.minecraft.client.renderer.LevelRenderer.renderChunkLayer(LevelRenderer.java:1550) at TRANSFORMER/[email protected]/net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1379) at TRANSFORMER/[email protected]/ca.bradj.eurekacraft.client.ChunkWavesForgeRendering.handleRenderEvent(ChunkWavesForgeRendering.java:60) at TRANSFORMER/[email protected]/ca.bradj.eurekacraft.client.__ChunkWavesForgeRendering_handleRenderEvent_RenderLevelStageEvent.invoke(.dynamic) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(ForgeHooksClient.java:280) at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(ForgeHooksClient.java:288) at TRANSFORMER/[email protected]/net.minecraft.client.renderer.LevelRenderer.renderChunkLayer(LevelRenderer.java:1550) at TRANSFORMER/[email protected]/net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1379) at TRANSFORMER/[email protected]/ca.bradj.eurekacraft.client.ChunkWavesForgeRendering.handleRenderEvent(ChunkWavesForgeRendering.java:60) at TRANSFORMER/[email protected]/ca.bradj.eurekacraft.client.__ChunkWavesForgeRendering_handleRenderEvent_RenderLevelStageEvent.invoke(.dynamic) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(ForgeHooksClient.java:280) at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(ForgeHooksClient.java:288) at TRANSFORMER/[email protected]/net.minecraft.client.renderer.LevelRenderer.renderChunkLayer(LevelRenderer.java:1550) at TRANSFORMER/[email protected]/net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1379) at TRANSFORMER/[email protected]/ca.bradj.eurekacraft.client.ChunkWavesForgeRendering.handleRenderEvent(ChunkWavesForgeRendering.java:60) at TRANSFORMER/[email protected]/ca.bradj.eurekacraft.client.__ChunkWavesForgeRendering_handleRenderEvent_RenderLevelStageEvent.invoke(.dynamic) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(ForgeHooksClient.java:280) at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(ForgeHooksClient.java:288) at TRANSFORMER/[email protected]/net.minecraft.client.renderer.LevelRenderer.renderChunkLayer(LevelRenderer.java:1550) at TRANSFORMER/[email protected]/net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1379) at TRANSFORMER/[email protected]/ca.bradj.eurekacraft.client.ChunkWavesForgeRendering.handleRenderEvent(ChunkWavesForgeRendering.java:60) ... etc forever ...
  9. I'm trying to build a similar functionality. Do you have code in a repo somewhere? I'm curious where you got the value of originPos from.
  10. Updating this as I was able to solve the problem on my own. TL;DR: I switched the `-1.0F` here to `1.0F` (for each box) VoxelShapes.texOffs(0, 0).addBox(0.0F, 0.0F, -4.0F, 15.0F, -1.0F, 8.0F); --- Here's why I think this was necessary. The -1.0F value represents the "Y dimension" of a CubeDefinition that is used to create a set of BakedQuad's for the entity model. Minecraft uses "BakedQuads" to render models. Those are 4-pointed shapes with a bit of additional metadata. Each cube is made up of six quads. One piece of metadata on a BakedQuad is "direction". I suspect minecraft uses that direction for shading purposes. Direction.UP gets shaded bright (due to sunlight) and Direction.DOWN gets shaded dark because it is in the shadows. By setting my Y dimension to negative, the "up" quad of the cube is actually baked and labeled as the "down" side of the cube. And vice versa of course. For more complex models, it might require a more comprehensive solution. But since my shape was only 1 "unit" thick, inverting the 1 worked out nicely. Result: https://imgur.com/a/JTi0oYt
  11. Don't be this guy! https://xkcd.com/979/ What was the problem?
  12. Nothing obvious in the trace. If you're running a mod pack, contact the makers of the pack to report the bug. If you're running your own collection of mods. Remove them one by one until it starts working. Then, report the bug to the creator of the mod that is broken.
  13. It's probably this line ``` RenderType layer = RenderType.entityTranslucentCull(texture); ``` Try a different render type.
  14. GitHub: https://github.com/bradsk88/EurekaCraft Problem: For some reason, the top of my model is darker than the bottom. IMO it would make sense for the "sunny" side to be brighter, but I'm not sure how to fix that. Image/Video of the problem: https://imgur.com/a/hAqpqcy Player Rendering Code: @SubscribeEvent public static void playerRender(final RenderPlayerEvent.Pre event) { PlayerDeployedBoardProvider.getBoardTypeFor(event.getPlayer()).ifPresent( (PlayerDeployedBoard.ColoredBoard bt) -> renderPlayerWithBoard(event, bt) ); } private static void renderPlayerWithBoard(final RenderPlayerEvent.Pre event, PlayerDeployedBoard.ColoredBoard bt) { if (BoardType.NONE.equals(bt.boardType)) { return; } AbstractBoardModel model = ModelsInit.getModel(bt.boardType, bt.r, bt.g, bt.b); PoseStack matrixStack = event.getPoseStack(); matrixStack.mulPose(Vector3f.YP.rotationDegrees(90)); LivingEntity living = event.getEntityLiving(); living.animationSpeed = 0; living.yHeadRot = living.yBodyRot + 90; float newYRot = (float) Math.toRadians(-living.yBodyRot); VertexConsumer ivertexbuilder = event.getMultiBufferSource().getBuffer(model.getRenderType()); model.getModelRenderer().yRot = newYRot; model.renderToBuffer( matrixStack, ivertexbuilder, event.getPackedLight(), OverlayTexture.WHITE_OVERLAY_V, 1.0F, 1.0F, 1.0F, 1.0F ); } Board Model Code: public abstract class AbstractBoardModel<M extends AbstractBoardModel<M>> extends EntityModel<Entity> { private final ModelPart VoxelShapes; private final ResourceLocation texture; protected float r; protected float g; protected float b; protected AbstractBoardModel() { this(1, 1, 1); } public AbstractBoardModel(float r, float g, float b) { this.VoxelShapes = this.build(); this.texture = this.getTexture(); this.r = r; this.g = g; this.b = b; } @Override public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){ //previously the render function, render code was moved to a method below } @Override public void renderToBuffer(PoseStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ VoxelShapes.render( matrixStack, buffer, packedLight, packedOverlay, red * this.r, green * this.g, blue * this.b, alpha ); } public ModelPart getModelRenderer() { return VoxelShapes; } public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) { modelRenderer.xRot = x; modelRenderer.yRot = y; modelRenderer.zRot = z; } protected abstract ModelPart build(); public RenderType getRenderType() { return this.renderType(this.texture); } } Edit: And the baked model: @Override protected ModelPart build() { CubeListBuilder VoxelShapes = CubeListBuilder.create(); VoxelShapes.texOffs(0, 0).addBox(0.0F, 0.0F, -4.0F, 15.0F, -1.0F, 8.0F); VoxelShapes.texOffs(0, 0).addBox(-2.0F, 0.0F, -5.0F, 2.0F, -1.0F, 10.0F); VoxelShapes.texOffs(0, 0).addBox(-8.0F, 0.0F, -6.0F, 6.0F, -1.0F, 12.0F); VoxelShapes.texOffs(0, 0).addBox(-10.0F, 0.0F, -5.0F, 2.0F, -1.0F, 10.0F); VoxelShapes.texOffs(0, 0).addBox(-12.0F, 0.0F, -4.0F, 2.0F, -1.0F, 8.0F); VoxelShapes.texOffs(0, 0).addBox(-14.0F, 0.0F, -3.0F, 2.0F, -1.0F, 6.0F); VoxelShapes.texOffs(0, 0).addBox(5.0F, 0.0F, -5.0F, 6.0F, -1.0F, 10.0F); VoxelShapes.texOffs(0, 0).addBox(8.0F, 1.0F, -2.0F, 5.0F, -1.0F, 1.0F); VoxelShapes.texOffs(0, 0).addBox(7.0F, 2.0F, -2.0F, 5.0F, -1.0F, 1.0F); VoxelShapes.texOffs(0, 0).addBox(8.0F, 1.0F, 1.0F, 5.0F, -1.0F, 1.0F); VoxelShapes.texOffs(0, 0).addBox(7.0F, 2.0F, 1.0F, 5.0F, -1.0F, 1.0F); VoxelShapes.texOffs(0, 0).addBox(-10.0F, 1.0F, -2.0F, 5.0F, -1.0F, 4.0F); VoxelShapes.texOffs(0, 0).addBox(-10.0F, 2.0F, -1.0F, 3.0F, -1.0F, 2.0F); MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); partdefinition.addOrReplaceChild("board", VoxelShapes, PartPose.rotation( (float) Math.PI, 0, 0)); return LayerDefinition.create(meshdefinition, 0, 0).bakeRoot(); } Thanks for any help you can provide!
  15. I would imagine yBodyRoyO probably only gets update each tick. So if you're linear interpolating from yBodyRotO to yBodyRot more than once a tick, it would cause it to "rewind" and "replay" rapidly.

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.