MinecraftDev icon indicating copy to clipboard operation
MinecraftDev copied to clipboard

@WrapOperation with @Constant has no IDE support

Open IThundxr opened this issue 2 years ago • 3 comments

Minecraft Development for IntelliJ plugin version

2023.3-1.7.3-472

IntelliJ version

IntelliJ IDEA 2023.3.4 (Ultimate Edition)

Operating System

Linux

Target platform

Architectury

Description of the bug

    @WrapOperation(method = "animate", constant = @Constant(classValue = AbstractBogeyBlock.class), ordinal = 0)
    private boolean unlinkedAnimateFix(Object instance, Operation<Boolean> original, @Share("wheelRadius") LocalDoubleRef wheelRadius) {
        if (instance instanceof AbstractBogeyBlock<?> type) {
            wheelRadius.set(type.getWheelRadius());
            return true;
        } else if (instance instanceof UnlinkedBogeyBlock type) {
            wheelRadius.set(type.getWheelRadius());
            return true;
        }
        return original.call(instance);
    }

targetting https://github.com/Fabricators-of-Create/Create/blob/703fd0de2055a1b79b5665d319acb4da3aace47c/src/main/java/com/simibubi/create/content/trains/bogey/AbstractBogeyBlockEntity.java#L103-L110

Oddly enough, its only for specific classes it looks like, https://github.com/Layers-of-Railways/Railway/blob/29947c1684d067b531218c8c77f15ad847491e2c/common/src/main/java/com/railwayteam/railways/mixin/MixinDeployerHandler.java works perfectly fine

IThundxr avatar Mar 10 '24 03:03 IThundxr

@IThundxr was this fixed or something?

Earthcomputer avatar Nov 16 '26 15:11 Earthcomputer

@IThundxr was this fixed or something?

Haven't had a chance to check again but the simple solution is just to use the normal @At with "CONSTANT" instead of @Constant both are basically the same at the end of the day

IThundxr avatar Nov 16 '26 16:11 IThundxr

Okay, but that doesn't mean this isn't still an issue

Earthcomputer avatar Nov 17 '26 12:11 Earthcomputer