Jump to content

Recommended Posts

Posted (edited)

I've created a block, property, model, blockstate, etc...

but my models won't load because of model problems

Code:

  Reveal hidden contents

Errors:

  Reveal hidden contents

 

Edited by Big_Bad_E
Posted
  On 8/15/2018 at 9:05 PM, Big_Bad_E said:

Caused by: java.lang.UnsupportedOperationException: JsonObject

Expand  

Your JSON file is wrong.

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
  On 8/15/2018 at 9:14 PM, Draco18s said:

Your JSON file is wrong.

Expand  

What am I doing wrong? The model was generated in a model generator.

I forgot to mention it worked with one texture, then I tried moving it to blockstate with the block properties, which had no texture at all, then I moved it back to models and got the crash.

Posted

The error says that a portion of it deserialized as an Object when something else was expected. Probably an array.

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)
  On 8/15/2018 at 9:21 PM, Draco18s said:

The error says that a portion of it deserialized as an Object when something else was expected. Probably an array.

Expand  

I see nothing. my texture looks good, along with the blockstate.

 

Fixed it by swapping the color and the texture, now I just have no textures. I'ma work on that myself I don't think the color is being set.

Edited by Big_Bad_E
Posted

If you're getting an error, then it's wrong.

 

Your code:

    "normal": {
      "model": "crystalweapons:crystalore"
    }

What's expected:

    "normal": [{
      "model": "crystalweapons:crystalore"
    }]

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
  On 8/15/2018 at 9:38 PM, Draco18s said:

If you're getting an error, then it's wrong.

 

Your code:

    "normal": {
      "model": "crystalweapons:crystalore"
    }

What's expected:

    "normal": [{
      "model": "crystalweapons:crystalore"
    }]
Expand  

Fixed it, but I don't get an error for that so, idk what's wrong

Posted

You can't tell the difference between those two pieces of code?

https://json-schema.org/understanding-json-schema/reference/array.html

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)

BLockState code:

@Override
    @MethodsReturnNonnullByDefault
    public BlockStateContainer createBlockState() {
        CrystalColor color = new CrystalColor(CrystalColor.colors[rand.nextInt(5)]);
        BlockStateContainer.Builder container = new BlockStateContainer.Builder(this).add(color);
        return container.build();
    }

    @Override
    public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
        worldIn.setBlockState(pos, createBlockState().getBaseState());
        worldIn.getBlockState(pos).getProperties().forEach((prop, value) -> System.out.println(prop.getName() + ", " + value + ", " + value.toString()));
        System.out.println("test");
    }

Test gets outprinted twice. Also no properties are outprinted of course.

Why does it get outprinted twice and what am I doing wrong with my properties?

I am supposed to use a property map?

 

Also, I don't really need the brackets cause it is just one item.

Edited by Big_Bad_E
Posted
  On 8/15/2018 at 10:36 PM, Big_Bad_E said:

Also, I don't really need the brackets cause it is just one item.

Expand  

An array of 1 is not the same as an object. Yes you do need them.

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
  On 8/17/2018 at 3:28 AM, Big_Bad_E said:

I have no idea what's wrong, help is appreciated (I can't respond rn but I will tomorrow, also no errors)

Expand  

Your property is an IUnlistedProperty you need to use an ExtendedBlockStateContainer.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.