IDs conversion : a quest for an "how to" or a "why not"

This forum is for anything that doesn't specifically have to do with Better Than Wolves
User avatar
Catox
Posts: 237
Joined: Fri Jan 06, 2012 9:54 am

IDs conversion : a quest for an "how to" or a "why not"

Post by Catox »

FlowerChild wrote:
Catox wrote:Is it such a problem to scan blocs and items of a world ? (or should I say "of a chunk")
No, I'm just placing all these restrictions on myself for shits and giggles.

Let's drop this here shall we? We can discuss it elsewhere if there's anything useful left to be said.
Well, I just didn't see how to completely express my interest in the matter without taking the risk of looking like some sort of arrogant know-it-all-that-knows-nothing.

So, well, if all I can get is sarcasm either way, I guess I'll develop here.


In my understanding, converting a world blocs and items should look something like that :

Code: Select all

for each chunk do
  for each block in chunk do
    convert id
    if container do for each item in container do convert id
  for each item in chunk do convert id
  for each item in inventory do convert id
The data is there, obviously, so the problem should come from the way you access it.
From the outside, I can imagine dealing with mc file format could be bothersome, but I believe it has been decoded by now so I'd say it should be feasible. Personally, I'm not used (at all) to deal with compressed formats, so I guess I could try to have a look at it, but my hopes would be very slim.

From the inside, I now you can load distant chunks since some mods do this with buildcraft for instance. Accessing any xyz bloc's data is then obviously possible. If a player can see what's inside a chest, it would also seem obvious that you can check what's in any chest in the world too. Then there are items floating around the world that can be managed by the game in all sort of ways I may have no idea about. The thing is : the data is there, necessarily. Personally, I don't know anything about java, which makes it impossible for me to comprehend what kind of limitation it could cause in this problem, unless someone explains.

So I guess I can't do much about it right now, but this is exactly the kind of problem I like to look into.
User avatar
thekyz
Posts: 266
Joined: Wed Jul 20, 2011 5:52 am
Location: Rennes, France

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by thekyz »

Seems covered, I don't think a utility doing only that would take to much time. The problem with MCEdit is that it's probably embedded with a lot of other systems (thus why it's that slow).
User avatar
Katalliaan
Posts: 1036
Joined: Tue Aug 09, 2011 6:58 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by Katalliaan »

I personally think it would be better to have a standalone program instead of making it a mod. That way, the resources going to the program wouldn't be used in keeping track of all the entities or rendering, but rather purely for converting IDs.

How would you handle items on the ground or things in containers that aren't blocks (like storage minecarts), though?
Open in case of fire
Spoiler
Show
Not now stupid - in case of fire
User avatar
SterlingRed
Posts: 1466
Joined: Tue Jul 05, 2011 11:02 am

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by SterlingRed »

Orientation would be another issue. Many btw items placed in our worlds have a specific orientation that would have to be maintained.
DaWhiskers
Posts: 66
Joined: Fri Jul 29, 2011 5:39 am

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by DaWhiskers »

With the reference to MCEdit being too slow due to other processing, perhaps using something like the Substrate Library http://www.minecraftforum.net/topic/245 ... nvil-beta/ with a small utility using the functionality there (as for orientation is that handled by meta data?? if so could it not also be converted? )
badmojo98
Posts: 47
Joined: Tue Feb 28, 2012 11:15 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by badmojo98 »

yeh, it should be a stand alone program, and FC shouldn't get involved in any way shape or form, other than to maybe make some flippant off-hand comment that offends you to the point of action, so you actually go and do something useful rather than... oh shit, off topic... sorry, i had a few drinks tonight. i suggest you take this idea to the MCEdit thread on Minecraft Forums, where someone with both a clue and desire to get deep into MCEdit code will take your idea and implement it. it's an open source project now, and as a long time user, i can tell you the new team is doing good things. and it's a good idea to solve this issue, considering it will effect the vast majority of mods far more than it will BTW (at least at the moment)

good luck :)
No one would say that what they were doing was complicated. It wouldn't even be considered new, except for maybe in the geological sense. They took from their surroundings what was needed and made of it something more.
- Primer
User avatar
Zhil
Posts: 4486
Joined: Thu Jul 14, 2011 3:12 pm
Location: Belgium

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by Zhil »

Okay, I see a lot of misinformation here, time to chime in:

- First of all, the entire MC codebase is available, so there was no need to decode anything, we have the source available
- Orientation? Minecraft blocks have no orientation. That's all just a trick with metadata

How should we create this tool? Easy, you take the source code for the map format, make a tool that reads save files and swaps IDs where needed.
Is this a lot of work? Not really, but more than FC would care to invest.
Is it hard? It shouldn't be, but there might be some "gotchas".
Am I going to do it? I don't think so, no.

So yeah, feel free to chime in, but don't take guesses. The source code is available and if you don't know how to read it, trying to guess how stuff works isn't conductive to this tool actually coming into existence.
Come join us at Vioki's Discord! discord.gg/fhMK5kx
User avatar
Catox
Posts: 237
Joined: Fri Jan 06, 2012 9:54 am

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by Catox »

(I had to take your last part first, it makes more sense in the flow of my answer, I believe)
So yeah, feel free to chime in, but don't take guesses. The source code is available and if you don't know how to read it, trying to guess how stuff works isn't conductive to this tool actually coming into existence.
Well, my "guesses" are more like personal illustration of a non guessed fact : data is here and logically accessible.
And while the point of this thread is partially to open discussion between competent persons who could help or do solve the problem, my personal objective was more to try to understand what it was (or what it is) that I was missing.
Gilberreke wrote:Okay, I see a lot of misinformation here, time to chime in:

- First of all, the entire MC codebase is available, so there was no need to decode anything, we have the source available
- Orientation? Minecraft blocks have no orientation. That's all just a trick with metadata

How should we create this tool? Easy, you take the source code for the map format, make a tool that reads save files and swaps IDs where needed.
Is this a lot of work? Not really, but more than FC would care to invest.
Is it hard? It shouldn't be, but there might be some "gotchas".
Am I going to do it? I don't think so, no.
In that case, when I asked if it is "such a problem to scan blocs and items of a world", a simple "not really but I can't bother to take the time to do it" as a reply would have be completely sufficient and understandable.

I've been in a similar situation before. The dev associated to a mc server I was a mod on didn't want to bother with the conversion of some many towny files. Once I understood it was actually simple text files that contained the to be converted coordinates, I asked some of the files, learned python basics, made a script and voilà.

Now if I knew some java basics, should I try and venture in some obscure (as is said to be) mc code in order to hope to find a solution to a problem that FC, a man who fixes bug in minutes, visibly consider too tedious to solve himself if he can avoid it ?

That's why I asked : it's interesting.
And if the real answer is that it's too bothersome, then the question is certainly not dumb.
User avatar
Zhil
Posts: 4486
Joined: Thu Jul 14, 2011 3:12 pm
Location: Belgium

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by Zhil »

I don't quite "get" your reply. I answered by providing the exact steps on how to go about creating this tool and your reply seems rather hostile. Did I do something to upset you?
Come join us at Vioki's Discord! discord.gg/fhMK5kx
User avatar
SterlingRed
Posts: 1466
Joined: Tue Jul 05, 2011 11:02 am

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by SterlingRed »

I understand 'orientation' is in the metadata. I'm not a programmer so I'm not entirely sure how it all works. I just wanted to raise the point that just changing some block Id numbers may not cover it and whoever wanted to look into it should make sure the 'orientation' (metadata trick) is maintained. Thanks for clarifying how that works Gil. I'll maintain 'lurker mode' on this particular topic. Maybe I'll learn someting :-p
User avatar
Catox
Posts: 237
Joined: Fri Jan 06, 2012 9:54 am

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by Catox »

Gilberreke wrote:I don't quite "get" your reply. I answered by providing the exact steps on how to go about creating this tool and your reply seems rather hostile. Did I do something to upset you?
Your intro and last sentence gave me the same feeling actually.
I probably vastly didn't understand the "chime in" in the end... :/
I don't know, the "don't take guesses" made me feel like being lectured.

I wouldn't say I'm upset, though. Sorry if I look tense, as I probably am, but that's not really the topic...
User avatar
Zhil
Posts: 4486
Joined: Thu Jul 14, 2011 3:12 pm
Location: Belgium

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by Zhil »

Catox wrote:I wouldn't say I'm upset, though. Sorry if I look tense, as I probably am, but that's not really the topic...
Ah, k, cool. I wasn't trying to imply that you don't know what you're talking about, I'm trying to avoid people taking elaborate guesses when someone can just look it up in the source. It's like people trying to guess what's in the special sauce when you've got the recipe lying next to you.

I'd do it myself, but I really haven't got the time to work on this.
Come join us at Vioki's Discord! discord.gg/fhMK5kx
User avatar
Catox
Posts: 237
Joined: Fri Jan 06, 2012 9:54 am

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by Catox »

Gilberreke wrote: It's like people trying to guess what's in the special sauce when you've got the recipe lying next to you.
Well I precisely had to do that in an okonomiyaki when I was in Japan : my japanese (and english actually) wasn't good enough to understand all of it. ^__^;
/end of digression/
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by FlowerChild »

One thing to note in all this: I hate working on file handling, so I tend to avoid it. It's one of those points where it stops feeling like game-programming to me, and I start losing interest.

This task may not be particularly hard to pull off, but lacking in motivation to dig into that kind of code, it's just not something I see myself doing.

HOWEVER, from what little thought I've put into it, I think something like this would probably work best with a couple of config files in which you can specify all the input and output values for the IDs that you want to convert and do the whole thing as one big batch job. Mod authors such as myself could also then provide these files for their users if they want to change up all the default ID values they are using (which is something I'll probably want to do at some point), to help simplify the process for the less technically inclined. I think config files would actually be more practical than a GUI for this as it would allow for the rapid entry of values, and the distribution of said files separately from the utility itself for the benefit of mod authors.

If done right, I can see something like this getting a fair amount of usage from the overall MC community for the reasons I've described, so you might even be able to get some decent ad-revenue off of it if you are so inclined.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by FlowerChild »

Also, to make it effective with mods (which would really be the point), you'd need to to be able to work with an arbitrary IInventory interface (not just chests, since you can be dealing with Mill Stones, Hoppers, or similar blocks from other mods), go in there, and swap around the BlockID values within them. Of course, player inventory and items on the ground would also have to be handled.

Metadata isn't an issue, as swapping the ID values shouldn't affect that. I *think* the same would be true for the Tile Entities associated with particular block IDs, but am not absolutely certain about that one.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by FlowerChild »

I just wanted to mention once again, that the optimal solution for this is if Mojang simply start using block IDs above the 256 range once the extended block ID solution has been released. It prevents it from ever becoming an issue.

Despite having given up on doing so, I just decided to fire Jeb one last email about this particular problem just in case he'd be receptive to it. It really involves no extra work on their part and could save a number of headaches for mod authors and users.
User avatar
Sarudak
Site Admin
Posts: 2786
Joined: Thu Nov 24, 2011 7:59 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by Sarudak »

FlowerChild wrote:One thing to note in all this: I hate working on file handling, so I tend to avoid it. It's one of those points where it stops feeling like game-programming to me, and I start losing interest.

This task may not be particularly hard to pull off, but lacking in motivation to dig into that kind of code, it's just not something I see myself doing.

HOWEVER, from what little thought I've put into it, I think something like this would probably work best with a couple of config files in which you can specify all the input and output values for the IDs that you want to convert and do the whole thing as one big batch job. Mod authors such as myself could also then provide these files for their users if they want to change up all the default ID values they are using (which is something I'll probably want to do at some point), to help simplify the process for the less technically inclined. I think config files would actually be more practical than a GUI for this as it would allow for the rapid entry of values, and the distribution of said files separately from the utility itself for the benefit of mod authors.

If done right, I can see something like this getting a fair amount of usage from the overall MC community for the reasons I've described, so you might even be able to get some decent ad-revenue off of it if you are so inclined.
I think I'm going to do this. I don't really care about ad revenue though.
FlowerChild wrote:Also, to make it effective with mods (which would really be the point), you'd need to to be able to work with an arbitrary IInventory interface (not just chests, since you can be dealing with Mill Stones, Hoppers, or similar blocks from other mods), go in there, and swap around the BlockID values within them. Of course, player inventory and items on the ground would also have to be handled.

Metadata isn't an issue, as swapping the ID values shouldn't affect that. I *think* the same would be true for the Tile Entities associated with particular block IDs, but am not absolutely certain about that one.
Arg... Inventories... That's one thing I hadn't thought of.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by FlowerChild »

Sarudak wrote:Arg... Inventories... That's one thing I hadn't thought of.
Hehe...which brings me to FlowerChild's rule of the internet #92 "If someone says something is easy to code, then it probably isn't".
User avatar
Sarudak
Site Admin
Posts: 2786
Joined: Thu Nov 24, 2011 7:59 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by Sarudak »

FlowerChild wrote:
Sarudak wrote:Arg... Inventories... That's one thing I hadn't thought of.
Hehe...which brings me to FlowerChild's rule of the internet #92 "If someone says something is easy to code, then it probably isn't".
Well that's true in most cases even if someone doesn't say it.
ialdbaoloth
Posts: 137
Joined: Sat Nov 12, 2011 2:46 am

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by ialdbaoloth »

Ninja'd x6!
Catox wrote:Is it such a problem to scan blocs and items of a world ? (or should I say "of a chunk")
Replacing placed blocks with a different kind of block is easy. That seems to be a feature of MCEdit,
the first tutorial for the C# library you mentioned, it was the first thing I did when I wrote a map parser
(stone+dirt -> wood, light fire). That's much easier. Both block Ids are still valid so you won't get any
weirdness from unchanged items, and reliability doesn't matter if you're just going to watch the world
burn and then leave, like an exploitative D'ni bastard.

Updating a map to change the ID of a block is harder, you have to find all the places block might hide
- and not change any number that's not really a block ID. There's at least the player inventory,
item inventory, items on the ground, falling sand/gravel, and blocks being moved as pistons.

Listing stuff off the top of my head is much much easier than reading the code and being sure
you've got exactly all the cases.

Once you know the case to handle, the code itself isn't too bad, just walking some trees.
Figuring out what to code is harder, but that's hardly the worst.

The thing is, all this leaves you with something that seems to work.

If it's going to be something required as part of a BTW update,
it has to be absolutely reliable. It also needs to handle BTB - which means
at least figuring out what's up with items or liquids in pipes. It should also work
with any other mods that are still compatible.

I don't know how you do that.
At a minimum, that means trying to do things like abort cleanly if you
see unknown blocks in the maps. Lots of testing. Figuring out how
to test before any mod starts recognizing new block IDs.

The point is, it's not so much writing the code, as being sure other people
can trust the code before you suggest/require that they run it on their worlds.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by FlowerChild »

ialdbaoloth wrote:The point is, it's not so much writing the code, as being sure other people
can trust the code before you suggest/require that they run it on their worlds.
Yup, which is generally why I'd prefer that such a utility need to be run on BTW *last*.

While the mod uses a huge number of ID's relative to others, one advantage BTW has in this regard is that I start at the end of the block ID range, whereas many other mods chose to use default ID's somewhere in a middle. Thus it is much more likely that Mojang IDs would start intersecting with theirs before they do ours.

Is the whole reason why I put the blockID freeze into place starting to make more sense to people now? :)
User avatar
BigShinyToys
Posts: 836
Joined: Fri Jul 08, 2011 9:53 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by BigShinyToys »

I can see it now standing on my sole forges steel base that was ounce cobble looking looking across my gold trees and iron grass.

block convention will be a very cool trick for map makers.
User avatar
sargunv
Site Admin
Posts: 557
Joined: Mon Nov 22, 2010 11:46 am
Location: Seattle, WA, USA

Re: Morvelaira's News Compilation

Post by sargunv »

There's a program than can replace the IDs in the world and in most inventories, but it doesn't work work the player's inventory and for items in dropped form. It hasn't been updated for the new save format yet though.

http://www.minecraftforum.net/topic/252 ... en-source/

Pfaeff is still active, so there's a good chance it will be updated.

EDIT: Moved this post here because I noticed the new topic.
The great randomo
Posts: 596
Joined: Fri Sep 30, 2011 2:25 pm
Location: In the ether...

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by The great randomo »

I'm probably missing something massive here, but why can't the values in the config fils be changed for the same effect?
Chris Martin wrote:The morning is for sleeping.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: IDs conversion : a quest for an "how to" or a "why not"

Post by FlowerChild »

The great randomo wrote:I'm probably missing something massive here, but why can't the values in the config fils be changed for the same effect?
Best not to get involved with a programming discussion if you don't know how the code works man. It makes it very hard for the rest of us to discuss these kinds of technical issues otherwise.
Locked