Add an advancement: A Falling Wizard

This commit is contained in:
Sollace 2023-12-13 18:21:06 +00:00
parent f8fc9467be
commit ea813c3dcb
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
4 changed files with 42 additions and 6 deletions

View file

@ -8,6 +8,7 @@ import com.minelittlepony.unicopia.ability.data.Hit;
import com.minelittlepony.unicopia.ability.data.Pos; import com.minelittlepony.unicopia.ability.data.Pos;
import com.minelittlepony.unicopia.ability.magic.Caster; import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType; import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
import com.minelittlepony.unicopia.advancement.UCriteria;
import com.minelittlepony.unicopia.block.state.StatePredicate; import com.minelittlepony.unicopia.block.state.StatePredicate;
import com.minelittlepony.unicopia.entity.Living; import com.minelittlepony.unicopia.entity.Living;
import com.minelittlepony.unicopia.entity.player.Pony; import com.minelittlepony.unicopia.entity.player.Pony;
@ -163,16 +164,19 @@ public class UnicornTeleportAbility implements Ability<Pos> {
Vec3d dest = destination.vec().add(offset); Vec3d dest = destination.vec().add(offset);
participant.teleport( dest = new Vec3d(dest.x, getTargetYPosition(participant.getEntityWorld(), BlockPos.ofFloored(dest), ShapeContext.of(participant)), dest.z);
dest.x,
getTargetYPosition(participant.getEntityWorld(), BlockPos.ofFloored(dest), ShapeContext.of(participant)), participant.teleport(dest.x, dest.y, dest.z);
dest.z
);
teleporter.subtractEnergyCost(distance); teleporter.subtractEnergyCost(distance);
participant.fallDistance /= distance; participant.fallDistance /= distance;
participant.getWorld().playSound(null, destination.pos(), USounds.ENTITY_PLAYER_UNICORN_TELEPORT, SoundCategory.PLAYERS, 1, 1); BlockPos blockPos = BlockPos.ofFloored(dest);
participant.getWorld().playSound(null, blockPos, USounds.ENTITY_PLAYER_UNICORN_TELEPORT, SoundCategory.PLAYERS, 1, 1);
if (!participant.getEntityWorld().isInBuildLimit(blockPos)) {
UCriteria.TELEPORT_ABOVE_WORLD.trigger(teleporter.asEntity());
}
return true; return true;
} }

View file

@ -27,6 +27,7 @@ public interface UCriteria {
CustomEventCriterion.Trigger POWER_UP_HEART = CUSTOM_EVENT.createTrigger("power_up_heart"); CustomEventCriterion.Trigger POWER_UP_HEART = CUSTOM_EVENT.createTrigger("power_up_heart");
CustomEventCriterion.Trigger SPLIT_SEA = CUSTOM_EVENT.createTrigger("split_sea"); CustomEventCriterion.Trigger SPLIT_SEA = CUSTOM_EVENT.createTrigger("split_sea");
CustomEventCriterion.Trigger RIDE_BALLOON = CUSTOM_EVENT.createTrigger("ride_balloon"); CustomEventCriterion.Trigger RIDE_BALLOON = CUSTOM_EVENT.createTrigger("ride_balloon");
CustomEventCriterion.Trigger TELEPORT_ABOVE_WORLD = CUSTOM_EVENT.createTrigger("teleport_above_world");
static void bootstrap() { } static void bootstrap() { }
} }

View file

@ -1180,6 +1180,8 @@
"advancements.unicopia.tempted.description": "Put on the alicorn amulet", "advancements.unicopia.tempted.description": "Put on the alicorn amulet",
"advancements.unicopia.hello_darkness_my_old_friend.title": "Hello Darkness...", "advancements.unicopia.hello_darkness_my_old_friend.title": "Hello Darkness...",
"advancements.unicopia.hello_darkness_my_old_friend.description": "Delve further into the powers of the dark side", "advancements.unicopia.hello_darkness_my_old_friend.description": "Delve further into the powers of the dark side",
"advancements.unicopia.a_falling_wizard.title": "A Falling Wizard",
"advancements.unicopia.a_falling_wizard.description": "A unicorn tried to perform an unsuccessful flying spell",
"advancements.unicopia.split_the_sea.title": "Who are you? Moses?", "advancements.unicopia.split_the_sea.title": "Who are you? Moses?",
"advancements.unicopia.split_the_sea.description": "Use magic to displace over 100 blocks of water in one go", "advancements.unicopia.split_the_sea.description": "Use magic to displace over 100 blocks of water in one go",

View file

@ -0,0 +1,29 @@
{
"parent": "unicopia:unicopia/unicorn/magical_route",
"display": {
"icon": {
"item": "unicopia:pegasus_amulet"
},
"title": {
"translate": "advancements.unicopia.a_falling_wizard.title"
},
"description": {
"translate": "advancements.unicopia.a_falling_wizard.description"
},
"frame": "challenge",
"show_toast": true,
"announce_to_chat": true,
"hidden": true
},
"criteria": {
"teleport_above_world": {
"trigger": "unicopia:custom",
"conditions": {
"event": "teleport_above_world"
}
}
},
"requirements": [
[ "teleport_above_world" ]
]
}