Jump to content

Recommended Posts

Posted

I tried setting Registry name with the name of the item but it keeps on saying to change the item to a resource location and if I do it messes everything up. I read the documentation on RegistryLocation, but it never says how to set it. 

Posted

item.setRegistryName("the name of the item");

 

How is this so difficult?

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
23 minutes ago, UnknownSquash said:

but it can't be a string the parenthesis have to be a Registry Location and thats my problem

 

There are three overloads of IForgeRegistryEntry.Impl#setRegistryName (which is inherited by Item):

  • (String)
  • (ResourceLocation)
  • (String, String)

Even if it did require a ResourceLocation, it's not a very complicated class: it's simply a domain (your mod ID) and a path (the name of your Item).

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
35 minutes ago, Choonster said:

 

There are three overloads of IForgeRegistryEntry.Impl#setRegistryName (which is inherited by Item):

  • (String)
  • (ResourceLocation)
  • (String, String)

Even if it did require a ResourceLocation, it's not a very complicated class: it's simply a domain (your mod ID) and a path (the name of your Item).

Which, coincidentally enough, is what the (string, string) method does.

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)

It's YOUR mod id. :|

@Mod(modid="this_string_here" ... )

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

I have the 1.11 version is that a problem, because that may be one of the reasons that this isn't workin with the info I am getting. I am probably still not doing it right but maybe I need to do different things based on the version I am on. Thanks.

Posted
6 minutes ago, UnknownSquash said:

I have the 1.11 version is that a problem, because that may be one of the reasons that this isn't workin with the info I am getting. I am probably still not doing it right but maybe I need to do different things based on the version I am on. Thanks.

 

1.11.x has these methods and it has the registry events. All of the advice you've received here still applies. 

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 (edited)

Okay, there are a lot of things you'll need to learn. As a beginning modder, trying to create a simple item is a good place to start. But it still requires a number of details to be done right.

 

But I'm also concerned that you look new to Java programming as well. For example, your code is a bit strange as the class has a name that indicates it is for an item, then you have a field for an item which you never create an instance for, but neither seem to deal with a class that extends Item properly, then you have an event-handling method which doesn't subscribe to an event.

 

Here are some of the things you'll need to get working:

1) you need a custom item class that actually extends Item (or a sub-class of Item) so you can specify the behavior, textures and such.

2) you need a registry method like yours but the class it is in needs to subscribe to the event bus, and the method needs to be annotated as a subscriber. I have tutorial information on event handling here: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html

3) In the registry method you need to create an instance (using "new" keyword for your custom item class) and assign it a registry name using the setRegistryName() method.

4) you need a public static final field for the item that is annotated with an @ObjectHolder annotation. This will ensure that the instance you use in your code is the singleton instance you actually registered. (which implies you also understand that item objects are singletons in Minecraft). 

5) In addition to registering the item itself you need to register it's model. This is also done with an event-subscribing method. It also implies that you have your resources set up properly with a JSON file for the model which points to texture image files.

6) You'll probably want your object to show up in a creative tab, so you will need to call the setCreativeTab() method for your item, I recommend doing this in the constructor of your custom item, but can be done elsewhere once the instance is created.

 

You might want to follow some tutorials. I have a fair bit of information at http://jabelarminecraft.blogspot.com/ and there is lots of other good stuff (and some bad stuff) if you google it.

 

You're also welcome to look at example mods like mine https://github.com/jabelar/ExampleMod-1.12 or Choonster's https://github.com/Choonster-Minecraft-Mods/TestMod3.  While it is not good to copy without understanding it, looking at other people's code can give you some ideas of what you might be doing wrong and what areas you need to learn more about.

Edited by jabelar

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
1 hour ago, jabelar said:

textures and such.

You do not need a custom class for textures. Sticks (ingots, nuggets...) are just Items.

 

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

I have not added the texture yet, but I created this improved code. The item "Dentyne....Gum" has the same name as the registry name and I think that it is not registering the name but the item. I don't really know but I am assuming that this makes the RegistryName useless. And do I need to do any of this on another file?

Thanks for all the info.

 

Screen Shot 2018-01-08 at 4.20.51 PM.png

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

    • I want to create block with entity, that will have height of 3 or more(configurable) and I tried to change first VoxelShape by increasing collision box on height I want and for changing block height on visual side i tried to configure BlockModelBuilder:  base.element() .from(0, 0, 0) .to(16f, 48f, 16f) .face(Direction.UP).texture("#top").end() .face(Direction.DOWN).texture("#bottom").end() .face(Direction.NORTH).texture("#side").end() .face(Direction.SOUTH).texture("#side").end() .face(Direction.WEST).texture("#side").end() .face(Direction.EAST).texture("#side").end() .end(); but, getting crash with next error: Position y out of range, must be within [-16, 32]. Found: %d [48.0]; Looks like game wont to block height modified by more than 32. Is there any way to fix that problem?
    • As long as the packets you are sending aren't lost, there's nothing wrong with what you're currently doing. Although, this sounds like something that would benefit from you making your own datapack registry instead of trying to arbitrarily sync static maps. Check out `DataPackRegistryEvent.NewRegistry`.
    • Hey all, I've been working a lot with datapacks lately, and I'm wondering what the most efficient way to get said data from server to client is.  I'm currently using packets, but given that a lot of the data I'm storing involves maps along the lines of Map<ResourceLocation, CustomDataType>, it can easily start to get messy if I need to transmit a lot of that data all at once. Recently I started looking into the ReloadableServerResources class, which is where Minecraft stores its built-ins.  I see you can access it via the server from the server's resources.managers, and it seems like this can be done even from the client to appropriately retrieve data from the server, unless I'm misunderstanding.  However, from what I can tell, this only works via built-in methods such as getRecipeManager() or getLootTables(), etc.  These are all SimpleJsonResourceReloadListeners, just like my datapack entries are, so it seems like it could be possible for me to access my datapack entries similarly?  But I don't see anywhere in ReloadableServerResources that stores loaded modded entries, so either I'm looking in the wrong place or it doesn't seem to be a thing. Are packets really the best way of doing this, or am I missing a method that would let me use ReloadableServerResources or something similar?
    • Hi, everyone! I'm new to minecraft modding stuff and want ask you some questions. 1. I checked forge references and saw there com.mojang and net.minecraft (not net.minecraftforge) and as I understand it's original game packages with all minecraft logic inside including renderers and so on, right? 2. Does it mean that forge has a limited set of instruments which doesn't cover all the aspects of the game? If make my question more specific then does forge provide such instruments that allow me totally change minecraft itself, like base mechanics and etc.? Or I have to use "original game packages" to implement such things? 3. I actively learning basic concepts with forge documentation and tutorials. So in my plans make different inventory system like in diabloids. Is that possible with forge? 4. It is last question related to the second one. So how deeply I can change minecraft with forge? I guess all my questions above because of that I haven't globally understanding what forge is and how it works inside and how it works with minecraft. It would be great if you provide some links or topics about it or explain it by yourself but I guess it's to big to be explained in that post at once. Anyway, thank you all for any help!
    • Im trying add to block a hole in center, just a usual block and in center of it on up side, there is should be a hole. I tried to add it via BlockModelBuilder, but its not working. Problem is that it only can change block size outside. I tried it to do with VoxelShape and its working, but its has been on server side and looks like its just changed collision shape, but for client, there is a texture covering this hole. I tried to use: base.renderType("cutout"); and removed some pixels from texture. I thought its should work, but game optimization makes block inside looks transparent. So, only custom model?
  • Topics

×
×
  • Create New...

Important Information

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