Jump to content

Recommended Posts

Posted

Hello all,

 

I'm currently trying to add my very first block, with a basic 16x16 texture, the same on all sides.

However, despite the fact that both a furnace.json and a furnace.png files exist, I continue to get the following error message

  Reveal hidden contents

 

The json file is

  Reveal hidden contents

and the png is attached

 

My Eclipse project configuration is attached. What am I doing wrong? Is more information required?

 

(Unfortunately, I have zero idea about how github works, so my project can't be found there)

Eclipse.png

furnace.png

Posted
  On 2/14/2019 at 11:47 AM, T-Dark said:

Caused by: java.io.FileNotFoundException: testmod:models/item/furnace.json

Expand  

You told the game to look for a model:

  On 2/14/2019 at 11:47 AM, T-Dark said:

    "model": "testmod:furnace"

Expand  

It doesn't exist. 

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)

Could you elaborate on that a little bit more? Should I have spelled the json as "models"? Do I need to add some other file containing model information?

 

I'm not telling the game anything about looking for a model: I just registered the block and the ItemBlock. Do I need to do something else that I'm missing?

Edited by T-Dark
Fixed typos
Posted (edited)

Blocks are comprised of 3 things:

 

1) A blockstate file that tells the game how to translate a block state (the metadata equivalence) into a model

2) A model file that tells the game what shape the block has (stairs are not cubes!) and what texture is on each face.

3) One or more texture files.

 

If you want your block to be a full cube (like dirt or stone) then you probably want to use "model": "cube_all" instead. Additionally you will need to specify textures, "textures": { "all" : "<your texture>" }

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

So the json should look like this?

 

  Reveal hidden contents

 

Because it still gives an error message

Caused by: java.io.FileNotFoundException: testmod:blockstates/furnace.json

As if it couldn't find the json file itself.

 

 

Actually, here's the whole stacktrace, in case it's useful

  Reveal hidden contents

 

 

Posted

Here are some examples of block json files:

 

Block Json File| Folder :  testmod/models/block (NAMED furnace.json)

  Reveal hidden contents

 

Item Json File| Folder : testmod/models/item(NAMED furnace.json)

  Reveal hidden contents

 

Blockstate Json File| Folder testmod/blockstates(NAMED furnace.json)

  Reveal hidden contents

 

Posted

Should I replace the entire json with just that? Because that still doesn't work

 

  Reveal hidden contents

 

Posted

Yup, replacing everything does not solve the problem.

 

The full paths are "src/main/resources/asset/testmod/blockstates/furnace.json" and "src/main/resources/asset/testmod/models/item/furnace.json" (or .../models/block/furnace.json)

 

Error message as follows

  Reveal hidden contents

 

It looks like it can't even find the files, regardless of actual content. In fact, I tried removing the whole asset package (and subpackages). Nothing changed in the error message.

Posted
  Quote

In fact, I tried removing the whole asset package (and subpackages). Nothing changed in the error message.

Expand  

Yes. You are missing a model file.

nov4e had given you a good example model json. You might want to use them for now.

 

You need to have a furnace.json in your testmod/models/block/.

You need to have a furnace.json in your testmod/blockstates/.

You need to have a furnace texture in your testmod/textures/blocks/.

 

The error is saying that Minecraft cannot find your furnace.json in your testmod/models/block/.

Some tips:

  Reveal hidden contents

 

Posted
  On 2/14/2019 at 11:57 PM, DavidM said:

The error is saying that Minecraft cannot find your furnace.json in your testmod/models/block/.

Expand  

Yeah, but, as far as I can see, I do have it there.

 

1218837828_Eclipse2.thumb.png.a512ab50fc840e5ddc3b6aa942aa161e.png

 

I'm using nov4e's jsons, unedited. The texture is a 16x16 pixels png made in paint.net. The error is the same. it can't find testmod:models/item/furnace.json and testmod:blockstates/furnace.json (in this order) even though they clearly exists.

Posted (edited)
  On 2/15/2019 at 9:58 AM, T-Dark said:

it can't find testmod:models/item/furnace.json and testmod:blockstates/furnace.json (in this order) even though they clearly exists.

Expand  

No they don't. Check your spelling. You named your assets folder "asset".

 

Minecraft is looking for assets/testmod/*, which does not exist in your mod directory due to the misspelling of the "assets" folder.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted
  On 2/15/2019 at 10:29 AM, DavidM said:

Minecraft is looking for assets/testmod/*, which does not exist in your mod directory due to the misspelling of the "assets" folder.

Expand  

Oh! Thanks! Unfortunately, renaming the package does not fix the problem.

 

testmod:models/item/furnace.json and testmod:blockstates/furnace.json are still not found.

 

Sorry to take your time for what probably is a mispell on my part.1647903970_Eclipse3.thumb.png.b6a5987ad03b5e690bba0d2987b6e0ec.png

Posted

Hmm... try right-clicking on your project folder and click "Refresh", then launch the game again.

 

Might not be the problem but worth a try.

Some tips:

  Reveal hidden contents

 

Posted
  On 2/15/2019 at 11:16 AM, DavidM said:

Hmm... try right-clicking on your project folder and click "Refresh", then launch the game again.

 

Might not be the problem but worth a try.

Expand  

Nope, the refresh did nothing to the game. it also messed up the folder structure1297343674_Eclipse4.thumb.png.82b353dfbc147cc4a15af17cc3188a96.png

 

Since we are talking about eclipse, is it in any way helpful if I say that sometimes eclipse shows a nullPointerException error message when I close a tab?

Posted

According to your last screenshot, you are in the "bin" folder. You need to go back to your "src" folder.

 

Apart from that, I can't figure out what went wrong. Check all your spellings and your ModelRegistry.

Some tips:

  Reveal hidden contents

 

Posted

My spellings seem to be ok. That being said, what is the ModelRegistry? Is it the GameRegistry.ObjectHolder annotation? What should I be checking exactly?

 

Here is the annotation

  Reveal hidden contents

And here is the block class

  Reveal hidden contents

 

 

Finally, does it help to know that I wrote this by following McJty's video tutorials?

Posted (edited)
  On 2/15/2019 at 1:10 PM, T-Dark said:

".f

Expand  

There's a dot there.

That's wrong.

If you're trying to do "modid:block" you failed, because that's a colon.

This is why I don't suggest that people construct their registry names themselves, but let the game do it.

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

Thank you very much. The question now is: What do I need to do to let the game construct it's own registry name?

Sorry for the stupid question, but I literally know nothing about Forge, and I'm having a hard time understanding the docs.

Posted

Option A: dont pass your mod id

Option B: use the version that takes 2 strings

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

Ok, I'm now using the version that takes 2 strings. Still no success. The Item json and the blockstate json are not found, and I'm getting a net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException.

 

ModBlocks class:

  Reveal hidden contents

BlockFurnace class

  Reveal hidden contents

CommonProxy class

  Reveal hidden contents

 

 

This is all I can find that has anything to do with the block. Still no success.

Posted

Thank you very much, I'll try to understand the setCustomModelResourceLocation thing later. Sorry, I still have no idea what a ModelResourceLocation actually is, but I guess I'll figure that out.

 

That aside (for now), what about the missing blockstate json (which, as far as I can see, is not missing, so I've no idea what is going wrong) and the ModelBlockDefinition$MissingVariantException? What could be causing them? As far as I understand, block models should get automatically registered along with the block itself, via the default IStateMapper. What am I missing?

 

Posted (edited)
  On 2/16/2019 at 9:27 AM, T-Dark said:

Sorry, I still have no idea what a ModelResourceLocation actually is, but I guess I'll figure that out.

Expand  

A ResourceLocation is a location for a resource (i.e. a model.json, a texture, etc). It's a convenient way for you as a modder to say "go look here" without having to understand where "here" actually is (because resource packs will override the default assets you ship and you shouldn't know or even care that this has been done!)

 

A ModelResourceLocation is specifically a ResourceLocation that points to a model file. As far as you're concerned, its just a resource location that points to a file in a slightly different place (you still need to supply the target file and that file will be in a subfolder named "model" or "models,"1 but otherwise it doesn't change how you use it in the code.

 

The two pieces of information a resource location needs in order to find an asset are two things:

1. Domain

2. File name

 

The domain is the same as your mod ID. This tells the game "don't look in the vanilla assets folder, look in the a folder named <modid>. You can specify domains that aren't your mod ID, as well. For example, if you want to create an item that looks like an apple, you can specify the domain "minecraft" and you can use vanilla texture files even if a custom resource pack has been installed that only alters vanilla textures.

 

The file name is essentially which asset to load. e.g. "apple". Typically you'll name your asset files for the block or item that they are for, but you don't have to (it just makes everyone's life easier). This file then must exist in the domain that was specified, if it doesn't, you'll get a MissingVariantException of one form or another.

 

And I say "one form or another" because it's an error caused by another error. If the game goes to load the asset you told it to and it isn't there, the FileNotFoundException will be thrown. But because the game is trying to build models, the model fails to get built, and that throws another error. If you told the game that your block has several states and then don't list one of them in your blockstate.json file, well, that's a MissingVariantException. If you included it in the blockstate file, but pointed to a model that fails to load because it existed, but had an error in it, that's a MissingVariantException Caused By MalformedJSONException.

 

And so on.

 

Any time you see "MissingVariantException" and a stack trace, keep scrolling down to the next error, it'll almost always start with "Caused By" and another error type. That error is the one you need to fix.

 

For example, lets take the log in your original post:

  Reveal hidden contents

 

Capture.PNG.2c8082a5ba06171ee6f317abe309110f.PNG

 

The three highlighted sections tell us everything: 1) the problem item or block, 2) the underlying error and 3) what file the game was trying to read.

 

These will vary slightly depending on exactly what error is the one that needs to get fixed, but this is what to look for.

 

1. I believe that it was originally "models" and that Mojang removed all the lingering s's, so this will vary slightly by MC version.

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.

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

    • Managed to solve the issue myself. Solved by a fresh modpack instance.
    • Hello, so straight to the problem. Today i wanted to startup Enigmatica as usual and it just wont startup. Last night everything worked fine, i didnt even turn off my pc. Crash log: https://mclo.gs/GJ6Kcy1
    • Rubidium and Embeddium are versions of the same mod, you can only have one. I believe Embeddium is the one that's actively maintained.
    • Hello, New to modding, but have a solid CS foundation. I've created multiple custom BlockEntities that all have the same issue, which is that the inventory only updates on right click (overriding the useItemOn method). I've seen multiple posts on here outlining a similar issue to mine, but I've already implemented the solution of: overriding the correct methods in the BlockEntity class and calling setChanged(). I've tried every different place for setChanged() to no success. I'm wondering if I'm missing something else or if there was some change to sending data to the client in 1.21.5? Or will I have to use a custom packet sender? Here is the code for one of my BlockEntity classes with a single inventory slot: public class MyCustomBlockEntity extends BlockEntity { public final ItemStackHandler inventory = new ItemStackHandler(1) { @Override protected int getStackLimit(int slot, @NotNull ItemStack stack) { return 1; } @Override protected void onContentsChanged(int slot) { setChanged(); if (!level.isClientSide()) { level.setBlockAndUpdate(getBlockPos(), getBlockState()); } } }; public MyCustomBlockEntity(BlockPos pPos, BlockState pBlockState) { super(ModBlockEntities.MY_CUSTOM_BE.get(), pPos, pBlockState); } public void clearContents() { inventory.setStackInSlot(0, ItemStack.EMPTY); } public void dropItem() { SimpleContainer inv = new SimpleContainer(inventory.getSlots()); inv.setItem(0, inventory.getStackInSlot(0)); Containers.dropContents(this.level, this.worldPosition, inv); } @Override public void setRemoved() { dropItem(); super.setRemoved(); } @Override protected void saveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { super.saveAdditional(pTag, pRegistries); pTag.put("inventory", inventory.serializeNBT(pRegistries)); } @Override protected void loadAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { super.loadAdditional(pTag, pRegistries); inventory.deserializeNBT(pRegistries, pTag.getCompound("inventory").get()); } @Override public Packet<ClientGamePacketListener> getUpdatePacket() { return ClientboundBlockEntityDataPacket.create(this); } @Override public CompoundTag getUpdateTag(HolderLookup.Provider pRegistries) { return saveWithoutMetadata(pRegistries); } } Mostly encountering the issue when calling the clearContents() method anywhere outside of useItemOn() in the Block class. I've also tried overriding both the handleUpdateTag() and onDataPacket() methods, calling their super along with loadAdditional(), but neither changed the outcome. Thanks in advance for any replies.
    • Hi all! I’m working on a Jurassic Park-themed mod for Minecraft 1.20.1, aiming to include dinosaurs, fossils, DNA extraction, and cool machines. This is a free project, mainly passion-driven, and I’ll give full credit to everyone involved. this is the perfect opportunity for beginners of modeling and coding. This project will give you experience and a creative freedom If you love dinosaurs and Minecraft modding, hit me up! Thanks! Add Me ogfrost. <--- Discord
  • Topics

×
×
  • Create New...

Important Information

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