File tree Expand file tree Collapse file tree
src/main/java/net/earthcomputer/clientcommands/mixin/rngevents Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package net .earthcomputer .clientcommands .mixin .rngevents ;
22
33import net .earthcomputer .clientcommands .features .PlayerRandCracker ;
4+ import net .minecraft .client .player .LocalPlayer ;
45import net .minecraft .world .entity .player .Player ;
56import net .minecraft .world .inventory .AnvilMenu ;
67import net .minecraft .world .item .ItemStack ;
@@ -14,7 +15,7 @@ public class AnvilMenuMixin {
1415
1516 @ Inject (method = "onTake" , at = @ At ("HEAD" ))
1617 public void onAnvilUse (Player player , ItemStack stack , CallbackInfo ci ) {
17- if (!player .getAbilities ().instabuild ) {
18+ if (player instanceof LocalPlayer && !player .getAbilities ().instabuild ) {
1819 PlayerRandCracker .onAnvilUse ();
1920 }
2021 }
Original file line number Diff line number Diff line change 11package net .earthcomputer .clientcommands .mixin .rngevents ;
22
3+ import com .llamalad7 .mixinextras .sugar .Local ;
34import net .earthcomputer .clientcommands .features .PlayerRandCracker ;
45import net .minecraft .world .item .CrossbowItem ;
6+ import net .minecraft .world .level .Level ;
57import org .spongepowered .asm .mixin .Mixin ;
68import org .spongepowered .asm .mixin .injection .At ;
79import org .spongepowered .asm .mixin .injection .Inject ;
1012@ Mixin (CrossbowItem .class )
1113public class CrossbowItemMixin {
1214 @ Inject (method = "performShooting" , at = @ At ("HEAD" ))
13- private void onPerformShooting (CallbackInfo ci ) {
14- PlayerRandCracker .onCrossbowUse ();
15+ private void onPerformShooting (CallbackInfo ci , @ Local (argsOnly = true , name = "level" ) Level level ) {
16+ if (level .isClientSide ()) {
17+ PlayerRandCracker .onCrossbowUse ();
18+ }
1519 }
1620}
You can’t perform that action at this time.
0 commit comments