File tree Expand file tree Collapse file tree 4 files changed +28
-13
lines changed Expand file tree Collapse file tree 4 files changed +28
-13
lines changed Original file line number Diff line number Diff line change @@ -110,9 +110,7 @@ public CompoundTag getSpawnCompound() {
110
110
if (!item .isNull ()) {
111
111
CompoundTag itemTag = NBTIO .putItemHelper (item );
112
112
int networkFullId = item .getNetworkFullId ();
113
- int networkDamage = RuntimeItems .hasData (networkFullId )? RuntimeItems .getData (networkFullId )
114
- : item .hasMeta () && ! (item instanceof ItemDurable ) ? item .getDamage ()
115
- : 0 ;
113
+ int networkDamage = (networkFullId & 0x1 ) == 0x1 ? 0 : item .getDamage ();
116
114
String namespacedId = RuntimeItems .getRuntimeMapping ().getNamespacedIdByNetworkId (
117
115
RuntimeItems .getNetworkId (networkFullId )
118
116
);
Original file line number Diff line number Diff line change 1
1
package cn .nukkit .item ;
2
2
3
3
import cn .nukkit .Server ;
4
+ import cn .nukkit .api .PowerNukkitOnly ;
4
5
import cn .nukkit .api .Since ;
5
6
import cn .nukkit .utils .BinaryStream ;
6
7
import com .google .gson .Gson ;
23
24
import java .util .LinkedHashMap ;
24
25
import java .util .Map ;
25
26
27
+ import static com .google .common .base .Verify .verify ;
28
+
26
29
@ Since ("1.3.2.0-PN" )
27
30
@ UtilityClass
28
31
@ Log4j2
@@ -59,8 +62,14 @@ public class RuntimeItems {
59
62
if (entry .oldId != null ) {
60
63
boolean hasData = entry .oldData != null ;
61
64
int fullId = getFullId (entry .oldId , hasData ? entry .oldData : 0 );
62
- legacyNetworkMap .put (fullId , (entry .id << 1 ) | (hasData ? 1 : 0 ));
63
- networkLegacyMap .put (entry .id , fullId | (hasData ? 1 : 0 ));
65
+ if (entry .deprecated != Boolean .TRUE ) {
66
+ verify (legacyNetworkMap .put (fullId , (entry .id << 1 ) | (hasData ? 1 : 0 )) == 0 ,
67
+ "Conflict while registering an item runtime id!"
68
+ );
69
+ }
70
+ verify (networkLegacyMap .put (entry .id , fullId | (hasData ? 1 : 0 )) == 0 ,
71
+ "Conflict while registering an item runtime id!"
72
+ );
64
73
}
65
74
}
66
75
@@ -106,5 +115,8 @@ static class Entry {
106
115
int id ;
107
116
Integer oldId ;
108
117
Integer oldData ;
118
+ @ PowerNukkitOnly
119
+ @ Since ("1.4.0.0-PN" )
120
+ Boolean deprecated ;
109
121
}
110
122
}
Original file line number Diff line number Diff line change 1
1
package cn .nukkit .utils ;
2
2
3
- import cn .nukkit .block .Block ;
4
3
import cn .nukkit .api .Since ;
4
+ import cn .nukkit .block .Block ;
5
5
import cn .nukkit .entity .Attribute ;
6
6
import cn .nukkit .entity .data .Skin ;
7
- import cn .nukkit .item .*;
7
+ import cn .nukkit .item .Item ;
8
+ import cn .nukkit .item .ItemDurable ;
9
+ import cn .nukkit .item .ItemID ;
10
+ import cn .nukkit .item .RuntimeItems ;
8
11
import cn .nukkit .level .GameRule ;
9
12
import cn .nukkit .level .GameRules ;
10
- import cn .nukkit .level .GlobalBlockPalette ;
11
13
import cn .nukkit .math .BlockFace ;
12
14
import cn .nukkit .math .BlockVector3 ;
13
15
import cn .nukkit .math .Vector3f ;
24
26
import io .netty .util .internal .EmptyArrays ;
25
27
26
28
import java .io .IOException ;
27
- import java .io .UncheckedIOException ;
28
29
import java .lang .reflect .Array ;
29
30
import java .nio .ByteOrder ;
30
31
import java .nio .charset .StandardCharsets ;
Original file line number Diff line number Diff line change 4654
4654
{
4655
4655
"name" : " minecraft:boat" ,
4656
4656
"id" : 611 ,
4657
- "oldId" : 333
4657
+ "oldId" : 333 ,
4658
+ "deprecated" : true
4658
4659
},
4659
4660
{
4660
4661
"name" : " minecraft:dye" ,
4661
4662
"id" : 612 ,
4662
- "oldId" : 351
4663
+ "oldId" : 351 ,
4664
+ "deprecated" : true
4663
4665
},
4664
4666
{
4665
4667
"name" : " minecraft:banner_pattern" ,
4666
4668
"id" : 613 ,
4667
- "oldId" : 434
4669
+ "oldId" : 434 ,
4670
+ "deprecated" : true
4668
4671
},
4669
4672
{
4670
4673
"name" : " minecraft:spawn_egg" ,
4671
4674
"id" : 614 ,
4672
- "oldId" : 383
4675
+ "oldId" : 383 ,
4676
+ "deprecated" : true
4673
4677
},
4674
4678
{
4675
4679
"name" : " minecraft:end_crystal" ,
You can’t perform that action at this time.
0 commit comments