本文整理匯總了Java中net.minecraft.init.Blocks.air方法的典型用法代碼示例。如果您正苦於以下問題:Java Blocks.air方法的具體用法?Java Blocks.air怎麽用?Java Blocks.air使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.init.Blocks
的用法示例。
在下文中一共展示了Blocks.air方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBlock0
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
/**
* Returns the block corresponding to the given coordinates inside a chunk.
*/
private Block getBlock0(int x, int y, int z)
{
Block block = Blocks.air;
if (y >= 0 && y >> 4 < this.storageArrays.length)
{
ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4];
if (extendedblockstorage != null)
{
try
{
block = extendedblockstorage.getBlockByExtId(x, y & 15, z);
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block");
throw new ReportedException(crashreport);
}
}
}
return block;
}
示例2: removeInvalidBlocks
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
public void removeInvalidBlocks()
{
this.blockRefCount = 0;
this.tickRefCount = 0;
for (int i = 0; i < 16; ++i)
{
for (int j = 0; j < 16; ++j)
{
for (int k = 0; k < 16; ++k)
{
Block block = this.getBlockByExtId(i, j, k);
if (block != Blocks.air)
{
++this.blockRefCount;
if (block.getTickRandomly())
{
++this.tickRefCount;
}
}
}
}
}
}
示例3: shouldMoveTo
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
/**
* Return true to set given position as destination
*/
protected boolean shouldMoveTo(World worldIn, BlockPos pos)
{
Block block = worldIn.getBlockState(pos).getBlock();
if (block == Blocks.farmland)
{
pos = pos.up();
IBlockState iblockstate = worldIn.getBlockState(pos);
block = iblockstate.getBlock();
if (block instanceof BlockCrops && ((Integer)iblockstate.getValue(BlockCrops.AGE)).intValue() == 7 && this.field_179503_e && (this.field_179501_f == 0 || this.field_179501_f < 0))
{
this.field_179501_f = 0;
return true;
}
if (block == Blocks.air && this.hasFarmItem && (this.field_179501_f == 1 || this.field_179501_f < 0))
{
this.field_179501_f = 1;
return true;
}
}
return false;
}
示例4: tryFlowInto
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
private void tryFlowInto(World worldIn, BlockPos pos, IBlockState state, int level)
{
if (this.canFlowInto(worldIn, pos, state))
{
if (state.getBlock() != Blocks.air)
{
if (this.blockMaterial == Material.lava)
{
this.triggerMixEffects(worldIn, pos);
}
else
{
state.getBlock().dropBlockAsItem(worldIn, pos, state, 0);
}
}
worldIn.setBlockState(pos, this.getDefaultState().withProperty(LEVEL, Integer.valueOf(level)), 3);
}
}
示例5: markDirty
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
/**
* For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it
* hasn't changed and skip it.
*/
public void markDirty()
{
if (this.worldObj != null)
{
IBlockState iblockstate = this.worldObj.getBlockState(this.pos);
this.blockMetadata = iblockstate.getBlock().getMetaFromState(iblockstate);
this.worldObj.markChunkDirty(this.pos, this);
if (this.getBlockType() != Blocks.air)
{
this.worldObj.updateComparatorOutputLevel(this.pos, this.getBlockType());
}
}
}
示例6: getDrops
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
public Collection<ItemStack> getDrops() {
List<ItemStack> drops = new ArrayList<ItemStack>();
net.minecraft.block.Block block = this.getNMSBlock();
if (block != Blocks.air) {
byte data = getData();
// based on nms.Block.dropNaturally
int count = block.quantityDroppedWithBonus(0, chunk.getHandle().worldObj.rand);
for (int i = 0; i < count; ++i) {
Item item = block.getItemDropped(data, chunk.getHandle().worldObj.rand, 0);
if (item != null) {
// Skulls are special, their data is based on the tile entity
if (Blocks.skull == block) {
net.minecraft.item.ItemStack nmsStack = new net.minecraft.item.ItemStack(item, 1, block.getDamageValue(chunk.getHandle().worldObj, x, y, z));
TileEntitySkull tileentityskull = (TileEntitySkull) chunk.getHandle().worldObj.getTileEntity(x, y, z);
if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null) {
nmsStack.setTagCompound(new NBTTagCompound());
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTUtil.func_152460_a(nbttagcompound, tileentityskull.func_152108_a());
nmsStack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
drops.add(CraftItemStack.asBukkitCopy(nmsStack));
// We don't want to drop cocoa blocks, we want to drop cocoa beans.
} else if (Blocks.cocoa == block) {
int dropAmount = (BlockCocoa.func_149987_c(data) >= 2 ? 3 : 1);
for (int j = 0; j < dropAmount; ++j) {
drops.add(new ItemStack(Material.INK_SACK, 1, (short) 3));
}
} else {
drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1, (short) block.damageDropped(data)));
}
}
}
}
return drops;
}
示例7: hasAir
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
public boolean hasAir()
{
if(this.worldObj.getBlockState(this.pos.add(1,0,0)).getBlock() == Blocks.air)
return true;
if(this.worldObj.getBlockState(this.pos.add(-1,0,0)).getBlock() == Blocks.air)
return true;
if(this.worldObj.getBlockState(this.pos.add(0,0,1)).getBlock() == Blocks.air)
return true;
if(this.worldObj.getBlockState(this.pos.add(0,0,-1)).getBlock() == Blocks.air)
return true;
return false;
}
示例8: getItemBurnTime
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
/**
* Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
* fuel
*/
public static int getItemBurnTime(ItemStack p_145952_0_)
{
if (p_145952_0_ == null)
{
return 0;
}
else
{
Item item = p_145952_0_.getItem();
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air)
{
Block block = Block.getBlockFromItem(item);
if (block == Blocks.wooden_slab)
{
return 150;
}
if (block.getMaterial() == Material.wood)
{
return 300;
}
if (block == Blocks.coal_block)
{
return 16000;
}
}
return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0)))))));
}
}
示例9: tryFlowInto
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
private void tryFlowInto(World worldIn, BlockPos pos, IBlockState state, int level) {
if (this.canFlowInto(worldIn, pos, state)) {
if (state.getBlock() != Blocks.air) {
if (this.blockMaterial == Material.lava) {
this.triggerMixEffects(worldIn, pos);
} else {
state.getBlock().dropBlockAsItem(worldIn, pos, state, 0);
}
}
worldIn.setBlockState(pos, this.getDefaultState().withProperty(LEVEL, Integer.valueOf(level)), 3);
}
}
示例10: set
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
public void set(int x, int y, int z, IBlockState state)
{
IBlockState iblockstate = this.get(x, y, z);
Block block = iblockstate.getBlock();
Block block1 = state.getBlock();
if (block != Blocks.air)
{
--this.blockRefCount;
if (block.getTickRandomly())
{
--this.tickRefCount;
}
}
if (block1 != Blocks.air)
{
++this.blockRefCount;
if (block1.getTickRandomly())
{
++this.tickRefCount;
}
}
this.data[y << 8 | z << 4 | x] = (char)Block.BLOCK_STATE_IDS.get(state);
}
示例11: getBlock
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
public Block getBlock(BlockPos pos)
{
return Blocks.air;
}
示例12: updateTask
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
/**
* Updates the task
*/
public void updateTask()
{
super.updateTask();
this.theVillager.getLookHelper().setLookPosition((double)this.destinationBlock.getX() + 0.5D, (double)(this.destinationBlock.getY() + 1), (double)this.destinationBlock.getZ() + 0.5D, 10.0F, (float)this.theVillager.getVerticalFaceSpeed());
if (this.getIsAboveDestination())
{
World world = this.theVillager.worldObj;
BlockPos blockpos = this.destinationBlock.up();
IBlockState iblockstate = world.getBlockState(blockpos);
Block block = iblockstate.getBlock();
if (this.field_179501_f == 0 && block instanceof BlockCrops && ((Integer)iblockstate.getValue(BlockCrops.AGE)).intValue() == 7)
{
world.destroyBlock(blockpos, true);
}
else if (this.field_179501_f == 1 && block == Blocks.air)
{
InventoryBasic inventorybasic = this.theVillager.getVillagerInventory();
for (int i = 0; i < inventorybasic.getSizeInventory(); ++i)
{
ItemStack itemstack = inventorybasic.getStackInSlot(i);
boolean flag = false;
if (itemstack != null)
{
if (itemstack.getItem() == Items.wheat_seeds)
{
world.setBlockState(blockpos, Blocks.wheat.getDefaultState(), 3);
flag = true;
}
else if (itemstack.getItem() == Items.potato)
{
world.setBlockState(blockpos, Blocks.potatoes.getDefaultState(), 3);
flag = true;
}
else if (itemstack.getItem() == Items.carrot)
{
world.setBlockState(blockpos, Blocks.carrots.getDefaultState(), 3);
flag = true;
}
}
if (flag)
{
--itemstack.stackSize;
if (itemstack.stackSize <= 0)
{
inventorybasic.setInventorySlotContents(i, (ItemStack)null);
}
break;
}
}
}
this.field_179501_f = -1;
this.runDelay = 10;
}
}
示例13: tryPlaceContainedLiquid
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
public boolean tryPlaceContainedLiquid(World worldIn, BlockPos pos)
{
if (this.isFull == Blocks.air)
{
return false;
}
else
{
Material material = worldIn.getBlockState(pos).getBlock().getMaterial();
boolean flag = !material.isSolid();
if (!worldIn.isAirBlock(pos) && !flag)
{
return false;
}
else
{
if (worldIn.provider.doesWaterVaporize() && this.isFull == Blocks.flowing_water)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
worldIn.playSoundEffect((double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l)
{
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)i + Math.random(), (double)j + Math.random(), (double)k + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
}
}
else
{
if (!worldIn.isRemote && flag && !material.isLiquid())
{
worldIn.destroyBlock(pos, true);
}
worldIn.setBlockState(pos, this.isFull.getDefaultState(), 3);
}
return true;
}
}
}
示例14: func_181065_a
import net.minecraft.init.Blocks; //導入方法依賴的package包/類
private boolean func_181065_a(BlockPos p_181065_1_)
{
IBlockState iblockstate = this.theWorld.getBlockState(p_181065_1_);
Block block = iblockstate.getBlock();
return block == Blocks.air ? true : !block.isFullCube();
}