Search in sources :

Example 1 with PolytoolUpdateMessage

use of minechem.network.message.PolytoolUpdateMessage in project Minechem by iopleke.

the class PolytoolInventory method setInventorySlotContents.

@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
    item = itemstack;
    if (itemstack != null && itemstack.stackSize == 64 && (itemstack.getItem() instanceof ElementItem) && PolytoolHelper.getTypeFromElement(ElementItem.getElement(itemstack), 1) != null && PolytoolItem.validAlloyInfusion(player.getCurrentEquippedItem(), itemstack)) {
        item = null;
        PolytoolUpgradeType upgrade = PolytoolHelper.getTypeFromElement(ElementItem.getElement(itemstack), 1);
        PolytoolItem.addTypeToNBT(player.inventory.getCurrentItem(), upgrade);
        if (!player.worldObj.isRemote) {
            PolytoolUpdateMessage message = new PolytoolUpdateMessage(upgrade);
            MessageHandler.INSTANCE.sendTo(message, (EntityPlayerMP) player);
        }
    }
}
Also used : ElementItem(minechem.item.element.ElementItem) PolytoolUpdateMessage(minechem.network.message.PolytoolUpdateMessage)

Aggregations

ElementItem (minechem.item.element.ElementItem)1 PolytoolUpdateMessage (minechem.network.message.PolytoolUpdateMessage)1