Reputation: 197
The Block registered just fine. It's there on the creative tab DECORATIVE (or whatever it's called). The Block's a purple-black cube (even when I place it) and so I tried to add some textures to my Block. The texture file's resolution is 127 x 127. Here's my code:
@Mod.EventBusSubscriber
public final class ItemModelRegistrar {
@SubscribeEvent
public static void onModelRegistry(ModelRegistryEvent event) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MyMainModClassInHere.itemCreepyFace01, 0, new ModelResourceLocation("MyModIDHere:creepy_face_01", "inventory"));
}
}
Is it just a problem with my texture's resolution? If yes, please tell the correct way to do it (without changing the texture).
Upvotes: 0
Views: 121
Reputation: 111
The method of registering the texture you're using is outdated, and shouldn't be used anymore. Instead, you should use ModelLoader.setCustomModelResourceLocation
. Here's an example:
ModelLoader.setCustomModelResourceLocation(
Item.getItemFromBlock(blockInstance),
metadataValue,
new ModelResourceLocation("blockRegistryName", "inventory")
);
Another issue you might have is that your texture is 127x127. 16x16 is probably your safest option, but if you want to use something with a higher resolution, always use powers of 2. In your case, see if you can bump it up to 128x128, or lower it down to another power of 2.
Upvotes: 1