Beispiel #1
0
 @Override
 public SpongeChunkProvider createChunkProvider(SpongeWorldGenerator newGenerator) {
   return new SpongeChunkProvider(
       (net.minecraft.world.World) (Object) this,
       newGenerator.getBaseGenerationPopulator(),
       newGenerator.getBiomeGenerator());
 }
Beispiel #2
0
  @Override
  public void updateWorldGenerator() {

    IMixinWorldType worldType = (IMixinWorldType) this.getProperties().getGeneratorType();
    // Get the default generator for the world type
    DataContainer generatorSettings = this.getProperties().getGeneratorSettings();

    SpongeWorldGenerator newGenerator = worldType.createGenerator(this, generatorSettings);
    // If the base generator is an IChunkProvider which implements
    // IPopulatorProvider we request that it add its populators not covered
    // by the base generation populator
    if (newGenerator.getBaseGenerationPopulator() instanceof IChunkProvider) {
      // We check here to ensure that the IPopulatorProvider is one of our mixed in ones and not
      // from a mod chunk provider extending a provider that we mixed into
      if (WorldGenConstants.isValid(
          (IChunkProvider) newGenerator.getBaseGenerationPopulator(), IPopulatorProvider.class)) {
        ((IPopulatorProvider) newGenerator.getBaseGenerationPopulator())
            .addPopulators(newGenerator);
      }
    } else if (newGenerator.getBaseGenerationPopulator() instanceof IPopulatorProvider) {
      // If its not a chunk provider but is a populator provider then we call it as well
      ((IPopulatorProvider) newGenerator.getBaseGenerationPopulator()).addPopulators(newGenerator);
    }

    // Re-apply all world generator modifiers
    WorldCreationSettings creationSettings = this.getCreationSettings();

    for (WorldGeneratorModifier modifier : this.getProperties().getGeneratorModifiers()) {
      modifier.modifyWorldGenerator(creationSettings, generatorSettings, newGenerator);
    }

    this.spongegen = createChunkProvider(newGenerator);
    this.spongegen.setGenerationPopulators(newGenerator.getGenerationPopulators());
    this.spongegen.setPopulators(newGenerator.getPopulators());
    this.spongegen.setBiomeOverrides(newGenerator.getBiomeSettings());

    ChunkProviderServer chunkProviderServer = (ChunkProviderServer) this.getChunkProvider();
    chunkProviderServer.serverChunkGenerator = this.spongegen;
  }