mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Add an advancement for killing a mob with a rock
This commit is contained in:
parent
849e47b905
commit
236f8afb02
5 changed files with 62 additions and 0 deletions
|
@ -29,6 +29,7 @@ public interface UDamageTypes {
|
|||
RegistryKey<DamageType> SUN = register("sun");
|
||||
RegistryKey<DamageType> SUNLIGHT = register("sunlight");
|
||||
RegistryKey<DamageType> PETRIFIED = register("petrified");
|
||||
RegistryKey<DamageType> ROCK = register("rock");
|
||||
|
||||
private static RegistryKey<DamageType> register(String name) {
|
||||
var key = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Unicopia.id(name));
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
import com.minelittlepony.unicopia.USounds;
|
||||
import com.minelittlepony.unicopia.UTags;
|
||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||
import com.minelittlepony.unicopia.entity.mob.UEntities;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -12,10 +13,13 @@ import net.minecraft.block.ButtonBlock;
|
|||
import net.minecraft.block.HopperBlock;
|
||||
import net.minecraft.block.LeverBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.FlyingItemEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.MovementType;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.damage.DamageSources;
|
||||
import net.minecraft.entity.data.DataTracker;
|
||||
import net.minecraft.entity.data.TrackedData;
|
||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||
|
@ -131,6 +135,16 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
|||
super.onEntityHit(hit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DamageSources getDamageSources() {
|
||||
return new DamageSources(getWorld().getRegistryManager()) {
|
||||
@Override
|
||||
public DamageSource arrow(PersistentProjectileEntity source, @Nullable Entity attacker) {
|
||||
return create(UDamageTypes.ROCK, source, attacker);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBlockHit(BlockHitResult hit) {
|
||||
BlockPos buttonPos = hit.getBlockPos().offset(hit.getSide());
|
||||
|
|
|
@ -734,6 +734,9 @@
|
|||
"death.attack.unicopia.steamroller.player": "%2$s steamrolled %1$s",
|
||||
"death.attack.unicopia.stalagmite.pegasus": "%1$s tried to perch on a stalagmite",
|
||||
"death.attack.unicopia.stalagmite.pegasus.player": "%1$s flew into a stalagmite whilst fighting %2$s",
|
||||
"death.attack.unicopia.rock": "%1$s was pummeled",
|
||||
"death.attack.unicopia.rock.item": "%1$s was pummelled by %2$s using %3$s",
|
||||
"death.attack.unicopia.rock.player": "%1$s was pummelled by %2$s",
|
||||
|
||||
"death.fell.accident.ladder.pegasus": "%1$s forgot they could fly and fell off a ladder",
|
||||
"death.fell.accident.vines.pegasus": "%1$s forgot they could fly and fell off some vines",
|
||||
|
@ -879,6 +882,8 @@
|
|||
|
||||
"advancements.unicopia.earth_route.title": "Path of the Pony",
|
||||
"advancements.unicopia.earth_route.description": "Join the Apple Clan",
|
||||
"advancements.unicopia.sticks_and_stones.title": "Sticks and Stones",
|
||||
"advancements.unicopia.sticks_and_stones.description": "Kill an mob by throwing rocks at it",
|
||||
"advancements.unicopia.born_on_a_rock_farm.title": "Born on a Rock Farm",
|
||||
"advancements.unicopia.born_on_a_rock_farm.description": "Successfully farm your first rock",
|
||||
"advancements.unicopia.thats_unusual.title": "That's Unusual",
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"parent": "unicopia:unicopia/earth/born_on_a_rock_farm",
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "unicopia:rock"
|
||||
},
|
||||
"title": {
|
||||
"translate": "advancements.unicopia.sticks_and_stones.title"
|
||||
},
|
||||
"description": {
|
||||
"translate": "advancements.unicopia.sticks_and_stones.description"
|
||||
},
|
||||
"frame": "task",
|
||||
"show_toast": true,
|
||||
"announce_to_chat": true,
|
||||
"hidden": true
|
||||
},
|
||||
"criteria": {
|
||||
"killed_entity_with_rock": {
|
||||
"trigger": "minecraft:player_killed_entity",
|
||||
"conditions": {
|
||||
"killing_blow": {
|
||||
"tags": [
|
||||
{
|
||||
"id": "unicopia:from_rocks",
|
||||
"expected": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[ "killed_entity_with_rock" ]
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"unicopia:rock"
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue