mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-25 22:11:32 +01:00
Merge remote-tracking branch 'origin/main' into 1.20.2-recode
This commit is contained in:
commit
2f9dc58613
@ -35,6 +35,7 @@ ViaFabricPlus is intended to replace [multiconnect](https://github.com/Earthcomp
|
||||
|
||||
### Conflicts
|
||||
- ***[DashLoader (*)](https://github.com/alphaqu/DashLoader/tree/fabric-1.20)*** - Font rendering related fixes aren't working
|
||||
- ***[Armor Skin (*)](https://github.com/IzzyDotExe/ArmorSkin)*** - Beta HUD changes aren't working
|
||||
|
||||
## List of all clientside related fixes and TODO
|
||||
<details>
|
||||
|
@ -22,13 +22,12 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.ArmorType;
|
||||
import de.florianmichael.viafabricplus.base.event.ChangeProtocolVersionCallback;
|
||||
import de.florianmichael.viafabricplus.base.event.FinishMinecraftLoadCallback;
|
||||
import de.florianmichael.viafabricplus.base.event.LoadClassicProtocolExtensionCallback;
|
||||
import de.florianmichael.viafabricplus.injection.MixinPlugin;
|
||||
import de.florianmichael.viafabricplus.injection.access.IFontStorage;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.FontStorage;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
@ -57,11 +56,6 @@ public class ClientsideFixes {
|
||||
*/
|
||||
public final static VersionRange LEGACY_SRV_RESOLVE = VersionRange.andOlder(VersionEnum.r1_2_4tor1_2_5).add(VersionRange.single(VersionEnum.bedrockLatest));
|
||||
|
||||
/**
|
||||
* Tracks if the client is using DashLoader, so we can skip some fixes in the font rendering since they break DashLoader
|
||||
*/
|
||||
public final static boolean DASH_LOADER = FabricLoader.getInstance().isModLoaded("dashloader");
|
||||
|
||||
/**
|
||||
* Contains the armor points of all armor items in legacy versions (<= 1.8.x)
|
||||
*/
|
||||
@ -111,8 +105,10 @@ public class ClientsideFixes {
|
||||
// Reloads some clientside stuff when the protocol version changes
|
||||
ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> {
|
||||
// Reloads all bounding boxes
|
||||
for (Block block : RELOADABLE_BLOCKS) {
|
||||
block.getDefaultState().initShapeCache();
|
||||
if (MinecraftClient.getInstance() != null && MinecraftClient.getInstance().player != null) { // Make sure that the game is loaded when reloading the cache
|
||||
for (Block block : RELOADABLE_BLOCKS) {
|
||||
block.getDefaultState().initShapeCache();
|
||||
}
|
||||
}
|
||||
|
||||
// Calculates the current chat limit, since it changes depending on the protocol version
|
||||
@ -124,7 +120,7 @@ public class ClientsideFixes {
|
||||
}
|
||||
}
|
||||
|
||||
if (DASH_LOADER) {
|
||||
if (!MixinPlugin.DASH_LOADER_PRESENT) {
|
||||
// Reloads all font storages to fix the font renderer
|
||||
for (FontStorage storage : MinecraftClient.getInstance().fontManager.fontStorages.values()) {
|
||||
RenderSystem.recordRenderCall(() -> ((IFontStorage) storage).viafabricplus_clearCaches());
|
||||
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class MixinPlugin implements IMixinConfigPlugin {
|
||||
public final static String INJECTOR_PACKAGE = "de.florianmichael.viafabricplus.injection.mixin";
|
||||
private final static String MC_FIXES_PACKAGE = ".fixes.minecraft";
|
||||
|
||||
public static boolean DASH_LOADER_PRESENT;
|
||||
public static boolean ARMOR_SKIN_PRESENT;
|
||||
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
final var loader = FabricLoader.getInstance();
|
||||
|
||||
DASH_LOADER_PRESENT = loader.isModLoaded("dashloader");
|
||||
ARMOR_SKIN_PRESENT = loader.isModLoaded("armorskin");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefMapperConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
if (mixinClassName.equals(INJECTOR_PACKAGE + MC_FIXES_PACKAGE + ".MixinFontStorage")) {
|
||||
return !DASH_LOADER_PRESENT;
|
||||
}
|
||||
if (mixinClassName.equals(INJECTOR_PACKAGE + MC_FIXES_PACKAGE + ".MixinInGameHud")) {
|
||||
return !ARMOR_SKIN_PRESENT;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
|
||||
|
||||
@Override
|
||||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
* 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.ipnext;
|
||||
package de.florianmichael.viafabricplus.injection.mixin.compat.ipnext;
|
||||
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
@ -29,7 +29,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
/*
|
||||
* https://github.com/blackd/Inventory-Profiles/tree/all-in-one is handling the offhand slot even when
|
||||
* ViaFabricPlus removes the slot in <= 1.8.9, so we have to cancel the handling of the offhand slot
|
||||
* <p>
|
||||
*
|
||||
* Fixes https://github.com/ViaVersion/ViaFabricPlus/issues/209
|
||||
*/
|
||||
@Pseudo
|
@ -15,7 +15,7 @@
|
||||
* 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.sodium;
|
||||
package de.florianmichael.viafabricplus.injection.mixin.compat.sodium;
|
||||
|
||||
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
|
||||
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
|
@ -83,7 +83,7 @@ public abstract class MixinFontStorage implements IFontStorage {
|
||||
|
||||
@Inject(method = "findGlyph", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/Font;getGlyph(I)Lnet/minecraft/client/font/Glyph;"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
|
||||
public void injectFindGlyph(int codePoint, CallbackInfoReturnable<FontStorage.GlyphPair> cir, Glyph glyph, Iterator var3, Font font) {
|
||||
if (ClientsideFixes.DASH_LOADER || !this.id.getNamespace().equals("minecraft")) return;
|
||||
if (!this.id.getNamespace().equals("minecraft")) return;
|
||||
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
if (viafabricplus_isForbiddenCharacter(font, codePoint)) cir.setReturnValue(FontStorage.GlyphPair.MISSING);
|
||||
@ -96,7 +96,7 @@ public abstract class MixinFontStorage implements IFontStorage {
|
||||
|
||||
@Inject(method = "findGlyphRenderer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/Font;getGlyph(I)Lnet/minecraft/client/font/Glyph;"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
|
||||
public void injectFindGlyphRenderer(int codePoint, CallbackInfoReturnable<GlyphRenderer> cir, Iterator var2, Font font) {
|
||||
if (ClientsideFixes.DASH_LOADER || !this.id.getNamespace().equals("minecraft")) return;
|
||||
if (!this.id.getNamespace().equals("minecraft")) return;
|
||||
|
||||
if (!viafabricplus_obfuscation && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
|
||||
if (viafabricplus_isForbiddenCharacter(font, codePoint)) cir.setReturnValue(this.blankGlyphRenderer);
|
||||
|
@ -17,13 +17,10 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.AnvilBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@ -38,7 +35,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(AnvilBlock.class)
|
||||
public class MixinAnvilBlock {
|
||||
public class MixinAnvilBlock extends FallingBlock {
|
||||
|
||||
@Unique
|
||||
private final static VoxelShape viafabricplus_x_axis_shape_v1_12_2 = Block.createCuboidShape(0, 0, 2, 16, 16, 14);
|
||||
@ -50,10 +47,27 @@ public class MixinAnvilBlock {
|
||||
@Final
|
||||
public static DirectionProperty FACING;
|
||||
|
||||
public MixinAnvilBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Unique
|
||||
private boolean viafabricplus_requireOriginalShape;
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
if (viafabricplus_requireOriginalShape) {
|
||||
viafabricplus_requireOriginalShape = false;
|
||||
return;
|
||||
}
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(state.get(FACING).getAxis() == Direction.Axis.X ? viafabricplus_x_axis_shape_v1_12_2 : viafabricplus_z_axis_shape_v1_12_2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
viafabricplus_requireOriginalShape = true;
|
||||
return super.getCullingShape(state, world, pos);
|
||||
}
|
||||
}
|
||||
|
@ -17,13 +17,10 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.HopperBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.function.BooleanBiFunction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
@ -36,19 +33,27 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(HopperBlock.class)
|
||||
public class MixinHopperBlock {
|
||||
public abstract class MixinHopperBlock extends BlockWithEntity {
|
||||
|
||||
@Unique
|
||||
private final static VoxelShape viafabricplus_inside_shape_v1_12_2 = Block.createCuboidShape(2, 10, 2, 14, 16, 14);
|
||||
|
||||
@Unique
|
||||
private final static VoxelShape viafabricplus_hopper_shape_v1_12_2 = VoxelShapes.combineAndSimplify(
|
||||
VoxelShapes.fullCube(),
|
||||
viafabricplus_inside_shape_v1_12_2,
|
||||
BooleanBiFunction.ONLY_FIRST);
|
||||
private final static VoxelShape viafabricplus_hopper_shape_v1_12_2 = VoxelShapes.combineAndSimplify(VoxelShapes.fullCube(), viafabricplus_inside_shape_v1_12_2, BooleanBiFunction.ONLY_FIRST);
|
||||
|
||||
@Unique
|
||||
private boolean viafabricplus_requireOriginalShape;
|
||||
|
||||
public MixinHopperBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true)
|
||||
public void injectGetOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable<VoxelShape> cir) {
|
||||
if (viafabricplus_requireOriginalShape) {
|
||||
viafabricplus_requireOriginalShape = false;
|
||||
return;
|
||||
}
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
cir.setReturnValue(viafabricplus_hopper_shape_v1_12_2);
|
||||
}
|
||||
@ -60,4 +65,10 @@ public class MixinHopperBlock {
|
||||
cir.setReturnValue(viafabricplus_inside_shape_v1_12_2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
viafabricplus_requireOriginalShape = true;
|
||||
return super.getCullingShape(state, world, pos);
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
"krypton": "<=0.2.2"
|
||||
},
|
||||
"conflicts": {
|
||||
"dashloader": "*"
|
||||
"dashloader": "*",
|
||||
"armorskin": "*"
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
"minVersion": "0.8",
|
||||
"package": "de.florianmichael.viafabricplus.injection.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"plugin": "de.florianmichael.viafabricplus.injection.MixinPlugin",
|
||||
"client": [
|
||||
"base.MixinAddServerScreen",
|
||||
"base.MixinClientConnection",
|
||||
@ -130,7 +131,7 @@
|
||||
"fixes.minecraft.screen.screenhandler.MixinBrewingStandScreenHandler_FuelSlot",
|
||||
"fixes.minecraft.screen.screenhandler.MixinPlayerScreenHandler",
|
||||
"fixes.minecraft.screen.screenhandler.MixinScreenHandler",
|
||||
"fixes.sodium.MixinChunkTracker",
|
||||
"compat.sodium.MixinChunkTracker",
|
||||
"fixes.viabedrock.MixinBedrockProtocol",
|
||||
"fixes.viabedrock.MixinJoinPackets",
|
||||
"fixes.vialegacy.MixinClassicProtocolExtension",
|
||||
@ -166,7 +167,7 @@
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinEntityTracker1_9",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinMetadataRewriter1_9To1_8",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
|
||||
"ipnext.MixinAutoRefillHandler_ItemSlotMonitor",
|
||||
"compat.ipnext.MixinAutoRefillHandler_ItemSlotMonitor",
|
||||
"jsonwebtoken.MixinClasses",
|
||||
"jsonwebtoken.MixinDefaultCompressionCodecResolver",
|
||||
"jsonwebtoken.MixinDefaultJwtParserBuilder"
|
||||
|
Loading…
Reference in New Issue
Block a user