mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Fixed gemstones not changing texture to reflect their affinity
This commit is contained in:
parent
97acff70d1
commit
7713f461e7
3 changed files with 14 additions and 7 deletions
|
@ -3,19 +3,21 @@ package com.minelittlepony.unicopia;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
|
|
||||||
public enum Affinity {
|
public enum Affinity {
|
||||||
GOOD(Formatting.BLUE, -1),
|
GOOD(Formatting.BLUE, -1, 0),
|
||||||
NEUTRAL(Formatting.LIGHT_PURPLE, 0),
|
NEUTRAL(Formatting.LIGHT_PURPLE, 0, 0.5F),
|
||||||
BAD(Formatting.RED, 1);
|
BAD(Formatting.RED, 1, 1);
|
||||||
|
|
||||||
private final Formatting color;
|
private final Formatting color;
|
||||||
|
|
||||||
private final int corruption;
|
private final int corruption;
|
||||||
|
private final float alignment;
|
||||||
|
|
||||||
public static final Affinity[] VALUES = values();
|
public static final Affinity[] VALUES = values();
|
||||||
|
|
||||||
Affinity(Formatting color, int corruption) {
|
Affinity(Formatting color, int corruption, float alignment) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.corruption = corruption;
|
this.corruption = corruption;
|
||||||
|
this.alignment = alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Formatting getColor() {
|
public Formatting getColor() {
|
||||||
|
@ -30,6 +32,10 @@ public enum Affinity {
|
||||||
return corruption;
|
return corruption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getAlignment() {
|
||||||
|
return alignment;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNeutral() {
|
public boolean isNeutral() {
|
||||||
return this == NEUTRAL;
|
return this == NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.minelittlepony.unicopia.item.ChameleonItem;
|
||||||
import com.minelittlepony.unicopia.item.EnchantableItem;
|
import com.minelittlepony.unicopia.item.EnchantableItem;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
import com.minelittlepony.unicopia.particle.UParticles;
|
import com.minelittlepony.unicopia.particle.UParticles;
|
||||||
|
import com.minelittlepony.unicopia.server.world.ZapAppleStageStore;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||||
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
||||||
|
@ -117,7 +118,7 @@ public interface URenderers {
|
||||||
PolearmRenderer.register(UItems.DIAMOND_POLEARM);
|
PolearmRenderer.register(UItems.DIAMOND_POLEARM);
|
||||||
PolearmRenderer.register(UItems.NETHERITE_POLEARM);
|
PolearmRenderer.register(UItems.NETHERITE_POLEARM);
|
||||||
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) ? EnchantableItem.getSpellKey(stack).getAffinity().getAlignment() : 0;
|
||||||
});
|
});
|
||||||
ModelPredicateProviderRegistry.register(UBlocks.ZAP_LEAVES.asItem(), new Identifier("flowering"), (stack, world, entity, seed) -> {
|
ModelPredicateProviderRegistry.register(UBlocks.ZAP_LEAVES.asItem(), new Identifier("flowering"), (stack, world, entity, seed) -> {
|
||||||
return ZapAppleStageStore.Stage.byStack(stack) == ZapAppleStageStore.Stage.FLOWERING ? 1 : 0;
|
return ZapAppleStageStore.Stage.byStack(stack) == ZapAppleStageStore.Stage.FLOWERING ? 1 : 0;
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"predicate": {
|
"predicate": {
|
||||||
"affinity": 1
|
"affinity": 0
|
||||||
},
|
},
|
||||||
"model": "unicopia:item/gemstone_pure"
|
"model": "unicopia:item/gemstone_pure"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"predicate": {
|
"predicate": {
|
||||||
"affinity": 3
|
"affinity": 1
|
||||||
},
|
},
|
||||||
"model": "unicopia:item/gemstone_corrupted"
|
"model": "unicopia:item/gemstone_corrupted"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue