Skip to content

Commit

Permalink
infinity...
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra-Myers committed Jul 26, 2024
1 parent d41c168 commit 165a4bc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
18 changes: 18 additions & 0 deletions src/main/java/com/nexia/core/mixin/entity/LivingEntityMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<Boolean> 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
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/com/nexia/core/mixin/player/PlayerMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
}

0 comments on commit 165a4bc

Please sign in to comment.