Jump to content

Recommended Posts

Posted

Hi !

 

I have implemented an IModel to render a custom ore block with different stone backgrounds and an overlay.

 

I have two questions :

 

- If the bake() method is called for all the instances of my custom ores (I have checked with a logger), does that mean there model are correctly registered or not necessarily ?

Because in game, all the different ores have no textures (purple and black cube)

 

- What should I return at the end of this method ? A Wrapper (default implementation of IFlexibleModel) ? Because I can't return a IBakedModel

 

In my opinion, the problem is inside the bake method , but even with the minimum, it doesn't works :

 

public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {


	ModelResourceLocation stoneModelLocation = new ModelResourceLocation("minecraft:stone", null);
	IModel stoneModel = ModelLoaderRegistry.getModel(stoneModelLocation);
	IBakedModel stoneBakedModel = stoneModel.bake(stoneModel.getDefaultState(), format, bakedTextureGetter);


	return new Wrapper(stoneBakedModel, format);
}

Posted

Also if someone could explain to me how what is a TextureAtlasSprite and how the Function<ResourceLocation, TextureAtlasSprite> textureGetter (one of the bake method argument) works.

textureGetter.apply(stoneModelLocation); should return my stone texture right ?

Posted

I don't understand, with the following code, it says the texture is missing :

 

public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
    ModelResourceLocation stoneModelLocation = new ModelResourceLocation("minecraft:stone", null);
    IModel stoneModel = ModelLoaderRegistry.getModel(stoneModelLocation);
    IBakedModel stoneBakedModel = stoneModel.bake(stoneModel.getDefaultState(), format, bakedTextureGetter);
    Logger.info(stoneBakedModel.getTexture().getIconName());
}

 

I think I have to do something with the texture getter, but I don't even know how it works.

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.