Skip to content

Commit

Permalink
idk anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
database-test committed Oct 27, 2024
1 parent fc8512b commit a0b3b70
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
25 changes: 14 additions & 11 deletions src/main/java/com/nexia/core/mixin/block/EndPortalBlockMixin.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
package com.nexia.core.mixin.block;
import com.nexia.minigames.games.bridge.BridgeGame;

import com.nexia.base.player.NexiaPlayer;
import com.nexia.base.player.PlayerDataManager;
import com.nexia.core.NexiaCore;
import com.nexia.minigames.games.duels.util.player.DuelsPlayerData;
import com.nexia.minigames.games.bridge.BridgeGame;
import com.nexia.minigames.games.bridge.util.player.BridgePlayerData;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EndPortalBlock;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import static com.nexia.minigames.games.bridge.BridgeGame.team1;
import static com.nexia.minigames.games.bridge.BridgeGame.team2;
import static com.nexia.core.NexiaCore.BRIDGE_DATA_MANAGER;

@Mixin(EndPortalBlock.class)
public class EndPortalBlockMixin {
Expand All @@ -26,16 +24,21 @@ public class EndPortalBlockMixin {
)
private void entityInside(BlockState blockState, Level level, BlockPos blockPos, Entity entity, CallbackInfo ci) {
if (!(entity instanceof ServerPlayer serverPlayer)) return;
NexiaPlayer nexiaPlayer = new NexiaPlayer(serverPlayer);
if (nexiaPlayer.unwrap() == entity && nexiaPlayer.hasTag("in_bridge_game")) {

BridgeGame.goal(nexiaPlayer);
NexiaPlayer nexiaPlayer = new NexiaPlayer(serverPlayer);

if (nexiaPlayer.hasTag("in_bridge_game")) {

BridgePlayerData data = (BridgePlayerData) PlayerDataManager.getDataManager(BRIDGE_DATA_MANAGER).get(nexiaPlayer);

if (data.team == BridgeGame.team1) {

BridgeGame.goal(nexiaPlayer, "team1");
}
if (data.team == BridgeGame.team2) {

BridgeGame.goal(nexiaPlayer, "team2");
}
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import java.time.Duration;
import java.util.ArrayList;
import java.util.Objects;
import java.util.UUID;

import static com.nexia.core.NexiaCore.BRIDGE_DATA_MANAGER;
Expand Down Expand Up @@ -245,7 +246,7 @@ public static void second() {
}
}

public static void goal(NexiaPlayer player) {
public static void goal(NexiaPlayer player, String team) {


if (!team1.refreshTeam() || !team2.refreshTeam()) endGame(null);
Expand All @@ -255,7 +256,6 @@ public static void goal(NexiaPlayer player) {

if (!BridgeGame.isEnding) {

var i = 0;

// for (i = 0; player == team1.players.get(i); i++) {
// PlayerDataManager.getDataManager(BRIDGE_DATA_MANAGER).get(player.getUUID()).savedData.incrementInteger("goals");
Expand All @@ -264,13 +264,13 @@ public static void goal(NexiaPlayer player) {
//
// }
//the most cursed thing ive ever written
if (BridgeGame.team1.players.contains(player)) {
if (Objects.equals(team, "team1")) {
PlayerDataManager.getDataManager(BRIDGE_DATA_MANAGER).get(player.getUUID()).savedData.incrementInteger("goals");
team1.goals++;
teamID = '1';
}

if (BridgeGame.team2.players.contains(player)) {
if (Objects.equals(team, "team2")) {
PlayerDataManager.getDataManager(BRIDGE_DATA_MANAGER).get(player.getUUID()).savedData.incrementInteger("goals");
team2.goals++;
teamID = '2';
Expand Down Expand Up @@ -551,6 +551,7 @@ public static void tick() {
if (BridgeGame.world.players().isEmpty()) {
}


// AABB aabb = new AABB(BridgeGame.map.corner1, BridgeGame.map.corner2);
// Predicate<Entity> predicate = o -> true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
public class BridgeMap {


public static final BridgeMap NETHFLAT = new BridgeMap("NETHFLAT", "NETHFLAT", new EntityPos(0, 80, -41, 0, 0), new EntityPos(0, 80, 41, 180, 0), new StructureMap(new Identifier("bridge", "nethflat"), StructureMap.Rotation.NO_ROTATION, true, new BlockPos(0, 80, 0), new BlockPos(-36, -3, -51), true));
public static final BridgeMap NETHFLAT = new BridgeMap("Neth Flat", "Neth Flat", new EntityPos(0, 80, -41, 0, 0), new EntityPos(0, 80, 41, 180, 0), new StructureMap(new Identifier("bridge", "nethflat"), StructureMap.Rotation.NO_ROTATION, true, new BlockPos(0, 80, 0), new BlockPos(-36, -3, -51), true));
public static List<BridgeMap> bridgeMaps = new ArrayList<>();
public String id;
public String name;
public EntityPos team1Pos;
public EntityPos team2Pos;
public StructureMap structureMap;


public BridgeMap(String id, String name, EntityPos team1Pos, EntityPos team2Pos, StructureMap structureMap) {
this.id = id;
this.name = name;
Expand Down

0 comments on commit a0b3b70

Please sign in to comment.