本文整理了Java中net.minecraft.world.World.isDaytime()
方法的一些代码示例,展示了World.isDaytime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.isDaytime()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:isDaytime
暂无
代码示例来源:origin: Vazkii/Botania
@Override
public void update() {
boolean state = world.getBlockState(getPos()).getValue(BotaniaStateProps.POWERED);
if(!world.isRemote) {
boolean newState = !world.isDaytime();
if(newState != state) {
world.setBlockState(getPos(), world.getBlockState(getPos()).withProperty(BotaniaStateProps.POWERED, newState), 1 | 2);
state = newState;
}
}
if(state) {
double radius = 512;
int iter = 2;
for(int i = 0; i < iter; i++) {
double x = pos.getX() + 0.5 + (Math.random() - 0.5) * radius;
double y = Math.min(256, pos.getY() + Botania.proxy.getClientRenderDistance() * 16);
double z = pos.getZ() + 0.5 + (Math.random() - 0.5) * radius;
float w = 0.6F;
float c = 1F - w;
float r = w + (float) Math.random() * c;
float g = w + (float) Math.random() * c;
float b = w + (float) Math.random() * c;
float s = 20F + (float) Math.random() * 20F;
int m = 50;
Botania.proxy.sparkleFX(x, y, z, r, g, b, s, m);
}
}
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
if (world.isDaytime() == daytime) {
return 1;
}
return 0;
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean isDaytime() {
return wrapped.isDaytime();
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public boolean isDaytime() {
return this.world.isDaytime();
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public int getBlockLightValue() {
return getWorld().isDaytime() ? 15 : 0; // hives may have the sky obstructed but should still be active
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public boolean isDaytime() {
return getActualWorld().isDaytime();
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@Override
public boolean shouldBeAtHome() {
return (world.provider.hasSkyLight() && !world.isDaytime()) || world.isRainingAt(getPosition());
}
代码示例来源:origin: ForestryMC/ForestryMC
private boolean canFly(World world) {
return (!world.isRaining() || getGenome().getTolerantFlyer()) &&
isActiveThisTime(world.isDaytime());
}
代码示例来源:origin: Silentine/GrimoireOfGaia
@Override
public void onLivingUpdate() {
if (world.isDaytime() && !world.isRemote) {
float f = getBrightness();
if (f > 0.5F && rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && world.canSeeSky(getPosition())) {
setFire(8);
attackEntityFrom(DamageSource.OUT_OF_WORLD, EntityAttributes.MAX_HEALTH_2 * 0.25F);
}
}
super.onLivingUpdate();
}
代码示例来源:origin: Silentine/GrimoireOfGaia
@Override
public void onLivingUpdate() {
if (world.isDaytime() && !world.isRemote) {
float f = getBrightness();
if (f > 0.5F && rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && world.canSeeSky(getPosition())) {
setFire(8);
attackEntityFrom(DamageSource.OUT_OF_WORLD, EntityAttributes.MAX_HEALTH_1 * 0.10F);
}
}
super.onLivingUpdate();
}
代码示例来源:origin: TeamLapen/Vampirism
@Override
public boolean getCanSpawnHere() {
if (isGettingSundamage(true) || (world.isDaytime() && rand.nextInt(5) != 0)) return false;
if (isGettingGarlicDamage(true) != EnumStrength.NONE) return false;
if (world.getVillageCollection().getNearestVillage(getPosition(), 1) != null) {
if (getRNG().nextInt(60) != 0) {
return false;
}
}
return super.getCanSpawnHere() && (!restrictedSpawn || getCanSpawnHereRestricted());
}
代码示例来源:origin: GregTechCE/GregTech
private boolean canSeeSunClearly(World world, BlockPos blockPos) {
if(!world.canSeeSky(blockPos)) {
return false;
}
if(world.isRaining()) {
Biome biome = world.getBiome(blockPos);
if(biome.canRain() || biome.getEnableSnow()) {
return false;
}
}
return world.isDaytime();
}
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
private void doSunBurn() {
if (burnsInSun() && world.isDaytime() && !world.isRemote) {
float brightness = getBrightness();
BlockPos blockpos = getRidingEntity() instanceof EntityBoat ? (new BlockPos(posX, (double) Math.round(posY), posZ)).up() : new BlockPos(posX, Math.round(posY), posZ);
if (brightness > 0.5F && rand.nextFloat() * 30.0F < (brightness - 0.4F) * 2.0F && world.canSeeSky(blockpos)) {
ItemStack helmet = getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (helmet.isEmpty()) {
setFire(8);
} else {
damageHelmet(helmet);
}
}
}
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public void playLivingSound() {
if (!world.isRemote || world.isDaytime() || getAttackTarget() != null) {
return;
}
playSound(getAmbientSound(), getSoundVolume() * ZooConfig.owlHootVolumeMultiplier.get(), 0.8f * getSoundPitch());
}
代码示例来源:origin: Silentine/GrimoireOfGaia
@Override
protected void updateAITasks() {
if (isWet()) {
attackEntityFrom(DamageSource.DROWN, 1.0F);
}
if (world.isDaytime() && ticksExisted >= targetChangeTime + 600) {
float f = getBrightness();
if (f > 0.5F && world.canSeeSky(new BlockPos(this)) && rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
setAttackTarget(null);
teleportRandomly();
}
}
super.updateAITasks();
}
代码示例来源:origin: Silentine/GrimoireOfGaia
@Override
protected void updateAITasks() {
if (isWet()) {
attackEntityFrom(DamageSource.DROWN, 1.0F);
}
if (world.isDaytime() && ticksExisted >= targetChangeTime + 600) {
float f = getBrightness();
if (f > 0.5F && world.canSeeSky(new BlockPos(this)) && rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
setAttackTarget(null);
teleportRandomly();
}
}
super.updateAITasks();
}
代码示例来源:origin: GregTechCE/GregTech
protected boolean checkCanSeeSun() {
BlockPos blockPos = getPos().up();
if(!getWorld().canBlockSeeSky(blockPos))
return false;
return !getWorld().isRaining() && getWorld().isDaytime();
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
@Override
public void onBihourlyTick() {
World world = animal.world;
boolean dayTime = world.isDaytime();
boolean isRaining = world.isRaining();
boolean isOutside = world.canBlockSeeSky(new BlockPos(animal));
boolean isOutsideInSun = !isRaining && isOutside && dayTime && HFApi.calendar.getDate(world).getSeason() != Season.WINTER;
if (isOutsideInSun && wasOutsideInSun) {
affectHappiness(type.getRelationshipBonus(AnimalAction.OUTSIDE));
}
//Mark the past value
wasOutsideInSun = isOutsideInSun;
}
代码示例来源:origin: OpenModularTurretsTeam/OpenModularTurrets
public static void updateSolarPanelAddon(TurretBase base) {
OMEnergyStorage storage = (OMEnergyStorage) base.getCapability(CapabilityEnergy.ENERGY, EnumFacing.DOWN);
if (!hasSolarPanelAddon(base) || storage == null) {
return;
}
if (base.getWorld().isDaytime() && !base.getWorld().isRaining() && base.getWorld().canBlockSeeSky(base.getPos().up(2))) {
storage.receiveEnergy(OMTConfig.MISCELLANEOUS.solarPanelAddonGen, false);
}
}
代码示例来源:origin: TeamLapen/Vampirism
@Override
public boolean shouldExecute() {
if (creature.ticksExisted % 10 == 3) {
Biome biome = creature.getEntityWorld().getBiome(creature.getPosition());
cache = VampirismAPI.sundamageRegistry().getSundamageInDim(creature.getEntityWorld().provider.getDimension()) && VampirismAPI.sundamageRegistry().getSundamageInBiome(biome);
}
return cache && creature.getEntityWorld().isDaytime() && !vampire.isIgnoringSundamage();
}
内容来源于网络,如有侵权,请联系作者删除!