mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-04 09:19:33 +01:00
Fix classic login input field
This commit is contained in:
parent
f3a86c51be
commit
1d45d1a054
@ -58,7 +58,6 @@ import java.io.File;
|
||||
* - Blit-jump is not supported in <= 1.8.9 (https://github.com/ViaVersion/ViaFabricPlus/issues/225)
|
||||
*
|
||||
* TODO | Migration v3
|
||||
* - Fix classic login input field (MixinSharedConstants)
|
||||
* - Make recipe fixes dynamic instead of a data dump in java classes
|
||||
* - Make mixin injection methods private
|
||||
* - Make mixins abstract
|
||||
@ -67,6 +66,7 @@ import java.io.File;
|
||||
* - Is de.florianmichael.viafabricplus.injection.mixin.jsonwebtoken.* still needed?
|
||||
* - Apply MixinAutoRefillHandler_ItemSlotMonitor only when mod is actually installed
|
||||
* - Make block shapes static
|
||||
* - Remove information package / system
|
||||
*/
|
||||
public class ViaFabricPlus {
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and 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 ITextFieldWidget {
|
||||
|
||||
void viaFabricPlus$unlockForbiddenCharacters();
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and 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.mixin.base;
|
||||
|
||||
import de.florianmichael.viafabricplus.injection.access.ITextFieldWidget;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(TextFieldWidget.class)
|
||||
public class MixinTextFieldWidget implements ITextFieldWidget {
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$forbiddenCharactersUnlocked = false;
|
||||
|
||||
@Redirect(method = "charTyped", at = @At(value = "INVOKE", target = "Lnet/minecraft/SharedConstants;isValidChar(C)Z"))
|
||||
public boolean allowForbiddenCharacters(char c) {
|
||||
if (this.viaFabricPlus$forbiddenCharactersUnlocked) {
|
||||
return true;
|
||||
}
|
||||
return SharedConstants.isValidChar(c);
|
||||
}
|
||||
|
||||
@Redirect(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/SharedConstants;stripInvalidChars(Ljava/lang/String;)Ljava/lang/String;"))
|
||||
public String allowForbiddenCharacters(String string) {
|
||||
if (this.viaFabricPlus$forbiddenCharactersUnlocked) {
|
||||
return string;
|
||||
}
|
||||
return SharedConstants.stripInvalidChars(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viaFabricPlus$unlockForbiddenCharacters() {
|
||||
this.viaFabricPlus$forbiddenCharactersUnlocked = true;
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.florianmichael.classic4j.ClassiCubeHandler;
|
||||
import de.florianmichael.classic4j.api.LoginProcessHandler;
|
||||
import de.florianmichael.classic4j.model.classicube.account.CCAccount;
|
||||
import de.florianmichael.viafabricplus.injection.access.ITextFieldWidget;
|
||||
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
||||
import de.florianmichael.viafabricplus.definition.account.ClassiCubeAccountHandler;
|
||||
import de.florianmichael.viafabricplus.screen.common.ProtocolSelectionScreen;
|
||||
@ -66,6 +67,9 @@ public class ClassiCubeLoginScreen extends VFPScreen {
|
||||
nameField.setMaxLength(Integer.MAX_VALUE);
|
||||
passwordField.setMaxLength(Integer.MAX_VALUE);
|
||||
|
||||
((ITextFieldWidget) nameField).viaFabricPlus$unlockForbiddenCharacters();
|
||||
((ITextFieldWidget) passwordField).viaFabricPlus$unlockForbiddenCharacters();
|
||||
|
||||
nameField.setText(ClassiCubeAccountHandler.INSTANCE.getUsername());
|
||||
passwordField.setText(ClassiCubeAccountHandler.INSTANCE.getPassword());
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
"base.MixinMultiplayerServerListWidget_ServerEntry",
|
||||
"base.MixinOptionsScreen",
|
||||
"base.MixinServerInfo",
|
||||
"base.MixinTextFieldWidget",
|
||||
"classic4j.MixinCCAuthenticationResponse",
|
||||
"compat.ipnext.MixinAutoRefillHandler_ItemSlotMonitor",
|
||||
"fixes.authlib.MixinKeyPairResponse",
|
||||
|
Loading…
Reference in New Issue
Block a user