Applied Energistics 2

Applied Energistics 2

156M Downloads

Wrong documentation for ChannelMode

Aresiel opened this issue ยท 2 comments

commented

The ChannelMode class' latter two comments (1, 2) are wrong.

An enum value with 0 adHocNetworkChannels and 0 cableCapacityFactor does not disable requirements, but rather limit the amount of used channels to 0.

See:
image
with this setup
image
and the following enum extension:

@Mixin(appeng.api.networking.pathing.ChannelMode.class)
public class ChannelModeNoneEnumExtension {
    @Mutable
    @Shadow
    @Final
    private static appeng.api.networking.pathing.ChannelMode[] $VALUES;

    @Invoker(value = "<init>")
    private static appeng.api.networking.pathing.ChannelMode create(String name, int ordinal, int adHocNetworkChannels, int cableCapacityFactor){
        throw new IllegalStateException();
    }

    static {
        appeng.api.networking.pathing.ChannelMode NONE = create("NONE", $VALUES.length, 0, 0);

        $VALUES = ArrayUtils.add($VALUES, NONE);
    }
}

I would correct this by simply removing the remark, since it's (clearly) not utilized.

commented

I sure hope you aren't doing this kind of enum extension in production. ๐Ÿ˜„

commented

I sure hope you aren't doing this kind of enum extension in production. ๐Ÿ˜„

They say ignorance is bliss, I hope you remain blissful on this matter.