Jump to content

Recommended Posts

Posted

I have read past forum posts addressing this, but I still can't seem to figure it out. I have a block that should create a variant for each EnumDyeColor. (So, 16 altogether.) I have already gotten this same block to work using a "facing" property so that it faces the player when placed, but I can't seem to get the "color" property to work. It generates 16 items without textures in the inventory and without textures when placed. I am pretty sure it's a JSON thing, because of the error which I will post below. Thanks.

  Reveal hidden contents

The console also says "suppressed 59 additional model loading errors."

Here is my JSON file.

  Reveal hidden contents

And just to clarify, the block model is loading a "test_block" in, just not generating the blockstate variants for the other 16 colors.

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

Posted (edited)

You can't have that many states.  IBlockState is still baked by a 1 nibble (half byte) metadata that can hold only 16 values. 

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

You can have UnlistedProperties, or create a new block for every color. I recommend the 2nd one

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)
  On 12/14/2018 at 1:47 AM, Cadiboo said:

You can have UnlistedProperties, or create a new block for every color. I recommend the 2nd one

Expand  

 

Unlisted properties aren't used to determine which model to render for a block, they're used by custom block models to determine how they should render. The correct solution here (while keeping a single block) would be to store the extra data in a TileEntity and use regular properties that have their values set in Block#getActualState. Though Mojang is moving away from having a single block for all colours with The Flattening in 1.13, so it may be best to split the colours into separate blocks now (as Cadiboo suggested).

 

I have an example of a block with a colour and a facing here: Block, TileEntity, blockstates file

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Write to NBT - write your data to a NBTTagCompound for serialisation (saving)

Read from NBT - read your data from a NBTTagCompound for deserialisation (loading)

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
  On 12/14/2018 at 8:24 AM, Choonster said:

I have an example of a block with a colour and a facing here

Expand  

Huh, I looked through that, and my JSON file is formatted the same way, but it gives me an Exception loading model for variant error. I made sure to register the tileentity, but maybe I'm missing something else with the actual model?

Posted

Show your new code? Preferably as a GitHub repository 

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Yeah, I've been getting a repository set up. For now, I'll just post the code directly.

  Reveal hidden contents
  Reveal hidden contents

These are the two java classes for the Block itself, and then the TileEntity.

Posted

Still stuck on this, I thought I figured out but the proper textures for each blockstate were not rendering properly. Just seeing if anyone has any ideas. Thanks.

Posted

I've been having issues with the repo right now. I duplicated some files accidentally, and some of the old files are still in it. Here is the blockstate and model file. The java classes are the ones posted above. Thanks.

  Reveal hidden contents
  Reveal hidden contents

 

Posted
  On 12/15/2018 at 11:45 PM, Siqhter said:

@Override public IBlockState getActualState(final IBlockState state, final IBlockAccess worldIn, final BlockPos pos) { return state.withProperty(FACING, getFacing(worldIn, pos)); }

Expand  

You are not including the color in your state here.

 

  On 12/15/2018 at 9:13 PM, Siqhter said:

However, using the getSubBlocks method, the textures for all other 15 blocks are not registering.

Expand  

What is your issue? Are item textures not there? Or those of blocks? If it's blocks then see above, otherwise you need to show how you are registering models for your itemblocks.

Posted
  On 12/19/2018 at 6:11 PM, Siqhter said:

Ok, so would I return COLOR and  FACING?

Expand  

Yes.

  On 12/19/2018 at 6:11 PM, Siqhter said:

Because right now it gives an error if I pass in COLOR.

Expand  

What is the mysterious "it"? The compiler? The IDE? The game? If it's the first two then you should be able to fix it, since it's just a compile error and those are easily fixable with some java knowledge. If it's the latter then post the error log.

Posted

Sorry, I meant the IDE, as in the red underline. It still compiles. The only error I get is "withProperty()" in IBlockState cannot be applied  to: IProperty<T> COLOR (EnumDyeColor)".

Posted

Well, this is what it says it expects in the error: block.properties.IProperty<T>.  But I don't think I really understand what it actually wants, other than COLOR, or rather what I'd pass in.

Posted

I assume just the method?

  Reveal hidden contents

 

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.