Skip to content

Commit

Permalink
fix: scope to island to prevent potential desyncs
Browse files Browse the repository at this point in the history
  • Loading branch information
AsoDesu committed Aug 20, 2024
1 parent 0ded652 commit 0ccd122
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.asodev.islandutils.mixins;

import net.asodev.islandutils.state.MccIslandState;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.EquipmentSlot;
Expand All @@ -20,6 +21,7 @@ public abstract class FixOffhandSwapMixin {

@Inject(method = "use", at = @At(value = "HEAD"), cancellable = true)
private void use(Level level, Player player, InteractionHand interactionHand, CallbackInfoReturnable<InteractionResultHolder<ItemStack>> ci) {
if (!MccIslandState.isOnline()) return;
if (getEquipmentSlot().getType() != EquipmentSlot.Type.HUMANOID_ARMOR) {
ItemStack itemStack = player.getItemInHand(interactionHand);
ci.setReturnValue(InteractionResultHolder.pass(itemStack));
Expand Down

0 comments on commit 0ccd122

Please sign in to comment.