Jump to content

Recommended Posts

Posted

this is my ore generation class there are no errors but it crashes the game when i register the generation. please help:

 

package com.moreoresmod.main.worldgeneration;

 

import java.util.Random;

 

import com.google.common.base.Predicate;

import com.moreoresmod.main.init.MoreOresModBlocks;

 

import net.minecraft.block.Block;

import net.minecraft.block.state.IBlockState;

import net.minecraft.init.Blocks;

import net.minecraft.util.BlockPos;

import net.minecraft.world.World;

import net.minecraft.world.WorldProvider;

import net.minecraft.world.chunk.IChunkProvider;

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

import net.minecraftforge.fml.common.IWorldGenerator;

 

public class RubyGeneration implements IWorldGenerator {

 

        @Override

        public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

                switch(world.provider.getDimensionId()){

                case 1:

                        generateEnd(world, random, chunkX, chunkZ);

                        break;

                case 0:

                        generateOverworld(world, random, chunkX, chunkZ);

                        break;

                case -1:

                        generateNeather(world, random, chunkX, chunkZ);

                        break;

                }

        }

        public void generateEnd(World world, Random random, int x, int z){

             

        }

     

        public void generateOverworld(World world, Random random, int x, int z){

                generateOre(MoreOresModBlocks.ruby_ore, world, random, x, z, 2 ,10 , 5, 0, 100, Blocks.stone);

        }

     

        public void generateNeather(World world, Random random, int x, int z){

             

        }

 

        public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance , int minY, int maxY, Block generateIn){

                int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);

                int hightRange = maxY - minY;

                WorldGenMinable gen = new WorldGenMinable((IBlockState) block, vienSize);

                for(int i = 0; i < chance; i++){

                        int xRand = chunkX * 16 + random.nextInt(16);

                        int yRand = random.nextInt(hightRange) + minY;

                        int zRand = chunkZ * 16 + random.nextInt(16);

                        gen.generate(world, random, blockPos(xRand, yRand, zRand));

                }

        }

        private BlockPos blockPos(int chunkX, int hightRange, int chunkZ) {

                return null;

        }

}

Posted

what is the problem now i found the new BlockPos But it still crashes:

 

package com.moreoresmod.main.worldgeneration;

 

import java.util.Random;

 

import com.google.common.base.Predicate;

import com.moreoresmod.main.init.MoreOresModBlocks;

 

import net.minecraft.block.Block;

import net.minecraft.block.state.IBlockState;

import net.minecraft.init.Blocks;

import net.minecraft.util.BlockPos;

import net.minecraft.world.World;

import net.minecraft.world.WorldProvider;

import net.minecraft.world.chunk.IChunkProvider;

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

import net.minecraftforge.fml.common.IWorldGenerator;

 

public class RubyGeneration implements IWorldGenerator {

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

switch(world.provider.getDimensionId()){

case 1:

generateEnd(world, random, chunkX, chunkZ);

break;

case 0:

generateOverworld(world, random, chunkX, chunkZ);

break;

case -1:

generateNeather(world, random, chunkX, chunkZ);

break;

}

}

public void generateEnd(World world, Random random, int x, int z){

 

}

 

public void generateOverworld(World world, Random random, int x, int z){

generateOre(MoreOresModBlocks.ruby_ore, world, random, x, z, 2 ,10 , 5, 0, 100, Blocks.stone);

}

 

public void generateNeather(World world, Random random, int x, int z){

 

}

 

public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance , int minY, int maxY, Block generateIn){

int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);

int hightRange = maxY - minY;

WorldGenMinable gen = new WorldGenMinable((IBlockState) block, vienSize);

for(int i = 0; i < chance; i++){

int xRand = chunkX * 16 + random.nextInt(16);

int yRand = random.nextInt(hightRange) + minY;

int zRand = chunkZ * 16 + random.nextInt(16);

gen.generate(world, random,new BlockPos(xRand, yRand, zRand));

}

}

}

Posted

---- Minecraft Crash Report ----

// I feel sad now :(

 

Time: 2/28/15 12:53 PM

Description: Exception ticking world

 

java.lang.ClassCastException: com.moreoresmod.main.block.RubyOre cannot be cast to net.minecraft.block.state.IBlockState

at com.moreoresmod.main.worldgeneration.RubyGeneration.generateOre(RubyGeneration.java:49)

at com.moreoresmod.main.worldgeneration.RubyGeneration.generateOverworld(RubyGeneration.java:39)

at com.moreoresmod.main.worldgeneration.RubyGeneration.generate(RubyGeneration.java:27)

at net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106)

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:270)

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1098)

at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:52)

at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12)

at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344)

at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302)

at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:117)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:92)

at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:189)

at net.minecraft.world.World.getChunkFromChunkCoords(World.java:304)

at net.minecraft.world.World.getChunkFromBlockCoords(World.java:299)

at net.minecraft.world.World.getBlockState(World.java:828)

at net.minecraft.block.BlockStaticLiquid.updateTick(BlockStaticLiquid.java:56)

at net.minecraft.block.Block.randomTick(Block.java:428)

at net.minecraft.world.WorldServer.updateBlocks(WorldServer.java:454)

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

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

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

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

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

at java.lang.Thread.run(Unknown Source)

 

 

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

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

 

-- Head --

Stacktrace:

at com.moreoresmod.main.worldgeneration.RubyGeneration.generateOre(RubyGeneration.java:49)

at com.moreoresmod.main.worldgeneration.RubyGeneration.generateOverworld(RubyGeneration.java:39)

at com.moreoresmod.main.worldgeneration.RubyGeneration.generate(RubyGeneration.java:27)

at net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106)

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:270)

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1098)

at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:52)

at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12)

at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344)

at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302)

at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:117)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:92)

at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:189)

at net.minecraft.world.World.getChunkFromChunkCoords(World.java:304)

at net.minecraft.world.World.getChunkFromBlockCoords(World.java:299)

at net.minecraft.world.World.getBlockState(World.java:828)

at net.minecraft.block.BlockStaticLiquid.updateTick(BlockStaticLiquid.java:56)

at net.minecraft.block.Block.randomTick(Block.java:428)

at net.minecraft.world.WorldServer.updateBlocks(WorldServer.java:454)

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

 

-- Affected level --

Details:

Level name: New World

All players: 1 total; [EntityPlayerMP['Player500'/265, l='New World', x=-280.66, y=21.09, z=-202.91]]

Chunk stats: ServerChunkCache: 1257 Drop: 0

Level seed: 2818109447166518196

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

Level generator options:

Level spawn location: 120.00,64.00,-140.00 - World: (120,64,-140), Chunk: (at 8,4,4 in 7,-9; contains blocks 112,0,-144 to 127,255,-129), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)

Level time: 4843 game time, 4843 day time

Level dimension: 0

Level storage version: 0x04ABD - Anvil

Level weather: Rain time: 171110 (now: false), thunder time: 50653 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true

Stacktrace:

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

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

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

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

at java.lang.Thread.run(Unknown Source)

 

-- System Details --

Details:

Minecraft Version: 1.8

Operating System: Windows 8.1 (amd64) version 6.3

Java Version: 1.8.0_31, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 724045656 bytes (690 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

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

IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94

FML: MCP v9.10 FML v8.0.32.1320 Minecraft Forge 11.14.1.1320 5 mods loaded, 5 mods active

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

FML{8.0.32.1320} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1320.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{11.14.1.1320} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1320.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

MoreOresMod{Pre Alpha 1.1} [MoreOresMod] (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['Player500'/265, l='New World', x=-280.66, y=21.09, z=-202.91]]

Type: Integrated Server (map_client.txt)

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

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
    • sorry, I might be stupid, but how do I open it? because the only options I have are too X out, copy it, which doesn't work and send crash report, which doesn't show it to me, also, sorry for taking so long.
    • Can you reproduce this with version 55.0.21? A whole lot of plant placement issues were just fixed in this PR.
    • Necro'ing that thread to ask if you found a solution ? I'm encountering the same crash on loading the world. I created the world in Creative to test my MP, went into survival to test combat, died, crashed on respawn and since then crash on loading the world. Deactivating Oculus isn't fixing it either, and I don't have Optifine (Twilight forest is incompatible)
  • Topics

×
×
  • Create New...

Important Information

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