Jump to content

Recommended Posts

Posted

I have a WorldType and ChunkGenerator to generate a new world type

the problem is I cant find a way to set the spawn location to where it needs to be

 

this is what i have found  WorldInfo.setSpawnPosition() is call by WorldServer.createSpawnPosition() during initialization

I havn't been able to find anywhere in code I can set it myself after this point and before the player is spawned in single player mode

I tried teleporting the player when first logging in but this sometimes causes fetal errors

 

this is the trace from where i trapped during WorldServer.createSpawnPosition()

at me.el.LoonTerra.BaseChunkProvider.provideChunk(BaseChunkProvider.java:56)
at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:192)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121)
at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:223)
at net.minecraft.world.World.getChunkFromChunkCoords(World.java:485)
at net.minecraft.world.World.getBlock(World.java:390)
at net.minecraft.world.World.isAirBlock(World.java:413)
at net.minecraft.world.World.getTopBlock(World.java:374)
at net.minecraft.world.WorldProvider.canCoordinateBeSpawn(WorldProvider.java:97)
at net.minecraft.world.WorldServer.createSpawnPosition(WorldServer.java:807)
at net.minecraft.world.WorldServer.initialize(WorldServer.java:771)
at net.minecraft.world.World.<init>(World.java:299)
at net.minecraft.world.WorldServer.<init>(WorldServer.java:104)
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:63)
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)

any ideas would be appreciated

 

 

Posted

the only classes i'm overiding are WorldType and IChunkProvider

 

WorldType is use by the internal world generator to generate DEFAULT ,FLAT ,AMPLIFIED  ,LARGE_BIOMES and DEFAULT_1_1 Types

 

by overriding this I can set the main world type to My own generated world

Currently i have 2  Islands and SkyBlock, selectable at world creation time in single player

Note. these are Dimension 0, not additional Dimentions

Posted

One world can have one WorldProvider.

 

You need to extend it (abstract as diesieben said) and replace normal one ("surface") with yours.

To do replacement you use DimensionManager, code needs to be ran in init or post.

DimensionManager.unregisterDimension(0);
DimensionManager.unregisterProviderType(0);
DimensionManager.registerProviderType(0, MyWorldProvider.class, true);
DimensionManager.registerDimension(0, 0);

 

Note that this will break compatybility with any world that uses provider overrides.

1.7.10 is no longer supported by forge, you are on your own.

Posted

        if (!hasNoSky && !isAdventure && net.minecraftforge.common.ForgeModContainer.defaultHasSpawnFuzz)

        {

            chunkcoordinates.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;

            chunkcoordinates.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;

            chunkcoordinates.posY = this.worldObj.getTopSolidOrLiquidBlock(chunkcoordinates.posX, chunkcoordinates.posZ);

        }

 

Set ForgeModContainer.defaultHasSpawnFuzz to false

 

Edit: Also then set the world spawn with worldInstance.setSpawnLocation(x, y, z)

Posted

Overriden WorldProvider (thanks Ernio)

 

however i got an error when the trying to get the biomes to generate (this only happens when the player spawn where chunks have not been generated and only sometimes)

 

here is the stacktrace

 

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:201) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151) ~[ChunkProviderServer.class:?]
at net.minecraft.server.management.PlayerManager$PlayerInstance.<init>(PlayerManager.java:411) ~[PlayerManager$PlayerInstance.class:?]
at net.minecraft.server.management.PlayerManager.getOrCreateChunkWatcher(PlayerManager.java:114) ~[PlayerManager.class:?]
at net.minecraft.server.management.PlayerManager.addPlayer(PlayerManager.java:158) ~[PlayerManager.class:?]
at net.minecraft.server.management.ServerConfigurationManager.func_72375_a(ServerConfigurationManager.java:256) ~[serverConfigurationManager.class:?]
at net.minecraft.server.management.ServerConfigurationManager.playerLoggedIn(ServerConfigurationManager.java:314) ~[serverConfigurationManager.class:?]
at net.minecraft.server.management.ServerConfigurationManager.initializeConnectionToPlayer(ServerConfigurationManager.java:174) ~[serverConfigurationManager.class:?]
at cpw.mods.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:173) ~[NetworkDispatcher.class:?]
at cpw.mods.fml.common.network.handshake.NetworkDispatcher.completeHandshake(NetworkDispatcher.java:446) ~[NetworkDispatcher.class:?]
at cpw.mods.fml.common.network.internal.HandshakeCompletionHandler.channelRead0(HandshakeCompletionHandler.java:17) ~[HandshakeCompletionHandler.class:?]
at cpw.mods.fml.common.network.internal.HandshakeCompletionHandler.channelRead0(HandshakeCompletionHandler.java:11) ~[HandshakeCompletionHandler.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[simpleChannelInboundHandler.class:?]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) [NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) [MinecraftServer$2.class:?]
Caused by: java.lang.NullPointerException
at net.minecraft.world.biome.WorldChunkManager.getRainfall(WorldChunkManager.java:88) ~[WorldChunkManager.class:?]
at net.minecraft.world.biome.BiomeCache$Block.<init>(BiomeCache.java:109) ~[biomeCache$Block.class:?]
at net.minecraft.world.biome.BiomeCache.getBiomeCacheBlock(BiomeCache.java:39) ~[biomeCache.class:?]
at net.minecraft.world.biome.BiomeCache.getCachedBiomes(BiomeCache.java:88) ~[biomeCache.class:?]
at net.minecraft.world.biome.WorldChunkManager.getBiomeGenAt(WorldChunkManager.java:183) ~[WorldChunkManager.class:?]
at net.minecraft.world.biome.WorldChunkManager.loadBlockGeneratorData(WorldChunkManager.java:165) ~[WorldChunkManager.class:?]
at me.el.LoonTerra.BaseChunkProvider.provideChunk(BaseChunkProvider.java:54) ~[baseChunkProvider.class:?]
at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:192) ~[ChunkProviderServer.class:?]

 

It appears that it is failing while trying to get rainfall levels

 

This is how im reading the biome data

protected BiomeGenBase[] getBiomeData(int cx, int cz) {
    return this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, cx * 16, cz * 16, 16, 16);
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.