[MCPE-13752] [Internal MCPE] Block registering class is messed up Created: 23/Feb/16  Updated: 31/Aug/16  Resolved: 26/Feb/16

Status: Resolved
Project: Minecraft (Bedrock codebase)
Component/s: None
Affects Version/s: 0.14.0
Fix Version/s: None

Type: Bug
Reporter: inxomnyaa
Resolution: Won't Fix Votes: 0
Labels: None

Confirmation Status: Unconfirmed
Platform: Tablet - Android - Samsung Galaxy Note

 Description   

Oh man Mojang..

Whats wrong with your register Block class?

Its really messed up and unsorted.

In the beginnings, they are listed from highest id to lowest id.

(you have to read from bottom to top)

Sand
StillLava
FlowingLava
StillWater
FlowingWater
Bedrock
Sapling
WoodPlanks
Cobblestone
Dirt
Grass
Stone
Air

But then, especially after id 127 (Lit redstone lamp) the class really messed up.

EmeraldOre // thats 129.. wheres EmeraldBlock, the 130?
Cocoa // Where is activator rail?
LitRedStoneLamp

NetherBrickStairs
NetherBrick // okay.. its next to nether brick stair.. but..
StoneBrickStairs
DarkOakStairs
AcaciaStairs
WoodButton // WHY IN HOLY SKY BIOME IS THIS HERE?!
JungleStairs
BirchStairs
SpruceStairs

How it actually should be looking like:

REDSTONE_LAMP = 123
LIT_REDSTONE_LAMP = 124
ACTIVATOR_RAIL = 126
COCOA = 127
SANDSTONE_STAIRS = 128
EMERALD_ORE = 129
ENDERCHEST = 130 //?
TRIPWIRE_HOOK = 131
TRIPWIRE = 132
EMERALD_BLOCK = 133
SPRUCE_WOOD_STAIRS = 134
BIRCH_WOOD_STAIRS = 135
JUNGLE_WOOD_STAIRS = 136

I know, this no actual "bug".. but thats bad practice i think. A cleanup will maybe help you in future development, due to MCPE being a GREAT project.

I am glad if i was able to help you a bit. Thanks ^^



 Comments   
Comment by [Mojang] MissMarzenia (Aleksandra Zajac) [ 31/Aug/16 ]

I meant the other Daniel, but sure.

Comment by inxomnyaa [ 31/Aug/16 ]

@Daniel Wustenhoff it would only be the internal order, not changing ID's

@MissMarzenia Welcome

Comment by [Mojang] MissMarzenia (Aleksandra Zajac) [ 26/Feb/16 ]

Thank you Daniel for taking your time to explain that in detail

Comment by Daniel Wustenhoff [ 26/Feb/16 ]

Changing ID's will change world saves, therefor we would have to convert them.
Currently we try to get the IDs to be similar to PC, without breaking anything that doesn't need breaking.
Its important to me at least that you can search the interwebs for your block id's (even-tho on PC you can use names) and use them as if there was only one minecraft.
it seems PC however ran out of ID's halfway through, and started filling up the unused ID's.

The unsorted isn't intended, but the overhead is also rather minor for us, we could win way more performance in other places, which is why we tackle those first

Comment by inxomnyaa [ 23/Feb/16 ]

Intended mess?
"I know, this no actual "bug".. but thats bad practice i think. A cleanup will maybe help you in future development, due to MCPE being a GREAT project."

^^ Its code style, you know
Clean code is always better for the future. It works without being cleaned up, and yea, if you need an id, you can search and replace, to get the id.
And also.. for example you would create an array, that has this kind of style:
Array(
id -> block name
id2 -> block name 2
)

Sorted arrays are faster in code processing. For example in array search functions, in array pop (remove last), etc

"Maybe, it's Intended".. well.. I can't see any reason not to sort it, but the change is just for better internal handling.

Comment by Luis Robles [ 23/Feb/16 ]

Do you think this is a bug? Maybe, it's Intended

Generated at Sat Jan 11 15:01:05 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.