Compare commits
2 Commits
94a4683d9b
...
3c01cf3c2c
Author | SHA1 | Date |
---|---|---|
Pablo Herrera | 3c01cf3c2c | |
Pablo Herrera | b386c531a0 |
|
@ -77,6 +77,11 @@ public class ClientsideFixes {
|
|||
*/
|
||||
public static final String ATTRIBUTE_FIX_KEY = "VFP|AttributeFix";
|
||||
|
||||
/**
|
||||
* This is an incremental index used for tablist entries to implement FIFO behavior <= 1.7
|
||||
*/
|
||||
public static int GLOBAL_TABLIST_INDEX = 0;
|
||||
|
||||
public static void init() {
|
||||
// Register additional CPE features
|
||||
CPEAdditions.modifyMappings();
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.access;
|
||||
|
||||
public interface IPlayerListEntry {
|
||||
|
||||
int viaFabricPlus$getIndex();
|
||||
|
||||
}
|
|
@ -22,6 +22,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network;
|
|||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.ClientsideFixes;
|
||||
import de.florianmichael.viafabricplus.fixes.data.recipe.RecipeInfo;
|
||||
import de.florianmichael.viafabricplus.fixes.data.recipe.Recipes1_11_2;
|
||||
import de.florianmichael.viafabricplus.injection.access.IDownloadingTerrainScreen;
|
||||
|
@ -178,6 +179,7 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
|||
}
|
||||
this.onSynchronizeRecipes(new SynchronizeRecipesS2CPacket(recipes));
|
||||
}
|
||||
ClientsideFixes.GLOBAL_TABLIST_INDEX = 0;
|
||||
((IPlayerListHud) MinecraftClient.getInstance().inGameHud.getPlayerListHud()).viaFabricPlus$setMaxPlayers(packet.maxPlayers());
|
||||
}
|
||||
|
||||
|
|
|
@ -19,24 +19,20 @@
|
|||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network;
|
||||
|
||||
import de.florianmichael.viafabricplus.fixes.ClientsideFixes;
|
||||
import de.florianmichael.viafabricplus.injection.access.IPlayerListEntry;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
@Mixin(PlayerListEntry.class)
|
||||
public abstract class MixinPlayerListEntry implements IntSupplier {
|
||||
public abstract class MixinPlayerListEntry implements IPlayerListEntry {
|
||||
|
||||
@Unique
|
||||
private static int viaFabricPlus$GLOBAL_INDEX = 0;
|
||||
|
||||
// A global creation order index, used to implement FIFO sorting in legacy tab list
|
||||
@Unique
|
||||
public final int viaFabricPlus$index = viaFabricPlus$GLOBAL_INDEX++;
|
||||
private final int viaFabricPlus$index = ClientsideFixes.GLOBAL_TABLIST_INDEX++;
|
||||
|
||||
@Override
|
||||
public int getAsInt() {
|
||||
public int viaFabricPlus$getIndex() {
|
||||
return viaFabricPlus$index;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen.hud;
|
||||
|
||||
import de.florianmichael.viafabricplus.injection.access.IPlayerListEntry;
|
||||
import de.florianmichael.viafabricplus.injection.access.IPlayerListHud;
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
@ -37,7 +38,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.function.IntSupplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Mixin(PlayerListHud.class)
|
||||
|
@ -45,12 +45,14 @@ public abstract class MixinPlayerListHud implements IPlayerListHud {
|
|||
|
||||
@Unique
|
||||
private static final Comparator<PlayerListEntry> viaFabricPlus$FIFO_COMPARATOR
|
||||
= Comparator.comparingInt(ple -> ((IntSupplier) ple).getAsInt());
|
||||
= Comparator.comparingInt(ple -> ((IPlayerListEntry) ple).viaFabricPlus$getIndex());
|
||||
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
@Shadow
|
||||
@Final
|
||||
private MinecraftClient client;
|
||||
|
||||
@Unique
|
||||
private int viaFabricPlus$maxSlots = 60;
|
||||
private int viaFabricPlus$maxSlots;
|
||||
@Unique
|
||||
private boolean viaFabricPlus$hideSkins = true;
|
||||
|
||||
|
@ -72,22 +74,21 @@ public abstract class MixinPlayerListHud implements IPlayerListHud {
|
|||
}
|
||||
|
||||
@Unique
|
||||
private List<PlayerListEntry> viaFabricPlus$transpose(List<PlayerListEntry> list) {
|
||||
private List<PlayerListEntry> viaFabricPlus$transpose(final List<PlayerListEntry> list) {
|
||||
// Only bother transposing if we know the list is full
|
||||
if (list.size() != viaFabricPlus$maxSlots) {
|
||||
viaFabricPlus$hideSkins =
|
||||
list.stream().noneMatch(e -> e.getProfile().getProperties().containsKey("textures"));
|
||||
viaFabricPlus$hideSkins = list.stream().noneMatch(e -> e.getProfile().getProperties().containsKey("textures"));
|
||||
return list;
|
||||
}
|
||||
|
||||
List<PlayerListEntry> result = new ArrayList<>(list.size());
|
||||
final List<PlayerListEntry> result = new ArrayList<>(list.size());
|
||||
|
||||
int columns = viaFabricPlus$maxSlots / PlayerListHud.MAX_ROWS;
|
||||
final int columns = viaFabricPlus$maxSlots / PlayerListHud.MAX_ROWS;
|
||||
boolean anyHasSkinData = false;
|
||||
for (int i = 0; i < viaFabricPlus$maxSlots; i++) {
|
||||
int row = i % PlayerListHud.MAX_ROWS;
|
||||
int col = i / PlayerListHud.MAX_ROWS;
|
||||
PlayerListEntry current = list.get(row * columns + col);
|
||||
final int row = i % PlayerListHud.MAX_ROWS;
|
||||
final int col = i / PlayerListHud.MAX_ROWS;
|
||||
final PlayerListEntry current = list.get(row * columns + col);
|
||||
result.add(current);
|
||||
anyHasSkinData = anyHasSkinData || current.getProfile().getProperties().containsKey("textures");
|
||||
}
|
||||
|
@ -96,7 +97,7 @@ public abstract class MixinPlayerListHud implements IPlayerListHud {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void viaFabricPlus$setMaxPlayers(int maxPlayers) {
|
||||
public void viaFabricPlus$setMaxPlayers(final int maxPlayers) {
|
||||
this.viaFabricPlus$maxSlots = Math.min(200, Math.max(20,
|
||||
((maxPlayers + PlayerListHud.MAX_ROWS - 1) / PlayerListHud.MAX_ROWS) * PlayerListHud.MAX_ROWS));
|
||||
}
|
||||
|
|
|
@ -81,9 +81,9 @@
|
|||
"visual_settings.viafabricplus.change_font_renderer_behaviour": "Change Font Renderer behavior",
|
||||
"visual_settings.viafabricplus.enable_sword_blocking": "Enable sword animation",
|
||||
"visual_settings.viafabricplus.enable_block_hit_animation": "Enable block hit animation",
|
||||
"visual_settings.viafabricplus.enable_legacy_tablist": "Enable legacy tablist behavior",
|
||||
"visual_settings.viafabricplus.disable_server_pinging": "Disable server pinging",
|
||||
"visual_settings.viafabricplus.sideways_backwards_walking": "Sideways backwards walking",
|
||||
"visual_settings.viafabricplus.enable_legacy_tablist": "Enable legacy tablist",
|
||||
|
||||
"bedrock.viafabricplus.login": "Your browser should have opened.\nClosing this screen will cancel the process!",
|
||||
"authentication.viafabricplus.failed_to_verify_session": "ViaFabricPlus couldn't verify your session! Please log in to an account or disable the BetaCraft authentication in the ViaFabricPlus Settings",
|
||||
|
|
Loading…
Reference in New Issue