use of com.teamwizardry.wizardry.api.item.halo.HaloInfusionItem in project Wizardry by TeamWizardry.
the class EntityHaloInfusionItem method processInitialInteract.
@Override
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) {
TileEntity tile = world.getTileEntity(infuserPos);
if (tile == null || !(tile instanceof TileHaloInfuser)) {
world.removeEntity(this);
return false;
}
ItemStack heldItem = player.getHeldItem(hand);
if (heldItem.isEmpty()) {
ItemStack slotted = getHaloInfusionItem().getStack();
if (!slotted.isEmpty()) {
player.setHeldItem(hand, slotted);
setHaloInfusionItem(HaloInfusionItemRegistry.EMPTY, false);
return true;
} else
return true;
}
for (HaloInfusionItem haloInfusionItem : HaloInfusionItemRegistry.getItems()) {
if (haloInfusionItem.getStack().isItemEqual(heldItem)) {
setHaloInfusionItem(haloInfusionItem, false);
// todo: remove from hand
return true;
}
}
return true;
}
Aggregations