From 165a4bc5a80d037ef2911f0ffecd3302311784b6 Mon Sep 17 00:00:00 2001 From: Alexandra-Myers Date: Fri, 26 Jul 2024 11:08:42 -0400 Subject: [PATCH] infinity... --- .../core/mixin/entity/LivingEntityMixin.java | 18 ++++++++++++++++++ .../nexia/core/mixin/player/PlayerMixin.java | 7 ------- .../ffa/base/player/FFASavedPlayerData.java | 7 ------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/nexia/core/mixin/entity/LivingEntityMixin.java b/src/main/java/com/nexia/core/mixin/entity/LivingEntityMixin.java index 6d4bd8c6..f67671e7 100644 --- a/src/main/java/com/nexia/core/mixin/entity/LivingEntityMixin.java +++ b/src/main/java/com/nexia/core/mixin/entity/LivingEntityMixin.java @@ -1,9 +1,16 @@ package com.nexia.core.mixin.entity; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.nexia.base.player.PlayerDataManager; +import com.nexia.core.NexiaCore; +import com.nexia.core.games.util.PlayerGameMode; +import com.nexia.core.utilities.player.CorePlayerData; import com.nexia.minigames.games.bedwars.areas.BwAreas; import com.nexia.minigames.games.bedwars.util.BwUtil; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.CombatRules; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -32,6 +39,17 @@ public LivingEntityMixin(EntityType entityType, Level level) { @Shadow public abstract ItemStack getBlockingItem(); + // Make void death instant + @WrapOperation(method = "outOfWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hurt(Lnet/minecraft/world/damagesource/DamageSource;F)Z")) + protected boolean killInVoid(LivingEntity instance, DamageSource damageSource, float f, Operation original) { + if ((Object)this instanceof ServerPlayer serverPlayer) { + if (((CorePlayerData) PlayerDataManager.getDataManager(NexiaCore.CORE_DATA_MANAGER).get(serverPlayer.getUUID())).gameMode == PlayerGameMode.LOBBY) { + return original.call(instance, damageSource, f); + } + } + return original.call(instance, damageSource, Float.MAX_VALUE); + } + /** * @author NotCoded diff --git a/src/main/java/com/nexia/core/mixin/player/PlayerMixin.java b/src/main/java/com/nexia/core/mixin/player/PlayerMixin.java index 46561ecc..781725b7 100644 --- a/src/main/java/com/nexia/core/mixin/player/PlayerMixin.java +++ b/src/main/java/com/nexia/core/mixin/player/PlayerMixin.java @@ -10,14 +10,11 @@ import com.nexia.core.utilities.player.CoreSavedPlayerData; import com.nexia.core.utilities.player.PlayerUtil; import com.nexia.core.utilities.pos.EntityPos; -import com.nexia.ffa.FfaUtil; import com.nexia.ffa.base.BaseFfaUtil; import com.nexia.minigames.games.bedwars.players.BwPlayerEvents; import com.nexia.minigames.games.bedwars.util.BwUtil; import com.nexia.minigames.games.duels.DuelGameMode; import com.nexia.minigames.games.duels.util.player.DuelsPlayerData; -import com.nexia.nexus.api.world.types.Minecraft; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -135,10 +132,6 @@ private void afterHurt(DamageSource damageSource, float damage, CallbackInfo ci) NexiaPlayer nexiaPlayer = new NexiaPlayer(player); - if (FfaUtil.isFfaPlayer(nexiaPlayer) && damageSource == DamageSource.OUT_OF_WORLD) { - FfaUtil.leaveOrDie(nexiaPlayer, damageSource, false); - } - if (BwUtil.isBedWarsPlayer(nexiaPlayer)) { BwPlayerEvents.afterHurt(nexiaPlayer, damageSource); } diff --git a/src/main/java/com/nexia/ffa/base/player/FFASavedPlayerData.java b/src/main/java/com/nexia/ffa/base/player/FFASavedPlayerData.java index d48dbde3..7a9e392a 100644 --- a/src/main/java/com/nexia/ffa/base/player/FFASavedPlayerData.java +++ b/src/main/java/com/nexia/ffa/base/player/FFASavedPlayerData.java @@ -8,8 +8,6 @@ public class FFASavedPlayerData extends SavedPlayerData { public int killstreak; public int bestKillstreak; public int deaths; - public double rating; - public double elo; public FFASavedPlayerData() { super(); @@ -22,10 +20,5 @@ public FFASavedPlayerData() { set(Integer.class, "killstreak", killstreak); set(Integer.class, "bestKillstreak", bestKillstreak); set(Integer.class, "deaths", deaths); - - this.elo = 0; - this.rating = 1; - set(Double.class, "elo", elo); - set(Double.class, "rating", rating); } }