The Config "Invert Activation" Doesn't Work
Slarper opened this issue ยท 2 comments
whatever the config "Invert Activation" turn ON or OFF, you should press the activation key (default is ACCENT GRAVE key `
) to enable the mod.
The mixin class net.kyrptonaught.diggusmaximus.mixin.MixinClientPlayerInteractionManager
injects into the method breakBlock
as:
@Inject(method = "breakBlock", at = @At(value = "HEAD"))
private void DIGGUS$BREAKBLOCK(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
if (DiggusMaximusMod.getOptions().enabled && DiggusMaximusClientMod.getActivationKey().isKeybindPressed())
DIGGUS$activate(pos, null, -1);
else if (DiggusMaximusMod.getExcavatingShapes().enableShapes && DiggusMaximusClientMod.getShapeKey().isKeybindPressed()) {
Direction facing = null;
HitResult result = client.player.raycast(10, 0, false);
if (result.getType() == HitResult.Type.BLOCK)
facing = ((BlockHitResult) result).getSide();
int selection = DiggusMaximusMod.getExcavatingShapes().selectedShape.ordinal();
DIGGUS$activate(pos, facing, selection);
}
}
But the 3rd line
if (DiggusMaximusMod.getOptions().enabled && DiggusMaximusClientMod.getActivationKey().isKeybindPressed())
evaluates a boolean
DiggusMaximusClientMod.getActivationKey().isKeybindPressed()
while the DiggusMaximusClientMod.getActivationKey()
returns DiggusMaximusMod.getOptions().keybinding
which is declared in class net.kyrptonaught.diggusmaximus.config.ConfigOptions
as:
public CustomKeyBinding keybinding = new DiggusKeyBinding(true, true, "key.keyboard.grave.accent");
because its class type is declared asCustomKeyBinding
so the isKeybindPressed()
in DiggusMaximusClientMod.getActivationKey().isKeybindPressed()
will be resolved to the wrong CustomKeyBinding::isKeybindPressed
instead of the correct DiggusMaximusMod::isKeybindPressed
.
So the solution is replace the problematic declaration for
public DiggusMaximusMod keybinding = new DiggusKeyBinding(true, true, "key.keyboard.grave.accent");