当前位置: 首页>>代码示例>>Java>>正文


Java ChunkPosition类代码示例

本文整理汇总了Java中net.minecraft.world.ChunkPosition的典型用法代码示例。如果您正苦于以下问题:Java ChunkPosition类的具体用法?Java ChunkPosition怎么用?Java ChunkPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChunkPosition类属于net.minecraft.world包,在下文中一共展示了ChunkPosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: func_150651_b

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
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--);
        }
    }
}
 
开发者ID:NSDN,项目名称:NyaSamaRailway,代码行数:17,代码来源:BlockWire.java

示例2: func_150651_b

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
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--);
        }
    }
}
 
开发者ID:NSDN,项目名称:NyaSamaRailway,代码行数:17,代码来源:RailBase.java

示例3: findNode

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
@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;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:18,代码来源:NodeHelper.java

示例4: findNodesInChunkWithinRange

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
@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;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:18,代码来源:NodeHelper.java

示例5: searchChunkForBooster

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
@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;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:18,代码来源:TileEntityMagicApiary.java

示例6: getAuraProvider

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
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;
  }
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:18,代码来源:TileEntityMagicApiary.java

示例7: doBlockExplosion

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:MHuanterAxe,项目名称:MHuanterMod,代码行数:21,代码来源:AdvancedExplosion.java

示例8: encodeInto

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:MHuanterAxe,项目名称:MHuanterMod,代码行数:22,代码来源:MSGExplosion.java

示例9: func_150812_a

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
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_);
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:20,代码来源:Chunk.java

示例10: func_147416_a

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
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;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:20,代码来源:ChunkProviderFlat.java

示例11: readPacketData

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:28,代码来源:S27PacketExplosion.java

示例12: func_150651_b

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
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--);
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:17,代码来源:BlockRailBase.java

示例13: getBlockAtEntityViewpoint

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
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;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:20,代码来源:ActiveRenderInfo.java

示例14: onDetonate

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
@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++;
        }
    }
}
 
开发者ID:romelo333,项目名称:notenoughwands,代码行数:25,代码来源:ForgeEventHandlers.java

示例15: removeTileEntity

import net.minecraft.world.ChunkPosition; //导入依赖的package包/类
@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();
        }
    }
}
 
开发者ID:amadornes,项目名称:Framez,代码行数:23,代码来源:BlockUtils.java


注:本文中的net.minecraft.world.ChunkPosition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。