Jump to content

Recommended Posts

Posted (edited)

I am getting an error when I try to make a block one which can have rotating sides.

 

This is the error:

 

java.lang.IllegalArgumentException: Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockStateContainer{block=null, properties=[type]}
	at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:204)
	at com.mart.solar.common.blocks.BlockMenhir.getMetaFromState(BlockMenhir.java:139)
	at net.minecraft.block.Block.setHarvestLevel(Block.java:2267)
	at net.minecraft.block.Block.setHarvestLevel(Block.java:2249)
	at com.mart.solar.common.blocks.BlockMenhir.<init>(BlockMenhir.java:44)
	at com.mart.solar.common.registry.ModBlocks.registerBlocks(ModBlocks.java:63)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_15_ModBlocks_registerBlocks_Register.invoke(.dynamic)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
	at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143)
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179)
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:736)
	at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:603)
	at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:270)
	at net.minecraft.client.Minecraft.init(Minecraft.java:513)
	at net.minecraft.client.Minecraft.run(Minecraft.java:421)
	at net.minecraft.client.main.Main.main(Main.java:118)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:26)

 

This is the class:

https://pastebin.com/L7aVvS3U

 

And this is my BlockEnum

https://pastebin.com/2MZpsqwz

 

If there is more info needed. My project:

https://github.com/Martacus/Solar

 

I hope someone can help me. I know what lines errors. I just cant figure out how I can give the blockstates the properties it needs before that happens.

Edited by MinecraftMart
Line which wasnt supposed to be in
Posted (edited)

Well you're trying to get/set a FACING property, but your block does not declare a FACING property in its BlockStateContainer (this is what the error is saying, at least...along with the block being null, what the hell?).

 

Looking over your code...

Your BlockEnum class declares how to handle the creation of the BlockStateContainer for the enum via the realStateContainer field, but your BlockMenhir class gives no fucks about this field and declares its own BlockStateContainer as only having a FACING property.

 

You've done something terrifyingly wrong, and I can't quite figure out what.

Edited by Draco18s

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.

Posted (edited)

I think i kind of figured it out. It was always creating a BlockStateContainer without the Facing property. I overrid  the method 

createStateContainer

and added both Properties. Right now it seems to ask me for an updated json with all the faces so it might have worked.

Edited by MinecraftMart

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.