Skip to content

Commit

Permalink
apply blacklist for swap animation
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Jul 15, 2024
1 parent dadf5da commit 4f45add
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.cleanroommc.neverenoughanimations.animations;

import com.cleanroommc.neverenoughanimations.IItemLocation;
import com.cleanroommc.neverenoughanimations.NEAConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
Expand All @@ -21,6 +22,7 @@ public class SwapHolder {
private ItemStack hotbarStack;

public boolean init(Slot hoveredSlot, List<Slot> slots, int hotbarIndex) {
if (NEAConfig.isBlacklisted(Minecraft.getMinecraft().currentScreen)) return false;
this.targetSlot = hoveredSlot;
this.hotbarSlot = findHotbarSlot(slots, hotbarIndex);
if (this.hotbarSlot == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ public void throwItem(int slotId, int dragType, ClickType clickTypeIn, EntityPla
IItemLocation slot = IItemLocation.of(this.inventorySlots.get(slotId));
if (slot.nea$getStack().isEmpty()) {
// only animate when shift is held (throw hole stack) or only one item is left
ItemPickupThrowAnimation.animateRemove(slot.nea$getX(), slot.nea$getY(), throwing.get(), false);
ItemPickupThrowAnimation.animate(slot.nea$getX(), slot.nea$getY(), throwing.get(), false);
}
}

@ModifyArg(method = "slotClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/EntityPlayer;dropItem(Lnet/minecraft/item/ItemStack;Z)Lnet/minecraft/entity/item/EntityItem;"))
public ItemStack animateThrow(ItemStack itemStackIn, @Local(ordinal = 0) int slot) {
public ItemStack animateThrow(ItemStack itemStackIn, @Local(ordinal = 0, argsOnly = true) int slot) {
if (slot == -999) {
ItemPickupThrowAnimation.animateRemove(NEA.getMouseX() - 8, NEA.getMouseY() - 8, itemStackIn.copy(), true);
ItemPickupThrowAnimation.animate(NEA.getMouseX() - 8, NEA.getMouseY() - 8, itemStackIn.copy(), true);
}
return itemStackIn;
}
Expand Down

0 comments on commit 4f45add

Please sign in to comment.