當前位置: 首頁>>代碼示例>>Java>>正文


Java Block.isFireSource方法代碼示例

本文整理匯總了Java中net.minecraft.block.Block.isFireSource方法的典型用法代碼示例。如果您正苦於以下問題:Java Block.isFireSource方法的具體用法?Java Block.isFireSource怎麽用?Java Block.isFireSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.block.Block的用法示例。


在下文中一共展示了Block.isFireSource方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateTick

import net.minecraft.block.Block; //導入方法依賴的package包/類
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	if (worldIn.getGameRules().getBoolean("doFireTick")) {
		if (!this.canPlaceBlockAt(worldIn, pos)) {
			worldIn.setBlockToAir(pos);
		}
		Block block = worldIn.getBlockState(pos.down()).getBlock();
		boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP);
		int i = state.getValue(AGE);
		if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos) && rand.nextFloat() < 0.2F + (float) i * 0.03F) {
			worldIn.setBlockToAir(pos);
		} else {
			if (i < 15) {
				state = state.withProperty(AGE, i + rand.nextInt(3) / 2);
				worldIn.setBlockState(pos, state, 4);
			}
			worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn) + rand.nextInt(10));
			if (!flag) {
				if (!this.canNeighborCatchFire(worldIn, pos)) {
					if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) || i > 3) {
						worldIn.setBlockToAir(pos);
					}
					return;
				}
				if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) {
					worldIn.setBlockToAir(pos);
					return;
				}
			}
			boolean flag1 = worldIn.isBlockinHighHumidity(pos);
			int j = 0;
			if (flag1) {
				j = -50;
			}
			this.tryCatchFire(worldIn, pos.east(), 300 + j, rand, i, EnumFacing.WEST);
			this.tryCatchFire(worldIn, pos.west(), 300 + j, rand, i, EnumFacing.EAST);
			this.tryCatchFire(worldIn, pos.down(), 250 + j, rand, i, EnumFacing.UP);
			this.tryCatchFire(worldIn, pos.up(), 250 + j, rand, i, EnumFacing.DOWN);
			this.tryCatchFire(worldIn, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH);
			this.tryCatchFire(worldIn, pos.south(), 300 + j, rand, i, EnumFacing.NORTH);
			for (int k = -1; k <= 1; ++k) {
				for (int l = -1; l <= 1; ++l) {
					for (int i1 = -1; i1 <= 4; ++i1) {
						if (k != 0 || i1 != 0 || l != 0) {
							int j1 = 100;
							if (i1 > 1) {
								j1 += (i1 - 1) * 100;
							}
							BlockPos blockpos = pos.add(k, i1, l);
							int k1 = this.getNeighborEncouragement(worldIn, blockpos);
							if (k1 > 0) {
								int l1 = (k1 + 40 + worldIn.getDifficulty().getDifficultyId() * 7) / (i + 30);
								if (flag1) {
									l1 /= 2;
								}
								if (l1 > 0 && rand.nextInt(j1) <= l1 && (!worldIn.isRaining() || !this.canDie(worldIn, blockpos))) {
									int i2 = i + rand.nextInt(5) / 4;
									if (i2 > 15) {
										i2 = 15;
									}
									worldIn.setBlockState(blockpos, state.withProperty(AGE, i2), 3);
								}
							}
						}
					}
				}
			}
		}
	}
}
 
開發者ID:MinecraftModDevelopmentMods,項目名稱:Got-Wood,代碼行數:70,代碼來源:BlockSpecialFire.java


注:本文中的net.minecraft.block.Block.isFireSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。