Added a separate item model for flowering zap leaves

This commit is contained in:
Sollace 2023-05-25 10:28:31 +01:00
parent 165f415f28
commit 97acff70d1
4 changed files with 20 additions and 1 deletions

View file

@ -119,6 +119,9 @@ public interface URenderers {
ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> {
return EnchantableItem.isEnchanted(stack) ? 1 + EnchantableItem.getSpellKey(stack).getAffinity().ordinal() : 0;
});
ModelPredicateProviderRegistry.register(UBlocks.ZAP_LEAVES.asItem(), new Identifier("flowering"), (stack, world, entity, seed) -> {
return ZapAppleStageStore.Stage.byStack(stack) == ZapAppleStageStore.Stage.FLOWERING ? 1 : 0;
});
ColorProviderRegistry.ITEM.register((stack, i) -> {
return i > 0 || !EnchantableItem.isEnchanted(stack) ? -1 : EnchantableItem.getSpellKey(stack).getColor();
}, UItems.GEMSTONE);

View file

@ -10,6 +10,7 @@ import com.minelittlepony.unicopia.util.Tickable;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LightningEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
@ -153,6 +154,10 @@ public class ZapAppleStageStore extends PersistentState implements Tickable {
return VALUES[MathHelper.clamp(id, 0, VALUES.length)];
}
public static Stage byStack(ItemStack stack) {
return byId(stack.getDamage() + 1);
}
public boolean mustChangeInto(Stage to) {
return this != to && (getNext() == to || this == HIBERNATING || to == HIBERNATING);
}

View file

@ -0,0 +1,3 @@
{
"parent": "unicopia:block/flowering_zap_leaves"
}

View file

@ -1,3 +1,11 @@
{
"parent": "unicopia:block/zap_leaves"
"parent": "unicopia:block/zap_leaves",
"overrides": [
{
"predicate": {
"flowering": 1
},
"model": "unicopia:item/flowering_zap_leaves"
}
]
}