java类net.minecraft.world.ChunkPosition的实例源码

BlockWire.java 文件源码 项目:NyaSamaRailway 阅读 32 收藏 0 点赞 0 评论 0
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--);
        }
    }
}
RailBase.java 文件源码 项目:NyaSamaRailway 阅读 26 收藏 0 点赞 0 评论 0
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--);
        }
    }
}
NodeHelper.java 文件源码 项目:MagicBees 阅读 28 收藏 0 点赞 0 评论 0
@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;
}
NodeHelper.java 文件源码 项目:MagicBees 阅读 26 收藏 0 点赞 0 评论 0
@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;
}
TileEntityMagicApiary.java 文件源码 项目:MagicBees 阅读 28 收藏 0 点赞 0 评论 0
@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;
}
TileEntityMagicApiary.java 文件源码 项目:MagicBees 阅读 20 收藏 0 点赞 0 评论 0
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;
  }
AdvancedExplosion.java 文件源码 项目:MHuanterMod 阅读 22 收藏 0 点赞 0 评论 0
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);
        }
    }
}
MSGExplosion.java 文件源码 项目:MHuanterMod 阅读 19 收藏 0 点赞 0 评论 0
@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);
    }
}
Chunk.java 文件源码 项目:Resilience-Client-Source 阅读 25 收藏 0 点赞 0 评论 0
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_);
    }
}
ChunkProviderFlat.java 文件源码 项目:Resilience-Client-Source 阅读 22 收藏 0 点赞 0 评论 0
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;
}
S27PacketExplosion.java 文件源码 项目:Resilience-Client-Source 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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();
}
BlockRailBase.java 文件源码 项目:Resilience-Client-Source 阅读 32 收藏 0 点赞 0 评论 0
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--);
        }
    }
}
ActiveRenderInfo.java 文件源码 项目:Resilience-Client-Source 阅读 24 收藏 0 点赞 0 评论 0
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;
}
ForgeEventHandlers.java 文件源码 项目:notenoughwands 阅读 24 收藏 0 点赞 0 评论 0
@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++;
        }
    }
}
BlockUtils.java 文件源码 项目:Framez 阅读 34 收藏 0 点赞 0 评论 0
@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();
        }
    }
}
Chunk.java 文件源码 项目:RuneCraftery 阅读 23 收藏 0 点赞 0 评论 0
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;
   }
}
Chunk.java 文件源码 项目:RuneCraftery 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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);
    }
}
Packet60Explosion.java 文件源码 项目:RuneCraftery 阅读 21 收藏 0 点赞 0 评论 0
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);
}
BlockBaseRailLogic.java 文件源码 项目:RuneCraftery 阅读 26 收藏 0 点赞 0 评论 0
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--);
        }
    }
}
S27PacketExplosion.java 文件源码 项目:Cauldron 阅读 26 收藏 0 点赞 0 评论 0
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();
}
ActiveRenderInfo.java 文件源码 项目:Cauldron 阅读 27 收藏 0 点赞 0 评论 0
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;
}
Chunk.java 文件源码 项目:Cauldron 阅读 22 收藏 0 点赞 0 评论 0
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_);
    }
}
ActiveRenderInfo.java 文件源码 项目:RuneCraftery 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 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;
}
Packet60Explosion.java 文件源码 项目:RuneCraftery 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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();
}
MobileChunk.java 文件源码 项目:archimedes-ships 阅读 26 收藏 0 点赞 0 评论 0
/**
 * 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;
}
ChunkProviderFlat.java 文件源码 项目:Cauldron 阅读 27 收藏 0 点赞 0 评论 0
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;
}
BlockRailBase.java 文件源码 项目:Cauldron 阅读 36 收藏 0 点赞 0 评论 0
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--);
        }
    }
}
ShipHandlerServer.java 文件源码 项目:archimedes-ships 阅读 28 收藏 0 点赞 0 评论 0
@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;
}
PacketNEIPong.java 文件源码 项目:ExtraUtilities 阅读 25 收藏 0 点赞 0 评论 0
@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);
    }
}
PacketNEIPong.java 文件源码 项目:ExtraUtilities 阅读 25 收藏 0 点赞 0 评论 0
@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));
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号