Jump to content

Recommended Posts

Posted

Hello everyone! I have just created a configuration file for my mod, and I want to know why the (items) ID listed in this file are so strange. However, the blocks ID are well. I mean that these items ID are very high and don't match with the ID in the game. Have a look:

 

 

# Configuration file

####################
# block
####################

block {
    I:beefpie=3034
    I:chocolatecake=3012
    I:partyblock=3035
    I:pizza=3032
    I:ricecrop=3069
    I:saltblock=3051
    I:saltore=3030
    I:strawberrycrop=3047
    I:tomatocrop=3040
    I:worktop=3052
}


####################
# item
####################

item {
    I:applecakeslice=31743
    I:applejuice=31690
    I:beefpieitem=31692
    I:bowlofcereal=31716
    I:breadandbutterpudding=31735
    I:breadslice=31740
    I:breadwithbutter=31725
    I:breadwithnutella=31727
    I:broth=31723
    I:butter=31738
    I:candyaxe=31686
    I:candyhoe=31685
    I:candypickaxe=31687
    I:candyspade=31683
    I:candysword=31684
    I:caramel=31718
    I:carrotsoup=31729
    I:cereal=31717
    I:cheese=31713
    I:cheesepastam=31709
    I:chips=31731
    I:chipsfried=31730
    I:chocolate=31733
    I:chocolatecakeitem=31694
    I:chocolatedonut=31705
    I:coockedcarrot=31742
    I:crisps=31708
    I:donutbase=31706
    I:fishandchips=31695
    I:flour=31702
    I:friedegg=31707
    I:glass=31691
    I:hamburger=31739
    I:kebab=31696
    I:knife=31698
    I:milkshake=31732
    I:muffin=31724
    I:nutella=31728
    I:omelette=9018
    I:omelettefinal=31726
    I:pasta=31720
    I:pizzaitem=31693
    I:pizzaslice=31714
    I:rawpizza=31712
    I:rice=31688
    I:riceseed=31689
    I:salt=31715
    I:smashedpotato=31734
    I:spaghetti=31721
    I:steakandchips=31722
    I:stew=31741
    I:strawberry=31711
    I:strawberrydonut=31704
    I:strawberryjam=31699
    I:strawberrymilkshake=31710
    I:strawberryseed=31703
    I:sushi=31736
    I:sweet=31719
    I:toast=31737
    I:tomato=31700
    I:tomatoseed=31701
    I:waffle=31697
}


 

 

Thank you :)

 

Posted

Vmy guess is that you've probably forgotten to de-increment them by 256 before sending them to your items. vanilla adds 256 to each of its itemIDs/shiftedIndex thingies when they get registered to avoid conflicts with its blockIDs. It also does the same thing to your items, and as the config is mostly for the mod user forge shows them the IDs in the config how they will see them in game meaning you need to remove 256 from each id as you pass it to your item.

Your IDs are probably higher than you were expecting as forge does some things to try to prevent id conflicts between mods, normally by making them high (note this is only done between config files created in the same launch).

Posted

Vmy guess is that you've probably forgotten to de-increment them by 256 before sending them to your items. vanilla adds 256 to each of its itemIDs/shiftedIndex thingies when they get registered to avoid conflicts with its blockIDs. It also does the same thing to your items, and as the config is mostly for the mod user forge shows them the IDs in the config how they will see them in game meaning you need to remove 256 from each id as you pass it to your item.

Your IDs are probably higher than you were expecting as forge does some things to try to prevent id conflicts between mods, normally by making them high (note this is only done between config files created in the same launch).

Thank you! ;D ;D

How can I de-increment them to make it readable in the config file?

 

The ID's of my mod goes up to "3070"

 

*Excuse me if I don't express properly, my English isn't very good :( (Im trying to become fluent)*

Posted

quite simply when you do

myItem = new MyItemClass(myItemIDFromConfig);

 

change it to

myItem = new MyItemClass(myItemIDFromConfig-256);

 

This should make it so that the IDs in the config file are the same as what it says they are in the world. (assuming you're doing everything else right).

 

P.S. your English is very good don't worry :)

Posted

quite simply when you do

myItem = new MyItemClass(myItemIDFromConfig);

 

change it to

myItem = new MyItemClass(myItemIDFromConfig-256);

 

This should make it so that the IDs in the config file are the same as what it says they are in the world. (assuming you're doing everything else right).

 

P.S. your English is very good don't worry :)

 

And...might cause conflicts with other mods.

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

quite simply when you do

myItem = new MyItemClass(myItemIDFromConfig);

 

change it to

myItem = new MyItemClass(myItemIDFromConfig-256);

 

This should make it so that the IDs in the config file are the same as what it says they are in the world. (assuming you're doing everything else right).

 

P.S. your English is very good don't worry :)

 

And...might cause conflicts with other mods.

Unofficial ID Listing FTW!

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted

quite simply when you do

myItem = new MyItemClass(myItemIDFromConfig);

 

change it to

myItem = new MyItemClass(myItemIDFromConfig-256);

 

This should make it so that the IDs in the config file are the same as what it says they are in the world. (assuming you're doing everything else right).

 

P.S. your English is very good don't worry :)

 

And...might cause conflicts with other mods.

 

NO. This will cause the id shown in config to be the same as it is in game, which is also what forge shuffles the ids based on (i think...) , ergo no conflict if the other author has also taken this into account.

Posted

quite simply when you do

myItem = new MyItemClass(myItemIDFromConfig);

 

change it to

myItem = new MyItemClass(myItemIDFromConfig-256);

 

This should make it so that the IDs in the config file are the same as what it says they are in the world. (assuming you're doing everything else right).

 

P.S. your English is very good don't worry :)

 

And...might cause conflicts with other mods.

 

NO. This will cause the id shown in config to be the same as it is in game, which is also what forge shuffles the ids based on (i think...) , ergo no conflict if the other author has also taken this into account.

 

I've tried with:

applecakeslice = new ItemFood(applecakesliceID-256, 10, false).setUnlocalizedName("applecakeslice").setCreativeTab(this.foodplustab);

but it doesn't work :C. The ID in the config file don't change.

Posted

 

So...so horribly out of date.

 

Thaumcraft 3 isn't even in the same 1000s bracket that that lists it as.  It's over in the 3000-3100 last I peeked.

 

NO. This will cause the id shown in config to be the same as it is in game, which is also what forge shuffles the ids based on (i think...) , ergo no conflict if the other author has also taken this into account.

 

Except that other mods might not do that, leading to players going "WTF!!!  ITS CRASHING BUT THE IDS ARE DIFFERENT!  *RAGE*"

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've tried with:

applecakeslice = new ItemFood(applecakesliceID-256, 10, false).setUnlocalizedName("applecakeslice").setCreativeTab(this.foodplustab);

but it doesn't work :C. The ID in the config file don't change.

 

the config won't change by itself. My code doesn't change the ID's passed to the config, only the ones read form it. If you want it to change then delete the cofig file and have it regenerated, but what i said won't change anything in the config file, only make it the same in the game.

 

 

NO. This will cause the id shown in config to be the same as it is in game, which is also what forge shuffles the ids based on (i think...) , ergo no conflict if the other author has also taken this into account.

 

Except that other mods might not do that, leading to players going "WTF!!!  ITS CRASHING BUT THE IDS ARE DIFFERENT!  *RAGE*"

 

yes, but that's the fault of the modder for not taking it into account. Normally forge puts quite a gap between the IDs anyway, so unless a modder has been extremely unconservative with their IDs then there shouldn't be many problems

 

 

although yes possible rage

Posted
yes, but that's the fault of the modder for not taking it into account. Normally forge puts quite a gap between the IDs anyway, so unless a modder has been extremely unconservative with their IDs then there shouldn't be many problems

 

Or you could leave it well enough alone.

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

buut then they don't match and OCD rage  :(

 

And everyone but you knows they don't match and why and have never had a problem with it.

 

So bug Overmind to update it (or else hand it off to someone else). Besides, it's better than nothing.

 

I did, actually.

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

Hello! I don't want to cause conflicts with other mods D: . Sincerely, I don't care the ID's of the blocks/items, I just want to see the same ID in the code and config file. For example, I don't want to see in my code "3050" and in the config file "31701". Thank you all for helping me :).

 

 

*I'm sorry if I didn't express myself very well*

Posted

Hello! I don't want to cause conflicts with other mods D: . Sincerely, I don't care the ID's of the blocks/items, I just want to see the same ID in the code and config file. For example, I don't want to see in my code "3050" and in the config file "31701". Thank you all for helping me :).

 

 

*I'm sorry if I didn't express myself very well*

If you're doing it right, the ID in the code is just the default. If you delete your config file, it should re-generate with the default IDs in your code.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted

Hello ;D! It doesn't work: When I delete my config file, it regenerates with the same ID as before.

 

Example:

I write in my code the ID for an apple cake slice: "3000" (default)

In the configuration file, it look like this: "31743" (WTF? :o)

 

When I delete the configuration file, it regenerates with the same ID.

Is there any way to make it look like it is written in the code?

 

Example:

I write in my code the ID for an apple cake slice: "3000" (default)

In the configuration file, it look like this: "3000" (:D)

 

(I'm new in create configuration files, so I can get confuse easily) Thank you! ;)

If I'm wrong, please explain to me what I'm doing wrong (please :-[)

Posted

That... is odd. Could you post your main mod source file please?

Hello! Here is my main class:

 

Main class: http://pastebin.com/gXAXyZn5

 

*If you know any way to optimize the code, tell me, I appreciate it ;). (Thank you)

 

A question:  I have reached the conclusion that the ID I put in the code are only "for guidance", so that those that really influence the game are those that are in the configuration file. Am I wrong? (Maybe I'm wrong)

Posted

Hello ;D! It doesn't work: When I delete my config file, it regenerates with the same ID as before.

 

Example:

I write in my code the ID for an apple cake slice: "3000" (default)

In the configuration file, it look like this: "31743" (WTF? :o)

 

When I delete the configuration file, it regenerates with the same ID.

Is there any way to make it look like it is written in the code?

 

Example:

I write in my code the ID for an apple cake slice: "3000" (default)

In the configuration file, it look like this: "3000" (:D)

 

(I'm new in create configuration files, so I can get confuse easily) Thank you! ;)

If I'm wrong, please explain to me what I'm doing wrong (please :-[)

 

I said about this already! the config file will change your IDs to avoid conflicts between things. Therefore the reason it is giving you different numbers is because you ether have an ID conflict somewhere between your item and vanilla OR some other reason it would decide to shift them (maybe moving away from some hard-coded values which it thinks are too low and may be used too frequently, not sure)  If you really want to sort it try increasing your coded values by some value (say 1000) and try again.

Posted

Hello! Here is my main class:

 

Main class: http://pastebin.com/gXAXyZn5

 

*If you know any way to optimize the code, tell me, I appreciate it ;). (Thank you)

 

Dang that's a lot of values!

 

Here's how I do it:

Main File

Config class

Adding Blocks

Base Block Class (all my blocks extend this)

Adding Items

Base Item Class (all my items extend this)

 

 

this frees up a lot of space (both in terms of your coding and the memory it occupies as each variable takes space) and is a lot easier to work with as you don't have to make sure you've use the correct variable name ext...

 

 

[EDIT]

The important bit in my code is the Config.getItem or Config.getBlock methods getting called in the constructor of the item/block. You must however make sure that the blocks are added in the @PreInit method AFTER the config file is loaded and BEFORE it is saved (also make sure it is sent to the config class).

Posted

OMG! Your code is art for my eyes! I love the way you wrote it. It's basically wonderful :o. Could you please let me to use your organization method? It will improve and simplify my work!  (I will give you the proper credits, of course :))

Posted

That's fine. It's all open source anyway, so you can find it all on my github if you need it.

 

 

I will say however that before blindly copying code, make sure you understand it and the programming concepts involved in how it was written.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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