Java 类net.minecraft.world.ChunkPosition 实例源码

项目:NyaSamaRailway    文件:BlockWire.java   
private void func_150651_b()
{
    for (int i = 0; i < this.array.size(); ++i)
    {
        BlockWire.Rail rail = this.func_150654_a((ChunkPosition)this.array.get(i));

        if (rail != null && rail.func_150653_a(this))
        {
            this.array.set(i, new ChunkPosition(rail.chunkCoordX, rail.chunkCoordY, rail.chunkCoordZ));
        }
        else
        {
            this.array.remove(i--);
        }
    }
}
项目:NyaSamaRailway    文件:RailBase.java   
private void func_150651_b()
{
    for (int i = 0; i < this.array.size(); ++i)
    {
        RailBase.Rail rail = this.func_150654_a((ChunkPosition)this.array.get(i));

        if (rail != null && rail.func_150653_a(this))
        {
            this.array.set(i, new ChunkPosition(rail.chunkCoordX, rail.chunkCoordY, rail.chunkCoordZ));
        }
        else
        {
            this.array.remove(i--);
        }
    }
}
项目:MagicBees    文件:NodeHelper.java   
@SuppressWarnings("unchecked")
public static INode findNode(Chunk chunk, int x, int y, int z, int range) {
    Vec3 apiaryPos = Vec3.createVectorHelper(x, y, z);
    List<TileEntity> tileEntities = new ArrayList<TileEntity>(((Map<ChunkPosition, TileEntity>)chunk.chunkTileEntityMap).values());
    Collections.shuffle(tileEntities);
    for (TileEntity entity : tileEntities) {
        if (entity instanceof INode) {
            Vec3 tePos = Vec3.createVectorHelper(entity.xCoord, entity.yCoord, entity.zCoord);
            Vec3 result = apiaryPos.subtract(tePos);
            if (result.lengthVector() <= range) {
                return (INode)entity;
            }
        }
    }

    return null;
}
项目:MagicBees    文件:NodeHelper.java   
@SuppressWarnings("unchecked")
public static List<INode> findNodesInChunkWithinRange(Chunk chunk, int x, int y, int z, int range) {
    List<INode> nodes = new ArrayList<INode>();
    Vec3 apiaryPos = Vec3.createVectorHelper(x, y, z);
    List<TileEntity> tileEntities = new ArrayList<TileEntity>(((Map<ChunkPosition, TileEntity>)chunk.chunkTileEntityMap).values());
    for (TileEntity entity : tileEntities) {
        if (entity instanceof INode) {
            Vec3 tePos = Vec3.createVectorHelper(entity.xCoord, entity.yCoord, entity.zCoord);
            Vec3 result = apiaryPos.subtract(tePos);
            if (result.lengthVector() <= range) {
                nodes.add((INode)entity);
            }
        }
    }

    return nodes;
}
项目:MagicBees    文件:TileEntityMagicApiary.java   
@SuppressWarnings("unchecked")
private boolean searchChunkForBooster(Chunk chunk) {
    Vec3 apiaryPos = Vec3.createVectorHelper(xCoord, yCoord, zCoord);
    for (Map.Entry<ChunkPosition, TileEntity> entry : ((Map<ChunkPosition, TileEntity>)chunk.chunkTileEntityMap).entrySet()) {
        TileEntity entity = entry.getValue();
        if (entity instanceof IMagicApiaryAuraProvider) {
            Vec3 tePos = Vec3.createVectorHelper(entity.xCoord, entity.yCoord, entity.zCoord);
            Vec3 result = apiaryPos.subtract(tePos);
            if (result.lengthVector() <= AURAPROVIDER_SEARCH_RADIUS) {
                saveAuraProviderPosition(entity.xCoord, entity.yCoord, entity.zCoord);
                this.auraProvider = (IMagicApiaryAuraProvider)entity;
                return true;
            }
        }
    }
    return false;
}
项目:MagicBees    文件:TileEntityMagicApiary.java   
private IMagicApiaryAuraProvider getAuraProvider(int x, int y, int z) {
Chunk chunk = worldObj.getChunkFromBlockCoords(x, z);
x %= 16;
z %= 16;
if (x < 0) {
    x += 16;
}
if (z < 0) {
    z += 16;
}
ChunkPosition cPos = new ChunkPosition(x, y, z);
TileEntity entity = (TileEntity)chunk.chunkTileEntityMap.get(cPos);
      if (!(entity instanceof IMagicApiaryAuraProvider)) {
          return null;
      }
      return (IMagicApiaryAuraProvider)entity;
  }
项目:MHuanterMod    文件:AdvancedExplosion.java   
public void doBlockExplosion() {
    if (!blocksCalculated) {
        calculateBlockExplosion();
    }
    for (int i = affectedBlockPositions.size() - 1; i >= 0; i--) {
        ChunkPosition chunkposition = (ChunkPosition) affectedBlockPositions.get(i);
        int x = chunkposition.chunkPosX;
        int y = chunkposition.chunkPosY;
        int z = chunkposition.chunkPosZ;
        Block block = worldObj.getBlock(x, y, z);
        if (block != null) {
            if (block.canDropFromExplosion(this)) {
                block.dropBlockAsItemWithChance(worldObj, x, y, z, worldObj.getBlockMetadata(x, y, z), 1F / explosionSize, 0);
            }

            worldObj.setBlock(x, y, z, Blocks.air, 0, 3);
            block.onBlockDestroyedByExplosion(worldObj, x, y, z, this);
        }
    }
}
项目:MHuanterMod    文件:MSGExplosion.java   
@Override
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buf) {
    buf.writeDouble(x);
    buf.writeDouble(y);
    buf.writeDouble(z);
    buf.writeFloat(size);
    buf.writeBoolean(smallParticles);
    buf.writeBoolean(bigParticles);

    int n = blocks.size();
    buf.writeInt(n);
    for (int i = 0; i < n; i++) {
        ChunkPosition pos = blocks.get(i);
        int dx = pos.chunkPosX - (int) x;
        int dy = pos.chunkPosY - (int) y;
        int dz = pos.chunkPosZ - (int) z;
        buf.writeByte(dx);
        buf.writeByte(dy);
        buf.writeByte(dz);
    }
}
项目:Resilience-Client-Source    文件:Chunk.java   
public void func_150812_a(int p_150812_1_, int p_150812_2_, int p_150812_3_, TileEntity p_150812_4_)
{
    ChunkPosition var5 = new ChunkPosition(p_150812_1_, p_150812_2_, p_150812_3_);
    p_150812_4_.setWorldObj(this.worldObj);
    p_150812_4_.field_145851_c = this.xPosition * 16 + p_150812_1_;
    p_150812_4_.field_145848_d = p_150812_2_;
    p_150812_4_.field_145849_e = this.zPosition * 16 + p_150812_3_;

    if (this.func_150810_a(p_150812_1_, p_150812_2_, p_150812_3_) instanceof ITileEntityProvider)
    {
        if (this.chunkTileEntityMap.containsKey(var5))
        {
            ((TileEntity)this.chunkTileEntityMap.get(var5)).invalidate();
        }

        p_150812_4_.validate();
        this.chunkTileEntityMap.put(var5, p_150812_4_);
    }
}
项目:Resilience-Client-Source    文件:ChunkProviderFlat.java   
public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_)
{
    if ("Stronghold".equals(p_147416_2_))
    {
        Iterator var6 = this.structureGenerators.iterator();

        while (var6.hasNext())
        {
            MapGenStructure var7 = (MapGenStructure)var6.next();

            if (var7 instanceof MapGenStronghold)
            {
                return var7.func_151545_a(p_147416_1_, p_147416_3_, p_147416_4_, p_147416_5_);
            }
        }
    }

    return null;
}
项目:Resilience-Client-Source    文件:S27PacketExplosion.java   
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer p_148837_1_) throws IOException
{
    this.field_149158_a = (double)p_148837_1_.readFloat();
    this.field_149156_b = (double)p_148837_1_.readFloat();
    this.field_149157_c = (double)p_148837_1_.readFloat();
    this.field_149154_d = p_148837_1_.readFloat();
    int var2 = p_148837_1_.readInt();
    this.field_149155_e = new ArrayList(var2);
    int var3 = (int)this.field_149158_a;
    int var4 = (int)this.field_149156_b;
    int var5 = (int)this.field_149157_c;

    for (int var6 = 0; var6 < var2; ++var6)
    {
        int var7 = p_148837_1_.readByte() + var3;
        int var8 = p_148837_1_.readByte() + var4;
        int var9 = p_148837_1_.readByte() + var5;
        this.field_149155_e.add(new ChunkPosition(var7, var8, var9));
    }

    this.field_149152_f = p_148837_1_.readFloat();
    this.field_149153_g = p_148837_1_.readFloat();
    this.field_149159_h = p_148837_1_.readFloat();
}
项目:Resilience-Client-Source    文件:BlockRailBase.java   
private void func_150651_b()
{
    for (int var1 = 0; var1 < this.field_150657_g.size(); ++var1)
    {
        BlockRailBase.Rail var2 = this.func_150654_a((ChunkPosition)this.field_150657_g.get(var1));

        if (var2 != null && var2.func_150653_a(this))
        {
            this.field_150657_g.set(var1, new ChunkPosition(var2.field_150661_c, var2.field_150658_d, var2.field_150659_e));
        }
        else
        {
            this.field_150657_g.remove(var1--);
        }
    }
}
项目:Resilience-Client-Source    文件:ActiveRenderInfo.java   
public static Block getBlockAtEntityViewpoint(World p_151460_0_, EntityLivingBase p_151460_1_, float p_151460_2_)
{
    Vec3 var3 = projectViewFromEntity(p_151460_1_, (double)p_151460_2_);
    ChunkPosition var4 = new ChunkPosition(var3);
    Block var5 = p_151460_0_.getBlock(var4.field_151329_a, var4.field_151327_b, var4.field_151328_c);

    if (var5.getMaterial().isLiquid())
    {
        float var6 = BlockLiquid.func_149801_b(p_151460_0_.getBlockMetadata(var4.field_151329_a, var4.field_151327_b, var4.field_151328_c)) - 0.11111111F;
        float var7 = (float)(var4.field_151327_b + 1) - var6;

        if (var3.yCoord >= (double)var7)
        {
            var5 = p_151460_0_.getBlock(var4.field_151329_a, var4.field_151327_b + 1, var4.field_151328_c);
        }
    }

    return var5;
}
项目:notenoughwands    文件:ForgeEventHandlers.java   
@SubscribeEvent
public void onDetonate(ExplosionEvent.Detonate event) {
    World world = event.world;
    if (world.isRemote) {
        return;
    }
    ProtectedBlocks protectedBlocks = ProtectedBlocks.getProtectedBlocks(world);
    if (!protectedBlocks.hasProtections()) {
        return;
    }


    List<ChunkPosition> affectedBlocks = event.getAffectedBlocks();

    int i = 0;
    while (i < affectedBlocks.size()) {
        ChunkPosition block = affectedBlocks.get(i);
        if (protectedBlocks.isProtected(world, block.chunkPosX, block.chunkPosY, block.chunkPosZ)) {
            affectedBlocks.remove(i);
        } else {
            i++;
        }
    }
}
项目:Framez    文件:BlockUtils.java   
@SuppressWarnings("rawtypes")
public static void removeTileEntity(World world, int x, int y, int z, boolean removeFromChunk, boolean removeFromWorld) {

    Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
    TileEntity te = null;
    if (chunk != null) {
        if (removeFromChunk) {
            te = (TileEntity) chunk.chunkTileEntityMap.remove(new ChunkPosition(x & 15, y, z & 15));
        } else {
            te = (TileEntity) chunk.chunkTileEntityMap.get(new ChunkPosition(x & 15, y, z & 15));
        }
    }

    if (te != null && removeFromWorld) {
        Iterator it = world.loadedTileEntityList.iterator();
        while (it.hasNext()) {
            TileEntity tile = (TileEntity) it.next();
            if (tile == te)
                it.remove();
        }
    }
}
项目:RuneCraftery    文件:Chunk.java   
public TileEntity func_76597_e(int p_76597_1_, int p_76597_2_, int p_76597_3_) {
   ChunkPosition var4 = new ChunkPosition(p_76597_1_, p_76597_2_, p_76597_3_);
   TileEntity var5 = (TileEntity)this.field_76648_i.get(var4);
   if(var5 == null) {
      int var6 = this.func_76610_a(p_76597_1_, p_76597_2_, p_76597_3_);
      if(var6 <= 0 || !Block.field_71973_m[var6].func_71887_s()) {
         return null;
      }

      if(var5 == null) {
         var5 = ((ITileEntityProvider)Block.field_71973_m[var6]).func_72274_a(this.field_76637_e);
         this.field_76637_e.func_72837_a(this.field_76635_g * 16 + p_76597_1_, p_76597_2_, this.field_76647_h * 16 + p_76597_3_, var5);
      }

      var5 = (TileEntity)this.field_76648_i.get(var4);
   }

   if(var5 != null && var5.func_70320_p()) {
      this.field_76648_i.remove(var4);
      return null;
   } else {
      return var5;
   }
}
项目:RuneCraftery    文件:Chunk.java   
/**
 * Sets the TileEntity for a given block in this chunk
 */
public void setChunkBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity)
{
    ChunkPosition chunkposition = new ChunkPosition(par1, par2, par3);
    par4TileEntity.setWorldObj(this.worldObj);
    par4TileEntity.xCoord = this.xPosition * 16 + par1;
    par4TileEntity.yCoord = par2;
    par4TileEntity.zCoord = this.zPosition * 16 + par3;

    Block block = Block.blocksList[getBlockID(par1, par2, par3)];
    if (block != null && block.hasTileEntity(getBlockMetadata(par1, par2, par3)))
    {
        if (this.chunkTileEntityMap.containsKey(chunkposition))
        {
            ((TileEntity)this.chunkTileEntityMap.get(chunkposition)).invalidate();
        }

        par4TileEntity.validate();
        this.chunkTileEntityMap.put(chunkposition, par4TileEntity);
    }
}
项目:RuneCraftery    文件:Packet60Explosion.java   
public void func_73273_a(DataOutput p_73273_1_) throws IOException {
   p_73273_1_.writeDouble(this.field_73616_a);
   p_73273_1_.writeDouble(this.field_73614_b);
   p_73273_1_.writeDouble(this.field_73615_c);
   p_73273_1_.writeFloat(this.field_73612_d);
   p_73273_1_.writeInt(this.field_73613_e.size());
   int var2 = (int)this.field_73616_a;
   int var3 = (int)this.field_73614_b;
   int var4 = (int)this.field_73615_c;
   Iterator var5 = this.field_73613_e.iterator();

   while(var5.hasNext()) {
      ChunkPosition var6 = (ChunkPosition)var5.next();
      int var7 = var6.field_76930_a - var2;
      int var8 = var6.field_76928_b - var3;
      int var9 = var6.field_76929_c - var4;
      p_73273_1_.writeByte(var7);
      p_73273_1_.writeByte(var8);
      p_73273_1_.writeByte(var9);
   }

   p_73273_1_.writeFloat(this.field_73610_f);
   p_73273_1_.writeFloat(this.field_73611_g);
   p_73273_1_.writeFloat(this.field_73617_h);
}
项目:RuneCraftery    文件:BlockBaseRailLogic.java   
private void refreshConnectedTracks()
{
    for (int i = 0; i < this.railChunkPosition.size(); ++i)
    {
        BlockBaseRailLogic blockbaseraillogic = this.getRailLogic((ChunkPosition)this.railChunkPosition.get(i));

        if (blockbaseraillogic != null && blockbaseraillogic.isRailChunkPositionCorrect(this))
        {
            this.railChunkPosition.set(i, new ChunkPosition(blockbaseraillogic.railX, blockbaseraillogic.railY, blockbaseraillogic.railZ));
        }
        else
        {
            this.railChunkPosition.remove(i--);
        }
    }
}
项目:Cauldron    文件:S27PacketExplosion.java   
public void readPacketData(PacketBuffer p_148837_1_) throws IOException
{
    this.field_149158_a = (double)p_148837_1_.readFloat();
    this.field_149156_b = (double)p_148837_1_.readFloat();
    this.field_149157_c = (double)p_148837_1_.readFloat();
    this.field_149154_d = p_148837_1_.readFloat();
    int i = p_148837_1_.readInt();
    this.field_149155_e = new ArrayList(i);
    int j = (int)this.field_149158_a;
    int k = (int)this.field_149156_b;
    int l = (int)this.field_149157_c;

    for (int i1 = 0; i1 < i; ++i1)
    {
        int j1 = p_148837_1_.readByte() + j;
        int k1 = p_148837_1_.readByte() + k;
        int l1 = p_148837_1_.readByte() + l;
        this.field_149155_e.add(new ChunkPosition(j1, k1, l1));
    }

    this.field_149152_f = p_148837_1_.readFloat();
    this.field_149153_g = p_148837_1_.readFloat();
    this.field_149159_h = p_148837_1_.readFloat();
}
项目:Cauldron    文件:ActiveRenderInfo.java   
public static Block getBlockAtEntityViewpoint(World p_151460_0_, EntityLivingBase p_151460_1_, float p_151460_2_)
{
    Vec3 vec3 = projectViewFromEntity(p_151460_1_, (double)p_151460_2_);
    ChunkPosition chunkposition = new ChunkPosition(vec3);
    Block block = p_151460_0_.getBlock(chunkposition.chunkPosX, chunkposition.chunkPosY, chunkposition.chunkPosZ);

    if (block.getMaterial().isLiquid())
    {
        float f1 = BlockLiquid.getLiquidHeightPercent(p_151460_0_.getBlockMetadata(chunkposition.chunkPosX, chunkposition.chunkPosY, chunkposition.chunkPosZ)) - 0.11111111F;
        float f2 = (float)(chunkposition.chunkPosY + 1) - f1;

        if (vec3.yCoord >= (double)f2)
        {
            block = p_151460_0_.getBlock(chunkposition.chunkPosX, chunkposition.chunkPosY + 1, chunkposition.chunkPosZ);
        }
    }

    return block;
}
项目:Cauldron    文件:Chunk.java   
public void func_150812_a(int p_150812_1_, int p_150812_2_, int p_150812_3_, TileEntity p_150812_4_)
{
    ChunkPosition chunkposition = new ChunkPosition(p_150812_1_, p_150812_2_, p_150812_3_);
    p_150812_4_.setWorldObj(this.worldObj);
    p_150812_4_.xCoord = this.xPosition * 16 + p_150812_1_;
    p_150812_4_.yCoord = p_150812_2_;
    p_150812_4_.zCoord = this.zPosition * 16 + p_150812_3_;

    int metadata = getBlockMetadata(p_150812_1_, p_150812_2_, p_150812_3_);
    if (this.getBlock(p_150812_1_, p_150812_2_, p_150812_3_).hasTileEntity(metadata))
    {
        if (this.chunkTileEntityMap.containsKey(chunkposition))
        {
            ((TileEntity)this.chunkTileEntityMap.get(chunkposition)).invalidate();
        }

        p_150812_4_.validate();
        this.chunkTileEntityMap.put(chunkposition, p_150812_4_);
    }
}
项目:RuneCraftery    文件:ActiveRenderInfo.java   
/**
 * Returns the block ID at the current camera location (either air or fluid), taking into account the height of
 * fluid blocks
 */
public static int getBlockIdAtEntityViewpoint(World par0World, EntityLivingBase par1EntityLivingBase, float par2)
{
    Vec3 vec3 = projectViewFromEntity(par1EntityLivingBase, (double)par2);
    ChunkPosition chunkposition = new ChunkPosition(vec3);
    int i = par0World.getBlockId(chunkposition.x, chunkposition.y, chunkposition.z);

    if (i != 0 && Block.blocksList[i].blockMaterial.isLiquid())
    {
        float f1 = BlockFluid.getFluidHeightPercent(par0World.getBlockMetadata(chunkposition.x, chunkposition.y, chunkposition.z)) - 0.11111111F;
        float f2 = (float)(chunkposition.y + 1) - f1;

        if (vec3.yCoord >= (double)f2)
        {
            i = par0World.getBlockId(chunkposition.x, chunkposition.y + 1, chunkposition.z);
        }
    }

    return i;
}
项目:RuneCraftery    文件:Packet60Explosion.java   
/**
 * Abstract. Reads the raw packet data from the data stream.
 */
public void readPacketData(DataInput par1DataInput) throws IOException
{
    this.explosionX = par1DataInput.readDouble();
    this.explosionY = par1DataInput.readDouble();
    this.explosionZ = par1DataInput.readDouble();
    this.explosionSize = par1DataInput.readFloat();
    int i = par1DataInput.readInt();
    this.chunkPositionRecords = new ArrayList(i);
    int j = (int)this.explosionX;
    int k = (int)this.explosionY;
    int l = (int)this.explosionZ;

    for (int i1 = 0; i1 < i; ++i1)
    {
        int j1 = par1DataInput.readByte() + j;
        int k1 = par1DataInput.readByte() + k;
        int l1 = par1DataInput.readByte() + l;
        this.chunkPositionRecords.add(new ChunkPosition(j1, k1, l1));
    }

    this.playerVelocityX = par1DataInput.readFloat();
    this.playerVelocityY = par1DataInput.readFloat();
    this.playerVelocityZ = par1DataInput.readFloat();
}
项目:archimedes-ships    文件:MobileChunk.java   
/**
 * Gets the TileEntity for a given block in this chunk
 */
@Override
public TileEntity getTileEntity(int x, int y, int z)
{
    ChunkPosition chunkposition = new ChunkPosition(x, y, z);
    TileEntity tileentity = chunkTileEntityMap.get(chunkposition);

    if (tileentity == null)
    {
        Block block = getBlock(x, y, z);
        int meta = getBlockMetadata(x, y, z);

        if (block == null || !block.hasTileEntity(meta))
        {
            return null;
        }

        tileentity = block.createTileEntity(worldObj, meta);
        setTileEntity(x, y, z, tileentity);

        tileentity = chunkTileEntityMap.get(chunkposition);
    }

    return tileentity;
}
项目:Cauldron    文件:ChunkProviderFlat.java   
public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_)
{
    if ("Stronghold".equals(p_147416_2_))
    {
        Iterator iterator = this.structureGenerators.iterator();

        while (iterator.hasNext())
        {
            MapGenStructure mapgenstructure = (MapGenStructure)iterator.next();

            if (mapgenstructure instanceof MapGenStronghold)
            {
                return mapgenstructure.func_151545_a(p_147416_1_, p_147416_3_, p_147416_4_, p_147416_5_);
            }
        }
    }

    return null;
}
项目:Cauldron    文件:BlockRailBase.java   
private void func_150651_b()
{
    for (int i = 0; i < this.field_150657_g.size(); ++i)
    {
        BlockRailBase.Rail rail = this.func_150654_a((ChunkPosition)this.field_150657_g.get(i));

        if (rail != null && rail.func_150653_a(this))
        {
            this.field_150657_g.set(i, new ChunkPosition(rail.field_150661_c, rail.field_150658_d, rail.field_150659_e));
        }
        else
        {
            this.field_150657_g.remove(i--);
        }
    }
}
项目:archimedes-ships    文件:ShipHandlerServer.java   
@Override
public void onChunkUpdate()
{
    super.onChunkUpdate();
    Collection<ChunkPosition> list = ((MobileChunkServer) ship.getShipChunk()).getSendQueue();
    if (firstChunkUpdate)
    {
        ship.getCapabilities().spawnSeatEntities();
    } else
    {
        MsgChunkBlockUpdate msg = new MsgChunkBlockUpdate(ship, list);
        ArchimedesShipMod.instance.pipeline.sendToAllAround(msg, new TargetPoint(ship.worldObj.provider.dimensionId, ship.posX, ship.posY, ship.posZ, 64D));
    }
    list.clear();
    firstChunkUpdate = false;
}
项目:ExtraUtilities    文件:PacketNEIPong.java   
@Override
public void writeData(final ByteBuf data) throws Exception {
    data.writeByte(this.positionList.size());
    for (final ChunkPosition pos : this.positionList) {
        data.writeInt(pos.chunkPosX);
        data.writeByte(pos.chunkPosY);
        data.writeInt(pos.chunkPosZ);
    }
}
项目:ExtraUtilities    文件:PacketNEIPong.java   
@Override
public void readData(final EntityPlayer player, final ByteBuf data) {
    int n = data.readUnsignedByte();
    if (n > 20) {
        n = 20;
    }
    this.positionList = new ArrayList<ChunkPosition>(n);
    for (int i = 0; i < n; ++i) {
        final int x = data.readInt();
        final int y = data.readUnsignedByte();
        final int z = data.readInt();
        this.positionList.add(new ChunkPosition(x, y, z));
    }
}
项目:ExtraUtilities    文件:PacketNEIPong.java   
@SideOnly(Side.CLIENT)
@Override
public void doStuffClient() {
    Minecraft.getMinecraft().thePlayer.closeScreen();
    for (final ChunkPosition chunkPosition : this.positionList) {
        for (int i = 0; i < 20; ++i) {
            Minecraft.getMinecraft().effectRenderer.addEffect((EntityFX)new ParticlePing(Minecraft.getMinecraft().theWorld, chunkPosition));
        }
    }
}
项目:witchery    文件:EntitySpirit.java   
private void setWaypointTo(MapGenStructure mapStructure) {
   if(mapStructure != null) {
      ChunkPosition pos = mapStructure.func_151545_a(super.worldObj, (int)super.posX, (int)super.posY, (int)super.posZ);
      if(pos != null) {
         super.homeX = (double)pos.chunkPosX;
         super.homeY = (double)pos.chunkPosY;
         super.homeZ = (double)pos.chunkPosZ;
         super.waypoint = Witchery.Items.GENERIC.itemWaystone.createStack();
      }
   }

}
项目:4Space-5    文件:WorldChunkManagerSpace.java   
@SuppressWarnings("rawtypes")
@Override
public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random)
{
    final int var6 = par1 - par3 >> 2;
    final int var7 = par2 - par3 >> 2;
    final int var8 = par1 + par3 >> 2;
    final int var10 = var8 - var6 + 1;

    final int var16 = var6 + 0 % var10 << 2;
    final int var17 = var7 + 0 / var10 << 2;

    return new ChunkPosition(var16, 0, var17);
}
项目:4Space-5    文件:PlayerCommand.java   
public ChunkPosition getPlayerLookingAtBlock(EntityPlayerMP player, float reach)
{
    Vec3 vec3d = Vec3.createVectorHelper(player.posX, (player.posY + 1.6200000000000001D) - player.yOffset, player.posZ);
    Vec3 vec3d1 = player.getLook(1.0F);
    Vec3 vec3d2 = vec3d.addVector(vec3d1.xCoord * reach, vec3d1.yCoord * reach, vec3d1.zCoord * reach);
    MovingObjectPosition hit = player.worldObj.rayTraceBlocks(vec3d, vec3d2);
    if(hit == null || hit.typeOfHit != MovingObjectType.BLOCK)
    {
        return null;
    }

    return new ChunkPosition(hit.blockX, hit.blockY, hit.blockZ);
}
项目:FairyFactions    文件:Spawner.java   
protected ChunkPosition getRandomSpawningPointInChunk(World world, int i, int j) {
    int k = i + world.rand.nextInt(16);
    world.getClass();
    int l = world.rand.nextInt(128);
    int i1 = j + world.rand.nextInt(16);
    return new ChunkPosition(k, l, i1);
}
项目:NyaSamaRailway    文件:BlockWire.java   
protected BlockWire.Rail func_150654_a(ChunkPosition chunkPosition)
{
    return checkBlockIsMe(this.world, chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ) ?
            new Rail(this.world, chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ)
            : (
            checkBlockIsMe(this.world, chunkPosition.chunkPosX, chunkPosition.chunkPosY + 1, chunkPosition.chunkPosZ) ?
                    new Rail(this.world, chunkPosition.chunkPosX, chunkPosition.chunkPosY + 1, chunkPosition.chunkPosZ)
                    : (
                    checkBlockIsMe(this.world, chunkPosition.chunkPosX, chunkPosition.chunkPosY - 1, chunkPosition.chunkPosZ) ?
                            new Rail(this.world, chunkPosition.chunkPosX, chunkPosition.chunkPosY - 1, chunkPosition.chunkPosZ)
                            : null)
    );
}
项目:NyaSamaRailway    文件:BlockWire.java   
private boolean func_150653_a(BlockWire.Rail p_150653_1_)
{
    for (int i = 0; i < this.array.size(); ++i)
    {
        ChunkPosition chunkposition = (ChunkPosition)this.array.get(i);

        if (chunkposition.chunkPosX == p_150653_1_.chunkCoordX && chunkposition.chunkPosZ == p_150653_1_.chunkCoordZ)
        {
            return true;
        }
    }

    return false;
}
项目:NyaSamaRailway    文件:BlockWire.java   
private boolean func_150652_b(int p_150652_1_, int p_150652_2_, int p_150652_3_)
{
    for (int l = 0; l < this.array.size(); ++l)
    {
        ChunkPosition chunkposition = (ChunkPosition)this.array.get(l);

        if (chunkposition.chunkPosX == p_150652_1_ && chunkposition.chunkPosZ == p_150652_3_)
        {
            return true;
        }
    }

    return false;
}
项目:NyaSamaRailway    文件:BlockWire.java   
private boolean func_150647_c(int p_150647_1_, int p_150647_2_, int p_150647_3_)
{
    BlockWire.Rail rail = this.func_150654_a(new ChunkPosition(p_150647_1_, p_150647_2_, p_150647_3_));

    if (rail == null)
    {
        return false;
    }
    else
    {
        rail.func_150651_b();
        return rail.func_150649_b(this);
    }
}
项目:NyaSamaRailway    文件:RailBase.java   
private boolean func_150653_a(RailBase.Rail p_150653_1_)
{
    for (int i = 0; i < this.array.size(); ++i)
    {
        ChunkPosition chunkposition = (ChunkPosition)this.array.get(i);

        if (chunkposition.chunkPosX == p_150653_1_.chunkCoordX && chunkposition.chunkPosZ == p_150653_1_.chunkCoordZ)
        {
            return true;
        }
    }

    return false;
}