本文整理了Java中net.minecraft.world.World.canSeeSky()
方法的一些代码示例,展示了World.canSeeSky()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.canSeeSky()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:canSeeSky
暂无
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean canSeeSky(@Nonnull BlockPos pos) {
return wrapped.canSeeSky(pos);
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public boolean canSeeSky(BlockPos pos) {
return getActualWorld().canSeeSky(pos);
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean getCanSpawnHere() {
return super.getCanSpawnHere() && this.world.canSeeSky(new BlockPos(this));
}
代码示例来源:origin: Glitchfiend/ToughAsNails
private boolean canFill(BlockPos pos)
{
//Only spread within enclosed areas, significantly reduces the impact on performance and suits the purpose of coils
return !this.getWorld().isBlockFullCube(pos) && (!this.getWorld().canSeeSky(pos));
}
代码示例来源:origin: NanamiArihara/FoodCraft-Reloaded
@Override
public boolean matches(World world, BlockPos pos) {
return world.getLight(pos.up()) >= this.level || world.canSeeSky(pos.up());
}
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public boolean getCanSpawnHere() {
BlockPos pos = new BlockPos(this);
return this.getRNG().nextInt(IceAndFire.CONFIG.trollSpawnCheckChance + 1) == 0 && !this.world.canSeeSky(pos) && pos.getY() <= 50 && super.getCanSpawnHere();
}
代码示例来源: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())) {
world.setEntityState(this, (byte) 11);
attackEntityFrom(DamageSource.OUT_OF_WORLD, EntityAttributes.MAX_HEALTH_2 * 0.25F);
}
}
for (int var2 = 0; var2 < 2; ++var2) {
world.spawnParticle(EnumParticleTypes.PORTAL, posX + (rand.nextDouble() - 0.5D) * width, posY + rand.nextDouble() * height, posZ + (rand.nextDouble() - 0.5D) * width, 0.0D, 0.0D, 0.0D);
}
super.onLivingUpdate();
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@Nullable
private Vec3d findPossibleShelter() {
Random random = npc.getRNG();
BlockPos entityPos = new BlockPos(npc.posX, getMinY(), npc.posZ);
for (int i = 0; i < 10; ++i) {
BlockPos randomPos = entityPos.add(random.nextInt(20) - 10, random.nextInt(6) - 3, random.nextInt(20) - 10);
if (!world.canSeeSky(randomPos) && npc.getBlockPathWeight(randomPos) > 0.0F) {
return new Vec3d((double) randomPos.getX(), (double) randomPos.getY(), (double) randomPos.getZ());
}
}
return null;
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
@Nullable
private Vec3d findLocation(boolean outside) {
Random random = theCreature.getRNG();
BlockPos blockpos = new BlockPos(theCreature.posX, theCreature.getEntityBoundingBox().minY, theCreature.posZ);
for (int i = 0; i < 10; ++i) {
BlockPos blockpos1 = blockpos.add(random.nextInt(20) - 10, random.nextInt(6) - 3, random.nextInt(20) - 10);
if (world.canSeeSky(blockpos1) == outside && theCreature.getBlockPathWeight(blockpos1) < 0.0F) {
return new Vec3d((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ());
}
}
return null;
}
}
代码示例来源:origin: WayofTime/BloodMagic
@Override
public double getArmourProtection(EntityLivingBase wearer, DamageSource source) {
if (wearer.getEntityWorld().canSeeSky(wearer.getPosition()) || wearer.getEntityWorld().provider.isDaytime()) {
return protectionLevel[this.level];
}
return 0;
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@Nullable
private Vec3d findPossibleShelter() {
Random random = this.troll.getRNG();
BlockPos blockpos = new BlockPos(this.troll.posX, this.troll.getEntityBoundingBox().minY, this.troll.posZ);
for (int i = 0; i < 10; ++i) {
BlockPos blockpos1 = blockpos.add(random.nextInt(20) - 10, random.nextInt(6) - 3, random.nextInt(20) - 10);
if (!this.world.canSeeSky(blockpos1) && this.troll.getBlockPathWeight(blockpos1) < 0.0F) {
return new Vec3d((double) blockpos1.getX(), (double) blockpos1.getY(), (double) blockpos1.getZ());
}
}
return null;
}
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
@Override
public boolean getServerActive() {
if (world.provider.hasSkyLight()) {
boolean i1 = world.canSeeSky(getPos().up());
float time = getTime();
if (i1 && time > 0.5) {
return true;
}
}
return false;
}
代码示例来源: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: 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: 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: JurassiCraftTeam/JurassiCraft2
@Override
public boolean canBlockStay(World world, BlockPos pos, IBlockState state) {
return (world.getLight(pos) >= 8 || world.canSeeSky(pos)) && world.getBlockState(pos.down()).getBlock().canSustainPlant(state, world, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
代码示例来源: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: WayofTime/BloodMagic
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
counter++;
if (world.canSeeSky(player.getPosition()) || world.provider.isDaytime()) {
if (counter % regenCooldown[this.level] == 0 && player.getHealth() < player.getMaxHealth()) {
player.heal(1);
}
if (fireResistTime[this.level] != 0 && counter % fireResistCooldown[this.level] == 0) {
player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, fireResistTime[this.level], 0, false, false));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!