Package mods.railcraft.api.core.items

Examples of mods.railcraft.api.core.items.IToolCrowbar


        if (!ModuleManager.isModuleLoaded(Module.TRAIN))
            return;

        boolean used = false;
        if (stack != null && stack.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) stack.getItem();
            if (entity instanceof EntityMinecart) {
                EntityMinecart cart = (EntityMinecart) entity;

                if (crowbar.canLink(thePlayer, stack, cart)) {
                    boolean linkable = cart instanceof ILinkableCart;
                    if (!linkable || (linkable && ((ILinkableCart) cart).isLinkable()))
                        if (linkMap.containsKey(thePlayer)) {
                            ILinkageManager lm = LinkageManager.instance();
                            EntityMinecart last = linkMap.remove(thePlayer);
                            if (lm.areLinked(cart, last)) {
                                lm.breakLink(cart, last);
                                used = true;
                                ChatPlugin.sendLocalizedChat(thePlayer, "railcraft.gui.link.broken");
                                LinkageManager.printDebug("Reason For Broken Link: User removed link.");
                            } else {
                                used = lm.createLink((EntityMinecart) entity, (EntityMinecart) last);
                                if (used)
                                    ChatPlugin.sendLocalizedChat(thePlayer, "railcraft.gui.link.created");
                            }
                            if (!used)
                                ChatPlugin.sendLocalizedChat(thePlayer, "railcraft.gui.link.failed");
                        } else {
                            linkMap.put(thePlayer, (EntityMinecart) entity);
                            ChatPlugin.sendLocalizedChat(thePlayer, "railcraft.gui.link.started");
                        }
                    if (used)
                        crowbar.onLink(thePlayer, stack, cart);
                } else if (crowbar.canBoost(thePlayer, stack, cart)) {
                    thePlayer.addExhaustion(1F);

                    if (thePlayer.ridingEntity != null) {
                        // NOOP
                    } else if (cart instanceof EntityTunnelBore) {
                        // NOOP
                    } else if (cart instanceof IDirectionalCart)
                        ((IDirectionalCart) cart).reverse();
                    else {
                        if (cart.posX < thePlayer.posX)
                            cart.motionX -= SMACK_VELOCITY;
                        else
                            cart.motionX += SMACK_VELOCITY;
                        if (cart.posZ < thePlayer.posZ)
                            cart.motionZ -= SMACK_VELOCITY;
                        else
                            cart.motionZ += SMACK_VELOCITY;
                    }
                    crowbar.onBoost(thePlayer, stack, cart);
                }
            }
        }
        if (used)
            event.setCanceled(true);
View Full Code Here


    @Override
    public boolean blockActivated(EntityPlayer player) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, getX(), getY(), getZ())) {
                GuiHandler.openGui(EnumGui.TRACK_ROUTING, player, getWorld(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
                crowbar.onWhack(player, current, getX(), getY(), getZ());
                return true;
            }
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean blockActivated(EntityPlayer player) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, getX(), getY(), getZ())) {
                GuiHandler.openGui(EnumGui.TRACK_LAUNCHER, player, getWorld(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
                crowbar.onWhack(player, current, getX(), getY(), getZ());
                return true;
            }
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean blockActivated(EntityPlayer player, int side) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, xCoord, yCoord, zCoord)) {
                WorldCoordinate target = TileAnchorWorld.getTarget(player);
                if (target == null)
                    TileAnchorWorld.setTarget(this, player);
                else if (worldObj.provider.dimensionId != target.dimension)
                    ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.fail.dimension", getName());
                else if (new WorldCoordinate(this).equals(target)) {
                    TileAnchorWorld.removeTarget(player);
                    ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.cancel", getName());
                } else {
                    TileEntity tile = TileAnchorWorld.getTargetAt(player, this, target);
                    if (tile instanceof TileAnchorWorld)
                        ((TileAnchorWorld) tile).setSentinel(player, new WorldCoordinate(this));
                    else if (tile != null)
                        ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.fail.invalid", getName());
                }
                crowbar.onWhack(player, current, xCoord, yCoord, zCoord);
                return true;
            }
        }
        return super.blockActivated(player, side);
    }
View Full Code Here

    @Override
    public boolean blockActivated(EntityPlayer player) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, getX(), getY(), getZ())) {
                decouple = !decouple;
                crowbar.onWhack(player, current, getX(), getY(), getZ());
                if (Game.isNotHost(getWorld()))
                    markBlockNeedsUpdate();
                else
                    sendUpdateToClient();
                return true;
View Full Code Here

    @Override
    public boolean blockActivated(EntityPlayer player, int side) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, xCoord, yCoord, zCoord)) {
                if (Game.isHost(worldObj)) {
                    WorldCoordinate target = sentinelPairingMap.get(player);
                    if (target == null)
                        setTarget(this, player);
                    else if (worldObj.provider.dimensionId != target.dimension)
                        ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.fail.dimension", getName());
                    else if (new WorldCoordinate(this).equals(target)) {
                        removeTarget(player);
                        ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.cancel", getName());
                    } else
                        setSentinel(player, target);
                    crowbar.onWhack(player, current, xCoord, yCoord, zCoord);
                }
                return true;
            }
        }
        return super.blockActivated(player, side);
View Full Code Here

    @Override
    public boolean blockActivated(EntityPlayer player) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, getX(), getY(), getZ())) {
                mirror();
                crowbar.onWhack(player, current, getX(), getY(), getZ());
                sendUpdateToClient();
                return true;
            }
        }
        return false;
View Full Code Here

    @Override
    public boolean blockActivated(EntityPlayer player) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, getX(), getY(), getZ())) {
                mode++;
                crowbar.onWhack(player, current, getX(), getY(), getZ());
                sendUpdateToClient();
                return true;
            }
        }
        return false;
View Full Code Here

    @Override
    public boolean blockActivated(EntityPlayer player) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            GuiHandler.openGui(EnumGui.TRACK_EMBARKING, player, getWorld(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
            crowbar.onWhack(player, current, getX(), getY(), getZ());
            return true;
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean blockActivated(EntityPlayer player) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, getX(), getY(), getZ())) {
                GuiHandler.openGui(EnumGui.TRACK_PRIMING, player, getWorld(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
                crowbar.onWhack(player, current, getX(), getY(), getZ());
                return true;
            }
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of mods.railcraft.api.core.items.IToolCrowbar

Copyright © 2018 www.massapicom. 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.