Add unique gem designs for different spells
|
@ -20,6 +20,7 @@ import com.minelittlepony.unicopia.ability.magic.spell.Spell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.ThrowableSpell;
|
import com.minelittlepony.unicopia.ability.magic.spell.ThrowableSpell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.TimeControlAbilitySpell;
|
import com.minelittlepony.unicopia.ability.magic.spell.TimeControlAbilitySpell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
|
||||||
|
import com.minelittlepony.unicopia.item.GemstoneItem;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
import com.minelittlepony.unicopia.util.RegistryUtils;
|
import com.minelittlepony.unicopia.util.RegistryUtils;
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
@ -133,6 +134,29 @@ public final class SpellType<T extends Spell> implements Affine, SpellPredicate<
|
||||||
return affinity;
|
return affinity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GemstoneItem.Shape getGemShape() {
|
||||||
|
if (this == NECROMANCY) return GemstoneItem.Shape.SKULL;
|
||||||
|
if (this == DARK_VORTEX) return GemstoneItem.Shape.VORTEX;
|
||||||
|
if (this == FROST || this == CHILLING_BREATH) return GemstoneItem.Shape.TRIANGLE;
|
||||||
|
if (this == SHIELD || this == ARCANE_PROTECTION) return GemstoneItem.Shape.SHIELD;
|
||||||
|
if (this == FLAME || this == SCORCH || this == INFERNAL || this == FIRE_BOLT) return GemstoneItem.Shape.FLAME;
|
||||||
|
if (this == MIMIC) return GemstoneItem.Shape.ARROW;
|
||||||
|
if (this == DISPEL_EVIL) return GemstoneItem.Shape.CROSS;
|
||||||
|
if (this == REVEALING) return GemstoneItem.Shape.CROSS;
|
||||||
|
if (this == SIPHONING) return GemstoneItem.Shape.LAMBDA;
|
||||||
|
if (this == VORTEX) return GemstoneItem.Shape.VORTEX;
|
||||||
|
if (this == FEATHER_FALL) return GemstoneItem.Shape.LAMBDA;
|
||||||
|
if (this == DISPLACEMENT) return GemstoneItem.Shape.BRUSH;
|
||||||
|
if (this == TRANSFORMATION) return GemstoneItem.Shape.BRUSH;
|
||||||
|
if (this == BUBBLE) return GemstoneItem.Shape.DONUT;
|
||||||
|
if (this == MIND_SWAP) return GemstoneItem.Shape.WAVE;
|
||||||
|
if (this == HYDROPHOBIC || this == CATAPULT) return GemstoneItem.Shape.ROCKET;
|
||||||
|
if (this == LIGHT) return GemstoneItem.Shape.STAR;
|
||||||
|
if (this == PORTAL) return GemstoneItem.Shape.RING;
|
||||||
|
if (this == AWKWARD) return GemstoneItem.Shape.ICE;
|
||||||
|
return GemstoneItem.Shape.ROUND;
|
||||||
|
}
|
||||||
|
|
||||||
public SpellTraits getTraits() {
|
public SpellTraits getTraits() {
|
||||||
return traits;
|
return traits;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,8 @@ public interface URenderers {
|
||||||
register(URenderers::renderBedItem, UItems.CLOTH_BED, UItems.CLOUD_BED);
|
register(URenderers::renderBedItem, UItems.CLOTH_BED, UItems.CLOUD_BED);
|
||||||
register(URenderers::renderChestItem, UBlocks.CLOUD_CHEST.asItem());
|
register(URenderers::renderChestItem, UBlocks.CLOUD_CHEST.asItem());
|
||||||
PolearmRenderer.register(UItems.WOODEN_POLEARM, UItems.STONE_POLEARM, UItems.IRON_POLEARM, UItems.GOLDEN_POLEARM, UItems.DIAMOND_POLEARM, UItems.NETHERITE_POLEARM);
|
PolearmRenderer.register(UItems.WOODEN_POLEARM, UItems.STONE_POLEARM, UItems.IRON_POLEARM, UItems.GOLDEN_POLEARM, UItems.DIAMOND_POLEARM, UItems.NETHERITE_POLEARM);
|
||||||
ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> EnchantableItem.isEnchanted(stack) ? EnchantableItem.getSpellKey(stack).getAffinity().getAlignment() : 0);
|
ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> EnchantableItem.getSpellKey(stack).getAffinity().getAlignment());
|
||||||
|
ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("shape"), (stack, world, entity, seed) -> EnchantableItem.getSpellKey(stack).getGemShape().getId());
|
||||||
ModelPredicateProviderRegistry.register(UItems.ROCK_CANDY, new Identifier("count"), (stack, world, entity, seed) -> stack.getCount() / (float)stack.getMaxCount());
|
ModelPredicateProviderRegistry.register(UItems.ROCK_CANDY, new Identifier("count"), (stack, world, entity, seed) -> stack.getCount() / (float)stack.getMaxCount());
|
||||||
ModelPredicateProviderRegistry.register(UItems.BUTTERFLY, new Identifier("variant"), (stack, world, entity, seed) -> (float)ButterflyItem.getVariant(stack).ordinal() / ButterflyEntity.Variant.VALUES.length);
|
ModelPredicateProviderRegistry.register(UItems.BUTTERFLY, new Identifier("variant"), (stack, world, entity, seed) -> (float)ButterflyItem.getVariant(stack).ordinal() / ButterflyEntity.Variant.VALUES.length);
|
||||||
ModelPredicateProviderRegistry.register(Unicopia.id("zap_cycle"), new ClampedModelPredicateProvider() {
|
ModelPredicateProviderRegistry.register(Unicopia.id("zap_cycle"), new ClampedModelPredicateProvider() {
|
||||||
|
|
|
@ -28,6 +28,13 @@ public final class ModelOverrides {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> ModelOverrides addUniform(String key, Iterable<T> values, Function<T, Float> idFunc, Function<T, Identifier> childModelSupplier) {
|
||||||
|
for (T t : values) {
|
||||||
|
addOverride(childModelSupplier.apply(t), key, idFunc.apply(t));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ModelOverrides addUniform(String key, int from, int to, Identifier model) {
|
public ModelOverrides addUniform(String key, int from, int to, Identifier model) {
|
||||||
float step = 1F / to;
|
float step = 1F / to;
|
||||||
for (int index = from; index <= to; index++) {
|
for (int index = from; index <= to; index++) {
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
package com.minelittlepony.unicopia.datagen.providers;
|
package com.minelittlepony.unicopia.datagen.providers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.block.UBlocks;
|
import com.minelittlepony.unicopia.block.UBlocks;
|
||||||
import com.minelittlepony.unicopia.datagen.DataCollector;
|
import com.minelittlepony.unicopia.datagen.DataCollector;
|
||||||
import com.minelittlepony.unicopia.item.BedsheetsItem;
|
import com.minelittlepony.unicopia.item.BedsheetsItem;
|
||||||
|
import com.minelittlepony.unicopia.item.GemstoneItem;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
|
||||||
|
@ -137,8 +139,7 @@ public class UModelProvider extends FabricModelProvider {
|
||||||
|
|
||||||
// gemstone
|
// gemstone
|
||||||
ModelOverrides.of(ItemModels.GENERATED)
|
ModelOverrides.of(ItemModels.GENERATED)
|
||||||
.addOverride(ModelIds.getItemSubModelId(UItems.GEMSTONE, "_pure"), "affinity", 0)
|
.addUniform("shape", List.of(GemstoneItem.Shape.values()), GemstoneItem.Shape::getId, shape -> ModelIds.getItemSubModelId(UItems.GEMSTONE, "_" + shape.name().toLowerCase(Locale.ROOT)))
|
||||||
.addOverride(ModelIds.getItemSubModelId(UItems.GEMSTONE, "_corrupted"), "affinity", 1)
|
|
||||||
.upload(UItems.GEMSTONE, itemModelGenerator);
|
.upload(UItems.GEMSTONE, itemModelGenerator);
|
||||||
|
|
||||||
// fishing rod
|
// fishing rod
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package com.minelittlepony.unicopia.item;
|
package com.minelittlepony.unicopia.item;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.Affinity;
|
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType;
|
import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||||
|
@ -96,11 +94,12 @@ public class GemstoneItem extends Item implements MultiItem, EnchantableItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDefaultStacks() {
|
public List<ItemStack> getDefaultStacks() {
|
||||||
return Arrays.stream(Affinity.VALUES)
|
return SpellType.REGISTRY.stream()
|
||||||
.flatMap(i -> SpellType.byAffinity(i).stream()
|
.filter(SpellType::isObtainable)
|
||||||
.filter(type -> type.isObtainable())
|
.sorted(
|
||||||
.map(type -> EnchantableItem.enchant(getDefaultStack(), type, i))
|
Comparator.<SpellType<?>, GemstoneItem.Shape>comparing(SpellType::getGemShape).thenComparing(Comparator.comparing(SpellType::getAffinity))
|
||||||
)
|
)
|
||||||
|
.map(type -> EnchantableItem.enchant(getDefaultStack(), type))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,4 +120,29 @@ public class GemstoneItem extends Item implements MultiItem, EnchantableItem {
|
||||||
return super.getName();
|
return super.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Shape {
|
||||||
|
ARROW,
|
||||||
|
BRUSH,
|
||||||
|
CROSS,
|
||||||
|
DONUT,
|
||||||
|
FLAME,
|
||||||
|
ICE,
|
||||||
|
LAMBDA,
|
||||||
|
RING,
|
||||||
|
ROCKET,
|
||||||
|
ROUND,
|
||||||
|
SHIELD,
|
||||||
|
SKULL,
|
||||||
|
SPLINT,
|
||||||
|
STAR,
|
||||||
|
TRIANGLE,
|
||||||
|
VORTEX,
|
||||||
|
WAVE;
|
||||||
|
|
||||||
|
public static final int LENGTH = values().length;
|
||||||
|
|
||||||
|
public float getId() {
|
||||||
|
return ordinal() / (float)LENGTH;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,7 @@
|
||||||
"spell.unicopia.shield.lore": "Casts a protective shield around the user",
|
"spell.unicopia.shield.lore": "Casts a protective shield around the user",
|
||||||
"spell.unicopia.bubble": "Bubble",
|
"spell.unicopia.bubble": "Bubble",
|
||||||
"spell.unicopia.bubble.lore": "Traps any creature it hits in a soap bubble",
|
"spell.unicopia.bubble.lore": "Traps any creature it hits in a soap bubble",
|
||||||
"spell.unicopia.arcane_protection": "Arcane Protections",
|
"spell.unicopia.arcane_protection": "Arcane Protection",
|
||||||
"spell.unicopia.arcane_protection.lore": "Creates a protective shroud over an area in which no other spells can be cast",
|
"spell.unicopia.arcane_protection.lore": "Creates a protective shroud over an area in which no other spells can be cast",
|
||||||
"spell.unicopia.vortex": "Arcane Attraction",
|
"spell.unicopia.vortex": "Arcane Attraction",
|
||||||
"spell.unicopia.vortex.lore": "Creates a magnetic force that pulls in other targets",
|
"spell.unicopia.vortex.lore": "Creates a magnetic force that pulls in other targets",
|
||||||
|
|
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.9 KiB |