Ars Nouveau

Ars Nouveau

49M Downloads

EffectInteract.java Bug

tweakbsd opened this issue ยท 2 comments

commented

Hi there,

I tried to get my Whelps to use shears on Pumpkins. But it didn't work. So I looked into the code why that is.
I came to the conclusion that the WhelpEntity class, as an implentor of "IInteractResponder" it should use the provided getHeldItem() method to get the ItemStack it uses. But instead I found a call to getHeldItemOffhand() which in my case always returned an empty ItemStack (to be precise minecraft:air). I changed it to use the IIInteractResponder method and boom my Whelp can suddenly create Carved Pumpkins. GREAT!!! But there's still another Bug that he always uses 1 Shear per Spell. If I can fix it I'll make a PR soon and post it here.

ItemStack stack = shooter instanceof IInteractResponder ? shooter.getHeldItemOffhand().copy() : ItemStack.EMPTY;

commented

Ok returning the shears back to the SummoningCrystal Chest is easily done with the same method that
is used when the ray trace result was for an entity:

items.addAll(player.inventory.mainInventory); items.addAll(player.inventory.armorInventory); items.addAll(player.inventory.offHandInventory); returnItems(rayTraceResult, world, shooter, augments, spellContext, items);

Now the Whelp is using the shear to carve pumpkins using Interact Spell and shears. Then putting the damaged shears back into the chest. Love it! Great mod by the way. Keep up your great work.

commented

Merged, thank you!