Skip to content

Commit

Permalink
feat: added ritual to summon random animal
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Aug 6, 2024
1 parent eb2c33d commit 27eec3a
Show file tree
Hide file tree
Showing 17 changed files with 340 additions and 13 deletions.
10 changes: 10 additions & 0 deletions src/generated/resources/assets/occultism/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,10 @@
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_otherworld_sapling_trader.intro.title": "Otherworld Sapling Trader",
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_otherworld_sapling_trader.name": "Summon Otherworld Sapling Trader",
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_otherworld_sapling_trader.trade.text": "To trade, drop an your offered item next to the trader, he will pick it up and drop the exchanged item.\n",
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_random_animal.description.text": "In this ritual a [#](ad03fc)Foliot[#]() is summoned **as an untamed spirit** to take the shape of a random animal.\n\\\n\\\nThe animal can be interacted with as it's natural counterpart, including taming, breeding and loot.\n",
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_random_animal.entity.text": "**Provides**: A random animal\n",
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_random_animal.entity.title": "Summon Random Animal",
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_random_animal.name": "Summon Random Animal",
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_transport_items.book_of_calling.text": "If you lose the book of calling, you can craft a new one.\n[#](ad03fc)Shift-right-click[#]() the spirit with the crafted book to assign it.\n",
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_transport_items.intro.text": "The transporter is useful in that you don't need a train of hoppers transporting stuff, and can use any inventory to take from and deposit.\n\\\n\\\nTo make it take from an inventory simply sneak and interact with it's book of calling on the inventory you want.\n",
"book.occultism.dictionary_of_spirits.summoning_rituals.summon_transport_items.intro.title": "Foliot Transporter",
Expand Down Expand Up @@ -1220,6 +1224,8 @@
"item.occultism.ritual_dummy.summon_horde_illager.tooltip": "Summon a possessed Evoker and his henchmen.",
"item.occultism.ritual_dummy.summon_marid_crusher": "Ritual: Summon Marid Crusher",
"item.occultism.ritual_dummy.summon_marid_crusher.tooltip": "The crusher is a spirit summoned to crush ores into dusts, effectively (more than) doubling the metal output. This crusher decays (much) slower than lower tier crushers.\n§7§oNote: Some recipes may require higher or lower tier crushers.",
"item.occultism.ritual_dummy.summon_random_animal": "Ritual: Summon Random Animal",
"item.occultism.ritual_dummy.summon_random_animal.tooltip": "Summons a random passive animal.",
"item.occultism.ritual_dummy.summon_wild_afrit": "Ritual: Summon Unbound Afrit",
"item.occultism.ritual_dummy.summon_wild_afrit.tooltip": "Summons an unbound Afrit that can be killed to obtain Afrit Essence",
"item.occultism.ritual_dummy.summon_wild_creeper": "Ritual: Summon The Wild Horde Creeper",
Expand Down Expand Up @@ -1790,6 +1796,10 @@
"ritual.occultism.summon_marid_crusher.finished": "Summoned marid ore crusher successfully.",
"ritual.occultism.summon_marid_crusher.interrupted": "Summoning of marid ore crusher interrupted.",
"ritual.occultism.summon_marid_crusher.started": "Started summoning marid ore crusher.",
"ritual.occultism.summon_random_animal.conditions": "Not all requirements for this ritual are met.",
"ritual.occultism.summon_random_animal.finished": "Summoned successfully.",
"ritual.occultism.summon_random_animal.interrupted": "Summoning of random animal interrupted.",
"ritual.occultism.summon_random_animal.started": "Started summoning a random animal.",
"ritual.occultism.summon_wild_afrit.conditions": "Not all requirements for this ritual are met.",
"ritual.occultism.summon_wild_afrit.finished": "Summoned unbound afrit successfully.",
"ritual.occultism.summon_wild_afrit.interrupted": "Summoning of unbound afrit interrupted.",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "occultism:item/ritual_dummy"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_bound_foliot": {
"conditions": {
"items": [
{
"items": "occultism:book_of_binding_bound_foliot"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "occultism:ritual/summon_random_animal"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_bound_foliot"
]
],
"rewards": {
"recipes": [
"occultism:ritual/summon_random_animal"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"background_u_index": 0,
"background_v_index": 0,
"category": "occultism:summoning_rituals",
"condition": {
"type": "modonomicon:true"
},
"description": "",
"hide_while_locked": false,
"icon": {
"item": "minecraft:cow_spawn_egg"
},
"name": "book.occultism.dictionary_of_spirits.summoning_rituals.summon_random_animal.name",
"pages": [
{
"type": "modonomicon:entity",
"anchor": "",
"condition": {
"type": "modonomicon:none"
},
"default_rotation": -45.0,
"entity_id": "minecraft:cow",
"name": "book.occultism.dictionary_of_spirits.summoning_rituals.summon_random_animal.entity.title",
"offset": 0.0,
"rotate": true,
"scale": 1.0,
"text": "book.occultism.dictionary_of_spirits.summoning_rituals.summon_random_animal.entity.text"
},
{
"type": "occultism:ritual_recipe",
"anchor": "",
"condition": {
"type": "modonomicon:none"
},
"recipe_id_1": "occultism:ritual/summon_random_animal",
"text": "",
"title1": "",
"title2": ""
},
{
"type": "modonomicon:text",
"anchor": "",
"condition": {
"type": "modonomicon:none"
},
"show_title_separator": true,
"text": "book.occultism.dictionary_of_spirits.summoning_rituals.summon_random_animal.description.text",
"title": "",
"use_markdown_in_title": false
}
],
"parents": [
{
"draw_arrow": true,
"entry": "occultism:summoning_rituals/summon_wild_parrot",
"line_enabled": true,
"line_reversed": true
}
],
"show_when_any_parent_unlocked": false,
"sort_number": -1,
"x": 4,
"y": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@
"show_when_any_parent_unlocked": false,
"sort_number": -1,
"x": 2,
"y": 2
"y": 4
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"type": "occultism:ritual",
"activation_item": {
"item": "occultism:book_of_binding_bound_foliot"
},
"ingredients": [
{
"tag": "c:crops"
},
{
"tag": "c:crops"
},
{
"tag": "c:crops"
},
{
"tag": "c:crops"
},
{
"tag": "c:crops"
},
{
"tag": "c:crops"
},
{
"tag": "c:crops"
},
{
"tag": "c:crops"
},
{
"item": "minecraft:egg"
}
],
"pentacle_id": "occultism:summon_foliot",
"result": {
"components": {
"minecraft:item_name": "{\"translate\":\"item.occultism.ritual_dummy.summon_random_animal\"}",
"minecraft:lore": [
"{\"translate\":\"item.occultism.ritual_dummy.summon_random_animal.tooltip\"}"
]
},
"count": 1,
"id": "minecraft:sheep_spawn_egg"
},
"ritual_dummy": {
"count": 1,
"id": "occultism:ritual_dummy/summon_random_animal"
},
"ritual_type": "occultism:summon_random_animal"
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
},
{
"tag": "c:dyes/blue"
},
{
"item": "minecraft:egg"
}
],
"pentacle_id": "occultism:summon_foliot",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"values": [
"minecraft:armadillo",
"minecraft:axolotl",
"minecraft:bat",
"minecraft:bee",
"minecraft:camel",
"minecraft:cat",
"minecraft:chicken",
"minecraft:cow",
"minecraft:donkey",
"minecraft:fox",
"minecraft:frog",
"minecraft:horse",
"minecraft:iron_golem",
"minecraft:llama",
"minecraft:mooshroom",
"minecraft:mule",
"minecraft:ocelot",
"minecraft:panda",
"minecraft:parrot",
"minecraft:pig",
"minecraft:polar_bear",
"minecraft:rabbit",
"minecraft:sheep",
"minecraft:snow_golem",
"minecraft:turtle",
"minecraft:villager",
"minecraft:wolf"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.klikli_dev.occultism.common.ritual;

import com.klikli_dev.occultism.crafting.recipe.RitualRecipe;
import com.klikli_dev.occultism.registry.OccultismTags;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.Level;

import java.util.stream.StreamSupport;

public class SummonRandomAnimalRitual extends SummonRitual{
public SummonRandomAnimalRitual(RitualRecipe recipe) {
super(recipe, false);
}

@Override
protected EntityType<?> getEntityToSummon(Level level) {
var options = StreamSupport.stream(BuiltInRegistries.ENTITY_TYPE.getTagOrEmpty(OccultismTags.Entities.RANDOM_ANIMALS_TO_SUMMON_LIST).spliterator(), false).toList();

if (options.isEmpty()) {
return null;
}

int index = level.random.nextInt(options.size());
return options.get(index).value();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void finish(Level level, BlockPos goldenBowlPosition, GoldenSacrificialBo
((ServerLevel) level).sendParticles(ParticleTypes.LARGE_SMOKE, goldenBowlPosition.getX() + 0.5,
goldenBowlPosition.getY() + 0.5, goldenBowlPosition.getZ() + 0.5, 1, 0, 0, 0, 0);

EntityType<?> entityType = this.recipe.getEntityToSummon();
EntityType<?> entityType = this.getEntityToSummon(level);
if (entityType != null) {
Entity entity = this.createSummonedEntity(entityType, level, goldenBowlPosition, blockEntity, castingPlayer);
if (entity instanceof LivingEntity living) {
Expand All @@ -152,6 +152,10 @@ public void finish(Level level, BlockPos goldenBowlPosition, GoldenSacrificialBo
}
}

protected EntityType<?> getEntityToSummon(Level level){
return this.recipe.getEntityToSummon();
}

public Entity createSummonedEntity(EntityType<?> entityType, Level level, BlockPos goldenBowlPosition, GoldenSacrificialBowlBlockEntity blockEntity,
@Nullable Player castingPlayer) {
return entityType.create(level);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3103,9 +3103,9 @@ private BookCategoryModel makeSummoningRitualsSubcategory() {
"______________________",
"_________1_e_i_a_m___",
"______________________",
"_________2_f_j________",
"_________2_f___I______",
"______________________",
"_________3_g__________",
"_________3_g_j________",
"______________________",
"_________4____________"
);
Expand Down Expand Up @@ -3146,6 +3146,9 @@ private BookCategoryModel makeSummoningRitualsSubcategory() {
var summonWildOtherworldBird = this.makeSummonWildOtherworldBirdEntry(entryMap, 'j');
summonWildOtherworldBird.withParent(BookEntryParentModel.create(summonWildParrot.getId()));

var summonRandomAnimal = this.makeSummonRandomAnimalEntry(entryMap, 'I');
summonRandomAnimal.withParent(BookEntryParentModel.create(summonWildParrot.getId()).withLineReversed(true));

var weatherMagic = this.makeWeatherMagicEntry(entryMap, 'k');
weatherMagic.withParent(BookEntryParentModel.create(overview.getId()));
var timeMagic = this.makeTimeMagicEntry(entryMap, 'l');
Expand All @@ -3171,6 +3174,7 @@ private BookCategoryModel makeSummoningRitualsSubcategory() {
summonOtherworldSaplingTrader.withCondition(BookTrueConditionModel.create());
summonOtherstoneTrader.withCondition(BookTrueConditionModel.create());
summonWildParrot.withCondition(BookTrueConditionModel.create());
summonRandomAnimal.withCondition(BookTrueConditionModel.create());
summonWildOtherworldBird.withCondition(BookTrueConditionModel.create());
weatherMagic.withCondition(BookTrueConditionModel.create());
timeMagic.withCondition(BookTrueConditionModel.create());
Expand All @@ -3197,6 +3201,7 @@ private BookCategoryModel makeSummoningRitualsSubcategory() {
summonOtherworldSaplingTrader,
summonWildOtherworldBird,
summonWildParrot,
summonRandomAnimal,
timeMagic,
weatherMagic,
witherSkull,
Expand Down Expand Up @@ -3724,6 +3729,50 @@ private BookEntryModel makeSummonWildParrotEntry(CategoryEntryMap entryMap, char
);
}

private BookEntryModel makeSummonRandomAnimalEntry(CategoryEntryMap entryMap, char icon) {
this.context().entry("summon_random_animal");
this.add(this.context().entryName(), "Summon Random Animal");

this.context().page("entity");
var entity = BookEntityPageModel.create()
.withEntityId("minecraft:cow")
.withEntityName(this.context().pageTitle())
.withText(this.context().pageText());

this.add(this.context().pageTitle(), "Summon Random Animal");
this.add(this.context().pageText(),
"""
**Provides**: A random animal
"""
);

this.context().page("ritual");
var ritual = BookRitualRecipePageModel.create()
.withRecipeId1(this.modLoc("ritual/summon_random_animal"));
//no text

this.context().page("description");
var description = BookTextPageModel.create()
.withText(this.context().pageText());
this.add(this.context().pageText(),
"""
In this ritual a [#](%1$s)Foliot[#]() is summoned **as an untamed spirit** to take the shape of a random animal.
\\
\\
The animal can be interacted with as it's natural counterpart, including taming, breeding and loot.
""".formatted(COLOR_PURPLE));


return BookEntryModel.create(this.modLoc(this.context().categoryId() + "/" + this.context().entryId()), this.context().entryName())
.withIcon(Items.COW_SPAWN_EGG)
.withLocation(entryMap.get(icon))
.withPages(
entity,
ritual,
description
);
}

private BookEntryModel makeSummonWildOtherworldBirdEntry(CategoryEntryMap entryMap, char icon) {
this.context().entry("summon_wild_otherworld_bird");

Expand Down
Loading

0 comments on commit 27eec3a

Please sign in to comment.