本文整理匯總了Java中net.minecraft.util.math.BlockPos.MutableBlockPos方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockPos.MutableBlockPos方法的具體用法?Java BlockPos.MutableBlockPos怎麽用?Java BlockPos.MutableBlockPos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.math.BlockPos
的用法示例。
在下文中一共展示了BlockPos.MutableBlockPos方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getNearbyCornerBlocks
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
private List<TileEntityStructure> getNearbyCornerBlocks(BlockPos p_184418_1_, BlockPos p_184418_2_)
{
List<TileEntityStructure> list = Lists.<TileEntityStructure>newArrayList();
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(p_184418_1_, p_184418_2_))
{
IBlockState iblockstate = this.world.getBlockState(blockpos$mutableblockpos);
if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK)
{
TileEntity tileentity = this.world.getTileEntity(blockpos$mutableblockpos);
if (tileentity != null && tileentity instanceof TileEntityStructure)
{
list.add((TileEntityStructure)tileentity);
}
}
}
return list;
}
示例2: RenderChunk
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public RenderChunk(World p_i47120_1_, RenderGlobal p_i47120_2_, int p_i47120_3_)
{
for (int i = 0; i < this.mapEnumFacing.length; ++i)
{
this.mapEnumFacing[i] = new BlockPos.MutableBlockPos();
}
this.world = p_i47120_1_;
this.renderGlobal = p_i47120_2_;
this.index = p_i47120_3_;
if (OpenGlHelper.useVbo())
{
for (int j = 0; j < BlockRenderLayer.values().length; ++j)
{
this.vertexBuffers[j] = new VertexBuffer(DefaultVertexFormats.BLOCK);
}
}
}
示例3: isFree
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
private PathNodeType isFree(int p_186327_1_, int p_186327_2_, int p_186327_3_)
{
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int i = p_186327_1_; i < p_186327_1_ + this.entitySizeX; ++i)
{
for (int j = p_186327_2_; j < p_186327_2_ + this.entitySizeY; ++j)
{
for (int k = p_186327_3_; k < p_186327_3_ + this.entitySizeZ; ++k)
{
IBlockState iblockstate = this.blockaccess.getBlockState(blockpos$mutableblockpos.setPos(i, j, k));
if (iblockstate.getMaterial() != Material.WATER)
{
return PathNodeType.BLOCKED;
}
}
}
}
return PathNodeType.WATER;
}
示例4: doVoidFogParticles
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public void doVoidFogParticles(int posX, int posY, int posZ)
{
int i = 32;
Random random = new Random();
ItemStack itemstack = this.mc.player.getHeldItemMainhand();
if (itemstack == null || Block.getBlockFromItem(itemstack.getItem()) != Blocks.BARRIER)
{
itemstack = this.mc.player.getHeldItemOffhand();
}
boolean flag = this.mc.playerController.getCurrentGameType() == GameType.CREATIVE && !itemstack.func_190926_b() && itemstack.getItem() == Item.getItemFromBlock(Blocks.BARRIER);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int j = 0; j < 667; ++j)
{
this.showBarrierParticles(posX, posY, posZ, 16, random, flag, blockpos$mutableblockpos);
this.showBarrierParticles(posX, posY, posZ, 32, random, flag, blockpos$mutableblockpos);
}
}
示例5: onUpdate
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void onUpdate() {
oldMotionX = motionX;
oldMotionY = motionY;
oldMotionZ = motionZ;
super.onUpdate();
motionX *= 0.95D; // equal to the potion effect friction. 0.95F
motionY *= 0.95D;
motionZ *= 0.95D;
if (motionX * motionX + motionY * motionY + motionZ * motionZ < 0.1D) {
setDead();
}
if (!world.isRemote) {
BlockPos pos = new BlockPos(posX, posY, posZ);
BlockPos.MutableBlockPos mPos = new BlockPos.MutableBlockPos(pos);
if (tryCutPlants(pos)) {
int plantsCut = 1;
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
if (x == 0 && y == 0 && z == 0) continue;
mPos.setPos(pos.getX() + x, pos.getY() + y, pos.getZ() + z);
if (tryCutPlants(mPos)) plantsCut++;
}
}
}
// slow the vortex down for each plant it broke
double mult = Math.pow(0.8D, plantsCut);
motionX *= mult;
motionY *= mult;
motionZ *= mult;
}
}
}
示例6: getAverageGroundLevel
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
protected int getAverageGroundLevel(World worldIn, StructureBoundingBox structurebb)
{
int i = 0;
int j = 0;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k)
{
for (int l = this.boundingBox.minX; l <= this.boundingBox.maxX; ++l)
{
blockpos$mutableblockpos.setPos(l, 64, k);
if (structurebb.isVecInside(blockpos$mutableblockpos))
{
i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.provider.getAverageGroundLevel() - 1);
++j;
}
}
}
if (j == 0)
{
return -1;
}
else
{
return i / j;
}
}
示例7: hasWater
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
private boolean hasWater(World worldIn, BlockPos pos)
{
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(pos.add(-4, 0, -4), pos.add(4, 1, 4)))
{
if (worldIn.getBlockState(blockpos$mutableblockpos).getMaterial() == Material.WATER)
{
return true;
}
}
return false;
}
示例8: getBrightness
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
/**
* Gets how bright this entity is.
*/
public float getBrightness(float partialTicks)
{
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(this.posX), 0, MathHelper.floor(this.posZ));
if (this.world.isBlockLoaded(blockpos$mutableblockpos))
{
blockpos$mutableblockpos.setY(MathHelper.floor(this.posY + (double)this.getEyeHeight()));
return this.world.getLightBrightness(blockpos$mutableblockpos);
}
else
{
return 0.0F;
}
}
示例9: generate
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(position.add(-1, -2, -1), position.add(1, 2, 1)))
{
boolean flag = blockpos$mutableblockpos.getX() == position.getX();
boolean flag1 = blockpos$mutableblockpos.getY() == position.getY();
boolean flag2 = blockpos$mutableblockpos.getZ() == position.getZ();
boolean flag3 = Math.abs(blockpos$mutableblockpos.getY() - position.getY()) == 2;
if (flag && flag1 && flag2)
{
this.setBlockAndNotifyAdequately(worldIn, new BlockPos(blockpos$mutableblockpos), Blocks.END_GATEWAY.getDefaultState());
}
else if (flag1)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.AIR.getDefaultState());
}
else if (flag3 && flag && flag2)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
}
else if ((flag || flag2) && !flag3)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
}
else
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.AIR.getDefaultState());
}
}
return true;
}
示例10: beforePlace
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void beforePlace(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider, BlockPos pos, float sif, int count)
{
BlockPos.MutableBlockPos p = new BlockPos.MutableBlockPos(pos);
for (int y1 = 0; y1 < count + 1; y1++)
{
p.setY(p.getY() + y1);
world.setBlockToAir(p);
}
}
示例11: propagateUpdate
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public void propagateUpdate(World worldIn, BlockPos pos)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == Blocks.COMMAND_BLOCK || iblockstate.getBlock() == Blocks.REPEATING_COMMAND_BLOCK)
{
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(pos);
blockpos$mutableblockpos.move((EnumFacing)iblockstate.getValue(FACING));
for (TileEntity tileentity = worldIn.getTileEntity(blockpos$mutableblockpos); tileentity instanceof TileEntityCommandBlock; tileentity = worldIn.getTileEntity(blockpos$mutableblockpos))
{
TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;
if (tileentitycommandblock.getMode() != TileEntityCommandBlock.Mode.SEQUENCE)
{
break;
}
IBlockState iblockstate1 = worldIn.getBlockState(blockpos$mutableblockpos);
Block block = iblockstate1.getBlock();
if (block != Blocks.CHAIN_COMMAND_BLOCK || worldIn.isUpdateScheduled(blockpos$mutableblockpos, block))
{
break;
}
worldIn.scheduleUpdate(new BlockPos(blockpos$mutableblockpos), block, this.tickRate(worldIn));
blockpos$mutableblockpos.move((EnumFacing)iblockstate1.getValue(FACING));
}
}
}
示例12: getBrightnessForRender
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public int getBrightnessForRender() {
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(posX), 0, MathHelper.floor(posZ));
if (world != null && world.isBlockLoaded(blockpos$mutableblockpos)) {
blockpos$mutableblockpos.setY(MathHelper.floor(posY + getEyeHeight()));
return world.getCombinedLight(blockpos$mutableblockpos, 0);
}
else {
return 15;
}
}
示例13: getBrightness
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public float getBrightness() {
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(posX), 0, MathHelper.floor(posZ));
if (world != null && world.isBlockLoaded(blockpos$mutableblockpos)) {
blockpos$mutableblockpos.setY(MathHelper.floor(posY + getEyeHeight()));
return world.getLightBrightness(blockpos$mutableblockpos);
}
else {
return 1.0F;
}
}
示例14: showBarrierParticles
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public void showBarrierParticles(int p_184153_1_, int p_184153_2_, int p_184153_3_, int p_184153_4_, Random random, boolean p_184153_6_, BlockPos.MutableBlockPos pos)
{
int i = p_184153_1_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
int j = p_184153_2_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
int k = p_184153_3_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
pos.setPos(i, j, k);
IBlockState iblockstate = this.getBlockState(pos);
iblockstate.getBlock().randomDisplayTick(iblockstate, this, pos, random);
if (p_184153_6_ && iblockstate.getBlock() == Blocks.BARRIER)
{
this.spawnParticle(EnumParticleTypes.BARRIER, (double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), 0.0D, 0.0D, 0.0D, new int[0]);
}
}
示例15: offsetToAverageGroundLevel
import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
protected boolean offsetToAverageGroundLevel(World worldIn, StructureBoundingBox structurebb, int yOffset)
{
if (this.horizontalPos >= 0)
{
return true;
}
else
{
int i = 0;
int j = 0;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k)
{
for (int l = this.boundingBox.minX; l <= this.boundingBox.maxX; ++l)
{
blockpos$mutableblockpos.setPos(l, 64, k);
if (structurebb.isVecInside(blockpos$mutableblockpos))
{
i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.provider.getAverageGroundLevel());
++j;
}
}
}
if (j == 0)
{
return false;
}
else
{
this.horizontalPos = i / j;
this.boundingBox.offset(0, this.horizontalPos - this.boundingBox.minY + yOffset, 0);
return true;
}
}
}