use of forestry.core.network.packets.PacketSocketUpdate in project ForestryMC by ForestryMC.
the class ContainerSocketedHelper method handleChipsetClickServer.
@Override
public void handleChipsetClickServer(int slot, EntityPlayerMP player, ItemStack itemstack) {
if (!tile.getSocket(slot).isEmpty()) {
return;
}
if (!ChipsetManager.circuitRegistry.isChipset(itemstack)) {
return;
}
ICircuitBoard circuitBoard = ChipsetManager.circuitRegistry.getCircuitBoard(itemstack);
if (circuitBoard == null) {
return;
}
if (!tile.getSocketType().equals(circuitBoard.getSocketType())) {
return;
}
ItemStack toSocket = itemstack.copy();
toSocket.setCount(1);
tile.setSocket(slot, toSocket);
ItemStack stack = player.inventory.getItemStack();
stack.shrink(1);
player.updateHeldItem();
PacketSocketUpdate packet = new PacketSocketUpdate(tile);
NetworkUtil.sendToPlayer(packet, player);
}
use of forestry.core.network.packets.PacketSocketUpdate 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