mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-21 12:24:22 +01:00
Added a separate item model for flowering zap leaves
This commit is contained in:
parent
165f415f28
commit
97acff70d1
4 changed files with 20 additions and 1 deletions
|
@ -119,6 +119,9 @@ public interface URenderers {
|
||||||
ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> {
|
ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> {
|
||||||
return EnchantableItem.isEnchanted(stack) ? 1 + EnchantableItem.getSpellKey(stack).getAffinity().ordinal() : 0;
|
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) -> {
|
ColorProviderRegistry.ITEM.register((stack, i) -> {
|
||||||
return i > 0 || !EnchantableItem.isEnchanted(stack) ? -1 : EnchantableItem.getSpellKey(stack).getColor();
|
return i > 0 || !EnchantableItem.isEnchanted(stack) ? -1 : EnchantableItem.getSpellKey(stack).getColor();
|
||||||
}, UItems.GEMSTONE);
|
}, UItems.GEMSTONE);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.minelittlepony.unicopia.util.Tickable;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.LightningEntity;
|
import net.minecraft.entity.LightningEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.*;
|
import net.minecraft.nbt.*;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
@ -153,6 +154,10 @@ public class ZapAppleStageStore extends PersistentState implements Tickable {
|
||||||
return VALUES[MathHelper.clamp(id, 0, VALUES.length)];
|
return VALUES[MathHelper.clamp(id, 0, VALUES.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Stage byStack(ItemStack stack) {
|
||||||
|
return byId(stack.getDamage() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean mustChangeInto(Stage to) {
|
public boolean mustChangeInto(Stage to) {
|
||||||
return this != to && (getNext() == to || this == HIBERNATING || to == HIBERNATING);
|
return this != to && (getNext() == to || this == HIBERNATING || to == HIBERNATING);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "unicopia:block/flowering_zap_leaves"
|
||||||
|
}
|
|
@ -1,3 +1,11 @@
|
||||||
{
|
{
|
||||||
"parent": "unicopia:block/zap_leaves"
|
"parent": "unicopia:block/zap_leaves",
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"flowering": 1
|
||||||
|
},
|
||||||
|
"model": "unicopia:item/flowering_zap_leaves"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
Loading…
Reference in a new issue