sp614x / optifine

1.77k stars 420 forks source link

[Bug] [1.20.1] Forge's gatherCapabilities() is missing in OptiFine patches #7549

Closed BloCamLimb closed 3 months ago

BloCamLimb commented 9 months ago

Description of Issue

I just found that a Forge patch was missing in OptiFine patches. I'm testing OptiFine HD U I6 pre6, Minecraft 1.20.1 and Forge 47.1.46. The net.minecraft.world.level.block.entity.BlockEntity constructor should call Forge's CapabilityProvider#gatherCapabilities() at tail, but it was missing in OptiFine-patched binaries. This will cause all Capabilities attached to BlockEntity to become unavailable.

OptiFine Version

OptiFine HD U I6 pre6

Fabric/Forge Version

Forge 47.1.46

Additional Information

In Forge, it's

    public BlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
        super(BlockEntity.class);
        this.type = type;
        this.worldPosition = pos.immutable();
        this.blockState = state;
        this.gatherCapabilities();
    }

In OptiFine, it's

    public BlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
        super(BlockEntity.class);
        this.nbtTagUpdateMs = 0;
        this.type = type;
        this.worldPosition = pos.immutable();
        this.blockState = state;
    }
SquidDev commented 8 months ago

See also https://github.com/sp614x/optifine/issues/7395, which is the same root issue - this also affects 1.19.4.

neos7m commented 6 months ago

Any workarounds for this? Can we do something to patch the file manually? A lot of mods rely on this behavior.

sp614x commented 3 months ago

Fixed, to be backported to 1.19.x.

SquidDev commented 1 month ago

What's the status of the fix here? From what I can tell it was never released (the last release for 1.20.1 was back in December 2023). I've had two bug reports this week caused by this bug, so any progress on the Optifine side would be much appreciated.

MrDiamondDog commented 1 month ago

This is a really annoying issue and a fix being released soon would be great. What's the status of this release?