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


Java World.getActualHeight方法代碼示例

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


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

示例1: onUpdate

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void onUpdate(EntityPlayer player, IRitualHandler tile, World world, BlockPos pos, NBTTagCompound data, int ticks) {
	if (ticks % 40 == 0) {
		List<EntityItem> smeltables = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos).grow(3), ie -> !FurnaceRecipes.instance().getSmeltingResult(ie.getItem()).isEmpty());
		smeltables.parallelStream().filter(ei -> !ei.getItem().getItem().hasContainerItem(ei.getItem())).findAny().ifPresent(e -> smeltAndSpawn(e));
		if (rng.nextDouble() < 0.1) {
			if (world.getGameRules().getBoolean("doFireTick")) {
				int x = Math.round(pos.getX()) - 5 + rng.nextInt(12);
				int y = Math.round(pos.getY()) - 5 + rng.nextInt(12);
				int z = Math.round(pos.getZ()) - 5 + rng.nextInt(12);
				if (y < 1)
					y = 1;
				if (y > world.getActualHeight())
					y = world.getActualHeight() - 2;
				BlockPos posn = new BlockPos(x, y, z);
				if (canBurn(world, posn))
					world.setBlockState(posn, Blocks.FIRE.getDefaultState());
			}
		}
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:22,代碼來源:RitualFlames.java

示例2: getBottomBlockAir

import net.minecraft.world.World; //導入方法依賴的package包/類
public static BlockPos getBottomBlockAir(World world, BlockPos pos)
{
	Chunk chunk = world.getChunkFromBlockCoords(pos);
       BlockPos blockpos;
       BlockPos blockpos1;

       for (blockpos = new BlockPos(pos.getX(), 0, pos.getZ()); blockpos.getY() < world.getActualHeight()- 1; blockpos = blockpos1)
       {
           blockpos1 = blockpos.up();
           IBlockState state = chunk.getBlockState(blockpos1);
           if ((state.getBlock() instanceof BlockLiquid || world.isAirBlock(blockpos1)) &&
           		chunk.getBlockState(blockpos1.up()) instanceof BlockLiquid || world.isAirBlock(blockpos1.up()))
           {
               break;
           }
       }
       return blockpos.up(2);		
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:19,代碼來源:HarshenUtils.java

示例3: removeStone

import net.minecraft.world.World; //導入方法依賴的package包/類
private void removeStone(World world, Random random, int x, int z) {
	int id = world.getBiomeGenForCoords(x, z).biomeID;
	Block block = Blocks.stone;

	if(id == 35 || id == 163 || id == 29 || id == 157 || id == 6 || id == 134 || id == 160 || id == 161 || id == 32 || id == 33) {
		block = Granite;
	} else if(id == 36 || id == 164 || id == 16 || id == 14 || id == 15 || id == 0 || id == 24 || id == 26) {
		block = Basalt;
	} else if(id == 2 || id == 1 || id == 7 || id == 129 || id == 5 || id == 30 || id == 11) {
		block = Limestone;
	} else if(id == 130 || id == 17 || id == 21 || id == 149 || id == 23 || id == 151 || id == 22 || id == 133 || id == 155 || id == 19 || id == 31 || id == 158 || id == 27) {
		block = Shale;
	} else if(id == 37 || id == 165 || id == 132 || id == 4 || id == 3 || id == 131 || id == 34 || id == 162 || id == 28 || id == 156 || id == 25) {
		block = Slate;
	} else if(id == 39 || id == 167 || id == 38 || id == 166 || id == 18 || id == 13 || id == 12 || id == 140) {
		block = Gneiss;
	} else {
		FMLLog.log(Level.ERROR, Technical.modName + ": TechnicalWorldGenerator could not find stone type for " + world.getBiomeGenForCoords(x, z).biomeName + " (id " + id + "). Please report this to the mod author(s)");
	}

	for(int y = 0; y < world.getActualHeight(); y++) {
		if(world.getBlock(x, y, z) == Blocks.stone)
			world.setBlock(x, y, z, block, 0, 0);
	}
}
 
開發者ID:viddeno,項目名稱:Technical,代碼行數:26,代碼來源:TechnicalWorldGenerator.java

示例4: isValidNemesisLocation

import net.minecraft.world.World; //導入方法依賴的package包/類
private static boolean isValidNemesisLocation(World world, BlockPos pos) {
	BlockPos scan = new BlockPos(pos.getX(), world.getActualHeight(), pos.getZ());
	while(scan.getY() > 0){
		if (!world.isAirBlock(scan)) {
			return world.getBlockState(scan).isOpaqueCube();
		}
		scan = scan.down();
	}
	return false;
}
 
開發者ID:ToroCraft,項目名稱:NemesisSystem,代碼行數:11,代碼來源:NemesisUtil.java


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