mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
It compiles ™️
This commit is contained in:
parent
0e5f786c77
commit
792420cfd0
@ -1114,7 +1114,7 @@ public class ItemRegistryDiff {
|
||||
ITEM_DIFF.put(SHEARS, andNewer(b1_7tob1_7_3));
|
||||
|
||||
ITEM_DIFF.put(DEAD_BUSH, andNewer(b1_6tob1_6_6));
|
||||
ITEM_DIFF.put(GRASS, andNewer(b1_6tob1_6_6));
|
||||
ITEM_DIFF.put(SHORT_GRASS, andNewer(b1_6tob1_6_6));
|
||||
ITEM_DIFF.put(FERN, andNewer(b1_6tob1_6_6));
|
||||
ITEM_DIFF.put(OAK_TRAPDOOR, andNewer(b1_6tob1_6_6));
|
||||
ITEM_DIFF.put(MAP, andNewer(b1_6tob1_6_6));
|
||||
|
@ -207,7 +207,7 @@ public record Material1_19_4(boolean blocksMovement, boolean burnable, boolean l
|
||||
MATERIALS.put(Blocks.DETECTOR_RAIL, DECORATION);
|
||||
MATERIALS.put(Blocks.STICKY_PISTON, PISTON);
|
||||
MATERIALS.put(Blocks.COBWEB, COBWEB);
|
||||
MATERIALS.put(Blocks.GRASS, REPLACEABLE_PLANT);
|
||||
MATERIALS.put(Blocks.SHORT_GRASS, REPLACEABLE_PLANT);
|
||||
MATERIALS.put(Blocks.FERN, REPLACEABLE_PLANT);
|
||||
MATERIALS.put(Blocks.DEAD_BUSH, REPLACEABLE_PLANT);
|
||||
MATERIALS.put(Blocks.SEAGRASS, REPLACEABLE_UNDERWATER_PLANT);
|
||||
|
@ -30,6 +30,7 @@ import net.minecraft.util.collection.DefaultedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class RecipeInfo<T extends Recipe<?>> {
|
||||
@ -109,7 +110,7 @@ public final class RecipeInfo<T extends Recipe<?>> {
|
||||
}
|
||||
|
||||
final int width_f = width;
|
||||
return new RecipeInfo<>(() -> new ShapedRecipe(group, CraftingRecipeCategory.MISC, width_f, height, ingredients, output), RecipeSerializer.SHAPED, output);
|
||||
return new RecipeInfo<>(() -> new ShapedRecipe(group, CraftingRecipeCategory.MISC, new RawShapedRecipe(width_f, height, ingredients, Optional.empty()), output, false), RecipeSerializer.SHAPED, output);
|
||||
}
|
||||
|
||||
public static RecipeInfo<ShapedRecipe> shaped(String group, ItemConvertible output, Object... args) {
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD
|
||||
* Copyright (C) 2023 RK_01/RaphiMC and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.access;
|
||||
|
||||
public interface IDownloadingTerrainScreen {
|
||||
|
||||
void viaFabricPlus$setReady();
|
||||
|
||||
boolean viaFabricPlus$isReady();
|
||||
|
||||
}
|
@ -24,7 +24,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.gui.screen.ConnectScreen$1")
|
||||
@Mixin(targets = "net.minecraft.client.gui.screen.multiplayer.ConnectScreen$1")
|
||||
public abstract class MixinConnectScreen_1 {
|
||||
|
||||
@WrapOperation(method = "run", at = @At(value = "INVOKE", target = "Ljava/lang/Exception;getMessage()Ljava/lang/String;", remap = false))
|
||||
|
@ -22,8 +22,8 @@ package de.florianmichael.viafabricplus.injection.mixin.base.integration;
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.viafabricplus.screen.base.PerServerVersionScreen;
|
||||
import de.florianmichael.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.minecraft.client.gui.screen.AddServerScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.AddServerScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
|
@ -29,7 +29,7 @@ import de.florianmichael.viafabricplus.protocolhack.util.ProtocolVersionDetector
|
||||
import de.florianmichael.viafabricplus.protocolhack.util.VersionEnumExtension;
|
||||
import de.florianmichael.viafabricplus.settings.impl.AuthenticationSettings;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import net.minecraft.client.gui.screen.ConnectScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.client.session.Session;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
@ -44,7 +44,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.gui.screen.ConnectScreen$1")
|
||||
@Mixin(targets = "net.minecraft.client.gui.screen.multiplayer.ConnectScreen$1")
|
||||
public abstract class MixinConnectScreen_1 {
|
||||
|
||||
@Shadow
|
||||
|
@ -19,39 +19,29 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.google.common.hash.HashCode;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.io.Files;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import de.florianmichael.viafabricplus.fixes.data.ResourcePackHeaderDiff;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.GameVersion;
|
||||
import net.minecraft.client.resource.ServerResourcePackProvider;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(ServerResourcePackProvider.class)
|
||||
public abstract class MixinServerResourcePackProvider {
|
||||
@Mixin(targets = "net.minecraft.client.resource.server.ServerResourcePackLoader$4")
|
||||
public abstract class MixinServerResourcePackLoader_4 {
|
||||
|
||||
@Redirect(method = "getDownloadHeaders", at = @At(value = "INVOKE", target = "Lnet/minecraft/SharedConstants;getGameVersion()Lnet/minecraft/GameVersion;"))
|
||||
private static GameVersion editHeaders() {
|
||||
@Redirect(method = "getHeaders", at = @At(value = "INVOKE", target = "Lnet/minecraft/SharedConstants;getGameVersion()Lnet/minecraft/GameVersion;"))
|
||||
private GameVersion editHeaders() {
|
||||
return ResourcePackHeaderDiff.get(ProtocolHack.getTargetVersion());
|
||||
}
|
||||
|
||||
@Inject(method = "getDownloadHeaders", at = @At("TAIL"), cancellable = true)
|
||||
private static void removeHeaders(CallbackInfoReturnable<Map<String, String>> cir) {
|
||||
@Inject(method = "getHeaders", at = @At("TAIL"), cancellable = true)
|
||||
private void removeHeaders(CallbackInfoReturnable<Map<String, String>> cir) {
|
||||
final LinkedHashMap<String, String> modifiableMap = new LinkedHashMap<>(cir.getReturnValue());
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_3)) {
|
||||
modifiableMap.remove("X-Minecraft-Version-ID");
|
||||
@ -64,24 +54,4 @@ public abstract class MixinServerResourcePackProvider {
|
||||
cir.setReturnValue(modifiableMap);
|
||||
}
|
||||
|
||||
@Redirect(method = "verifyFile", at = @At(value = "INVOKE", target = "Lcom/google/common/hash/HashCode;toString()Ljava/lang/String;", remap = false))
|
||||
private String revertHashAlgorithm(HashCode instance, @Local File file) throws IOException {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
//noinspection deprecation
|
||||
return Hashing.sha1().hashBytes(Files.toByteArray(file)).toString();
|
||||
} else if (ProtocolHack.getTargetVersion().isOlderThan(VersionEnum.r1_18tor1_18_1)) {
|
||||
return DigestUtils.sha1Hex(new FileInputStream(file));
|
||||
} else {
|
||||
return instance.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "verifyFile", at = @At(value = "INVOKE", target = "Ljava/lang/String;toLowerCase(Ljava/util/Locale;)Ljava/lang/String;"))
|
||||
private String disableIgnoreCase(String instance, Locale locale) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
return instance;
|
||||
}
|
||||
return instance.toLowerCase(locale);
|
||||
}
|
||||
|
||||
}
|
@ -44,7 +44,7 @@ public abstract class MixinCauldronBlock extends AbstractCauldronBlock {
|
||||
BooleanBiFunction.ONLY_FIRST
|
||||
);
|
||||
|
||||
public MixinCauldronBlock(Settings settings, Map<Item, CauldronBehavior> behaviorMap) {
|
||||
public MixinCauldronBlock(Settings settings, CauldronBehavior.CauldronBehaviorMap behaviorMap) {
|
||||
super(settings, behaviorMap);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.MovementType;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.entity.vehicle.VehicleEntity;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -46,7 +47,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(BoatEntity.class)
|
||||
public abstract class MixinBoatEntity extends Entity {
|
||||
public abstract class MixinBoatEntity extends VehicleEntity {
|
||||
|
||||
@Shadow
|
||||
private double x;
|
||||
@ -63,18 +64,6 @@ public abstract class MixinBoatEntity extends Entity {
|
||||
@Shadow
|
||||
private double boatPitch;
|
||||
|
||||
@Shadow
|
||||
public abstract int getDamageWobbleTicks();
|
||||
|
||||
@Shadow
|
||||
public abstract void setDamageWobbleTicks(int wobbleTicks);
|
||||
|
||||
@Shadow
|
||||
public abstract float getDamageWobbleStrength();
|
||||
|
||||
@Shadow
|
||||
public abstract void setDamageWobbleStrength(float wobbleStrength);
|
||||
|
||||
@Shadow
|
||||
private BoatEntity.Location location;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public abstract class MixinLockableContainerBlockEntity {
|
||||
this fix, so that you can at least see / join the world.
|
||||
*/
|
||||
|
||||
@WrapOperation(method = "readNbt", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Text$Serializer;fromJson(Ljava/lang/String;)Lnet/minecraft/text/MutableText;"))
|
||||
@WrapOperation(method = "readNbt", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Text$Serialization;fromJson(Ljava/lang/String;)Lnet/minecraft/text/MutableText;"))
|
||||
private MutableText allowInvalidJson(String json, Operation<MutableText> operation) {
|
||||
if (DebugSettings.global().skipContainersWithCustomDisplayNames.isEnabled()) {
|
||||
try {
|
||||
|
@ -22,6 +22,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network;
|
||||
import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
import de.florianmichael.viafabricplus.fixes.data.recipe.RecipeInfo;
|
||||
import de.florianmichael.viafabricplus.fixes.data.recipe.Recipes1_11_2;
|
||||
import de.florianmichael.viafabricplus.injection.access.IDownloadingTerrainScreen;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -69,6 +70,8 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
@Shadow
|
||||
public abstract void onSynchronizeRecipes(SynchronizeRecipesS2CPacket packet);
|
||||
|
||||
@Shadow protected abstract boolean isSecureChatEnforced();
|
||||
|
||||
protected MixinClientPlayNetworkHandler(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) {
|
||||
super(client, connection, connectionState);
|
||||
}
|
||||
@ -90,8 +93,8 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19_4);
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
|
||||
private boolean removeUnknownPlayerListEntryWarning(Logger instance, String s, Object o) {
|
||||
@WrapWithCondition(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
|
||||
private boolean removeUnknownPlayerListEntryWarning(Logger instance, String s, Object object1, Object object2) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19_3);
|
||||
}
|
||||
|
||||
@ -111,20 +114,24 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "onServerMetadata", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ServerMetadataS2CPacket;isSecureChatEnforced()Z", ordinal = 1))
|
||||
private boolean removeSecureChatWarning(ServerMetadataS2CPacket instance) {
|
||||
return instance.isSecureChatEnforced() || VisualSettings.global().disableSecureChatWarning.isEnabled();
|
||||
@Redirect(method = "onServerMetadata", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;isSecureChatEnforced()Z"))
|
||||
private boolean removeSecureChatWarning(ClientPlayNetworkHandler instance) {
|
||||
return isSecureChatEnforced() || VisualSettings.global().disableSecureChatWarning.isEnabled();
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "onPlayerSpawnPosition", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;setReady()V"))
|
||||
private boolean moveDownloadingTerrainClosing(DownloadingTerrainScreen instance) {
|
||||
return ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19);
|
||||
@Inject(method = "onPlayerSpawnPosition", at = @At("RETURN"))
|
||||
public void moveDownloadingTerrainClosing(PlayerSpawnPositionS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isBetweenInclusive(VersionEnum.r1_19, VersionEnum.r1_20_2)) {
|
||||
if (this.client.currentScreen instanceof DownloadingTerrainScreen downloadingTerrainScreen) {
|
||||
((IDownloadingTerrainScreen) downloadingTerrainScreen).viaFabricPlus$setReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPlayerPositionLook", at = @At("RETURN"))
|
||||
private void closeDownloadingTerrain(PlayerPositionLookS2CPacket packet, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1) && this.client.currentScreen instanceof DownloadingTerrainScreen downloadingTerrainScreen) {
|
||||
downloadingTerrainScreen.setReady();
|
||||
((IDownloadingTerrainScreen) downloadingTerrainScreen).viaFabricPlus$setReady();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.gui.screen.ConnectScreen$1")
|
||||
@Mixin(targets = "net.minecraft.client.gui.screen.multiplayer.ConnectScreen$1")
|
||||
public abstract class MixinConnectScreen_1 {
|
||||
|
||||
@Final
|
||||
|
@ -19,12 +19,14 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
|
||||
|
||||
import de.florianmichael.viafabricplus.injection.access.IDownloadingTerrainScreen;
|
||||
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.common.KeepAliveC2SPacket;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -32,51 +34,75 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
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;
|
||||
|
||||
@Mixin(DownloadingTerrainScreen.class)
|
||||
public abstract class MixinDownloadingTerrainScreen extends Screen {
|
||||
public abstract class MixinDownloadingTerrainScreen extends Screen implements IDownloadingTerrainScreen {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private long loadStartTime;
|
||||
|
||||
@Shadow
|
||||
private boolean ready;
|
||||
|
||||
@Unique
|
||||
private int viaFabricPlus$tickCounter;
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$isReady;
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$closeOnNextTick = false;
|
||||
|
||||
public MixinDownloadingTerrainScreen(Text title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||
private void modifyCloseCondition(CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1)) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_20_2)) {
|
||||
ci.cancel();
|
||||
if (this.ready) {
|
||||
if (System.currentTimeMillis() > this.loadStartTime + 30000L) {
|
||||
this.close();
|
||||
} else {
|
||||
if (this.viaFabricPlus$closeOnNextTick) {
|
||||
if (this.client.player == null) return;
|
||||
|
||||
BlockPos blockPos = this.client.player.getBlockPos();
|
||||
boolean bl = this.client.world != null && this.client.world.isOutOfHeightLimit(blockPos.getY());
|
||||
if (bl || this.client.worldRenderer.isRenderingReady(blockPos) || this.client.player.isSpectator() || !this.client.player.isAlive()) {
|
||||
this.close();
|
||||
}
|
||||
} else {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$isReady || System.currentTimeMillis() > this.loadStartTime + 2000;
|
||||
} else {
|
||||
this.viaFabricPlus$closeOnNextTick = this.viaFabricPlus$isReady;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_18tor1_18_1)) {
|
||||
if (this.viaFabricPlus$isReady) {
|
||||
this.close();
|
||||
}
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_1)) {
|
||||
this.viaFabricPlus$tickCounter++;
|
||||
|
||||
if (this.viaFabricPlus$tickCounter % 20 == 0) {
|
||||
MinecraftClient.getInstance().getNetworkHandler().sendPacket(new KeepAliveC2SPacket(0));
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_1)) {
|
||||
this.viaFabricPlus$tickCounter++;
|
||||
if (this.viaFabricPlus$tickCounter % 20 == 0) {
|
||||
MinecraftClient.getInstance().getNetworkHandler().sendPacket(new KeepAliveC2SPacket(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;ready:Z"))
|
||||
private boolean modifyCloseBehaviour(DownloadingTerrainScreen instance) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_1tor1_19_2)) {
|
||||
return this.ready/*TODO: Not in 1.19.2, but make the screen close faster*/ || System.currentTimeMillis() > this.loadStartTime + 2000;
|
||||
}
|
||||
@Override
|
||||
public boolean viaFabricPlus$isReady() {
|
||||
return viaFabricPlus$isReady;
|
||||
}
|
||||
|
||||
return this.ready;
|
||||
@Override
|
||||
public void viaFabricPlus$setReady() {
|
||||
viaFabricPlus$isReady = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class ProtocolHack {
|
||||
/**
|
||||
* The native version of the client
|
||||
*/
|
||||
public static final VersionEnum NATIVE_VERSION = VersionEnum.r1_20_2;
|
||||
public static final VersionEnum NATIVE_VERSION = VersionEnum.r1_20_3;
|
||||
|
||||
/**
|
||||
* This field stores the target version that you set in the GUI
|
||||
|
@ -51,7 +51,7 @@ public class ViaFabricPlusViaCommandSender implements ViaCommandSender {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ((FabricClientCommandSource) source).getPlayer().getEntityName();
|
||||
return ((FabricClientCommandSource) source).getPlayer().getName().getString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.settings.impl.BedrockSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.ConnectScreen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
@ -42,10 +42,11 @@ public class ViaFabricPlusTransferProvider extends TransferProvider {
|
||||
if (BedrockSettings.global().openPromptGUIToConfirmTransfer.getValue()) {
|
||||
mc.setScreen(new ConfirmScreen(
|
||||
(bl) -> {
|
||||
if (bl)
|
||||
if (bl) {
|
||||
connect(newAddress);
|
||||
else
|
||||
} else {
|
||||
MinecraftClient.getInstance().setScreen(null);
|
||||
}
|
||||
},
|
||||
Text.of("ViaFabricPlus"),
|
||||
Text.translatable("bedrock.viafabricplus.confirm_transfer_server_prompt", newAddress.getHostName() + ":" + newAddress.getPort())
|
||||
|
@ -67,7 +67,7 @@ public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider
|
||||
return new Item[4];
|
||||
}
|
||||
|
||||
return getMinecraftContainerItems(getPlayer().playerScreenHandler.getCraftingInput().getInputStacks());
|
||||
return getMinecraftContainerItems(getPlayer().playerScreenHandler.getCraftingInput().getHeldStacks());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,7 +73,7 @@ public class VFPScreen extends Screen {
|
||||
* @param subtitle The subtitle which should be rendered
|
||||
*/
|
||||
public void setupUrlSubtitle(final String subtitle) {
|
||||
this.setupSubtitle(Text.of(subtitle), ConfirmLinkScreen.opening(subtitle, this, true));
|
||||
this.setupSubtitle(Text.of(subtitle), ConfirmLinkScreen.opening(this, subtitle));
|
||||
}
|
||||
|
||||
|
||||
@ -121,15 +121,7 @@ public class VFPScreen extends Screen {
|
||||
|
||||
if (this.subtitle != null && this.subtitlePressAction != null) {
|
||||
final int subtitleWidth = textRenderer.getWidth(subtitle);
|
||||
this.addDrawableChild(subtitleWidget = new PressableTextWidget(
|
||||
width / 2 - (subtitleWidth / 2),
|
||||
(textRenderer.fontHeight + 2) * 2 + 3,
|
||||
subtitleWidth,
|
||||
textRenderer.fontHeight + 2,
|
||||
subtitle,
|
||||
subtitlePressAction,
|
||||
textRenderer
|
||||
));
|
||||
this.addDrawableChild(subtitleWidget = new PressableTextWidget(width / 2 - (subtitleWidth / 2), (textRenderer.fontHeight + 2) * 2 + 3, subtitleWidth, textRenderer.fontHeight + 2, subtitle, subtitlePressAction, textRenderer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class PerServerVersionScreen extends VFPScreen {
|
||||
protected void init() {
|
||||
super.init();
|
||||
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height + 5, textRenderer.fontHeight + 4));
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, -5, textRenderer.fontHeight + 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -63,7 +63,7 @@ public class PerServerVersionScreen extends VFPScreen {
|
||||
public class SlotList extends AlwaysSelectedEntryListWidget<DummyProtocolSlot> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
|
||||
this.addEntry(new ResetProtocolSlot());
|
||||
VersionEnum.SORTED_VERSIONS.stream().map(ViaProtocolSlot::new).forEach(this::addEntry);
|
||||
|
@ -53,7 +53,7 @@ public class ProtocolSelectionScreen extends VFPScreen {
|
||||
@Override
|
||||
protected void init() {
|
||||
// List and Settings
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height - 30, textRenderer.fontHeight + 4));
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, 30, textRenderer.fontHeight + 4));
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.translatable("base.viafabricplus.settings"), button -> SettingsScreen.INSTANCE.open(this)).position(width - 98 - 5, 5).size(98, 20).build());
|
||||
|
||||
// ClassiCube
|
||||
@ -110,7 +110,7 @@ public class ProtocolSelectionScreen extends VFPScreen {
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<ProtocolSlot> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
|
||||
VersionEnum.SORTED_VERSIONS.stream().map(ProtocolSlot::new).forEach(this::addEntry);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConfirmLinkScreen;
|
||||
import net.minecraft.client.gui.screen.ConnectScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
@ -47,16 +47,12 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
|
||||
protected BetaCraftScreen() {
|
||||
super("BetaCraft", true);
|
||||
this.setupSubtitle(Text.of(BETA_CRAFT_SERVER_LIST_URL), ConfirmLinkScreen.opening(
|
||||
BETA_CRAFT_SERVER_LIST_URL,
|
||||
this,
|
||||
true
|
||||
));
|
||||
this.setupSubtitle(Text.of(BETA_CRAFT_SERVER_LIST_URL), ConfirmLinkScreen.opening(this, BETA_CRAFT_SERVER_LIST_URL));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height + 5, (textRenderer.fontHeight + 2) * 3));
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, -5, (textRenderer.fontHeight + 2) * 3));
|
||||
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.translatable("base.viafabricplus.reset"), button -> {
|
||||
SERVER_LIST = null;
|
||||
@ -77,7 +73,7 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<VFPListEntry> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
if (SERVER_LIST == null) return;
|
||||
|
||||
for (BCVersionCategory value : BCVersionCategory.values()) {
|
||||
|
@ -44,10 +44,7 @@ public class ClassiCubeLoginScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
public void open(Screen prevScreen) {
|
||||
this.setupSubtitle(
|
||||
Text.translatable("classicube.viafabricplus.account"),
|
||||
ConfirmLinkScreen.opening(ClassiCubeHandler.CLASSICUBE_ROOT_URI.toString(), this, true)
|
||||
);
|
||||
this.setupSubtitle(Text.translatable("classicube.viafabricplus.account"), ConfirmLinkScreen.opening(this, ClassiCubeHandler.CLASSICUBE_ROOT_URI.toString()));
|
||||
super.open(prevScreen);
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ import de.florianmichael.viafabricplus.settings.impl.AuthenticationSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConnectScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
|
||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
@ -72,7 +72,7 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height + 5, (textRenderer.fontHeight + 4) * 3));
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, -5, (textRenderer.fontHeight + 4) * 3));
|
||||
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.translatable("base.viafabricplus.logout"), button -> {
|
||||
close();
|
||||
@ -104,7 +104,7 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<VFPListEntry> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
|
||||
SERVER_LIST.forEach(serverInfo -> this.addEntry(new ServerSlot(serverInfo)));
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class SettingsScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height + 5, (textRenderer.fontHeight + 2) * 2));
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, -5, (textRenderer.fontHeight + 2) * 2));
|
||||
|
||||
super.init();
|
||||
}
|
||||
@ -55,7 +55,7 @@ public class SettingsScreen extends VFPScreen {
|
||||
public static class SlotList extends AlwaysSelectedEntryListWidget<VFPListEntry> {
|
||||
|
||||
public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) {
|
||||
super(minecraftClient, width, height, top, bottom, entryHeight);
|
||||
super(minecraftClient, width, height - top - bottom, top, entryHeight);
|
||||
|
||||
for (SettingGroup group : ViaFabricPlus.global().getSettingsManager().getGroups()) {
|
||||
this.addEntry(new TitleRenderer(group.getName()));
|
||||
|
@ -15,16 +15,17 @@ accessible field net/minecraft/entity/vehicle/BoatEntity yawVelocity F
|
||||
accessible field net/minecraft/client/font/FontStorage glyphRendererCache Lnet/minecraft/client/font/GlyphContainer;
|
||||
accessible field net/minecraft/client/font/FontStorage glyphCache Lnet/minecraft/client/font/GlyphContainer;
|
||||
accessible field net/minecraft/entity/EntityType dimensions Lnet/minecraft/entity/EntityDimensions;
|
||||
mutable field net/minecraft/entity/EntityType dimensions Lnet/minecraft/entity/EntityDimensions;
|
||||
accessible field net/minecraft/block/AbstractBlock velocityMultiplier F
|
||||
mutable field net/minecraft/block/AbstractBlock velocityMultiplier F
|
||||
|
||||
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
|
||||
accessible method net/minecraft/entity/passive/CamelEntity getPassengerAttachmentY (ZFLnet/minecraft/entity/EntityDimensions;F)D
|
||||
accessible method net/minecraft/entity/vehicle/BoatEntity getMaxPassengers ()I
|
||||
accessible method net/minecraft/client/gui/screen/ConnectScreen setStatus (Lnet/minecraft/text/Text;)V
|
||||
accessible method net/minecraft/client/gui/screen/multiplayer/ConnectScreen setStatus (Lnet/minecraft/text/Text;)V
|
||||
accessible method net/minecraft/item/BlockItem getPlacementState (Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/block/BlockState;
|
||||
|
||||
accessible class net/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection
|
||||
accessible class net/minecraft/client/font/FontStorage$GlyphPair
|
||||
|
||||
mutable field net/minecraft/entity/EntityType dimensions Lnet/minecraft/entity/EntityDimensions;
|
||||
mutable field net/minecraft/block/AbstractBlock velocityMultiplier F
|
@ -52,7 +52,7 @@
|
||||
"fixes.minecraft.MixinProfileKeysImpl",
|
||||
"fixes.minecraft.MixinRedirectResolver",
|
||||
"fixes.minecraft.MixinServerAddress",
|
||||
"fixes.minecraft.MixinServerResourcePackProvider",
|
||||
"fixes.minecraft.MixinServerResourcePackLoader_4",
|
||||
"fixes.minecraft.MixinStringHelper",
|
||||
"fixes.minecraft.MixinTextRenderer",
|
||||
"fixes.minecraft.block.MixinAbstractBlock",
|
||||
|
Loading…
Reference in New Issue
Block a user