Jump to content

[1.12.2] Rendering is weird on custom flat dimension


bonjourpancake

Recommended Posts

Hi all,
Working on a custom dimension based on the flat dimension generator from Minecraft and I can't seem to figure out how to make it look like the default flat land.

Example:
LVR8fSZ.png

 

I'm looking through the source and I've only modified the generation of villages and messed around with the rendering of clouds but other than that I don't know where I went wrong.

I've tried setting Sky and Cloud renderers to null as well as setting the cloud heights to -1.0F.
Could anyone have a look and see where I went wrong / what source code to look at to make it look like normal flat?

 

CODE:

PowerhouseDimensions.java (registered in preInit of CommonProxy)

public class PowerhouseDimensions {

    public static DimensionType powerhouseDimensionType;

    public static void init() {
        registerDimensionTypes();
        registerDimensions();
    }

    private static void registerDimensionTypes() {
        powerhouseDimensionType = DimensionType.register(
                Powercraft.MOD_ID,
                "_test",
                Powercraft.DIMENSION_ID,
                FlatWorldProvider.class,
                false);


    }

    private static void registerDimensions() {
        DimensionManager.registerDimension(Powercraft.DIMENSION_ID, powerhouseDimensionType);
    }

}

 

FlatWorldProvider.java

public class FlatWorldProvider extends WorldProvider {

    @Override
    public DimensionType getDimensionType() {
        return PowerhouseDimensions.powerhouseDimensionType;
    }

    @Override
    public String getSaveFolder() {
        return "flat";
    }

    @Override
    public IChunkGenerator createChunkGenerator() {
        return new FlatDimensionGenerator(world);
    }

}

 

FlatDimensionGenerator.java

public class FlatDimensionGenerator implements IChunkGenerator
{
    private final World world;
    private final IBlockState[] cachedBlockIDs = new IBlockState[256];
    private final FlatGeneratorInfo flatWorldGenInfo;

    public FlatDimensionGenerator(World worldIn)
    {
        this.world = worldIn;
        this.flatWorldGenInfo = FlatGeneratorInfo.getDefaultFlatGenerator();

        int j = 0;
        int k = 0;

        for (FlatLayerInfo flatlayerinfo : this.flatWorldGenInfo.getFlatLayers())
        {
            for (int i = flatlayerinfo.getMinY(); i < flatlayerinfo.getMinY() + flatlayerinfo.getLayerCount(); ++i)
            {
                IBlockState iblockstate = flatlayerinfo.getLayerMaterial();

                if (iblockstate.getBlock() != Blocks.AIR)
                {
                    this.cachedBlockIDs[i] = iblockstate;
                }
            }

            if (flatlayerinfo.getLayerMaterial().getBlock() == Blocks.AIR)
            {
                k += flatlayerinfo.getLayerCount();
            }
            else
            {
                j += flatlayerinfo.getLayerCount() + k;
                k = 0;
            }
        }

        worldIn.setSeaLevel(j);
    }

    /**
     * Generates the chunk at the specified position, from scratch
     */
    @Override
    public Chunk generateChunk(int x, int z)
    {
        ChunkPrimer chunkprimer = new ChunkPrimer();

        for (int i = 0; i < this.cachedBlockIDs.length; ++i)
        {
            IBlockState iblockstate = this.cachedBlockIDs[i];

            if (iblockstate != null)
            {
                for (int j = 0; j < 16; ++j)
                {
                    for (int k = 0; k < 16; ++k)
                    {
                        chunkprimer.setBlockState(j, i, k, iblockstate);
                    }
                }
            }
        }

        Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
        //chunk.generateSkylightMap();
        return chunk;
    }

    @Override
    public void populate(int x, int z) {
    }

    @Override
    public boolean generateStructures(Chunk chunkIn, int x, int z) {
        return false;
    }

    public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
    {
       return Collections.emptyList();
    }

    @Nullable
    @Override
    public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, boolean findUnexplored) {
        return null;
    }

    @Override
    public boolean isInsideStructure(World worldIn, String structureName, BlockPos pos) {
        return false;
    }

    @Override
    public void recreateStructures(Chunk chunkIn, int x, int z) {

    }
}

 

Edited by bonjourpancake
Link to comment
Share on other sites

  • 4 weeks later...

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.