Jump to content

Dimension, multiple biomes, Exception ticking world


OwnAgePau

Recommended Posts

Hi all,

 

I am working on my mod which adds a new dimension that generates just like the nether but with all custom blocks and such. Now that i had that all working i wanted to go with my custom WorldChunkManager called WorldChunkManagerMarona and start making it so that i can get more biomes to generate in my dimension. What i did:

- Made the following classes : (all classes from genlayer), WorldChunkManagerMarona, TheBiomeDeco (BiomeDecorator), BiomeGenBaseMarona, BiomeCacheBlock, BiomeCache, WorldTypeMarona, WorldTypeEventMarona.

Changed my chunkprovider and all my biomes so that tey use BiomeGenBaseMarona instead of BiomeGenBase.

 

I also have this custom Entity + model + renderer and i am not sure if that has anything to do with the Exception Ticking World cause when i look at the error where it points me to i see :

public void tick()
{       
//There is a lot more in this but i left it out
this.updateTimeLightAndEntities();
}

This is that method:

public void updateTimeLightAndEntities()
    {
        this.theProfiler.startSection("levels");
        int i;

        Integer[] ids = DimensionManager.getIDs(this.tickCounter % 200 == 0);
        for (int x = 0; x < ids.length; x++)
        {
            int id = ids[x];
            long j = System.nanoTime();

            if (id == 0 || this.getAllowNether())
            {
                WorldServer worldserver = DimensionManager.getWorld(id);
                this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());
                this.theProfiler.startSection("pools");
                worldserver.getWorldVec3Pool().clear();
                this.theProfiler.endSection();

                if (this.tickCounter % 20 == 0)
                {
                    this.theProfiler.startSection("timeSync");
                    this.serverConfigManager.sendPacketToAllPlayersInDimension(new Packet4UpdateTime(worldserver.getTotalWorldTime(), worldserver.getWorldTime()), worldserver.provider.dimensionId);
                    this.theProfiler.endSection();
                }

                this.theProfiler.startSection("tick");
                FMLCommonHandler.instance().onPreWorldTick(worldserver);
                CrashReport crashreport;

                try
                {
                    worldserver.tick(); 
                }
                catch (Throwable throwable) // This is where it throws the "Exception"
                {
                    crashreport = CrashReport.makeCrashReport(throwable, "Exception ticking world");
                    worldserver.addWorldInfoToCrashReport(crashreport);
                    throw new ReportedException(crashreport);
                }
//There is more below but as it doesn't even reach that far i didn't paste it in
           }
     }
}

Crash report:

 

 

---- Minecraft Crash Report ----

// You should try our sister game, Minceraft!

 

Time: 11-5-13 15:42

Description: Exception ticking world

 

java.lang.NullPointerException

at net.minecraft.world.WorldServer.tick(WorldServer.java:157)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:641)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:571)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:469)

at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.world.WorldServer.tick(WorldServer.java:157)

 

-- Affected level --

Details:

Level name: O

All players: 0 total; []

Chunk stats: ServerChunkCache: 0 Drop: 0

Level seed: 6373585879700994045

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: World: (0,0,0), Chunk: (at 0,0,0 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: 0 game time, 0 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: ~~ERROR~~ NullPointerException: null

Stacktrace:

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:641)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:571)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:469)

at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

 

-- System Details --

Details:

Minecraft Version: 1.5.2

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.7.0_17, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 911871824 bytes (869 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Suspicious classes: FML and Forge are installed

IntCache: cache: 0, tcache: 0, allocated: 3, tallocated: 63

FML: MCP v7.51 FML v5.2.5.686 Minecraft Forge 7.8.0.686 4 mods loaded, 4 mods active

mcp{7.44} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{5.2.5.686} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{7.8.0.686} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

myOresMod{1.2.3} [soul Forest Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Player Count: 0 / 8; []

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

 

 

 

If you want any looks inside any of these many classes please tell me which ones you need. I'll include my WorldChunkManager as it is mostly the "base class" of the dimension/biome thing.

 

 

package Mod_Ores.BiomeGen.Dimension;

import Mod_Ores.BiomeGen.BiomeGenBaseMarona;
import Mod_Ores.BiomeGen.GenLayer.GenLayerMarona;
import Mod_Ores.BiomeGen.GenLayer.IntCacheMarona;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;

import net.minecraftforge.common.*;
import net.minecraftforge.event.terraingen.*;

public class WorldChunkManagerMarona
{
    public static ArrayList<BiomeGenBaseMarona> allowedBiomes = new ArrayList<BiomeGenBaseMarona>(Arrays.asList(BiomeGenBaseMarona.SoulForest, BiomeGenBaseMarona.FrostCaves));
    private GenLayerMarona genBiomes;

    /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */
private GenLayerMarona biomeIndexLayer;

    /** The BiomeCache object for this world. */
private BiomeCacheMarona biomeCache;

    /** A list of biomes that the player can spawn in. */
private List biomesToSpawnIn;

    protected WorldChunkManagerMarona()
    {
        this.biomeCache = new BiomeCacheMarona(this);
        this.biomesToSpawnIn = new ArrayList();
        this.biomesToSpawnIn.addAll(allowedBiomes);
    }

    public WorldChunkManagerMarona(long par1, WorldTypeMarona par3WorldType)
    {
        this();
        GenLayerMarona[] agenlayer = GenLayerMarona.initializeAllBiomeGenerators(par1, par3WorldType);
        agenlayer = getModdedBiomeGenerators(par3WorldType, par1, agenlayer);
        this.genBiomes = agenlayer[0];
        this.biomeIndexLayer = agenlayer[1];
    }

    public WorldChunkManagerMarona(World par1World)
    {
        this();
    }

    public WorldChunkManagerMarona(BiomeGenBaseMarona biomeGenBaseMarona, float f, float g) 
    {
	// TODO Auto-generated constructor stub
}

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

    /**
     * Returns the BiomeGenBase related to the x, z position on the world.
     */
public BiomeGenBaseMarona getBiomeGenAt(int par1, int par2)
    {
        return this.biomeCache.getBiomeGenAt(par1, par2);
    }

    /**
     * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length.
     */
public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5)
    {
        IntCacheMarona.resetIntCache();

        if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
        {
            par1ArrayOfFloat = new float[par4 * par5];
        }

        int[] aint = this.biomeIndexLayer.getInts(par2, par3, par4, par5);

        for (int i1 = 0; i1 < par4 * par5; ++i1)
        {
            float f = (float)BiomeGenBaseMarona.biomeList[aint[i1]].getIntRainfall() / 65536.0F;

            if (f > 1.0F)
            {
                f = 1.0F;
            }

            par1ArrayOfFloat[i1] = f;
        }

        return par1ArrayOfFloat;
    }

    @SideOnly(Side.CLIENT)

    /**
     * Return an adjusted version of a given temperature based on the y height
     */
public float getTemperatureAtHeight(float par1, int par2)
    {
        return par1;
    }

    /**
     * Returns a list of temperatures to use for the specified blocks.  Args: listToReuse, x, y, width, length
     */
public float[] getTemperatures(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5)
    {
        IntCacheMarona.resetIntCache();

        if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
        {
            par1ArrayOfFloat = new float[par4 * par5];
        }

        int[] aint = this.biomeIndexLayer.getInts(par2, par3, par4, par5);

        for (int i1 = 0; i1 < par4 * par5; ++i1)
        {
            float f = (float)BiomeGenBaseMarona.biomeList[aint[i1]].getIntTemperature() / 65536.0F;

            if (f > 1.0F)
            {
                f = 1.0F;
            }

            par1ArrayOfFloat[i1] = f;
        }

        return par1ArrayOfFloat;
    }

    /**
     * Returns an array of biomes for the location input.
     */
public BiomeGenBaseMarona[] getBiomesForGeneration(BiomeGenBaseMarona[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
    {
	IntCacheMarona.resetIntCache();

        if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
        {
            par1ArrayOfBiomeGenBase = new BiomeGenBaseMarona[par4 * par5];
        }

        int[] aint = this.genBiomes.getInts(par2, par3, par4, par5);

        for (int i1 = 0; i1 < par4 * par5; ++i1)
        {
            par1ArrayOfBiomeGenBase[i1] = BiomeGenBaseMarona.biomeList[aint[i1]];
        }

        return par1ArrayOfBiomeGenBase;
    }

    /**
     * Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the
     * WorldChunkManager Args: oldBiomeList, x, z, width, depth
     */
public BiomeGenBaseMarona[] loadBlockGeneratorData(BiomeGenBaseMarona[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
    {
        return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true);
    }

    /**
     * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
     * don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
     */
public BiomeGenBaseMarona[] getBiomeGenAt(BiomeGenBaseMarona[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6)
    {
	IntCacheMarona.resetIntCache();

        if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
        {
            par1ArrayOfBiomeGenBase = new BiomeGenBaseMarona[par4 * par5];
        }

        if (par6 && par4 == 16 && par5 == 16 && (par2 & 15) == 0 && (par3 & 15) == 0)
        {
        	BiomeGenBaseMarona[] abiomegenbase1 = this.biomeCache.getCachedBiomes(par2, par3);
            System.arraycopy(abiomegenbase1, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5);
            return par1ArrayOfBiomeGenBase;
        }
        else
        {
            int[] aint = this.biomeIndexLayer.getInts(par2, par3, par4, par5);

            for (int i1 = 0; i1 < par4 * par5; ++i1)
            {
                par1ArrayOfBiomeGenBase[i1] = BiomeGenBaseMarona.biomeList[aint[i1]];
            }

            return par1ArrayOfBiomeGenBase;
        }
    }

    /**
     * checks given Chunk's Biomes against List of allowed ones
     */
public boolean areBiomesViable(int par1, int par2, int par3, List par4List)
    {
	IntCacheMarona.resetIntCache();
        int l = par1 - par3 >> 2;
        int i1 = par2 - par3 >> 2;
        int j1 = par1 + par3 >> 2;
        int k1 = par2 + par3 >> 2;
        int l1 = j1 - l + 1;
        int i2 = k1 - i1 + 1;
        int[] aint = this.genBiomes.getInts(l, i1, l1, i2);

        for (int j2 = 0; j2 < l1 * i2; ++j2)
        {
        	BiomeGenBaseMarona biomegenbase = BiomeGenBaseMarona.biomeList[aint[j2]];

            if (!par4List.contains(biomegenbase))
            {
                return false;
            }
        }

        return true;
    }

    /**
     * Finds a valid position within a range, that is in one of the listed biomes. Searches {par1,par2} +-par3 blocks.
     * Strongly favors positive y positions.
     */
public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random)
    {
	IntCacheMarona.resetIntCache();
        int l = par1 - par3 >> 2;
        int i1 = par2 - par3 >> 2;
        int j1 = par1 + par3 >> 2;
        int k1 = par2 + par3 >> 2;
        int l1 = j1 - l + 1;
        int i2 = k1 - i1 + 1;
        int[] aint = this.genBiomes.getInts(l, i1, l1, i2);
        ChunkPosition chunkposition = null;
        int j2 = 0;

        for (int k2 = 0; k2 < l1 * i2; ++k2)
        {
            int l2 = l + k2 % l1 << 2;
            int i3 = i1 + k2 / l1 << 2;
            BiomeGenBaseMarona biomegenbase = BiomeGenBaseMarona.biomeList[aint[k2]];

            if (par4List.contains(biomegenbase) && (chunkposition == null || par5Random.nextInt(j2 + 1) == 0))
            {
                chunkposition = new ChunkPosition(l2, 0, i3);
                ++j2;
            }
        }

        return chunkposition;
    }

    /**
     * Calls the WorldChunkManager's biomeCache.cleanupCache()
     */
public void cleanupCache()
    {
        this.biomeCache.cleanupCache();
    }

    public GenLayerMarona[] getModdedBiomeGenerators(WorldTypeMarona worldType, long seed, GenLayerMarona[] original)
    {
        WorldTypeEventMarona.InitBiomeGens event = new WorldTypeEventMarona.InitBiomeGens(worldType, seed, original);
        MinecraftForge.TERRAIN_GEN_BUS.post(event);
        return event.newBiomeGens;
    }
}

 

 

 

I hope someone reads this who knows how to get the mutliple biomes in my dimension working.

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.



×
×
  • Create New...

Important Information

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