
bradsk88
Members-
Posts
17 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
bradsk88's Achievements

Tree Puncher (2/8)
0
Reputation
-
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?
-
Ah, perfect. Thanks
-
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.
-
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();
-
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?
-
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 ...
-
[1.18.2] Rendering a block model clientside only
bradsk88 replied to SoLegendary's topic in Modder Support
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. -
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
-
IDE gives error, but I don't know how to fix it.
bradsk88 replied to Kuikenpower's topic in Modder Support
Don't be this guy! https://xkcd.com/979/ What was the problem? -
It's probably this line ``` RenderType layer = RenderType.entityTranslucentCull(texture); ``` Try a different render type.
-
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!
-
Issue with Rendering my Own Custom Player Entity / Model [1.16.5]
bradsk88 replied to barnboi's topic in Modder Support
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. -
Figured it out. TLDR Enqueue work in FMLClientSetupEvent In that work, grab the Overworld's DimensionRenderInfo and call setWeatherRenderHandler on it with your custom renderer. In the renderer, copy the minecraft rain code and: Provide your own ResourceLocation for RAIN_LOCATION Remove the "-" from f3 value (I also multiplied it by 0.2 to slow down the rain) Source https://github.com/bradsk88/EurekaCraft/compare/4cfd071e8f5079184fb9be6a69b4316ce76c2d46...d13be10e423955eb4341f05ec94d46865adb1436