Jump to content

Block entity renderer model forcing not working [1.19.2][SOLVED]


RInventor7

Recommended Posts

Hi! I'm trying to get my block entity rederer working, which in fact already works. When I set the RenderType to ENTITYBLOCK_ANIMATED then BER doesn't render anything. When I don't set it, then minecraft reders my block and BER redner's it again. If I change my BER's rotation or translation I wish to not see the original block model. So I set RenderType to ENTITYBLOCK_ANIMATED. The model isn't loaded by default, so I force the model to load myself using ModelEvent$RegisterAdditional event on the mod bus, but it's not doing anything. Subscribing works and the event fires noramally. Thanks for any help.

@SubscribeEvent
public static void registerBlockEntityModels(ModelEvent.RegisterAdditional event) {
    event.register(new ResourceLocation(MyMod.MOD_ID, "models/block/rail.json"));
}
Edited by RInventor7
Link to comment
Share on other sites

ENTITYBLOCK_ANIMATED is not a RenderType (unless you created one with that name? - it would need to be lowercase if you did)

It is an enum value returned from your Block's getRenderShape() method.

Manually registering models won't do anything if you don't use them. It just forces minecraft/forge to prebake the model ready for use.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

3 hours ago, warjort said:

ENTITYBLOCK_ANIMATED is not a RenderType

That was my mistake, I had remebered it incorrectly. 

3 hours ago, warjort said:

Manually registering models won't do anything if you don't use them.

That's a good point. I understand I need to specify my model location in my BER render method by changing the ModelData argument, right?

blockRenderer.renderSingleBlock(bs, poseStack, bufferSource, combinedLight, OverlayTexture.NO_OVERLAY, ModelData.EMPTY, RenderType.cutout());

The problem is can't seem to find a way to specify my model's resource location anyhow...

ModelData modelData = ModelData.builder().with(somePropertySomething???).build();

Is this even the correct way or is it done differently?

ModelData modelData = ModelData.builder().with(new ModelProperty<>(), new ResourceLocation(MyMod.MOD_ID, "models/block/rail.json")).build();

This also doesn't seem to do anything... I'm probably doing it wrong? 

Are there any examples somewhere (I couldn't seem to find any)?

Edited by RInventor7
Link to comment
Share on other sites

No you get the model from the ModelManager via the BlockEntityRenderProvider.Context.

e.g. https://github.com/AppliedEnergistics/Applied-Energistics-2/blob/43afa73c3aa8f291fc085ee70459aa85711e408a/src/main/java/appeng/client/render/tesr/CrankRenderer.java#L53

 

ModelData is something you can attach to individual BlockEntities and use in rendering.

https://github.com/MinecraftForge/MinecraftForge/blob/ab70bde1d648125acee073a93a25d4b8f08985c9/src/main/java/net/minecraftforge/common/extensions/IForgeBlockEntity.java#L167

I don't think it is that useful unless you using custom models?

If you are already doing dynamic rendering, you can just look directly at the block entity data.

 

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

  • RInventor7 changed the title to Block entity renderer model forcing not working [1.19.2][SOLVED]

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.