diff --git a/src/generated/resources/data/tconstruct/recipes/tools/modifiers/ability/crystalshot_random.json b/src/generated/resources/data/tconstruct/recipes/tools/modifiers/ability/crystalshot_random.json new file mode 100644 index 00000000000..ba7d5d1524c --- /dev/null +++ b/src/generated/resources/data/tconstruct/recipes/tools/modifiers/ability/crystalshot_random.json @@ -0,0 +1,51 @@ +{ + "type": "tconstruct:swappable_modifier", + "inputs": [ + { + "ingredient": [ + { + "item": "tconstruct:earth_slime_crystal_cluster" + }, + { + "item": "tconstruct:sky_slime_crystal_cluster" + } + ] + }, + { + "ingredient": [ + { + "item": "minecraft:amethyst_cluster" + }, + { + "item": "minecraft:nether_quartz_ore" + } + ] + }, + { + "ingredient": [ + { + "item": "tconstruct:ichor_slime_crystal_cluster" + }, + { + "item": "tconstruct:ender_slime_crystal_cluster" + } + ] + }, + { + "tag": "forge:ingots/manyullyn" + }, + { + "tag": "forge:ingots/manyullyn" + } + ], + "tools": { + "tag": "tconstruct:modifiable/ranged/bows" + }, + "slots": { + "abilities": 1 + }, + "result": { + "name": "tconstruct:crystalshot", + "value": "random" + } +} \ No newline at end of file diff --git a/src/main/java/slimeknights/tconstruct/tools/data/ModifierRecipeProvider.java b/src/main/java/slimeknights/tconstruct/tools/data/ModifierRecipeProvider.java index e4621010303..2c0370ee120 100644 --- a/src/main/java/slimeknights/tconstruct/tools/data/ModifierRecipeProvider.java +++ b/src/main/java/slimeknights/tconstruct/tools/data/ModifierRecipeProvider.java @@ -595,6 +595,15 @@ private void addModifierRecipes(Consumer consumer) { crystalshotRecipe.accept(TinkerWorld.ichorGeode.getBud(BudSize.CLUSTER), "ichor"); crystalshotRecipe.accept(TinkerWorld.enderGeode.getBud(BudSize.CLUSTER), "enderslime"); crystalshotRecipe.accept(Items.NETHER_QUARTZ_ORE, "quartz"); + SwappableModifierRecipeBuilder.modifier(TinkerModifiers.crystalshot, "random") + .addInput(Ingredient.of(TinkerWorld.earthGeode.getBud(BudSize.CLUSTER), TinkerWorld.skyGeode.getBud(BudSize.CLUSTER))) + .addInput(Ingredient.of(Items.AMETHYST_CLUSTER, Items.NETHER_QUARTZ_ORE)) + .addInput(Ingredient.of(TinkerWorld.ichorGeode.getBud(BudSize.CLUSTER), TinkerWorld.enderGeode.getBud(BudSize.CLUSTER))) + .addInput(TinkerMaterials.manyullyn.getIngotTag()) + .addInput(TinkerMaterials.manyullyn.getIngotTag()) + .setTools(TinkerTags.Items.BOWS) + .setSlots(SlotType.ABILITY, 1) + .save(consumer, wrap(TinkerModifiers.crystalshot, abilityFolder, "_random")); ModifierRecipeBuilder.modifier(TinkerModifiers.crystalshot) .setSlots(SlotType.ABILITY, 1) .setTools(TinkerTags.Items.BOWS) diff --git a/src/main/java/slimeknights/tconstruct/tools/item/CrystalshotItem.java b/src/main/java/slimeknights/tconstruct/tools/item/CrystalshotItem.java index 88e1c2852c2..fadfda41e54 100644 --- a/src/main/java/slimeknights/tconstruct/tools/item/CrystalshotItem.java +++ b/src/main/java/slimeknights/tconstruct/tools/item/CrystalshotItem.java @@ -16,8 +16,23 @@ import net.minecraft.world.level.Level; import slimeknights.tconstruct.tools.TinkerTools; +import java.util.ArrayList; +import java.util.List; + /** Internal item used by crystalshot modifier */ public class CrystalshotItem extends ArrowItem { + /** Possible variants for a random crystalshot, so addons can register their own if desired */ + public static final List RANDOM_VARIANTS; + static { + RANDOM_VARIANTS = new ArrayList<>(); + RANDOM_VARIANTS.add("amethyst"); + RANDOM_VARIANTS.add("earthslime"); + RANDOM_VARIANTS.add("skyslime"); + RANDOM_VARIANTS.add("ichor"); + RANDOM_VARIANTS.add("enderslime"); + RANDOM_VARIANTS.add("quartz"); + } + /** NBT key for variants on the stack and entity */ private static final String TAG_VARIANT = "variant"; public CrystalshotItem(Properties props) { super(props); @@ -26,10 +41,15 @@ public CrystalshotItem(Properties props) { @Override public AbstractArrow createArrow(Level pLevel, ItemStack pStack, LivingEntity pShooter) { CrystalshotEntity arrow = new CrystalshotEntity(pLevel, pShooter); + String variant = "random"; CompoundTag tag = pStack.getTag(); if (tag != null) { - arrow.setVariant(tag.getString(TAG_VARIANT)); + variant = tag.getString(TAG_VARIANT); + } + if ("random".equals(variant)) { + variant = RANDOM_VARIANTS.get(pShooter.getRandom().nextInt(RANDOM_VARIANTS.size())); } + arrow.setVariant(variant); return arrow; } diff --git a/src/main/java/slimeknights/tconstruct/tools/modifiers/ability/ranged/CrystalshotModifier.java b/src/main/java/slimeknights/tconstruct/tools/modifiers/ability/ranged/CrystalshotModifier.java index 06bbf5a943b..1277eb1e7a9 100644 --- a/src/main/java/slimeknights/tconstruct/tools/modifiers/ability/ranged/CrystalshotModifier.java +++ b/src/main/java/slimeknights/tconstruct/tools/modifiers/ability/ranged/CrystalshotModifier.java @@ -17,6 +17,7 @@ import java.util.function.Predicate; public class CrystalshotModifier extends NoLevelsModifier implements BowAmmoModifierHook { + @Override protected void registerHooks(Builder hookBuilder) { hookBuilder.addHook(this, TinkerHooks.BOW_AMMO); diff --git a/src/main/resources/assets/tconstruct/mantle/colors.json b/src/main/resources/assets/tconstruct/mantle/colors.json index c66b48c005c..c8d51a82023 100644 --- a/src/main/resources/assets/tconstruct/mantle/colors.json +++ b/src/main/resources/assets/tconstruct/mantle/colors.json @@ -42,6 +42,7 @@ "crystalshot.ichor": "#FF8324", "crystalshot.skyslime": "#82D7D5", "crystalshot.quartz": "#B6A48E", + "crystalshot.random": "#FFFFFF", "__armor_abilities__": null, "ambidextrous": "#AA7D66", diff --git a/src/main/resources/assets/tconstruct/models/item/crystalshot.json b/src/main/resources/assets/tconstruct/models/item/crystalshot.json index 0423f5cc485..4504e2456cb 100644 --- a/src/main/resources/assets/tconstruct/models/item/crystalshot.json +++ b/src/main/resources/assets/tconstruct/models/item/crystalshot.json @@ -2,7 +2,7 @@ "loader": "mantle:nbt_key", "parent": "forge:item/default", "textures": { - "default": "tconstruct:item/arrow/amethyst", + "default": "tconstruct:item/arrow/crystalshot_random", "amethyst": "tconstruct:item/arrow/amethyst", "earthslime": "tconstruct:item/arrow/earthslime", "enderslime": "tconstruct:item/arrow/enderslime", diff --git a/src/main/resources/assets/tconstruct/textures/item/arrow/crystalshot_random.png b/src/main/resources/assets/tconstruct/textures/item/arrow/crystalshot_random.png new file mode 100644 index 00000000000..0382f405f5f Binary files /dev/null and b/src/main/resources/assets/tconstruct/textures/item/arrow/crystalshot_random.png differ