Package net.minecraft.entity.item

Examples of net.minecraft.entity.item.EntityMinecart


        if (offer.amount <= 0)
            return used;

        LinkageManager lm = LinkageManager.instance();

        EntityMinecart linkedCart = lm.getLinkedCartA(this);
        if (linkedCart != source && linkedCart instanceof ILiquidTransfer)
            used += ((ILiquidTransfer) linkedCart).offerLiquid(this, offer);

        offer.amount = qty - used;
        if (offer.amount <= 0)
View Full Code Here


        FluidStack newRequest = request.copy();
        newRequest.amount = request.amount - acquired.amount;

        LinkageManager lm = LinkageManager.instance();

        EntityMinecart linkedCart = lm.getLinkedCartA(this);
        if (linkedCart != source && linkedCart instanceof ILiquidTransfer)
            acquired.amount += ((ILiquidTransfer) linkedCart).requestLiquid(this, newRequest);

        if (acquired.amount >= request.amount)
            return acquired.amount;
View Full Code Here

        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.");
View Full Code Here

        if (cart instanceof EntityLocomotive)
            return true;

        LinkageManager lm = LinkageManager.instance();

        EntityMinecart linkA = lm.getLinkedCartA(this);
        if (linkA != null && !(linkA instanceof EntityLocomotive))
            return false;

        EntityMinecart linkB = lm.getLinkedCartB(this);
        return linkB == null || linkB instanceof EntityLocomotive;
    }
View Full Code Here

                    private EntityMinecart last = null;
                    private EntityMinecart current = head;

                    @Override
                    public boolean hasNext() {
                        EntityMinecart next = lm.getLinkedCartA(current);
                        if (next != null && next != last)
                            return true;
                        next = lm.getLinkedCartB(current);
                        if (next != null && next != last)
                            return true;
                        return false;
                    }

                    @Override
                    public EntityMinecart next() {
                        EntityMinecart next = lm.getLinkedCartA(current);
                        if (next != last) {
                            last = current;
                            current = next;
                            return current;
                        }
View Full Code Here

    private void addCartsToTrain(EntityMinecart cart) {
        addCart(cart);

        LinkageManager lm = LinkageManager.instance();
        EntityMinecart linkA = lm.getLinkedCartA(cart);
        EntityMinecart linkB = lm.getLinkedCartB(cart);

        if (linkA == null)
            frontback.add(cart.getPersistentID());
        else if (!containsCart(linkA))
            addCartsToTrain(linkA);
View Full Code Here

    }

    protected void releaseTrain() {
        LinkageManager lm = LinkageManager.instance();
        for (UUID id : carts) {
            EntityMinecart cart = lm.getCartFromUUID(id);
            if (cart != null) {
                cart.getEntityData().removeTag(LinkageManager.TRAIN_HIGH);
                cart.getEntityData().removeTag(LinkageManager.TRAIN_LOW);
            }
        }
        carts.clear();
        lockingTracks.clear();
    }
View Full Code Here

    }

    public EntityLocomotive getLocomotive() {
        LinkageManager lm = LinkageManager.instance();
        for (UUID id : frontback) {
            EntityMinecart cart = lm.getCartFromUUID(id);
            if (cart instanceof EntityLocomotive)
                return (EntityLocomotive) cart;
        }
        return null;
    }
View Full Code Here

     * @param id
     * @return
     */
    @Override
    public EntityMinecart getCartFromUUID(UUID id) {
        EntityMinecart cart = carts.get(id);
        if (cart != null && cart.isDead) {
            carts.remove(id);
            return null;
        }
        return carts.get(id);
View Full Code Here

    public void breakLinkA(EntityMinecart cart) {
        resetTrain(cart);
        UUID link = getLinkA(cart);
        cart.getEntityData().setLong(LINK_A_HIGH, 0);
        cart.getEntityData().setLong(LINK_A_LOW, 0);
        EntityMinecart other = getCartFromUUID(link);
        if (other != null)
            breakLink(other, cart);
        if (cart instanceof ILinkableCart)
            ((ILinkableCart) cart).onLinkBroken(other);
View Full Code Here

TOP

Related Classes of net.minecraft.entity.item.EntityMinecart

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.