Package universalelectricity.core.vector

Examples of universalelectricity.core.vector.Vector3


        super.updateEntity();
       
        if (!this.worldObj.isRemote)
        {
            ForgeDirection inputDirection = ForgeDirection.getOrientation(this.getBlockMetadata() + 2);
            TileEntity inputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), inputDirection);
           
            if (inputTile instanceof INetworkProvider)
                this.network = ((INetworkProvider) inputTile).getNetwork();
            else
                this.network = null;
        }
       
        if (this.inventory[0] != null && this.energyStored < this.getMaxEnergyStored())
        {
            if (this.inventory[0].getItem() instanceof IItemElectric)
            {
                this.setEnergyStored(this.getEnergyStored() + (PowerUtils.UE.discharge(this.inventory[0], PowerConversionUtils.INSTANCE.new UEElectricPack((this.getMaxEnergyStored() - this.getEnergyStored()) / this.getVoltage(), this.getVoltage()), 2).toUEWatts()));
            }
            else if (this.inventory[0].getItem() instanceof IElectricItem)
            {
                this.setEnergyStored(this.getEnergyStored() + (PowerUtils.IC2.discharge(this.inventory[0], PowerConversionUtils.INSTANCE.new UEElectricPack((this.getMaxEnergyStored() - this.getEnergyStored()) / this.getVoltage(), this.getVoltage()), 2).toUEWatts()));
            }
           
        }
       
        if (this.energyStored >= WATTS_PER_TICK - .0500F)
        {
            // The left slot contains the item to be processed
            if (this.inventory[1] != null && this.canDraw() && (this.processTicks == 0 || this.baseID != this.inventory[1].itemID
                || this.baseMeta != this.inventory[1].getItemDamage()))
            {
                this.baseID = this.inventory[1].itemID;
                this.baseMeta = this.inventory[1].getItemDamage();
                this.processTicks = this.getDrawingTime();
                this.recipeTicks = this.getDrawingTime();
            }
           
            // Checks if the item can be processed and if the drawing time left is
            // greater than 0, if so, then draw the item.
            if (this.canDraw() && this.processTicks > 0)
            {
                this.processTicks--;
               
                // When the item is finished drawing
                if (this.processTicks < 1)
                {
                    this.drawItem();
                    this.processTicks = 0;
                }
                this.energyStored -= WATTS_PER_TICK;
            }
            else
            {
                this.processTicks = 0;
            }
        }
       
        if (!this.worldObj.isRemote)
        {
            if (this.ticks % 3 == 0 && this.playersUsing > 0)
            {
                PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 12);
            }
        }
       
        this.energyStored = Math.min(this.energyStored, this.getMaxEnergyStored());
        this.energyStored = Math.max(this.energyStored, 0f);
View Full Code Here


    @Override
    public void openChest()
    {
        if (!this.worldObj.isRemote)
        {
            PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 15);
        }
        this.playersUsing++;
    }
View Full Code Here

    {
        super.updateEntity();
       
        if (!this.worldObj.isRemote && this.ticks % 3 == 0)
        {
            TileEntity inputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), this.input);
           
            // Check if requesting power on output
            TileEntity outputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), this.output);
           
            this.inputNetwork = ElectricityHelper.getNetworkFromTileEntity(inputTile, this.input);
            this.outputNetwork = ElectricityHelper.getNetworkFromTileEntity(outputTile, this.output);
           
            PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 12);
        }
        this.produceUE(this.output);
    }
View Full Code Here

    {
        if (this.output != dir)
        {
            this.input = dir;
            if (!this.worldObj.isRemote)
                PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 12);
            this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
            this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, ElectricExpansionItems.blockTransformer.blockID);
        }
    }
View Full Code Here

    {
        if (this.input != dir)
        {
            this.output = dir;
            if (!this.worldObj.isRemote)
                PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 12);
            this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
            this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, ElectricExpansionItems.blockTransformer.blockID);
        }
    }
View Full Code Here

    @Override
    public void initiate()
    {
        super.initiate();
        this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, ElectricExpansionItems.blockInsulatedWire.blockID);
        PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 12);
    }
View Full Code Here

       
        if (!this.worldObj.isRemote)
        {
            if (this.ticks % 3L == 0L && this.playersUsing.size() > 0)
            {
                PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 12.0D);
            }
        }
       
        if (this.inventory[2] != null && this.inventory[2].getItem() instanceof ItemLinkCard)
        {
View Full Code Here

        }
    }
   
    public void refreshConnections()
    {
        this.outputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), outputDir);
        this.outputNetwork = ElectricityHelper.getNetworkFromTileEntity(outputTile, outputDir);
       
        this.inputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), inputDir);
        this.inputNetwork = ElectricityHelper.getNetworkFromTileEntity(inputTile, inputDir);
    }
View Full Code Here

       
       
       
        if (movingPosition != null)
        {
            if (new Vector3(tileEntity).equals(new Vector3(movingPosition)))
            {
                RenderFloatingText.renderFloatingText(status, (float) ((float) x + .5), (float) y - 1, (float) ((float) z + .5));
                RenderFloatingText.renderFloatingText(name, (float) ((float) x + .5), (float) y - .70F, (float) ((float) z + .5));
            }
        }
View Full Code Here

        super.updateEntity();
       
        if (!this.worldObj.isRemote)
        {
            ForgeDirection inputDirection = ForgeDirection.getOrientation(this.getBlockMetadata() + 2);
            TileEntity inputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), inputDirection);
           
            if (inputTile instanceof INetworkProvider)
                this.network = ((INetworkProvider) inputTile).getNetwork();
            else
                this.network = null;
        }
       
        if (this.inventory[0] != null && this.energyStored < this.getMaxEnergyStored())
        {
            if (this.inventory[0].getItem() instanceof IItemElectric)
            {
                this.setEnergyStored(this.getEnergyStored() + (PowerUtils.UE.discharge(this.inventory[0], PowerConversionUtils.INSTANCE.new UEElectricPack((this.getMaxEnergyStored() - this.getEnergyStored()) / this.getVoltage(), this.getVoltage()), 2).toUEWatts()));
            }
            else if (this.inventory[0].getItem() instanceof IElectricItem)
            {
                this.setEnergyStored(this.getEnergyStored() + (PowerUtils.IC2.discharge(this.inventory[0], PowerConversionUtils.INSTANCE.new UEElectricPack((this.getMaxEnergyStored() - this.getEnergyStored()) / this.getVoltage(), this.getVoltage()), 2).toUEWatts()));
            }
           
        }
       
        if (this.energyStored >= WATTS_PER_TICK - .0500F)
        {
            if (this.inventory[1] != null && this.canProcess() && (this.processTicks == 0 || this.baseID != this.inventory[1].itemID || this.baseMeta != this.inventory[1].getItemDamage()))
            {
                this.baseID = this.inventory[1].itemID;
                this.baseMeta = this.inventory[1].getItemDamage();
                this.processTicks = this.getProcessingTime();
                this.recipeTicks = this.getProcessingTime();
            }
           
            if (this.canProcess() && this.processTicks > 0)
            {
                this.processTicks--;
               
                if (this.processTicks < 1)
                {
                    this.processItem();
                    this.processTicks = 0;
                }
                this.getClass();
                this.energyStored -= WATTS_PER_TICK;
            }
            else
            {
                this.processTicks = 0;
            }
        }
       
        if (!this.worldObj.isRemote)
        {
            if (this.ticks % 3L == 0L && this.playersUsing > 0)
            {
                PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 12.0D);
            }
        }
       
        this.energyStored = Math.min(this.energyStored, this.getMaxEnergyStored());
        this.energyStored = Math.max(this.energyStored, 0.0F);
View Full Code Here

TOP

Related Classes of universalelectricity.core.vector.Vector3

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.