Add back command
This commit is contained in:
parent
a027393534
commit
731a46c241
7 changed files with 94 additions and 3 deletions
|
@ -19,8 +19,14 @@ import dev.zontreck.essentials.networking.ModMessages;
|
|||
import dev.zontreck.essentials.networking.S2CUpdateHearts;
|
||||
import dev.zontreck.essentials.rtp.RTPCachesEventHandlers;
|
||||
import dev.zontreck.essentials.rtp.RandomPositionFactory;
|
||||
import dev.zontreck.essentials.util.BackPositionCaches;
|
||||
import dev.zontreck.libzontreck.events.RegisterPacketsEvent;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -105,6 +111,17 @@ public class AriasEssentials {
|
|||
ALIVE=false;
|
||||
}
|
||||
|
||||
@SubscribeEvent (priority = EventPriority.HIGHEST)
|
||||
public void onPlayerDied(final LivingDeathEvent ev)
|
||||
{
|
||||
if(ev.getEntity() instanceof ServerPlayer sp)
|
||||
{
|
||||
// Update player back position!
|
||||
WorldPosition wp = new WorldPosition(sp);
|
||||
BackPositionCaches.Update(sp.getUUID(), wp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
|
||||
@Mod.EventBusSubscriber(modid = AriasEssentials.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue