Examples of ForgeDirection


Examples of net.minecraftforge.common.ForgeDirection

  private void doWork(FluidMode mode)
  {
    int modeAmount = mode.getAmount() * tickRate;
    float modeCost = mode.getCost() * tickRate;
    ForgeDirection facing = ForgeDirection.getOrientation(getBlockMetadata());
    FluidStack drainable = fluidHandler.drain(facing.getOpposite(), modeAmount, false);

    if (drainable != null && drainable.amount > 0)
    {
      List<Fluid> fluidFilter = getFilterFluids(inventory.slots);
      IAEItemStack toImport = Util.createItemStack(new ItemStack(FLUIDDISPLAY.getItemInstance(), drainable.amount, drainable.fluidID));

      IMEInventoryHandler cellArray = getGrid().getCellArray();
      if (cellArray != null)
      {
        IAEItemStack notImported = cellArray.calculateItemAddition(toImport.copy());

        if (fluidFilter != null && !fluidFilter.isEmpty() && fluidFilter.size() > 0)
        {
          if (fluidFilter.contains(drainable.getFluid()))
          {
            if (notImported == null && grid.useMEEnergy(modeCost, "Import Fluid"))
            {
              FluidStack drained = fluidHandler.drain(facing.getOpposite(), (int) toImport.getStackSize(), true);
              if (drained != null)
                cellArray.addItems(toImport.copy());
            }
          }
        } else
        {
          if (notImported == null && grid.useMEEnergy(modeCost, "Import Fluid"))
          {
            FluidStack drained = fluidHandler.drain(facing.getOpposite(), (int) toImport.getStackSize(), true);
            if (drained != null)
              cellArray.addItems(toImport.copy());
          }
        }
      }
View Full Code Here

Examples of net.minecraftforge.common.ForgeDirection

  }

  @Override
  public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis)
  {
    ForgeDirection rotation = ForgeDirection.getOrientation(worldObj.getBlockMetadata(x, y, z));

    worldObj.setBlockMetadataWithNotify(x, y, z, rotateDirecions(rotation).ordinal(), 3);
    TileEntity te = worldObj.getBlockTileEntity(x, y, z);
    if (te instanceof IGridTileEntity)
    {
View Full Code Here

Examples of net.minecraftforge.common.ForgeDirection

    isBlockContainer = true;
  }

  public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack)
  {
    ForgeDirection orientation = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));

    TileEntity clickedOnTileEntity = world.getBlockTileEntity(x + orientation.getOpposite().offsetX, y + orientation.getOpposite().offsetY, z + orientation.getOpposite().offsetZ);
    TileEntity blockTileEntity = world.getBlockTileEntity(x, y, z);

    if (blockTileEntity instanceof IColoredMETile)
    {
      if (clickedOnTileEntity instanceof IColoredMETile)
      {

        // All this shit to make it compatible w/ AE 13 AND 14 :D
        Method isColoredMethod = null;
        boolean isColored = false;

        try
        {
          // Method for AE 14 (With forgeDireciton argument)
          isColoredMethod = ((IColoredMETile) clickedOnTileEntity).getClass().getDeclaredMethod("isColored", ForgeDirection.class);
          isColored = (Boolean) isColoredMethod.invoke((IColoredMETile) clickedOnTileEntity, orientation);
        } catch (Throwable ex)
        {
          try
          {
            // Method for AE 13 (W/O the argument)
            isColoredMethod = ((IColoredMETile) clickedOnTileEntity).getClass().getDeclaredMethod("isColored");
            isColored = (Boolean) isColoredMethod.invoke(clickedOnTileEntity);
          } catch (Throwable e)
          {
          }
        }

        if (isColored)
        {
          ((IColoredMETile) blockTileEntity).setColor(((IColoredMETile) clickedOnTileEntity).getColor());
        } else
        {
          ((IColoredMETile) blockTileEntity).setColor(-1);
        }
      } else
      {
        ((IColoredMETile) blockTileEntity).setColor(-1);
      }
    }

    if (player.isSneaking())
    {
      world.setBlockMetadataWithNotify(x, y, z, orientation.getOpposite().ordinal(), 3);
    }
  }
View Full Code Here

Examples of net.minecraftforge.common.ForgeDirection

  @Override
  public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset)
  {
    if (itemstack.getItemDamage() == 4)
    {
      ForgeDirection face = ForgeDirection.getOrientation(side);
      if (world.getBlockId(x + face.offsetX, y + face.offsetY, z + face.offsetZ) == 0 && Util.getCellRegistry().getHandlerForCell(itemstack).storedItemTypes() != 0)
      {
        if (FMLCommonHandler.instance().getEffectiveSide().isServer())
        {
          IAEItemStack request = Util.createItemStack(Util.getCellRegistry().getHandlerForCell(itemstack).getAvailableItems().getItems().get(0).copy());
View Full Code Here

Examples of net.minecraftforge.common.ForgeDirection

    {
      if (world.getBlockTileEntity(x, y, z) instanceof TileEntityBusFluidImport)
        ((TileEntityBusFluidImport) world.getBlockTileEntity(x, y, z)).setRedstoneStatus(world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z));
      PacketDispatcher.sendPacketToAllPlayers(world.getBlockTileEntity(x, y, z).getDescriptionPacket());
    }
    ForgeDirection blockOrientation = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
    TileEntity blockTE = world.getBlockTileEntity(x, y, z);
    if (blockTE instanceof TileEntityBusFluidImport)
    {
      TileEntity fluidHandler = world.getBlockTileEntity(x + blockOrientation.offsetX, y + blockOrientation.offsetY, z + blockOrientation.offsetZ);
      ((TileEntityBusFluidImport) blockTE).setFluidHandler(fluidHandler instanceof IFluidHandler ? (IFluidHandler) fluidHandler : null);
View Full Code Here

Examples of net.minecraftforge.common.ForgeDirection

      {
        storageBus.updateGrid();
        PacketDispatcher.sendPacketToAllPlayers(world.getBlockTileEntity(x, y, z).getDescriptionPacket());
        MinecraftForge.EVENT_BUS.post(new GridStorageUpdateEvent(world, new WorldCoord(x, y, z), storageBus.getGrid()));
      }
      ForgeDirection blockOrientation = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));

      TileEntity fluidHandler = world.getBlockTileEntity(x + blockOrientation.offsetX, y + blockOrientation.offsetY, z + blockOrientation.offsetZ);
      storageBus.setFluidHandler(fluidHandler instanceof IFluidHandler ? (IFluidHandler) fluidHandler : null);
    }
  }
View Full Code Here

Examples of net.minecraftforge.common.ForgeDirection

  public void doWork()
  {
    if (isMachineActive() && getGrid() != null)
    {
      ForgeDirection orientation = ForgeDirection.getOrientation(getBlockMetadata());

      int offsetID = worldObj.getBlockId(xCoord + orientation.offsetX, yCoord + orientation.offsetY, zCoord + orientation.offsetZ);
      int offsetMeta = worldObj.getBlockMetadata(xCoord + orientation.offsetX, yCoord + orientation.offsetY, zCoord + orientation.offsetZ);

      IMEInventoryHandler cellArray = getGrid().getCellArray();
View Full Code Here

Examples of net.minecraftforge.common.ForgeDirection

    {
      if (world.getBlockTileEntity(x, y, z) instanceof TileEntityBusFluidExport)
        PacketDispatcher.sendPacketToAllPlayers(world.getBlockTileEntity(x, y, z).getDescriptionPacket());
      ((TileEntityBusFluidExport) world.getBlockTileEntity(x, y, z)).setRedstoneStatus(world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z));
    }
    ForgeDirection blockOrientation = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
    TileEntity blockTE = world.getBlockTileEntity(x, y, z);
    if (blockTE instanceof TileEntityBusFluidExport)
    {
      TileEntity fluidHandler = world.getBlockTileEntity(x + blockOrientation.offsetX, y + blockOrientation.offsetY, z + blockOrientation.offsetZ);
      ((TileEntityBusFluidExport) blockTE).setFluidHandler(fluidHandler instanceof IFluidHandler ? (IFluidHandler) fluidHandler : null);
View Full Code Here

Examples of net.minecraftforge.common.ForgeDirection

  public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
  {
    Tessellator ts = Tessellator.instance;
    ts.setColorOpaque_I(0xFFFFFF);
    ForgeDirection face = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
    renderer.renderStandardBlock(block, x, y, z);
    BlockMonitorStorageFluid monitorBlock = (BlockMonitorStorageFluid) block;
    int[] color =
    { 0, 0, 0 };
    TileEntity blockTE = world.getBlockTileEntity(x, y, z);
View Full Code Here

Examples of net.minecraftforge.common.ForgeDirection

            if (monitorTE.isMatrixed())
            {
              ItemStack toAdd = monitorTE.fillContainer(currItem.copy());
              if (toAdd != null)
              {
                ForgeDirection orientation = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
                dropBlockAsItem_do(world, x + orientation.offsetX, y + orientation.offsetY, z + orientation.offsetZ, toAdd);
                currItem.stackSize -= 1;
                if (currItem.stackSize <= 0)
                  currItem = null;
              }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.