Skip to content

Commit d0492e1

Browse files
committed
feat: Update Forge to 1.21
1 parent f78e6aa commit d0492e1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

forge/src/main/java/net/blay09/mods/balm/forge/config/ForgeBalmConfig.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ private <T> void readConfigValues(String parentPath, T instance, ModConfig confi
137137
logger.error("Invalid config value for " + path + ", expected " + type.getName() + " but got " + value.getClass());
138138
}
139139
} else if (hasValue && ResourceLocation.class.isAssignableFrom(type)) {
140-
field.set(instance, new ResourceLocation(config.getConfigData().get(path)));
140+
field.set(instance, ResourceLocation.parse(config.getConfigData().get(path)));
141141
} else if (hasValue && (Collection.class.isAssignableFrom(type))) {
142142
Object raw = config.getConfigData().getRaw(path);
143143
if (raw instanceof List<?> list) {
144144
ExpectedType expectedType = field.getAnnotation(ExpectedType.class);
145145
Function<Object, Object> mapper = (it) -> it;
146146
if (expectedType != null && ResourceLocation.class.isAssignableFrom(expectedType.value())) {
147-
mapper = (it) -> new ResourceLocation((String) it);
147+
mapper = (it) -> ResourceLocation.parse((String) it);
148148
} else if (expectedType != null && Enum.class.isAssignableFrom(expectedType.value())) {
149149
mapper = (it) -> parseEnumValue(expectedType.value(), (String) it);
150150
}

forge/src/main/java/net/blay09/mods/balm/forge/network/NetworkChannels.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class NetworkChannels {
1616

1717
public static SimpleChannel get(String modId) {
1818
return channels.computeIfAbsent(modId, key -> {
19-
ResourceLocation channelName = new ResourceLocation(key, "network");
19+
ResourceLocation channelName = ResourceLocation.fromNamespaceAndPath(key, "network");
2020
ChannelBuilder builder = ChannelBuilder.named(channelName);
2121
if (serverOnlyMods.contains(modId)) {
2222
builder = builder.optionalClient();

0 commit comments

Comments
 (0)