Posted May 7, 20205 yr 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
May 7, 20205 yr Howdy You could create a custom model that creates a model on the fly (or combines existing model) based on the itemstack properties. There is an example of how this works for blocks; it can be adapted to items fairly easily https://github.com/TheGreyGhost/MinecraftByExample (see mbe04). You could also consider using an ItemStackTileEntityRenderer (see Item.Properties.setISTER) -TGG
July 23, 20205 yr Author 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 July 24, 20205 yr 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.