@@ -29,6 +29,10 @@ class BlockTable {
29
29
public function __construct () {
30
30
$ json = json_decode (file_get_contents (BEDROCK_DATA_PATH . "block_id_map.json " ), true );
31
31
foreach ($ json as $ name => $ id ) {
32
+ // pistonArmCollision -> piston_arm_collision
33
+ if (str_contains (strtolower ($ name ), "piston " )) {
34
+ $ name = ltrim (strtolower (preg_replace ('/[A-Z]/ ' , '_\0 ' , $ name )), '_ ' );
35
+ }
32
36
$ this ->idToName [$ id ] = $ name ;
33
37
$ this ->nameToId [$ name ] = $ id ;
34
38
}
@@ -40,7 +44,13 @@ public function __construct() {
40
44
);
41
45
$ nbtReader = new NetworkNbtSerializer ();
42
46
while (!$ legacyStateMapReader ->feof ()){
43
- $ id = $ this ->getId ($ legacyStateMapReader ->getString ());
47
+ $ name = $ legacyStateMapReader ->getString ();
48
+ // pistonArmCollision -> piston_arm_collision
49
+ if (str_contains (strtolower ($ name ), "piston " )) {
50
+ $ name = ltrim (strtolower (preg_replace ('/[A-Z]/ ' , '_\0 ' , $ name )), '_ ' );
51
+ }
52
+
53
+ $ id = $ this ->getId ($ name );
44
54
$ damage = $ legacyStateMapReader ->getLShort ();
45
55
46
56
$ offset = $ legacyStateMapReader ->getOffset ();
0 commit comments