Update for 1.19

This commit is contained in:
Johannes Frohnmeyer 2022-06-08 12:00:57 +02:00
parent 0b3323fb9c
commit 5ed982b453
Signed by: Johannes
GPG Key ID: E76429612C2929F4
6 changed files with 18 additions and 18 deletions

View File

@ -22,7 +22,7 @@ build_test:
image: gradle:jdk17 image: gradle:jdk17
stage: deploy stage: deploy
script: script:
- gradle --build-cache build publish -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven" - gradle --build-cache deployDebug -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven"
- mv build/libs/* ./ - mv build/libs/* ./
- mv build/devlibs/*-dev.jar ./ - mv build/devlibs/*-dev.jar ./
- rm *-maven.jar *-sources.jar - rm *-maven.jar *-sources.jar
@ -52,7 +52,7 @@ deploy:
- if: $CI_COMMIT_TAG && '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^master/' - if: $CI_COMMIT_TAG && '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^master/'
stage: deploy stage: deploy
script: script:
- gradle --build-cache build publish modrinth -Prelease -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven" - gradle --build-cache build publish modrinth modrinthSyncBody -Prelease -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven"
- rm build/libs/* - rm build/libs/*
- rm build/devlibs/* - rm build/devlibs/*
- gradle --build-cache -Pflavor=curseforge build curseforge -Prelease - gradle --build-cache -Pflavor=curseforge build curseforge -Prelease

View File

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2020 JFronny Copyright (c) 2022 JFronny
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -9,10 +9,10 @@ repositories {
dependencies { dependencies {
modRuntimeOnly "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modRuntimeOnly "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:6.2.57") { modApi("me.shedaniel.cloth:cloth-config-fabric:7.0.65") {
exclude(group: "net.fabricmc.fabric-api") exclude(group: "net.fabricmc.fabric-api")
} }
modImplementation "com.terraformersmc:modmenu:3.1.0" modImplementation "com.terraformersmc:modmenu:4.0.0-beta.4"
} }
if (flavor == "curseforge") { if (flavor == "curseforge") {

View File

@ -1,11 +1,11 @@
# https://fabricmc.net/develop/ # https://fabricmc.net/develop/
minecraft_version=1.18.2 minecraft_version=1.19
yarn_mappings=build.1 yarn_mappings=build.1
loader_version=0.13.3 loader_version=0.14.6
maven_group=io.gitlab.jfronny maven_group=io.gitlab.jfronny
archives_base_name=breakme archives_base_name=breakme
fabric_version=0.47.8+1.18.2 fabric_version=0.55.1+1.19
modrinth_id=ibgLmpmd modrinth_id=ibgLmpmd
modrinth_optional_dependencies=mOgUt4GM modrinth_optional_dependencies=mOgUt4GM

View File

@ -8,7 +8,7 @@ import me.shedaniel.autoconfig.gui.registry.api.GuiRegistryAccess;
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry; import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder; import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.minecraft.text.TranslatableText; import net.minecraft.text.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Collections; import java.util.Collections;
@ -29,7 +29,7 @@ public class BreakMeClient implements ClientModInitializer {
private List<AbstractConfigListEntry> get(String i13n, Field field, Object config, Object defaults, GuiRegistryAccess guiProvider) { private List<AbstractConfigListEntry> get(String i13n, Field field, Object config, Object defaults, GuiRegistryAccess guiProvider) {
return Collections.singletonList( return Collections.singletonList(
builder.startSelector( builder.startSelector(
new TranslatableText(i13n), Text.translatable(i13n),
BreakMe.getProviders(), BreakMe.getProviders(),
getUnsafely(field, config, getUnsafely(field, defaults)) getUnsafely(field, config, getUnsafely(field, defaults))
).setDefaultValue(() -> "None") ).setDefaultValue(() -> "None")

View File

@ -12,25 +12,25 @@ import java.util.NoSuchElementException;
public class ClassFinder { public class ClassFinder {
public static List<Class<?>> find(String packageName) throws NoSuchElementException, IOException { public static List<Class<?>> find(String packageName) throws NoSuchElementException, IOException {
String path = packageName.replace('.', '/');
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Path p = FabricLoader.getInstance() Path p = FabricLoader.getInstance()
.getModContainer(BreakMe.MOD_ID) .getModContainer(BreakMe.MOD_ID)
.orElseThrow(FileNotFoundException::new) .orElseThrow(FileNotFoundException::new)
.findPath(path) .findPath(".")
.orElseThrow(FileNotFoundException::new); .orElseThrow(FileNotFoundException::new)
return findInternal(p, classLoader); .toAbsolutePath();
return findInternal(p, p.resolve(packageName.replace('.', '/')), classLoader);
} }
private static List<Class<?>> findInternal(Path path, ClassLoader classLoader) throws IOException { private static List<Class<?>> findInternal(Path rootPath, Path path, ClassLoader classLoader) throws IOException {
List<Class<?>> result = new ArrayList<>(); List<Class<?>> result = new ArrayList<>();
Files.list(path).forEach(s -> { Files.list(path).forEach(s -> {
try { try {
if (Files.isDirectory(s)) { if (Files.isDirectory(s)) {
result.addAll(findInternal(s, classLoader)); result.addAll(findInternal(rootPath, s, classLoader));
} else if (s.getFileName().toString().endsWith(".class")) { } else if (s.getFileName().toString().endsWith(".class")) {
String p = s.toString().replace('/', '.'); String p = rootPath.relativize(s).toString().replace('/', '.');
result.add(classLoader.loadClass(p.substring(1, p.length() - 6))); result.add(classLoader.loadClass(p.substring(0, p.length() - ".class".length())));
} }
} catch (Throwable e) { } catch (Throwable e) {
BreakMe.LOGGER.error("Could not scan classpath for crash method", e); BreakMe.LOGGER.error("Could not scan classpath for crash method", e);