Search in sources :

Example 1 with PacketSecurityStationAddHacker

use of pneumaticCraft.common.network.PacketSecurityStationAddHacker in project PneumaticCraft by MineMaarten.

the class NetworkConnectionPlayerHandler method onSlotHack.

@Override
protected void onSlotHack(int slot, boolean nuked) {
    if (!nuked && gui instanceof GuiSecurityStationHacking) {
        ((GuiSecurityStationHacking) gui).onSlotHack(slot);
    }
    if (station.getStackInSlot(slot) != null && (station.getStackInSlot(slot).getItemDamage() == ItemNetworkComponents.NETWORK_REGISTRY || station.getStackInSlot(slot).getItemDamage() == ItemNetworkComponents.DIAGNOSTIC_SUBROUTINE)) {
        hackedSuccessfully = true;
        EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
        NetworkHandler.sendToServer(new PacketSecurityStationAddHacker(station, player.getCommandSenderName()));
        FMLClientHandler.instance().getClient().thePlayer.closeScreen();
        player.addChatComponentMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Hacking successful! This Security Station now doesn't protect the area any longer!"));
        if (gui instanceof GuiSecurityStationHacking)
            ((GuiSecurityStationHacking) gui).removeUpdatesOnConnectionHandlers();
    }
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) EntityPlayer(net.minecraft.entity.player.EntityPlayer) PacketSecurityStationAddHacker(pneumaticCraft.common.network.PacketSecurityStationAddHacker)

Aggregations

EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1 PacketSecurityStationAddHacker (pneumaticCraft.common.network.PacketSecurityStationAddHacker)1