Jump to content

[1.10.2] Custom Dimension


abused_master

Recommended Posts

Hey all, so today i was working on a mod thats sole purpose was a new dimension, but ran into some problems, minecraft starts up just fine but creating a world crashed, Crash Report:

http://pastebin.com/tNFjthiY

Code:

ChunkProvider:

public class CaveChunkProvider implements IChunkGenerator {

    public static final int FLOOR_HEIGHT = 62;
    public static final int CEILING_HEIGHT = 120;
    static int seedOffset = 0;
    static ImmutableSet<OreGenEvent.GenerateMinable.EventType> bannedOres = ImmutableSet.of(OreGenEvent.GenerateMinable.EventType.DIRT, OreGenEvent.GenerateMinable.EventType.GRAVEL, OreGenEvent.GenerateMinable.EventType.ANDESITE, OreGenEvent.GenerateMinable.EventType.DIORITE, OreGenEvent.GenerateMinable.EventType.GRANITE);
    private final World worldObj;

    static
    {
        MinecraftForge.ORE_GEN_BUS.register(CaveChunkProvider.class);
    }

    private final List<MapGenStructure> structureGenerators = Lists.newArrayList();
    private final List<MapGenBase> generators = Lists.newArrayList();
    Random random = new Random();
    GenStates[] nextState;
    Biome[] biomes = null;
    private WorldGenLakes waterLakeGenerator;
    private WorldGenLakes lavaLakeGenerator;

    public CaveChunkProvider(World worldIn, long seed)
    {
        int length = GenStates.values().length;
        this.nextState = new GenStates[length - 1];
        System.arraycopy(GenStates.values(), 1, this.nextState, 0, length - 1);

        this.worldObj = worldIn;

        this.structureGenerators.add(new MapGenScatteredFeature());
        this.structureGenerators.add(new MapGenMineshaft());

        this.generators.add(TerrainGen.getModdedMapGen(new MapGenCaves(), InitMapGenEvent.EventType.CAVE));
        this.generators.add(TerrainGen.getModdedMapGen(new MapGenRavine(), InitMapGenEvent.EventType.RAVINE));

        this.waterLakeGenerator = new WorldGenLakes(Blocks.WATER);
        this.lavaLakeGenerator = new WorldGenLakes(Blocks.LAVA);
    }

    @SubscribeEvent
    public static void preventOres(OreGenEvent.GenerateMinable event)
    {
        OreGenEvent.GenerateMinable.EventType type = event.getType();
    }

    @Nonnull
    public Chunk provideChunk(int x, int z)
    {
        ChunkPrimer chunkprimer = new ChunkPrimer();

        this.random.setSeed(this.worldObj.getSeed() + (x >> 2) * 65535 + (z >> 2));

        int spire_x = (x >> 2) * 64 + (8 + this.random.nextInt(48)) - x * 16;
        int spire_z = (z >> 2) * 64 + (8 + this.random.nextInt(48)) - z * 16;

        this.random.setSeed(x * 341873128712L + z * 132897987541L);
        GenStates[] values = GenStates.values();
        for (int dx = 0; dx < 16; dx++) {
            for (int dz = 0; dz < 16; dz++)
            {
                int rs = (spire_x - dx) * (spire_x - dx) + (spire_z - dz) * (spire_z - dz);

                double spire_dist = rs < 256 ? Math.sqrt(rs) : Double.MAX_VALUE;

                GenStates curState = GenStates.FLOOR_BEDROCK;
                for (int dy = 0; dy < 256; dy++)
                {
                    IBlockState state = curState.state;
                    if ((curState == GenStates.AIR) &&
                            (rs < 256))
                    {
                        int m = Math.min(dy - 62, 120 - dy);
                        double t = spire_dist;
                        if (m < 9) {
                            t -= Math.sqrt(9 - m);
                        }
                        if ((t <= 4.0D) || ((t <= 5.0D) && (this.random.nextBoolean()))) {
                            state = Blocks.COBBLESTONE.getDefaultState();
                        }
                    }
                    if (dy >= 253) {
                        state = Blocks.BEDROCK.getDefaultState();
                    }
                    chunkprimer.setBlockState(dx, dy, dz, state);
                    boolean advance;
                    switch (curState)
                    {
                        case FLOOR_BEDROCK:
                            advance = (dy > 2) || ((dy > 0) && (this.random.nextBoolean()));
                            break;
                        case GROUND:
                            advance = (dy >= 64) || ((dy >= 62) && (this.random.nextInt(4) != 0));
                            break;
                        case AIR:
                            advance = (dy >= 90) && ((dy >= 120) || (this.random.nextInt(1 + 2 * (120 - dy) * (120 - dy)) == 0));
                            break;
                        case CEILING:
                            advance = (dy >= 120) && (this.random.nextInt(40) == 0);
                            break;
                        case CEILING_STONE:
                            advance = dy >= 253;

                            break;
                        case CEILING_BEDROCK:
                            advance = false;
                            break;
                        default:
                            throw new RuntimeException("Invalid State " + curState);
                    }
                    if (advance) {
                        curState = values[(curState.ordinal() + 1)];
                    }
                }
            }
        }
        for (MapGenBase generator : this.generators) {
            generator.generate(this.worldObj, x, z, chunkprimer);
        }
        for (MapGenBase mapgenbase : this.structureGenerators) {
            mapgenbase.generate(this.worldObj, x, z, chunkprimer);
        }
        for (int dx = 0; dx < 16; dx++) {
            for (int dz = 0; dz < 16; dz++) {
                for (int dy = 62; dy < 65; dy++) {
                    if (chunkprimer.getBlockState(dx, dy, dz) == Blocks.STONE.getDefaultState()) {
                        chunkprimer.setBlockState(dx, dy, dz, Blocks.COBBLESTONE.getDefaultState());
                    }
                }
            }
        }
        Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);

        this.biomes = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomes, x * 16, z * 16, 16, 16);
        byte[] biomeIDs = chunk.getBiomeArray();
        for (int l = 0; l < biomeIDs.length; l++) {
            biomeIDs[l] = ((byte)Biome.getIdForBiome(this.biomes[l]));
        }
        chunk.generateSkylightMap();
        return chunk;
    }

    public void populate(int x, int z)
    {
        BlockFalling.fallInstantly = true;
        int i = x * 16;
        int j = z * 16;
        BlockPos blockpos = new BlockPos(i, 0, j);
        Biome biome = this.worldObj.getBiomeForCoordsBody(new BlockPos(i + 16, 0, j + 16));
        boolean flag = false;
        this.random.setSeed(this.worldObj.getSeed());
        long k = this.random.nextLong() / 2L * 2L + 1L;
        long l = this.random.nextLong() / 2L * 2L + 1L;
        this.random.setSeed(x * k + z * l ^ this.worldObj.getSeed());
        ChunkPos chunkpos = new ChunkPos(x, z);

        ForgeEventFactory.onChunkPopulate(true, this, this.worldObj, this.random, x, z, false);
        for (MapGenStructure mapgenstructure : this.structureGenerators)
        {
            boolean flag1 = mapgenstructure.generateStructure(this.worldObj, this.random, chunkpos);
            if ((mapgenstructure instanceof MapGenVillage)) {
                flag |= flag1;
            }
        }
        if ((this.waterLakeGenerator != null) && (!flag) && (this.random.nextInt(4) == 0)) {
            this.waterLakeGenerator.generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + );
        }
        if ((this.lavaLakeGenerator != null) && (!flag) && (this.random.nextInt( == 0))
        {
            BlockPos blockpos1 = blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(this.random.nextInt(248) + , this.random.nextInt(16) + ;
        }
        for (int i1 = 0; i1 < 8; i1++) {
            new WorldGenDungeons().generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + );
        }
        for (int i2 = 0; i2 < 2; i2++)
        {
            seedOffset = i2;
            biome.decorate(this.worldObj, this.random, blockpos);
        }
        seedOffset = 0;

        ForgeEventFactory.onChunkPopulate(false, this, this.worldObj, this.random, x, z, flag);
        BlockFalling.fallInstantly = false;

        seedOffset = 1;
        GameRegistry.generateWorld(x, z, this.worldObj, this, this.worldObj.getChunkProvider());
        seedOffset = 0;
    }

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

    @Nonnull
    public List<Biome.SpawnListEntry> getPossibleCreatures(@Nonnull EnumCreatureType creatureType, @Nonnull BlockPos pos)
    {
        Biome biome = this.worldObj.getBiomeForCoordsBody(pos);
        return biome.getSpawnableList(creatureType);
    }

    @Nullable
    public BlockPos getStrongholdGen(@Nonnull World worldIn, @Nonnull String structureName, @Nonnull BlockPos position)
    {
        return null;
    }

    public void recreateStructures(@Nonnull Chunk chunkIn, int x, int z)
    {
        for (MapGenStructure mapgenstructure : this.structureGenerators) {
            mapgenstructure.generate(this.worldObj, x, z, null);
        }
    }

    static enum GenStates
    {
        FLOOR_BEDROCK(Blocks.BEDROCK.getDefaultState()),  GROUND(Blocks.STONE.getDefaultState()),  AIR(Blocks.AIR.getDefaultState()),  CEILING(Blocks.COBBLESTONE.getDefaultState()),  CEILING_STONE(Blocks.STONE.getDefaultState()),  CEILING_BEDROCK(Blocks.BEDROCK.getDefaultState());

        final IBlockState state;

        private GenStates(IBlockState state)
        {
            this.state = state;
        }
    }

}

 

World Provider:

public class CaveWorldProvider extends OvercaveWorldProvider {

    static
    {
        MinecraftForge.EVENT_BUS.register(CaveWorldProvider.class);
    }

        public CaveWorldProvider()
    {
        super(OvercaveEntries.over_cave);
        this.isHellWorld = false;
        this.hasNoSky = true;
    }
    public long getSeed()
    {
        int i = CaveChunkProvider.seedOffset;
        if (i != 0) {
            return super.getSeed() * 31L + i;
        }
        return super.getSeed();
    }

    public int getHeight()
    {
        return 81;
    }

    public boolean canCoordinateBeSpawn(int x, int z)
    {
        return true;
    }

    public boolean canRespawnHere()
    {
        return true;
    }

    public boolean isSurfaceWorld()
    {
        return false;
    }

    public boolean isSkyColored()
    {
        return false;
    }

    public boolean doesXZShowFog(int x, int z)
    {
        return false;
    }

    @Nullable
    public float[] calcSunriseSunsetColors(float celestialAngle, float partialTicks)
    {
        return null;
    }

    @Nonnull
    public Vec3d getFogColor(float p_76562_1_, float p_76562_2_)
    {
        return new Vec3d(1.0E-5D, 1.0E-5D, 1.0E-5D);
    }

    public float calculateCelestialAngle(long par1, float par3)
    {
        int j = 18000;
        float f1 = (j + par3) / 24000.0F - 0.25F;
        if (f1 < 0.0F) {
            f1 += 1.0F;
        }
        if (f1 > 1.0F) {
            f1 -= 1.0F;
        }
        float f2 = f1;
        f1 = 1.0F - (float)((Math.cos(f1 * 3.141592653589793D) + 1.0D) / 2.0D);
        f1 = f2 + (f1 - f2) / 3.0F;
        return f1;
    }

    @Nonnull
    public IChunkGenerator createChunkGenerator()
    {
        return new CaveChunkProvider(this.worldObj, getSeed());
    }

    protected void generateLightBrightnessTable()
    {
        float f = 0.0F;
        for (int i = 0; i <= 15; i++)
        {
            float p = i / 15.0F;
            float f1 = 1.0F - p;
            this.lightBrightnessTable[i] = (p / (f1 * 3.0F + 1.0F));
            if (this.lightBrightnessTable[i] < 0.2F) {
                this.lightBrightnessTable[i] *= this.lightBrightnessTable[i] / 0.2F;
            }
        }
    }

}

OverCaveWorldProvider:

public class OvercaveWorldProvider extends WorldProvider {

    final DimensionEntry entry;

    public OvercaveWorldProvider(DimensionEntry entry)
    {
        this.entry = entry;
    }

    @Nonnull
    public DimensionType getDimensionType()
    {
        return (DimensionType) this.entry.value;
    }

}

 

Link to comment
Share on other sites

All I can say is, what's at VillageCollection.java:303 and why would your code cause it to be null.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • ya ya i get it boolean find = false; int count = 0; BlockState dblkstate; BlockPos bpos = null; BlockPos dpos = null; for(BlockPos cursor : todos_los_blockes ){ dpos = cursor; target.particle(cursor.getCenter()); dblkstate = warudo.getBlockState(cursor); if( !dblkstate.canBeReplaced() ){  //<---------- //if( dblkstate .getBlock() instanceof tubo ){ find = true; break; } bpos = cursor; count ++; } for this case setting blocks i can know discrimaniting by the  canbereplaced tag      thanks 
    • can we have a example of that for item    inever could make it work for item  for blocks i got this  
    • When opening I am directed to a log called ´´forge-1.20.1-47.2.20-installer.jar.log´´ below the following error is written: JVM info: Oracle Corporation - 21.0.2 - 21.0.2+13- LTS-58 java.net.preferIPv4Stack=true Current Time: 02/27/2024 16:58:33 Host: files.minecraftforge.net [51.79.83.165] Host: maven.minecraftforge.net [51.79.83.165] Host: libraries.minecraft.net [13.107.246.33, 13.107.213.33] Host: launchermeta.mojang.com [13.107.246.33, 13.107.213.33] Host: piston-meta.mojang.com [13.107.246.33, 13.107.213.33] java.net.UnknownHostException: This host is not known (authserver.mojang.com) at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:52) at java.base/java.net.InetAddress$PlatformResolver.lookupByName(InetAddress.java:1211) at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1828) at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:1139) at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1818) at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1688) at net.minecraftforge.installer.DownloadUtils.getIps(DownloadUtils.java:290) at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120) Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "net.minecraftforge.installer.DownloadUtils.getIps(String)" is null at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120)
    • I have downloaded forge version 1.20.4 and I have Java 17 installed but my .jar will not open and the error log text file below is created     JVM info: Oracle Corporation - 17.0.10 - 17.0.10+11-LTS-240 java.net.preferIPv4Stack=true Current Time: 27/02/2024 19:43:19 Host: files.minecraftforge.net [51.79.83.165, 2607:5300:203:65a5:0:0:0:0] Host: maven.minecraftforge.net [51.79.83.165, 2607:5300:203:65a5:0:0:0:0] Host: libraries.minecraft.net [13.107.246.64, 13.107.213.64, 2620:1ec:46:0:0:0:0:64, 2620:1ec:bdf:0:0:0:0:64] Host: launchermeta.mojang.com [13.107.213.64, 13.107.246.64, 2620:1ec:bdf:0:0:0:0:64, 2620:1ec:46:0:0:0:0:64] Host: piston-meta.mojang.com [13.107.213.64, 13.107.246.64, 2620:1ec:46:0:0:0:0:64, 2620:1ec:bdf:0:0:0:0:64] java.net.UnknownHostException: No such host is known (authserver.mojang.com)     at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)     at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:933)     at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1543)     at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:852)     at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1532)     at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1384)     at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1305)     at net.minecraftforge.installer.DownloadUtils.getIps(DownloadUtils.java:290)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120) Exception in thread "main"  java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "net.minecraftforge.installer.DownloadUtils.getIps(String)" is null     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120)  
    • we tried both versions and both cant run on her laptop for some reason idk what to do  
  • Topics

×
×
  • Create New...

Important Information

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