Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jude123412 authored Mar 10, 2025
2 parents be07d6c + c383c58 commit a72c2cc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/gregtech/mixin/Mixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public enum Mixin {
.setApplyIf(() -> true)
.setPhase(Phase.EARLY)
.setSide(Side.BOTH)),
ItemMixinCoverFix(new Builder("Allow cover items to bypass sneak checks").addMixinClasses("minecraft.ItemMixin")
.addTargetedMod(VANILLA)
.setApplyIf(() -> true)
.setPhase(Phase.EARLY)
.setSide(Side.BOTH)),

VanillaToolChanges(
new Builder("Changes wooden tools to be a little faster").addMixinClasses("minecraft.ItemToolMaterialMixin")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package gregtech.mixin.mixins.early.minecraft;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.sugar.Local;

import gregtech.api.covers.CoverRegistry;

@Mixin(Item.class)
public class ItemMixin {

@ModifyReturnValue(method = "doesSneakBypassUse", at = @At("RETURN"), remap = false)
private boolean gt5u$checkCoverShift(boolean original, @Local(argsOnly = true) EntityPlayer player) {
// player.getHeldItem() has already been null checked
if (CoverRegistry.isCover(player.getHeldItem())) {
return true;
}
return original;
}

}

0 comments on commit a72c2cc

Please sign in to comment.