[DEV] Fix Forge Mixins

This commit is contained in:
2025-03-13 15:07:34 +02:00
parent 23720f6629
commit 152bc94e27
12 changed files with 24 additions and 24 deletions

View File

@@ -31,12 +31,12 @@ public class ConfigScreenHandlerMixin {
*/
@Inject(at = @At("RETURN"), method = "getGuiFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
if (config.getModId().equals(selectedMod.getModId())) {
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
cir.setReturnValue(
Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
);

View File

@@ -31,12 +31,12 @@ public class ConfigScreenHandlerMixin {
*/
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
if (config.getModId().equals(selectedMod.getModId())) {
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
cir.setReturnValue(
Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
);

View File

@@ -31,12 +31,12 @@ public class ConfigScreenHandlerMixin {
*/
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
if (config.getModId().equals(selectedMod.getModId())) {
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
cir.setReturnValue(
Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
);

View File

@@ -31,12 +31,12 @@ public class ConfigScreenHandlerMixin {
*/
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
if (config.getModId().equals(selectedMod.getModId())) {
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
cir.setReturnValue(
Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
);

View File

@@ -31,12 +31,12 @@ public class ConfigScreenHandlerMixin {
*/
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
if (config.getModId().equals(selectedMod.getModId())) {
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
cir.setReturnValue(
Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
);

View File

@@ -31,12 +31,12 @@ public class ConfigScreenHandlerMixin {
*/
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
if (config.getModId().equals(selectedMod.getModId())) {
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
cir.setReturnValue(
Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
);

View File

@@ -34,7 +34,7 @@
+ @Inject(at = @At("RETURN"), method = "getGuiFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
@@ -43,7 +43,7 @@
- } else {
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
+ if (config.getModId().equals(selectedMod.getModId())) {
+ if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ cir.setReturnValue(
+ Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
+ );

View File

@@ -19,7 +19,7 @@
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
@@ -28,7 +28,7 @@
- } else {
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
+ if (config.getModId().equals(selectedMod.getModId())) {
+ if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ cir.setReturnValue(
+ Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
+ );

View File

@@ -19,7 +19,7 @@
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
@@ -28,7 +28,7 @@
- } else {
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
+ if (config.getModId().equals(selectedMod.getModId())) {
+ if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ cir.setReturnValue(
+ Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
+ );

View File

@@ -19,7 +19,7 @@
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
@@ -28,7 +28,7 @@
- } else {
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
+ if (config.getModId().equals(selectedMod.getModId())) {
+ if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ cir.setReturnValue(
+ Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
+ );

View File

@@ -19,7 +19,7 @@
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
@@ -28,7 +28,7 @@
- } else {
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
+ if (config.getModId().equals(selectedMod.getModId())) {
+ if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ cir.setReturnValue(
+ Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
+ );

View File

@@ -19,7 +19,7 @@
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
- ConfigController.getMonitoredConfigs().forEach((conf, config) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, config) -> {
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
@@ -28,7 +28,7 @@
- } else {
- //ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
+ if (config.getModId().equals(selectedMod.getModId())) {
+ if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ if (config.getClass().isAnnotationPresent(ClothScreen.class) && ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config")) {
+ cir.setReturnValue(
+ Optional.of((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))
+ );