mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-31 18:18:04 +01:00
Updated to 1.20-rc1
This commit is contained in:
parent
a76af7d66d
commit
7546c8812f
9
.github/DEVELOPER_API.md
vendored
9
.github/DEVELOPER_API.md
vendored
@ -22,13 +22,18 @@ public class ViaFabricPlusExampleAddon implements ClientModInitializer {
|
||||
| PreLoadCallback | Called before everything (Pre-pre load) |
|
||||
|
||||
### General API
|
||||
#### Add CustomPayload channels for versions below 1.13
|
||||
In order to receive custom payloads with custom channels in versions below 1.13, you need to register them, that's what you do:
|
||||
```java
|
||||
Protocol1_13To1_12_2.MAPPINGS.getChannelMappings().put("FML|HS", "fml:hs");
|
||||
```
|
||||
|
||||
#### Get the release version of a material:
|
||||
```java
|
||||
final VersionRange range = ItemReleaseVersionDefinition.INSTANCE.getItemMap().get(Items.WRITABLE_BOOK); // If an item does not appear in the item map, it has always existed
|
||||
|
||||
// The Range class then contains all versions in which the item occurs.
|
||||
// You can find out how the Range class works in the ViaLoadingBase README.
|
||||
// https://github.com/FlorianMichael/ViaLoadingBase
|
||||
// https://github.com/ViaVersion/ViaLoader
|
||||
```
|
||||
|
||||
#### Creating own settings for the settings screen:
|
||||
|
41
README.md
41
README.md
@ -14,7 +14,7 @@
|
||||
# Why another protocol translator?
|
||||
ViaFabricPlus is intended to replace [multiconnect](https://github.com/Earthcomputer/multiconnect), and it also promises more compactness and stability. ViaFabricPlus can do everything multiconnect could do, but supports more Minecraft versions (listed below) and has more protocol changes implemented.
|
||||
### Supported Server versions
|
||||
- Release (1.0.0 - 1.20 [1.20-pre7])
|
||||
- Release (1.0.0 - 1.20 [1.20-rc1])
|
||||
- Beta (b1.0 - b1.8.1)
|
||||
- Alpha (a1.0.15 - a1.2.6)
|
||||
- Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension))
|
||||
@ -75,12 +75,12 @@ For compiling only! **You do not need to install these!**
|
||||
| ViaVersion | https://github.com/ViaVersion/ViaVersion |
|
||||
| ViaBackwards | https://github.com/ViaVersion/ViaBackwards |
|
||||
| Snake YAML | https://mvnrepository.com/artifact/org.yaml/snakeyaml/1.33 |
|
||||
| ViaLegacy | https://github.com/RaphiMC/ViaLegacy |
|
||||
| ViaAprilFools | https://github.com/RaphiMC/ViaAprilFools |
|
||||
| ViaBedrock | https://github.com/RaphiMC/ViaBedrock |
|
||||
| ViaLegacy | https://github.com/ViaVersion/ViaLegacy |
|
||||
| ViaAprilFools | https://github.com/ViaVersion/ViaAprilFools |
|
||||
| ViaBedrock | https://github.com/ViaVersion/ViaBedrock |
|
||||
| MC-Structs | https://github.com/Lenni0451/MCStructs |
|
||||
| Reflect | https://github.com/Lenni0451/Reflect |
|
||||
| ViaLoadingBase | https://github.com/FlorianMichael/ViaLoadingBase |
|
||||
| ViaLoader | https://github.com/ViaVersion/ViaLoader |
|
||||
| Netty-transport-RakNet | https://github.com/CloudburstMC/Network/tree/develop |
|
||||
| Classic4J | https://github.com/FlorianMichael/Classic4J |
|
||||
</details>
|
||||
@ -93,6 +93,37 @@ ViaFabricPlus uses Gradle, to make sure that it is installed properly you can ch
|
||||
4. Open the folder as a Gradle project in your preferred IDE.
|
||||
5. Run the mod.
|
||||
|
||||
### Include via Gradle/Maven
|
||||
```groovy
|
||||
repositories {
|
||||
maven {
|
||||
name = "ViaVersion"
|
||||
url = "https://repo.viaversion.com"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "de.florianmichael:viafabricplus:2.7.3" // Get latest version from releases
|
||||
}
|
||||
```
|
||||
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>viaversion</id>
|
||||
<url>https://repo.viaversion.com</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>de.florianmichael</groupId>
|
||||
<artifactId>viafabricplus</artifactId>
|
||||
<version>2.7.3</version> <!-- Get latest version from releases -->
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
### To learn more about the API and about addons, you can simply click [here](.github/DEVELOPER_API.md)
|
||||
|
||||
## ⚠️ WARNING ⚠️
|
||||
|
23
build.gradle
23
build.gradle
@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
id "fabric-loom" version "1.1-SNAPSHOT"
|
||||
id "maven-publish"
|
||||
}
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
@ -124,3 +125,25 @@ jar {
|
||||
}
|
||||
from("LICENSE") { rename { "${it}_${project.archivesBaseName}" } }
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Via"
|
||||
url = "https://repo.viaversion.com/"
|
||||
credentials(PasswordCredentials)
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
groupId = project.maven_group
|
||||
artifactId = project.archives_base_name
|
||||
version = project.mod_version
|
||||
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# minecraft and fabric
|
||||
minecraft_version=1.20-pre7
|
||||
yarn_mappings=1.20-pre7+build.2
|
||||
minecraft_version=1.20-rc1
|
||||
yarn_mappings=1.20-rc1+build.2
|
||||
loader_version=0.14.21
|
||||
fabric_api_version=0.83.0+1.20
|
||||
|
||||
# viafabricplus
|
||||
mod_version=2.7.3
|
||||
mod_version=2.7.5-SNAPSHOT
|
||||
maven_group=de.florianmichael
|
||||
archives_base_name=viafabricplus
|
||||
|
||||
@ -18,7 +18,7 @@ raknet_transport_version=1.0.0.CR1-SNAPSHOT
|
||||
classic4j_version=1.2.0
|
||||
|
||||
# viaversion (and required) libs
|
||||
viaversion_version=4.7.0-1.20-pre7-SNAPSHOT
|
||||
viaversion_version=4.7.0-1.20-rc1-SNAPSHOT
|
||||
viabackwards_version=4.7.0-1.20-pre5-SNAPSHOT
|
||||
snake_yml_version=2.0
|
||||
|
||||
@ -31,7 +31,7 @@ vialoader_version=2.2.5-SNAPSHOT
|
||||
|
||||
# lenni0451 libs
|
||||
mcstructs_text_version=2.2.5
|
||||
reflect_version=1.1.0
|
||||
reflect_version=1.2.0
|
||||
|
||||
# other libs
|
||||
mod_menu_version=7.0.0-beta.2
|
||||
|
@ -19,12 +19,13 @@ package de.florianmichael.viafabricplus.base.settings.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class SettingGroup {
|
||||
private final List<AbstractSetting<?>> settings = new ArrayList<>();
|
||||
private final String name;
|
||||
private final Text name;
|
||||
|
||||
public SettingGroup(String name) {
|
||||
public SettingGroup(Text name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@ -32,7 +33,7 @@ public class SettingGroup {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
public Text getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class AuthenticationSettings extends SettingGroup {
|
||||
public final ButtonSetting BEDROCK_ACCOUNT = new ButtonSetting(this, Text.translatable("authentication.viafabricplus.bedrock"), () -> CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
try (final CloseableHttpClient httpClient = MicrosoftConstants.createHttpClient()) {
|
||||
BedrockAccountHandler.INSTANCE.setAccount(MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.getFromInput(httpClient, new StepMsaDeviceCode.MsaDeviceCodeCallback(msaDeviceCode -> {
|
||||
final var mcChain = MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.getFromInput(httpClient, new StepMsaDeviceCode.MsaDeviceCodeCallback(msaDeviceCode -> {
|
||||
MinecraftClient.getInstance().execute(() -> MinecraftClient.getInstance().setScreen(new ConfirmScreen(consumer -> {
|
||||
if (consumer) {
|
||||
MinecraftClient.getInstance().keyboard.setClipboard(msaDeviceCode.userCode());
|
||||
@ -64,17 +64,19 @@ public class AuthenticationSettings extends SettingGroup {
|
||||
e.printStackTrace();
|
||||
MinecraftClient.getInstance().execute(() -> MinecraftClient.getInstance().setScreen(new NoticeScreen(() -> Thread.currentThread().interrupt(), Text.literal("Microsoft Bedrock login"), Text.translatable("bedrocklogin.viafabricplus.error"), Text.translatable("words.viafabricplus.cancel"), false)));
|
||||
}
|
||||
})));
|
||||
}));
|
||||
BedrockAccountHandler.INSTANCE.setAccount(mcChain, MinecraftAuth.BEDROCK_PLAY_FAB_TOKEN.getFromInput(httpClient, mcChain.prevResult().fullXblSession()));
|
||||
}
|
||||
ProtocolSelectionScreen.INSTANCE.open(new MultiplayerScreen(new TitleScreen()));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
MinecraftClient.getInstance().execute(() -> MinecraftClient.getInstance().setScreen(new NoticeScreen(() -> Thread.currentThread().interrupt(), Text.literal("Microsoft Bedrock login"), Text.translatable("bedrocklogin.viafabricplus.error"), Text.translatable("words.viafabricplus.cancel"), false)));
|
||||
}
|
||||
})) {
|
||||
@Override
|
||||
public MutableText displayValue() {
|
||||
if (BedrockAccountHandler.INSTANCE.getAccount() != null) {
|
||||
return Text.literal("Bedrock account: " + BedrockAccountHandler.INSTANCE.getAccount().displayName());
|
||||
if (BedrockAccountHandler.INSTANCE.getMcChain() != null) {
|
||||
return Text.literal("Bedrock account: " + BedrockAccountHandler.INSTANCE.getMcChain().displayName());
|
||||
}
|
||||
return super.displayValue();
|
||||
}
|
||||
@ -85,6 +87,6 @@ public class AuthenticationSettings extends SettingGroup {
|
||||
|
||||
|
||||
public AuthenticationSettings() {
|
||||
super("Authentication");
|
||||
super(Text.translatable("settings.viafabricplus.authentication"));
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,6 @@ public class DebugSettings extends SettingGroup {
|
||||
public final ProtocolSyncBooleanSetting legacyMiningSpeeds = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.legacypseeds"), VersionRange.andOlder(VersionEnum.r1_4_6tor1_4_7));
|
||||
|
||||
public DebugSettings() {
|
||||
super("Debug");
|
||||
super(Text.translatable("settings.viafabricplus.debug"));
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ public class ExperimentalSettings extends SettingGroup {
|
||||
public final BooleanSetting fixFontCache = new BooleanSetting(this, Text.translatable("experimental.viafabricplus.fontcachefix"), true);
|
||||
|
||||
public ExperimentalSettings() {
|
||||
super("Experimental");
|
||||
super(Text.translatable("settings.viafabricplus.experimental"));
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class GeneralSettings extends SettingGroup {
|
||||
public final BooleanSetting autoDetectVersion = new BooleanSetting(this, Text.translatable("general.viafabricplus.autodetect"), false);
|
||||
|
||||
public GeneralSettings() {
|
||||
super("General");
|
||||
super(Text.translatable("settings.viafabricplus.general"));
|
||||
mainButtonOrientation.setValue(1); // Default value
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,6 @@ public class VisualSettings extends SettingGroup {
|
||||
public final ProtocolSyncBooleanSetting fixSodiumChunkRendering = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.sodium"), VersionRange.andOlder(VersionEnum.c0_28toc0_30));
|
||||
|
||||
public VisualSettings() {
|
||||
super("Visual");
|
||||
super(Text.translatable("settings.viafabricplus.visual"));
|
||||
}
|
||||
}
|
||||
|
@ -17,17 +17,15 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.definition.bedrock;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.base.FileSaver;
|
||||
import net.raphimc.mcauth.MinecraftAuth;
|
||||
import net.raphimc.mcauth.step.bedrock.StepMCChain;
|
||||
import net.raphimc.mcauth.step.bedrock.playfab.StepPlayFabToken;
|
||||
import net.raphimc.mcauth.util.MicrosoftConstants;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class BedrockAccountHandler extends FileSaver {
|
||||
public static BedrockAccountHandler INSTANCE;
|
||||
|
||||
@ -36,7 +34,8 @@ public class BedrockAccountHandler extends FileSaver {
|
||||
BedrockAccountHandler.INSTANCE.init();
|
||||
}
|
||||
|
||||
private StepMCChain.MCChain account;
|
||||
private StepMCChain.MCChain mcChain;
|
||||
private StepPlayFabToken.PlayFabToken playFabToken;
|
||||
|
||||
public BedrockAccountHandler() {
|
||||
super("bedrock.account");
|
||||
@ -44,30 +43,39 @@ public class BedrockAccountHandler extends FileSaver {
|
||||
|
||||
@Override
|
||||
public void write(JsonObject object) {
|
||||
if (account == null) return;
|
||||
if (mcChain == null) return;
|
||||
|
||||
for (Map.Entry<String, JsonElement> entry : account.toJson().entrySet()) {
|
||||
object.add(entry.getKey(), entry.getValue());
|
||||
}
|
||||
object.add("mc-chain", mcChain.toJson());
|
||||
object.add("play-fab-token", playFabToken.toJson());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(JsonObject object) {
|
||||
try {
|
||||
account = MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.fromJson(object);
|
||||
mcChain = MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.fromJson(object.get("mc-chain").getAsJsonObject());
|
||||
try (final CloseableHttpClient httpClient = MicrosoftConstants.createHttpClient()) {
|
||||
account = MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.refresh(httpClient, account);
|
||||
mcChain = MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.refresh(httpClient, mcChain);
|
||||
}
|
||||
|
||||
playFabToken = MinecraftAuth.BEDROCK_PLAY_FAB_TOKEN.fromJson(object.get("play-fab-token").getAsJsonObject());
|
||||
try (final CloseableHttpClient httpClient = MicrosoftConstants.createHttpClient()) {
|
||||
playFabToken = MinecraftAuth.BEDROCK_PLAY_FAB_TOKEN.refresh(httpClient, playFabToken);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ViaFabricPlus.LOGGER.warn("No Bedrock account could be found");
|
||||
}
|
||||
}
|
||||
|
||||
public StepMCChain.MCChain getAccount() {
|
||||
return account;
|
||||
public void setAccount(final StepMCChain.MCChain mcChain, final StepPlayFabToken.PlayFabToken playFabToken) {
|
||||
this.mcChain = mcChain;
|
||||
this.playFabToken = playFabToken;
|
||||
}
|
||||
|
||||
public void setAccount(StepMCChain.MCChain account) {
|
||||
this.account = account;
|
||||
public StepMCChain.MCChain getMcChain() {
|
||||
return mcChain;
|
||||
}
|
||||
|
||||
public StepPlayFabToken.PlayFabToken getPlayFabToken() {
|
||||
return playFabToken;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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.fixes.minecraft;
|
||||
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.text.OrderedText;
|
||||
import net.minecraft.text.StringVisitable;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(TextRenderer.class)
|
||||
public abstract class MixinTextRenderer {
|
||||
|
||||
@Shadow public abstract List<OrderedText> wrapLines(StringVisitable text, int width);
|
||||
|
||||
@Shadow public abstract int draw(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light);
|
||||
|
||||
@Shadow public abstract String mirror(String text);
|
||||
|
||||
@Shadow @Final public int fontHeight;
|
||||
|
||||
@Shadow protected abstract int drawInternal(OrderedText text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light);
|
||||
|
||||
@Shadow public abstract int getWidth(OrderedText text);
|
||||
|
||||
@Inject(method = "draw(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;IIZ)I", at = @At("HEAD"), cancellable = true)
|
||||
public void allowNewLines_String(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, boolean rightToLeft, CallbackInfoReturnable<Integer> cir) {
|
||||
if (ProtocolHack.getTargetVersion() == VersionEnum.bedrockLatest) {
|
||||
final List<OrderedText> lines = wrapLines(StringVisitable.plain(rightToLeft ? this.mirror(text) : text), Integer.MAX_VALUE);
|
||||
if (lines.size() > 1) {
|
||||
int offsetX = 0;
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
offsetX = this.drawInternal(lines.get(i), x, y - (lines.size() * (fontHeight + 2)) + (i * (fontHeight + 2)), color, shadow, new Matrix4f(matrix), vertexConsumers, layerType, backgroundColor, light);
|
||||
}
|
||||
cir.setReturnValue(offsetX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "draw(Lnet/minecraft/text/Text;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)I", at = @At("HEAD"), cancellable = true)
|
||||
public void allowNewLines_Text(Text text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumers, TextRenderer.TextLayerType layerType, int backgroundColor, int light, CallbackInfoReturnable<Integer> cir) {
|
||||
if (ProtocolHack.getTargetVersion() == VersionEnum.bedrockLatest) {
|
||||
final List<OrderedText> lines = wrapLines(text, Integer.MAX_VALUE);
|
||||
if (lines.size() > 1) {
|
||||
int offsetX = 0;
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
offsetX = this.draw(lines.get(i), x, y - (lines.size() * (fontHeight + 2)) + (i * (fontHeight + 2)), color, shadow, new Matrix4f(matrix), vertexConsumers, layerType, backgroundColor, light);
|
||||
}
|
||||
cir.setReturnValue(offsetX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getWidth(Lnet/minecraft/text/StringVisitable;)I", at = @At("HEAD"), cancellable = true)
|
||||
public void allowNewLines_getWidth(StringVisitable text, CallbackInfoReturnable<Integer> cir) {
|
||||
if (MinecraftClient.getInstance().world != null && ProtocolHack.getTargetVersion() == VersionEnum.bedrockLatest) {
|
||||
int i = 0;
|
||||
for (OrderedText wrapLine : this.wrapLines(text, Integer.MAX_VALUE)) {
|
||||
if (getWidth(wrapLine) >= i) i = getWidth(wrapLine);
|
||||
}
|
||||
cir.setReturnValue(MathHelper.ceil(i));
|
||||
}
|
||||
}
|
||||
}
|
@ -20,7 +20,6 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.ProfileKey;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.definition.bedrock.BedrockAccountHandler;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
|
||||
@ -39,7 +38,6 @@ import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.c2s.login.LoginHelloC2SPacket;
|
||||
import net.raphimc.mcauth.step.bedrock.StepMCChain;
|
||||
import net.raphimc.viabedrock.protocol.storage.AuthChainData;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@ -50,7 +48,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.UUID;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.gui.screen.ConnectScreen$1")
|
||||
public class MixinConnectScreen_1 {
|
||||
@ -99,12 +97,13 @@ public class MixinConnectScreen_1 {
|
||||
final VersionEnum targetVersion = ProtocolHack.getTargetVersion(connection.channel);
|
||||
|
||||
if (targetVersion == VersionEnum.bedrockLatest) {
|
||||
final StepMCChain.MCChain account = BedrockAccountHandler.INSTANCE.getAccount();
|
||||
final StepMCChain.MCChain account = BedrockAccountHandler.INSTANCE.getMcChain();
|
||||
if (account == null) return;
|
||||
final UUID deviceId = account.prevResult().initialXblSession().prevResult2().id();
|
||||
final String playFabId = BedrockAccountHandler.INSTANCE.getPlayFabToken().playFabId();
|
||||
|
||||
if (account != null) {
|
||||
userConnection.put(new AuthChainData(userConnection, account.mojangJwt(), account.identityJwt(), account.publicKey(), account.privateKey()));
|
||||
ViaFabricPlus.LOGGER.info("Created AuthChainData for Bedrock authentication!");
|
||||
}
|
||||
userConnection.put(new AuthChainData(userConnection, account.mojangJwt(), account.identityJwt(), account.publicKey(), account.privateKey(), deviceId, playFabId));
|
||||
ViaFabricPlus.LOGGER.info("Created AuthChainData for Bedrock authentication!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public abstract class MixinProtocolVersion {
|
||||
viafabricplus_remaps.put("1.16.4/5", new Pair<>("1.16.4-1.16.5", null));
|
||||
viafabricplus_remaps.put("1.18/1.18.1", new Pair<>("1.18-1.18.1", null));
|
||||
viafabricplus_remaps.put("1.19.1/2", new Pair<>("1.19.1-1.19.2", null));
|
||||
viafabricplus_remaps.put("1.20", new Pair<>("1.20-pre7", null));
|
||||
viafabricplus_remaps.put("1.20", new Pair<>("1.20-rc1", null));
|
||||
}
|
||||
|
||||
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(ILjava/lang/String;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;"))
|
||||
|
@ -33,7 +33,7 @@ public class PackFormatsMappings {
|
||||
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
|
||||
|
||||
public static void load() {
|
||||
registerVersion(VersionEnum.r1_20, 15, "1.20 Pre-release 7", "1.20-pre7");
|
||||
registerVersion(VersionEnum.r1_20, 15, "1.20 Release Candidate 1", "1.20-rc1");
|
||||
registerVersion(VersionEnum.r1_19_4, 13, "1.19.4");
|
||||
registerVersion(VersionEnum.r1_19_3, 12, "1.19.3");
|
||||
registerVersion(VersionEnum.r1_19_1tor1_19_2, 9, "1.19.2");
|
||||
|
@ -29,6 +29,7 @@ import de.florianmichael.viafabricplus.base.event.FinishViaVersionStartupCallbac
|
||||
import de.florianmichael.viafabricplus.protocolhack.command.ViaFabricPlusVLCommandHandler;
|
||||
import de.florianmichael.viafabricplus.protocolhack.impl.ViaFabricPlusVLInjector;
|
||||
import de.florianmichael.viafabricplus.protocolhack.impl.ViaFabricPlusVLLoader;
|
||||
import de.florianmichael.viafabricplus.protocolhack.impl.platform.ViaFabricPlusViaLegacyPlatformImpl;
|
||||
import de.florianmichael.viafabricplus.protocolhack.impl.platform.ViaFabricPlusViaVersionPlatformImpl;
|
||||
import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLLegacyPipeline;
|
||||
import io.netty.channel.*;
|
||||
@ -41,7 +42,6 @@ import net.raphimc.vialoader.ViaLoader;
|
||||
import net.raphimc.vialoader.impl.platform.ViaAprilFoolsPlatformImpl;
|
||||
import net.raphimc.vialoader.impl.platform.ViaBackwardsPlatformImpl;
|
||||
import net.raphimc.vialoader.impl.platform.ViaBedrockPlatformImpl;
|
||||
import net.raphimc.vialoader.impl.platform.ViaLegacyPlatformImpl;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
@ -117,7 +117,7 @@ public class ProtocolHack {
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
ViaLoader.init(new ViaFabricPlusViaVersionPlatformImpl(null), new ViaFabricPlusVLLoader(), new ViaFabricPlusVLInjector(), new ViaFabricPlusVLCommandHandler(), ViaBackwardsPlatformImpl::new, ViaLegacyPlatformImpl::new, ViaAprilFoolsPlatformImpl::new, ViaBedrockPlatformImpl::new);
|
||||
ViaLoader.init(new ViaFabricPlusViaVersionPlatformImpl(null), new ViaFabricPlusVLLoader(), new ViaFabricPlusVLInjector(), new ViaFabricPlusVLCommandHandler(), ViaBackwardsPlatformImpl::new, ViaFabricPlusViaLegacyPlatformImpl::new, ViaAprilFoolsPlatformImpl::new, ViaBedrockPlatformImpl::new);
|
||||
initCommands();
|
||||
|
||||
FinishViaVersionStartupCallback.EVENT.invoker().onFinishViaVersionStartup();
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.protocolhack.impl.platform;
|
||||
|
||||
import net.raphimc.vialoader.impl.platform.ViaLegacyPlatformImpl;
|
||||
|
||||
public class ViaFabricPlusViaLegacyPlatformImpl extends ViaLegacyPlatformImpl {
|
||||
|
||||
@Override
|
||||
public String getCpeAppName() {
|
||||
return "ViaFabricPlus";
|
||||
}
|
||||
}
|
@ -74,7 +74,7 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
for (BCVersion value : BCVersion.values()) {
|
||||
final List<BCServerInfo> servers = SERVER_LIST.serversOfVersion(value);
|
||||
if (servers.isEmpty()) continue;
|
||||
addEntry(new TitleRenderer(value.name()));
|
||||
addEntry(new TitleRenderer(Text.literal(value.name())));
|
||||
for (BCServerInfo server : servers) {
|
||||
addEntry(new ServerSlot(server));
|
||||
}
|
||||
|
@ -49,4 +49,4 @@
|
||||
"bedrocklogin.viafabricplus.error": "Ein Fehler ist aufgetreten! In der latest.log sind genauere Informationen;\bitte Melde den Fehler unter: \nhttps://github.com/FlorianMichael/ViaFabricPlus/issues",
|
||||
|
||||
"forceversion.viafabricplus.title": "Bitte wähle die Version, die beim Verbinden mit dem Server verwendet werden soll"
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,12 @@
|
||||
"words.viafabricplus.copy": "Copy code",
|
||||
"words.viafabricplus.error": "Something went wrong! Please try again later",
|
||||
|
||||
"settings.viafabricplus.authentication": "Authentication",
|
||||
"settings.viafabricplus.experimental": "Experimental",
|
||||
"settings.viafabricplus.visual": "Visual",
|
||||
"settings.viafabricplus.debug": "Debug",
|
||||
"settings.viafabricplus.general": "General",
|
||||
|
||||
"general.viafabricplus.secret": "Show Super Secret Settings",
|
||||
"general.viafabricplus.extrainformation": "Show extra information in Debug Hud",
|
||||
"general.viafabricplus.classicloading": "Show classic loading progress in connect screen",
|
||||
|
@ -12,7 +12,7 @@
|
||||
"words.viafabricplus.online": "Online Mód",
|
||||
"words.viafabricplus.reset": "Visszaállítás",
|
||||
"words.viafabricplus.copy": "Kód másolása",
|
||||
|
||||
|
||||
"general.viafabricplus.secret": "Super Secret Settings mutatása",
|
||||
"general.viafabricplus.extrainformation": "Extra információ mutatása a Debug HUD-ban",
|
||||
"general.viafabricplus.classicloading": "Klasszikus folyamatjelző mutatása a csatlakozási képernyőn",
|
||||
|
@ -69,4 +69,4 @@
|
||||
|
||||
"betacraft.viafabricplus.warning": "このボタンを押すと、API リクエストが\"betacraft.uk/serverlist\"に送信されます。",
|
||||
"betacraft.viafabricplus.error": "エラーが発生しました。 後でもう一度試してください。"
|
||||
}
|
||||
}
|
||||
|
@ -49,4 +49,4 @@
|
||||
"bedrocklogin.viafabricplus.error": "En Fehler ist opgetrieden! An der latest.log sin genauer Informatiounen;\n.e.g. Meld den Fehler enner: \nhttps://github.com/FloriUnMichael/ViaFabricPlus/issues",
|
||||
|
||||
"forceversion.viafabricplus.title": "W.e.g. wähl die Versioun, die bäim Verbannen mat dem Server benotzt ginn soll"
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,12 @@
|
||||
"words.viafabricplus.copy": "Kopiuj kod",
|
||||
"words.viafabricplus.error": "Coś poszło nie tak! Proszę, spróbuj ponownie później",
|
||||
|
||||
"settings.viafabricplus.authentication": "Uwierzytelnianie",
|
||||
"settings.viafabricplus.experimental": "Eksperymenty",
|
||||
"settings.viafabricplus.visual": "Wizualne",
|
||||
"settings.viafabricplus.debug": "Debugowanie",
|
||||
"settings.viafabricplus.general": "Ogólne",
|
||||
|
||||
"general.viafabricplus.secret": "Pokazuj Super Secret Settings",
|
||||
"general.viafabricplus.extrainformation": "Pokazuj dodatkowe informacje w interfejsie debugowania",
|
||||
"general.viafabricplus.classicloading": "Pokazuj klasyczny pasek ładowania w ekranie łączenia",
|
||||
|
@ -12,6 +12,13 @@
|
||||
"words.viafabricplus.online": "Лицензионный",
|
||||
"words.viafabricplus.reset": "Сброс",
|
||||
"words.viafabricplus.copy": "Копировать код",
|
||||
"words.viafabricplus.error": "Что-то пошло не так. Повторите попытку позже.",
|
||||
|
||||
"settings.viafabricplus.authentication": "Аутентификация",
|
||||
"settings.viafabricplus.experimental": "Экспериментальные",
|
||||
"settings.viafabricplus.visual": "Внешний вид",
|
||||
"settings.viafabricplus.debug": "Отладка",
|
||||
"settings.viafabricplus.general": "Основные",
|
||||
|
||||
"general.viafabricplus.secret": "Вернуть Super Secret Settings",
|
||||
"general.viafabricplus.extrainformation": "Показывать дополнительную информацию на экране отладки",
|
||||
@ -45,6 +52,7 @@
|
||||
"authentication.viafabricplus.spoof": "Имя пользователя ClassiCube при его использовании",
|
||||
"authentication.viafabricplus.skin": "Разрешить ViaLegacy загружать скины в старых версиях",
|
||||
"authentication.viafabricplus.bedrock": "Нажмите для настройки учётной записи Bedrock Edition",
|
||||
"authentication.viafabricplus.error": "Не удалось проверить вашу сессию. Войдите в свою учётную запись или отключите аутентификацию BetaCraft в настройках ViaFabricPlus.",
|
||||
|
||||
"visual.viafabricplus.secure": "Удалять уведомления о безопасности чата",
|
||||
"visual.viafabricplus.indicator": "Скрывать индикатор цифровой подписи в чате",
|
||||
@ -75,7 +83,6 @@
|
||||
"classicube.viafabricplus.warning": "Эта функция отправит запросы API к ClassiCube API.",
|
||||
|
||||
"betacraft.viafabricplus.warning": "Нажатие этой кнопки отправит запрос API к \"betacraft.uk/serverlist\".",
|
||||
"betacraft.viafabricplus.error": "Что-то пошло не так. Повторите попытку позже.",
|
||||
|
||||
"modmenu.summaryTranslation.viafabricplus": "Мод для подключения к серверам любых версий.",
|
||||
"modmenu.descriptionTranslation.viafabricplus": "Мод Fabric для подключения к серверам §lлюбых§r версий Minecraft (Classic, Alpha, Beta, снапшоты, релизы и даже Bedrock), содержащий приятные исправления для улучшения игрового процесса."
|
||||
|
@ -13,6 +13,12 @@
|
||||
"words.viafabricplus.reset": "Зкинути",
|
||||
"words.viafabricplus.copy": "Зкопіювати код",
|
||||
"words.viafabricplus.error": "Щось пішло не так! Спробуйте будь ласка пізніше",
|
||||
|
||||
"settings.viafabricplus.authentication": "Авторизація",
|
||||
"settings.viafabricplus.experimental": "Експериментальне",
|
||||
"settings.viafabricplus.visual": "Візуальне",
|
||||
"settings.viafabricplus.debug": "Дебаг",
|
||||
"settings.viafabricplus.general": "Загальне",
|
||||
|
||||
"general.viafabricplus.secret": "Показувати Супер Секретні Налаштування",
|
||||
"general.viafabricplus.extrainformation": "Показувати додаткову інформацію на екрані відладки",
|
||||
@ -46,6 +52,7 @@
|
||||
"authentication.viafabricplus.spoof": "Підмінити ім'я користувача на ім'я ClassiCube, якщо використовується ClassiCube",
|
||||
"authentication.viafabricplus.skin": "Дозволити ViaLegacy завантажувати скіни в старих версіх",
|
||||
"authentication.viafabricplus.bedrock": "Нажміть, щоб встановити аккаунт для Bedrock",
|
||||
"authentication.viafabricplus.error": "ViaFabricPlus не змогла підтвердити вашу сесію! Будь ласка ввійдіть у ваш аккаунт або вимкніть авторизацію BetaCraft у налаштуваннях ViaFabricPlus",
|
||||
|
||||
"visual.viafabricplus.secure": "Прибрати застереження чату",
|
||||
"visual.viafabricplus.indicator": "Сховати ідикатор підпису",
|
||||
@ -75,6 +82,5 @@
|
||||
|
||||
"classicube.viafabricplus.warning": "Ця фішка надішле API запит до ClassiCube API.",
|
||||
|
||||
"betacraft.viafabricplus.warning": "Нажимаючи цю кнопку ви надішлете API запит до \"betacraft.uk/serverlist\".",
|
||||
"betacraft.viafabricplus.error": "Щось пішло не так! Будь ласка, спробуйте знову пізніше"
|
||||
"betacraft.viafabricplus.warning": "Нажимаючи цю кнопку ви надішлете API запит до \"betacraft.uk/serverlist\"."
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
"fixes.minecraft.MixinProfileKeysImpl",
|
||||
"fixes.minecraft.MixinServerResourcePackProvider",
|
||||
"fixes.minecraft.MixinStringHelper",
|
||||
"fixes.minecraft.MixinTextRenderer",
|
||||
"fixes.minecraft.block.MixinAbstractBlock",
|
||||
"fixes.minecraft.block.MixinAbstractBlock_AbstractBlockState",
|
||||
"fixes.minecraft.block.MixinAnvilBlock",
|
||||
|
Loading…
Reference in New Issue
Block a user