本文整理匯總了Java中net.minecraft.util.BlockPos.getX方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockPos.getX方法的具體用法?Java BlockPos.getX怎麽用?Java BlockPos.getX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.BlockPos
的用法示例。
在下文中一共展示了BlockPos.getX方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startExecuting
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* Execute a one shot task or start executing a continuous task
*/
public void startExecuting()
{
this.insidePosX = -1;
BlockPos blockpos = this.doorInfo.getInsideBlockPos();
int i = blockpos.getX();
int j = blockpos.getY();
int k = blockpos.getZ();
if (this.entityObj.getDistanceSq(blockpos) > 256.0D)
{
Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.entityObj, 14, 3, new Vec3((double)i + 0.5D, (double)j, (double)k + 0.5D));
if (vec3 != null)
{
this.entityObj.getNavigator().tryMoveToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord, 1.0D);
}
}
else
{
this.entityObj.getNavigator().tryMoveToXYZ((double)i + 0.5D, (double)j, (double)k + 0.5D, 1.0D);
}
}
示例2: checkFallable
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private void checkFallable(World worldIn, BlockPos pos)
{
if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
{
int i = 32;
if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
{
if (!worldIn.isRemote)
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
this.onStartFalling(entityfallingblock);
worldIn.spawnEntityInWorld(entityfallingblock);
}
}
else
{
worldIn.setBlockToAir(pos);
BlockPos blockpos;
for (blockpos = pos.down(); canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
if (blockpos.getY() > 0)
{
worldIn.setBlockState(blockpos.up(), this.getDefaultState());
}
}
}
}
示例3: randomDisplayTick
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
double d0 = (double)((float)pos.getX() + 0.4F + rand.nextFloat() * 0.2F);
double d1 = (double)((float)pos.getY() + 0.7F + rand.nextFloat() * 0.3F);
double d2 = (double)((float)pos.getZ() + 0.4F + rand.nextFloat() * 0.2F);
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
示例4: markBlockForUpdate
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void markBlockForUpdate(BlockPos pos)
{
int i = pos.getX() >> 4;
int j = pos.getZ() >> 4;
PlayerManager.PlayerInstance playermanager$playerinstance = this.getPlayerInstance(i, j, false);
if (playermanager$playerinstance != null)
{
playermanager$playerinstance.flagChunkForUpdate(pos.getX() & 15, pos.getY(), pos.getZ() & 15);
}
}
示例5: notifyLightSet
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void notifyLightSet(BlockPos pos)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
this.markBlocksForUpdate(i - 1, j - 1, k - 1, i + 1, j + 1, k + 1);
}
示例6: generate
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.water)
{
return false;
}
else
{
int i = rand.nextInt(this.radius - 2) + 2;
int j = 2;
for (int k = position.getX() - i; k <= position.getX() + i; ++k)
{
for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
{
int i1 = k - position.getX();
int j1 = l - position.getZ();
if (i1 * i1 + j1 * j1 <= i * i)
{
for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
{
BlockPos blockpos = new BlockPos(k, k1, l);
Block block = worldIn.getBlockState(blockpos).getBlock();
if (block == Blocks.dirt || block == Blocks.grass)
{
worldIn.setBlockState(blockpos, this.block.getDefaultState(), 2);
}
}
}
}
}
return true;
}
}
示例7: breakBlock
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
int i = 1;
int j = i + 1;
int k = pos.getX();
int l = pos.getY();
int i1 = pos.getZ();
if (worldIn.isAreaLoaded(new BlockPos(k - j, l - j, i1 - j), new BlockPos(k + j, l + j, i1 + j)))
{
for (int j1 = -i; j1 <= i; ++j1)
{
for (int k1 = -i; k1 <= i; ++k1)
{
for (int l1 = -i; l1 <= i; ++l1)
{
BlockPos blockpos = pos.add(j1, k1, l1);
IBlockState iblockstate = worldIn.getBlockState(blockpos);
if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue())
{
worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4);
}
}
}
}
}
}
示例8: getBlockStateRaw
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private IBlockState getBlockStateRaw(BlockPos pos)
{
if (pos.getY() >= 0 && pos.getY() < 256)
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;
return this.chunkArray[i][j].getBlockState(pos);
}
else
{
return DEFAULT_STATE;
}
}
示例9: func_175937_a
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
void func_175937_a(BlockPos p_175937_1_, BlockPos p_175937_2_, Block p_175937_3_)
{
BlockPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ());
int i = this.getGreatestDistance(blockpos);
float f = (float)blockpos.getX() / (float)i;
float f1 = (float)blockpos.getY() / (float)i;
float f2 = (float)blockpos.getZ() / (float)i;
for (int j = 0; j <= i; ++j)
{
BlockPos blockpos1 = p_175937_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2));
BlockLog.EnumAxis blocklog$enumaxis = this.func_175938_b(p_175937_1_, blockpos1);
this.setBlockAndNotifyAdequately(this.world, blockpos1, p_175937_3_.getDefaultState().withProperty(BlockLog.LOG_AXIS, blocklog$enumaxis));
}
}
示例10: doExplosionB
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* Does the second part of the explosion (sound, particles, drop spawn)
*/
public void doExplosionB(boolean spawnParticles)
{
this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (this.explosionSize >= 2.0F && this.isSmoking)
{
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D, new int[0]);
}
else
{
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D, new int[0]);
}
if (this.isSmoking)
{
for (BlockPos blockpos : this.affectedBlockPositions)
{
Block block = this.worldObj.getBlockState(blockpos).getBlock();
if (spawnParticles)
{
double d0 = (double)((float)blockpos.getX() + this.worldObj.rand.nextFloat());
double d1 = (double)((float)blockpos.getY() + this.worldObj.rand.nextFloat());
double d2 = (double)((float)blockpos.getZ() + this.worldObj.rand.nextFloat());
double d3 = d0 - this.explosionX;
double d4 = d1 - this.explosionY;
double d5 = d2 - this.explosionZ;
double d6 = (double)MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5);
d3 = d3 / d6;
d4 = d4 / d6;
d5 = d5 / d6;
double d7 = 0.5D / (d6 / (double)this.explosionSize + 0.1D);
d7 = d7 * (double)(this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F);
d3 = d3 * d7;
d4 = d4 * d7;
d5 = d5 * d7;
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5, new int[0]);
this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]);
}
if (block.getMaterial() != Material.air)
{
if (block.canDropFromExplosion(this))
{
block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0);
}
this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3);
block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this);
}
}
}
if (this.isFlaming)
{
for (BlockPos blockpos1 : this.affectedBlockPositions)
{
if (this.worldObj.getBlockState(blockpos1).getBlock().getMaterial() == Material.air && this.worldObj.getBlockState(blockpos1.down()).getBlock().isFullBlock() && this.explosionRNG.nextInt(3) == 0)
{
this.worldObj.setBlockState(blockpos1, Blocks.fire.getDefaultState());
}
}
}
}
示例11: func_179850_c
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean func_179850_c(BlockPos p_179850_1_)
{
int i = p_179850_1_.getX() - this.doorBlockPos.getX();
int j = p_179850_1_.getZ() - this.doorBlockPos.getY();
return i * this.insideDirection.getFrontOffsetX() + j * this.insideDirection.getFrontOffsetZ() >= 0;
}
示例12: createSpawnPosition
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* creates a spawn position at random within 256 blocks of 0,0
*/
private void createSpawnPosition(WorldSettings p_73052_1_)
{
if (!this.provider.canRespawnHere())
{
this.worldInfo.setSpawn(BlockPos.ORIGIN.up(this.provider.getAverageGroundLevel()));
}
else if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD)
{
this.worldInfo.setSpawn(BlockPos.ORIGIN.up());
}
else
{
this.findingSpawnPoint = true;
WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager();
List<BiomeGenBase> list = worldchunkmanager.getBiomesToSpawnIn();
Random random = new Random(this.getSeed());
BlockPos blockpos = worldchunkmanager.findBiomePosition(0, 0, 256, list, random);
int i = 0;
int j = this.provider.getAverageGroundLevel();
int k = 0;
if (blockpos != null)
{
i = blockpos.getX();
k = blockpos.getZ();
}
else
{
logger.warn("Unable to find spawn biome");
}
int l = 0;
while (!this.provider.canCoordinateBeSpawn(i, k))
{
i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64);
++l;
if (l == 1000)
{
break;
}
}
this.worldInfo.setSpawn(new BlockPos(i, j, k));
this.findingSpawnPoint = false;
if (p_73052_1_.isBonusChestEnabled())
{
this.createBonusChest();
}
}
}
示例13: func_175712_a
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public List<NextTickListEntry> func_175712_a(StructureBoundingBox structureBB, boolean p_175712_2_)
{
List<NextTickListEntry> list = null;
for (int i = 0; i < 2; ++i)
{
Iterator<NextTickListEntry> iterator;
if (i == 0)
{
iterator = this.pendingTickListEntriesTreeSet.iterator();
}
else
{
iterator = this.pendingTickListEntriesThisTick.iterator();
}
while (iterator.hasNext())
{
NextTickListEntry nextticklistentry = (NextTickListEntry)iterator.next();
BlockPos blockpos = nextticklistentry.position;
if (blockpos.getX() >= structureBB.minX && blockpos.getX() < structureBB.maxX && blockpos.getZ() >= structureBB.minZ && blockpos.getZ() < structureBB.maxZ)
{
if (p_175712_2_)
{
this.pendingTickListEntriesHashSet.remove(nextticklistentry);
iterator.remove();
}
if (list == null)
{
list = Lists.<NextTickListEntry>newArrayList();
}
list.add(nextticklistentry);
}
}
}
return list;
}
示例14: renderModelStandardQuads
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private void renderModelStandardQuads(IBlockAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, EnumFacing faceIn, int brightnessIn, boolean ownBrightness, WorldRenderer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
{
double d0 = (double)blockPosIn.getX();
double d1 = (double)blockPosIn.getY();
double d2 = (double)blockPosIn.getZ();
Block.EnumOffsetType block$enumoffsettype = blockIn.getOffsetType();
if (block$enumoffsettype != Block.EnumOffsetType.NONE)
{
int i = blockPosIn.getX();
int j = blockPosIn.getZ();
long k = (long)(i * 3129871) ^ (long)j * 116129781L;
k = k * k * 42317861L + k * 11L;
d0 += ((double)((float)(k >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D;
d2 += ((double)((float)(k >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D;
if (block$enumoffsettype == Block.EnumOffsetType.XYZ)
{
d1 += ((double)((float)(k >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D;
}
}
for (BakedQuad bakedquad : listQuadsIn)
{
if (ownBrightness)
{
this.fillQuadBounds(blockIn, bakedquad.getVertexData(), bakedquad.getFace(), (float[])null, boundsFlags);
brightnessIn = boundsFlags.get(0) ? blockIn.getMixedBrightnessForBlock(blockAccessIn, blockPosIn.offset(bakedquad.getFace())) : blockIn.getMixedBrightnessForBlock(blockAccessIn, blockPosIn);
}
worldRendererIn.addVertexData(bakedquad.getVertexData());
worldRendererIn.putBrightness4(brightnessIn, brightnessIn, brightnessIn, brightnessIn);
if (bakedquad.hasTintIndex())
{
int l = blockIn.colorMultiplier(blockAccessIn, blockPosIn, bakedquad.getTintIndex());
if (EntityRenderer.anaglyphEnable)
{
l = TextureUtil.anaglyphColor(l);
}
float f = (float)(l >> 16 & 255) / 255.0F;
float f1 = (float)(l >> 8 & 255) / 255.0F;
float f2 = (float)(l & 255) / 255.0F;
worldRendererIn.putColorMultiplier(f, f1, f2, 4);
worldRendererIn.putColorMultiplier(f, f1, f2, 3);
worldRendererIn.putColorMultiplier(f, f1, f2, 2);
worldRendererIn.putColorMultiplier(f, f1, f2, 1);
}
worldRendererIn.putPosition(d0, d1, d2);
}
}
示例15: getCoordinateInfo
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public static String getCoordinateInfo(BlockPos pos)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
StringBuilder stringbuilder = new StringBuilder();
try
{
stringbuilder.append(String.format("World: (%d,%d,%d)", new Object[] {Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(k)}));
}
catch (Throwable var17)
{
stringbuilder.append("(Error finding world loc)");
}
stringbuilder.append(", ");
try
{
int l = i >> 4;
int i1 = k >> 4;
int j1 = i & 15;
int k1 = j >> 4;
int l1 = k & 15;
int i2 = l << 4;
int j2 = i1 << 4;
int k2 = (l + 1 << 4) - 1;
int l2 = (i1 + 1 << 4) - 1;
stringbuilder.append(String.format("Chunk: (at %d,%d,%d in %d,%d; contains blocks %d,0,%d to %d,255,%d)", new Object[] {Integer.valueOf(j1), Integer.valueOf(k1), Integer.valueOf(l1), Integer.valueOf(l), Integer.valueOf(i1), Integer.valueOf(i2), Integer.valueOf(j2), Integer.valueOf(k2), Integer.valueOf(l2)}));
}
catch (Throwable var16)
{
stringbuilder.append("(Error finding chunk loc)");
}
stringbuilder.append(", ");
try
{
int j3 = i >> 9;
int k3 = k >> 9;
int l3 = j3 << 5;
int i4 = k3 << 5;
int j4 = (j3 + 1 << 5) - 1;
int k4 = (k3 + 1 << 5) - 1;
int l4 = j3 << 9;
int i5 = k3 << 9;
int j5 = (j3 + 1 << 9) - 1;
int i3 = (k3 + 1 << 9) - 1;
stringbuilder.append(String.format("Region: (%d,%d; contains chunks %d,%d to %d,%d, blocks %d,0,%d to %d,255,%d)", new Object[] {Integer.valueOf(j3), Integer.valueOf(k3), Integer.valueOf(l3), Integer.valueOf(i4), Integer.valueOf(j4), Integer.valueOf(k4), Integer.valueOf(l4), Integer.valueOf(i5), Integer.valueOf(j5), Integer.valueOf(i3)}));
}
catch (Throwable var15)
{
stringbuilder.append("(Error finding world loc)");
}
return stringbuilder.toString();
}