Jump to content

Recommended Posts

Posted

This forum is not so you can use us as a human search engine.

 

This is the link to the wiki: https://forge.gemwire.uk/wiki/Main_Page

 

e.g. your question is answered here: https://forge.gemwire.uk/wiki/BlockState_JSONs and here: https://forge.gemwire.uk/wiki/Tinted_Textures

But given this is a Mojang feature rather than a Forge feature, you should not in general expect Forge to provide documentation for it.
 

  • Thanks 1

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.

Posted

i know about everything on that page but i dont know how to just change the texture based on a Property.
(i have MANY Properties, some should change the texture and i dont want to make like 15 different models)

Posted

As it says on the link above, use Multipart to compose complicated models, e.g.

https://minecraft.fandom.com/wiki/Tutorials/Models#Example:_Redstone_Wire

 

Or you can use datagen to generate the models using code if there are lots of them:

https://forge.gemwire.uk/wiki/Datageneration/States_and_Models

 

Or if you can't figure out how to do it with Mojang's models;

Make it a BlockEntity and render it yourself, maybe with the help of some prebaked models using ModelBlockRenderer

Or define and bake your own model format:  https://docs.minecraftforge.net/en/1.19.2/rendering/modelloaders/

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.

Posted

Pretty much the main point of using models is that it prebakes the texture information at load time.

You switch the model not the texture, otherwise there is no point using them and you should just render things yourself.

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.

Posted

i am currently doing it like this but if i place around 80 pipes i got 40 fps:

 

public class PipeRenderer implements BlockEntityRenderer<ItemPipeBlockEntity> {

public static final ResourceLocation[] MODELS = new ResourceLocation[]{
new ResourceLocation("actualgenerators", "block/pipe_core"),
new ResourceLocation("actualgenerators", "block/pipe_horizontal_both"),
new ResourceLocation("actualgenerators", "block/pipe_horizontal_extract"),
new ResourceLocation("actualgenerators", "block/pipe_horizontal_insert"),
new ResourceLocation("actualgenerators", "block/pipe_horizontal_cable"),
};

public static final BakedModel[] BAKED_MODELS = new BakedModel[MODELS.length];
private static BlockRenderDispatcher blockRenderer;

public PipeRenderer(BlockEntityRendererProvider.@NotNull Context context) {
ModelManager modelManager = context.getBlockRenderDispatcher().getBlockModelShaper().getModelManager();
blockRenderer = context.getBlockRenderDispatcher();
for (int i = 0; i < MODELS.length; i++)
BAKED_MODELS[i] = modelManager.getModel(MODELS[i]);
}

@Override
public void render(@NotNull ItemPipeBlockEntity pipe, float partialTicks, PoseStack ms, @NotNull MultiBufferSource buffers, int combinedLightIn, int combinedOverlayIn) {
var buffer = buffers.getBuffer(RenderType.cutout());

BlockState state = pipe.getBlockState();
BlockPos pos = pipe.getBlockPos();
Level level = pipe.getLevel();

for (Direction direction : Direction.values()) {
EMode connectionMode = pipe.getIO(direction).Mode;
if (connectionMode == EMode.DISABLED) continue;
switch (connectionMode) {
case CABLE -> {
ms.pushPose();
applyRotation(ms, direction);
renderModel(BAKED_MODELS[4], level, pos, state, ms, buffer);
}
case INSERT -> {
ms.pushPose();
applyRotation(ms, direction);
renderModel(BAKED_MODELS[3], level, pos, state, ms, buffer);
}
case EXTRACT -> {
ms.pushPose();
applyRotation(ms, direction);
renderModel(BAKED_MODELS[2], level, pos, state, ms, buffer);
}
case EXTRACT_INSERT -> {
ms.pushPose();
applyRotation(ms, direction);
renderModel(BAKED_MODELS[1], level, pos, state, ms, buffer);
}
}
}
}

private void renderModel(BakedModel baked, Level level, BlockPos pos, BlockState state, PoseStack stack, VertexConsumer buffer) {
blockRenderer.getModelRenderer().tesselateWithAO(
level,
baked,
state,
pos,
stack,
buffer,
false,
RandomSource.create(),
state.getSeed(pos),
15
);
stack.popPose();
}

private void applyRotation(PoseStack poseStack, @NotNull Direction direction) {
switch (direction) {
case UP -> poseStack.rotateAround(new Quaternionf().mul(Axis.XP.rotationDegrees(90F)), 0.5f, 0.5f, 0.5f);
case DOWN -> poseStack.rotateAround(new Quaternionf().mul(Axis.XP.rotationDegrees(270F)), 0.5f, 0.5f, 0.5f);
case SOUTH ->
poseStack.rotateAround(new Quaternionf().mul(Axis.YP.rotationDegrees(180F)), 0.5f, 0.5f, 0.5f);
case WEST -> poseStack.rotateAround(new Quaternionf().mul(Axis.YP.rotationDegrees(90F)), 0.5f, 0.5f, 0.5f);
case EAST -> poseStack.rotateAround(new Quaternionf().mul(Axis.YP.rotationDegrees(270F)), 0.5f, 0.5f, 0.5f);
}
}

}

 

Posted (edited)

Back in February I took the whole month off from answering questions in this forum.

I found I was wasting most of my time explaining to users why their questions were unanswerable.

 

I seem to be getting stuck in that loop again.

 

From now on, if a user fails to show they have done their own research (like not even reading the forum rules/faq)

or posts incomplete, unanswerable questions lacking in useful information to reproduce/diagnose the problem,

they will have to figure out for themselves why their questions have a response count of zero.

Edited by warjort

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.

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.