Package mekanism.api

Examples of mekanism.api.Coord4D


      {
        block = Blocks.redstone_ore;
      }

      ItemStack stack = new ItemStack(block, 1, meta);
      Coord4D orig = new Coord4D(x, y, z, player.worldObj.provider.dimensionId);

      List<String> names = MekanismUtils.getOreDictName(stack);

      boolean isOre = false;

      for(String s : names)
      {
        if(s.startsWith("ore") || s.equals("logWood"))
        {
          isOre = true;
        }
      }

      if(getMode(itemstack) == 3 && isOre && !player.capabilities.isCreativeMode)
      {
        Set<Coord4D> found = new Finder(player.worldObj, stack, new Coord4D(x, y, z, player.worldObj.provider.dimensionId)).calc();

        for(Coord4D coord : found)
        {
          if(coord.equals(orig) || getEnergy(itemstack) < (ENERGY_USAGE*getEfficiency(itemstack)))
          {
 
View Full Code Here


      found.add(pointer);

      for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
      {
        Coord4D coord = pointer.getFromSide(side);

        if(coord.exists(world) && checkID(coord.getBlock(world)) && (coord.getMetadata(world) == stack.getItemDamage() || (MekanismUtils.getOreDictName(stack).contains("logWood") && coord.getMetadata(world) % 4 == stack.getItemDamage() % 4)))
        {
          loop(coord);
        }
      }
    }
View Full Code Here

    Collections.shuffle(tempPumpList);

    //First see if there are any fluid blocks touching the pump - if so, sucks and adds the location to the recurring list
    for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
    {
      Coord4D wrapper = Coord4D.get(this).getFromSide(orientation);

      if(MekanismUtils.isFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord))
      {
        if(fluidTank.getFluid() == null || MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord).isFluidEqual(fluidTank.getFluid()))
        {
          if(take)
          {
            setEnergy(getEnergy() - Mekanism.electricPumpUsage);
            recurringNodes.add(wrapper.clone());
            fluidTank.fill(MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord), true);
            worldObj.setBlockToAir(wrapper.xCoord, wrapper.yCoord, wrapper.zCoord);
          }

          return true;
        }
      }
    }

    //Finally, go over the recurring list of nodes and see if there is a fluid block available to suck - if not, will iterate around the recurring block, attempt to suck,
    //and then add the adjacent block to the recurring list
    for(Coord4D wrapper : tempPumpList)
    {
      if(MekanismUtils.isFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord))
      {
        if(fluidTank.getFluid() == null || MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord).isFluidEqual(fluidTank.getFluid()))
        {
          if(take)
          {
            setEnergy(getEnergy() - Mekanism.electricPumpUsage);
            fluidTank.fill(MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord), true);
            worldObj.setBlockToAir(wrapper.xCoord, wrapper.yCoord, wrapper.zCoord);
          }

          return true;
        }
      }

      //Add all the blocks surrounding this recurring node to the recurring node list
      for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
      {
        Coord4D side = wrapper.getFromSide(orientation);

        if(Coord4D.get(this).distanceTo(side) <= 80)
        {
          if(MekanismUtils.isFluid(worldObj, side.xCoord, side.yCoord, side.zCoord))
          {
View Full Code Here

          if(!finishedCalc)
          {
            doPlenish();
          }
          else {
            Coord4D below = Coord4D.get(this).getFromSide(ForgeDirection.DOWN);
           
            if(canReplace(below, false, false) && getEnergy() >= Mekanism.fluidicPlenisherUsage && fluidTank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME)
            {
              if(fluidTank.getFluid().getFluid().canBePlacedInWorld())
              {
View Full Code Here

   
    if(activeNodes.isEmpty())
    {
      if(usedNodes.isEmpty())
      {
        Coord4D below = Coord4D.get(this).getFromSide(ForgeDirection.DOWN);
       
        if(!canReplace(below, true, true))
        {
          finishedCalc = true;
          return;
        }

        activeNodes.add(below);
      }
      else {
        finishedCalc = true;
        return;
      }
    }
   
    Set<Coord4D> toRemove = new HashSet<Coord4D>();
   
    for(Coord4D coord : activeNodes)
    {
      if(coord.exists(worldObj))
      {
        if(canReplace(coord, true, false))
        {
          worldObj.setBlock(coord.xCoord, coord.yCoord, coord.zCoord, MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()), 0, 3);

          setEnergy(getEnergy() - Mekanism.fluidicPlenisherUsage);
          fluidTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);

        }
       
        for(ForgeDirection dir : dirs)
        {
          Coord4D sideCoord = coord.getFromSide(dir);
         
          if(sideCoord.exists(worldObj) && canReplace(sideCoord, true, true))
          {
            activeNodes.add(sideCoord);
          }
        }
       
View Full Code Here

    {
      if((master != null) != prevMaster)
      {
        for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
        {
          Coord4D obj = Coord4D.get(this).getFromSide(side);

          if(!obj.isAirBlock(worldObj) && !(obj.getTileEntity(worldObj) instanceof TileEntitySalinationTank))
          {
            obj.getBlock(worldObj).onNeighborChange(worldObj, obj.xCoord, obj.yCoord, obj.zCoord, xCoord, yCoord, zCoord);
          }
        }
      }
     
      prevMaster = (master != null);
View Full Code Here

    }
  }
 
  public int pushUp(FluidStack fluid, boolean doFill)
  {
    Coord4D up = Coord4D.get(this).getFromSide(ForgeDirection.UP);
   
    if(up.getTileEntity(worldObj) instanceof TileEntityPortableTank)
    {
      IFluidHandler handler = (IFluidHandler)up.getTileEntity(worldObj);
     
      if(handler.canFill(ForgeDirection.DOWN, fluid.getFluid()))
      {
        return handler.fill(ForgeDirection.DOWN, fluid, doFill);
      }
View Full Code Here

 
  public int getCurrentNeeded()
  {
    int needed = fluidTank.getCapacity()-fluidTank.getFluidAmount();
   
    Coord4D top = Coord4D.get(this).getFromSide(ForgeDirection.UP);
   
    if(top.getTileEntity(worldObj) instanceof TileEntityPortableTank)
    {
      needed += ((TileEntityPortableTank)top.getTileEntity(worldObj)).getCurrentNeeded();
    }
   
    return needed;
  }
View Full Code Here

    @Override
    public void fromBytes(ByteBuf dataStream)
    {
      packetType = SorterGuiPacket.values()[dataStream.readInt()];
 
      object3D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
 
      guiType = dataStream.readInt();
 
      if(packetType == SorterGuiPacket.CLIENT || packetType == SorterGuiPacket.CLIENT_INDEX)
      {
View Full Code Here

    }
 
    @Override
    public void fromBytes(ByteBuf dataStream)
    {
      coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
      type = dataStream.readByte();
 
      if(type == 0)
      {
        tFilter = TransporterFilter.readFromPacket(dataStream);
View Full Code Here

TOP

Related Classes of mekanism.api.Coord4D

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.