Limbo entry/exit messages
This commit is contained in:
parent
20a8da57c1
commit
d233bc727a
8 changed files with 170 additions and 8 deletions
|
@ -1,6 +1,9 @@
|
|||
package org.dimdev.dimdoors.block;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import org.dimdev.dimdoors.entity.limbo.LimboExitReason;
|
||||
import org.dimdev.dimdoors.fluid.ModFluids;
|
||||
import org.dimdev.dimdoors.api.rift.target.EntityTarget;
|
||||
import org.dimdev.dimdoors.rift.targets.EscapeTarget;
|
||||
|
@ -27,7 +30,11 @@ public class EternalFluidBlock extends FluidBlock {
|
|||
}
|
||||
|
||||
try {
|
||||
TARGET.receiveEntity(entity, Vec3d.ZERO, MathUtil.entityEulerAngle(entity), entity.getVelocity());
|
||||
if (TARGET.receiveEntity(entity, Vec3d.ZERO, MathUtil.entityEulerAngle(entity), entity.getVelocity())) {
|
||||
if (entity instanceof PlayerEntity) {
|
||||
LimboExitReason.ETERNAL_FLUID.broadcast((PlayerEntity) entity);
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package org.dimdev.dimdoors.entity.limbo;
|
||||
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.MessageType;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Util;
|
||||
|
||||
public abstract class LimboEntranceSource {
|
||||
public abstract Text getMessage(PlayerEntity player);
|
||||
|
||||
public void broadcast(PlayerEntity player, MinecraftServer server) {
|
||||
server.getPlayerManager().broadcastChatMessage(this.getMessage(player), MessageType.SYSTEM, Util.NIL_UUID);
|
||||
}
|
||||
|
||||
public static LimboDeathEntranceSource ofDamageSource(DamageSource source) {
|
||||
return new LimboDeathEntranceSource(source);
|
||||
}
|
||||
|
||||
public static class LimboDeathEntranceSource extends LimboEntranceSource {
|
||||
private final DamageSource damageSource;
|
||||
|
||||
private LimboDeathEntranceSource(DamageSource damageSource) {
|
||||
this.damageSource = damageSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text getMessage(PlayerEntity player) {
|
||||
TranslatableText message = (TranslatableText) this.damageSource.getDeathMessage(player);
|
||||
return new TranslatableText("limbo." + message.getKey(), message.getArgs());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.dimdev.dimdoors.entity.limbo;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.MessageType;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.StringIdentifiable;
|
||||
import net.minecraft.util.Util;
|
||||
|
||||
public enum LimboExitReason implements StringIdentifiable {
|
||||
ETERNAL_FLUID,
|
||||
GENERIC,
|
||||
RIFT;
|
||||
|
||||
@Override
|
||||
public String asString() {
|
||||
return "limbo.exit." + this.name().toLowerCase();
|
||||
}
|
||||
|
||||
public void broadcast(PlayerEntity player) {
|
||||
//noinspection ConstantConditions
|
||||
player.getServer().getPlayerManager().broadcastChatMessage(new TranslatableText(asString(), player.getGameProfile().getName()), MessageType.SYSTEM, Util.NIL_UUID);
|
||||
}
|
||||
}
|
|
@ -17,6 +17,8 @@ import net.minecraft.world.World;
|
|||
public class BlockMixin {
|
||||
@Inject(method = "onBreak", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/block/Block;spawnBreakParticles(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V"))
|
||||
public void triggerTagBlockBreak(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfo ci) {
|
||||
ModCriteria.TAG_BLOCK_BREAK.trigger((ServerPlayerEntity) player, state.getBlock());
|
||||
if (!world.isClient()) {
|
||||
ModCriteria.TAG_BLOCK_BREAK.trigger((ServerPlayerEntity) player, state.getBlock());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.dimdev.dimdoors.mixin;
|
||||
|
||||
import org.dimdev.dimdoors.entity.advancement.ModCriteria;
|
||||
import org.dimdev.dimdoors.entity.limbo.LimboEntranceSource;
|
||||
import org.dimdev.dimdoors.entity.stat.ModStats;
|
||||
import org.dimdev.dimdoors.api.util.TeleportUtil;
|
||||
import org.dimdev.dimdoors.world.ModDimensions;
|
||||
|
@ -12,6 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
|
@ -32,6 +34,8 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin {
|
|||
}
|
||||
this.incrementStat(ModStats.TIMES_SENT_TO_LIMBO);
|
||||
TeleportUtil.teleportRandom(this, ModDimensions.LIMBO_DIMENSION, 384);
|
||||
//noinspection ConstantConditions
|
||||
LimboEntranceSource.ofDamageSource(source).broadcast((PlayerEntity) (Object) this, this.getServer());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ public class RiftRegistry {
|
|||
return this.graph.outgoingEdgesOf(pointer).stream()
|
||||
.map(this.graph::getEdgeTarget)
|
||||
.map(Rift.class::cast)
|
||||
.map(rift -> rift.getLocation())
|
||||
.map(Rift::getLocation)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,13 +4,10 @@ import java.util.UUID;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.util.math.EulerAngle;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import org.dimdev.dimdoors.api.rift.target.EntityTarget;
|
||||
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
||||
import org.dimdev.dimdoors.api.util.Location;
|
||||
import org.dimdev.dimdoors.api.util.TeleportUtil;
|
||||
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
||||
import org.dimdev.dimdoors.world.ModDimensions;
|
||||
import org.dimdev.dimdoors.world.level.registry.DimensionalRegistry;
|
||||
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
||||
|
@ -20,6 +17,8 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.EulerAngle;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import static org.dimdev.dimdoors.api.util.EntityUtils.chat;
|
||||
|
||||
|
|
|
@ -252,5 +252,97 @@
|
|||
"biome.dimdoors.black_void": "Black void (Public Pockets)",
|
||||
"biome.dimdoors.dangerous_black_void": "Dangerous Black void (Dungeon Pockets)",
|
||||
"biome.dimdoors.limbo": "Limbo",
|
||||
"biome.dimdoors.white_void": "White void (Private Pockets)"
|
||||
"biome.dimdoors.white_void": "White void (Private Pockets)",
|
||||
|
||||
"limbo.death.fell.accident.ladder": "%1$s fell off a ladder and fell into limbo",
|
||||
"limbo.death.fell.accident.vines": "%1$s fell off some vines and fell into limbo",
|
||||
"limbo.death.fell.accident.weeping_vines": "%1$s fell off some weeping vines and fell into limbo",
|
||||
"limbo.death.fell.accident.twisting_vines": "%1$s fell off some twisting vines and fell into limbo",
|
||||
"limbo.death.fell.accident.scaffolding": "%1$s fell off scaffolding and fell into limbo",
|
||||
"limbo.death.fell.accident.other_climbable": "%1$s fell while climbing and fell into limbo",
|
||||
"limbo.death.fell.accident.generic": "%1$s fell from a high place and fell into limbo",
|
||||
"limbo.death.fell.killer": "%1$s was doomed to fall and fell into limbo",
|
||||
"limbo.death.fell.assist": "%1$s was doomed to fall by %2$s and fell into limbo",
|
||||
"limbo.death.fell.assist.item": "%1$s was doomed to fall by %2$s using %3$s and fell into limb",
|
||||
"limbo.death.fell.finish": "%1$s fell too far and was sent to limbo by %2$s",
|
||||
"limbo.death.fell.finish.item": "%1$s fell too far and was finished by %2$s using %3$s and fell into limbo",
|
||||
"limbo.death.attack.lightningBolt": "%1$s was struck by lightning and was sent to limbo",
|
||||
"limbo.death.attack.lightningBolt.player": "%1$s was struck by lightning whilst fighting %2$s and was sent to limbo",
|
||||
"limbo.death.attack.inFire": "%1$s went to Limbo in flames",
|
||||
"limbo.death.attack.inFire.player": "%1$s walked into fire whilst fighting %2$s and was sent to Limbo",
|
||||
"limbo.death.attack.onFire": "%1$s burned to Limbo",
|
||||
"limbo.death.attack.onFire.player": "%1$s was burnt to a crisp whilst fighting %2$s and was sent tp Limbo",
|
||||
"limbo.death.attack.lava": "%1$s tried to swim in lava and sank into Limbo and sank into Limbo",
|
||||
"limbo.death.attack.lava.player": "%1$s tried to swim in lava to escape %2$s and sank into Limbo",
|
||||
"limbo.death.attack.hotFloor": "%1$s discovered the floor was lava and sank into Limbo",
|
||||
"limbo.death.attack.hotFloor.player": "%1$s walked into danger zone due to %2$s and sank into Limbo",
|
||||
"limbo.death.attack.inWall": "%1$s suffocated into Limbo",
|
||||
"limbo.death.attack.inWall.player": "%1$s suffocated into Limbo whilst fighting %2$s",
|
||||
"limbo.death.attack.cramming": "%1$s was squished too much ans sent to Limbo",
|
||||
"limbo.death.attack.cramming.player": "%1$s was squashed by %2$s",
|
||||
"limbo.death.attack.drown": "%1$s drowned and sank into Limbo",
|
||||
"limbo.death.attack.drown.player": "%1$s drowned whilst trying to escape %2$s and sank into Limbo",
|
||||
"limbo.death.attack.starve": "%1$s starved to death and shriveled into Limbo",
|
||||
"limbo.death.attack.starve.player": "%1$s starved to death whilst fighting %2$s and shriveled into Limbo",
|
||||
"limbo.death.attack.cactus": "%1$s pricked a hole in reality",
|
||||
"limbo.death.attack.cactus.player": "%1$s walked into a cactus whilst trying to escape %2$s and was sent to Limbo",
|
||||
"limbo.death.attack.generic": "%1$s was sent to Limbo",
|
||||
"limbo.death.attack.generic.player": "%1$s was sent to Limbo because of %2$s",
|
||||
"limbo.death.attack.explosion": "%1$s was blown to Limbo",
|
||||
"limbo.death.attack.explosion.player": "%1$s was blown to Limbo by %2$s",
|
||||
"limbo.death.attack.explosion.player.item": "%1$s was blown to Limbo by %2$s using %3$s",
|
||||
"limbo.death.attack.magic": "%1$s was cast into Limbo by magic",
|
||||
"limbo.death.attack.magic.player": "%1$s was cast into Limbo by magic whilst trying to escape %2$s",
|
||||
"limbo.death.attack.even_more_magic": "%1$s was cast into Limbo by even more magic",
|
||||
"limbo.death.attack.message_too_long": "Actually, message was too long to deliver fully. Sorry! Here's stripped version: %s",
|
||||
"limbo.death.attack.wither": "%1$s withered into Limbo",
|
||||
"limbo.death.attack.wither.player": "%1$s withered into Limbo whilst fighting %2$s",
|
||||
"limbo.death.attack.witherSkull": "%1$s was shot by a skull into Limbo from %2$s",
|
||||
"limbo.death.attack.anvil": "%1$s was squashed into Limbo by a falling anvil",
|
||||
"limbo.death.attack.anvil.player": "%1$s was squashed into Limbo by a falling anvil whilst fighting %2$s",
|
||||
"limbo.death.attack.fallingBlock": "%1$s was squashed into Limbo by a falling block",
|
||||
"limbo.death.attack.fallingBlock.player": "%1$s was squashed into Limbo by a falling block whilst fighting %2$s",
|
||||
"limbo.death.attack.stalagmite": "%1$s was impaled into Limbo on a stalagmite",
|
||||
"limbo.death.attack.stalagmite.player": "%1$s was impaled into Limbo on a stalagmite whilst fighting %2$s",
|
||||
"limbo.death.attack.fallingStalactite": "%1$s was skewered into Limbo by a falling stalactite",
|
||||
"limbo.death.attack.fallingStalactite.player": "%1$s was skewered into Limbo by a falling stalactite whilst fighting %2$s",
|
||||
"limbo.death.attack.mob": "%1$s was slain by %2$s and was sent to Limbo",
|
||||
"limbo.death.attack.mob.item": "%1$s was slain by %2$s using %3$s and was sent to Limbo",
|
||||
"limbo.death.attack.player": "%1$s was slain by %2$s and was sent to Limbo",
|
||||
"limbo.death.attack.player.item": "%1$s was slain by %2$s using %3$s and was sent to Limbo",
|
||||
"limbo.death.attack.arrow": "%1$s was shot by %2$s and was sent to Limbo",
|
||||
"limbo.death.attack.arrow.item": "%1$s was shot by %2$s using %3$s and was sent to Limbo",
|
||||
"limbo.death.attack.fireball": "%1$s was fireballed into Limbo by %2$s",
|
||||
"limbo.death.attack.fireball.item": "%1$s was fireballed into Limbo by %2$s using %3$s",
|
||||
"limbo.death.attack.thrown": "%1$s was pummeled into Limbo by %2$s",
|
||||
"limbo.death.attack.thrown.item": "%1$s was pummeled into Limbo by %2$s using %3$s",
|
||||
"limbo.death.attack.indirectMagic": "%1$s was killed by %2$s using magic and was sent to Limbo",
|
||||
"limbo.death.attack.indirectMagic.item": "%1$s was sent by %2$s using %3$s and was sent to Limbo",
|
||||
"limbo.death.attack.thorns": "%1$s was sent to Limbo trying to hurt %2$s",
|
||||
"limbo.death.attack.thorns.item": "%1$s was sent to Limbo by %3$s trying to hurt %2$s",
|
||||
"limbo.death.attack.trident": "%1$s was impaled by %2$s into Limbo",
|
||||
"limbo.death.attack.trident.item": "%1$s was impaled by %2$s with %3$s into Limbo",
|
||||
"limbo.death.attack.fall": "%1$s hit the ground too hard and dropped into Limbo",
|
||||
"limbo.death.attack.fall.player": "%1$s hit the ground too hard whilst trying to escape %2$s and dropped into Limbo",
|
||||
"limbo.death.attack.outOfWorld": "%1$s fell into Limbo",
|
||||
"limbo.death.attack.outOfWorld.player": "%1$s didn't want to live in the same world as %2$s and went to Limbo",
|
||||
"limbo.death.attack.dragonBreath": "%1$s was roasted in dragon breath and was sent to Limbo",
|
||||
"limbo.death.attack.dragonBreath.player": "%1$s was roasted in dragon breath by %2$s and was sent to Limbo",
|
||||
"limbo.death.attack.flyIntoWall": "%1$s experienced kinetic energy and flew into Limbo",
|
||||
"limbo.death.attack.flyIntoWall.player": "%1$s experienced kinetic energy whilst trying to escape %2$s and flew into Limbo",
|
||||
"limbo.death.attack.fireworks": "%1$s went into Limbo with a bang",
|
||||
"limbo.death.attack.fireworks.player": "%1$s went into Limbo with a bang whilst fighting %2$s",
|
||||
"limbo.death.attack.fireworks.item": "%1$s went into Limbo with a bang due to a firework fired from %3$s by %2$s",
|
||||
"limbo.death.attack.badRespawnPoint.message": "%1$s was killed by %2$s and was sent by Limbo",
|
||||
"limbo.death.attack.badRespawnPoint.link": "Intentional Game Design",
|
||||
"limbo.death.attack.sweetBerryBush": "%1$s poked a hole in reality",
|
||||
"limbo.death.attack.sweetBerryBush.player": "%1$s was poked to death by a sweet berry bush whilst trying to escape %2$s and was sent to Limbo",
|
||||
"limbo.death.attack.sting": "%1$s bugged out to Limbo",
|
||||
"limbo.death.attack.sting.player": "%1$s bugged out to Limbo by %2$s",
|
||||
"limbo.death.attack.freeze": "%1$s froze into Limbo",
|
||||
"limbo.death.attack.freeze.player": "%1$s was frozen into Limbo by %2$s",
|
||||
|
||||
"limbo.exit.eternal_fluid": "%1$s bathed in reality",
|
||||
"limbo.exit.generic": "%1$s escaped Limbo",
|
||||
"limbo.exit.rift": "%1$s found a rift leading out of Limbo"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue