Package mekanism.common.tile

Examples of mekanism.common.tile.TileEntityBasicBlock


  public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis)
  {
    TileEntity tile = world.getTileEntity(x, y, z);
    if(tile instanceof TileEntityBasicBlock)
    {
      TileEntityBasicBlock basicTile = (TileEntityBasicBlock)tile;
      if(basicTile.canSetFacing(axis.ordinal()))
      {
        basicTile.setFacing((short)axis.ordinal());
        return true;
      }
    }
    return false;
  }
View Full Code Here


  }

  @Override
  public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack)
  {
    TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
    int side = MathHelper.floor_double((entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
    int height = Math.round(entityliving.rotationPitch);
    int change = 3;

    if(tileEntity == null)
    {
      return;
    }

    if(tileEntity.canSetFacing(0) && tileEntity.canSetFacing(1))
    {
      if(height >= 65)
      {
        change = 1;
      }
      else if(height <= -65)
      {
        change = 0;
      }
    }

    if(change != 0 && change != 1)
    {
      switch(side)
      {
        case 0: change = 2; break;
        case 1: change = 5; break;
        case 2: change = 3; break;
        case 3: change = 4; break;
      }
    }

    if(tileEntity instanceof TileEntityLogisticalSorter)
    {
      TileEntityLogisticalSorter transporter = (TileEntityLogisticalSorter)tileEntity;

      if(!transporter.hasInventory())
      {
        for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
        {
          TileEntity tile = Coord4D.get(transporter).getFromSide(dir).getTileEntity(world);

          if(tile instanceof IInventory)
          {
            change = dir.getOpposite().ordinal();
            break;
          }
        }
      }
    }

    tileEntity.setFacing((short)change);
    tileEntity.redstone = world.isBlockIndirectlyGettingPowered(x, y, z);

    if(tileEntity instanceof IBoundingBlock)
    {
      ((IBoundingBlock)tileEntity).onPlace();
View Full Code Here

  }

  @Override
  public void breakBlock(World world, int x, int y, int z, Block block, int meta)
  {
    TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);

    if(tileEntity instanceof IBoundingBlock)
    {
      ((IBoundingBlock)tileEntity).onBreak();
    }
View Full Code Here

  @Override
  @SideOnly(Side.CLIENT)
  public void randomDisplayTick(World world, int x, int y, int z, Random random)
  {
    TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);

    if(MekanismUtils.isActive(world, x, y, z) && ((IActiveState)tileEntity).renderUpdate() && Mekanism.machineEffects)
    {
      float xRandom = (float)x + 0.5F;
      float yRandom = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
View Full Code Here

  @Override
  @SideOnly(Side.CLIENT)
  public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
  {
    int metadata = world.getBlockMetadata(x, y, z);
    TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);

    if(this == Mekanism.MachineBlock)
    {
      if(metadata == 0)
      {
View Full Code Here

    if(world.isRemote)
    {
      return true;
    }

    TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
    int metadata = world.getBlockMetadata(x, y, z);

    if(entityplayer.getCurrentEquippedItem() != null)
    {
      Item tool = entityplayer.getCurrentEquippedItem().getItem();

      if(MekanismUtils.hasUsableWrench(entityplayer, x, y, z))
      {
        if(entityplayer.isSneaking() && metadata != 13)
        {
          dismantleBlock(world, x, y, z, false);
          return true;
        }

        if(ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools") && tool instanceof IToolWrench)
          ((IToolWrench)tool).wrenchUsed(entityplayer, x, y, z);

        int change = ForgeDirection.ROTATION_MATRIX[ForgeDirection.UP.ordinal()][tileEntity.facing];

        if(tileEntity instanceof TileEntityLogisticalSorter)
        {
          if(!((TileEntityLogisticalSorter)tileEntity).hasInventory())
          {
            for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
            {
              TileEntity tile = Coord4D.get(tileEntity).getFromSide(dir).getTileEntity(world);

              if(tile instanceof IInventory)
              {
                change = dir.getOpposite().ordinal();
                break;
              }
            }
          }
        }

        tileEntity.setFacing((short)change);
        world.notifyBlocksOfNeighborChange(x, y, z, this);
        return true;
      }
    }
View Full Code Here

  @Override
  public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
  {
    if(!player.capabilities.isCreativeMode && !world.isRemote && canHarvestBlock(player, world.getBlockMetadata(x, y, z)))
    {
      TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);

      float motion = 0.7F;
      double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
      double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
      double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
 
View Full Code Here

  }

  @Override
  public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
  {
    TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
    ItemStack itemStack = new ItemStack(this, 1, world.getBlockMetadata(x, y, z));

    if(itemStack.stackTagCompound == null)
    {
      itemStack.setTagCompound(new NBTTagCompound());
View Full Code Here

  {
    TileEntity tile = world.getTileEntity(x, y, z);
    ForgeDirection[] valid = new ForgeDirection[6];
    if(tile instanceof TileEntityBasicBlock)
    {
      TileEntityBasicBlock basicTile = (TileEntityBasicBlock)tile;
      for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
      {
        if(basicTile.canSetFacing(dir.ordinal()))
        {
          valid[dir.ordinal()] = dir;
        }
      }
    }
View Full Code Here

  public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis)
  {
    TileEntity tile = world.getTileEntity(x, y, z);
    if(tile instanceof TileEntityBasicBlock)
    {
      TileEntityBasicBlock basicTile = (TileEntityBasicBlock)tile;
      if(basicTile.canSetFacing(axis.ordinal()))
      {
        basicTile.setFacing((short)axis.ordinal());
        return true;
      }
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of mekanism.common.tile.TileEntityBasicBlock

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.