use of forestry.core.circuits.ISolderingIron in project ForestryMC by ForestryMC.
the class SocketWidget method handleMouseClick.
@Override
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
ItemStack itemstack = manager.minecraft.player.inventory.getItemStack();
if (itemstack.isEmpty()) {
return;
}
Item held = itemstack.getItem();
Container container = manager.gui.inventorySlots;
if (!(container instanceof IContainerSocketed)) {
return;
}
IContainerSocketed containerSocketed = (IContainerSocketed) container;
// Insert chipsets
if (held instanceof ItemCircuitBoard) {
containerSocketed.handleChipsetClick(slot);
} else if (held instanceof ISolderingIron) {
containerSocketed.handleSolderingIronClick(slot);
}
}
use of forestry.core.circuits.ISolderingIron in project ForestryMC by ForestryMC.
the class ContainerSocketedHelper method handleSolderingIronClickServer.
@Override
public void handleSolderingIronClickServer(int slot, EntityPlayerMP player, ItemStack itemstack) {
ItemStack socket = tile.getSocket(slot);
if (socket.isEmpty() || !(itemstack.getItem() instanceof ISolderingIron)) {
return;
}
// Not sufficient space in player's inventory. failed to stow.
if (!InventoryUtil.stowInInventory(socket, player.inventory, false)) {
return;
}
tile.setSocket(slot, ItemStack.EMPTY);
InventoryUtil.stowInInventory(socket, player.inventory, true);
itemstack.damageItem(1, player);
player.updateHeldItem();
PacketSocketUpdate packet = new PacketSocketUpdate(tile);
NetworkUtil.sendToPlayer(packet, player);
}
Aggregations