Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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);
}

  • Author

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 ?

  • Author

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.