Package powercrystals.minefactoryreloaded.tile.rednet

Examples of powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetCable


    }
   
    TileEntity te = world.getBlockTileEntity(x, y, z);
    if(te instanceof TileEntityRedNetCable)
    {
      TileEntityRedNetCable cable = (TileEntityRedNetCable)te;
     
      int subHit = getPartClicked(player, 3.0F, cable);
     
      if(subHit < 0)
      {
        return false;
      }
      side = _partSideMappings[subHit];

      ItemStack s = player.inventory.getCurrentItem();
     
      if(side >= 0)
      {
        if(MFRUtil.isHoldingHammer(player))
        {
          if(!world.isRemote)
          {
            int nextColor;
            if(!player.isSneaking())
            {
              nextColor = cable.getSideColor(ForgeDirection.getOrientation(side)) + 1;
              if(nextColor > 15) nextColor = 0;
            }
            else
            {
              nextColor = cable.getSideColor(ForgeDirection.getOrientation(side)) - 1;
              if(nextColor < 0) nextColor = 15;
            }
            cable.setSideColor(ForgeDirection.getOrientation(side), nextColor);
            world.markBlockForUpdate(x, y, z);
            return true;
          }
        }
        else if(s != null && s.itemID == Item.dyePowder.itemID)
        {
          if(!world.isRemote)
          {
            cable.setSideColor(ForgeDirection.getOrientation(side), 15 - s.getItemDamage());
            world.markBlockForUpdate(x, y, z);
            return true;
          }
        }
      }
      else if(MFRUtil.isHoldingHammer(player))
      {
        byte mode = cable.getMode();
        mode++;
        if(mode > 2)
        {
          mode = 0;
        }
        cable.setMode(mode);
        if(!world.isRemote)
        {
          PacketDispatcher.sendPacketToAllAround(x, y, z, 50, world.provider.dimensionId, cable.getDescriptionPacket());
          if(mode == 0)
          {
            player.sendChatToPlayer("Set cable to standard connection mode");
          }
          else if(mode == 1)
View Full Code Here


  {
    int power = 0;
    TileEntity te = world.getBlockTileEntity(x, y, z);
    if(te instanceof TileEntityRedNetCable)
    {
      TileEntityRedNetCable cable = ((TileEntityRedNetCable)te);
      if(cable.getNetwork() == null || cable.getConnectionState(ForgeDirection.VALID_DIRECTIONS[side].getOpposite()) == RedNetConnectionType.None)
      {
        return 0;
      }
     
      int subnet = ((TileEntityRedNetCable)te).getSideColor(ForgeDirection.getOrientation(side).getOpposite());
View Full Code Here

  {
    int power = 0;
    TileEntity te = world.getBlockTileEntity(x, y, z);
    if(te instanceof TileEntityRedNetCable)
    {
      TileEntityRedNetCable cable = ((TileEntityRedNetCable)te);
      if(cable.getNetwork() == null || cable.getConnectionState(ForgeDirection.VALID_DIRECTIONS[side].getOpposite()) == RedNetConnectionType.None)
      {
        return 0;
      }
     
      BlockPosition nodebp = new BlockPosition(x, y, z, ForgeDirection.getOrientation(side).getOpposite());
      nodebp.moveForwards(1);

      int subnet = cable.getSideColor(nodebp.orientation);
     
      if(cable.getNetwork().isWeakNode(nodebp))
      {
        power = 0;
        RedstoneNetwork.log("Asked for strong power at " + x + "," + y + "," + z + " - weak node, power 0");
      }
      else
      {
        power = Math.min(Math.max(cable.getNetwork().getPowerLevelOutput(subnet), 0), 15);
        RedstoneNetwork.log("Asked for strong power at " + x + "," + y + "," + z + " - got " + power + " from network " + ((TileEntityRedNetCable)te).getNetwork().getId() + ":" + subnet);
      }
    }
    return power;
  }
View Full Code Here

  }
 
  @Override
  public TileEntity createNewTileEntity(World world)
  {
    return new TileEntityRedNetCable();
  }
View Full Code Here

      Object[] packetReadout = PacketWrapper.readPacketData(data, decodeAs);
     
      TileEntity te = ((EntityPlayer)player).worldObj.getBlockTileEntity((Integer)packetReadout[0], (Integer)packetReadout[1], (Integer)packetReadout[2]);
      if(te instanceof TileEntityRedNetCable)
      {
        TileEntityRedNetCable tec = (TileEntityRedNetCable) te;
        tec.setSideColor(ForgeDirection.DOWN, (Integer)packetReadout[3]);
        tec.setSideColor(ForgeDirection.UP, (Integer)packetReadout[4]);
        tec.setSideColor(ForgeDirection.NORTH, (Integer)packetReadout[5]);
        tec.setSideColor(ForgeDirection.SOUTH, (Integer)packetReadout[6]);
        tec.setSideColor(ForgeDirection.WEST, (Integer)packetReadout[7]);
        tec.setSideColor(ForgeDirection.EAST, (Integer)packetReadout[8]);
        tec.setMode((Byte)packetReadout[9]);
      }
    }
    else if(packetType == Packets.LogicCircuitDefinition) // server -> client: logic circuit (class and pins)
    {
      Class[] decodeAs = { Integer.class, Integer.class, Integer.class };
View Full Code Here

 
 
  @Override
  public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float scale)
  {
    TileEntityRedNetCable cable = (TileEntityRedNetCable)tileentity;
    bindTextureByName(MineFactoryReloadedCore.tileEntityFolder + "cable.png");
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5f, (float) z + 0.5F);
   
    GL11.glDisable(GL11.GL_ALPHA_TEST);
View Full Code Here

TOP

Related Classes of powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetCable

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.