Examples of IHackableBlock


Examples of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock

                stat.setText(textList);
            }
        }

        if(hackTime > 0) {
            IHackableBlock hackableBlock = HackableHandler.getHackableForCoord(world, blockX, blockY, blockZ, player);
            if(hackableBlock != null) {
                hackTime++;// = Math.min(hackTime + 1, hackableBlock.getHackTime(world, blockX, blockY, blockZ, player));
            } else {
                hackTime = 0;
            }
View Full Code Here

Examples of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock

        return d1 > 1.0D - 0.025D / d0;
    }

    public void hack(){
        if(isInitialized() && isPlayerLookingAtTarget()) {
            IHackableBlock block = HackableHandler.getHackableForCoord(world, blockX, blockY, blockZ, player);
            if(block != null && (hackTime == 0 || hackTime > block.getHackTime(world, blockX, blockY, blockZ, player))) NetworkHandler.sendToServer(new PacketHackingBlockStart(blockX, blockY, blockZ));
        }
    }
View Full Code Here

Examples of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock

            if(hackableBlockClazz != entry.getValue().getClass() || !entry.getValue().canHack(entry.getKey().world, entry.getKey().x, entry.getKey().y, entry.getKey().z, player) && !isInDisplayCooldown(entry.getValue(), entry.getKey().world, entry.getKey().x, entry.getKey().y, entry.getKey().z, player)) iterator.remove();
        }

        Block block = world.getBlock(x, y, z);
        if(block instanceof IHackableBlock && ((IHackableBlock)block).canHack(world, x, y, z, player)) return (IHackableBlock)block;
        IHackableBlock hackable = getInstance().trackedHackableBlocks.get(new WorldAndCoord(world, x, y, z));
        if(hackable == null) {
            if(!PneumaticCraftAPIHandler.getInstance().hackableBlocks.containsKey(block)) return null;
            try {
                hackable = PneumaticCraftAPIHandler.getInstance().hackableBlocks.get(block).newInstance();
                if(hackable.canHack(world, x, y, z, player)) {
                    getInstance().trackedHackableBlocks.put(new WorldAndCoord(world, x, y, z), hackable);
                } else {
                    hackable = null;
                }
            } catch(Exception e) {
View Full Code Here

Examples of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock

        return 10;
    }

    @Override
    public void addInformation(World world, int x, int y, int z, List<String> infoList){
        IHackableBlock hackableBlock = HackableHandler.getHackableForCoord(world, x, y, z, PneumaticCraft.proxy.getPlayer());
        int hackTime = ((BlockTrackUpgradeHandler)HUDHandler.instance().getSpecificRenderer(BlockTrackUpgradeHandler.class)).getTargetForCoord(x, y, z).getHackTime();
        if(hackTime == 0) {
            hackableBlock.addInfo(world, x, y, z, infoList, PneumaticCraft.proxy.getPlayer());
        } else {
            int requiredHackTime = hackableBlock.getHackTime(world, x, y, z, PneumaticCraft.proxy.getPlayer());
            int percentageComplete = hackTime * 100 / requiredHackTime;
            if(percentageComplete < 100) {
                infoList.add(I18n.format("pneumaticHelmet.hacking.hacking") + " (" + percentageComplete + "%%)");
            } else if(hackTime < requiredHackTime + 20) {
                hackableBlock.addPostHackInfo(world, x, y, z, infoList, PneumaticCraft.proxy.getPlayer());
            } else {
                hackableBlock.addInfo(world, x, y, z, infoList, PneumaticCraft.proxy.getPlayer());
            }
        }
    }
View Full Code Here

Examples of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock

    public void onServerTick(TickEvent.ServerTickEvent event){
        if(event.phase == TickEvent.Phase.END) {
            Iterator<Map.Entry<WorldAndCoord, IHackableBlock>> blockIterator = hackedBlocks.entrySet().iterator();
            while(blockIterator.hasNext()) {
                Map.Entry<WorldAndCoord, IHackableBlock> entry = blockIterator.next();
                IHackableBlock hackableBlock = entry.getValue();
                WorldAndCoord hackedBlock = entry.getKey();

                boolean found = false;
                for(Map.Entry<Block, Class<? extends IHackableBlock>> registeredEntry : PneumaticCraftAPIHandler.getInstance().hackableBlocks.entrySet()) {
                    if(hackableBlock.getClass() == registeredEntry.getValue()) {
                        if(hackedBlock.getBlock() == registeredEntry.getKey()) {
                            if(!hackableBlock.afterHackTick((World)hackedBlock.world, hackedBlock.x, hackedBlock.y, hackedBlock.z)) {
                                blockIterator.remove();
                            }
                            found = true;
                            break;
                        }
View Full Code Here

Examples of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock

        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) {
View Full Code Here

Examples of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock

        super(coord.x, coord.y, coord.z);
    }

    @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);
        }
    }
View Full Code Here

Examples of pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock

        }
    }

    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 {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.