本文整理了Java中net.minecraft.world.World.isThundering()
方法的一些代码示例,展示了World.isThundering()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.isThundering()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:isThundering
暂无
代码示例来源:origin: Vazkii/Botania
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase entity, @Nonnull EntityLivingBase attacker) {
if(!(entity instanceof EntityPlayer) && entity != null) {
double range = 8;
List<EntityLivingBase> alreadyTargetedEntities = new ArrayList<>();
int dmg = 5;
long lightningSeed = ItemNBTHelper.getLong(stack, TAG_LIGHTNING_SEED, 0);
Predicate<Entity> selector = e -> e instanceof EntityLivingBase && e instanceof IMob && !(e instanceof EntityPlayer) && !alreadyTargetedEntities.contains(e);
Random rand = new Random(lightningSeed);
EntityLivingBase lightningSource = entity;
int hops = entity.world.isThundering() ? 10 : 4;
for(int i = 0; i < hops; i++) {
List<Entity> entities = entity.world.getEntitiesInAABBexcluding(lightningSource, new AxisAlignedBB(lightningSource.posX - range, lightningSource.posY - range, lightningSource.posZ - range, lightningSource.posX + range, lightningSource.posY + range, lightningSource.posZ + range), selector::test);
if(entities.isEmpty())
break;
EntityLivingBase target = (EntityLivingBase) entities.get(rand.nextInt(entities.size()));
if(attacker instanceof EntityPlayer)
target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), dmg);
else target.attackEntityFrom(DamageSource.causeMobDamage(attacker), dmg);
Botania.proxy.lightningFX(Vector3.fromEntityCenter(lightningSource), Vector3.fromEntityCenter(target), 1, 0x0179C4, 0xAADFFF);
alreadyTargetedEntities.add(target);
lightningSource = target;
dmg--;
}
if(!entity.world.isRemote)
ItemNBTHelper.setLong(stack, TAG_LIGHTNING_SEED, entity.world.rand.nextLong());
}
return super.hitEntity(stack, entity, attacker);
}
代码示例来源:origin: Vazkii/Botania
@Override
public int getDelayBetweenPassiveGeneration() {
boolean rain = supertile.getWorld().getBiome(supertile.getPos()).getRainfall() > 0 && (supertile.getWorld().isRaining() || supertile.getWorld().isThundering());
return rain ? 2 : 3;
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean isThundering() {
return wrapped.isThundering();
}
代码示例来源:origin: CyclopsMC/EvilCraft
@Override
public boolean isActive(World world) {
return world.isThundering();
}
代码示例来源:origin: SleepyTrousers/EnderIO
public static boolean worldIsState(WeatherTask task, World world) {
if (world.isRaining()) {
return world.isThundering() ? task == STORM : task == RAIN;
}
return task == CLEAR;
}
代码示例来源:origin: Electrical-Age/ElectricalAge
public static double getWeather(World world) {
if (world.isThundering())
return 1.0;
if (world.isRaining())
return 0.5;
return 0.0;
}
}
代码示例来源:origin: CyclopsMC/EvilCraft
@Override
public boolean isActive(World world) {
return world.isRaining() && !world.isThundering();
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public boolean isThundering() {
return getActualWorld().isThundering();
}
代码示例来源:origin: Electrical-Age/ElectricalAge
public static double getWeatherNoLoad(int dim) {
if (!getWorldExist(dim)) return 0.0;
World world = getWorld(dim);
if (world.isThundering())
return 1.0;
if (world.isRaining())
return 0.5;
return 0.0;
}
代码示例来源:origin: SquidDev-CC/plethora
@SubtargetedModuleObjectMethod.Inject(
module = IntegrationVanilla.daylightSensor, target = IWorldLocation.class, worldThread = false,
doc = "function():string -- The weather in the current world"
)
public static Object[] getWeather(IWorldLocation location, IContext<IModuleContainer> context, Object[] args) {
World world = location.getWorld();
if (world.isRaining()) {
if (world.isThundering()) {
return new Object[]{"thunder"};
} else {
return new Object[]{"rain"};
}
} else {
return new Object[]{"clear"};
}
}
}
代码示例来源:origin: TeamLapen/Vampirism
protected boolean isLowLightLevel() {
BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32)) {
return false;
} else {
int i = this.world.getLightFromNeighbors(blockpos);
if (this.world.isThundering()) {
int j = this.world.getSkylightSubtracted();
this.world.setSkylightSubtracted(10);
i = this.world.getLightFromNeighbors(blockpos);
this.world.setSkylightSubtracted(j);
}
return i <= this.rand.nextInt(8);
}
}
代码示例来源:origin: Silentine/GrimoireOfGaia
/**
* @see EntityMob
*/
private boolean isValidLightLevel() {
BlockPos blockpos = new BlockPos(posX, getEntityBoundingBox().minY, posZ);
if (world.getLightFor(EnumSkyBlock.SKY, blockpos) > rand.nextInt(32)) {
return false;
} else {
int i = world.getLightFromNeighbors(blockpos);
if (world.isThundering()) {
int j = world.getSkylightSubtracted();
world.setSkylightSubtracted(10);
i = world.getLightFromNeighbors(blockpos);
world.setSkylightSubtracted(j);
}
return i <= rand.nextInt(8);
}
}
代码示例来源:origin: Silentine/GrimoireOfGaia
/**
* Checks to make sure the light is not too bright where the mob is spawning
*/
private boolean isValidLightLevel() {
BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32)) {
return false;
} else {
int i = this.world.getLightFromNeighbors(blockpos);
if (this.world.isThundering()) {
int j = this.world.getSkylightSubtracted();
this.world.setSkylightSubtracted(10);
i = this.world.getLightFromNeighbors(blockpos);
this.world.setSkylightSubtracted(j);
}
return i <= this.rand.nextInt(8);
}
}
代码示例来源:origin: CyclopsMC/EvilCraft
protected boolean isValidLightLevel()
{
BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
{
return false;
}
else
{
int i = this.world.getLightFromNeighbors(blockpos);
if (this.world.isThundering())
{
int j = this.world.getSkylightSubtracted();
this.world.setSkylightSubtracted(10);
i = this.world.getLightFromNeighbors(blockpos);
this.world.setSkylightSubtracted(j);
}
return i <= this.rand.nextInt(8);
}
}
代码示例来源:origin: CoFH/ThermalFoundation
@Override
protected boolean isValidLightLevel() {
if (!restrictLightLevel()) {
return true;
}
BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32)) {
return false;
} else {
int i = this.world.getLightFromNeighbors(blockpos);
if (this.world.isThundering()) {
int j = this.world.getSkylightSubtracted();
this.world.setSkylightSubtracted(10);
i = this.world.getLightFromNeighbors(blockpos);
this.world.setSkylightSubtracted(j);
}
return i <= this.rand.nextInt(getSpawnLightLevel());
}
}
代码示例来源:origin: Electrical-Age/ElectricalAge
if (world.isThundering()) {
target = 1.0f;
代码示例来源:origin: SonarSonic/Calculator
if (data == 0 && !this.world.isThundering()) {
return false;
} else if (data > 0 && this.world.isThundering()) {
return false;
代码示例来源:origin: sinkillerj/ProjectE
world.addWeatherEffect(lightning);
if (world.isThundering())
内容来源于网络,如有侵权,请联系作者删除!