本文整理匯總了Java中net.minecraft.block.material.Material.air方法的典型用法代碼示例。如果您正苦於以下問題:Java Material.air方法的具體用法?Java Material.air怎麽用?Java Material.air使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.block.material.Material
的用法示例。
在下文中一共展示了Material.air方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onItemUse
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
/**
* Called when a Block is right-clicked with this Item
*/
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
pos = pos.offset(side);
if (!playerIn.canPlayerEdit(pos, side, stack))
{
return false;
}
else
{
if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air)
{
worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
worldIn.setBlockState(pos, Blocks.fire.getDefaultState());
}
stack.damageItem(1, playerIn);
return true;
}
}
示例2: func_175928_b
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
protected void func_175928_b(World worldIn, BlockPos p_175928_2_, int p_175928_3_)
{
int i = p_175928_3_ * p_175928_3_;
for (int j = -p_175928_3_; j <= p_175928_3_; ++j)
{
for (int k = -p_175928_3_; k <= p_175928_3_; ++k)
{
if (j * j + k * k <= i)
{
BlockPos blockpos = p_175928_2_.add(j, 0, k);
Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial();
if (material == Material.air || material == Material.leaves)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
}
}
}
}
}
示例3: spawnBonemealParticles
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
public static void spawnBonemealParticles(World worldIn, BlockPos pos, int amount)
{
if (amount == 0)
{
amount = 15;
}
Block block = worldIn.getBlockState(pos).getBlock();
if (block.getMaterial() != Material.air)
{
block.setBlockBoundsBasedOnState(worldIn, pos);
for (int i = 0; i < amount; ++i)
{
double d0 = itemRand.nextGaussian() * 0.02D;
double d1 = itemRand.nextGaussian() * 0.02D;
double d2 = itemRand.nextGaussian() * 0.02D;
worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]);
}
}
}
示例4: fillWithBlocks
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
/**
* Fill the given area with the selected blocks
*/
protected void fillWithBlocks(World worldIn, StructureBoundingBox boundingboxIn, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, IBlockState boundaryBlockState, IBlockState insideBlockState, boolean existingOnly)
{
for (int i = yMin; i <= yMax; ++i)
{
for (int j = xMin; j <= xMax; ++j)
{
for (int k = zMin; k <= zMax; ++k)
{
if (!existingOnly || this.getBlockStateFromPos(worldIn, j, i, k, boundingboxIn).getBlock().getMaterial() != Material.air)
{
if (i != yMin && i != yMax && j != xMin && j != xMax && k != zMin && k != zMax)
{
this.setBlockState(worldIn, insideBlockState, j, i, k, boundingboxIn);
}
else
{
this.setBlockState(worldIn, boundaryBlockState, j, i, k, boundingboxIn);
}
}
}
}
}
}
示例5: fillWithRandomizedBlocks
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
/**
* arguments: World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
* maxZ, boolean alwaysreplace, Random rand, StructurePieceBlockSelector blockselector
*/
protected void fillWithRandomizedBlocks(World worldIn, StructureBoundingBox boundingboxIn, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, boolean alwaysReplace, Random rand, StructureComponent.BlockSelector blockselector)
{
for (int i = minY; i <= maxY; ++i)
{
for (int j = minX; j <= maxX; ++j)
{
for (int k = minZ; k <= maxZ; ++k)
{
if (!alwaysReplace || this.getBlockStateFromPos(worldIn, j, i, k, boundingboxIn).getBlock().getMaterial() != Material.air)
{
blockselector.selectBlocks(rand, j, i, k, i == minY || i == maxY || j == minX || j == maxX || k == minZ || k == maxZ);
this.setBlockState(worldIn, blockselector.getBlockState(), j, i, k, boundingboxIn);
}
}
}
}
}
示例6: func_181631_a
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
void func_181631_a(BlockPos p_181631_1_, float p_181631_2_, IBlockState p_181631_3_)
{
int i = (int)((double)p_181631_2_ + 0.618D);
for (int j = -i; j <= i; ++j)
{
for (int k = -i; k <= i; ++k)
{
if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_))
{
BlockPos blockpos = p_181631_1_.add(j, 0, k);
Material material = this.world.getBlockState(blockpos).getBlock().getMaterial();
if (material == Material.air || material == Material.leaves)
{
this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_);
}
}
}
}
}
示例7: sendClickBlockToController
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
private void sendClickBlockToController(boolean leftClick)
{
if (!leftClick)
{
this.leftClickCounter = 0;
}
if (this.leftClickCounter <= 0 && !this.thePlayer.isUsingItem())
{
if (leftClick && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
BlockPos blockpos = this.objectMouseOver.getBlockPos();
if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit))
{
this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit);
this.thePlayer.swingItem();
}
}
else
{
this.playerController.resetBlockRemoving();
}
}
}
示例8: updateFallState
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos)
{
if (!this.isInWater())
{
this.handleWaterMovement();
}
if (!this.worldObj.isRemote && this.fallDistance > 3.0F && onGroundIn)
{
IBlockState iblockstate = this.worldObj.getBlockState(pos);
Block block = iblockstate.getBlock();
float f = (float)MathHelper.ceiling_float_int(this.fallDistance - 3.0F);
if (block.getMaterial() != Material.air)
{
double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F);
if (d0 > 2.5D)
{
d0 = 2.5D;
}
int i = (int)(150.0D * d0);
((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(iblockstate)});
}
}
super.updateFallState(y, onGroundIn, blockIn, pos);
}
示例9: clickMouse
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
private void clickMouse() {
if (this.leftClickCounter <= 0) {
this.thePlayer.swingItem();
if (this.objectMouseOver == null) {
logger.error("Null returned as \'hitResult\', this shouldn\'t happen!");
if (this.playerController.isNotCreative()) {
this.leftClickCounter = 10;
}
} else {
switch (this.objectMouseOver.typeOfHit) {
case ENTITY:
this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit);
break;
case BLOCK:
BlockPos blockpos = this.objectMouseOver.getBlockPos();
if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) {
this.playerController.clickBlock(blockpos, this.objectMouseOver.sideHit);
break;
}
case MISS:
default:
if (this.playerController.isNotCreative()) {
this.leftClickCounter = 10;
}
}
}
}
}
示例10: enqueueRelightChecks
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
/**
* Called once-per-chunk-per-tick, and advances the round-robin relight check index by up to 8 blocks at a time. In
* a worst-case scenario, can potentially take up to 25.6 seconds, calculated via (4096/8)/20, to re-check all
* blocks in a chunk, which may explain lagging light updates on initial world generation.
*/
public void enqueueRelightChecks()
{
BlockPos blockpos = new BlockPos(this.xPosition << 4, 0, this.zPosition << 4);
for (int i = 0; i < 8; ++i)
{
if (this.queuedLightChecks >= 4096)
{
return;
}
int j = this.queuedLightChecks % 16;
int k = this.queuedLightChecks / 16 % 16;
int l = this.queuedLightChecks / 256;
++this.queuedLightChecks;
for (int i1 = 0; i1 < 16; ++i1)
{
BlockPos blockpos1 = blockpos.add(k, (j << 4) + i1, l);
boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15;
if (this.storageArrays[j] == null && flag || this.storageArrays[j] != null && this.storageArrays[j].getBlockByExtId(k, i1, l).getMaterial() == Material.air)
{
for (EnumFacing enumfacing : EnumFacing.values())
{
BlockPos blockpos2 = blockpos1.offset(enumfacing);
if (this.worldObj.getBlockState(blockpos2).getBlock().getLightValue() > 0)
{
this.worldObj.checkLight(blockpos2);
}
}
this.worldObj.checkLight(blockpos1);
}
}
}
}
示例11: func_181650_b
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
private void func_181650_b(World p_181650_1_, BlockPos p_181650_2_, PropertyBool p_181650_3_)
{
this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_);
int i = 4;
for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().getMaterial() == Material.air && i > 0; --i)
{
this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_);
p_181650_2_ = p_181650_2_.down();
}
}
示例12: isAirBlock
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
/**
* Checks to see if an air block exists at the provided location. Note that this only checks to see if the blocks
* material is set to air, meaning it is possible for non-vanilla blocks to still pass this check.
*/
public boolean isAirBlock(BlockPos pos)
{
return this.getBlockState(pos).getBlock().getMaterial() == Material.air;
}
示例13: tickUpdates
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
/**
* Runs through the list of updates to run and ticks them
*/
public boolean tickUpdates(boolean p_72955_1_)
{
if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD)
{
return false;
}
else
{
int i = this.pendingTickListEntriesTreeSet.size();
if (i != this.pendingTickListEntriesHashSet.size())
{
throw new IllegalStateException("TickNextTick list out of synch");
}
else
{
if (i > 1000)
{
i = 1000;
}
this.theProfiler.startSection("cleaning");
for (int j = 0; j < i; ++j)
{
NextTickListEntry nextticklistentry = (NextTickListEntry)this.pendingTickListEntriesTreeSet.first();
if (!p_72955_1_ && nextticklistentry.scheduledTime > this.worldInfo.getWorldTotalTime())
{
break;
}
this.pendingTickListEntriesTreeSet.remove(nextticklistentry);
this.pendingTickListEntriesHashSet.remove(nextticklistentry);
this.pendingTickListEntriesThisTick.add(nextticklistentry);
}
this.theProfiler.endSection();
this.theProfiler.startSection("ticking");
Iterator<NextTickListEntry> iterator = this.pendingTickListEntriesThisTick.iterator();
while (iterator.hasNext())
{
NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next();
iterator.remove();
int k = 0;
if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k)))
{
IBlockState iblockstate = this.getBlockState(nextticklistentry1.position);
if (iblockstate.getBlock().getMaterial() != Material.air && Block.isEqualTo(iblockstate.getBlock(), nextticklistentry1.getBlock()))
{
try
{
iblockstate.getBlock().updateTick(this, nextticklistentry1.position, iblockstate, this.rand);
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception while ticking a block");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being ticked");
CrashReportCategory.addBlockInfo(crashreportcategory, nextticklistentry1.position, iblockstate);
throw new ReportedException(crashreport);
}
}
}
else
{
this.scheduleUpdate(nextticklistentry1.position, nextticklistentry1.getBlock(), 0);
}
}
this.theProfiler.endSection();
this.pendingTickListEntriesThisTick.clear();
return !this.pendingTickListEntriesTreeSet.isEmpty();
}
}
}
示例14: updateBlockRemoving
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
public void updateBlockRemoving()
{
++this.curblockDamage;
if (this.receivedFinishDiggingPacket)
{
int i = this.curblockDamage - this.initialBlockDamage;
Block block = this.theWorld.getBlockState(this.field_180241_i).getBlock();
if (block.getMaterial() == Material.air)
{
this.receivedFinishDiggingPacket = false;
}
else
{
float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(i + 1);
int j = (int)(f * 10.0F);
if (j != this.durabilityRemainingOnBlock)
{
this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180241_i, j);
this.durabilityRemainingOnBlock = j;
}
if (f >= 1.0F)
{
this.receivedFinishDiggingPacket = false;
this.tryHarvestBlock(this.field_180241_i);
}
}
}
else if (this.isDestroyingBlock)
{
Block block1 = this.theWorld.getBlockState(this.field_180240_f).getBlock();
if (block1.getMaterial() == Material.air)
{
this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180240_f, -1);
this.durabilityRemainingOnBlock = -1;
this.isDestroyingBlock = false;
}
else
{
int k = this.curblockDamage - this.initialDamage;
float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(k + 1);
int l = (int)(f1 * 10.0F);
if (l != this.durabilityRemainingOnBlock)
{
this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180240_f, l);
this.durabilityRemainingOnBlock = l;
}
}
}
}
示例15: addRainParticles
import net.minecraft.block.material.Material; //導入方法依賴的package包/類
private void addRainParticles()
{
float f = this.mc.theWorld.getRainStrength(1.0F);
if (!Config.isRainFancy())
{
f /= 2.0F;
}
if (f != 0.0F && Config.isRainSplash())
{
this.random.setSeed((long)this.rendererUpdateCount * 312987231L);
Entity entity = this.mc.getRenderViewEntity();
WorldClient worldclient = this.mc.theWorld;
BlockPos blockpos = new BlockPos(entity);
byte b0 = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int i = 0;
int j = (int)(100.0F * f * f);
if (this.mc.gameSettings.particleSetting == 1)
{
j >>= 1;
}
else if (this.mc.gameSettings.particleSetting == 2)
{
j = 0;
}
for (int k = 0; k < j; ++k)
{
BlockPos blockpos1 = worldclient.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0, this.random.nextInt(b0) - this.random.nextInt(b0)));
BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = worldclient.getBlockState(blockpos2).getBlock();
if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(blockpos1) >= 0.15F)
{
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
if (block.getMaterial() == Material.lava)
{
this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
else if (block.getMaterial() != Material.air)
{
block.setBlockBoundsBasedOnState(worldclient, blockpos2);
++i;
if (this.random.nextInt(i) == 0)
{
d0 = (double)blockpos2.getX() + d3;
d1 = (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
d2 = (double)blockpos2.getZ() + d4;
}
this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
if (i > 0 && this.random.nextInt(3) < this.rainSoundCounter++)
{
this.rainSoundCounter = 0;
if (d1 > (double)(blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY()))
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
}
else
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
}
}
}
}