Jump to content

[forge-1.8-11.14.1.1334] CleanRoom Generator


longlostbro

Recommended Posts

I am attempting to create a mod similar to the SkyBlocks bukkit plugin. My first step is to make a CleanRoom Generator (create a world with no block generation).

 

Which is the best method of creating a world with no blocks in it? (so I can have islands in the sky with no ground below)

  • Implement IWorldGenerator?
  • Extend world provider?
  • Implement IChunkProvider?
  • Extend BiomeGenBase?
  • Some better method?

Link to comment
Share on other sites

The best method would be your own 'clean room' WorldType, which provides the IChunkProvider.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

I am getting a NullPointerException for some reason and I can't pinpoint where or why. Can someone give me a hand?

ERROR

---- Minecraft Crash Report ----
// Ouch. That hurt 

Time: 5/24/15 6:51 PM
Description: Exception ticking world

java.lang.NullPointerException: Exception ticking world
at net.minecraft.world.biome.WorldChunkManager.getRainfall(WorldChunkManager.java:90)
at net.minecraft.world.biome.BiomeCache$Block.<init>(BiomeCache.java:105)
at net.minecraft.world.biome.BiomeCache.getBiomeCacheBlock(BiomeCache.java:37)
at net.minecraft.world.biome.BiomeCache.func_180284_a(BiomeCache.java:48)
at net.minecraft.world.biome.WorldChunkManager.func_180300_a(WorldChunkManager.java:75)
at net.minecraft.world.World.getBiomeGenForCoordsBody(World.java:215)
at net.minecraft.world.WorldProvider.getBiomeGenForCoords(WorldProvider.java:429)
at net.minecraft.world.World.getBiomeGenForCoords(World.java:185)
at net.minecraft.world.World.canBlockFreezeBody(World.java:2880)
at net.minecraft.world.WorldProvider.canBlockFreeze(WorldProvider.java:508)
at net.minecraft.world.World.canBlockFreeze(World.java:2875)
at net.minecraft.world.World.func_175662_w(World.java:2863)
at net.minecraft.world.WorldServer.updateBlocks(WorldServer.java:422)
at net.minecraft.world.WorldServer.tick(WorldServer.java:228)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:763)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)
at java.lang.Thread.run(Thread.java:745)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at net.minecraft.world.biome.WorldChunkManager.getRainfall(WorldChunkManager.java:90)
at net.minecraft.world.biome.BiomeCache$Block.<init>(BiomeCache.java:105)
at net.minecraft.world.biome.BiomeCache.getBiomeCacheBlock(BiomeCache.java:37)
at net.minecraft.world.biome.BiomeCache.func_180284_a(BiomeCache.java:48)
at net.minecraft.world.biome.WorldChunkManager.func_180300_a(WorldChunkManager.java:75)
at net.minecraft.world.World.getBiomeGenForCoordsBody(World.java:215)
at net.minecraft.world.WorldProvider.getBiomeGenForCoords(WorldProvider.java:429)
at net.minecraft.world.World.getBiomeGenForCoords(World.java:185)
at net.minecraft.world.World.canBlockFreezeBody(World.java:2880)
at net.minecraft.world.WorldProvider.canBlockFreeze(WorldProvider.java:508)
at net.minecraft.world.World.canBlockFreeze(World.java:2875)
at net.minecraft.world.World.func_175662_w(World.java:2863)
at net.minecraft.world.WorldServer.updateBlocks(WorldServer.java:422)
at net.minecraft.world.WorldServer.tick(WorldServer.java:228)

-- Affected level --
Details:
Level name: New World
All players: 1 total; [EntityPlayerMP['Player357'/0, l='New World', x=1.50, y=64.00, z=0.50]]
Chunk stats: ServerChunkCache: 625 Drop: 0
Level seed: -4952892408551608451
Level generator: ID 06 - CleanRoom, ver 0. Features enabled: true
Level generator options: 
Level spawn location: 7.00,64.00,7.00 - World: (7,64,7), Chunk: (at 7,4,7 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 10 game time, 10 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 81862 (now: false), thunder time: 127519 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:763)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)
at java.lang.Thread.run(Thread.java:745)

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.8.0_45, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 433081584 bytes (413 MB) / 780664832 bytes (744 MB) up to 3791650816 bytes (3616 MB)
JVM Flags: 0 total; 
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.10 FML v8.0.37.1334 Minecraft Forge 11.14.1.1334 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{8.0.37.1334} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1334.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{11.14.1.1334} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1334.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
SkyBlocks{1.0} [skyBlocks] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Loaded coremods (and transformers): 
Profiler Position: N/A (disabled)
Player Count: 1 / 8; [EntityPlayerMP['Player357'/0, l='New World', x=1.50, y=64.00, z=0.50]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'

SOURCE

 

@Mod(modid = SkyBlocks.MODID, version = SkyBlocks.VERSION)
public class SkyBlocks
{
    public static final String MODID = "SkyBlocks";
    public static final String VERSION = "1.0";
    public static WorldType cleanRoom = new CleanRoomWorldType("CleanRoom");

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
    	
    }
    
    @EventHandler
    public void Load(FMLInitializationEvent event){
    	LanguageRegistry.instance().addStringLocalization("generator.CleanRoom", "CleanRoom");
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
            
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
        
    }
    
}

 

public class CleanRoomWorldType extends WorldType {
    public CleanRoomWorldType(String name) {
    	super(name);      
    }

    @Override
    public WorldChunkManager getChunkManager(World world) {
        // This is our ChunkManager class, it controls rain, temp, biomes, and spawn location
        return new CleanRoomChunkManager(world);
    }

    @Override
    public IChunkProvider getChunkGenerator(World world, String generatorOptions) {
        // This is our ChunkProvider, this generates the world terrain.
        return new CleanRoomChunkProvider(world);
    }

    public boolean hasVoidParticles(boolean flag) {
        return flag; // Are their void particles?
    }

    public int getSeaLevel(World world) {
        // Sets the Average Ground Level, be careful with this one, it controls the Y value of your spawn point.
        return 64;
    }

    public double voidFadeMagnitude() {
        return 0.0D; // Sets the void fade, play with it to see which values work for you.
    }
}

 

public class CleanRoomChunkProvider implements IChunkProvider {
    private World world;
    private Random random;
    
    public CleanRoomChunkProvider(World world) {
        // Save the passed values for later use.
        this.world = world;
        random = new Random(world.getSeed());
    }    
    
@Override
public boolean chunkExists(int x, int z) {
	return true; // Of course it does, it's all air though...
}

public Chunk loadChunk(int chunkX, int chunkZ) {
        // Setting the random seed this way allows for the same seed to generate the same chunk
        // every time, even though we don't use it in this tutorial.
        random.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L);
        // Create an empty chunk
        Chunk chunk = new Chunk(world, chunkX, chunkZ);
        if (chunkX!=0 || chunkZ!=0) { // Only generate the 0,0 chunk.
            return chunk;
        }
        // Generate extended block storage
        for (int y=0; y<16; y++) {
            chunk.getBlockStorageArray()[y] = new ExtendedBlockStorage(y << 4, true);
        }
        // Generate 16x16 square of grass blocks at y value of 63.
        for (int x=0; x<16; x++) {
            for (int z=0; z<16; z++) {
                chunk.getBlockStorageArray()[3].set(x, 15/*y*/, z, Blocks.air.getDefaultState());
            }
        }
        chunk.generateSkylightMap();
        return chunk;
    }

@Override
public Chunk provideChunk(int x, int z) {
	return loadChunk(x, z);
}
@Override
public Chunk provideChunk(BlockPos blockPosIn) {
	return loadChunk(blockPosIn.getX(), blockPosIn.getY());
}
@Override
public void populate(IChunkProvider p_73153_1_, int p_73153_2_,
		int p_73153_3_) {
	//populate with ore or whatever
}
@Override
public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_,
		int p_177460_3_, int p_177460_4_) {
	// TODO Auto-generated method stub
	return false;
}
@Override
public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_) {
	// TODO Auto-generated method stub
	return false;
}
@Override
public boolean unloadQueuedChunks() {
	// TODO Auto-generated method stub
	return false;
}
@Override
public boolean canSave() {
	return true;
}
@Override
public String makeString() {
	// TODO Auto-generated method stub
	return "CleanRoom";
}
@Override //getPossibleCreatures
public List func_177458_a(EnumCreatureType p_177458_1_, BlockPos p_177458_2_) {
	return null;
}
@Override
public BlockPos getStrongholdGen(World worldIn, String p_180513_2_,
		BlockPos p_180513_3_) {
	return null;
}
@Override
public int getLoadedChunkCount() {
	return 0;
}
@Override
public void recreateStructures(Chunk p_180514_1_, int p_180514_2_,
		int p_180514_3_) {

}
@Override
public void saveExtraData() {

}

}

 

public class CleanRoomChunkManager extends WorldChunkManager {
    private World world;
    private List<BiomeGenBase> biomesToSpawnIn;

    public CleanRoomChunkManager() {
        biomesToSpawnIn = new ArrayList<BiomeGenBase>();
        biomesToSpawnIn.add(BiomeGenBase.plains); // Which biomes can you spawn in?
    }

    public CleanRoomChunkManager(World world) {
        this();
        this.world = world; // save the world value if you need it later.
    }

    // Gets the list of valid biomes for the player to spawn in.
    public List getBiomesToSpawnIn() {
        return biomesToSpawnIn;
    }

    // Returns the BiomeGenBase related to the x, z position on the world.
    public BiomeGenBase getBiomeGenAt(int x, int z) {
        return BiomeGenBase.plains; // Always plains here
    }

    // checks given Chunk's Biomes against List of allowed ones
    public boolean areBiomesViable(int par1, int par2, int par3, List par4List) {
        return true;
    }

    // Finds a valid position within a range, that is one of the listed biomes.
    public BlockPos findBiomePosition(int i, int j, int k, List list, Random random) {
        // With the integration of the server into the client, the spawn location is randomized a bit.
        // EntityPlayerMP will adjust the location you give here randomly in the range of -10 to +9
        // This is done to both the X and Z locations.
        // The Y location is ideally just above the top solid block at that location.
        // NOTE:  If the location given does not have a grass block, the location will be further randomized.
        return new BlockPos(7, 0, 7);
    }
}

Link to comment
Share on other sites

1. What is your minecraft and forge version?

2. I think you should make it so that there is no chunk on the world.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

11.14.1.1334 the latest recommended

 

In which class would i do that? Im new to world generation..

So is that 1.7 or 2.8?

And surely, on public boolean chunkExists(int x, int z)

 

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

1.8 returning fals for chunk exists still causes the same error

I inspected it and only found out that the exception is impossible..

Can you debug it with some breakpoints?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

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.