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


Java World.isDaytime方法代碼示例

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


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

示例1: updateTick

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random r) {
	if (!state.getValue(placed) && (world.isDaytime() || world.getMoonPhase() != 4)) {
		world.setBlockToAir(pos);
		for (int i = 0; i < 7; i++) {
			world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, pos.getX() + r.nextDouble(), pos.getY() + r.nextDouble(), pos.getZ() + r.nextDouble(), r.nextGaussian() * 0.01, r.nextDouble() * 0.01, r.nextGaussian() * 0.01);
		}
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:10,代碼來源:BlockMoonbell.java

示例2: spawnFlowers

import net.minecraft.world.World; //導入方法依賴的package包/類
@SubscribeEvent
public void spawnFlowers(PlayerTickEvent evt) {
	if (evt.side == Side.SERVER && evt.phase == Phase.START) {
		World w = evt.player.world;
		if (w.getTotalWorldTime() % 20 == 0 && validBiomesMoonBell.contains(w.getBiome(evt.player.getPosition()))) {
			Random r = evt.player.getRNG();
			if (w.provider.getDimension() == 0 && w.provider.getMoonPhase(w.getWorldTime()) == 4 && !w.isDaytime() && evt.player.getRNG().nextDouble() < 0.2) {
				int dx = (r.nextInt(7) - 3) * 10;
				int dz = (r.nextInt(7) - 3) * 10;
				MutableBlockPos pos = new MutableBlockPos(evt.player.getPosition().add(dx, 0, dz));
				tryAndSpawn(w, pos);
			}
		}
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:16,代碼來源:BlockMoonbell.java

示例3: get

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
@Callback
public Object[] get(Context context, Arguments args, World worldIn, TileEntitySensor teIn) {
	if (args.checkString(0).equalsIgnoreCase("biome")) {
		return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).biomeName };
	} else if (args.checkString(0).equalsIgnoreCase("lightlevel")) {
		return new Object[] { worldIn.getBlockLightValue((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.yCoord + rangeLimit(rangeLimit(args.optInteger(1, 0)))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))) };
	} else if (args.checkString(0).equalsIgnoreCase("raining")) {
		return new Object[] { worldIn.isRaining() };
	} else if (args.checkString(0).equalsIgnoreCase("thundering")) {
		return new Object[] { worldIn.isThundering() };
	} else if (args.checkString(0).equalsIgnoreCase("daytime")) {
		return new Object[] { worldIn.isDaytime() };
	} else if (args.checkString(0).equalsIgnoreCase("moonphase")) {
		return new Object[] { worldIn.getCurrentMoonPhaseFactor() };
	} else if (args.checkString(0).equalsIgnoreCase("celestialangle")) {
		return new Object[] { worldIn.getCelestialAngle(1.0F)};
	} else if (args.checkString(0).equalsIgnoreCase("dimension")) {
		return new Object[] { worldIn.getWorldInfo().getVanillaDimension()};
	} else if (args.checkString(0).equalsIgnoreCase("temperature") || args.checkString(0).equalsIgnoreCase("temp")) {
		return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).temperature};
	} else if (args.checkString(0).equalsIgnoreCase("highhumidity")) {
		return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).isHighHumidity()};
	} else if (args.checkString(0).equalsIgnoreCase("humidity")) {
		return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).rainfall};
	} else if (args.checkString(0).equalsIgnoreCase("worldseed")) {
		return new Object[] { worldIn.getSeed()};
	}
	return new Object[] { "No method passed, or not found" };
}
 
開發者ID:PC-Logix,項目名稱:OpenSensors,代碼行數:31,代碼來源:ItemWorldSensor.java

示例4: isValid

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public boolean isValid(EntityPlayer player, World world, BlockPos pos, List<ItemStack> recipe) {
	return world.isDaytime();
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:5,代碼來源:RitualHighMoon.java

示例5: isDayTime

import net.minecraft.world.World; //導入方法依賴的package包/類
public static boolean isDayTime(World world){
    return world.isDaytime();
}
 
開發者ID:canitzp,項目名稱:Metalworks,代碼行數:4,代碼來源:Util.java


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