Jump to content

Recommended Posts

Posted

I recently updated my mod from 1.11.2 to 1.12 only to find that, after redoing all registry, all my items except for one (which is baffling) don't have textures. Plus my blocks aren't registering in the game even though the FML log isn't giving me any errors except for one, which is for some reason registered under the minecraft domain DESPITE me distinctly stating the mod id as the domain

 

Posted
  On 7/20/2017 at 5:48 PM, GooberGunter said:

I recently updated my mod from 1.11.2 to 1.12 only to find that, after redoing all registry, all my items except for one (which is baffling) don't have textures. Plus my blocks aren't registering in the game even though the FML log isn't giving me any errors except for one, which is for some reason registered under the minecraft domain DESPITE me distinctly stating the mod id as the domain

Expand  

Code and ModelLoader.setCustomModelResourceLocation needs to be called from ModelRegistryEvent.

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.

Posted
  On 7/20/2017 at 5:51 PM, GooberGunter said:

Thanks, Is this somewhere in the forge doc?

Expand  

I do not believe so but you register your models the same way you did before, it just needs to be in the event.

  • Like 1

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.

Posted

Alright, all the textures for the tools and items work. On another note, the blocks are still not being registered in the game even though i have the handler set up:

  Reveal hidden contents

 

Posted (edited)
new ModelResourceLocation(new ResourceLocation(Reference.MOD_ID, blocklist.get(i).getUnlocalizedName().substring(5)), "inventory")

Should be

new ModelResourceLocation(blocklist.get(i).getRegistryName(), "inventory")


Please do not follow old crappy tutorials.

Edited by MrBendelScrolls
Posted
  On 7/20/2017 at 6:09 PM, GooberGunter said:

Got it, thanks

Expand  

Also are you calling ModelLoader.setCustomModelResourceLocation in the Block Registry event? If so it has its own event ModelRegistryEvent. 

  On 7/20/2017 at 6:03 PM, GooberGunter said:

On another note, the blocks are still not being registered in the game even though i have the handler set up:

Expand  

You are not registering the ItemBlock for them.

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.

Posted (edited)

Also, again... MY COMPLAINS ABOUT THE CODE! Feel free to call me a bad person with all of the synonyms.

This is unnecessary to use fori loop and list.get(i). This code is very hard to read.
Simplier and cleaner is to use foreach.
Example:

for (Block block : blocklist) {
    event.getRegistry().register(block);
}
Edited by MrBendelScrolls
I can't think
  • Like 1
Posted
  On 7/20/2017 at 6:20 PM, MrBendelScrolls said:

Also, again... MY COMPLAINS ABOUT THE CODE! Feel free to call me a bad person with all of the synonyms.

This is unnecessary to use fori loop and list.get(i). This code is very hard to read.
Simplier and cleaner is to use foreach.
Example:

for (Block block : blocklist) {
    event.getRegistry().register(block);
}
Expand  

Not at all, I'm happy to receive any information on how to improve my code and java practices. Thanks for the tip

Posted
  On 7/20/2017 at 6:19 PM, GooberGunter said:

I

What method do I call?

Expand  

I think you will also need a Item Registry event to register the ItemBlocks, but I am not really sure. I haven't started updating to 1.12 just yet.

  • Like 1

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.

Posted

Fun, when I tried the item block registry, I got:

  Reveal hidden contents

 

I can't see what the problem is since the first block I added is not null, unless you can't cast, but it's not telling me that I can't cast a block to ItemBlock

 

ModBlocks:

  Reveal hidden contents

 

Posted
  On 7/20/2017 at 6:50 PM, GooberGunter said:

but it's not telling me that I can't cast a block to ItemBlock

Expand  

That is not true, what it says is 

  On 7/20/2017 at 6:50 PM, GooberGunter said:

java.lang.NullPointerException: Can't use a null-name for the registry, object net.minecraft.item.ItemBlock@3cb8b037.

Expand  

You never set the registry name for the ItemBlock.

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.

Posted
  On 7/20/2017 at 7:07 PM, GooberGunter said:

registry name? OH, right. Now it rings a bell. But how do I do that?

Expand  

new ItemBlock(block).setRegistryName(block.getRegistryName);

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.

Posted (edited)

If you don't mind me asking, I know the code is necessary, but why is it necessary? I don't fully understand what the line does. Also where would I put this line?

Edited by GooberGunter
Posted
  On 7/20/2017 at 7:31 PM, GooberGunter said:

If you don't mind me asking, I know the code is necessary, but why is it necessary? I don't fully understand what the line does.

Expand  

It is necessary because we need some form of id that will not change. Numerical ids will change and are not mod specific, while using a ResourceLocation allows a Block, Item, etc to be traced easily back to its mod, and they are also mod specific because of the modid. So in other words a register name is just an id.

  On 7/20/2017 at 7:31 PM, GooberGunter said:

Also where would I put this line?

Expand  

You make two new ItemBlock instances in your ModBlocks class. Every time you make a new instance of any Item, Block, etc you need to set it's registry name.

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.

Posted
  On 7/20/2017 at 7:46 PM, GooberGunter said:

But I set the registry name when I initialized the block:

		Dblock = new BlockDiamondiliumBlock("Dblock", "Dblock");

 

Expand  

You didn't do it for the ItemBlock though.

  On 7/20/2017 at 6:50 PM, GooberGunter said:

itemblocklist.add(new ItemBlock(Dblock));

Expand  

 

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.

Posted (edited)

Forge isn't reading the domain for the resource location of my blocks

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(new ResourceLocation("neem: " + block.getRegistryName()), "inventory"));

I never really learned this part right

Edited by GooberGunter
Posted
  On 7/20/2017 at 8:00 PM, GooberGunter said:

Forge isn't reading the domain for the resource location of my blocks

Expand  

Don't do new ResourceLocation(String, String)

Block#getRegistryName() returns a ResourceLocation.

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.

Posted (edited)

Then should there be something specific that I set the registry name to? Actually, in each of their block classes, the registry name is a new ResourceLocation(String, String). Is this right?

Apparently that doesn't matter because forge is still looking for the textures in minecraft:

I'm going to check my json files

 

EDIT: Yup, that was the problem. In the json files, the texture location didn't specify my mod id

Edited by GooberGunter
Posted
  On 7/20/2017 at 8:06 PM, GooberGunter said:

Then should there be something specific that I set the registry name to?

Expand  

The registry name should follow these two rules

  1. It should contain the modid as the domainName.
  2. It should be unique.

Though i need to clear something up and it will be easier done through this modding video I made for 1.10.2, which doesn't use the events so ignore that part, but what it does do correctly is how to call the ModelLoader.setCustomModelResourceLocation method. At the bottom you will see how it is called, you may need to pause the video.

  • Like 1

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.