Skip to content

Commit

Permalink
Fix off by one int clamp in Witchery's glyph rendering (#448)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Cleptomania and github-actions[bot] authored Dec 9, 2024
1 parent 319191c commit ad9680d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,10 @@ public class FixesConfig {
@Config.DefaultBoolean(true)
public static boolean fixWitcheryThunderDetection;

@Config.Comment("Fixes some potential errors in Witchery Rendering")
@Config.DefaultBoolean(true)
public static boolean fixWitcheryRendering;

// Xaero's Minimap
@Config.Comment("Fixes the player entity dot rendering when arrow is chosen")
@Config.DefaultBoolean(true)
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,10 @@ public enum Mixins {
.setSide(Side.BOTH).setPhase(Phase.LATE).setApplyIf(() -> FixesConfig.fixWitcheryThunderDetection)
.addTargetedMod(TargetedMod.WITCHERY)),

FIX_WITCHERY_RENDERING(new Builder("Fixes Witchery Rendering errors")
.addMixinClasses("witchery.MixinBlockCircleGlyph").setSide(Side.CLIENT).setPhase(Phase.LATE)
.setApplyIf(() -> FixesConfig.fixWitcheryRendering).addTargetedMod(TargetedMod.WITCHERY)),

// Various Exploits/Fixes
GC_TIME_COMMAND_FIX(new Builder("GC Time Fix").addMixinClasses("minecraft.MixinTimeCommandGalacticraftFix")
.setPhase(Phase.EARLY).setSide(Side.BOTH).setApplyIf(() -> FixesConfig.fixTimeCommandWithGC)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.mitchej123.hodgepodge.mixins.late.witchery;

import net.minecraft.util.IIcon;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

import com.emoniph.witchery.blocks.BlockCircleGlyph;

@Mixin(BlockCircleGlyph.class)
public class MixinBlockCircleGlyph {

@Shadow(remap = false)
private IIcon[] icons;

@ModifyConstant(method = "getIcon(II)Lnet/minecraft/util/IIcon;", constant = @Constant(intValue = 12))
private int hodgepodge$fixMetadataClamp(int oldValue) {
return icons.length - 1;
}

}

0 comments on commit ad9680d

Please sign in to comment.