diff --git a/src/main/java/com/minelittlepony/unicopia/ability/EarthPonyKickAbility.java b/src/main/java/com/minelittlepony/unicopia/ability/EarthPonyKickAbility.java index 58cfcf32..b062b6c5 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/EarthPonyKickAbility.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/EarthPonyKickAbility.java @@ -100,6 +100,12 @@ public class EarthPonyKickAbility implements Ability { return true; } + if (type == ActivationType.DOUBLE_TAP && player.asEntity().isOnGround() && player.getMagicalReserves().getMana().get() > 40) { + player.getPhysics().dashForward((float)player.asWorld().random.nextTriangular(3.5F, 0.3F)); + player.subtractEnergyCost(4); + return true; + } + return false; } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java index 1da42ea1..9defc2bc 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java @@ -16,6 +16,7 @@ import com.minelittlepony.unicopia.item.UItems; import com.minelittlepony.unicopia.item.enchantment.UEnchantments; import com.minelittlepony.unicopia.particle.*; import com.minelittlepony.unicopia.projectile.ProjectileUtil; +import com.minelittlepony.unicopia.server.world.BlockDestructionManager; import com.minelittlepony.unicopia.server.world.ModificationType; import com.minelittlepony.unicopia.server.world.UGameRules; import com.minelittlepony.unicopia.server.world.WeatherConditions; @@ -32,6 +33,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.particle.ParticleTypes; +import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.util.math.*; @@ -623,12 +625,20 @@ public class PlayerPhysics extends EntityPhysics implements Tickab Vec3d orientation = entity.getRotationVec(1).multiply(speed); entity.addVelocity(orientation.x, orientation.y, orientation.z); - int damage = TraceHelper.findBlocks(entity, speed + 4, 1, state -> state.isIn(UTags.GLASS_PANES)).stream() + boolean isEarthPonySmash = pony.getObservedSpecies().canUseEarth() && !isFlying(); + int damage = TraceHelper.findBlocks(entity, speed + 4, 1, state -> (isEarthPonySmash && !state.isAir()) || state.isIn(UTags.GLASS_PANES)).stream() .flatMap(pos -> BlockPos.streamOutwards(pos, 2, 2, 2)) - .filter(pos -> entity.world.getBlockState(pos).isOf(Blocks.GLASS_PANE)) + .filter(pos -> (isEarthPonySmash && !entity.world.isAir(pos)) || entity.world.getBlockState(pos).isIn(UTags.GLASS_PANES)) .reduce(0, (u, pos) -> { if (pony.canModifyAt(pos, ModificationType.PHYSICAL)) { - entity.world.breakBlock(pos, true); + if (isEarthPonySmash) { + BlockDestructionManager.of(entity.world).damageBlock(pos, (int)entity.world.getRandom().nextTriangular(5, 3)); + if (BlockDestructionManager.of(entity.world).getBlockDestruction(pos) >= 9) { + entity.world.breakBlock(pos, true); + } + } else { + entity.world.breakBlock(pos, true); + } } else { ParticleUtils.spawnParticles(new MagicParticleEffect(0x00AAFF), entity.world, Vec3d.ofCenter(pos), 15); } @@ -638,11 +648,22 @@ public class PlayerPhysics extends EntityPhysics implements Tickab if (damage > 0) { pony.subtractEnergyCost(damage / 5F); entity.damage(DamageSource.FLY_INTO_WALL, Math.min(damage, entity.getHealth() - 1)); - UCriteria.BREAK_WINDOW.trigger(entity); + if (!isEarthPonySmash) { + UCriteria.BREAK_WINDOW.trigger(entity); + } + } + + if (isEarthPonySmash) { + pony.findAllEntitiesInRange(speed + 4, EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR).forEach(e -> e.damage(MagicalDamageSource.STEAMROLLER, 50)); } pony.updateVelocity(); - pony.playSound(USounds.ENTITY_PLAYER_PEGASUS_DASH, 1); + + if (isFlying()) { + pony.playSound(USounds.ENTITY_PLAYER_PEGASUS_DASH, 1); + } else { + pony.playSound(SoundEvents.ENTITY_RAVAGER_STEP, 2, 0.3F); + } } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayerEntity.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayerEntity.java index c4efcbf2..98b43573 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayerEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayerEntity.java @@ -39,7 +39,7 @@ abstract class MixinServerPlayerEntity extends PlayerEntity implements ScreenHan cancellable = true) private void onTrySleep(BlockPos pos, CallbackInfoReturnable> info) { if (get().getActualSpecies().isNocturnal() && get().asWorld().getGameRules().getBoolean(UGameRules.DO_NOCTURNAL_BAT_PONIES)) { - ((PlayerEntity)this).sendMessage(Text.translatable("block.minecraft.bed.no_sleep.nocturnal"), true); + ((PlayerEntity)this).sendMessage(Text.translatable("block.unicopia.bed.no_sleep.nocturnal"), true); info.setReturnValue(Either.left(PlayerEntity.SleepFailureReason.OTHER_PROBLEM)); } diff --git a/src/main/java/com/minelittlepony/unicopia/util/MagicalDamageSource.java b/src/main/java/com/minelittlepony/unicopia/util/MagicalDamageSource.java index bcb7be69..7834af8f 100644 --- a/src/main/java/com/minelittlepony/unicopia/util/MagicalDamageSource.java +++ b/src/main/java/com/minelittlepony/unicopia/util/MagicalDamageSource.java @@ -21,6 +21,7 @@ public class MagicalDamageSource extends EntityDamageSource { public static final DamageSource TRIBE_SWAP = new DamageSource("tribe_swap").setOutOfWorld().setUnblockable(); public static final DamageSource ZAP_APPLE = create("zap"); public static final DamageSource KICK = create("kick"); + public static final DamageSource STEAMROLLER = create("steamroller"); public static final DamageSource SUN = new DamageSource("sun").setBypassesArmor().setFire(); public static final DamageSource SUNLIGHT = new DamageSource("sunlight").setBypassesArmor().setFire(); public static final DamageSource PETRIFIED = new DamageSource("petrified").setBypassesArmor().setFire(); diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index c39c3547..821e60e4 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -2,7 +2,9 @@ "block.unicopia.bed.not_safe": "You may not rest here, there are enemies nearby", "block.unicopia.bed.not_tired": "You do not feel tired right now", - "block.minecraft.bed.no_sleep.nocturnal": "You can only sleep in the day or during thunderstorms", + "block.unicopia.bed.no_sleep.nocturnal": "You can only sleep in the day or during thunderstorms", + "sleep.not_possible.nocturnal": "No amount of rest can pass this day", + "sleep.skipping_day": "Sleeping through this day", "ability.unicopia.empty_hooves": "I need to find a jar", "ability.unicopia.indoors": "I can't see the sky from here", @@ -533,6 +535,8 @@ "death.attack.black_hole.player": "%1$s got sucked into %2$s's black hole", "death.attack.kick": "%1$s was kicked really hard", "death.attack.kick.player": "%2$s kicked %1$s really hard", + "death.attack.steamroller": "%1$s was flattened", + "death.attack.steamroller.player": "%2$s steamrolled %1$s", "death.attack.stalagmite.pegasus": "%1$s tried to perch on a stalagmite", "death.attack.stalagmite.pegasus.player": "%1$s flew into a stalagmite whilst fighting %2$s",