mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-09-06 01:07:59 +02:00
Cleaned settings and finished V3 TODO list
This commit is contained in:
parent
c5191b583d
commit
677843479b
@ -36,6 +36,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
* TODO | General
|
||||
* - Make recipe fixes dynamic instead of a data dump in java classes
|
||||
* - Check if relevant for protocol translation: TakeItemEntityPacket isEmpty case (1.20 -> 1.20.1 change)
|
||||
* - Check previous Donkey interaction fix (see git logs)
|
||||
* - Window interactions in <= 1.16.5 has changed and can be detected by the server
|
||||
* - Most CTS protocol features aren't supported (see https://github.com/ViaVersion/ViaFabricPlus/issues/181)
|
||||
* - Most CPE features aren't implemented correctly (see https://github.com/ViaVersion/ViaFabricPlus/issues/152)
|
||||
@ -45,12 +46,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
* - X/Z Face based jump movement in <= 1.13.2 is broken (https://github.com/ViaVersion/ViaFabricPlus/issues/189)
|
||||
* - Collision hit boxes has been changed (https://github.com/ViaVersion/ViaFabricPlus/issues/195)
|
||||
* - Blit-jump is not supported in <= 1.8.9 (https://github.com/ViaVersion/ViaFabricPlus/issues/225)
|
||||
*
|
||||
* TODO | Migration v3
|
||||
* - Use ViaProxy config patch for some clientside fixes options (Remove ViaFabricPlusVLViaConfig and MixinViaLegacyConfig)
|
||||
* - Add setting for VFP AlphaInventoryProvider
|
||||
* - Fix MixinAbstractDonkeyEntity
|
||||
* - Check TO DO in MixinEntity
|
||||
*/
|
||||
public class ViaFabricPlus {
|
||||
private static final ViaFabricPlus instance = new ViaFabricPlus();
|
||||
|
@ -26,7 +26,8 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.ArmorType;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -42,8 +43,12 @@ public class ArmorHudEmulation1_8 {
|
||||
|
||||
public static void init() {
|
||||
ClientTickEvents.START_WORLD_TICK.register(world -> {
|
||||
if (!VisualSettings.global().emulateArmorHud.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (MinecraftClient.getInstance().player != null) {
|
||||
final UserConnection userConnection = ((IClientConnection) MinecraftClient.getInstance().getNetworkHandler().getConnection()).viaFabricPlus$getUserConnection();
|
||||
final UserConnection userConnection = ProtocolHack.getPlayNetworkUserConnection();
|
||||
if (userConnection != null) {
|
||||
try {
|
||||
sendArmorUpdate(userConnection);
|
||||
|
@ -22,6 +22,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
import de.florianmichael.viafabricplus.fixes.entity.EntityRidingOffsetsPre1_20_2;
|
||||
import de.florianmichael.viafabricplus.injection.access.IEntity;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import de.florianmichael.viafabricplus.settings.impl.DebugSettings;
|
||||
import it.unimi.dsi.fastutil.objects.Object2DoubleMap;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FenceGateBlock;
|
||||
@ -217,7 +218,7 @@ public abstract class MixinEntity implements IEntity {
|
||||
|
||||
@Override
|
||||
public boolean viaFabricPlus$isInLoadedChunkAndShouldTick() {
|
||||
return this.viaFabricPlus$isInLoadedChunkAndShouldTick || !ProtocolHack.getTargetVersion().isBetweenInclusive(VersionEnum.r1_9, VersionEnum.r1_16_4tor1_16_5) /* || TODO: Add setting to force this*/;
|
||||
return this.viaFabricPlus$isInLoadedChunkAndShouldTick || DebugSettings.global().alwaysTickClientPlayer.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,10 +47,12 @@ public abstract class MixinHeldItemRenderer {
|
||||
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getUseAction()Lnet/minecraft/util/UseAction;")),
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;applyEquipOffset(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Arm;F)V", ordinal = 2, shift = At.Shift.AFTER))
|
||||
private void transformLegacyBlockAnimations(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_8)) {
|
||||
final boolean blockHitAnimation = VisualSettings.global().enableBlockHitAnimation.isEnabled();
|
||||
|
||||
if (VisualSettings.global().enableSwordBlocking.isEnabled() || blockHitAnimation) {
|
||||
matrices.translate(-0.1F, 0.05F, 0.0F);
|
||||
|
||||
if (VisualSettings.global().blockHitAnimation.isEnabled()) {
|
||||
if (blockHitAnimation) {
|
||||
final var arm = (hand == Hand.MAIN_HAND) ? player.getMainArm() : player.getMainArm().getOpposite();
|
||||
applySwingOffset(matrices, arm, swingProgress);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.vialegacy;
|
||||
package de.florianmichael.viafabricplus.injection.mixin.vialegacy;
|
||||
|
||||
import de.florianmichael.viafabricplus.event.LoadClassicProtocolExtensionCallback;
|
||||
import de.florianmichael.viafabricplus.injection.access.IExtensionProtocolMetadataStorage;
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.mixin.vialegacy;
|
||||
|
||||
import de.florianmichael.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.raphimc.vialegacy.ViaLegacyConfig;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(value = ViaLegacyConfig.class, remap = false)
|
||||
public class MixinViaLegacyConfig {
|
||||
|
||||
@Inject(method = { "isLegacySkullLoading", "isLegacySkinLoading" }, at = @At("HEAD"), cancellable = true)
|
||||
public void replaceWithVFPSetting(CallbackInfoReturnable<Boolean> cir) {
|
||||
cir.setReturnValue(GeneralSettings.global().loadSkinsAndSkullsInLegacyVersions.getValue());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.mixin.viaversion;
|
||||
|
||||
import com.viaversion.viaversion.util.Config;
|
||||
import de.florianmichael.viafabricplus.protocolhack.util.ConfigPatcher;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(value = Config.class, remap = false)
|
||||
public abstract class MixinConfig {
|
||||
|
||||
@Redirect(method = "loadConfig(Ljava/io/File;Ljava/net/URL;)Ljava/util/Map;", at = @At(value = "INVOKE", target = "Ljava/util/Map;containsKey(Ljava/lang/Object;)Z"))
|
||||
private boolean allowConfigPatching(final Map<String, Object> map, final Object key) {
|
||||
if (((Object) this) instanceof ConfigPatcher) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
}
|
@ -37,7 +37,9 @@ import de.florianmichael.viafabricplus.protocolhack.command.ViaFabricPlusVLComma
|
||||
import de.florianmichael.viafabricplus.protocolhack.impl.ViaFabricPlusVLInjector;
|
||||
import de.florianmichael.viafabricplus.protocolhack.impl.ViaFabricPlusVLLoader;
|
||||
import de.florianmichael.viafabricplus.protocolhack.impl.platform.ViaFabricPlusViaLegacyPlatformImpl;
|
||||
import de.florianmichael.viafabricplus.protocolhack.impl.platform.ViaFabricPlusViaVersionPlatformImpl;
|
||||
import de.florianmichael.viafabricplus.protocolhack.netty.ViaFabricPlusVLLegacyPipeline;
|
||||
import de.florianmichael.viafabricplus.protocolhack.util.ConfigPatcher;
|
||||
import de.florianmichael.viafabricplus.protocolhack.util.NoPacketSendChannel;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.util.AttributeKey;
|
||||
@ -50,12 +52,13 @@ import net.raphimc.vialoader.ViaLoader;
|
||||
import net.raphimc.vialoader.impl.platform.ViaAprilFoolsPlatformImpl;
|
||||
import net.raphimc.vialoader.impl.platform.ViaBackwardsPlatformImpl;
|
||||
import net.raphimc.vialoader.impl.platform.ViaBedrockPlatformImpl;
|
||||
import net.raphimc.vialoader.impl.platform.ViaVersionPlatformImpl;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.cloudburstmc.netty.channel.raknet.config.RakChannelOption;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@ -63,6 +66,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
* This class represents the whole Protocol Translator, here all important variables are stored
|
||||
*/
|
||||
public class ProtocolHack {
|
||||
|
||||
/**
|
||||
* These attribute keys are used to track the main connections of Minecraft and ViaVersion, so that they can be used later during the connection to send packets.
|
||||
*/
|
||||
@ -174,7 +178,38 @@ public class ProtocolHack {
|
||||
throw new IllegalStateException("The player is not connected to a server");
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply recommended config options to the ViaVersion config files
|
||||
*
|
||||
* @param directory The directory where the ViaVersion config files are located
|
||||
*/
|
||||
public static void patchConfigs(final File directory) {
|
||||
final File configFolder = new File(directory, "ViaLoader");
|
||||
|
||||
final File viaVersionConfig = new File(configFolder, "viaversion.yml");
|
||||
final Map<String, Object> viaVersionPatches = new HashMap<>();
|
||||
viaVersionPatches.put("fix-infested-block-breaking", false);
|
||||
viaVersionPatches.put("shield-blocking", false);
|
||||
viaVersionPatches.put("no-delay-shield-blocking", true);
|
||||
viaVersionPatches.put("chunk-border-fix", true);
|
||||
new ConfigPatcher(viaVersionConfig, viaVersionPatches);
|
||||
|
||||
final File viaLegacyConfig = new File(configFolder, "vialegacy.yml");
|
||||
final Map<String, Object> viaLegacyPatches = new HashMap<>();
|
||||
viaLegacyPatches.put("legacy-skull-loading", true);
|
||||
viaLegacyPatches.put("legacy-skin-loading", true);
|
||||
new ConfigPatcher(viaLegacyConfig, viaLegacyPatches);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to initialize the whole Protocol Translator
|
||||
*
|
||||
* @param directory The directory where the ViaVersion config files are located
|
||||
* @return A CompletableFuture that will be completed when the initialization is done
|
||||
*/
|
||||
public static CompletableFuture<Void> init(final File directory) {
|
||||
patchConfigs(directory);
|
||||
|
||||
// Register command callback for /viaversion and /viafabricplus
|
||||
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> {
|
||||
final var commandHandler = (ViaFabricPlusVLCommandHandler) Via.getManager().getCommandHandler();
|
||||
@ -188,10 +223,11 @@ public class ProtocolHack {
|
||||
return CompletableFuture.runAsync(() -> {
|
||||
// Load ViaVersion and register all platforms and their components
|
||||
ViaLoader.init(
|
||||
new ViaVersionPlatformImpl(directory),
|
||||
new ViaFabricPlusViaVersionPlatformImpl(directory),
|
||||
new ViaFabricPlusVLLoader(),
|
||||
new ViaFabricPlusVLInjector(),
|
||||
new ViaFabricPlusVLCommandHandler(),
|
||||
|
||||
ViaBackwardsPlatformImpl::new,
|
||||
ViaFabricPlusViaLegacyPlatformImpl::new,
|
||||
ViaAprilFoolsPlatformImpl::new,
|
||||
@ -200,4 +236,5 @@ public class ProtocolHack {
|
||||
PostViaVersionLoadCallback.EVENT.invoker().onPostViaVersionLoad();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ import net.raphimc.viabedrock.protocol.providers.BlobCacheProvider;
|
||||
import net.raphimc.viabedrock.protocol.providers.NettyPipelineProvider;
|
||||
import net.raphimc.viabedrock.protocol.providers.TransferProvider;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.AlphaInventoryProvider;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.TrackingAlphaInventoryProvider;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicMPPassProvider;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicWorldHeightProvider;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.providers.OldAuthProvider;
|
||||
@ -64,7 +65,8 @@ public class ViaFabricPlusVLLoader extends VLLoader {
|
||||
providers.use(EncryptionProvider.class, new ViaFabricPlusEncryptionProvider());
|
||||
providers.use(GameProfileFetcher.class, new ViaFabricPlusGameProfileFetcher());
|
||||
providers.use(ClassicMPPassProvider.class, new ViaFabricPlusClassicMPPassProvider());
|
||||
providers.use(AlphaInventoryProvider.class, new ViaFabricPlusAlphaInventoryProvider());
|
||||
|
||||
providers.use(AlphaInventoryProvider.class, new ViaFabricPlusAlphaInventoryProvider(providers.get(TrackingAlphaInventoryProvider.class)));
|
||||
|
||||
providers.use(NettyPipelineProvider.class, new ViaFabricPlusNettyPipelineProvider());
|
||||
providers.use(BlobCacheProvider.class, new ViaFabricPlusBlobCacheProvider());
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.protocolhack.impl;
|
||||
|
||||
import net.raphimc.vialoader.impl.viaversion.VLViaConfig;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ViaFabricPlusVLViaConfig extends VLViaConfig {
|
||||
|
||||
public ViaFabricPlusVLViaConfig(File configFile) {
|
||||
super(configFile);
|
||||
|
||||
UNSUPPORTED.add("simulate-pt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSimulatePlayerTick() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.protocolhack.impl.platform;
|
||||
|
||||
import com.viaversion.viaversion.configuration.AbstractViaConfig;
|
||||
import de.florianmichael.viafabricplus.protocolhack.impl.ViaFabricPlusVLViaConfig;
|
||||
import net.raphimc.vialoader.impl.platform.ViaVersionPlatformImpl;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ViaFabricPlusViaVersionPlatformImpl extends ViaVersionPlatformImpl {
|
||||
|
||||
public ViaFabricPlusViaVersionPlatformImpl(File rootFolder) {
|
||||
super(rootFolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractViaConfig createConfig() {
|
||||
final AbstractViaConfig config = new ViaFabricPlusVLViaConfig(new File(this.getDataFolder(), "viaversion.yml"));
|
||||
config.reload();
|
||||
return config;
|
||||
}
|
||||
|
||||
}
|
@ -22,10 +22,13 @@ package de.florianmichael.viafabricplus.protocolhack.provider.vialegacy;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import de.florianmichael.viafabricplus.protocolhack.translator.ItemTranslator;
|
||||
import de.florianmichael.viafabricplus.settings.impl.GeneralSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.AlphaInventoryProvider;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.TrackingAlphaInventoryProvider;
|
||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.AlphaInventoryTracker;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
|
||||
import java.util.List;
|
||||
@ -33,10 +36,15 @@ import java.util.List;
|
||||
import static net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.copyItems;
|
||||
|
||||
public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider {
|
||||
private final TrackingAlphaInventoryProvider trackingAlphaInventoryProvider;
|
||||
|
||||
public ViaFabricPlusAlphaInventoryProvider(final TrackingAlphaInventoryProvider trackingAlphaInventoryProvider) {
|
||||
this.trackingAlphaInventoryProvider = trackingAlphaInventoryProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesInventoryTracker() {
|
||||
return false;
|
||||
return !GeneralSettings.global().emulateInventoryActionsInLegacyVersions.getValue();
|
||||
}
|
||||
|
||||
protected Item[] getMinecraftContainerItems(final List<ItemStack> trackingItems) {
|
||||
@ -53,38 +61,59 @@ public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider
|
||||
|
||||
@Override
|
||||
public Item[] getMainInventoryItems(UserConnection user) {
|
||||
if (getPlayer() == null) return new Item[37];
|
||||
if (usesInventoryTracker()) {
|
||||
return trackingAlphaInventoryProvider.getMainInventoryItems(user);
|
||||
} else if (getPlayer() == null) {
|
||||
return new Item[37];
|
||||
}
|
||||
|
||||
return getMinecraftContainerItems(getPlayer().getInventory().main);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getCraftingInventoryItems(UserConnection user) {
|
||||
if (getPlayer() == null) return new Item[4];
|
||||
if (usesInventoryTracker()) {
|
||||
return trackingAlphaInventoryProvider.getCraftingInventoryItems(user);
|
||||
} else if (getPlayer() == null) {
|
||||
return new Item[4];
|
||||
}
|
||||
|
||||
return getMinecraftContainerItems(getPlayer().playerScreenHandler.getCraftingInput().getInputStacks());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getArmorInventoryItems(UserConnection user) {
|
||||
if (getPlayer() == null) return new Item[4];
|
||||
if (usesInventoryTracker()) {
|
||||
return trackingAlphaInventoryProvider.getArmorInventoryItems(user);
|
||||
} else if (getPlayer() == null) {
|
||||
return new Item[4];
|
||||
}
|
||||
|
||||
return getMinecraftContainerItems(getPlayer().getInventory().armor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getContainerItems(UserConnection user) {
|
||||
if (getPlayer() == null) return new Item[37];
|
||||
if (usesInventoryTracker()) {
|
||||
return trackingAlphaInventoryProvider.getContainerItems(user);
|
||||
} else if (getPlayer() == null) {
|
||||
return new Item[37];
|
||||
}
|
||||
|
||||
return getMinecraftContainerItems(getPlayer().currentScreenHandler.getStacks());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToInventory(UserConnection user, Item item) {
|
||||
getPlayer().getInventory().insertStack(ItemTranslator.viaB1_8toMc(item));
|
||||
if (usesInventoryTracker()) {
|
||||
trackingAlphaInventoryProvider.addToInventory(user, item);
|
||||
} else {
|
||||
getPlayer().getInventory().insertStack(ItemTranslator.viaB1_8toMc(item));
|
||||
}
|
||||
}
|
||||
|
||||
protected ClientPlayerEntity getPlayer() {
|
||||
return MinecraftClient.getInstance().player;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.protocolhack.util;
|
||||
|
||||
import com.viaversion.viaversion.util.Config;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConfigPatcher extends Config {
|
||||
|
||||
private final Map<String, Object> patches;
|
||||
|
||||
public ConfigPatcher(final File configFile, final Map<String, Object> patches) {
|
||||
super(configFile);
|
||||
|
||||
this.patches = patches;
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDefaultConfigURL() {
|
||||
return ConfigPatcher.class.getClassLoader().getResource("assets/viafabricplus/viaversion-config.yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleConfig(Map<String, Object> config) {
|
||||
for (final Map.Entry<String, Object> entry : this.patches.entrySet()) {
|
||||
if (!config.containsKey(entry.getKey())) {
|
||||
config.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUnsupportedOptions() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
@ -31,6 +31,9 @@ public class DebugSettings extends SettingGroup {
|
||||
// 1.19 -> 1.18.2
|
||||
public final VersionedBooleanSetting disableSequencing = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.disable_sequencing"), VersionRange.andOlder(VersionEnum.r1_18_2));
|
||||
|
||||
// 1.17 -> 1.16.5
|
||||
public final VersionedBooleanSetting alwaysTickClientPlayer = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.always_tick_client_player"), VersionRange.of(VersionEnum.r1_9, VersionEnum.r1_16_4tor1_16_5));
|
||||
|
||||
// 1.13 -> 1.12.2
|
||||
public final VersionedBooleanSetting executeInputsInSync = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.execute_inputs_in_sync"), VersionRange.andOlder(VersionEnum.r1_12_2));
|
||||
public final VersionedBooleanSetting sneakInstant = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.sneak_instant"), VersionRange.of(VersionEnum.r1_8, VersionEnum.r1_12_2));
|
||||
@ -49,7 +52,7 @@ public class DebugSettings extends SettingGroup {
|
||||
public final VersionedBooleanSetting replaceSneaking = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.replace_sneaking"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||
public final VersionedBooleanSetting longSneaking = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.long_sneaking"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||
|
||||
// r1_5tor1_5_1 -> r1_4_6tor1_4_7
|
||||
// 1.5/1.5.1 -> 1.4.6/1.4.7
|
||||
public final VersionedBooleanSetting legacyMiningSpeeds = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.legacy_mining_speeds"), VersionRange.andOlder(VersionEnum.r1_4_6tor1_4_7));
|
||||
|
||||
public DebugSettings() {
|
||||
|
@ -55,6 +55,8 @@ public class GeneralSettings extends SettingGroup {
|
||||
Text.translatable("base.viafabricplus.cancel_and_notify"),
|
||||
Text.translatable("base.viafabricplus.cancel")
|
||||
);
|
||||
public final BooleanSetting loadSkinsAndSkullsInLegacyVersions = new BooleanSetting(this, Text.translatable("general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions"), true);
|
||||
public final BooleanSetting emulateInventoryActionsInLegacyVersions = new BooleanSetting(this, Text.translatable("general_settings.viafabricplus.emulate_inventory_actions_in_legacy_versions"), true);
|
||||
|
||||
public GeneralSettings() {
|
||||
super(Text.translatable("setting_group_name.viafabricplus.general"));
|
||||
|
@ -46,16 +46,17 @@ public class VisualSettings extends SettingGroup {
|
||||
public final VersionedBooleanSetting removeNewerFeaturesFromCommandBlockScreen = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.remove_newer_features_from_command_block_screen"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
public final VersionedBooleanSetting showSuperSecretSettings = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.show_super_secret_settings"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
|
||||
// 1.8.x -> r1_7_6tor1_7_10
|
||||
public final VersionedBooleanSetting blockHitAnimation = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.enable_block_hit_animation"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||
// 1.8.x -> 1.7.6 - 1.7.10
|
||||
public final VersionedBooleanSetting enableSwordBlocking = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.enable_sword_blocking"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||
public final VersionedBooleanSetting enableBlockHitAnimation = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.enable_block_hit_animation"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||
|
||||
// r1_0_0tor1_0_1 -> b1_8tob1_8_1
|
||||
// 1.0.0-1.0.1 -> b1.8-b1.8.1
|
||||
public final VersionedBooleanSetting replaceHurtSoundWithOOFSound = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.replace_hurt_sound_with_oof_sound"), VersionRange.andOlder(VersionEnum.b1_8tob1_8_1));
|
||||
|
||||
// b1_8tob1_8_1 -> b1_7tob1_7_3
|
||||
// b1.8/b1.8.1 -> b1_7/b1.7.3
|
||||
public final VersionedBooleanSetting removeNewerHudElements = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.remove_newer_hud_elements"), VersionRange.andOlder(VersionEnum.b1_7tob1_7_3));
|
||||
|
||||
// a1_0_15 -> c0_28toc0_30
|
||||
// a1.0.15 -> c0_28/c0_30
|
||||
public final VersionedBooleanSetting replaceCreativeInventory = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.replace_creative_inventory_with_classic_inventory"), VersionRange.andOlder(VersionEnum.c0_28toc0_30));
|
||||
public final VersionedBooleanSetting oldWalkingAnimation = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.old_walking_animation"), VersionRange.andOlder(VersionEnum.c0_28toc0_30));
|
||||
|
||||
|
@ -41,6 +41,8 @@
|
||||
"general_settings.viafabricplus.auto_detect_version": "Auto detect version",
|
||||
"general_settings.viafabricplus.show_advertised_server_version": "Show advertised/server version in Multiplayer",
|
||||
"general_settings.viafabricplus.ignore_packet_translation_errors": "Ignore packet translation errors",
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "Load skins and skulls in legacy versions",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_legacy_versions": "Emulate inventory actions in legacy versions",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Open prompt GUI to confirm transferring to other servers",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click to set account for Bedrock edition",
|
||||
@ -58,6 +60,7 @@
|
||||
"debug_settings.viafabricplus.legacy_mining_speeds": "Legacy mining speeds",
|
||||
"debug_settings.viafabricplus.skip_containers_with_custom_display_names": "Skip containers with custom display names",
|
||||
"debug_settings.viafabricplus.prevent_entity_cramming": "Prevent entity cramming",
|
||||
"debug_settings.viafabricplus.always_tick_client_player": "Always tick client player",
|
||||
|
||||
"authentication_settings.viafabricplus.use_beta_craft_authentication": "Use BetaCraft authentication",
|
||||
"authentication_settings.viafabricplus.verify_session_for_online_mode": "Verify session for online mode servers",
|
||||
@ -76,7 +79,8 @@
|
||||
"visual_settings.viafabricplus.replace_creative_inventory_with_classic_inventory": "Replace creative inventory",
|
||||
"visual_settings.viafabricplus.old_walking_animation": "Old walking animation",
|
||||
"visual_settings.viafabricplus.change_font_renderer_behaviour": "Change Font renderer behaviour",
|
||||
"visual_settings.viafabricplus.enable_block_hit_animation": "Enable 1.7 Block hit animation",
|
||||
"visual_settings.viafabricplus.enable_sword_blocking": "Enable sword animation",
|
||||
"visual_settings.viafabricplus.enable_block_hit_animation": "Enable block hit animation",
|
||||
|
||||
"bedrock.viafabricplus.login": "Your browser should have opened.\nPlease enter the following Code: %s\nClosing this screen will cancel the process!",
|
||||
"bedrock.viafabricplus.confirm_transfer_server_prompt": "Do you want to transfer to the following server?\n%s\n\nThis will disconnect the current server and connect to the new one.",
|
||||
|
@ -0,0 +1,2 @@
|
||||
# Dummy file for the Config patcher features
|
||||
nothing_to_see_here: true
|
@ -162,7 +162,7 @@
|
||||
"fixes.minecraft.screen.screenhandler.MixinScreenHandler",
|
||||
"fixes.vialegacy.MixinClassicProtocolExtension",
|
||||
"fixes.vialegacy.MixinClientboundPacketsc0_30cpe",
|
||||
"fixes.vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||
"vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||
"fixes.vialegacy.MixinProtocol1_8to1_7_6_10",
|
||||
"fixes.vialegacy.MixinProtocolc0_30toc0_30cpe",
|
||||
"fixes.viaversion.MixinChatItemRewriter",
|
||||
@ -199,5 +199,9 @@
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
},
|
||||
"mixins": [
|
||||
"vialegacy.MixinViaLegacyConfig",
|
||||
"viaversion.MixinConfig"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user