mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-22 11:56:21 +01:00
1.19.4 port
This commit is contained in:
parent
9085acc657
commit
1c46fab9b0
@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# minecraft and fabric
|
||||
minecraft_version=1.19.3
|
||||
yarn_mappings=1.19.3+build.5
|
||||
loader_version=0.14.14
|
||||
fabric_api_version=0.74.0+1.19.3
|
||||
minecraft_version=1.19.4
|
||||
yarn_mappings=1.19.4+build.1
|
||||
loader_version=0.14.17
|
||||
fabric_api_version=0.76.0+1.19.4
|
||||
|
||||
# viafabricplus
|
||||
mod_version=2.1.1
|
||||
|
@ -17,12 +17,12 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.definition;
|
||||
|
||||
import com.mojang.bridge.game.PackType;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.GameVersion;
|
||||
import net.minecraft.SaveVersion;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@ -32,6 +32,7 @@ public class PackFormatsDefinition {
|
||||
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
|
||||
|
||||
public static void load() {
|
||||
registerVersion(ProtocolVersion.v1_19_4, 12, "1.19.4");
|
||||
registerVersion(ProtocolVersion.v1_19_3, 12, "1.19.3");
|
||||
registerVersion(ProtocolVersion.v1_19_1, 9, "1.19.2");
|
||||
registerVersion(ProtocolVersion.v1_19, 9, "1.19");
|
||||
@ -78,7 +79,7 @@ public class PackFormatsDefinition {
|
||||
}
|
||||
|
||||
final GameVersion gameVersion = protocolMap.get(nativeVersion);
|
||||
if (!gameVersion.getName().equals(SharedConstants.getGameVersion().getName()) || !gameVersion.getId().equals(SharedConstants.getGameVersion().getId()) || gameVersion.getPackVersion(PackType.RESOURCE) != SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)) {
|
||||
if (!gameVersion.getName().equals(SharedConstants.getGameVersion().getName()) || !gameVersion.getId().equals(SharedConstants.getGameVersion().getId()) || gameVersion.getResourceVersion(ResourceType.SERVER_DATA) != SharedConstants.getGameVersion().getResourceVersion(ResourceType.SERVER_DATA)) {
|
||||
throw new RuntimeException("The current version has no pack format registered");
|
||||
}
|
||||
}
|
||||
@ -116,8 +117,8 @@ public class PackFormatsDefinition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPackVersion(PackType packType) {
|
||||
if (packType == PackType.RESOURCE) {
|
||||
public int getResourceVersion(ResourceType type) {
|
||||
if (type == ResourceType.SERVER_DATA) {
|
||||
return packFormat;
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -162,7 +162,7 @@ public class ClassicItemSelectionScreen extends Screen {
|
||||
final int renderY = halfHeight - boxHeight / 2;
|
||||
|
||||
fill(matrices, renderX, renderY, renderX + boxWidth, renderY + boxHeight, Integer.MIN_VALUE);
|
||||
drawCenteredText(matrices, textRenderer, "Select block", renderX + boxWidth / 2, renderY + SIDE_OFFSET, -1);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "Select block", renderX + boxWidth / 2, renderY + SIDE_OFFSET, -1);
|
||||
selectedItem = null;
|
||||
|
||||
int y = SIDE_OFFSET + SIDE_OFFSET;
|
||||
@ -175,7 +175,7 @@ public class ClassicItemSelectionScreen extends Screen {
|
||||
fill(matrices, renderX + x, renderY + y, renderX + x + ITEM_XY_BOX_DIMENSION_CLASSIC, renderY + y + ITEM_XY_BOX_DIMENSION_CLASSIC, Integer.MAX_VALUE);
|
||||
selectedItem = item.getDefaultStack();
|
||||
}
|
||||
MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(item.getDefaultStack(), renderX + x + ITEM_XY_BOX_DIMENSION_MODERN / 4, renderY + y + ITEM_XY_BOX_DIMENSION_MODERN / 4);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(matrices, item.getDefaultStack(), renderX + x + ITEM_XY_BOX_DIMENSION_MODERN / 4, renderY + y + ITEM_XY_BOX_DIMENSION_MODERN / 4);
|
||||
x += ITEM_XY_BOX_DIMENSION_CLASSIC;
|
||||
}
|
||||
y += ITEM_XY_BOX_DIMENSION_CLASSIC;
|
||||
|
@ -35,7 +35,7 @@ public class ClassicProgressRenderer extends DrawableHelper {
|
||||
if (classicProgressStorage == null) return;
|
||||
|
||||
final Window window = MinecraftClient.getInstance().getWindow();
|
||||
drawCenteredText(
|
||||
drawCenteredTextWithShadow(
|
||||
matrices,
|
||||
MinecraftClient.getInstance().textRenderer,
|
||||
"[ViaFabricPlus] " + classicProgressStorage.status,
|
||||
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.access;
|
||||
|
||||
import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
|
||||
|
||||
public interface IItemGroup_DisplayContext {
|
||||
|
||||
ComparableProtocolVersion viafabricplus_getVersion();
|
||||
void viafabricplus_setVersion(final ComparableProtocolVersion comparableProtocolVersion);
|
||||
|
||||
boolean viafabricplus_isState();
|
||||
void viafabricplus_setState(final boolean state);
|
||||
}
|
@ -30,9 +30,9 @@ import io.netty.channel.epoll.EpollDatagramChannel;
|
||||
import io.netty.channel.epoll.EpollSocketChannel;
|
||||
import io.netty.channel.socket.nio.NioDatagramChannel;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.encryption.PacketDecryptor;
|
||||
import net.minecraft.network.encryption.PacketEncryptor;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.viabedrock.netty.AesGcmEncryption;
|
||||
import net.raphimc.viabedrock.netty.SnappyCompression;
|
||||
|
@ -27,7 +27,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(Main.class)
|
||||
public class MixinMain {
|
||||
|
||||
@Inject(method = "main([Ljava/lang/String;Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/crash/CrashReport;initCrashReport()V"))
|
||||
@Inject(method = "main", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/crash/CrashReport;initCrashReport()V"))
|
||||
private static void preLoad(CallbackInfo ci) {
|
||||
ViaFabricPlus.INSTANCE.init();
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.bridge;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.screen.settings.SettingsScreen;
|
||||
import de.florianmichael.viafabricplus.settings.groups.BridgeSettings;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -27,16 +26,12 @@ import net.minecraft.client.gui.screen.option.OptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.GridWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(OptionsScreen.class)
|
||||
public abstract class MixinOptionsScreen extends Screen {
|
||||
|
||||
@ -44,16 +39,10 @@ public abstract class MixinOptionsScreen extends Screen {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Shadow protected abstract ButtonWidget createButton(Text message, Supplier<Screen> screenSupplier);
|
||||
|
||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/ClickableWidget;)Lnet/minecraft/client/gui/widget/ClickableWidget;", ordinal = 10, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;", ordinal = 10, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void addValuesButton(CallbackInfo ci, GridWidget gridWidget, GridWidget.Adder adder) {
|
||||
if (BridgeSettings.INSTANCE.optionsButtonInGameOptions.getValue()) {
|
||||
adder.add(this.createButton(Text.literal("ViaFabricPlus").styled(style -> style.withColor(Formatting.GOLD)).append(" ").append("Settings..."), () -> SettingsScreen.get((OptionsScreen) (Object) this)));
|
||||
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && MinecraftClient.getInstance().player != null) {
|
||||
if (BridgeSettings.INSTANCE.showSuperSecretSettings.getValue() && MinecraftClient.getInstance().player != null) {
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.literal("Super Secret Settings..."), button -> MinecraftClient.getInstance().gameRenderer.cycleSuperSecretSetting()).dimensions(this.width / 2 + 5, this.height / 6 + 18, 150, 20).build());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
@Inject(method = "onPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
private void onPing(PlayPingS2CPacket packet, CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isNewerThanOrEqualTo(ProtocolVersion.v1_17)) {
|
||||
return;
|
||||
|
@ -35,7 +35,7 @@ import net.minecraft.client.network.ClientPlayerInteractionManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
import net.minecraft.util.ActionResult;
|
||||
@ -97,7 +97,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
return type == SlotActionType.PICKUP && slot == -999;
|
||||
}
|
||||
|
||||
@Redirect(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V"))
|
||||
@Redirect(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V"))
|
||||
private void modifySlotClickPacket(ClientPlayNetworkHandler instance, Packet<?> packet) {
|
||||
try {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) {
|
||||
@ -133,7 +133,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
instance.sendPacket(packet);
|
||||
}
|
||||
|
||||
@Redirect(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 0),
|
||||
@Redirect(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 0),
|
||||
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;sendSequencedPacket(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/network/SequencedPacketCreator;)V", ordinal = 0)))
|
||||
private void redirectInteractItem(ClientPlayNetworkHandler clientPlayNetworkHandler, Packet<?> packet) {
|
||||
@ -142,7 +142,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 0, shift = At.Shift.BEFORE))
|
||||
@Inject(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 0, shift = At.Shift.BEFORE))
|
||||
public void injectInteractItem(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
||||
ViaFabricPlusHandItemProvider.lastUsedItem = player.getStackInHand(hand).copy();
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public abstract class MixinEntity {
|
||||
@Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true)
|
||||
public void injectGetVelocityAffectingPos(CallbackInfoReturnable<BlockPos> cir) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
cir.setReturnValue(new BlockPos(pos.x, getBoundingBox().minY - 1, pos.z));
|
||||
cir.setReturnValue(BlockPos.ofFloored(pos.x, getBoundingBox().minY - 1, pos.z));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class MixinHeldItemRenderer {
|
||||
|
||||
@Inject(method = "renderFirstPersonItem",
|
||||
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;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V"))
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V"))
|
||||
private void onRenderFirstPersonItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
|
||||
//noinspection DataFlowIssue
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && client.player.isBlocking()) {
|
||||
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import de.florianmichael.viafabricplus.injection.access.IItemGroup_DisplayContext;
|
||||
import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.resource.featuretoggle.FeatureSet;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ItemGroup.DisplayContext.class)
|
||||
public class MixinItemGroup_DisplayContext implements IItemGroup_DisplayContext {
|
||||
|
||||
@Unique
|
||||
private static ComparableProtocolVersion viafabricplus_version;
|
||||
|
||||
@Unique
|
||||
private static boolean viafabricplus_state;
|
||||
|
||||
@Redirect(method = "doesNotMatch", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/featuretoggle/FeatureSet;equals(Ljava/lang/Object;)Z"))
|
||||
private boolean adjustLastVersionMatchCheck(FeatureSet instance, Object o) {
|
||||
return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getClassWrapper().getTargetVersion() && viafabricplus_state == GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComparableProtocolVersion viafabricplus_getVersion() {
|
||||
return viafabricplus_version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viafabricplus_setVersion(ComparableProtocolVersion comparableProtocolVersion) {
|
||||
viafabricplus_version = comparableProtocolVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean viafabricplus_isState() {
|
||||
return viafabricplus_state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viafabricplus_setState(boolean state) {
|
||||
viafabricplus_state = state;
|
||||
}
|
||||
}
|
@ -17,12 +17,17 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import de.florianmichael.viafabricplus.injection.access.IItemGroup_DisplayContext;
|
||||
import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.platform.ComparableProtocolVersion;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.resource.featuretoggle.FeatureSet;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -32,20 +37,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(ItemGroups.class)
|
||||
public class MixinItemGroups {
|
||||
|
||||
@Unique
|
||||
private static ComparableProtocolVersion viafabricplus_version;
|
||||
@Shadow @Nullable private static ItemGroup.@Nullable DisplayContext displayContext;
|
||||
|
||||
@Unique
|
||||
private static boolean viafabricplus_state;
|
||||
@Inject(method = "updateDisplayContext", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroups;updateEntries(Lnet/minecraft/item/ItemGroup$DisplayContext;)V", shift = At.Shift.BEFORE))
|
||||
private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, RegistryWrapper.WrapperLookup lookup, CallbackInfoReturnable<Boolean> cir) {
|
||||
final IItemGroup_DisplayContext accessor = (IItemGroup_DisplayContext) (Object) displayContext;
|
||||
|
||||
@Redirect(method = "displayParametersMatch", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/featuretoggle/FeatureSet;equals(Ljava/lang/Object;)Z"))
|
||||
private static boolean adjustLastVersionMatchCheck(FeatureSet instance, Object o) {
|
||||
return instance.equals(o) && viafabricplus_version == ViaLoadingBase.getClassWrapper().getTargetVersion() && viafabricplus_state == GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue();
|
||||
}
|
||||
|
||||
@Inject(method = "updateDisplayParameters", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroups;updateEntries(Lnet/minecraft/resource/featuretoggle/FeatureSet;Z)V", shift = At.Shift.BEFORE))
|
||||
private static void trackLastVersion(FeatureSet enabledFeatures, boolean operatorEnabled, CallbackInfoReturnable<Boolean> cir) {
|
||||
viafabricplus_version = ViaLoadingBase.getClassWrapper().getTargetVersion();
|
||||
viafabricplus_state = GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue();
|
||||
accessor.viafabricplus_setVersion(ViaLoadingBase.getClassWrapper().getTargetVersion());
|
||||
accessor.viafabricplus_setState(GeneralSettings.INSTANCE.removeNotAvailableItemsFromCreativeTab.getValue());
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class MixinConnectScreen_1 {
|
||||
return instance.getPort();
|
||||
}
|
||||
|
||||
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;send(Lnet/minecraft/network/Packet;)V", ordinal = 1, shift = At.Shift.BEFORE))
|
||||
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;send(Lnet/minecraft/network/packet/Packet;)V", ordinal = 1, shift = At.Shift.BEFORE))
|
||||
public void setupConnectionSessions(CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_19)) {
|
||||
return; // This disables the chat session emulation for all versions <= 1.18.2
|
||||
|
@ -18,6 +18,8 @@
|
||||
package de.florianmichael.viafabricplus.screen;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.screen.settings.SettingsScreen;
|
||||
import de.florianmichael.viafabricplus.settings.groups.GeneralSettings;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import de.florianmichael.vialoadingbase.platform.InternalProtocolList;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -52,6 +54,8 @@ public class ProtocolSelectionScreen extends Screen {
|
||||
|
||||
this.addDrawableChild(new SlotList(this.client, width, height, 3 + 3 /* start offset */ + (textRenderer.fontHeight + 2) * 3 /* title is 2 */, height + 5, textRenderer.fontHeight + 4));
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.literal("<-"), button -> this.close()).position(0, height - 20).size(20, 20).build());
|
||||
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.literal("Settings"), button -> client.setScreen(SettingsScreen.get(this))).position(0, 0).size(98, 20).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,9 +64,9 @@ public class ProtocolSelectionScreen extends Screen {
|
||||
|
||||
matrices.push();
|
||||
matrices.scale(2F, 2F, 2F);
|
||||
drawCenteredText(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
matrices.pop();
|
||||
drawCenteredText(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -106,7 +110,7 @@ public class ProtocolSelectionScreen extends Screen {
|
||||
matrices.translate(x, y - 1, 0);
|
||||
|
||||
final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
drawCenteredText(matrices, textRenderer, this.protocolVersion.getName(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, isSelected ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, this.protocolVersion.getName(), entryWidth / 2, entryHeight / 2 - textRenderer.fontHeight / 2, isSelected ? Color.GREEN.getRGB() : Color.RED.getRGB());
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ public class SettingsScreen extends Screen {
|
||||
|
||||
matrices.push();
|
||||
matrices.scale(2F, 2F, 2F);
|
||||
drawCenteredText(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "ViaFabricPlus", width / 4, 3, Color.ORANGE.getRGB());
|
||||
matrices.pop();
|
||||
drawCenteredText(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, "https://github.com/FlorianMichael/ViaFabricPlus", width / 2, (textRenderer.fontHeight + 2) * 2 + 3, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,7 +23,7 @@ import de.florianmichael.viafabricplus.settings.type_impl.BooleanSetting;
|
||||
public class BridgeSettings extends SettingGroup {
|
||||
public final static BridgeSettings INSTANCE = new BridgeSettings();
|
||||
|
||||
public final BooleanSetting optionsButtonInGameOptions = new BooleanSetting(this, "Options button in game options", true);
|
||||
public final BooleanSetting showSuperSecretSettings = new BooleanSetting(this, "Show Super Secret Settings", true);
|
||||
public final BooleanSetting showExtraInformationInDebugHud = new BooleanSetting(this, "Show extra information in Debug Hud", true);
|
||||
public final BooleanSetting showClassicLoadingProgressInConnectScreen = new BooleanSetting(this, "Show classic loading progress in connect screen", true);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"client": [
|
||||
"base.MixinClientConnection",
|
||||
"base.MixinClientConnection_1",
|
||||
"base.MixinClientLoginNetworkHandler",
|
||||
"base.MixinMain",
|
||||
"base.MixinMinecraftClient",
|
||||
@ -28,6 +29,7 @@
|
||||
"fixes.minecraft.MixinServerAddress",
|
||||
"fixes.minecraft.MixinServerResourcePackProvider",
|
||||
"fixes.minecraft.MixinStringHelper",
|
||||
"fixes.minecraft.block.MixinAbstractBlock",
|
||||
"fixes.minecraft.block.MixinAbstractBlock_AbstractBlockState",
|
||||
"fixes.minecraft.block.MixinAnvilBlock",
|
||||
"fixes.minecraft.block.MixinBambooBlock",
|
||||
@ -139,11 +141,12 @@
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinEntityTracker1_9",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinMetadataRewriter1_9To1_8",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinMovementTracker",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
|
||||
"base.MixinClientConnection_1",
|
||||
"fixes.minecraft.block.MixinAbstractBlock"
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
},
|
||||
"mixins": [
|
||||
"fixes.minecraft.item.MixinItemGroup_DisplayContext"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user