@SideOnly(Side.CLIENT)
 public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
   if (blockAccess.getTileEntity(x, y, z) instanceof TileEntityDisguiseBlock) {
     TileEntityDisguiseBlock te = (TileEntityDisguiseBlock) blockAccess.getTileEntity(x, y, z);
     if (te != null) {
       Block block = te.getBlock();
       if (block != null) {
         return block.getIcon(side, te.getMetadata());
       }
     }
   }
   return blockIcon;
 }
Esempio n. 2
0
 @Override
 public int getLightValue(IBlockAccess world, int x, int y, int z) {
   if (y < 0) return 0;
   TileEntity tile = world.getTileEntity(x, y, z);
   if (tile instanceof ISignalTile) return ((ISignalTile) tile).getLightValue();
   return 0;
 }
Esempio n. 3
0
 @Override
 public void setBlockBoundsBasedOnState(IBlockAccess world, int i, int j, int k) {
   TileEntity tile = world.getTileEntity(i, j, k);
   if (tile instanceof TileSignalFoundation)
     ((TileSignalFoundation) tile).setBlockBoundsBasedOnState(world, i, j, k);
   else setBlockBounds(0, 0, 0, 1, 1, 1);
 }
Esempio n. 4
0
 @Override
 public boolean canConnectRedstone(IBlockAccess world, int i, int j, int k, int dir) {
   TileEntity tile = world.getTileEntity(i, j, k);
   if (tile instanceof TileSignalFoundation)
     return ((TileSignalFoundation) tile).canConnectRedstone(dir);
   return false;
 }
Esempio n. 5
0
 @Override
 public int isProvidingWeakPower(IBlockAccess world, int i, int j, int k, int side) {
   TileEntity tile = world.getTileEntity(i, j, k);
   if (tile instanceof TileSignalFoundation)
     return ((TileSignalFoundation) tile).getPowerOutput(side);
   return PowerPlugin.NO_POWER;
 }
 public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) {
   TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
   if ((tTileEntity instanceof BaseMetaTileEntity)) {
     return ((BaseMetaTileEntity) tTileEntity).getLightValue();
   }
   return 0;
 }
 public void onNeighborChange(
     IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) {
   TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
   if ((tTileEntity instanceof BaseTileEntity)) {
     ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ);
   }
 }
Esempio n. 8
0
  @Override
  public void renderWorldBlock(
      RenderBlocks renderblocks, IBlockAccess iba, int i, int j, int k, int md) {
    super.context.setBrightness(super.block.getMixedBrightnessForBlock(iba, i, j, k));
    TileCovered tc = (TileCovered) iba.getTileEntity(i, j, k);
    if (tc != null) {
      super.context.setPos(i, j, k);
      if (tc.CoverSides > 0) {
        super.context.setTint(1.0F, 1.0F, 1.0F);
        super.context.readGlobalLights(iba, i, j, k);
        this.renderCovers(tc.CoverSides, tc.Covers);
      }

      TileWiring tw = (TileWiring) tc;
      int cons = tw.getConnectionMask();
      int indcon = tw.getExtConnectionMask();
      int indconex = tw.EConEMask;
      cons |= indcon;
      super.context.setTint(1.0F, 1.0F, 1.0F);
      IIcon topIcon = RedPowerBase.blockMicro.getIcon(1, md);
      IIcon centIcon = RedPowerBase.blockMicro.getIcon(2, md);
      this.setSideTex(topIcon, centIcon, topIcon);
      this.setWireSize(0.5F, 0.0625F);
      // RenderLib.bindTexture("/eloraam/control/control1.png");
      this.renderWireBlock(tw.ConSides, cons, indcon, indconex);
      // RenderLib.unbindTexture();
    }
  }
Esempio n. 9
0
  @Override
  public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    EnumBlockMultiType type = (EnumBlockMultiType) state.getValue(MULTI_TYPE);
    int renderType = 0;

    switch (type) {
      case CRYO_CHAMBER:
        IBlockState stateAbove = worldIn.getBlockState(pos.up());
        TileEntityMulti tile = (TileEntityMulti) worldIn.getTileEntity(pos);
        if (stateAbove.getBlock() == this
            && (stateAbove.getValue(MULTI_TYPE)) == EnumBlockMultiType.CRYO_CHAMBER) {
          renderType = 0;
        } else {
          renderType = 4;
        }
        if (tile != null && tile.mainBlockPosition != null) {
          IBlockState stateMain = worldIn.getBlockState(tile.mainBlockPosition);
          if (stateMain.getBlock() == MarsBlocks.machine
              && stateMain.getValue(BlockMachineMars.TYPE)
                  == BlockMachineMars.EnumMachineType.CRYOGENIC_CHAMBER) {
            EnumFacing dir = stateMain.getValue(BlockMachineMars.FACING);
            renderType += dir.getHorizontalIndex();
          }
        }
        break;
      default:
        break;
    }

    return state.withProperty(RENDER_TYPE, renderType);
  }
 public static TileEntity getTileEntity(IBlockAccess blockaccess, int x, int y, int z) {
   HashSet<ChunkCoordinates> visited = Sets.newHashSet();
   Block block = blockaccess.getBlock(x, y, z);
   while (block != NailedBlocks.portalController) {
     if (isValidLinkPortalBlock(block) == 0) {
       return null;
     }
     ChunkCoordinates pos = new ChunkCoordinates(x, y, z);
     if (!visited.add(pos)) {
       return null;
     }
     int meta = blockaccess.getBlockMetadata(x, y, z);
     if (meta == 0) {
       return null;
     }
     if (meta == 1) {
       y--;
     } else if (meta == 2) {
       y++;
     } else if (meta == 3) {
       z--;
     } else if (meta == 4) {
       z++;
     } else if (meta == 5) {
       x--;
     } else if (meta == 6) {
       x++;
     } else {
       return null;
     }
     block = blockaccess.getBlock(x, y, z);
   }
   return blockaccess.getTileEntity(x, y, z);
 }
Esempio n. 11
0
 @Override
 public boolean isSideSolid(IBlockAccess world, int i, int j, int k, ForgeDirection side) {
   TileEntity tile = world.getTileEntity(i, j, k);
   if (tile instanceof TileSignalFoundation)
     return ((TileSignalFoundation) tile).isSideSolid(world, i, j, k, side);
   return false;
 }
Esempio n. 12
0
  @Override
  /**
   * This returns a complete list of items dropped from this block.
   *
   * @param world The current world
   * @param pos Block position in world
   * @param state Current state
   * @param fortune Breakers fortune level
   * @return A ArrayList containing all items this block drops
   */
  public List<ItemStack> getDrops(
      IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
    List<ItemStack> ret = new java.util.ArrayList<ItemStack>();

    Random rand = world instanceof World ? ((World) world).rand : RANDOM;

    int count = quantityDropped(state, fortune, rand);
    for (int i = 0; i < count; i++) {
      TileEntityBerries tile = (TileEntityBerries) world.getTileEntity(pos);
      ItemStack stack = BerryManager.getBerryItem(BerryManager.berryNames.get(tile.getBerryId()));
      if (stack != null) {
        ret.add(stack);
      }
    }
    return ret;
  }
Esempio n. 13
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int i, int j, int k, Block block, int modelId, RenderBlocks renderer) {
    IBlockAccess blockAccess = renderer.blockAccess;
    renderer.renderAllFaces = true;
    Block blockToRender = TFCBlocks.Planks;
    if (block instanceof IMultipleBlock) {
      blockToRender = ((IMultipleBlock) block).getBlockTypeForRender();
    }

    TEStand te = (TEStand) (world.getTileEntity(i, j, k));
    if ((world.getTileEntity(i, j - 1, k) != null
            && world.getTileEntity(i, j - 1, k) instanceof TEStand)
        || te.isTop) return false;
    int l = (int) (((te.yaw % 360) / 90) % 2);
    // Arms of the Stand
    if (l == 0) {
      renderer.setRenderBounds(0.1F, 1.35F, 0.44F, 0.9F, 1.45F, 0.56F);
      renderer.renderStandardBlock(blockToRender, i, j, k);

      // Main posts of the stand
      renderer.setRenderBounds(0.35F, 0.101F, 0.45F, 0.45F, 1.35F, 0.55F);
      renderer.renderStandardBlock(blockToRender, i, j, k);

      renderer.setRenderBounds(0.55F, 0.101F, 0.45F, 0.65F, 1.35F, 0.55F);
      renderer.renderStandardBlock(blockToRender, i, j, k);
    } else {
      renderer.setRenderBounds(0.44F, 1.35F, 0.1F, 0.56F, 1.45F, 0.9F);
      renderer.renderStandardBlock(blockToRender, i, j, k);

      // Main posts of the stand
      renderer.setRenderBounds(0.45F, 0.101F, 0.35F, 0.55F, 1.35F, 0.45F);
      renderer.renderStandardBlock(blockToRender, i, j, k);

      renderer.setRenderBounds(0.45F, 0.101F, 0.55F, 0.55F, 1.35F, 0.65F);
      renderer.renderStandardBlock(blockToRender, i, j, k);
    }

    // Base of the stand
    renderer.setRenderBounds(0.1F, 0F, 0.1F, 0.9F, 0.1F, 0.9F);
    renderer.renderStandardBlock(blockToRender, i, j, k);

    renderer.setRenderBounds(0.45F, 1.45F, 0.45F, 0.55F, 1.9F, 0.55F);
    renderer.renderStandardBlock(blockToRender, i, j, k);
    renderer.renderAllFaces = false;
    return true;
  }
Esempio n. 14
0
 @Override
 public boolean renderWorldBlock(
     IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
   TileEntity tile = world.getTileEntity(x, y, z);
   int side = -1;
   int meta = world.getBlockMetadata(x, y, z);
   if (tile != null && tile instanceof TileInjector) side = ((TileInjector) tile).side;
   switch (side) {
     case 2:
       RenderBlocksHelper.renderFace(
           world,
           renderer,
           block,
           x,
           y,
           z,
           "x",
           PillarMaterials.values()[meta].block.getIcon(0, 0));
       break;
     case 3:
       RenderBlocksHelper.renderFace(
           world,
           renderer,
           block,
           x,
           y,
           z,
           "x",
           PillarMaterials.values()[meta].block.getIcon(0, 0));
       break;
     case 4:
       RenderBlocksHelper.renderFace(
           world,
           renderer,
           block,
           x,
           y,
           z,
           "z",
           PillarMaterials.values()[meta].block.getIcon(0, 0));
       break;
     case 5:
       RenderBlocksHelper.renderFace(
           world,
           renderer,
           block,
           x,
           y,
           z,
           "z",
           PillarMaterials.values()[meta].block.getIcon(0, 0));
       break;
     case -1:
       break;
     default:
       break;
   }
   return true;
 }
Esempio n. 15
0
 public int isProvidingWeakPower(IBlockAccess Access, int i, int j, int k, int l) {
   if (!this.canProvidePower()) {
     return 0;
   } else {
     int i1 = ((TileEntityBlueMateriaChest) Access.getTileEntity(i, j, k)).numPlayersUsing;
     return MathHelper.clamp_int(i1, 0, 15);
   }
 }
Esempio n. 16
0
 @Override
 public int getLightValue(IBlockAccess world, int x, int y, int z) {
   TileEntity tileEntity = world.getTileEntity(x, y, z);
   if (tileEntity != null && tileEntity instanceof TileSolarCollector) {
     return ((TileSolarCollector) tileEntity).getLightValue();
   }
   return 0;
 }
Esempio n. 17
0
 @Override
 public void onNeighborChange(
     IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
   if (world.getBlock(tileX, tileY, tileZ) != InitBlocks.blockSteelPipe) {
     TileSteelPipe tile = (TileSteelPipe) world.getTileEntity(x, y, z);
     tile.updateConnections(); // only on server
   }
 }
 @Override
 public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
   TileEntity tileEntity = world.getTileEntity(x, y, z);
   if (tileEntity != null && tileEntity instanceof TilePlayerRelocatorBase) {
     return ((TilePlayerRelocatorBase) tileEntity).isLocked ? icons[1] : icons[0];
   }
   return icons[0];
 }
Esempio n. 19
0
 @Override
 public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
   TileEntityScreen screen = (TileEntityScreen) worldIn.getTileEntity(pos);
   return state
       .withProperty(LEFT, screen.connectedLeft)
       .withProperty(RIGHT, screen.connectedRight)
       .withProperty(UP, screen.connectedUp)
       .withProperty(DOWN, screen.connectedDown);
 }
 @Override
 public int getLightValue(IBlockAccess iba, int x, int y, int z) {
   LaserEffectTile te = (LaserEffectTile) iba.getTileEntity(x, y, z);
   return te instanceof TargetTile && ((TargetTile) te).isTriggered()
       ? (ModList.COLORLIGHT.isLoaded()
           ? ReikaColorAPI.getPackedIntForColoredLight(te.getRenderColor(), 15)
           : 15)
       : 2;
 }
  @SideOnly(Side.CLIENT)
  @Override
  public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
    TileEntity te = world.getTileEntity(x, y, z);

    if (!(te instanceof ISidedFacing)) return iconBuffer[0];

    return iconBuffer[Util.getTextureOnSide(side, ((ISidedFacing) te).getFacing())];
  }
 @Override
 public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
   TileEntity te = world.getTileEntity(pos);
   if (te instanceof CustomTileEntity) {
     CustomTileEntity cte = (CustomTileEntity) te;
     return cte.getState();
   }
   return state;
 }
Esempio n. 23
0
 @Override
 protected boolean isValidConnection(
     IBlockState ownState,
     IBlockState neighbourState,
     IBlockAccess world,
     BlockPos ownPos,
     EnumFacing neighbourDirection) {
   return super.isValidConnection(ownState, neighbourState, world, ownPos, neighbourDirection)
       || world.getTileEntity(ownPos.offset(neighbourDirection)) instanceof IFluidHandler;
 }
 public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
   TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
   if (tTileEntity == null) {
     return 0;
   }
   if ((tTileEntity instanceof IGregTechTileEntity)) {
     return ((IGregTechTileEntity) tTileEntity).getLightOpacity();
   }
   return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0;
 }
  protected IIcon GetIconBasedOnMatter(IBlockAccess world, int x, int y, int z) {
    TileEntity entity = world.getTileEntity(x, y, z);

    if (entity != null && entity instanceof IMatterHandler) {
      if (((IMatterHandler) entity).getMatterStored() > 0) {
        return MatterOverdriveIcons.matter_tank_full;
      }
    }
    return MatterOverdriveIcons.matter_tank_empty;
  }
  @Override
  public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {

    TEGenericControl te = (TEGenericControl) blockAccess.getTileEntity(x, y, z);
    if (te != null) {
      ForgeDirection dir = te.getDirection();
      te.setDirection(dir);
      setBlockBounds(AABBUtils.rotate(defaultBoundingBox.copy(), Utilities.dirToMeta(dir)));
    }
  }
 /**
  * Returns true if the block is emitting indirect/weak redstone power on the specified side. If
  * isBlockNormalCube returns true, standard redstone propagation rules will apply instead and this
  * will not be called. Args: World, X, Y, Z, side. Note that the side is reversed - eg it is 1
  * (up) when checking the bottom of the block.
  */
 public int isProvidingWeakPower(
     IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
   if (!this.canProvidePower()) {
     return 0;
   } else {
     int i1 =
         ((TileEntityBoundChest) par1IBlockAccess.getTileEntity(par2, par3, par4)).numUsingPlayers;
     return MathHelper.clamp_int(i1, 0, 15);
   }
 }
  @Override
  public int isProvidingWeakPower(IBlockAccess iblockaccess, int x, int y, int z, int side) {
    int weakPower = super.isProvidingWeakPower(iblockaccess, x, y, z, side);
    if (weakPower > 0) {
      return weakPower;
    } else {
      TileEntityLittleChunk tile = (TileEntityLittleChunk) iblockaccess.getTileEntity(x, y, z);
      if (tile != null) {
        int maX = tile.size, maY = tile.size, maZ = tile.size;
        int startX = 0, startY = 0, startZ = 0;

        switch (side) {
          case 1:
            maY = 1;
            break;

          case 0:
            startY = maY - 1;
            break;

          case 3:
            maZ = 1;
            break;

          case 2:
            startZ = maZ - 1;
            break;

          case 5:
            maX = 1;
            break;

          case 4:
            startX = maX - 1;
            break;
        }

        for (int xx = startX; xx < maX; xx++) {
          for (int yy = startY; yy < maY; yy++) {
            for (int zz = startZ; zz < maZ; zz++) {
              if (tile.getBlock(xx, yy, zz) != Blocks.air) {
                Block littleBlock = tile.getBlock(xx, yy, zz);
                if (littleBlock != null) {
                  return littleBlock.isProvidingWeakPower(
                      tile.getLittleWorld(), (x << 3) + xx, (y << 3) + yy, (z << 3) + zz, side);
                }
              }
            }
          }
        }
      }
      return 0;
    }
  }
 public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
   if ((aSide < 0) || (aSide > 5)) {
     return 0;
   }
   TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
   if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) {
     return ((IGregTechTileEntity) tTileEntity)
         .getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
   }
   return 0;
 }
 @Override
 public int getLightValue(IBlockAccess world, int x, int y, int z) {
   TileEntityLittleChunk tile = (TileEntityLittleChunk) world.getTileEntity(x, y, z);
   try {
     if (tile != null) return tile.getLightlevel();
   } catch (ClassCastException e) {
     FMLCommonHandler.instance().getFMLLogger().warn(e.getLocalizedMessage());
     return super.getLightValue(world, x, y, z);
   }
   return super.getLightValue(world, x, y, z);
 }