Jump to content

Dimension help:


BottleFact

Recommended Posts

Hi! I have a problem with my dimension; when it generates, all the chunks don't line up  There is a spoiler with a snippet of the output. The code is also provided. Thanks to those who can help me!

 

P.S. I have tried rewriting all the code, changing the dimension id, but it won't work  :-\

Here's an image of what I'm describing:

 

hUeOlI4.png

 

Output

 

 

[10:57:25] [server thread/WARN] [FML]: ****************************************

[10:57:25] [server thread/WARN] [FML]: * There is an attempt to load a chunk (23,36) in dimension 32 that is already being loaded. This will cause weird chunk breakages.

[10:57:25] [server thread/WARN] [FML]: *  at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:172)

[10:57:25] [server thread/WARN] [FML]: *  at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149)

[10:57:25] [server thread/WARN] [FML]: *  at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119)

[10:57:25] [server thread/WARN] [FML]: *  at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:221)

[10:57:25] [server thread/WARN] [FML]: *  at net.minecraft.world.World.getChunkFromChunkCoords(World.java:482)

[10:57:25] [server thread/WARN] [FML]: *  at net.minecraft.world.SpawnerAnimals.func_151350_a(SpawnerAnimals.java:33)...

[10:57:25] [server thread/WARN] [FML]: ****************************************

 

 

 

Code

 

Biome

 

 

package sqm.minecraft.starfield.dimension;

 

import java.util.Random;

 

import net.minecraft.init.Blocks;

import net.minecraft.world.World;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraft.world.gen.feature.WorldGenDesertWells;

 

public class DimensionBiomeStarfield extends BiomeGenBase

{

    private static final String __OBFID = "CL_00000167";

 

    public DimensionBiomeStarfield(int p_i1977_1_)

    {

        super(p_i1977_1_);

        this.spawnableCreatureList.clear();

        this.topBlock = Blocks.sand;

        this.fillerBlock = Blocks.sand;

        this.theBiomeDecorator.treesPerChunk = -999;

        this.theBiomeDecorator.deadBushPerChunk = 2;

        this.theBiomeDecorator.reedsPerChunk = 50;

        this.theBiomeDecorator.cactiPerChunk = 10;

        this.spawnableCreatureList.clear();

    }

 

    public void decorate(World p_76728_1_, Random p_76728_2_, int p_76728_3_, int p_76728_4_)

    {

        super.decorate(p_76728_1_, p_76728_2_, p_76728_3_, p_76728_4_);

 

        if (p_76728_2_.nextInt(1000) == 0)

        {

            int k = p_76728_3_ + p_76728_2_.nextInt(16) + 8;

            int l = p_76728_4_ + p_76728_2_.nextInt(16) + 8;

            WorldGenDesertWells worldgendesertwells = new WorldGenDesertWells();

            worldgendesertwells.generate(p_76728_1_, p_76728_2_, k, p_76728_1_.getHeightValue(k, l) + 1, l);

        }

    }

}

 

 

 

World Provider

 

 

package sqm.minecraft.starfield.dimension;

 

import net.minecraft.world.WorldProvider;

import net.minecraft.world.biome.WorldChunkManagerHell;

import sqm.minecraft.starfield.Starfield;

 

public class DimensionProviderStarfield extends WorldProvider {

 

private static final String __OBFID = "CL_00000387";

private float[] colorsSunriseSunset = new float[4];

 

    /**

    * creates a new world chunk manager for WorldProvider

    */

    public void registerWorldChunkManager()

    {

        this.worldChunkMgr = new WorldChunkManagerHell(Starfield.dimensionBiome, 0.0F);

        this.dimensionId = Starfield.dimensionID;

    }

 

    /**

    * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld".

    */

    public String getDimensionName()

    {

        return "Starfield";

    }

 

}

 

 

 

 

Teleporter

 

 

package sqm.minecraft.starfield.dimension;

 

import java.util.ArrayList;

import java.util.List;

import java.util.Random;

 

import net.minecraft.entity.Entity;

import net.minecraft.init.Blocks;

import net.minecraft.util.LongHashMap;

import net.minecraft.util.MathHelper;

import net.minecraft.world.Teleporter;

import net.minecraft.world.WorldServer;

 

public class TeleporterStarfield extends Teleporter

{

    private final WorldServer worldServerInstance;

    /** A private Random() function in Teleporter */

    private final Random random;

    /** Stores successful portal placement locations for rapid lookup. */

    private final LongHashMap destinationCoordinateCache = new LongHashMap();

    /**

    * A list of valid keys for the destinationCoordainteCache. These are based on the X & Z of the players initial

    * location.

    */

    private final List destinationCoordinateKeys = new ArrayList();

    private static final String __OBFID = "CL_00000153";

 

    public TeleporterStarfield(WorldServer p_i1963_1_)

    {

    super(p_i1963_1_);

        this.worldServerInstance = p_i1963_1_;

        this.random = new Random(p_i1963_1_.getSeed());

    }

 

    /**

    * Place an entity in a nearby portal, creating one if necessary.

    */

    public void placeInPortal(Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_)

    {

   

            int i = MathHelper.floor_double(p_77185_1_.posX);

            int j = MathHelper.floor_double(p_77185_1_.posY) - 1;

            int k = MathHelper.floor_double(p_77185_1_.posZ);

            byte b0 = 1;

            byte b1 = 0;

 

            for (int l = -2; l <= 2; ++l)

            {

                for (int i1 = -2; i1 <= 2; ++i1)

                {

                    for (int j1 = -1; j1 < 3; ++j1)

                    {

                        int k1 = i + i1 * b0 + l * b1;

                        int l1 = j + j1;

                        int i2 = k + i1 * b1 - l * b0;

                        boolean flag = j1 < 0;

                        this.worldServerInstance.setBlock(k1, l1, i2, flag ? Blocks.obsidian : Blocks.air);

                    }

                }

            }

 

            p_77185_1_.setLocationAndAngles((double)i, (double)j, (double)k, p_77185_1_.rotationYaw, 0.0F);

            p_77185_1_.motionX = p_77185_1_.motionY = p_77185_1_.motionZ = 0.0D;

    }

}

 

 

 

Useful bits from Main class

 

 

public static int dimensionID = 32;

 

public static final BiomeGenBase dimensionBiome = (new DimensionBiomeStarfield(80)).setColor(6316128).setBiomeName("Starfield").setHeight(new BiomeGenBase.Height(1.0F, 0.5F)).setDisableRain();

 

    public static void teleportDim(World w, int x, int y, int z, Entity entity)

    {

    if(entity.ridingEntity == null && entity.riddenByEntity == null && entity instanceof EntityPlayerMP){

    EntityPlayerMP player = (EntityPlayerMP) entity;

    FMLCommonHandler.instance().getMinecraftServerInstance();

    MinecraftServer server = MinecraftServer.getServer();

   

    if(player.timeUntilPortal > 0)

    {

    player.timeUntilPortal = 10;

    }else if(player.dimension != dimensionID)

    {

    player.timeUntilPortal = 10;

    player.mcServer.getConfigurationManager().transferPlayerToDimension(player, dimensionID,new TeleporterStarfield(server.worldServerForDimension(dimensionID)));

    }else{

    player.timeUntilPortal = 10;

    player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0,new TeleporterStarfield(server.worldServerForDimension(0)));

    }

    }

    }

 

    DimensionManager.registerProviderType(dimensionID, DimensionProviderStarfield.class, false);

    DimensionManager.registerDimension(dimensionID, dimensionID);

 

 

Creator of the Starfield Mod.

Link to comment
Share on other sites

Okay, I actually went ahead and fixed the bug instead! (it will produce the same error message but there should be no more walls!)

 

I pretty much added a system where it would temporarily store generated chunks and return them if they existed at the location that was called to be generated. I did the same with the stone noise for each chunk; store it, find it, return it.

 

Big plus; no side effects!  :D

Creator of the Starfield Mod.

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.