public static boolean isWorldSkyblock(World world) { return world.getWorldInfo().getTerrainType() instanceof WorldTypeSkyblock; }
@Override public String getName() { return getWorld().getWorldInfo().getWorldName(); }
@Override public void setWeather(WeatherType weatherType, long duration) { WorldInfo info = getWorld().getWorldInfo(); if (WeatherTypes.THUNDER_STORM.equals(weatherType)) { info.setCleanWeatherTime(0); info.setThundering(true); info.setThunderTime((int) duration); } else if (WeatherTypes.RAIN.equals(weatherType)) { info.setCleanWeatherTime(0); info.setRaining(true); info.setRainTime((int) duration); } else if (WeatherTypes.CLEAR.equals(weatherType)) { info.setRaining(false); info.setThundering(false); info.setCleanWeatherTime((int) duration); } }
public static void resetRainTime(World w){ w.getWorldInfo().setRainTime(w.rand.nextInt(w.getWorldInfo().isRaining() ? 12000 : 168000) + 12000); } }
/** * Set the initial values of a new world to create, from the values from an existing world. * * Called after construction when a user selects the "Recreate" button. * * @param original the original */ public void recreateFromExistingWorld(WorldInfo original) { worldName = I18n.format("selectWorld.newWorld.copyOf", original.getWorldName()); worldSeed = original.getSeed() + ""; selectedIndex = original.getTerrainType().getId(); chunkProviderSettingsJson = original.getGeneratorOptions(); generateStructuresEnabled = original.isMapFeaturesEnabled(); allowCheats = original.areCommandsAllowed(); if (original.isHardcoreModeEnabled()) { gameMode = "hardcore"; } else if (original.getGameType().isSurvivalOrAdventure()) { gameMode = "survival"; } else if (original.getGameType().isCreative()) { gameMode = "creative"; } } }
private static void populateWorldProperties(Map<String,Object> properties, World world, WorldInfo worldInfo) properties.put("world", worldInfo == null ? "" : worldInfo.getWorldName()); properties.put("world.seed", worldInfo == null ? 0L : worldInfo.getSeed()); properties.put("world.version", worldInfo == null ? 0 : worldInfo.getSaveVersion()); properties.put("world.isHardcore", worldInfo == null ? false : worldInfo.isHardcoreModeEnabled()); properties.put("world.hasFeatures", worldInfo == null ? false : worldInfo.isMapFeaturesEnabled()); properties.put("world.hasCheats", worldInfo == null ? false : worldInfo.areCommandsAllowed()); properties.put("world.gameMode", worldInfo == null ? "" : worldInfo.getGameType().getName()); properties.put("world.gameMode.id", worldInfo == null ? 0 : worldInfo.getGameType().getID()); properties.put("world.type", worldInfo == null ? "" : worldInfo.getTerrainType().getName()); properties.put("world.type.version", worldInfo == null ? 0 : worldInfo.getTerrainType().getVersion()); String genName = "RandomLevelSource"; String genClass = "ChunkProviderOverworld";
if (event.world.getWorldInfo().isThundering()) event.world.getWorldInfo().setThundering(false);; if (!event.world.getWorldInfo().isRaining() && event.world.getWorldInfo().getRainTime() > 36000) event.world.getWorldInfo().setRainTime(event.world.rand.nextInt(24000) + 12000); if (!event.world.getWorldInfo().isRaining() && event.world.getWorldInfo().getRainTime() > 96000) event.world.getWorldInfo().setRainTime(event.world.rand.nextInt(84000) + 12000); if (!event.world.getWorldInfo().isThundering() && event.world.getWorldInfo().getThunderTime() > 36000) event.world.getWorldInfo().setThunderTime(event.world.rand.nextInt(24000) + 12000);
private boolean startRain(World world) { if(!world.isRaining()) { if(world.rand.nextInt(10) == 0) { world.getWorldInfo().setRaining(true); TileTeruTeruBozu.resetRainTime(world); } return true; } return false; }
private BiomeProvider getInternalBiomeProvider(World world) { if (biomeProvider == null) { for (WorldType type : WorldType.WORLD_TYPES) { if ("BIOMESOP".equals(type.getName())) { WorldType orig = world.getWorldInfo().getTerrainType(); world.getWorldInfo().setTerrainType(type); biomeProvider = type.getBiomeProvider(world); world.getWorldInfo().setTerrainType(orig); break; } } } return biomeProvider; }
public OceanicBiomeProvider(WorldInfo info) { super(info); GenLayer[] agenlayer = initializeAllBiomeGenerators(info.getSeed(), info.getTerrainType(), info.getGeneratorOptions()); agenlayer = getModdedBiomeGenerators(info.getTerrainType(), info.getSeed(), agenlayer); ReflectionHelper.setPrivateValue(BiomeProvider.class, this, agenlayer[0], "genBiomes", "field_76944_d"); ReflectionHelper.setPrivateValue(BiomeProvider.class, this, agenlayer[1], "biomeIndexLayer", "field_76945_e"); }
public ModdedDecorationComposer(World world) { this.worldSeed = world.getWorldInfo().getSeed(); this.random = new Random(this.worldSeed); }
@Override public void updateInPedestal(@Nonnull World world, @Nonnull BlockPos pos) { if (!world.isRemote && ProjectEConfig.pedestalCooldown.evertidePedCooldown != -1) { TileEntity te = world.getTileEntity(pos); if (!(te instanceof DMPedestalTile)) { return; } DMPedestalTile tile = ((DMPedestalTile) te); if (tile.getActivityCooldown() == 0) { int i = (300 + world.rand.nextInt(600)) * 20; world.getWorldInfo().setRainTime(i); world.getWorldInfo().setThunderTime(i); world.getWorldInfo().setRaining(true); tile.setActivityCooldown(ProjectEConfig.pedestalCooldown.evertidePedCooldown); } else { tile.decrementActivityCooldown(); } } }
/** * Instantiates a new chunk generator cloud. * * @param worldIn the world in */ public ChunkGeneratorCloud(World worldIn) { // DEBUG System.out.println("Constructing ChunkGeneratorCloud"); world = worldIn; rand = new Random(world.getSeed()); terrainType = world.getWorldInfo().getTerrainType(); mapFeaturesEnabled = world.getWorldInfo().isMapFeaturesEnabled(); world.setSeaLevel(63); MapGenVillage.VILLAGE_SPAWN_BIOMES.add(ModBiomes.cloud); initNoiseGenerators(); postTerrainGenEvents(); setBiomeWeights(); postNoiseEvent(); }
@Override public void activate() { if (world.isRemote) { world.playSound(null, getPos(), SoundEvents.ENTITY_LIGHTNING_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + world.rand.nextFloat() * 0.2F); float f = getPos().getX() + 0.5F; float f1 = getPos().getY() + 0.0F + world.rand.nextFloat() * 6F / 16F; float f2 = getPos().getZ() + 0.5F; float f3 = 0.52F; float f4 = world.rand.nextFloat() * 0.6F - 0.3F; ParticleRender.addEntityExplodeFX(world, f - f3, f1, f2 + f4); ParticleRender.addEntityExplodeFX(world, f + f3, f1, f2 + f4); ParticleRender.addEntityExplodeFX(world, f + f4, f1, f2 - f3); ParticleRender.addEntityExplodeFX(world, f + f4, f1, f2 + f3); } else { if (reverse) { world.getWorldInfo().setRaining(false); } else { world.getWorldInfo().setRaining(true); world.getWorldInfo().setRainTime(duration); } charge = 0; duration = 0; reverse = false; sendNetworkUpdate(); } }
this.world.getWorldInfo().setRaining(data != 0); this.world.getWorldInfo().setRaining(data != 0); this.world.getWorldInfo().setThundering(data != 0);
public static void disableVanillaHardcore(ICommandSender sender) { if (sender.getServer().getEntityWorld().getWorldInfo().isHardcoreModeEnabled()) { sender.sendMessage(new TextComponentTranslation("hqm.message.vanillaHardcore")); try { ReflectionHelper.setPrivateValue(WorldInfo.class, sender.getEntityWorld().getWorldInfo(), false, 20); } catch (Throwable ex) { ex.printStackTrace(); } if (!sender.getServer().getEntityWorld().getWorldInfo().isHardcoreModeEnabled()) { sender.sendMessage(new TextComponentTranslation("hqm.message.vanillaHardcoreOverride")); } } }
private WorldDummy() { super( new SaveHandlerMP(), new WorldInfo(new WorldSettings(0, GameType.SPECTATOR, false, false, WorldType.FLAT), "dummy"), new WorldProvider() { @Override public DimensionType getDimensionType() { return DimensionType.OVERWORLD; } }, new Profiler(), false ); provider.setWorld(this); chunkProvider = createChunkProvider(); }
protected void thunder(World world, boolean state) { world.getWorldInfo().setThundering(state); }
String generatorOptions = world.getWorldInfo().getGeneratorOptions(); LostCityProfile p; if (generatorOptions == null || generatorOptions.trim().isEmpty()) {
public void onBlockRemoval() { if (getWorld().getWorldInfo().getGameType() != GameType.CREATIVE) { computeItemDrop().forEach(this::dropItem); } }