Skip to content

Commit

Permalink
feat: Update Forge to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Jun 14, 2024
1 parent f78e6aa commit d0492e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ private <T> void readConfigValues(String parentPath, T instance, ModConfig confi
logger.error("Invalid config value for " + path + ", expected " + type.getName() + " but got " + value.getClass());
}
} else if (hasValue && ResourceLocation.class.isAssignableFrom(type)) {
field.set(instance, new ResourceLocation(config.getConfigData().get(path)));
field.set(instance, ResourceLocation.parse(config.getConfigData().get(path)));
} else if (hasValue && (Collection.class.isAssignableFrom(type))) {
Object raw = config.getConfigData().getRaw(path);
if (raw instanceof List<?> list) {
ExpectedType expectedType = field.getAnnotation(ExpectedType.class);
Function<Object, Object> mapper = (it) -> it;
if (expectedType != null && ResourceLocation.class.isAssignableFrom(expectedType.value())) {
mapper = (it) -> new ResourceLocation((String) it);
mapper = (it) -> ResourceLocation.parse((String) it);
} else if (expectedType != null && Enum.class.isAssignableFrom(expectedType.value())) {
mapper = (it) -> parseEnumValue(expectedType.value(), (String) it);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class NetworkChannels {

public static SimpleChannel get(String modId) {
return channels.computeIfAbsent(modId, key -> {
ResourceLocation channelName = new ResourceLocation(key, "network");
ResourceLocation channelName = ResourceLocation.fromNamespaceAndPath(key, "network");
ChannelBuilder builder = ChannelBuilder.named(channelName);
if (serverOnlyMods.contains(modId)) {
builder = builder.optionalClient();
Expand Down

0 comments on commit d0492e1

Please sign in to comment.