mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-09-28 04:27:25 +02:00
Port to 1.20.2-rc1
This commit is contained in:
parent
7ea0500b24
commit
50e9952e64
@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# minecraft and fabric
|
||||
minecraft_version=1.20.1
|
||||
yarn_mappings=1.20.1+build.10
|
||||
minecraft_version=1.20.2-rc1
|
||||
yarn_mappings=1.20.2-rc1+build.2
|
||||
loader_version=0.14.22
|
||||
fabric_api_version=0.86.1+1.20.1
|
||||
fabric_api_version=0.88.5+1.20.2
|
||||
|
||||
# viafabricplus
|
||||
mod_version=2.8.7-SNAPSHOT
|
||||
|
@ -40,6 +40,9 @@ import org.apache.logging.log4j.Logger;
|
||||
import java.io.File;
|
||||
|
||||
/*
|
||||
* TODO | Port
|
||||
* - AllayEntity, VexEntity and BoatEntity height offsets are missing?
|
||||
*
|
||||
* TODO | General
|
||||
* - Check if relevant for protocol translation: TakeItemEntityPacket isEmpty case (1.20 -> 1.20.1 change)
|
||||
* - Window interactions in <= 1.16.5 has changed and can be detected by the server
|
||||
@ -56,7 +59,7 @@ import java.io.File;
|
||||
* - Blit-jump is not supported in <= 1.8.9 (https://github.com/ViaVersion/ViaFabricPlus/issues/225)
|
||||
*/
|
||||
public class ViaFabricPlus {
|
||||
public final static VersionEnum NATIVE_VERSION = VersionEnum.r1_20tor1_20_1;
|
||||
public final static VersionEnum NATIVE_VERSION = VersionEnum.r1_20_2;
|
||||
|
||||
public final static Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
public final static Logger LOGGER = LogManager.getLogger("ViaFabricPlus");
|
||||
|
@ -20,7 +20,6 @@ package de.florianmichael.viafabricplus.definition.screen;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.definition.screen.netminecraft.LegacySmithingScreenHandler;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreens;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
@ -45,17 +44,6 @@ public class CustomScreenHandler {
|
||||
}
|
||||
};
|
||||
|
||||
public final static Consumer<PacketByteBuf> LEGACY_SMITHING_HANDLER = data -> {
|
||||
final var byteBuf = data.asByteBuf();
|
||||
|
||||
try {
|
||||
CustomScreenHandler.openLegacySmithingScreen(Type.VAR_INT.readPrimitive(byteBuf), Type.COMPONENT.read(byteBuf));
|
||||
} catch (Exception e) {
|
||||
ViaFabricPlus.LOGGER.error("Failed to open legacy smithing table", e);
|
||||
}
|
||||
};
|
||||
|
||||
public final static ScreenHandlerType<LegacySmithingScreenHandler> LEGACY_SMITHING = new ScreenHandlerType<>(LegacySmithingScreenHandler::new, FeatureFlags.VANILLA_FEATURES);
|
||||
private final static Map<Integer, ScreenHandlerType<ScreenHandler>> TRIPLE_CHEST_HANDLERS = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
@ -65,10 +53,6 @@ public class CustomScreenHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void openLegacySmithingScreen(final int windowID, final JsonElement title) {
|
||||
HandledScreens.open(CustomScreenHandler.LEGACY_SMITHING, MinecraftClient.getInstance(), windowID, Text.Serializer.fromJson(title.toString()));
|
||||
}
|
||||
|
||||
public static void handleTripleChestHandler(final short windowID, final JsonElement title, final short slots) {
|
||||
int n = slots / 9;
|
||||
final int modulo = slots % 9;
|
||||
|
@ -1,102 +0,0 @@
|
||||
package de.florianmichael.viafabricplus.definition.screen.netminecraft;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.util.stream.Stream;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.recipe.ShapedRecipe;
|
||||
import net.minecraft.recipe.SmithingRecipe;
|
||||
import net.minecraft.registry.DynamicRegistryManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class LegacySmithingRecipe implements SmithingRecipe {
|
||||
public final static Serializer SERIALIZER = new Serializer();
|
||||
final Ingredient base;
|
||||
final Ingredient addition;
|
||||
final ItemStack result;
|
||||
private final Identifier id;
|
||||
|
||||
public LegacySmithingRecipe(Identifier id, Ingredient base, Ingredient addition, ItemStack result) {
|
||||
this.id = id;
|
||||
this.base = base;
|
||||
this.addition = addition;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public boolean matches(Inventory inventory, World world) {
|
||||
return this.base.test(inventory.getStack(0)) && this.addition.test(inventory.getStack(1));
|
||||
}
|
||||
|
||||
public ItemStack craft(Inventory inventory, DynamicRegistryManager registryManager) {
|
||||
ItemStack itemStack = this.result.copy();
|
||||
NbtCompound nbtCompound = inventory.getStack(0).getNbt();
|
||||
if (nbtCompound != null) {
|
||||
itemStack.setNbt(nbtCompound.copy());
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public boolean fits(int width, int height) {
|
||||
return width * height >= 2;
|
||||
}
|
||||
|
||||
public ItemStack getOutput(DynamicRegistryManager registryManager) {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public boolean testTemplate(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean testBase(ItemStack stack) {
|
||||
return this.base.test(stack);
|
||||
}
|
||||
|
||||
public boolean testAddition(ItemStack stack) {
|
||||
return this.addition.test(stack);
|
||||
}
|
||||
|
||||
public Identifier getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return SERIALIZER;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return Stream.of(this.base, this.addition).anyMatch((ingredient) -> ingredient.getMatchingStacks().length == 0);
|
||||
}
|
||||
|
||||
public static class Serializer implements RecipeSerializer<LegacySmithingRecipe> {
|
||||
public Serializer() {
|
||||
}
|
||||
|
||||
public LegacySmithingRecipe read(Identifier identifier, JsonObject jsonObject) {
|
||||
Ingredient ingredient = Ingredient.fromJson(JsonHelper.getObject(jsonObject, "base"));
|
||||
Ingredient ingredient2 = Ingredient.fromJson(JsonHelper.getObject(jsonObject, "addition"));
|
||||
ItemStack itemStack = ShapedRecipe.outputFromJson(JsonHelper.getObject(jsonObject, "result"));
|
||||
return new LegacySmithingRecipe(identifier, ingredient, ingredient2, itemStack);
|
||||
}
|
||||
|
||||
public LegacySmithingRecipe read(Identifier identifier, PacketByteBuf packetByteBuf) {
|
||||
Ingredient ingredient = Ingredient.fromPacket(packetByteBuf);
|
||||
Ingredient ingredient2 = Ingredient.fromPacket(packetByteBuf);
|
||||
ItemStack itemStack = packetByteBuf.readItemStack();
|
||||
return new LegacySmithingRecipe(identifier, ingredient, ingredient2, itemStack);
|
||||
}
|
||||
|
||||
public void write(PacketByteBuf packetByteBuf, LegacySmithingRecipe legacySmithingRecipe) {
|
||||
legacySmithingRecipe.base.write(packetByteBuf);
|
||||
legacySmithingRecipe.addition.write(packetByteBuf);
|
||||
packetByteBuf.writeItemStack(legacySmithingRecipe.result);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package de.florianmichael.viafabricplus.definition.screen.netminecraft;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ingame.ForgingScreen;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class LegacySmithingScreen extends ForgingScreen<LegacySmithingScreenHandler> {
|
||||
private static final Identifier TEXTURE = new Identifier("textures/gui/container/legacy_smithing.png");
|
||||
|
||||
public LegacySmithingScreen(LegacySmithingScreenHandler handler, PlayerInventory playerInventory, Text title) {
|
||||
super(handler, playerInventory, title, TEXTURE);
|
||||
this.titleX = 60;
|
||||
this.titleY = 18;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawInvalidRecipeArrow(DrawContext context, int x, int y) {
|
||||
if ((this.handler.getSlot(0).hasStack() || this.handler.getSlot(1).hasStack()) && !this.handler.getSlot(this.handler.getResultSlotIndex()).hasStack()) {
|
||||
context.drawTexture(TEXTURE, x + 99, y + 45, this.backgroundWidth, 0, 28, 21);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
package de.florianmichael.viafabricplus.definition.screen.netminecraft;
|
||||
|
||||
import de.florianmichael.viafabricplus.definition.screen.CustomScreenHandler;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
import net.minecraft.screen.ForgingScreenHandler;
|
||||
import net.minecraft.screen.ScreenHandlerContext;
|
||||
import net.minecraft.screen.slot.ForgingSlotsManager;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class LegacySmithingScreenHandler extends ForgingScreenHandler {
|
||||
private final World world;
|
||||
|
||||
@Nullable
|
||||
private LegacySmithingRecipe currentRecipe;
|
||||
private final List<LegacySmithingRecipe> recipes;
|
||||
|
||||
public LegacySmithingScreenHandler(int syncId, PlayerInventory playerInventory) {
|
||||
this(syncId, playerInventory, ScreenHandlerContext.EMPTY);
|
||||
}
|
||||
|
||||
public LegacySmithingScreenHandler(int syncId, PlayerInventory playerInventory, ScreenHandlerContext context) {
|
||||
super(CustomScreenHandler.LEGACY_SMITHING, syncId, playerInventory, context);
|
||||
this.world = playerInventory.player.getWorld();
|
||||
this.recipes = this.world.getRecipeManager().listAllOfType(RecipeType.SMITHING).stream().filter((recipe) -> {
|
||||
return recipe instanceof LegacySmithingRecipe;
|
||||
}).map((recipe) -> {
|
||||
return (LegacySmithingRecipe)recipe;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
protected ForgingSlotsManager getForgingSlotsManager() {
|
||||
return ForgingSlotsManager.create().input(0, 27, 47, (stack) -> {
|
||||
return true;
|
||||
}).input(1, 76, 47, (stack) -> {
|
||||
return true;
|
||||
}).output(2, 134, 47).build();
|
||||
}
|
||||
|
||||
protected boolean canUse(BlockState state) {
|
||||
return state.isOf(Blocks.SMITHING_TABLE);
|
||||
}
|
||||
|
||||
protected boolean canTakeOutput(PlayerEntity player, boolean present) {
|
||||
return this.currentRecipe != null && this.currentRecipe.matches(this.input, this.world);
|
||||
}
|
||||
|
||||
protected void onTakeOutput(PlayerEntity player, ItemStack stack) {
|
||||
stack.onCraft(player.getWorld(), player, stack.getCount());
|
||||
this.output.unlockLastRecipe(player, Collections.emptyList());
|
||||
this.decrementStack(0);
|
||||
this.decrementStack(1);
|
||||
this.context.run((world, pos) -> {
|
||||
world.syncWorldEvent(1044, pos, 0);
|
||||
});
|
||||
}
|
||||
|
||||
private void decrementStack(int slot) {
|
||||
ItemStack itemStack = this.input.getStack(slot);
|
||||
itemStack.decrement(1);
|
||||
this.input.setStack(slot, itemStack);
|
||||
}
|
||||
|
||||
public void updateResult() {
|
||||
List<LegacySmithingRecipe> list = this.world.getRecipeManager().getAllMatches(RecipeType.SMITHING, this.input, this.world).stream().filter((recipe) -> {
|
||||
return recipe instanceof LegacySmithingRecipe;
|
||||
}).map((recipe) -> {
|
||||
return (LegacySmithingRecipe)recipe;
|
||||
}).toList();
|
||||
if (list.isEmpty()) {
|
||||
this.output.setStack(0, ItemStack.EMPTY);
|
||||
} else {
|
||||
LegacySmithingRecipe legacySmithingRecipe = (LegacySmithingRecipe)list.get(0);
|
||||
ItemStack itemStack = legacySmithingRecipe.craft(this.input, this.world.getRegistryManager());
|
||||
if (itemStack.isItemEnabled(this.world.getEnabledFeatures())) {
|
||||
this.currentRecipe = legacySmithingRecipe;
|
||||
this.output.setLastRecipe(legacySmithingRecipe);
|
||||
this.output.setStack(0, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getSlotFor(ItemStack stack) {
|
||||
return this.testAddition(stack) ? 1 : 0;
|
||||
}
|
||||
|
||||
protected boolean testAddition(ItemStack stack) {
|
||||
return this.recipes.stream().anyMatch((recipe) -> {
|
||||
return recipe.testAddition(stack);
|
||||
});
|
||||
}
|
||||
|
||||
public boolean canInsertIntoSlot(ItemStack stack, Slot slot) {
|
||||
return slot.inventory != this.output && super.canInsertIntoSlot(stack, slot);
|
||||
}
|
||||
}
|
@ -83,12 +83,12 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/ClientConnection;)Lio/netty/channel/ChannelFuture;", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Lazy;get()Ljava/lang/Object;", shift = At.Shift.BEFORE), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private static void captureAddress(InetSocketAddress address, boolean useEpoll, ClientConnection connection, CallbackInfoReturnable<ChannelFuture> cir, Class class_, Lazy lazy) {
|
||||
@Inject(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/ClientConnection;)Lio/netty/channel/ChannelFuture;", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/Bootstrap;group(Lio/netty/channel/EventLoopGroup;)Lio/netty/bootstrap/AbstractBootstrap;", shift = At.Shift.BEFORE), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private static void captureAddress(InetSocketAddress address, boolean useEpoll, ClientConnection connection, CallbackInfoReturnable<ChannelFuture> cir, Class channelType, EventLoopGroup eventLoopGroup) {
|
||||
((IClientConnection) connection).viafabricplus_captureAddress(address);
|
||||
|
||||
if (ProtocolHack.getTargetVersion(address) == VersionEnum.bedrockLatest) {
|
||||
cir.setReturnValue(RakNetClientConnection.connectRakNet(connection, address, lazy, class_));
|
||||
cir.setReturnValue(RakNetClientConnection.connectRakNet(connection, address, eventLoopGroup, channelType));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ import java.util.Optional;
|
||||
@Mixin(MultiplayerServerListPinger.class)
|
||||
public class MixinMultiplayerServerListPinger {
|
||||
|
||||
@Inject(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/net/InetSocketAddress;Z)Lnet/minecraft/network/ClientConnection;"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
@Inject(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/profiler/PerformanceLog;)Lnet/minecraft/network/ClientConnection;"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void trackSessions(ServerInfo entry, Runnable saver, CallbackInfo ci, ServerAddress serverAddress, Optional optional, InetSocketAddress inetSocketAddress) {
|
||||
final VersionEnum version = ((IServerInfo) entry).viafabricplus_forcedVersion();
|
||||
|
||||
|
@ -17,8 +17,6 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import de.florianmichael.viafabricplus.definition.screen.netminecraft.LegacySmithingScreen;
|
||||
import de.florianmichael.viafabricplus.definition.screen.netminecraft.LegacySmithingScreenHandler;
|
||||
import de.florianmichael.viafabricplus.definition.screen.CustomScreenHandler;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
|
||||
@ -38,9 +36,6 @@ public class MixinHandledScreens {
|
||||
|
||||
@Inject(method = "getProvider", at = @At("HEAD"), cancellable = true)
|
||||
private static <T extends ScreenHandler> void returnFakeProvider(ScreenHandlerType<T> type, CallbackInfoReturnable<HandledScreens.@Nullable Provider> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_20tor1_20_1) && type == CustomScreenHandler.LEGACY_SMITHING) {
|
||||
cir.setReturnValue((handler, playerInventory, title) -> new LegacySmithingScreen((LegacySmithingScreenHandler) handler, playerInventory, title));
|
||||
}
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2) && CustomScreenHandler.isTripleChestHandler(type)) {
|
||||
cir.setReturnValue((handler, playerInventory, title) -> new GenericContainerScreen((GenericContainerScreenHandler) handler, playerInventory, title));
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public abstract class MixinInGameHud {
|
||||
return originalValue;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), slice = @Slice(
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 1,
|
||||
require = 0)
|
||||
@ -78,7 +78,7 @@ public abstract class MixinInGameHud {
|
||||
return old;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), slice = @Slice(
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 2,
|
||||
require = 0)
|
||||
@ -87,7 +87,7 @@ public abstract class MixinInGameHud {
|
||||
return old;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), slice = @Slice(
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1,
|
||||
require = 0)
|
||||
|
@ -20,7 +20,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
import com.mojang.authlib.yggdrasil.response.KeyPairResponse;
|
||||
import de.florianmichael.viafabricplus.injection.access.IKeyPairResponse;
|
||||
import de.florianmichael.viafabricplus.injection.access.IPublicKeyData;
|
||||
import net.minecraft.client.util.ProfileKeysImpl;
|
||||
import net.minecraft.client.session.ProfileKeysImpl;
|
||||
import net.minecraft.network.encryption.PlayerPublicKey;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -32,6 +32,6 @@ public class MixinProfileKeysImpl {
|
||||
|
||||
@Inject(method = "decodeKeyPairResponse", at = @At("RETURN"))
|
||||
private static void trackLegacyKey(KeyPairResponse keyPairResponse, CallbackInfoReturnable<PlayerPublicKey.PublicKeyData> cir) {
|
||||
((IPublicKeyData) (Object) cir.getReturnValue()).viafabricplus_setV1Key(((IKeyPairResponse) keyPairResponse).viafabricplus_getLegacyPublicKeySignature());
|
||||
((IPublicKeyData) (Object) cir.getReturnValue()).viafabricplus_setV1Key(((IKeyPairResponse) (Object) keyPairResponse).viafabricplus_getLegacyPublicKeySignature());
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(AllayEntity.class)
|
||||
public class MixinAllayEntity {
|
||||
|
||||
@Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
cir.setReturnValue(0.0);
|
||||
}
|
||||
}
|
||||
// @Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
// public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
// if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
// cir.setReturnValue(0.0);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -10,11 +10,11 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
@Mixin(BoatEntity.class)
|
||||
public class MixinBoatEntity {
|
||||
|
||||
@ModifyConstant(method = "getMountedHeightOffset", constant = @Constant(doubleValue = 0.25))
|
||||
public double modifyConstant(double constant) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
return 0.3;
|
||||
}
|
||||
return constant;
|
||||
}
|
||||
// @ModifyConstant(method = "getMountedHeightOffset", constant = @Constant(doubleValue = 0.25))
|
||||
// public double modifyConstant(double constant) {
|
||||
// if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
// return 0.3;
|
||||
// }
|
||||
// return constant;
|
||||
// }
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ public class MixinVexEntity extends HostileEntity {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
cir.setReturnValue(0.0);
|
||||
}
|
||||
}
|
||||
// @Inject(method = "getHeightOffset", at = @At("HEAD"), cancellable = true)
|
||||
// public void changeHeightOffset(CallbackInfoReturnable<Double> cir) {
|
||||
// if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
// cir.setReturnValue(0.0);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* 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.network;
|
||||
|
||||
import de.florianmichael.viafabricplus.definition.ClientsideFixes;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.listener.ServerPacketListener;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.s2c.common.CommonPingS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@Mixin(ClientCommonNetworkHandler.class)
|
||||
public abstract class MixinClientCommonNetworkHandler {
|
||||
|
||||
|
||||
@Shadow @Final protected MinecraftClient client;
|
||||
|
||||
@Shadow protected abstract void send(Packet<? extends ServerPacketListener> packet, BooleanSupplier sendCondition, Duration expiry);
|
||||
|
||||
@Shadow public abstract void sendPacket(Packet<?> packet);
|
||||
|
||||
@Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
private void onPing(CommonPingS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_17)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int inventoryId = (packet.getParameter() >> 16) & 0xFF; // Fix Via Bug from 1.16.5 (Window Confirmation -> PlayPing) Usage for MiningFast Detection
|
||||
ScreenHandler handler = null;
|
||||
|
||||
if (client.player == null) return;
|
||||
|
||||
if (inventoryId == 0) handler = client.player.playerScreenHandler;
|
||||
if (inventoryId == client.player.currentScreenHandler.syncId) handler = client.player.currentScreenHandler;
|
||||
|
||||
if (handler == null) ci.cancel();
|
||||
}
|
||||
|
||||
@Redirect(method = "onKeepAlive", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientCommonNetworkHandler;send(Lnet/minecraft/network/packet/Packet;Ljava/util/function/BooleanSupplier;Ljava/time/Duration;)V"))
|
||||
public void forceSendKeepAlive(ClientCommonNetworkHandler instance, Packet<? extends ServerPacketListener> packet, BooleanSupplier sendCondition, Duration expiry) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_3)) {
|
||||
sendPacket(packet);
|
||||
return;
|
||||
}
|
||||
send(packet, sendCondition, expiry);
|
||||
}
|
||||
|
||||
@Inject(method = "onCustomPayload(Lnet/minecraft/network/packet/s2c/common/CustomPayloadS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
public void handlePseudoPackets(CustomPayloadS2CPacket packet, CallbackInfo ci) {
|
||||
final var channel = packet.payload().id().toString();
|
||||
final var data = new PacketByteBuf(Unpooled.buffer());
|
||||
packet.payload().write(data);
|
||||
|
||||
if (channel.equals(ClientsideFixes.PACKET_SYNC_IDENTIFIER)) {
|
||||
final var uuid = data.readString();
|
||||
|
||||
if (ClientsideFixes.hasSyncTask(uuid)) {
|
||||
ClientsideFixes.getSyncTask(uuid).accept(data);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -15,29 +15,19 @@
|
||||
* 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;
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
|
||||
import de.florianmichael.viafabricplus.definition.ClientsideFixes;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.client.util.telemetry.WorldSession;
|
||||
import net.minecraft.client.network.*;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.listener.ServerPlayPacketListener;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.s2c.play.*;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@ -56,10 +46,6 @@ import java.util.function.BooleanSupplier;
|
||||
@Mixin(ClientPlayNetworkHandler.class)
|
||||
public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private MinecraftClient client;
|
||||
|
||||
@Shadow
|
||||
public abstract void onEntityStatus(EntityStatusS2CPacket packet);
|
||||
|
||||
@ -71,43 +57,18 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
@Shadow
|
||||
public abstract void onSimulationDistance(SimulationDistanceS2CPacket packet);
|
||||
|
||||
@Shadow
|
||||
protected abstract void sendPacket(Packet<ServerPlayPacketListener> packet, BooleanSupplier sendCondition, Duration expirationTime);
|
||||
|
||||
@Shadow
|
||||
public abstract void sendPacket(Packet<?> packet);
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private ClientConnection connection;
|
||||
|
||||
@Shadow
|
||||
private ClientWorld world;
|
||||
|
||||
@Shadow public abstract ClientConnection getConnection();
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
public void fixPlayerListOrdering(MinecraftClient client, Screen screen, ClientConnection connection, ServerInfo serverInfo, GameProfile profile, WorldSession worldSession, CallbackInfo ci) {
|
||||
public void fixPlayerListOrdering(MinecraftClient client, ClientConnection clientConnection, ClientConnectionState clientConnectionState, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
this.listedPlayerListEntries = new LinkedHashSet<>();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
private void onPing(PlayPingS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_17)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int inventoryId = (packet.getParameter() >> 16) & 0xFF; // Fix Via Bug from 1.16.5 (Window Confirmation -> PlayPing) Usage for MiningFast Detection
|
||||
ScreenHandler handler = null;
|
||||
|
||||
if (client.player == null) return;
|
||||
|
||||
if (inventoryId == 0) handler = client.player.playerScreenHandler;
|
||||
if (inventoryId == client.player.currentScreenHandler.syncId) handler = client.player.currentScreenHandler;
|
||||
|
||||
if (handler == null) ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "onChunkLoadDistance", at = @At("RETURN"))
|
||||
public void emulateSimulationDistance(ChunkLoadDistanceS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_17_1)) {
|
||||
@ -136,29 +97,20 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("InvalidInjectorMethodSignature")
|
||||
@ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class))
|
||||
public Class<?> dontChangePlayerYaw(Object entity, Class<?> constant) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18_2)) {
|
||||
return Integer.class;
|
||||
}
|
||||
return constant;
|
||||
}
|
||||
// @SuppressWarnings("InvalidInjectorMethodSignature")
|
||||
// @ModifyConstant(method = "onEntityPassengersSet", constant = @Constant(classValue = BoatEntity.class))
|
||||
// public Class<?> dontChangePlayerYaw(Object entity, Class<?> constant) {
|
||||
// if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18_2)) {
|
||||
// return Integer.class;
|
||||
// }
|
||||
// return constant;
|
||||
// }
|
||||
|
||||
@WrapWithCondition(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
|
||||
public boolean removeWarning(Logger instance, String s, Object o) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19_3);
|
||||
}
|
||||
|
||||
@Redirect(method = "onKeepAlive", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;Ljava/util/function/BooleanSupplier;Ljava/time/Duration;)V"))
|
||||
public void forceSendKeepAlive(ClientPlayNetworkHandler instance, Packet<ServerPlayPacketListener> packet, BooleanSupplier sendCondition, Duration expirationTime) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_3)) {
|
||||
sendPacket(packet);
|
||||
return;
|
||||
}
|
||||
sendPacket(packet, sendCondition, expirationTime);
|
||||
}
|
||||
|
||||
@Redirect(method = "onServerMetadata", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ServerMetadataS2CPacket;isSecureChatEnforced()Z"))
|
||||
public boolean removeSecureChatWarning(ServerMetadataS2CPacket instance) {
|
||||
return instance.isSecureChatEnforced() || VisualSettings.INSTANCE.disableSecureChatWarning.isEnabled();
|
||||
@ -166,24 +118,9 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
|
||||
@Inject(method = "onSetTradeOffers", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
public void checkLoginPacket(SetTradeOffersS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion(connection.channel).isOlderThanOrEqualTo(VersionEnum.r1_13_2) && this.client.player == null) {
|
||||
if (ProtocolHack.getTargetVersion(getConnection().channel).isOlderThanOrEqualTo(VersionEnum.r1_13_2) && MinecraftClient.getInstance().player == null) {
|
||||
ViaFabricPlus.LOGGER.error("Server tried to send Play packet in Login process, dropping \"SetTradeOffers\"");
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onCustomPayload", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
public void handlePseudoPackets(CustomPayloadS2CPacket packet, CallbackInfo ci) {
|
||||
final var channel = packet.getChannel().toString();
|
||||
final var data = packet.getData();
|
||||
|
||||
if (channel.equals(ClientsideFixes.PACKET_SYNC_IDENTIFIER)) {
|
||||
final var uuid = data.readString();
|
||||
|
||||
if (ClientsideFixes.hasSyncTask(uuid)) {
|
||||
ClientsideFixes.getSyncTask(uuid).accept(data);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -18,9 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.packet;
|
||||
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.player.PlayerAbilities;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
@ -32,8 +30,8 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@Mixin(UpdatePlayerAbilitiesC2SPacket.class)
|
||||
public class MixinUpdatePlayerAbilitiesC2SPacket {
|
||||
|
||||
@Redirect(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketByteBuf;writeByte(I)Lio/netty/buffer/ByteBuf;"))
|
||||
public ByteBuf implementFlags(PacketByteBuf instance, int value) {
|
||||
@Redirect(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketByteBuf;writeByte(I)Lnet/minecraft/network/PacketByteBuf;"))
|
||||
public PacketByteBuf implementFlags(PacketByteBuf instance, int value) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_2)) {
|
||||
final PlayerAbilities playerAbilities = MinecraftClient.getInstance().player.getAbilities();
|
||||
|
||||
|
@ -79,16 +79,16 @@ public class MixinConnectScreen_1 {
|
||||
return instance.getPort();
|
||||
}
|
||||
|
||||
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;send(Lnet/minecraft/network/packet/Packet;)V", ordinal = 1))
|
||||
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;send(Lnet/minecraft/network/packet/Packet;)V"))
|
||||
public void spoofUserName(ClientConnection instance, Packet<?> packet) {
|
||||
if (AuthenticationSettings.INSTANCE.spoofUserNameIfUsingClassiCube.getValue() && ViaFabricPlusClassicMPPassProvider.classiCubeMPPass != null && ClassiCubeAccountHandler.INSTANCE.getAccount() != null) {
|
||||
instance.send(new LoginHelloC2SPacket(ClassiCubeAccountHandler.INSTANCE.getAccount().username(), Optional.ofNullable(MinecraftClient.getInstance().getSession().getUuidOrNull())));
|
||||
instance.send(new LoginHelloC2SPacket(ClassiCubeAccountHandler.INSTANCE.getAccount().username(), MinecraftClient.getInstance().getSession().getUuidOrNull()));
|
||||
return;
|
||||
}
|
||||
instance.send(packet);
|
||||
}
|
||||
|
||||
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;send(Lnet/minecraft/network/packet/Packet;)V", ordinal = 1, shift = At.Shift.BEFORE))
|
||||
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;send(Lnet/minecraft/network/packet/Packet;)V", shift = At.Shift.BEFORE))
|
||||
public void setupConnectionSessions(CallbackInfo ci) {
|
||||
final ClientConnection connection = field_2416.connection;
|
||||
if (connection == null || connection.channel == null) return;
|
||||
|
@ -17,13 +17,12 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
|
||||
|
||||
import net.minecraft.network.packet.c2s.common.KeepAliveC2SPacket;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.network.packet.c2s.play.KeepAliveC2SPacket;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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.viaversion.protocol1_20to1_19_4;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ServerboundPackets1_19_4;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20to1_19_4.Protocol1_20To1_19_4;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20to1_19_4.packets.InventoryPackets;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import de.florianmichael.viafabricplus.definition.ClientsideFixes;
|
||||
import de.florianmichael.viafabricplus.definition.screen.CustomScreenHandler;
|
||||
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;
|
||||
|
||||
@Mixin(value = InventoryPackets.class, remap = false)
|
||||
public class MixinInventoryPackets extends ItemRewriter<ClientboundPackets1_19_4, ServerboundPackets1_19_4, Protocol1_20To1_19_4> {
|
||||
|
||||
public MixinInventoryPackets(Protocol1_20To1_19_4 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Inject(method = "registerPackets", at = @At("RETURN"))
|
||||
public void handleLegacySmithingScreen(CallbackInfo ci) {
|
||||
protocol.registerClientbound(ClientboundPackets1_19_4.OPEN_WINDOW, ClientboundPackets1_19_4.OPEN_WINDOW, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
map(Type.VAR_INT); // Window ID
|
||||
map(Type.VAR_INT); // Type ID
|
||||
map(Type.COMPONENT); // Title
|
||||
|
||||
handler(wrapper -> {
|
||||
final var windowId = wrapper.get(Type.VAR_INT, 0);
|
||||
final var typeId = wrapper.get(Type.VAR_INT, 1);
|
||||
final var title = wrapper.get(Type.COMPONENT, 0);
|
||||
|
||||
if (typeId == 20) {
|
||||
wrapper.clearPacket();
|
||||
wrapper.setPacketType(ClientboundPackets1_19_4.PLUGIN_MESSAGE);
|
||||
|
||||
wrapper.write(Type.STRING, ClientsideFixes.PACKET_SYNC_IDENTIFIER);
|
||||
wrapper.write(Type.STRING, ClientsideFixes.executeSyncTask(CustomScreenHandler.LEGACY_SMITHING_HANDLER));
|
||||
wrapper.write(Type.VAR_INT, windowId);
|
||||
wrapper.write(Type.COMPONENT, title);
|
||||
} else {
|
||||
final var mappedId = protocol.getMappingData().getMenuMappings().getNewId(typeId);
|
||||
if (mappedId == -1) {
|
||||
wrapper.cancel();
|
||||
} else {
|
||||
wrapper.set(Type.VAR_INT, 1, mappedId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ public class Classic4JImpl {
|
||||
final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
try {
|
||||
mc.getSessionService().joinServer(mc.getSession().getProfile(), mc.getSession().getAccessToken(), serverId);
|
||||
mc.getSessionService().joinServer(mc.getSession().getUuidOrNull(), mc.getSession().getAccessToken(), serverId);
|
||||
} catch (AuthenticationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class PackFormatsMappings {
|
||||
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
|
||||
|
||||
public static void load() {
|
||||
registerVersion(VersionEnum.r1_20_2, 18, "1.20.2 Release Candidate 1", "1.20.2-rc1");
|
||||
registerVersion(VersionEnum.r1_20tor1_20_1, 15, "1.20.1"); // 1.20 and 1.20.1 are the same, why care...
|
||||
registerVersion(VersionEnum.r1_19_4, 13, "1.19.4");
|
||||
registerVersion(VersionEnum.r1_19_3, 12, "1.19.3");
|
||||
@ -81,6 +82,8 @@ public class PackFormatsMappings {
|
||||
}
|
||||
|
||||
final GameVersion gameVersion = protocolMap.get(nativeVersion);
|
||||
System.out.println(SharedConstants.getGameVersion().getName() + " " + gameVersion.getName());
|
||||
System.out.println(SharedConstants.getGameVersion().getId() + " " + gameVersion.getId());
|
||||
if (!gameVersion.getName().equals(SharedConstants.getGameVersion().getName()) || !gameVersion.getId().equals(SharedConstants.getGameVersion().getId()) || gameVersion.getResourceVersion(ResourceType.CLIENT_RESOURCES) != SharedConstants.getGameVersion().getResourceVersion(ResourceType.CLIENT_RESOURCES)) {
|
||||
throw new RuntimeException("The current version has no pack format registered");
|
||||
}
|
||||
|
@ -26,7 +26,9 @@ import io.netty.channel.socket.nio.NioDatagramChannel;
|
||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.NetworkSide;
|
||||
import net.minecraft.network.handler.PacketSizeLogger;
|
||||
import net.minecraft.util.Lazy;
|
||||
import net.minecraft.util.profiler.PerformanceLog;
|
||||
import org.cloudburstmc.netty.channel.raknet.RakChannelFactory;
|
||||
import org.cloudburstmc.netty.channel.raknet.config.RakChannelOption;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -39,8 +41,8 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
public class RakNetClientConnection {
|
||||
private final static List<InetSocketAddress> rakNetPingSessions = new ArrayList<>();
|
||||
|
||||
public static ChannelFuture connectRakNet(final ClientConnection clientConnection, final InetSocketAddress address, final Lazy lazy, final Class channelType) {
|
||||
final Bootstrap nettyBoostrap = new Bootstrap().group((EventLoopGroup) lazy.get()).handler(new ChannelInitializer<>() {
|
||||
public static ChannelFuture connectRakNet(final ClientConnection clientConnection, final InetSocketAddress address, final EventLoopGroup eventLoopGroup, final Class channelType) {
|
||||
final Bootstrap nettyBoostrap = new Bootstrap().group(eventLoopGroup).handler(new ChannelInitializer<>() {
|
||||
@Override
|
||||
protected void initChannel(@NotNull Channel channel) {
|
||||
try {
|
||||
@ -51,7 +53,7 @@ public class RakNetClientConnection {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
ChannelPipeline channelPipeline = channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30));
|
||||
ClientConnection.addHandlers(channelPipeline, NetworkSide.CLIENTBOUND);
|
||||
ClientConnection.addHandlers(channelPipeline, NetworkSide.CLIENTBOUND, clientConnection.packetSizeLogger);
|
||||
|
||||
channelPipeline.addLast("packet_handler", clientConnection);
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class ViaFabricPlusTransferProvider extends TransferProvider {
|
||||
final var mc = MinecraftClient.getInstance();
|
||||
mc.world.disconnect();
|
||||
|
||||
final var serverInfo = new ServerInfo(newAddress.getHostName(), newAddress.getHostName() + ":" + newAddress.getPort(), false);
|
||||
final var serverInfo = new ServerInfo(newAddress.getHostName(), newAddress.getHostName() + ":" + newAddress.getPort(), ServerInfo.ServerType.OTHER);
|
||||
ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), mc, ServerAddress.parse(serverInfo.address), serverInfo, false);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.protocolhack.provider.vialegacy;
|
||||
|
||||
import com.mojang.authlib.Agent;
|
||||
import com.mojang.authlib.GameProfileRepository;
|
||||
import com.mojang.authlib.HttpAuthenticationService;
|
||||
import com.mojang.authlib.ProfileLookupCallback;
|
||||
@ -33,21 +32,21 @@ import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ViaFabricPlusGameProfileFetcher extends GameProfileFetcher {
|
||||
public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString());
|
||||
public final static HttpAuthenticationService AUTHENTICATION_SERVICE = new YggdrasilAuthenticationService(Proxy.NO_PROXY);
|
||||
public final static MinecraftSessionService SESSION_SERVICE = AUTHENTICATION_SERVICE.createMinecraftSessionService();
|
||||
public final static GameProfileRepository GAME_PROFILE_REPOSITORY = AUTHENTICATION_SERVICE.createProfileRepository();
|
||||
|
||||
@Override
|
||||
public UUID loadMojangUUID(String playerName) throws Exception {
|
||||
final CompletableFuture<com.mojang.authlib.GameProfile> future = new CompletableFuture<>();
|
||||
GAME_PROFILE_REPOSITORY.findProfilesByNames(new String[]{playerName}, Agent.MINECRAFT, new ProfileLookupCallback() {
|
||||
GAME_PROFILE_REPOSITORY.findProfilesByNames(new String[]{playerName}, new ProfileLookupCallback() {
|
||||
@Override
|
||||
public void onProfileLookupSucceeded(com.mojang.authlib.GameProfile profile) {
|
||||
future.complete(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileLookupFailed(com.mojang.authlib.GameProfile profile, Exception exception) {
|
||||
public void onProfileLookupFailed(String profileName, Exception exception) {
|
||||
future.completeExceptionally(exception);
|
||||
}
|
||||
});
|
||||
@ -59,14 +58,15 @@ public class ViaFabricPlusGameProfileFetcher extends GameProfileFetcher {
|
||||
|
||||
@Override
|
||||
public GameProfile loadGameProfile(UUID uuid) throws Exception {
|
||||
final com.mojang.authlib.GameProfile inProfile = new com.mojang.authlib.GameProfile(uuid, null);
|
||||
final com.mojang.authlib.GameProfile mojangProfile = SESSION_SERVICE.fillProfileProperties(inProfile, true);
|
||||
if (mojangProfile.equals(inProfile)) throw new ProfileNotFoundException();
|
||||
final var result = SESSION_SERVICE.fetchProfile(uuid, true);
|
||||
if (result == null) throw new ProfileNotFoundException();
|
||||
|
||||
final GameProfile gameProfile = new GameProfile(mojangProfile.getName(), mojangProfile.getId());
|
||||
for (final var entry : mojangProfile.getProperties().entries()) {
|
||||
final var profile = result.profile();
|
||||
final var gameProfile = new GameProfile(profile.getName(), profile.getId());
|
||||
|
||||
for (final var entry : profile.getProperties().entries()) {
|
||||
final Property prop = entry.getValue();
|
||||
gameProfile.addProperty(new GameProfile.Property(prop.getName(), prop.getValue(), prop.getSignature()));
|
||||
gameProfile.addProperty(new GameProfile.Property(prop.name(), prop.value(), prop.signature()));
|
||||
}
|
||||
return gameProfile;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class ViaFabricPlusOldAuthProvider extends OldAuthProvider {
|
||||
try {
|
||||
final var mc = MinecraftClient.getInstance();
|
||||
|
||||
mc.getSessionService().joinServer(mc.getSession().getProfile(), mc.getSession().getAccessToken(), serverId);
|
||||
mc.getSessionService().joinServer(mc.getSession().getUuidOrNull(), mc.getSession().getAccessToken(), serverId);
|
||||
} catch (Exception e) {
|
||||
ViaFabricPlus.LOGGER.error("Error occurred while calling join server to verify session", e);
|
||||
|
||||
|
@ -31,16 +31,20 @@ import io.netty.channel.epoll.Epoll;
|
||||
import io.netty.channel.epoll.EpollSocketChannel;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.NetworkSide;
|
||||
import net.minecraft.network.NetworkState;
|
||||
import net.minecraft.network.handler.PacketSizeLogger;
|
||||
import net.minecraft.network.listener.ClientQueryPacketListener;
|
||||
import net.minecraft.network.packet.c2s.handshake.ConnectionIntent;
|
||||
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.query.QueryRequestC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.query.QueryPongS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.query.PingResultS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.query.QueryResponseS2CPacket;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.profiler.PerformanceLog;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -70,7 +74,7 @@ public class ViaFabricPlusBaseVersionProvider extends BaseVersionProvider {
|
||||
}
|
||||
|
||||
ChannelPipeline channelPipeline = channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30));
|
||||
ClientConnection.addHandlers(channelPipeline, NetworkSide.CLIENTBOUND);
|
||||
ClientConnection.addHandlers(channelPipeline, NetworkSide.CLIENTBOUND, new PacketSizeLogger(new PerformanceLog()));
|
||||
channelPipeline.addLast("packet_handler", clientConnection);
|
||||
}
|
||||
}).channel(useEpoll ? EpollSocketChannel.class : NioSocketChannel.class).connect(address);
|
||||
@ -79,40 +83,36 @@ public class ViaFabricPlusBaseVersionProvider extends BaseVersionProvider {
|
||||
if (!future1.isSuccess()) {
|
||||
future.completeExceptionally(future1.cause());
|
||||
} else {
|
||||
channelFuture.channel().eventLoop().execute(() -> { // needs to execute after channel init
|
||||
clientConnection.setPacketListener(new ClientQueryPacketListener() {
|
||||
@Override
|
||||
public void onResponse(QueryResponseS2CPacket packet) {
|
||||
if (packet.metadata() != null && packet.metadata().version().isPresent()) {
|
||||
final VersionEnum version = VersionEnum.fromProtocolId(packet.metadata().version().get().protocolVersion());
|
||||
future.complete(version);
|
||||
clientConnection.connect(address.getHostString(), address.getPort(), new ClientQueryPacketListener() {
|
||||
@Override
|
||||
public void onResponse(QueryResponseS2CPacket packet) {
|
||||
if (packet.metadata() != null && packet.metadata().version().isPresent()) {
|
||||
final VersionEnum version = VersionEnum.fromProtocolId(packet.metadata().version().get().protocolVersion());
|
||||
future.complete(version);
|
||||
|
||||
ViaFabricPlus.LOGGER.info("Auto-detected " + version + " for " + address);
|
||||
} else {
|
||||
future.completeExceptionally(new IllegalArgumentException("Null version in query response"));
|
||||
}
|
||||
clientConnection.disconnect(Text.empty());
|
||||
ViaFabricPlus.LOGGER.info("Auto-detected " + version + " for " + address);
|
||||
} else {
|
||||
future.completeExceptionally(new IllegalArgumentException("Null version in query response"));
|
||||
}
|
||||
clientConnection.disconnect(Text.empty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPong(QueryPongS2CPacket packet) {
|
||||
clientConnection.disconnect(Text.literal("Pong not requested!"));
|
||||
}
|
||||
@Override
|
||||
public void onPingResult(PingResultS2CPacket packet) {
|
||||
clientConnection.disconnect(Text.literal("Ping not requested!"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected(Text reason) {
|
||||
future.completeExceptionally(new IllegalStateException(reason.getString()));
|
||||
}
|
||||
@Override
|
||||
public void onDisconnected(Text reason) {
|
||||
future.completeExceptionally(new IllegalStateException(reason.getString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnectionOpen() {
|
||||
return channelFuture.channel().isOpen();
|
||||
}
|
||||
});
|
||||
|
||||
clientConnection.send(new HandshakeC2SPacket(address.getHostString(), address.getPort(), NetworkState.STATUS));
|
||||
clientConnection.send(new QueryRequestC2SPacket());
|
||||
@Override
|
||||
public boolean isConnectionOpen() {
|
||||
return channelFuture.channel().isOpen();
|
||||
}
|
||||
});
|
||||
clientConnection.send(new QueryRequestC2SPacket());
|
||||
}
|
||||
});
|
||||
} catch (Throwable throwable) { // You never know...
|
||||
|
@ -55,7 +55,7 @@ public class ItemTranslator {
|
||||
final var emptyBuf = new PacketByteBuf(Unpooled.buffer());
|
||||
dummyPacket.write(emptyBuf);
|
||||
|
||||
final int id = NetworkState.PLAY.getPacketId(NetworkSide.SERVERBOUND, dummyPacket);
|
||||
final int id = NetworkState.PLAY.getHandler(NetworkSide.SERVERBOUND).getId(dummyPacket);
|
||||
|
||||
try {
|
||||
final var wrapper = new PacketWrapperImpl(id, emptyBuf, DUMMY_USER_CONNECTION);
|
||||
|
@ -49,7 +49,7 @@ public class ForceVersionScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.renderBackground(context, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
this.renderTitle(context, Text.translatable("forceversion.viafabricplus.title"));
|
||||
|
@ -99,7 +99,7 @@ public class ProtocolSelectionScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.renderBackground(context, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
this.renderTitle(context);
|
||||
|
@ -43,7 +43,7 @@ public class SettingsScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.renderBackground(context, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
this.renderTitle(context);
|
||||
|
@ -60,7 +60,7 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.renderBackground(context, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
this.renderTitle(context);
|
||||
@ -108,7 +108,7 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
@Override
|
||||
public void mappedMouseClicked(double mouseX, double mouseY, int button) {
|
||||
final ServerAddress serverAddress = ServerAddress.parse(server.host() + ":" + server.port());
|
||||
final ServerInfo entry = new ServerInfo(server.name(), serverAddress.getAddress(), false);
|
||||
final ServerInfo entry = new ServerInfo(server.name(), serverAddress.getAddress(), ServerInfo.ServerType.OTHER);
|
||||
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false);
|
||||
super.mappedMouseClicked(mouseX, mouseY, button);
|
||||
|
@ -90,14 +90,6 @@ public class ClassiCubeLoginScreen extends VFPScreen {
|
||||
}).position(width / 2 - 75, passwordField.getY() + (20 * 4) + 5).size(150, 20).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
nameField.tick();
|
||||
passwordField.tick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
ClassiCubeAccountHandler.INSTANCE.setAccount(null);
|
||||
@ -106,7 +98,8 @@ public class ClassiCubeLoginScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.renderBackground(context, mouseX, mouseY, delta);
|
||||
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.width / 2, 70, 16777215);
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, this.status, this.width / 2, 1, 16777215);
|
||||
|
||||
|
@ -80,13 +80,6 @@ public class ClassiCubeMFAScreen extends VFPScreen {
|
||||
}).position(width / 2 - 75, mfaField.getY() + (20 * 4) + 5).size(150, 20).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
mfaField.tick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
ClassiCubeAccountHandler.INSTANCE.setAccount(null);
|
||||
@ -95,7 +88,7 @@ public class ClassiCubeMFAScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.renderBackground(context, mouseX, mouseY, delta);
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.width / 2, 70, 16777215);
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, this.status, this.width / 2, 1, 16777215);
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.renderBackground(context, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
final CCAccount account = ClassiCubeAccountHandler.INSTANCE.getAccount();
|
||||
@ -124,7 +124,7 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
@Override
|
||||
public void mappedMouseClicked(double mouseX, double mouseY, int button) {
|
||||
final ServerAddress serverAddress = ServerAddress.parse(classiCubeServerInfo.ip() + ":" + classiCubeServerInfo.port());
|
||||
final ServerInfo entry = new ServerInfo(classiCubeServerInfo.name(), serverAddress.getAddress(), false);
|
||||
final ServerInfo entry = new ServerInfo(classiCubeServerInfo.name(), serverAddress.getAddress(), ServerInfo.ServerType.OTHER);
|
||||
ViaFabricPlusClassicMPPassProvider.classiCubeMPPass = classiCubeServerInfo.mpPass();
|
||||
|
||||
if (AuthenticationSettings.INSTANCE.forceCPEIfUsingClassiCube.getValue()) {
|
||||
|
@ -8,11 +8,10 @@ accessible field net/minecraft/client/network/ServerAddress INVALID Lnet/minecra
|
||||
accessible field net/minecraft/client/network/ServerAddress hostAndPort Lcom/google/common/net/HostAndPort;
|
||||
accessible field net/minecraft/client/MinecraftClient fontManager Lnet/minecraft/client/font/FontManager;
|
||||
accessible field net/minecraft/client/font/FontManager fontStorages Ljava/util/Map;
|
||||
accessible field net/minecraft/network/ClientConnection EPOLL_CLIENT_IO_GROUP Lnet/minecraft/util/Lazy;
|
||||
accessible field net/minecraft/network/ClientConnection LOCAL_CLIENT_IO_GROUP Lnet/minecraft/util/Lazy;
|
||||
accessible field net/minecraft/client/gui/screen/GameMenuScreen exitButton Lnet/minecraft/client/gui/widget/ButtonWidget;
|
||||
accessible field net/minecraft/client/font/FontStorage$GlyphPair MISSING Lnet/minecraft/client/font/FontStorage$GlyphPair;
|
||||
accessible field net/minecraft/client/network/AllowedAddressResolver addressResolver Lnet/minecraft/client/network/AddressResolver;
|
||||
accessible field net/minecraft/network/ClientConnection packetSizeLogger Lnet/minecraft/network/handler/PacketSizeLogger;
|
||||
|
||||
accessible method net/minecraft/screen/GenericContainerScreenHandler <init> (Lnet/minecraft/screen/ScreenHandlerType;ILnet/minecraft/entity/player/PlayerInventory;I)V
|
||||
accessible method net/minecraft/client/font/FontStorage$GlyphPair <init> (Lnet/minecraft/client/font/Glyph;Lnet/minecraft/client/font/Glyph;)V
|
||||
|
@ -25,7 +25,7 @@
|
||||
"fixes.minecraft.MixinBipedEntityModel",
|
||||
"fixes.minecraft.MixinCamera",
|
||||
"fixes.minecraft.MixinClientPlayerInteractionManager",
|
||||
"fixes.minecraft.MixinClientPlayNetworkHandler",
|
||||
"fixes.minecraft.network.MixinClientPlayNetworkHandler",
|
||||
"fixes.minecraft.MixinDrawContext",
|
||||
"fixes.minecraft.MixinFontStorage",
|
||||
"fixes.minecraft.MixinHandledScreens",
|
||||
@ -108,6 +108,7 @@
|
||||
"fixes.minecraft.item.MixinPickaxeItem",
|
||||
"fixes.minecraft.item.MixinShovelItem",
|
||||
"fixes.minecraft.item.MixinSwordItem",
|
||||
"fixes.minecraft.network.MixinClientCommonNetworkHandler",
|
||||
"fixes.minecraft.packet.MixinChatMessageC2SPacket",
|
||||
"fixes.minecraft.packet.MixinPacketByteBuf",
|
||||
"fixes.minecraft.packet.MixinUpdatePlayerAbilitiesC2SPacket",
|
||||
@ -158,7 +159,6 @@
|
||||
"fixes.viaversion.protocol1_19_1to1_19.MixinProtocol1_19_1To1_19",
|
||||
"fixes.viaversion.protocol1_19_3to1_19_1.MixinProtocol1_19_3To1_19_1",
|
||||
"fixes.viaversion.protocol1_19to1_18_2.MixinWorldPackets",
|
||||
"fixes.viaversion.protocol1_20to1_19_4.MixinInventoryPackets",
|
||||
"fixes.viaversion.protocol1_9_1to1_9.MixinProtocol1_9_1To1_9",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinChunk1_8Type",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinCommandBlockProvider",
|
||||
|
Loading…
Reference in New Issue
Block a user