Jump to content

Java error on starting game by a block


luckie12

Recommended Posts

Hi, so i followed a tutorial on youtube and tried to make a block breaker. But the problem is when i start the game, it crashes with this:

 

Error:

 

[14:20:52] [Client thread/ERROR] [FML]: Caught exception from TestPack (tp)

java.lang.IllegalArgumentException: Block: class fatalitygc.testpack.blocks.BlockBreaker has property: type with invalidly named value: BASIC

at net.minecraft.block.state.BlockStateContainer.validateProperty(BlockStateContainer.java:115) ~[forgeSrc-1.10.2-12.18.3.2221.jar:?]

at net.minecraft.block.state.BlockStateContainer.<init>(BlockStateContainer.java:75) ~[forgeSrc-1.10.2-12.18.3.2221.jar:?]

at net.minecraft.block.state.BlockStateContainer.<init>(BlockStateContainer.java:60) ~[forgeSrc-1.10.2-12.18.3.2221.jar:?]

at fatalitygc.testpack.blocks.BlockBreaker.createBlockState(BlockBreaker.java:36) ~[bin/:?]

at net.minecraft.block.Block.<init>(Block.java:278) ~[forgeSrc-1.10.2-12.18.3.2221.jar:?]

at net.minecraft.block.Block.<init>(Block.java:287) ~[forgeSrc-1.10.2-12.18.3.2221.jar:?]

at fatalitygc.testpack.blocks.BlockBreaker.<init>(BlockBreaker.java:28) ~[bin/:?]

at fatalitygc.testpack.init.ModBlocks.init(ModBlocks.java:25) ~[bin/:?]

at fatalitygc.testpack.TestPack.preInit(TestPack.java:35) ~[bin/:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]

at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:618) ~[forgeSrc-1.10.2-12.18.3.2221.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:243) ~[forgeSrc-1.10.2-12.18.3.2221.jar:?]

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:221) ~[forgeSrc-1.10.2-12.18.3.2221.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]

at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:145) [LoadController.class:?]

at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:624) [Loader.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:259) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

[14:20:52] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ----

// Shall we play a game?

 

 

So i went in my BlockBreaker class and see:

 

	this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, ChipTypes.BASIC));

Which is referring to the error, and the ChipTypes.BASIC refers to my enum handler:

public static enum ChipTypes implements IStringSerializable{
	BASIC("basic", 0),
	ADVANCED("advanced", 1);

	private int ID;
	private String name;

	private ChipTypes(String name, int ID){
		this.ID = ID;
		this.name= name;
	}

	@Override
	public String getName() {
		return this.name();
	}

	public int getID() {
		return ID;
	}

	@Override
	public String toString() {
		return getName();
	}

}

 

What could be wrong? I did everything the same as in the tutorial :/

 

thanks for any help!

Link to comment
Share on other sites

You haven't told the game what states your block has, so you've tried to set a state the blockstatecontainer doesn't know about and is therefor invalid.

 

(You're missing a method that you need to override)

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

That is not the problem.

 

You are correct. I was looking for something that wasn't there, but which didn't need to be either.

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

It's invalid in the case that property value names must be all lowercase.

 

This wasnt the case :D

 

Look at this

return this.name();

What is this.name()?

 

This was :P I changed it too return name; instead of return this.name(); and now it works, thanks. I guess the guy changed it not onscreen at the tutorial :D

Link to comment
Share on other sites

I was right, too.

Animefan just told you what to do. Which shows you that you have literally 0 idea what your code is doing. Which is bad.

Yeah, welcome to the age of tutorials where its like;

 

Type this, do this and look it works

without explanation :-)

 

And some code you look at and be like;

How do they know

 

 

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.