diff options
Diffstat (limited to 'fabric/src')
3 files changed, 10 insertions, 58 deletions
diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java b/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java index 9c5a1e8..21424fc 100644 --- a/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java +++ b/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java @@ -1,16 +1,12 @@ package de.hype.bbsentials.fabric; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.entity.player.PlayerEntity; - import java.util.ArrayList; import java.util.List; public class DebugThread implements de.hype.bbsentials.common.client.DebugThread { + public static List<Object> store = new ArrayList<>(); boolean doTest = false; - public static List<Object> store = new ArrayList<>(); @Override public void loop() { if (doTest) { @@ -26,52 +22,9 @@ public class DebugThread implements de.hype.bbsentials.common.client.DebugThread public void doOnce() { doTest = true; } + @Override public List<String> test() { return List.of(""); } - - public List<PlayerEntity> getAllPlayers() { - List<PlayerEntity> players = new ArrayList<>(); - - // Iterate through all players and check their distance from the source player - for (PlayerEntity player : MinecraftClient.getInstance().player.getEntityWorld().getPlayers()) { - if (!player.getDisplayName().getString().startsWith("!")) { - players.add(player); - } - } - - return players; - } - - public List<PlayerEntity> getPlayersInRadius(ClientPlayerEntity referencePlayer, List<PlayerEntity> players, double radius) { - List<PlayerEntity> nearbyPlayers = new ArrayList<>(); - - // Iterate through all players and check their distance from the source player - for (PlayerEntity player : players) { - if (player != referencePlayer && player.squaredDistanceTo(referencePlayer) <= radius * radius) { - nearbyPlayers.add(player); - } - } - - return nearbyPlayers; - } - - public List<PlayerEntity> getNonBingoPlayers(List<PlayerEntity> players) { - List<PlayerEntity> nonBingoPlayers = new ArrayList<>(); - - // Iterate through all players and check their distance from the source player - for (PlayerEntity player : players) { - if (player.getCustomName().getString().contains("Ⓑ")) { - nonBingoPlayers.add(player); - } - } - return nonBingoPlayers; - } - - public List<String> getSplashLeechingPlayers() { - List<PlayerEntity> players = getAllPlayers(); -// players.remove(MinecraftClient.getInstance().player); - return getPlayersInRadius(MinecraftClient.getInstance().player, getNonBingoPlayers(players), 5).stream().map((playerEntity -> playerEntity.getDisplayName().getString())).toList(); - } } diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/DoubleFieldWidget.java b/fabric/src/main/java/de/hype/bbsentials/fabric/DoubleFieldWidget.java index 968cb92..67cbf21 100644 --- a/fabric/src/main/java/de/hype/bbsentials/fabric/DoubleFieldWidget.java +++ b/fabric/src/main/java/de/hype/bbsentials/fabric/DoubleFieldWidget.java @@ -20,7 +20,7 @@ public class DoubleFieldWidget extends IntegerFieldWidget { @Override public boolean charTyped(char chr, int modifiers) { - if (chr == '.' || chr == ',') return super.typeChar('.', modifiers); + if (chr == '.' || chr == ',') return super.typeChar('.', modifiers, true); return super.charTyped(chr, modifiers); } diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/IntegerFieldWidget.java b/fabric/src/main/java/de/hype/bbsentials/fabric/IntegerFieldWidget.java index fbbd649..d5f9a2e 100644 --- a/fabric/src/main/java/de/hype/bbsentials/fabric/IntegerFieldWidget.java +++ b/fabric/src/main/java/de/hype/bbsentials/fabric/IntegerFieldWidget.java @@ -20,6 +20,13 @@ public class IntegerFieldWidget extends TextFieldWidget { @Override public boolean charTyped(char chr, int modifiers) { + return typeChar(chr, modifiers, false); + } + + public boolean typeChar(char chr, int modifiers, boolean doNotBlock) { + if (doNotBlock) { + return super.charTyped(chr, modifiers); + } // Allow removal (backspace and delete) and specific key combinations (Ctrl+A) if (chr == 8 || chr == 127 || (modifiers & 1) == 1) { return super.charTyped(chr, modifiers); @@ -30,12 +37,4 @@ public class IntegerFieldWidget extends TextFieldWidget { } return false; // Block other characters } - - /** - * Use this to bypass the check from the own charTyped. Passes this to the super Class of this. - */ - public boolean typeChar(char chr, int modifiers) { - return charTyped(chr, modifiers); - } - } |