Search in sources :

Example 1 with WorldInfo

use of net.minecraft.world.storage.WorldInfo in project malmo by Microsoft.

the class EnvironmentHelper method setMissionWeather.

public static void setMissionWeather(MissionInit minit) {
    ServerSection ss = minit.getMission().getServerSection();
    ServerInitialConditions sic = (ss != null) ? ss.getServerInitialConditions() : null;
    if (sic != null && sic.getWeather() != null && !sic.getWeather().equalsIgnoreCase("normal")) {
        // Max allowed by Minecraft's own Weather Command.
        int maxtime = 1000000 * 20;
        int cleartime = (sic.getWeather().equalsIgnoreCase("clear")) ? maxtime : 0;
        int raintime = (sic.getWeather().equalsIgnoreCase("rain")) ? maxtime : 0;
        int thundertime = (sic.getWeather().equalsIgnoreCase("thunder")) ? maxtime : 0;
        WorldServer worldserver = MinecraftServer.getServer().worldServers[0];
        WorldInfo worldinfo = worldserver.getWorldInfo();
        worldinfo.setCleanWeatherTime(cleartime);
        worldinfo.setRainTime(raintime);
        worldinfo.setThunderTime(thundertime);
        worldinfo.setRaining(raintime + thundertime > 0);
        worldinfo.setThundering(thundertime > 0);
    }
}
Also used : ServerSection(com.microsoft.Malmo.Schemas.ServerSection) WorldInfo(net.minecraft.world.storage.WorldInfo) WorldServer(net.minecraft.world.WorldServer) ServerInitialConditions(com.microsoft.Malmo.Schemas.ServerInitialConditions)

Example 2 with WorldInfo

use of net.minecraft.world.storage.WorldInfo in project Engine by VoltzEngine-Project.

the class CheckFakeWorld method newWorld.

public static CheckFakeWorld newWorld(String name) {
    WorldSettings settings = new WorldSettings(0, WorldSettings.GameType.SURVIVAL, false, false, WorldType.FLAT);
    WorldInfo worldInfo = new WorldInfo(settings, name);
    CheckWorldSaveHandler handler = new CheckWorldSaveHandler(worldInfo);
    return new CheckFakeWorld(handler, settings, new CheckWorldProvider());
}
Also used : WorldInfo(net.minecraft.world.storage.WorldInfo)

Example 3 with WorldInfo

use of net.minecraft.world.storage.WorldInfo in project MorePlanets by SteveKunG.

the class EntityVeinFloater method onUpdate.

@Override
public void onUpdate() {
    super.onUpdate();
    MorePlanetsCore.PROXY.addBoss(this);
    this.motionY *= 0.5D;
    if (this.getHealth() <= 0.0F) {
        int i = (300 + this.rand.nextInt(600)) * 20;
        WorldInfo worldinfo = this.world.getWorldInfo();
        worldinfo.setCleanWeatherTime(0);
        worldinfo.setRainTime(i);
        worldinfo.setThunderTime(i);
        worldinfo.setRaining(true);
        worldinfo.setThundering(false);
        this.dataManager.set(VINE_PULL, false);
        return;
    }
    int tick = this.ticksExisted;
    tick %= 600;
    if (this.getHealth() <= this.getMaxHealth() / 2) {
        if (!this.isDead) {
            if (tick > 300) {
                this.dataManager.set(VINE_PULL, true);
            } else {
                this.dataManager.set(VINE_PULL, false);
            }
        }
    } else {
        this.dataManager.set(VINE_PULL, false);
        if (!this.world.isRemote && this.ticksExisted % 200 == 0) {
            List<EntityVeinFloaterMinion> minionList = this.world.getEntitiesWithinAABB(EntityVeinFloaterMinion.class, new AxisAlignedBB(this.posX - 32, this.posY - 32, this.posZ - 32, this.posX + 32, this.posY + 32, this.posZ + 32));
            if (minionList.size() <= 32) {
                EntityVeinFloaterMinion tentacle1 = new EntityVeinFloaterMinion(this.world);
                tentacle1.setLocationAndAngles(this.posX + 2.0F, this.posY + 12.0F, this.posZ + 2.0F, 0.0F, 0.0F);
                tentacle1.setAbsorptionAmount(20.0F);
                this.world.spawnEntity(tentacle1);
                EntityVeinFloaterMinion tentacle2 = new EntityVeinFloaterMinion(this.world);
                tentacle2.setLocationAndAngles(this.posX - 2.0F, this.posY + 12.0F, this.posZ - 2.0F, 0.0F, 0.0F);
                tentacle2.setAbsorptionAmount(20.0F);
                this.world.spawnEntity(tentacle2);
                EntityVeinFloaterMinion tentacle3 = new EntityVeinFloaterMinion(this.world);
                tentacle3.setLocationAndAngles(this.posX + 2.0F, this.posY + 12.0F, this.posZ - 2.0F, 0.0F, 0.0F);
                tentacle3.setAbsorptionAmount(20.0F);
                this.world.spawnEntity(tentacle3);
                EntityVeinFloaterMinion tentacle4 = new EntityVeinFloaterMinion(this.world);
                tentacle4.setLocationAndAngles(this.posX - 2.0F, this.posY + 12.0F, this.posZ + 2.0F, 0.0F, 0.0F);
                tentacle4.setAbsorptionAmount(20.0F);
                this.world.spawnEntity(tentacle4);
            }
        }
    }
    if (this.getVinePull()) {
        int range = 16;
        List<EntityPlayer> entitiesAroundBH = this.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.posX - range, this.posY - range, this.posZ - range, this.posX + range, this.posY + range, this.posZ + range));
        for (EntityPlayer entity : entitiesAroundBH) {
            if (!entity.capabilities.isCreativeMode) {
                double motionX = this.posX - entity.posX;
                double motionY = this.posY - entity.posY + 12.0D;
                double motionZ = this.posZ - entity.posZ;
                entity.motionX = motionX * 0.025F;
                entity.motionY = motionY * 0.025F;
                entity.motionZ = motionZ * 0.025F;
                List<EntityPlayer> entityNearBH = this.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.posX - 1.0D, this.posY - 1.0D, this.posZ - 1.0D, this.posX + 5.0D, this.posY + 12.5D, this.posZ + 5.0D));
                for (EntityPlayer near : entityNearBH) {
                    near.attackEntityFrom(DamageSource.causeMobDamage(this), 8.0F);
                }
            }
        }
    }
    if (this.getHealth() <= this.getMaxHealth() / 3) {
        int i = (300 + this.rand.nextInt(600)) * 20;
        WorldInfo worldinfo = this.world.getWorldInfo();
        worldinfo.setCleanWeatherTime(0);
        worldinfo.setRainTime(i);
        worldinfo.setThunderTime(i);
        worldinfo.setRaining(true);
        worldinfo.setThundering(true);
        if (this.rand.nextFloat() > 0.975F && !this.isDead) {
            EntityPlayer player = this.world.getClosestPlayer(this.posX, this.posY, this.posZ, 32, false);
            if (player != null && !player.capabilities.isCreativeMode && !player.isDead) {
                EntityNibiruLightningBolt bolt = new EntityNibiruLightningBolt(this.world);
                bolt.setLocationAndAngles(player.posX, player.posY, player.posZ, 0.0F, 0.0F);
                this.world.spawnEntity(bolt);
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) WorldInfo(net.minecraft.world.storage.WorldInfo) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityNibiruLightningBolt(stevekung.mods.moreplanets.module.planets.nibiru.entity.weather.EntityNibiruLightningBolt) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)

Example 4 with WorldInfo

use of net.minecraft.world.storage.WorldInfo in project RFToolsDimensions by McJty.

the class GenericWorldProvider method createBiomeProviderInternal.

private void createBiomeProviderInternal() {
    getDimensionInformation();
    if (dimensionInformation != null) {
        ControllerType type = dimensionInformation.getControllerType();
        if (type == ControllerType.CONTROLLER_SINGLE) {
            this.biomeProvider = new BiomeProviderSingle(dimensionInformation.getBiomes().get(0));
        } else if (type == ControllerType.CONTROLLER_DEFAULT) {
            WorldInfo worldInfo = world.getWorldInfo();
            worldInfo = new WorldInfo(worldInfo) {

                @Override
                public long getSeed() {
                    return seed;
                }
            };
            this.biomeProvider = new BiomeProvider(worldInfo);
        } else {
            this.biomeProvider = new GenericBiomeProvider(world.getWorldInfo()) {

                @Override
                public DimensionInformation getDimensionInformation() {
                    // Hack to get the dimension information in the superclass.
                    return dimensionInformation;
                }
            };
        }
    } else {
        this.biomeProvider = new BiomeProvider(world.getWorldInfo());
    }
    if (dimensionInformation != null) {
        this.hasSkyLight = dimensionInformation.getTerrainType().hasSky();
        setupSkyRenderers();
    }
}
Also used : BiomeProvider(net.minecraft.world.biome.BiomeProvider) WorldInfo(net.minecraft.world.storage.WorldInfo) ControllerType(mcjty.rftoolsdim.dimensions.types.ControllerType) BiomeProviderSingle(net.minecraft.world.biome.BiomeProviderSingle)

Aggregations

WorldInfo (net.minecraft.world.storage.WorldInfo)4 ServerInitialConditions (com.microsoft.Malmo.Schemas.ServerInitialConditions)1 ServerSection (com.microsoft.Malmo.Schemas.ServerSection)1 ControllerType (mcjty.rftoolsdim.dimensions.types.ControllerType)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 WorldServer (net.minecraft.world.WorldServer)1 BiomeProvider (net.minecraft.world.biome.BiomeProvider)1 BiomeProviderSingle (net.minecraft.world.biome.BiomeProviderSingle)1 TargetPoint (net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)1 EntityNibiruLightningBolt (stevekung.mods.moreplanets.module.planets.nibiru.entity.weather.EntityNibiruLightningBolt)1