Skip to content

Commit a18d0aa

Browse files
committed
Fix compilation errors from 1.21.11 changes
1 parent 8ee20d4 commit a18d0aa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/com/example/examplemod/Config.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.example.examplemod;
22

3-
import net.minecraft.resources.ResourceLocation;
3+
import net.minecraft.resources.Identifier;
44
import net.minecraft.world.item.Item;
55
import net.minecraftforge.common.ForgeConfigSpec;
66
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
@@ -43,7 +43,7 @@ public class Config {
4343
public static Set<Item> items;
4444

4545
private static boolean validateItemName(final Object obj) {
46-
return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(ResourceLocation.tryParse(itemName));
46+
return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(Identifier.tryParse(itemName));
4747
}
4848

4949
@SubscribeEvent
@@ -54,7 +54,7 @@ static void onLoad(final ModConfigEvent event) {
5454

5555
// convert the list of strings into a set of items
5656
items = ITEM_STRINGS.get().stream()
57-
.map(itemName -> ForgeRegistries.ITEMS.getValue(ResourceLocation.tryParse(itemName)))
57+
.map(itemName -> ForgeRegistries.ITEMS.getValue(Identifier.tryParse(itemName)))
5858
.collect(Collectors.toSet());
5959
}
6060
}

src/main/java/com/example/examplemod/ExampleMod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public ExampleMod(FMLJavaModLoadingContext context) {
8787
CREATIVE_MODE_TABS.register(modBusGroup);
8888

8989
// Register the item to a creative tab
90-
BuildCreativeModeTabContentsEvent.getBus(modBusGroup).addListener(ExampleMod::addCreative);
90+
BuildCreativeModeTabContentsEvent.BUS.addListener(ExampleMod::addCreative);
9191

9292
// Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us
9393
context.registerConfig(ModConfig.Type.COMMON, Config.SPEC);

0 commit comments

Comments
 (0)