Closing in on mixin sorting

Now only the big mixins + final cleanup is missing on this point.
This commit is contained in:
FlorianMichael 2024-12-24 06:28:22 +01:00
parent 83d4097a31
commit acf924f9ca
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
103 changed files with 346 additions and 329 deletions

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.old.viaversion;
package com.viaversion.viafabricplus.base.bedrock;
import com.viaversion.viaversion.api.connection.StorableObject;

View File

@ -26,7 +26,6 @@ import com.viaversion.viafabricplus.base.Events;
import com.viaversion.viafabricplus.base.save.impl.AccountsSave;
import com.viaversion.viafabricplus.base.save.impl.SettingsSave;
import com.viaversion.viafabricplus.base.settings.SettingsManager;
import org.jetbrains.annotations.ApiStatus;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -22,7 +22,7 @@
package com.viaversion.viafabricplus.base.settings.impl;
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
import com.viaversion.viafabricplus.injection.access.IConfirmScreen;
import com.viaversion.viafabricplus.injection.access.base.bedrock.IConfirmScreen;
import com.viaversion.viafabricplus.base.save.impl.AccountsSave;
import com.viaversion.viafabricplus.base.screen.VFPScreen;
import com.viaversion.viafabricplus.base.settings.base.BooleanSetting;

View File

@ -29,11 +29,11 @@ import com.viaversion.viafabricplus.features.cpe_extensions.CPEAdditions;
import com.viaversion.viafabricplus.features.footstep_particle.FootStepParticle1_12_2;
import com.viaversion.viafabricplus.features.networking.resource_pack_header.ResourcePackHeaderDiff;
import com.viaversion.viafabricplus.features.recipe_emulation.Recipes1_11_2;
import com.viaversion.viafabricplus.features.text_rendering.non_existing_characters.UnicodeFontFix1_12_2;
import com.viaversion.viafabricplus.features.filter_non_existing_characters.UnicodeFontFix1_12_2;
import com.viaversion.viafabricplus.features.ui.armor_hud.ArmorHudEmulation1_8;
import com.viaversion.viafabricplus.features.ui.classic_creative_menu.GridItemSelectionScreen;
import com.viaversion.viafabricplus.old.data.EntityDimensionDiff;
import com.viaversion.viafabricplus.old.versioned.EnchantmentAttributesEmulation1_20_6;
import com.viaversion.viafabricplus.features.entity.EntityDimensionDiff;
import com.viaversion.viafabricplus.features.entity.enchantment_attributes.EnchantmentAttributesEmulation1_20_6;
import com.viaversion.viafabricplus.util.DataCustomPayload;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.minecraft.client.MinecraftClient;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.old.data;
package com.viaversion.viafabricplus.features.entity;
import com.viaversion.viafabricplus.base.Events;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.old.versioned;
package com.viaversion.viafabricplus.features.entity.enchantment_attributes;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
@ -35,7 +35,6 @@ import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.registry.tag.BlockTags;
import org.jetbrains.annotations.ApiStatus;
import java.util.Optional;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.old.viaversion;
package com.viaversion.viafabricplus.features.entity.metadata_handling;
import com.viaversion.viaversion.api.connection.StorableObject;
import it.unimi.dsi.fastutil.ints.Int2FloatMap;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.old.versioned.visual;
package com.viaversion.viafabricplus.features.entity.riding_offsets;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,9 +19,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.features.text_rendering.non_existing_characters;
package com.viaversion.viafabricplus.features.filter_non_existing_characters;
import com.viaversion.viafabricplus.injection.mixin.features.text_rendering.non_existing_characters.MixinFontStorage;
import com.viaversion.viafabricplus.injection.mixin.features.filter_non_existing_characters.MixinFontStorage;
import net.minecraft.client.font.BakedGlyph;
import net.minecraft.client.font.Glyph;
import net.minecraft.client.font.RenderableGlyph;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.features.text_rendering.non_existing_characters;
package com.viaversion.viafabricplus.features.filter_non_existing_characters;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.features.text_rendering.non_existing_characters;
package com.viaversion.viafabricplus.features.filter_non_existing_characters;
import com.viaversion.viafabricplus.base.Events;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
@ -30,7 +30,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.SimpleOption;
import net.minecraft.client.resource.language.TranslationStorage;
import net.minecraft.util.Language;
import org.jetbrains.annotations.ApiStatus;
/**
* Older versions only had unicode font support for some languages and therefore servers are expecting the client

View File

@ -22,7 +22,7 @@
package com.viaversion.viafabricplus.features.item.filter_creative_tabs;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler;

View File

@ -21,7 +21,7 @@
package com.viaversion.viafabricplus.features.max_chat_length;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.minecraft.client.MinecraftClient;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.access;
package com.viaversion.viafabricplus.injection.access.base;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.access;
package com.viaversion.viafabricplus.injection.access.base;
import net.raphimc.vialegacy.protocol.classic.c0_30cpetoc0_28_30.data.ClassicProtocolExtension;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.access;
package com.viaversion.viafabricplus.injection.access.base;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.access;
package com.viaversion.viafabricplus.injection.access.base;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.access;
package com.viaversion.viafabricplus.injection.access.base;
public interface ITextFieldWidget {

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.access;
package com.viaversion.viafabricplus.injection.access.base.bedrock;
public interface IChunkTracker {

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.access;
package com.viaversion.viafabricplus.injection.access.base.bedrock;
import net.minecraft.text.Text;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.access;
package com.viaversion.viafabricplus.injection.access.base.bedrock;
public interface IRakSessionCodec {

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.access;
package com.viaversion.viafabricplus.injection.access.world.always_tick_entities;
public interface IEntity {

View File

@ -21,7 +21,7 @@
package com.viaversion.viafabricplus.injection.mixin.base.access;
import com.viaversion.viafabricplus.injection.access.IChunkTracker;
import com.viaversion.viafabricplus.injection.access.base.bedrock.IChunkTracker;
import net.raphimc.viabedrock.api.chunk.BedrockChunk;
import net.raphimc.viabedrock.protocol.storage.ChunkTracker;
import org.spongepowered.asm.mixin.Final;

View File

@ -22,7 +22,7 @@
package com.viaversion.viafabricplus.injection.mixin.base.access;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.injection.access.IMultiValueDebugSampleLogImpl;
import com.viaversion.viafabricplus.injection.access.base.IMultiValueDebugSampleLogImpl;
import net.minecraft.util.profiler.MultiValueDebugSampleLogImpl;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;

View File

@ -21,7 +21,7 @@
package com.viaversion.viafabricplus.injection.mixin.base.access;
import com.viaversion.viafabricplus.injection.access.IRakSessionCodec;
import com.viaversion.viafabricplus.injection.access.base.bedrock.IRakSessionCodec;
import io.netty.util.collection.IntObjectMap;
import org.cloudburstmc.netty.channel.raknet.packet.EncapsulatedPacket;
import org.cloudburstmc.netty.channel.raknet.packet.RakDatagramPacket;

View File

@ -27,8 +27,8 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.IMultiValueDebugSampleLogImpl;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IMultiValueDebugSampleLogImpl;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.protocoltranslator.netty.ViaFabricPlusVLLegacyPipeline;
import io.netty.bootstrap.AbstractBootstrap;

View File

@ -21,7 +21,7 @@
package com.viaversion.viafabricplus.injection.mixin.base.connection;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import net.minecraft.client.network.ClientLoginNetworkHandler;
import net.minecraft.network.ClientConnection;
import net.minecraft.text.Text;

View File

@ -24,8 +24,8 @@ package com.viaversion.viafabricplus.injection.mixin.base.connection;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.viaversion.viafabricplus.injection.access.IMultiValueDebugSampleLogImpl;
import com.viaversion.viafabricplus.injection.access.IServerInfo;
import com.viaversion.viafabricplus.injection.access.base.IMultiValueDebugSampleLogImpl;
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
import net.minecraft.client.network.MultiplayerServerListPinger;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.network.ClientConnection;

View File

@ -23,10 +23,10 @@ package com.viaversion.viafabricplus.injection.mixin.base.integration;
import com.viaversion.viaversion.api.connection.ProtocolInfo;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viafabricplus.old.viaversion.BedrockJoinGameTracker;
import com.viaversion.viafabricplus.base.bedrock.BedrockJoinGameTracker;
import com.viaversion.viafabricplus.injection.ViaFabricPlusMixinPlugin;
import com.viaversion.viafabricplus.injection.access.IChunkTracker;
import com.viaversion.viafabricplus.injection.access.IRakSessionCodec;
import com.viaversion.viafabricplus.injection.access.base.bedrock.IChunkTracker;
import com.viaversion.viafabricplus.injection.access.base.bedrock.IRakSessionCodec;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
import com.viaversion.viafabricplus.util.ChatUtil;

View File

@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.integration;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.viaversion.viafabricplus.injection.access.IServerInfo;
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
import com.viaversion.viafabricplus.base.settings.impl.BedrockSettings;
import net.minecraft.client.network.MultiplayerServerListPinger;
import net.minecraft.client.network.ServerAddress;

View File

@ -22,8 +22,8 @@
package com.viaversion.viafabricplus.injection.mixin.base.integration;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.IServerInfo;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
import net.minecraft.SharedConstants;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.network.ClientConnection;

View File

@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.integration;
import com.llamalad7.mixinextras.sugar.Local;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.injection.access.IServerInfo;
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
import com.viaversion.viafabricplus.base.save.impl.SettingsSave;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.nbt.NbtCompound;

View File

@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.base.integration.bedrock;
import com.llamalad7.mixinextras.sugar.Local;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import net.minecraft.network.ClientConnection;
import net.raphimc.minecraftauth.step.bedrock.StepMCChain;

View File

@ -22,7 +22,7 @@
package com.viaversion.viafabricplus.injection.mixin.base.ui;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.injection.access.IServerInfo;
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
import com.viaversion.viafabricplus.screen.PerServerVersionScreen;
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
import net.minecraft.client.gui.screen.Screen;

View File

@ -21,7 +21,7 @@
package com.viaversion.viafabricplus.injection.mixin.base.ui;
import com.viaversion.viafabricplus.injection.access.IConfirmScreen;
import com.viaversion.viafabricplus.injection.access.base.bedrock.IConfirmScreen;
import net.minecraft.client.gui.screen.ConfirmScreen;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.*;

View File

@ -26,7 +26,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import de.florianmichael.classic4j.model.classicube.account.CCAccount;
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
import com.viaversion.viafabricplus.injection.access.IServerInfo;
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.protocoltranslator.impl.provider.vialegacy.ViaFabricPlusClassicMPPassProvider;
import com.viaversion.viafabricplus.protocoltranslator.util.ProtocolVersionDetector;

View File

@ -26,7 +26,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.viaversion.viafabricplus.base.settings.impl.BedrockSettings;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.injection.access.IServerInfo;
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.screen.ProtocolSelectionScreen;
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;

View File

@ -21,7 +21,7 @@
package com.viaversion.viafabricplus.injection.mixin.compat.classic4j;
import com.viaversion.viafabricplus.injection.access.ITextFieldWidget;
import com.viaversion.viafabricplus.injection.access.base.ITextFieldWidget;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.util.StringHelper;
import org.spongepowered.asm.mixin.Mixin;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft;
package com.viaversion.viafabricplus.injection.mixin.features.april_fools_8bit_sound;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import net.minecraft.client.sound.StaticSound;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.allow_duplicated_uuids;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -0,0 +1,43 @@
/*
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus
* Copyright (C) 2021-2024 the original authors
* - FlorianMichael/EnZaXD <florian.michael07@gmail.com>
* - RK_01/RaphiMC
* Copyright (C) 2023-2024 ViaVersion 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 com.viaversion.viafabricplus.injection.mixin.features.entity.enchantment_attributes;
import com.viaversion.viafabricplus.features.entity.enchantment_attributes.EnchantmentAttributesEmulation1_20_6;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.minecraft.entity.LivingEntity;
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(LivingEntity.class)
public abstract class MixinLivingEntity {
@Inject(method = "getVelocityMultiplier", at = @At("HEAD"))
private void setGenericMovementEfficiencyAttribute(CallbackInfoReturnable<Float> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {
EnchantmentAttributesEmulation1_20_6.setGenericMovementEfficiencyAttribute((LivingEntity) (Object) this);
}
}
}

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,10 +19,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.old.viaversion.WolfHealthTracker1_14_4;
import com.viaversion.viafabricplus.features.entity.metadata_handling.WolfHealthTracker1_14_4;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.FoodComponent;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.entity.metadata_sanity_handling;
package com.viaversion.viafabricplus.injection.mixin.features.entity.metadata_handling;
import com.viaversion.viaversion.legacy.bossbar.CommonBoss;
import org.spongepowered.asm.mixin.Mixin;

View File

@ -19,14 +19,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.entity.metadata_sanity_handling;
package com.viaversion.viafabricplus.injection.mixin.features.entity.metadata_handling;
import com.viaversion.viaversion.protocols.v1_14_3to1_14_4.packet.ClientboundPackets1_14_4;
import com.viaversion.viaversion.protocols.v1_14_4to1_15.Protocol1_14_4To1_15;
import com.viaversion.viaversion.protocols.v1_14_4to1_15.rewriter.EntityPacketRewriter1_15;
import com.viaversion.viaversion.rewriter.EntityRewriter;
import com.viaversion.viaversion.rewriter.entitydata.EntityDataFilter;
import com.viaversion.viafabricplus.old.viaversion.WolfHealthTracker1_14_4;
import com.viaversion.viafabricplus.features.entity.metadata_handling.WolfHealthTracker1_14_4;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.entity.metadata_sanity_handling;
package com.viaversion.viafabricplus.injection.mixin.features.entity.metadata_handling;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.entity.metadata_sanity_handling;
package com.viaversion.viafabricplus.injection.mixin.features.entity.metadata_handling;
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
import com.viaversion.viaversion.protocols.v1_8to1_9.storage.EntityTracker1_9;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.pose;
import com.mojang.authlib.GameProfile;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.entity.riding_offsets;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -22,7 +22,7 @@
package com.viaversion.viafabricplus.injection.mixin.features.entity.v1_8_boat;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.old.versioned.visual.EntityRidingOffsetsPre1_20_2;
import com.viaversion.viafabricplus.features.entity.riding_offsets.EntityRidingOffsetsPre1_20_2;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View File

@ -19,10 +19,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.text_rendering.non_existing_characters;
package com.viaversion.viafabricplus.injection.mixin.features.filter_non_existing_characters;
import com.viaversion.viafabricplus.features.text_rendering.non_existing_characters.RenderableGlyphDiff;
import com.viaversion.viafabricplus.features.text_rendering.non_existing_characters.BuiltinEmptyGlyph1_12_2;
import com.viaversion.viafabricplus.features.filter_non_existing_characters.RenderableGlyphDiff;
import com.viaversion.viafabricplus.features.filter_non_existing_characters.BuiltinEmptyGlyph1_12_2;
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.*;

View File

@ -19,9 +19,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.text_rendering.non_existing_characters;
package com.viaversion.viafabricplus.injection.mixin.features.filter_non_existing_characters;
import com.viaversion.viafabricplus.features.text_rendering.non_existing_characters.UnicodeFontFix1_12_2;
import com.viaversion.viafabricplus.features.filter_non_existing_characters.UnicodeFontFix1_12_2;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import net.minecraft.client.resource.language.LanguageManager;
import net.minecraft.resource.ResourceManager;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft;
package com.viaversion.viafabricplus.injection.mixin.features.instant_sneaking;
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
import net.minecraft.client.render.Camera;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.viaversion;
package com.viaversion.viafabricplus.injection.mixin.features.interaction;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.protocols.v1_21_2to1_21_4.rewriter.BlockItemPacketRewriter1_21_4;

View File

@ -30,7 +30,7 @@ import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ServerboundPac
import com.viaversion.viaversion.protocols.v1_16_4to1_17.Protocol1_16_4To1_17;
import com.viaversion.viafabricplus.features.interaction.ActionResultException1_12_2;
import com.viaversion.viafabricplus.features.interaction.ClientPlayerInteractionManager1_18_2;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.injection.access.IClientPlayerInteractionManager;
import com.viaversion.viafabricplus.injection.access.IScreenHandler;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.viaversion;
package com.viaversion.viafabricplus.injection.mixin.features.interaction;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;

View File

@ -0,0 +1,44 @@
/*
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus
* Copyright (C) 2021-2024 the original authors
* - FlorianMichael/EnZaXD <florian.michael07@gmail.com>
* - RK_01/RaphiMC
* Copyright (C) 2023-2024 ViaVersion 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 com.viaversion.viafabricplus.injection.mixin.features.interaction;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(MinecraftClient.class)
public abstract class MixinMinecraftClient {
@ModifyExpressionValue(method = "handleBlockBreaking", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z"))
private boolean allowBlockBreakAndItemUsageAtTheSameTime(boolean original) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_7_6) && original;
}
@ModifyExpressionValue(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z"))
private boolean allowItemUsageAndBlockBreakAtTheSameTime(boolean original) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_7_6) && original;
}
}

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen.screenhandler;
package com.viaversion.viafabricplus.injection.mixin.features.interaction;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.injection.access.IScreenHandler;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen.screenhandler;
package com.viaversion.viafabricplus.injection.mixin.features.interaction.inventory_clicking;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import net.minecraft.item.ItemStack;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen.screenhandler;
package com.viaversion.viafabricplus.injection.mixin.features.interaction.inventory_clicking;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen.screenhandler;
package com.viaversion.viafabricplus.injection.mixin.features.interaction.inventory_clicking;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen.screenhandler;
package com.viaversion.viafabricplus.injection.mixin.features.interaction.inventory_clicking;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.screen.screenhandler;
package com.viaversion.viafabricplus.injection.mixin.features.interaction.merchant_emulation;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.item;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item;
package com.viaversion.viafabricplus.injection.mixin.features.item.cooldown;
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
import net.minecraft.entity.player.ItemCooldownManager;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.item.swinging;
package com.viaversion.viafabricplus.injection.mixin.features.item.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.item.swinging;
package com.viaversion.viafabricplus.injection.mixin.features.item.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.item.swinging;
package com.viaversion.viafabricplus.injection.mixin.features.item.interactions;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item;
package com.viaversion.viafabricplus.injection.mixin.features.item.missing_model;
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
import net.minecraft.client.item.ItemModelManager;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.item;
package com.viaversion.viafabricplus.injection.mixin.features.item.v1_7_tilt;
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
import net.minecraft.client.network.AbstractClientPlayerEntity;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft;
package com.viaversion.viafabricplus.injection.mixin.features.legacy_skin_loading;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.yggdrasil.ProfileResult;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
package com.viaversion.viafabricplus.injection.mixin.features.movement.entity;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.ui.chat_indicator;
package com.viaversion.viafabricplus.injection.mixin.features.networking.legacy_chat_signatures;
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
import net.minecraft.client.gui.hud.ChatHud;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.ui.chat_indicator;
package com.viaversion.viafabricplus.injection.mixin.features.networking.legacy_chat_signatures;
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
import net.minecraft.client.gui.hud.ChatHud;

View File

@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.networking.legacy_
import com.llamalad7.mixinextras.sugar.Local;
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.injection.access.legacy_chat_signatures.ILegacyKeySignatureStorage;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viaversion.api.connection.UserConnection;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.features.text_rendering;
package com.viaversion.viafabricplus.injection.mixin.features.strike_through_offset;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.injection.mixin.old.viaversion;
package com.viaversion.viafabricplus.injection.mixin.features.swinging;
import com.viaversion.viaversion.protocols.v1_15_2to1_16.storage.InventoryTracker1_16;
import org.spongepowered.asm.mixin.Mixin;

View File

@ -0,0 +1,81 @@
/*
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus
* Copyright (C) 2021-2024 the original authors
* - FlorianMichael/EnZaXD <florian.michael07@gmail.com>
* - RK_01/RaphiMC
* Copyright (C) 2023-2024 ViaVersion 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 com.viaversion.viafabricplus.injection.mixin.features.swinging;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import org.jetbrains.annotations.Nullable;
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.CallbackInfoReturnable;
@Mixin(MinecraftClient.class)
public abstract class MixinMinecraftClient {
@Shadow
@Nullable
public ClientPlayerEntity player;
@WrapWithCondition(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
private boolean disableSwing(ClientPlayerEntity instance, Hand hand) {
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15);
}
@Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult$Success;swingSource()Lnet/minecraft/util/ActionResult$SwingSource;", ordinal = 0))
private ActionResult.SwingSource disableSwing(ActionResult.Success instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
return ActionResult.SwingSource.NONE;
} else {
return instance.swingSource();
}
}
@Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult$Success;swingSource()Lnet/minecraft/util/ActionResult$SwingSource;", ordinal = 2))
private ActionResult.SwingSource disableSwing2(ActionResult.Success instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
return ActionResult.SwingSource.NONE;
} else {
return instance.swingSource();
}
}
@Inject(method = "doAttack", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;crosshairTarget:Lnet/minecraft/util/hit/HitResult;", shift = At.Shift.BEFORE, ordinal = 0))
private void fixSwingPacketOrder(CallbackInfoReturnable<Boolean> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
this.player.swingHand(Hand.MAIN_HAND);
}
}
@WrapWithCondition(method = "doAttack", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
private boolean fixSwingPacketOrder(ClientPlayerEntity instance, Hand hand) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_8);
}
}

View File

@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.injection.mixin.features.ui.disable_server_
import com.google.common.collect.Lists;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.injection.access.IServerInfo;
import com.viaversion.viafabricplus.injection.access.base.IServerInfo;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.base.settings.impl.GeneralSettings;
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;

View File

@ -21,7 +21,7 @@
package com.viaversion.viafabricplus.injection.mixin.features.world.always_tick_entities;
import com.viaversion.viafabricplus.injection.access.IEntity;
import com.viaversion.viafabricplus.injection.access.world.always_tick_entities.IEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;

View File

@ -19,20 +19,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.old.viaversion;
package com.viaversion.viafabricplus.injection.mixin.features.world.always_tick_entities;
import com.viaversion.viaversion.api.connection.StorableObject;
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
import com.viaversion.viafabricplus.injection.access.world.always_tick_entities.IEntity;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
public class TeleportTracker1_7_6_10 implements StorableObject {
@Mixin(Entity.class)
public abstract class MixinEntity implements IEntity {
private Boolean onGround = null;
@Unique
private boolean viaFabricPlus$isInLoadedChunkAndShouldTick;
public Boolean getPending() {
return onGround;
@Override
public boolean viaFabricPlus$isInLoadedChunkAndShouldTick() {
return this.viaFabricPlus$isInLoadedChunkAndShouldTick || DebugSettings.global().alwaysTickClientPlayer.isEnabled();
}
public void setPending(Boolean onGround) {
this.onGround = onGround;
@Override
public void viaFabricPlus$setInLoadedChunkAndShouldTick(final boolean inLoadedChunkAndShouldTick) {
this.viaFabricPlus$isInLoadedChunkAndShouldTick = inLoadedChunkAndShouldTick;
}
}

View File

@ -23,7 +23,7 @@ package com.viaversion.viafabricplus.injection.mixin.integration.viabedrock;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viafabricplus.old.viaversion.BedrockJoinGameTracker;
import com.viaversion.viafabricplus.base.bedrock.BedrockJoinGameTracker;
import net.raphimc.viabedrock.protocol.packet.JoinPackets;
import net.raphimc.viabedrock.protocol.types.primitive.LongLEType;
import net.raphimc.viabedrock.protocol.types.primitive.StringType;

View File

@ -53,29 +53,6 @@ public abstract class MixinMinecraftClient {
@Shadow
protected int attackCooldown;
@WrapWithCondition(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
private boolean disableSwing(ClientPlayerEntity instance, Hand hand) {
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_15);
}
@Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult$Success;swingSource()Lnet/minecraft/util/ActionResult$SwingSource;", ordinal = 0))
private ActionResult.SwingSource disableSwing(ActionResult.Success instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
return ActionResult.SwingSource.NONE;
} else {
return instance.swingSource();
}
}
@Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ActionResult$Success;swingSource()Lnet/minecraft/util/ActionResult$SwingSource;", ordinal = 2))
private ActionResult.SwingSource disableSwing2(ActionResult.Success instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
return ActionResult.SwingSource.NONE;
} else {
return instance.swingSource();
}
}
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/tutorial/TutorialManager;onInventoryOpened()V", shift = At.Shift.AFTER))
private void sendOpenInventoryPacket(CallbackInfo ci) {
if (DebugSettings.global().sendOpenInventoryPacket.isEnabled()) {
@ -85,18 +62,6 @@ public abstract class MixinMinecraftClient {
}
}
@Inject(method = "doAttack", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;crosshairTarget:Lnet/minecraft/util/hit/HitResult;", shift = At.Shift.BEFORE, ordinal = 0))
private void fixSwingPacketOrder(CallbackInfoReturnable<Boolean> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
this.player.swingHand(Hand.MAIN_HAND);
}
}
@WrapWithCondition(method = "doAttack", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
private boolean fixSwingPacketOrder(ClientPlayerEntity instance, Hand hand) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_8);
}
@Redirect(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;attackCooldown:I", ordinal = 1))
private int moveCooldownIncrement(MinecraftClient instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
@ -115,14 +80,4 @@ public abstract class MixinMinecraftClient {
}
}
@ModifyExpressionValue(method = "handleBlockBreaking", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z"))
private boolean allowBlockBreakAndItemUsageAtTheSameTime(boolean original) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_7_6) && original;
}
@ModifyExpressionValue(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z"))
private boolean allowItemUsageAndBlockBreakAtTheSameTime(boolean original) {
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_7_6) && original;
}
}

View File

@ -27,7 +27,7 @@ import com.mojang.authlib.GameProfile;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
import net.minecraft.client.MinecraftClient;

View File

@ -22,10 +22,8 @@
package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.old.versioned.visual.EntityRidingOffsetsPre1_20_2;
import com.viaversion.viafabricplus.injection.access.IEntity;
import com.viaversion.viafabricplus.features.entity.riding_offsets.EntityRidingOffsetsPre1_20_2;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
import it.unimi.dsi.fastutil.objects.Object2DoubleMap;
import net.minecraft.block.BlockState;
import net.minecraft.block.FenceGateBlock;
@ -44,7 +42,6 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@ -53,7 +50,7 @@ import java.util.List;
@SuppressWarnings("ConstantValue")
@Mixin(Entity.class)
public abstract class MixinEntity implements IEntity {
public abstract class MixinEntity {
@Shadow
private World world;
@ -85,9 +82,6 @@ public abstract class MixinEntity implements IEntity {
@Shadow
public abstract float getStepHeight();
@Unique
private boolean viaFabricPlus$isInLoadedChunkAndShouldTick;
@Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;lengthSquared()D", ordinal = 1), slice = @Slice(
from = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;adjustMovementForCollisions(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;")
))
@ -301,14 +295,4 @@ public abstract class MixinEntity implements IEntity {
}
}
@Override
public boolean viaFabricPlus$isInLoadedChunkAndShouldTick() {
return this.viaFabricPlus$isInLoadedChunkAndShouldTick || DebugSettings.global().alwaysTickClientPlayer.isEnabled();
}
@Override
public void viaFabricPlus$setInLoadedChunkAndShouldTick(final boolean inLoadedChunkAndShouldTick) {
this.viaFabricPlus$isInLoadedChunkAndShouldTick = inLoadedChunkAndShouldTick;
}
}

View File

@ -23,8 +23,8 @@ package com.viaversion.viafabricplus.injection.mixin.old.minecraft.entity;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.old.versioned.EnchantmentAttributesEmulation1_20_6;
import com.viaversion.viafabricplus.old.versioned.visual.EntityRidingOffsetsPre1_20_2;
import com.viaversion.viafabricplus.features.entity.enchantment_attributes.EnchantmentAttributesEmulation1_20_6;
import com.viaversion.viafabricplus.features.entity.riding_offsets.EntityRidingOffsetsPre1_20_2;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import com.viaversion.viafabricplus.base.settings.impl.DebugSettings;
import com.viaversion.viafabricplus.base.settings.impl.VisualSettings;
@ -81,13 +81,6 @@ public abstract class MixinLivingEntity extends Entity {
super(type, world);
}
@Inject(method = "getVelocityMultiplier", at = @At("HEAD"))
private void setGenericMovementEfficiencyAttribute(CallbackInfoReturnable<Float> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {
EnchantmentAttributesEmulation1_20_6.setGenericMovementEfficiencyAttribute((LivingEntity) (Object) this);
}
}
@ModifyExpressionValue(method = "tickStatusEffects", at = @At(value = "CONSTANT", args = "intValue=4"))
private int changeParticleDensity(int original) {
if (ProtocolTranslator.getTargetVersion().olderThan(ProtocolVersion.v1_20_5)) {

View File

@ -1,86 +0,0 @@
/*
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus
* Copyright (C) 2021-2024 the original authors
* - FlorianMichael/EnZaXD <florian.michael07@gmail.com>
* - RK_01/RaphiMC
* Copyright (C) 2023-2024 ViaVersion 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 com.viaversion.viafabricplus.injection.mixin.old.vialegacy;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8;
import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ServerboundPackets1_8;
import com.viaversion.viafabricplus.old.viaversion.TeleportTracker1_7_6_10;
import net.raphimc.vialegacy.protocol.release.r1_7_2_5tor1_7_6_10.packet.ClientboundPackets1_7_2;
import net.raphimc.vialegacy.protocol.release.r1_7_2_5tor1_7_6_10.packet.ServerboundPackets1_7_2;
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.Protocolr1_7_6_10Tor1_8;
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 = Protocolr1_7_6_10Tor1_8.class, remap = false)
public abstract class MixinProtocolr1_7_6_10Tor1_8 extends AbstractProtocol<ClientboundPackets1_7_2, ClientboundPackets1_8, ServerboundPackets1_7_2, ServerboundPackets1_8> {
@Inject(method = "registerPackets", at = @At("RETURN"))
private void addTeleportTracker(CallbackInfo ci) {
this.registerClientbound(ClientboundPackets1_7_2.PLAYER_POSITION, ClientboundPackets1_8.PLAYER_POSITION, new PacketHandlers() {
@Override
public void register() {
map(Types.DOUBLE); // x
map(Types.DOUBLE, Types.DOUBLE, stance -> stance - 1.62F); // y
map(Types.DOUBLE); // z
map(Types.FLOAT); // yaw
map(Types.FLOAT); // pitch
handler(wrapper -> {
final boolean onGround = wrapper.read(Types.BOOLEAN); // On Ground
final TeleportTracker1_7_6_10 teleportTracker = wrapper.user().get(TeleportTracker1_7_6_10.class);
if (teleportTracker != null) {
teleportTracker.setPending(onGround);
}
wrapper.write(Types.BYTE, (byte) 0); // flags
});
}
}, true);
this.registerServerbound(ServerboundPackets1_8.MOVE_PLAYER_POS_ROT, ServerboundPackets1_7_2.MOVE_PLAYER_POS_ROT, new PacketHandlers() {
@Override
public void register() {
map(Types.DOUBLE); // x
map(Types.DOUBLE); // y
handler(wrapper -> wrapper.write(Types.DOUBLE, wrapper.get(Types.DOUBLE, 1) + 1.62)); // stance
map(Types.DOUBLE); // z
map(Types.FLOAT); // yaw
map(Types.FLOAT); // pitch
map(Types.BOOLEAN); // onGround
handler(wrapper -> {
final TeleportTracker1_7_6_10 teleportTracker = wrapper.user().get(TeleportTracker1_7_6_10.class);
if (teleportTracker != null) {
Boolean pendingTeleport = teleportTracker.getPending();
if (pendingTeleport != null) {
wrapper.set(Types.BOOLEAN, 0, pendingTeleport);
teleportTracker.setPending(null);
}
}
});
}
}, true);
}
}

View File

@ -36,8 +36,8 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.protocol.version.VersionType;
import com.viaversion.viaversion.connection.UserConnectionImpl;
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
import com.viaversion.viafabricplus.old.viaversion.ViaFabricPlusProtocol;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.protocoltranslator.protocol.ViaFabricPlusProtocol;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.protocoltranslator.impl.command.ViaFabricPlusVLCommandHandler;
import com.viaversion.viafabricplus.protocoltranslator.impl.platform.ViaFabricPlusViaLegacyPlatformImpl;
import com.viaversion.viafabricplus.protocoltranslator.impl.platform.ViaFabricPlusViaVersionPlatformImpl;
@ -63,9 +63,7 @@ import net.raphimc.vialoader.impl.platform.ViaAprilFoolsPlatformImpl;
import net.raphimc.vialoader.impl.platform.ViaBackwardsPlatformImpl;
import net.raphimc.vialoader.impl.platform.ViaBedrockPlatformImpl;
import org.cloudburstmc.netty.channel.raknet.config.RakChannelOption;
import org.jetbrains.annotations.ApiStatus;
import java.io.File;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Path;

View File

@ -22,7 +22,7 @@
package com.viaversion.viafabricplus.protocoltranslator.impl.command.classic;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viafabricplus.injection.access.IExtensionProtocolMetadataStorage;
import com.viaversion.viafabricplus.injection.access.base.IExtensionProtocolMetadataStorage;
import com.viaversion.viafabricplus.protocoltranslator.impl.command.VFPViaSubCommand;
import net.minecraft.util.Formatting;
import net.raphimc.vialegacy.api.LegacyProtocolVersion;

View File

@ -22,7 +22,7 @@
package com.viaversion.viafabricplus.protocoltranslator.impl.provider.vialegacy;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viafabricplus.injection.access.IClientConnection;
import com.viaversion.viafabricplus.injection.access.base.IClientConnection;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import net.raphimc.vialegacy.protocol.release.r1_6_4tor1_7_2_5.provider.EncryptionProvider;

View File

@ -24,7 +24,7 @@ package com.viaversion.viafabricplus.protocoltranslator.netty;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
import com.viaversion.viafabricplus.old.viaversion.ViaFabricPlusProtocol;
import com.viaversion.viafabricplus.protocoltranslator.protocol.ViaFabricPlusProtocol;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.network.handler.HandlerNames;

View File

@ -19,8 +19,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viafabricplus.old.viaversion;
package com.viaversion.viafabricplus.protocoltranslator.protocol;
import com.viaversion.viafabricplus.base.bedrock.BedrockJoinGameTracker;
import com.viaversion.viafabricplus.features.entity.metadata_handling.WolfHealthTracker1_14_4;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
@ -106,13 +108,8 @@ public class ViaFabricPlusProtocol extends AbstractSimpleProtocol {
// Add storages we need for different fixes here
if (serverVersion.equals(BedrockProtocolVersion.bedrockLatest)) {
connection.put(new BedrockJoinGameTracker());
} else {
if (serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
connection.put(new WolfHealthTracker1_14_4());
}
if (serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
connection.put(new TeleportTracker1_7_6_10());
}
} else if (serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
connection.put(new WolfHealthTracker1_14_4());
}
}

View File

@ -33,7 +33,7 @@ import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.protocols.v1_12to1_12_1.packet.ClientboundPackets1_12_1;
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
import com.viaversion.viafabricplus.old.viaversion.ViaFabricPlusProtocol;
import com.viaversion.viafabricplus.protocoltranslator.protocol.ViaFabricPlusProtocol;
import com.viaversion.viafabricplus.protocoltranslator.ProtocolTranslator;
import io.netty.buffer.Unpooled;
import net.minecraft.client.MinecraftClient;

Some files were not shown because too many files have changed in this diff Show More