Examples of ChunkCoordinates


Examples of net.minecraft.util.ChunkCoordinates

  public ChunkCoordinates getBinding() {
    if(receiver == null)
      return null;

    TileEntity tile = (TileEntity) receiver;
    return new ChunkCoordinates(tile.xCoord, tile.yCoord, tile.zCoord);
  }
View Full Code Here

Examples of net.minecraft.util.ChunkCoordinates

    EntityThrowable entity = (EntityThrowable) burst;

    switch(stack.getItemDamage()) {
    case BOUNCE : {
      if(!isManaBlock && pos.entityHit == null) {
        ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates();
        if(coords.posX != pos.blockX || coords.posY != pos.blockY || coords.posZ != pos.blockZ) {
          Vector3 currentMovementVec = new Vector3(entity.motionX, entity.motionY, entity.motionZ);
          ForgeDirection dir = ForgeDirection.getOrientation(pos.sideHit);
          Vector3 normalVector = new Vector3(dir.offsetX, dir.offsetY, dir.offsetZ).normalize();
          Vector3 movementVec = normalVector.multiply(-2 * currentMovementVec.dotProduct(normalVector)).add(currentMovementVec);

          burst.setMotion(movementVec.x, movementVec.y, movementVec.z);
          dead = false;
        }
      }
      break;
    }
    case MINE : {
      World world = entity.worldObj;
      int x = pos.blockX;
      int y = pos.blockY;
      int z = pos.blockZ;
      Block block = world.getBlock(x, y, z);
      TileEntity tile = world.getTileEntity(x, y, z);

      int meta = world.getBlockMetadata(x, y, z);
      float hardness = block.getBlockHardness(world, x, y, z);
      int mana = burst.getMana();

      ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates();
      if((coords.posX != x || coords.posY != y || coords.posZ != z) && !(tile instanceof IManaBlock) && block != null && hardness != -1 && hardness < 50F && (burst.isFake() || mana >= 24)) {
        List<ItemStack> items = new ArrayList();

        items.addAll(block.getDrops(world, x, y, z, meta, 0));

        if(!burst.hasAlreadyCollidedAt(x, y, z)) {
          if(!burst.isFake() && !entity.worldObj.isRemote) {
            world.setBlockToAir(x, y, z);
            if(ConfigHandler.blockBreakParticles)
              entity.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));

            for(ItemStack stack_ : items)
              world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack_));
            burst.setMana(mana - 24);
          }
        }

        dead = false;
      }
      break;
    }
    case PHANTOM : {
      if(!isManaBlock) {
        dead = false;
        burst.setMinManaLoss(Math.max(0, burst.getMinManaLoss() - 4));
      }
      break;
    }
    case EXPLOSIVE : {
      if(!burst.isFake()) {
        ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates();
        if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.blockX != coords.posX || pos.blockY != coords.posY || pos.blockZ != coords.posZ))
          entity.worldObj.createExplosion(entity, entity.posX, entity.posY, entity.posZ, burst.getMana() / 50F, true);
      } else dead = false;
      break;
    }
    case WEIGHT : {
      if(!burst.isFake()) {
        int x = pos.blockX;
        int y = pos.blockY;
        int z = pos.blockZ;
        Block block = entity.worldObj.getBlock(x, y, z);
        Block blockBelow = entity.worldObj.getBlock(x, y - 1, z);
        if(blockBelow.isAir(entity.worldObj, x, y - 1, z) && block.getBlockHardness(entity.worldObj, x, y, z) != -1 && entity.worldObj.getTileEntity(x, y, z) == null) {
          EntityFallingBlock falling = new EntityFallingBlock(entity.worldObj, x + 0.5, y + 0.5, z + 0.5, block, entity.worldObj.getBlockMetadata(x, y, z));
          if(!entity.worldObj.isRemote)
            entity.worldObj.spawnEntityInWorld(falling);
        }
      }
      break;
    }
    case PAINT : {
      int storedColor = getStoredColor(stack);
      if(!burst.isFake() && storedColor > -1 && storedColor < 17) {
        if(pos.entityHit != null && pos.entityHit instanceof EntitySheep) {
          int r = 20;
          int sheepColor = ((EntitySheep) pos.entityHit).getFleeceColor();
          List<EntitySheep> sheepList = entity.worldObj.getEntitiesWithinAABB(EntitySheep.class, AxisAlignedBB.getBoundingBox(pos.entityHit.posX - r, pos.entityHit.posY - r, pos.entityHit.posZ - r, pos.entityHit.posX + r, pos.entityHit.posY + r, pos.entityHit.posZ + r));
          for(EntitySheep sheep : sheepList) {
            if(sheep.getFleeceColor() == sheepColor)
              sheep.setFleeceColor(storedColor == 16 ? sheep.worldObj.rand.nextInt(16) : storedColor);
          }
          dead = true;
        } else {
          Block block = entity.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
          if(paintableBlocks.contains(block)) {
            int meta = entity.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ);
            List<ChunkCoordinates> coordsToPaint = new ArrayList();
            List<ChunkCoordinates> coordsFound = new ArrayList();

            ChunkCoordinates theseCoords = new ChunkCoordinates(pos.blockX, pos.blockY, pos.blockZ);
            coordsFound.add(theseCoords);

            do {
              List<ChunkCoordinates> iterCoords = new ArrayList(coordsFound);
              for(ChunkCoordinates coords : iterCoords) {
                coordsFound.remove(coords);
                coordsToPaint.add(coords);

                for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
                  Block block_ = entity.worldObj.getBlock(coords.posX + dir.offsetX, coords.posY + dir.offsetY, coords.posZ + dir.offsetZ);
                  int meta_ = entity.worldObj.getBlockMetadata(coords.posX + dir.offsetX, coords.posY + dir.offsetY, coords.posZ + dir.offsetZ);
                  ChunkCoordinates coords_ = new ChunkCoordinates(coords.posX + dir.offsetX, coords.posY + dir.offsetY, coords.posZ + dir.offsetZ);
                  if(block_ == block && meta_ == meta && !coordsFound.contains(coords_) && !coordsToPaint.contains(coords_))
                    coordsFound.add(coords_);
                }
              }
            } while(!coordsFound.isEmpty() && coordsToPaint.size() < 1000);

            for(ChunkCoordinates coords : coordsToPaint) {
              int placeColor = storedColor == 16 ? entity.worldObj.rand.nextInt(16) : storedColor;
              int metaThere = entity.worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ);

              if(metaThere != placeColor) {
                if(!entity.worldObj.isRemote)
                  entity.worldObj.setBlockMetadataWithNotify(coords.posX, coords.posY, coords.posZ, placeColor, 2);
                float[] color = EntitySheep.fleeceColorTable[placeColor];
                float r = color[0];
                float g = color[1];
                float b = color[2];
                for(int i = 0; i < 4; i++)
                  Botania.proxy.sparkleFX(entity.worldObj, coords.posX + (float) Math.random(), coords.posY + (float) Math.random(), coords.posZ + (float) Math.random(), r, g, b, 0.6F + (float) Math.random() * 0.3F, 5);

              }
            }
          }
        }
      }
      break;
    }
    case FIRE : {
      ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates();
      if((coords.posX != pos.blockX || coords.posY != pos.blockY || coords.posZ != pos.blockZ) && !burst.isFake() && !isManaBlock) {
        ForgeDirection dir = ForgeDirection.getOrientation(pos.sideHit);

        int x = pos.blockX + dir.offsetX;
        int y = pos.blockY + dir.offsetY;
        int z = pos.blockZ + dir.offsetZ;

        Block blockAt = entity.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
        Block blockAt_ = entity.worldObj.getBlock(x, y, z);

        if(blockAt == Blocks.portal)
          entity.worldObj.setBlock(pos.blockX, pos.blockY, pos.blockZ, Blocks.air);
        else if(blockAt_.isAir(entity.worldObj, x, y, z))
          entity.worldObj.setBlock(x, y, z, Blocks.fire);
      }

      break;
    }
    case PISTON : {
      ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates();
      if((coords.posX != pos.blockX || coords.posY != pos.blockY || coords.posZ != pos.blockZ) && !burst.isFake() && !isManaBlock && !entity.worldObj.isRemote) {
        ForgeDirection dir = ForgeDirection.getOrientation(pos.sideHit).getOpposite();
        int x = pos.blockX + dir.offsetX;
        int y = pos.blockY + dir.offsetY;
        int z = pos.blockZ + dir.offsetZ;
View Full Code Here

Examples of net.minecraft.util.ChunkCoordinates

                    continue;
                }

                IManaReceiver receiver = (IManaReceiver) tile;

                ChunkCoordinates srcCoords = burst.getBurstSourceChunkCoordinates();

                if(MathHelper.pointDistanceSpace(tile.xCoord, tile.yCoord, tile.zCoord, srcCoords.posX, srcCoords.posY, srcCoords.posZ) > 3 && receiver.canRecieveManaFromBursts() && !receiver.isFull()) {
                  Vector3 burstVec = Vector3.fromEntity(entity);
                  Vector3 tileVec = Vector3.fromTileEntityCenter(tile).add(0, -0.1, 0);
                  Vector3 motionVec = new Vector3(entity.motionX, entity.motionY, entity.motionZ);
View Full Code Here

Examples of net.minecraft.util.ChunkCoordinates

                  int y_ = y + dir.offsetY;
                  int z_ = z + dir.offsetZ;

                  Block block_ = par2World.getBlock(x_, y_, z_);
                  if(block_.isAir(par2World, x_, y_, z_) || block_.isReplaceable(par2World, x_, y_, z_) || block_ instanceof BlockFlower && !(block_ instanceof ISpecialFlower) || block_ == Blocks.double_plant) {
                    airBlocks.add(new ChunkCoordinates(x_, y_, z_));
                    hasAir = true;
                  }
                }

                if(hasAir) {
View Full Code Here

Examples of net.minecraft.util.ChunkCoordinates

  public ChunkCoordinates getSource() {
    int x = dataWatcher.getWatchableObjectInt(23);
    int y = dataWatcher.getWatchableObjectInt(24);
    int z = dataWatcher.getWatchableObjectInt(25);
    return new ChunkCoordinates(x, y, z);
  }
View Full Code Here

Examples of net.minecraft.util.ChunkCoordinates

    super.writeEntityToNBT(par1nbtTagCompound);
    par1nbtTagCompound.setInteger(TAG_INVUL_TIME, getInvulTime());
    par1nbtTagCompound.setBoolean(TAG_AGGRO, isAggored());
    par1nbtTagCompound.setInteger(TAG_MOB_SPAWN_TICKS, getMobSpawnTicks());

    ChunkCoordinates source = getSource();
    par1nbtTagCompound.setInteger(TAG_SOURCE_X, source.posX);
    par1nbtTagCompound.setInteger(TAG_SOURCE_Y, source.posY);
    par1nbtTagCompound.setInteger(TAG_SOURCE_Z, source.posZ);
  }
View Full Code Here

Examples of net.minecraft.util.ChunkCoordinates

    super.onLivingUpdate();

    if(!worldObj.isRemote && worldObj.difficultySetting == EnumDifficulty.PEACEFUL)
      setDead();

    ChunkCoordinates source = getSource();
   
    float range = 32F;
    List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(source.posX + 0.5 - range, source.posY + 0.5 - range, source.posZ + 0.5 - range, source.posX + 0.5 + range, source.posY + 0.5 + range, source.posZ + 0.5 + range));

    range = 12F;
View Full Code Here

Examples of net.minecraft.util.ChunkCoordinates

        if(worldObj.getCollidingBoundingBoxes(this, boundingBox).isEmpty() && !worldObj.isAnyLiquid(boundingBox))
          flag = true;

        // Prevent out of bounds teleporting
        ChunkCoordinates source = getSource();
        if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(posX, posY, posZ, source.posX, source.posY, source.posZ) > 12)
          flag = false;
      }
    }
View Full Code Here

Examples of net.minecraft.util.ChunkCoordinates

                  exposed = true;
                  break;
                }

              if(exposed)
                coords.add(new ChunkCoordinates(xp, yp, zp));
            }
          }

      if(coords.isEmpty())
        return;

      Collections.shuffle(coords);
      ChunkCoordinates breakCoords = coords.get(0);
      Block block = supertile.getWorldObj().getBlock(breakCoords.posX, breakCoords.posY, breakCoords.posZ);
      int meta = supertile.getWorldObj().getBlockMetadata(breakCoords.posX, breakCoords.posY, breakCoords.posZ);
      supertile.getWorldObj().setBlockToAir(breakCoords.posX, breakCoords.posY, breakCoords.posZ);
      if(ConfigHandler.blockBreakParticles)
        supertile.getWorldObj().playAuxSFX(2001, breakCoords.posX, breakCoords.posY, breakCoords.posZ, Block.getIdFromBlock(block) + (meta << 12));
View Full Code Here

Examples of net.minecraft.util.ChunkCoordinates

          for(int k = 2; k >= -2; k--) {
            int x = par4 + i + 1;
            int y = par5 + k + 1;
            int z = par6 + j + 1;
            if(par3World.isAirBlock(x, y, z) && (!par3World.provider.hasNoSky || y < 255) && ModBlocks.flower.canBlockStay(par3World, x, y, z))
              validCoords.add(new ChunkCoordinates(x, y, z));
          }
        }

      int flowerCount = Math.min(validCoords.size(), par3World.rand.nextBoolean() ? 3 : 4);
      for(int i = 0; i < flowerCount; i++) {
        ChunkCoordinates coords = validCoords.get(par3World.rand.nextInt(validCoords.size()));
        validCoords.remove(coords);
        par3World.setBlock(coords.posX, coords.posY, coords.posZ, ModBlocks.flower, par3World.rand.nextInt(16), 1 | 2);
      }
      par1ItemStack.stackSize--;
    } else {
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.