Jump to content

Recommended Posts

Posted

I have an Item that has about 8 different models. To switch between those models on runtime, I used an Item Property Override, which also works just fine.

But I now want to be able to also switch between a few different textures, that would be applied to the prevously selected model, allowing for many different model/texture combinations.

 

The problem is, that I don't know how I can apply only a texture in an Item Property Override.

I know that I could write a model for every single model / texture combination, but there will probably be around 100 different combinations. Doing all these models would be a pretty tedious task, and wouldn't be really efficient.

 

Does anyone know a solution to this problem?

Regards

  • 2 months later...
Posted (edited)

Thank you for the Reply. I now pretty much followed the mbe15 from MinecraftByExample. Since it is not a chessboard and it should only change texture I changed the ChessboardFinalisedModel#getQuads
 method to this:

@Override
    public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {

        ResourceLocation textureRL = new ResourceLocation("minecraft:block/diamond_block");
        AtlasTexture blocksStitchedTextures = ModelLoader.instance().getSpriteMap().getAtlasTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
        TextureAtlasSprite texture = blocksStitchedTextures.getSprite(textureRL);

        ArrayList<BakedQuad> quads = new ArrayList<>();

        for (BakedQuad quad : baseModel.getQuads(state, side, rand)) {
            quads.add(new BakedQuad(quad.getVertexData(), quad.getTintIndex(), quad.getFace(), texture, quad.shouldApplyDiffuseLighting()));
        }

        return quads;
    }

In my opinion, this should change the texture of every quad into a diamondblock texture. I am sure this method is called but the texture is just being the one declared in the json model. When I remove the one in the json model file, the texture becomes the default pink-black quads texture.

I couldn't find something in the internet with the same problem so I am coming back to this Post.

 

Thanks in advance!

Regards

Edited by VirtCraft
Error in Information

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.