mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-17 10:24:23 +01:00
Add an advancement for killing phantoms whilst flying
This commit is contained in:
parent
a3abee6765
commit
207320f6a0
8 changed files with 53 additions and 3 deletions
|
@ -18,6 +18,7 @@ public interface UCriteria {
|
|||
CustomEventCriterion.Trigger SEND_OATS = CUSTOM_EVENT.createTrigger("send_oats");
|
||||
CustomEventCriterion.Trigger RECEIVE_OATS = CUSTOM_EVENT.createTrigger("receive_oats");
|
||||
CustomEventCriterion.Trigger BREAK_WINDOW = CUSTOM_EVENT.createTrigger("break_window");
|
||||
CustomEventCriterion.Trigger KILL_PHANTOM_WHILE_FLYING = CUSTOM_EVENT.createTrigger("kill_phantom_while_flying");
|
||||
|
||||
static void bootstrap() { }
|
||||
}
|
||||
|
|
|
@ -538,6 +538,12 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
}
|
||||
}
|
||||
|
||||
public void onKill(Entity killedEntity, DamageSource damage) {
|
||||
if (killedEntity != null && killedEntity.getType() == EntityType.PHANTOM && getPhysics().isFlying()) {
|
||||
UCriteria.KILL_PHANTOM_WHILE_FLYING.trigger(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean subtractEnergyCost(double foodSubtract) {
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ import com.minelittlepony.unicopia.entity.player.Pony;
|
|||
import com.minelittlepony.unicopia.server.world.UGameRules;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.screen.ScreenHandlerListener;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
|
@ -44,4 +46,10 @@ abstract class MixinServerPlayerEntity extends PlayerEntity implements ScreenHan
|
|||
info.setReturnValue(Either.left(PlayerEntity.SleepFailureReason.OTHER_PROBLEM));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "updateKilledAdvancementCriterion(Lnet/minecraft/entity/Entity;ILnet/minecraft/entity/damage/DamageSource;)V",
|
||||
at = @At("TAIL"))
|
||||
private void onUpdateKilledAdvancementCriterion(Entity entityKilled, int score, DamageSource damageSource, CallbackInfo info) {
|
||||
get().onKill(entityKilled, damageSource);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -651,6 +651,9 @@
|
|||
"advancements.unicopia.rainbow_crash.title": "Dammit, Rainbow",
|
||||
"advancements.unicopia.rainbow_crash.description": "Wage war on the evil glass window nation",
|
||||
|
||||
"advancements.unicopia.deter_phantom.title": "What Flies Around",
|
||||
"advancements.unicopia.deter_phantom.description": "Get up there and give those phantoms a taste of their own medicine",
|
||||
|
||||
"unicopia.toast.discoveries.title": "New Discoveries!",
|
||||
"unicopia.toast.discoveries.description": "Check your spellbook"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"parent": "unicopia:unicopia/pegasus/sky_route",
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "unicopia:phantom_membrane"
|
||||
},
|
||||
"title": {
|
||||
"translate": "advancements.unicopia.deter_phantom.title"
|
||||
},
|
||||
"description": {
|
||||
"translate": "advancements.unicopia.deter_phantom.description"
|
||||
},
|
||||
"frame": "challenge",
|
||||
"show_toast": true,
|
||||
"announce_to_chat": true,
|
||||
"hidden": true
|
||||
},
|
||||
"criteria": {
|
||||
"the_thing": {
|
||||
"trigger": "unicopia:custom",
|
||||
"conditions": {
|
||||
"event": "kill_phantom_while_flying"
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[ "the_thing" ]
|
||||
],
|
||||
"rewards": {
|
||||
"experience": 100
|
||||
}
|
||||
}
|
|
@ -24,6 +24,6 @@
|
|||
}
|
||||
},
|
||||
"requirements": [
|
||||
[ "shed_feather" ]
|
||||
[ "shed_feather" ]
|
||||
]
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
}
|
||||
},
|
||||
"requirements": [
|
||||
[ "shed_feather_5" ]
|
||||
[ "shed_feather_5" ]
|
||||
]
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
}
|
||||
},
|
||||
"requirements": [
|
||||
[ "shed_feather_15" ]
|
||||
[ "shed_feather_15" ]
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue