Reputation: 54
Here are my predicate overrides, inside of weather_cycle_device.json
:
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "rafaels-weather-cycle-device:item/weather_cycle_device"
},
"overrides": [
{
"predicate": {
"rafaels-weather-cycle-device:weather_state": 2.0
},
"model": "rafaels-weather-cycle-device:item/weather_cycle_device_rainy"
},
{
"predicate": {
"rafaels-weather-cycle-device:weather_state": 3.0
},
"model": "rafaels-weather-cycle-device:item/weather_cycle_device_thunder"
}
]
}
Here is how I am setting the model states for items in the Java code:
package net.rafael.weathercycledevice.util;
import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.util.Identifier;
import net.rafael.weathercycledevice.RafaelsWeatherCycleDevice;
import net.rafael.weathercycledevice.components.ModComponentDataTypes;
import net.rafael.weathercycledevice.item.ModItems;
public class ModModelPredicates {
public static void registerModelPredicates() {
ModelPredicateProviderRegistry.register(ModItems.WEATHER_CYCLE_DEVICE, Identifier.of(RafaelsWeatherCycleDevice.MOD_ID, "weather_state"),
(stack, world, entity, seed) -> {
Integer weatherState = stack.get(ModComponentDataTypes.WeatherState);
return weatherState != null ? weatherState : 1;
});
}
}
In the beginning, my logs reported that the state was 1, and it changes after using the item appropriately to state 3. So, predicate values are changing but not the textures.
How can I affect the predicate overrides accordingly?
Upvotes: 2
Views: 109