Revert "Merge remote-tracking branch 'origin/main'"
This reverts commitff8b366eb9
, reversing changes made to52146286fe
.
This commit is contained in:
parent
9b312bf4de
commit
f88506f654
4 changed files with 16 additions and 47 deletions
|
@ -23,6 +23,10 @@ repositories {
|
|||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
minecraft {
|
||||
accessWidener = file("src/main/resources/bclib.accesswidener")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings minecraft.officialMojangMappings()
|
||||
|
|
|
@ -2,6 +2,7 @@ package ru.bclib.mixin.client;
|
|||
|
||||
import com.mojang.datafixers.util.Function4;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Minecraft.ExperimentalDialogType;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.client.color.item.ItemColors;
|
||||
import net.minecraft.client.main.GameConfig;
|
||||
|
@ -25,11 +26,6 @@ import ru.bclib.api.dataexchange.DataExchangeAPI;
|
|||
import ru.bclib.api.datafixer.DataFixerAPI;
|
||||
import ru.bclib.interfaces.CustomColorProvider;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
|
@ -53,55 +49,19 @@ public abstract class MinecraftMixin {
|
|||
});
|
||||
}
|
||||
|
||||
// @Shadow
|
||||
// protected abstract void doLoadLevel(String string, RegistryHolder registryHolder, Function<LevelStorageAccess, DataPackConfig> function, Function4<LevelStorageAccess, RegistryHolder, ResourceManager, DataPackConfig, WorldData> function4, boolean bl, ExperimentalDialogType experimentalDialogType);
|
||||
//
|
||||
@Shadow
|
||||
protected abstract void doLoadLevel(String string, RegistryHolder registryHolder, Function<LevelStorageAccess, DataPackConfig> function, Function4<LevelStorageAccess, RegistryHolder, ResourceManager, DataPackConfig, WorldData> function4, boolean bl, ExperimentalDialogType experimentalDialogType);
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private LevelStorageSource levelSource;
|
||||
Method doLoadLevel = null;
|
||||
Object experimentalDialogType_BACKUP = null;
|
||||
|
||||
private void bclib_doLoadLevel_BACKUP(String levelID, RegistryHolder registryHolder, Function<LevelStorageAccess, DataPackConfig> function, Function4<LevelStorageAccess, RegistryHolder, ResourceManager, DataPackConfig, WorldData> function4, boolean bl){
|
||||
if (experimentalDialogType_BACKUP==null) {
|
||||
try {
|
||||
Class experimentalDialogType = Class.forName("net.minecraft.client.Minecraft$ExperimentalDialogType");
|
||||
Field f = experimentalDialogType.getDeclaredField("$VALUES");
|
||||
f.setAccessible(true);
|
||||
experimentalDialogType_BACKUP = Array.get(f.get(null), 2);
|
||||
} catch (ClassNotFoundException | IllegalAccessException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (doLoadLevel==null) {
|
||||
for (Method m : Minecraft.class.getDeclaredMethods()) {
|
||||
if (m.getName().equals("doLoadLevel")) {
|
||||
doLoadLevel = m;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (doLoadLevel!=null && experimentalDialogType_BACKUP!=null){
|
||||
doLoadLevel.setAccessible(true);
|
||||
try {
|
||||
doLoadLevel.invoke(this, new Object[]{levelID, registryHolder, function, function4, bl, experimentalDialogType_BACKUP});
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "loadLevel", cancellable = true, at = @At("HEAD"))
|
||||
private void bclib_callFixerOnLoad(String levelID, CallbackInfo ci) {
|
||||
DataExchangeAPI.prepareServerside();
|
||||
|
||||
if (DataFixerAPI.fixData(this.levelSource, levelID, true, (appliedFixes) -> {
|
||||
bclib_doLoadLevel_BACKUP(levelID, RegistryAccess.builtin(), Minecraft::loadDataPacks, Minecraft::loadWorldData, false);
|
||||
//this.doLoadLevel(levelID, RegistryAccess.builtin(), Minecraft::loadDataPacks, Minecraft::loadWorldData, false, Minecraft.ExperimentalDialogType.BACKUP);
|
||||
this.doLoadLevel(levelID, RegistryAccess.builtin(), Minecraft::loadDataPacks, Minecraft::loadWorldData, false, Minecraft.ExperimentalDialogType.BACKUP);
|
||||
})) {
|
||||
ci.cancel();
|
||||
}
|
||||
|
|
4
src/main/resources/bclib.accesswidener
Normal file
4
src/main/resources/bclib.accesswidener
Normal file
|
@ -0,0 +1,4 @@
|
|||
accessWidener v1 named
|
||||
|
||||
# Classes
|
||||
accessible class net/minecraft/client/Minecraft$ExperimentalDialogType
|
|
@ -28,7 +28,8 @@
|
|||
],
|
||||
"modmenu": [ "ru.bclib.gui.modmenu.EntryPoint::entrypointObject" ]
|
||||
},
|
||||
"mixins": [
|
||||
"accessWidener" : "bclib.accesswidener",
|
||||
"mixins": [
|
||||
"bclib.mixins.common.json",
|
||||
"bclib.mixins.client.json"
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue