use of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock in project PneumaticCraft by MineMaarten.
the class PneumaticCraftAPIHandler method addHackable.
@Override
public void addHackable(Block block, Class<? extends IHackableBlock> iHackable) {
if (block == null)
throw new NullPointerException("Block is null!");
if (iHackable == null)
throw new NullPointerException("IHackableBlock is null!");
if (Block.class.isAssignableFrom(iHackable)) {
Log.warning("Blocks that implement IHackableBlock shouldn't be registered as hackable! Registering block: " + block.getLocalizedName());
} else {
try {
IHackableBlock hackableBlock = iHackable.newInstance();
if (hackableBlock.getId() != null)
stringToBlockHackables.put(hackableBlock.getId(), iHackable);
hackableBlocks.put(block, iHackable);
} catch (InstantiationException e) {
Log.error("Not able to register hackable block: " + iHackable.getName() + ". Does the class have a parameterless constructor?");
e.printStackTrace();
} catch (IllegalAccessException e) {
Log.error("Not able to register hackable block: " + iHackable.getName() + ". Is the class a public class?");
e.printStackTrace();
}
}
}
use of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock in project PneumaticCraft by MineMaarten.
the class PacketHackingBlockFinish method handleClientSide.
@Override
public void handleClientSide(PacketHackingBlockFinish message, EntityPlayer player) {
IHackableBlock hackableBlock = HackableHandler.getHackableForCoord(player.worldObj, message.x, message.y, message.z, player);
if (hackableBlock != null) {
hackableBlock.onHackFinished(player.worldObj, message.x, message.y, message.z, player);
PneumaticCraft.proxy.getHackTickHandler().trackBlock(new WorldAndCoord(player.worldObj, message.x, message.y, message.z), hackableBlock);
CommonHUDHandler.getHandlerForPlayer(player).setHackedBlock(null);
player.worldObj.playSound(message.x, message.y, message.z, "PneumaticCraft:helmetHackFinish", 1.0F, 1.0F, false);
}
}
Aggregations