use of pneumaticCraft.common.network.PacketHackingEntityFinish in project PneumaticCraft by MineMaarten.
the class CommonHUDHandler method handleHacking.
private void handleHacking(EntityPlayer player) {
if (hackedBlock != null) {
IHackableBlock hackableBlock = HackableHandler.getHackableForCoord(hackedBlock, player);
if (hackableBlock != null) {
if (++hackTime >= hackableBlock.getHackTime(hackedBlock.world, hackedBlock.x, hackedBlock.y, hackedBlock.z, player)) {
hackableBlock.onHackFinished(player.worldObj, hackedBlock.x, hackedBlock.y, hackedBlock.z, player);
PneumaticCraft.proxy.getHackTickHandler().trackBlock(hackedBlock, hackableBlock);
NetworkHandler.sendToAllAround(new PacketHackingBlockFinish(hackedBlock), player.worldObj);
setHackedBlock(null);
}
} else {
setHackedBlock(null);
}
} else if (hackedEntity != null) {
IHackableEntity hackableEntity = HackableHandler.getHackableForEntity(hackedEntity, player);
if (hackableEntity != null) {
if (++hackTime >= hackableEntity.getHackTime(hackedEntity, player)) {
hackableEntity.onHackFinished(hackedEntity, player);
PneumaticCraft.proxy.getHackTickHandler().trackEntity(hackedEntity, hackableEntity);
NetworkHandler.sendToAllAround(new PacketHackingEntityFinish(hackedEntity), new NetworkRegistry.TargetPoint(hackedEntity.worldObj.provider.dimensionId, hackedEntity.posX, hackedEntity.posY, hackedEntity.posZ, 64));
setHackedEntity(null);
}
} else {
setHackedEntity(null);
}
}
}
Aggregations