Package net.minecraft.util

Examples of net.minecraft.util.ChunkCoordinates


    positionAt++;
    if(positionAt == POSITIONS.length)
      positionAt = 0;

    int[] acoords = POSITIONS[positionAt];
    ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord + acoords[0], supertile.yCoord + acoords[1], supertile.zCoord + acoords[2]);
    Block block = supertile.getWorldObj().getBlock(coords.posX, coords.posY, coords.posZ);
    if(block != Blocks.air) {
      Item item = Item.getItemFromBlock(block);
      if(item != null) {
        ItemStack stack = new ItemStack(item, 1, supertile.getWorldObj().getBlockMetadata(coords.posX, coords.posY, coords.posZ));
View Full Code Here


  }

  @Override
  public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
    Block block = par3World.getBlock(par4, par5, par6);
    ChunkCoordinates boundTile = getBoundTile(par1ItemStack);

    if(boundTile.posY != -1 && par2EntityPlayer.isSneaking() && (boundTile.posX != par4 || boundTile.posY != par5 || boundTile.posZ != par6)) {
      TileEntity tile = par3World.getTileEntity(boundTile.posX, boundTile.posY, boundTile.posZ);
      if(tile instanceof IWandBindable) {
        if(((IWandBindable) tile).bindTo(par2EntityPlayer, par1ItemStack, par4, par5, par6, par7)) {
View Full Code Here

    return false;
  }

  @Override
  public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
    ChunkCoordinates coords = getBoundTile(par1ItemStack);
    TileEntity tile = par2World.getTileEntity(coords.posX, coords.posY, coords.posZ);
    if(tile == null || !(tile instanceof IWandBindable))
      setBoundTile(par1ItemStack, 0, -1, 0);
  }
View Full Code Here

  public static ChunkCoordinates getBoundTile(ItemStack stack) {
    int x = ItemNBTHelper.getInt(stack, TAG_BOUND_TILE_X, 0);
    int y = ItemNBTHelper.getInt(stack, TAG_BOUND_TILE_Y, -1);
    int z = ItemNBTHelper.getInt(stack, TAG_BOUND_TILE_Z, 0);
    return new ChunkCoordinates(x, y, z);
  }
View Full Code Here

    return "botaniamisc.wandMode." + (getBindMode(stack) ? "bind" : "function");
  }

  @Override
  public ChunkCoordinates getBinding(ItemStack stack) {
    ChunkCoordinates bound = getBoundTile(stack);
    if(bound.posY != -1)
      return bound;

    MovingObjectPosition pos = Minecraft.getMinecraft().objectMouseOver;
    if(pos != null) {
      TileEntity tile = Minecraft.getMinecraft().theWorld.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
      if(tile != null && tile instanceof ITileBound) {
        ChunkCoordinates coords = ((ITileBound) tile).getBinding();
        return coords;
      }
    }

    return null;
View Full Code Here

    super.onUpdate();

    if(!supertile.getWorldObj().isRemote && supertile.getWorldObj().getTotalWorldTime() % 5 == 0) {
      int manaCost = 80;
      if(mana >= manaCost) {
        ChunkCoordinates coords = getCoordsToPut();
        if(coords != null) {
          supertile.getWorldObj().setBlockToAir(coords.posX, coords.posY, coords.posZ);
          if(ConfigHandler.blockBreakParticles)
            supertile.getWorldObj().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(Block.getBlockFromName("sand")));
          EntityItem item = new EntityItem(supertile.getWorldObj(), coords.posX + 0.5, coords.posY + 0.5, coords.posZ + 0.5, new ItemStack(Items.clay_ball));
View Full Code Here

          int x = supertile.xCoord + i;
          int y = supertile.yCoord + j;
          int z = supertile.zCoord + k;
          Block block = supertile.getWorldObj().getBlock(x, y, z);
          if(block == Block.getBlockFromName("sand"))
            possibleCoords.add(new ChunkCoordinates(x, y, z));
        }

    if(possibleCoords.isEmpty())
      return null;
    return possibleCoords.get(supertile.getWorldObj().rand.nextInt(possibleCoords.size()));
View Full Code Here

          int y = srcy + k;
          int z = srcz + j;

          Block block = world.getBlock(x, y, z);
          if((stackDmg == 0 && block instanceof BlockBush && !(block instanceof ISpecialFlower) && (!(block instanceof IGrassHornExcempt) || ((IGrassHornExcempt) block).canUproot(world, x, y, z))) || (stackDmg == 1 && block instanceof BlockLeavesBase))
            coords.add(new ChunkCoordinates(x, y, z));
        }

    Collections.shuffle(coords, rand);

    int count = Math.min(coords.size(), 32 + stackDmg * 16);
    for(int i = 0; i < count; i++) {
      ChunkCoordinates currCoords = coords.get(i);
      List<ItemStack> items = new ArrayList();
      Block block = world.getBlock(currCoords.posX, currCoords.posY, currCoords.posZ);
      int meta = world.getBlockMetadata(currCoords.posX, currCoords.posY, currCoords.posZ);
      items.addAll(block.getDrops(world, currCoords.posX, currCoords.posY, currCoords.posZ, meta, 0));

View Full Code Here

    if(redstoneSignal > 0)
      return;

    if(!supertile.getWorldObj().isRemote && mana >= COST && supertile.getWorldObj().getTotalWorldTime() % 100 == 0) {
      ChunkCoordinates coords = getCoordsToPut();
      if(coords != null) {
        ItemStack stack = getOreToPut();
        if(stack != null) {
          Block block = Block.getBlockFromItem(stack.getItem());
          int meta = stack.getItemDamage();
View Full Code Here

          int x = supertile.xCoord + i;
          int y = supertile.yCoord + j;
          int z = supertile.zCoord + k;
          Block block = supertile.getWorldObj().getBlock(x, y, z);
          if(block != null && block.isReplaceableOreGen(supertile.getWorldObj(), x, y, z, Blocks.stone))
            possibleCoords.add(new ChunkCoordinates(x, y, z));
        }

    if(possibleCoords.isEmpty())
      return null;
    return possibleCoords.get(supertile.getWorldObj().rand.nextInt(possibleCoords.size()));
View Full Code Here

TOP

Related Classes of net.minecraft.util.ChunkCoordinates

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.