Package net.minecraftforge.common.util

Examples of net.minecraftforge.common.util.ForgeDirection


      if(!getBundle().getEntity().getWorldObj().isRemote) {

        if(res != null && res.component != null) {

          ForgeDirection connDir = res.component.dir;
          ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);

          if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {

            if(getConnectionMode(faceHit) == ConnectionMode.DISABLED) {
              setConnectionMode(faceHit, getNextConnectionMode(faceHit));
View Full Code Here


      setExtractionSignalColor(res.component.dir, col);
      return true;
    } else if(ConduitUtil.isToolEquipped(player)) {
      if(!getBundle().getEntity().getWorldObj().isRemote) {
        if(res != null && res.component != null) {
          ForgeDirection connDir = res.component.dir;
          ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);
          if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {
            if(getConnectionMode(faceHit) == ConnectionMode.DISABLED) {
              setConnectionMode(faceHit, getNextConnectionMode(faceHit));
              return true;
            }
View Full Code Here

    }
  }

  private void updateStartPushDir() {

    ForgeDirection newVal = getNextDir(startPushDir);
    boolean foundNewStart = false;
    while (newVal != startPushDir && !foundNewStart) {
      foundNewStart = getConduitConnections().contains(newVal) || getExternalConnections().contains(newVal);
      newVal = getNextDir(newVal);
    }
View Full Code Here

    }
    currentPushToken = token;
    int pushed = 0;
    int total = pushStack.amount;

    ForgeDirection dir = startPushDir;
    FluidStack toPush = pushStack.copy();

    int filledLocal = tank.fill(toPush, doPush);
    toPush.amount -= filledLocal;
    pushed += filledLocal;

    do {
      if(dir != from && canOutputToDir(dir)) {
        if(getConduitConnections().contains(dir)) {
          ILiquidConduit conduitCon = getFluidConduit(dir);
          if(conduitCon != null) {
            int toCon = ((LiquidConduit) conduitCon).pushLiquid(dir.getOpposite(), toPush, doPush, token);
            toPush.amount -= toCon;
            pushed += toCon;
          }
        } else if(getExternalConnections().contains(dir)) {
          IFluidHandler con = getTankContainer(getLocation().getLocation(dir));
          if(con != null) {
            int toExt = con.fill(dir.getOpposite(), toPush, doPush);
            toPush.amount -= toExt;
            pushed += toExt;
            if(doPush) {
              network.outputedToExternal(toExt);
            }
View Full Code Here

      BoundingBox bb = cube.scale(xLen, yLen, zLen);

      for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
        if(d != component.dir && d != component.dir.getOpposite()) {

          ForgeDirection vDir = RenderUtil.getVDirForFace(d);
          if(component.dir == ForgeDirection.UP || component.dir == ForgeDirection.DOWN) {
            vDir = RenderUtil.getUDirForFace(d);
          } else if((component.dir == ForgeDirection.NORTH || component.dir == ForgeDirection.SOUTH) && d.offsetY != 0) {
            vDir = RenderUtil.getUDirForFace(d);
          }

          float minU = texture.getMinU();
          float maxU = texture.getMaxU();
          float minV = texture.getMinV();
          float maxV = texture.getMaxV();

          float sideScale = Math.max(bb.sizeX(), bb.sizeY()) * 2 / 16f;
          sideScale = Math.max(sideScale, bb.sizeZ() * 2 / 16f);
          float width = Math.min(bb.sizeX(), bb.sizeY()) * 15f / 16f;

          List<Vertex> corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
          moveEdgeCorners(corners, vDir, width);
          moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
          for (Vertex c : corners) {
            addVecWithUV(c.xyz, c.uv.x, c.uv.y);
          }

          corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
          moveEdgeCorners(corners, vDir.getOpposite(), width);
          moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
          for (Vertex c : corners) {
            addVecWithUV(c.xyz, c.uv.x, c.uv.y);
          }

View Full Code Here

    }
  }

  @Override
  protected void actionPerformed(GuiButton b) {
    ForgeDirection dir = ForgeDirection.values()[b.id];
    EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
    BlockCoord loc = cb.getLocation();
    PacketHandler.INSTANCE.sendToServer(new PacketOpenConduitUI(cb.getEntity(), dir));
    player.openGui(EnderIO.instance, GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE + dir.ordinal(), player.worldObj, loc.x, loc.y, loc.z);
  }
View Full Code Here

        setSignalColor(res.component.dir, col);
        return true;
      } else if(ConduitUtil.isToolEquipped(player)) {

        if(res != null && res.component != null) {
          ForgeDirection connDir = res.component.dir;
          ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);

          boolean colorHit = false;
          if(all != null && containsExternalConnection(connDir)) {
            for (RaytraceResult rtr : all) {
              if(rtr != null && rtr.component != null && COLOR_CONTROLLER_ID.equals(rtr.component.data)) {
                colorHit = true;
              }
            }
          }

          if(colorHit) {
            setSignalColor(connDir, DyeColor.getNext(getSignalColor(connDir)));
            return true;

          } else if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {

            BlockCoord loc = getLocation().getLocation(faceHit);
            Block id = world.getBlock(loc.x, loc.y, loc.z);
            if(id == EnderIO.blockConduitBundle) {
              IRedstoneConduit neighbour = ConduitUtil.getConduit(world, loc.x, loc.y, loc.z, IRedstoneConduit.class);
              if(neighbour != null && neighbour.getConnectionMode(faceHit.getOpposite()) == ConnectionMode.DISABLED) {
                neighbour.setConnectionMode(faceHit.getOpposite(), ConnectionMode.NOT_SET);
              }
              setConnectionMode(faceHit, ConnectionMode.NOT_SET);
              return ConduitUtil.joinConduits(this, faceHit);
            }
            forceConnectionMode(faceHit, ConnectionMode.IN_OUT);
View Full Code Here

  public boolean onBlockActivated(EntityPlayer player, RaytraceResult res, List<RaytraceResult> all) {
    super.onBlockActivated(player, res, all);
    if(ConduitUtil.isToolEquipped(player)) {
      if(!getBundle().getEntity().getWorldObj().isRemote) {
        if(res != null && res.component != null) {
          ForgeDirection connDir = res.component.dir;
          ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);
          if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {
            if(getConnectionMode(faceHit) == ConnectionMode.DISABLED) {
              setConnectionMode(faceHit, getNextConnectionMode(faceHit));
            }
            // Attempt to join networks
View Full Code Here

      }
      return true;
    } else if(ConduitUtil.isToolEquipped(player)) {
      if(!getBundle().getEntity().getWorldObj().isRemote) {
        if(res != null && res.component != null) {
          ForgeDirection connDir = res.component.dir;
          ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);
          if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {
            if(getConnectionMode(faceHit) == ConnectionMode.DISABLED) {
              setConnectionMode(faceHit, getNextConnectionMode(faceHit));
              return true;
            }
            // Attempt to join networks
            return ConduitUtil.joinConduits(this, faceHit);
          } else if(externalConnections.contains(connDir)) {
            setConnectionMode(connDir, getNextConnectionMode(connDir));
            return true;
          } else if(containsConduitConnection(connDir)) {
            ConduitUtil.disconectConduits(this, connDir);
            return true;
          }
        }
      }
    } else {

      if(res != null && res.component != null) {
        ForgeDirection connDir = res.component.dir;
        if(connDir != null && connDir != ForgeDirection.UNKNOWN && containsExternalConnection(connDir)) {
          if(!player.worldObj.isRemote) {
            PacketConduitProbe.sendInfoMessage(player, this, player.getCurrentEquippedItem());
          }
          return true;
View Full Code Here

      if(!getBundle().getEntity().getWorldObj().isRemote) {

        if(res != null && res.component != null) {

          ForgeDirection connDir = res.component.dir;
          ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);

          if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {

            if(getConnectionMode(faceHit) == ConnectionMode.DISABLED) {
              setConnectionMode(faceHit, getNextConnectionMode(faceHit));
View Full Code Here

TOP

Related Classes of net.minecraftforge.common.util.ForgeDirection

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.