SparkyTD Posted October 6, 2022 Share Posted October 6, 2022 (edited) I am learning Forge 1.19, and as my first item I wanted to create a moon phase tracker. It is basically a copy of a clock, with eight different textures, and eight different models that are determined by a custom predicate in the base model. The predicate is just a custom ItemProperty that retrieves level.getMoonPhase(). If I hold this item in my hand, or throw it on the ground, it shows the correct moon phase texture, like it should. But if I look at the item in my inventory, or place it in an item frame, it only renders the default texture, and doesn't apply the overrides defined in the model json. What could be causing this behavior? I haven't seen any inventory-specific json files in the Clock or Compass, so I don't know what I have to do. Here are the relevant files: assets/lunareclipse/models/item/moon_dial.json -> https://pastebin.com/KPELaAuE assets/lunareclipse/models/item/moon_dial_1.json -> https://pastebin.com/iFe9i2AD (all 8 files are the same, except different texture number) ClientModEvents and MoonDialItem.java -> https://pastebin.com/Cd18rqQz Screenshot that demonstrates the issue: https://imgur.com/a/uRAjtEX Edited October 6, 2022 by SparkyTD Solved Quote Link to comment Share on other sites More sharing options...
warjort Posted October 6, 2022 Share Posted October 6, 2022 If you look at the code for the clock, it tries to use the LivingEntity's level if the passed level is null. You are also missing value = Dist.CLIENT for your subscription to client events. Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post. Link to comment Share on other sites More sharing options...
SparkyTD Posted October 6, 2022 Author Share Posted October 6, 2022 1 hour ago, warjort said: If you look at the code for the clock, it tries to use the LivingEntity's level if the passed level is null. You are also missing value = Dist.CLIENT for your subscription to client events. That was it, thanks! I didn't know level could be null. The is code works now: ItemProperties.register(this, new ResourceLocation(LunarEclipseMod.MODID, "moon_phase"), (stack, level, living, id) -> { if (living != null) return (float) living.level.getMoonPhase(); if (level != null) return (float) level.getMoonPhase(); return 0; }); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.