1
1
package platinpython .rgbblocks ;
2
2
3
3
import net .minecraft .core .NonNullList ;
4
- import org .apache .logging .log4j .LogManager ;
5
- import org .apache .logging .log4j .Logger ;
6
-
7
4
import net .minecraft .world .item .CreativeModeTab ;
8
5
import net .minecraft .world .item .Item ;
9
6
import net .minecraft .world .item .ItemStack ;
10
7
import net .minecraft .world .level .block .DispenserBlock ;
11
8
import net .minecraftforge .common .MinecraftForge ;
12
- import net .minecraftforge .event .RegistryEvent .MissingMappings ;
13
- import net .minecraftforge .event .RegistryEvent .MissingMappings .Mapping ;
14
9
import net .minecraftforge .eventbus .api .SubscribeEvent ;
15
10
import net .minecraftforge .fml .InterModComms ;
16
11
import net .minecraftforge .fml .ModList ;
17
12
import net .minecraftforge .fml .common .Mod ;
18
13
import net .minecraftforge .fml .event .lifecycle .FMLCommonSetupEvent ;
19
14
import net .minecraftforge .fml .event .lifecycle .InterModEnqueueEvent ;
20
15
import net .minecraftforge .fml .javafmlmod .FMLJavaModLoadingContext ;
16
+ import net .minecraftforge .registries .ForgeRegistries ;
17
+ import net .minecraftforge .registries .MissingMappingsEvent ;
18
+ import org .apache .logging .log4j .LogManager ;
19
+ import org .apache .logging .log4j .Logger ;
21
20
import platinpython .rgbblocks .data .DataGatherer ;
22
21
import platinpython .rgbblocks .dispenser .DispensePaintbucketBehaviour ;
23
22
import platinpython .rgbblocks .util .RegistryHandler ;
@@ -45,7 +44,8 @@ public void setup(final FMLCommonSetupEvent event) {
45
44
PacketHandler .register ();
46
45
47
46
event .enqueueWork (() -> DispenserBlock .registerBehavior (ItemRegistry .PAINT_BUCKET .get (),
48
- new DispensePaintbucketBehaviour ()));
47
+ new DispensePaintbucketBehaviour ()
48
+ ));
49
49
}
50
50
51
51
public void enqueueIMC (final InterModEnqueueEvent event ) {
@@ -55,9 +55,10 @@ public void enqueueIMC(final InterModEnqueueEvent event) {
55
55
}
56
56
57
57
@ SubscribeEvent
58
- public void replaceMappings (MissingMappings <Item > event ) {
59
- for (Mapping <Item > mapping : event .getAllMappings ()) {
60
- if (mapping .key .toString ().equals ("rgbblocks:bucket_of_paint" )) {
58
+ public void replaceMappings (MissingMappingsEvent event ) {
59
+ for (MissingMappingsEvent .Mapping <Item > mapping : event .getAllMappings (
60
+ ForgeRegistries .ITEMS .getRegistryKey ())) {
61
+ if (mapping .getKey ().toString ().equals ("rgbblocks:bucket_of_paint" )) {
61
62
mapping .remap (ItemRegistry .PAINT_BUCKET .get ());
62
63
}
63
64
}
@@ -72,11 +73,13 @@ public ItemStack makeIcon() {
72
73
}
73
74
74
75
@ Override
75
- public void fillItemList (NonNullList <ItemStack > pItems ) {
76
- super .fillItemList (pItems );
77
- pItems .sort ((i1 , i2 ) -> i1 .getItem ().getRegistryName ().compareNamespaced (i2 .getItem ().getRegistryName ()));
78
- pItems .removeIf (i -> i .getItem ().equals (ItemRegistry .PAINT_BUCKET .get ()));
79
- pItems .add (0 , ItemRegistry .PAINT_BUCKET .get ().getDefaultInstance ());
76
+ public void fillItemList (NonNullList <ItemStack > items ) {
77
+ super .fillItemList (items );
78
+ //noinspection ConstantConditions
79
+ items .sort ((i1 , i2 ) -> ForgeRegistries .ITEMS .getKey (i1 .getItem ())
80
+ .compareNamespaced (ForgeRegistries .ITEMS .getKey (i2 .getItem ())));
81
+ items .removeIf (i -> i .getItem ().equals (ItemRegistry .PAINT_BUCKET .get ()));
82
+ items .add (0 , ItemRegistry .PAINT_BUCKET .get ().getDefaultInstance ());
80
83
}
81
84
};
82
85
}
0 commit comments