Package net.minecraft.block

Examples of net.minecraft.block.Block


    if (tile instanceof TileCamo) {
      TileCamo camo = (TileCamo) tile;
      ItemStack currentStack = par5EntityPlayer.getCurrentEquippedItem();

      boolean doChange = true;
      Block block = null;
      checkChange:
      {
        if (currentStack != null) {
          if (Item.getIdFromItem(currentStack.getItem()) == 0) {
            doChange = false;
            break checkChange;
          }

          block = Block.getBlockFromItem(currentStack.getItem());
          if (block == null || !isValidRenderType(block.getRenderType()) || block instanceof BlockCamo || block.getMaterial() == Material.air)
            doChange = false;
        }
      }

      if (doChange) {
View Full Code Here


  @Override
  public int colorMultiplier(IBlockAccess par1World, int par2, int par3, int par4) {
    TileEntity tile = par1World.getTileEntity(par2, par3, par4);
    if (tile instanceof TileCamo) {
      TileCamo camo = (TileCamo) tile;
      Block block = camo.camo;
      if (block != null)
        return block instanceof BlockCamo ? 0xFFFFFF : block.colorMultiplier(par1World, par2, par3, par4);

    }
    return 0xFFFFFF;
  }
View Full Code Here

        ToolHandler.removeBlocksInIteration(player, world, x, y, z, doX ? -2 : 0, doY ? -1 : 0, doZ ? -2 : 0, doX ? 3 : 1, doY ? 4 : 1, doZ ? 3 : 1, null, ToolHandler.materialsAxe, silk, fortune);
        break;
      }
      case 2: {
        Block blck = world.getBlock(x, y, z);
        if (Utils.isWoodLog(world, x, y, z)) {
          while (blck != Blocks.air) {
                        BlockUtils.breakFurthestBlock(world, x, y, z, blck, player);
            blck = world.getBlock(x, y, z);
          }
View Full Code Here

    MovingObjectPosition block = ToolHandler.raytraceFromEntity(world, player, true, 4.5);
    if (block == null)
      return false;

    Block blk = world.getBlock(x, y, z);

    ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit);
    int fortune = EnchantmentHelper.getFortuneModifier(player);
    boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
    if (ConfigHandler.bedrockDimensionID != 0 && blk == Blocks.bedrock && ((world.provider.isSurfaceWorld() && y < 5) || (y > 253 && world.provider instanceof WorldProviderBedrock))) {
View Full Code Here

        ToolHandler.removeBlocksInIteration(player, world, x, y, z, doX ? -2 : 0, doY ? -1 : 0, doZ ? -2 : 0, doX ? 3 : 1, doY ? 4 : 1, doZ ? 3 : 1, null, ToolHandler.materialsShovel, silk, fortune);
        break;
      }
      case 2: {
        Block blk = world.getBlock(x, y, z);
        ToolHandler.removeBlocksInIteration(player, world, x, y, z, 0, -8, 0, 1, 8, 1, blk, ToolHandler.materialsShovel, silk, fortune);
        break;
      }
    }
    return false;
View Full Code Here

  public static void removeBlockWithDrops(EntityPlayer player, World world, int x, int y, int z, int bx, int by, int bz, Block block, Material[] materialsListing, boolean silk, int fortune, float blockHardness) {
    if (!world.blockExists(x, y, z))
      return;

    Block blk = world.getBlock(x, y, z);

    if (block != null && blk != block)
      return;

    int meta = world.getBlockMetadata(x, y, z);
    Material mat = world.getBlock(x, y, z).getMaterial();
    if (blk != null && !blk.isAir(world, x, y, z) && ((blk.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0 || (blk == Blocks.bedrock && (y <= 253 && world.provider instanceof WorldProviderBedrock))))) {
      if (!blk.canHarvestBlock(player, meta) || !isRightMaterial(mat, materialsListing))
        return;
      if (ConfigHandler.bedrockDimensionID != 0 && block == Blocks.bedrock && ((world.provider.isSurfaceWorld() && y < 5) || (y > 253 && world.provider instanceof WorldProviderBedrock))) {
        world.setBlock(x, y, z, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockBedrockPortal.class));
      }
      if (ConfigHandler.bedrockDimensionID != 0 && world.provider.dimensionId == ConfigHandler.bedrockDimensionID && blk == Blocks.bedrock && y <= 253) {
        world.setBlock(x, y, z, Blocks.air);
      }
      if (!player.capabilities.isCreativeMode && blk != Blocks.bedrock) {
        int localMeta = world.getBlockMetadata(x, y, z);
                if(MiscHelper.breakBlockToAirWithCheck(world, x, y, z, player)) {
                    blk.onBlockDestroyedByPlayer(world, x, y, z, localMeta);

                    blk.harvestBlock(world, player, x, y, z, localMeta);
                    blk.onBlockHarvested(world, x, y, z, localMeta, player);
                }
      } else {
        world.setBlockToAir(x, y, z);
      }
    }
View Full Code Here

    cooldown = 10;
  }

  private boolean checkBlock(ChunkCoordinates coords) {
    Block block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ);
    int meta = worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ);

    return !(block == ConfigBlocks.blockAiry && meta == 0) && !ThaumcraftApi.portableHoleBlackList.contains(block) && block != null && block.getBlockHardness(worldObj, coords.posX, coords.posY, coords.posZ) != -1F || block != Blocks.air;
  }
View Full Code Here

  public void swingHit() {
    ChunkCoordinates coords = getTargetLoc();
    ItemStack stack = getStackInSlot(0);
    Item item = stack.getItem();
    Block block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ);

    player.setCurrentItemOrArmor(0, stack);
    //EntityPlayer realPlayer=MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(Owner);
    //NBTTagCompound data=realPlayer.getEntityData().getCompoundTag("PlayerPersisted");
    //player.getEntityData().setCompoundTag("PlayerPersisted",data);
    //NBTTagCompound cmp=player.getEntityData().getCompoundTag("PlayerPersisted");
    //System.out.println(cmp.getCompoundTag("TCResearch").getTagList("TCResearchList").tagCount());

    boolean done = false;

    if (leftClick) {
      Entity entity = detectedEntities.isEmpty() ? null : detectedEntities.get(worldObj.rand.nextInt(detectedEntities.size()));
      if (entity != null) {
        player.getAttributeMap().applyAttributeModifiers(stack.getAttributeModifiers()); // Set attack strenght
        player.attackTargetEntityWithCurrentItem(entity);
        done = true;
      } else if (!isBreaking) {
        if (block != Blocks.air && !block.isAir(worldObj, coords.posX, coords.posY, coords.posZ) && block.getBlockHardness(worldObj, coords.posX, coords.posY, coords.posZ) >= 0) {
          isBreaking = true;
          startBreaking(block, worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ));
          done = true;
        }
      }
    } else {
      int side = SIDES[(getBlockMetadata() & 7) - 2].getOpposite().ordinal();

      if (!(block != Blocks.air && !block.isAir(worldObj, coords.posX, coords.posY, coords.posZ))) {
        coords.posY -= 1;
        side = ForgeDirection.UP.ordinal();
        block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ);
      }

      try {
        ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_AIR, coords.posX, coords.posY, coords.posZ, side,worldObj);
        Entity entity = detectedEntities.isEmpty() ? null : detectedEntities.get(worldObj.rand.nextInt(detectedEntities.size()));
        done = entity != null && entity instanceof EntityLiving && (item.itemInteractionForEntity(stack, player, (EntityLivingBase) entity) || (!(entity instanceof EntityAnimal) || ((EntityAnimal) entity).interact(player)));

        if (!done)
          item.onItemUseFirst(stack, player, worldObj, coords.posX, coords.posY, coords.posZ, side, 0F, 0F, 0F);
        if (!done)
          done = block != null && block.onBlockActivated(worldObj, coords.posX, coords.posY, coords.posZ, player, side, 0F, 0F, 0F);
        if (!done)
          done = item.onItemUse(stack, player, worldObj, coords.posX, coords.posY, coords.posZ, side, 0F, 0F, 0F);
        if (!done) {
          item.onItemRightClick(stack, worldObj, player);
          done = true;
View Full Code Here

    float var4;
    int var5;
    ChunkCoordinates coords = getTargetLoc();

    var1 = curblockDamage - initialDamage;
    Block block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ);

    if (block == Blocks.air)
      stopBreaking();
    else {
      var4 = block.getPlayerRelativeBlockHardness(player, worldObj, coords.posX, coords.posY, coords.posZ) * var1;
      var5 = (int) (var4 * 10);

      if (var5 != durabilityRemainingOnBlock) {
        worldObj.destroyBlockInWorldPartially(player.getEntityId(), coords.posX, coords.posY, coords.posZ, var5);
        durabilityRemainingOnBlock = var5;
View Full Code Here

  public boolean tryHarvestBlock(int par1, int par2, int par3) {
    ItemStack stack = getStackInSlot(0);
    if (stack != null && stack.getItem().onBlockStartBreak(stack, par1, par2, par3, player))
      return false;

    Block block = worldObj.getBlock(par1, par2, par3);
    int var5 = worldObj.getBlockMetadata(par1, par2, par3);
    //worldObj.playAuxSFXAtEntity(player, 2001, par1, par2, par3, var4 + (var5 << 12));
    boolean var6;

    boolean var8 = false;
    if (block != null)
      var8 = block.canHarvestBlock(player, var5);

    worldObj.loadedEntityList.size();
    if (stack != null)
      stack.getItem().onBlockDestroyed(stack, worldObj, block, par1, par2, par3, player);

    var6 = removeBlock(par1, par2, par3);
    if (var6 && var8)
      block.harvestBlock(worldObj, player, par1, par2, par3, var5);

    return var6;
  }
View Full Code Here

TOP

Related Classes of net.minecraft.block.Block

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.