TaylorWilton / Schematic2Structure

Utility to convert schematics to Minecraft's .nbt file format for use with the Structure block
MIT License
17 stars 3 forks source link

Potential bug #3

Open jose-vm opened 7 years ago

jose-vm commented 7 years ago

Is this intentional or is this a mistake? screenshot

TaylorWilton commented 7 years ago

I think it might be that I forgot to update the variable names, but I'm not 100% sure - as you can probably tell it's been a little while since I last worked on this project.

Thanks for bringing it to my attention, i'll have a look now.

TaylorWilton commented 7 years ago

After testing, it looks like I forgot to rename the variables after switching them round. I'm in the process of pushing a fix now.

Thanks again for bringing this to my attention!

jose-vm commented 7 years ago

thanks!

jose-vm commented 7 years ago

err, are you sure it is fixed?

TaylorWilton commented 7 years ago

I used find and replace to switch height and width, and you're probably asking if it's fixed because you would have seen that while the set of variables you pointed out were fixed, another set had swapped around.

I tried changing them back, and now I'm more confused than before.

It looks like what a schematic denotes as width, height and length is different from what a structure denotes as width, height and length.

This is what the structure looks like (and should look like) when the variable names are swapped

short width = (short) ((Tag) schematicMap.get("Height")).getValue();
short height = (short) ((Tag) schematicMap.get("Width")).getValue();
short length = (short) ((Tag) schematicMap.get("Length")).getValue();

2017-04-13_14 43 42

Whereas this is what the structure looks like when the code is 'correct'

short height = (short) ((Tag) schematicMap.get("Height")).getValue();
short width = (short) ((Tag) schematicMap.get("Width")).getValue();
short length = (short) ((Tag) schematicMap.get("Length")).getValue();

2017-04-13_14 45 00

When I wrote the code, I obviously spent a while swapping variables around trying to get the correct result, and didn't document it very well. This also could have been helped by using more detailed variable names.

TaylorWilton commented 7 years ago

As a fix, I'm planning to come up with better variable names, and document the behaviour better. However, for now it seems to work.