Skip to content

Commit

Permalink
fix 24w33a compat
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolij committed Aug 18, 2024
1 parent a90b59c commit c848cbd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
- fix NeoForge 21.0.112-beta support
- fix 24w33a
- further improvements to overall system stability and other minor adjustments have been made to enhance the user experience
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

Expand All @@ -18,12 +19,24 @@ public abstract class GameRendererMixin {
Zume.renderHook();
}

@ModifyReturnValue(method = "getFov", at = @At("TAIL"))
@Group(name = "zume$getFov", min = 1, max = 1)
@ModifyReturnValue(method = "getFov", at = @At("TAIL"), require = 0)
public double zume$getFov$TAIL(double original) {
if (Zume.isFOVHookActive())
return Zume.fovHook(original);

return original;
}

// 24w33a (21.2)+ compat
@Dynamic
@Group(name = "zume$getFov", min = 1, max = 1)
@ModifyReturnValue(method = "method_3196(Lnet/minecraft/class_4184;FZ)F", at = @At("TAIL"), require = 0)
public float zume$getFov$TAIL(float original) {
if (Zume.isFOVHookActive())
return (float) Zume.fovHook(original);

return original;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import dev.nolij.zume.impl.Zume;
import net.minecraft.client.MouseHandler;
import net.minecraft.world.entity.player.Inventory;
Expand Down Expand Up @@ -48,9 +50,21 @@ public abstract class MouseHandlerMixin {
return original;
}

@WrapWithCondition(method = "onScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Inventory;swapPaint(D)V"))
@Group(name = "zume$onScroll", min = 1, max = 1)
@WrapWithCondition(method = "onScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Inventory;swapPaint(D)V"), require = 0)
public boolean onMouseScroll$scrollInHotbar(Inventory instance, double scrollAmount) {
return !Zume.mouseScrollHook((int) scrollAmount);
}

// 24w33a (21.2)+ compat
@Dynamic
@Group(name = "zume$onScroll", min = 1, max = 1)
@WrapOperation(method = "onScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/class_9928;method_61972(DII)I"), require = 0)
public int zume$onScroll$getNextScrollWheelSelection(double scrollAmount, int current, int max, Operation<Integer> original) {
if (Zume.mouseScrollHook((int) scrollAmount))
return current;

return original.call(scrollAmount, current, max);
}

}

0 comments on commit c848cbd

Please sign in to comment.