Merge 1.20.2 into 1.20.3
This commit is contained in:
commit
181be3cf80
|
|
@ -27,8 +27,6 @@ dependencies {
|
|||
transitive = false
|
||||
}
|
||||
|
||||
modCompileOnly("curse.maven:diagonal-fences-458048:${diagonal_fences_version}")
|
||||
|
||||
modCompileOnly "curse.maven:spark-361579:${rootProject.spark_version}"
|
||||
// compile against the JEI API but do not include it at runtime
|
||||
modCompileOnly("mezz.jei:jei-${jei_minecraft_version}-common:${jei_version}")
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
package org.embeddedt.modernfix.common.mixin.perf.dynamic_resources.diagonalfences;
|
||||
|
||||
import fuzs.diagonalfences.api.world.level.block.DiagonalBlock;
|
||||
import fuzs.diagonalfences.client.model.MultipartAppender;
|
||||
import fuzs.diagonalfences.mixin.client.accessor.ModelBakeryAccessor;
|
||||
import net.minecraft.client.renderer.block.model.multipart.MultiPart;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.FenceBlock;
|
||||
import net.minecraft.world.level.block.IronBarsBlock;
|
||||
import org.apache.logging.log4j.util.BiConsumer;
|
||||
import org.embeddedt.modernfix.ModernFixClient;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.api.entrypoint.ModernFixClientIntegration;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MultipartAppender.class)
|
||||
@RequiresMod("diagonalfences")
|
||||
public abstract class MultipartAppenderMixin {
|
||||
@Shadow(remap = false)
|
||||
public static void appendDiagonalSelectors(BiConsumer<ResourceLocation, UnbakedModel> modelBakery, MultiPart multiPart, boolean rotateCenter) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
private static boolean handlerInjected = false;
|
||||
|
||||
@Inject(method = "onPrepareModelBaking", at = @At("HEAD"), cancellable = true)
|
||||
private static void setupHelper(CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
if(handlerInjected)
|
||||
return;
|
||||
handlerInjected = true;
|
||||
ModernFixClient.CLIENT_INTEGRATIONS.add(new ModernFixClientIntegration() {
|
||||
@Override
|
||||
public UnbakedModel onUnbakedModelLoad(ResourceLocation location, UnbakedModel originalModel, ModelBakery bakery) {
|
||||
if(originalModel instanceof MultiPart multipart) {
|
||||
Block block = multipart.definition.getOwner();
|
||||
if((block instanceof FenceBlock || block instanceof IronBarsBlock) && block instanceof DiagonalBlock diagonalBlock && diagonalBlock.hasProperties()) {
|
||||
try {
|
||||
appendDiagonalSelectors(((ModelBakeryAccessor)bakery)::diagonalfences$callCacheAndQueueDependencies, multipart, block instanceof IronBarsBlock);
|
||||
} catch(RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return originalModel;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -176,6 +176,7 @@ public class ModernFixEarlyConfig {
|
|||
.put("mixin.perf.remove_spawn_chunks", isDevEnv)
|
||||
.putConditionally(() -> !isFabric, "mixin.bugfix.fix_config_crashes", true)
|
||||
.putConditionally(() -> !isFabric, "mixin.bugfix.forge_at_inject_error", true)
|
||||
.putConditionally(() -> !isFabric, "mixin.feature.registry_event_progress", false)
|
||||
.putConditionally(() -> isFabric, "mixin.perf.clear_fabric_mapping_tables", false)
|
||||
.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package org.embeddedt.modernfix.forge.mixin.feature.registry_event_progress;
|
||||
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.StartupMessageManager;
|
||||
import net.minecraftforge.fml.event.IModBusEvent;
|
||||
import net.minecraftforge.registries.GameData;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.forge.util.AsyncLoadingScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(value = GameData.class, remap = false)
|
||||
@ClientOnlyMixin
|
||||
public class GameDataMixin {
|
||||
|
||||
private static AsyncLoadingScreen mfix$asyncScreen;
|
||||
|
||||
@Inject(method = "postRegisterEvents", at = @At(value = "INVOKE", target = "Ljava/util/Set;iterator()Ljava/util/Iterator;", ordinal = 0))
|
||||
private static void createAsyncScreen(CallbackInfo ci) {
|
||||
mfix$asyncScreen = new AsyncLoadingScreen();
|
||||
}
|
||||
|
||||
@Inject(method = "postRegisterEvents", at = @At(value = "INVOKE", target = "Ljava/lang/RuntimeException;getSuppressed()[Ljava/lang/Throwable;", ordinal = 0))
|
||||
private static void closeAsyncScreen(CallbackInfo ci) {
|
||||
mfix$asyncScreen.close();
|
||||
mfix$asyncScreen = null;
|
||||
}
|
||||
|
||||
@Redirect(method = "postRegisterEvents", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/ModLoader;postEventWrapContainerInModOrder(Lnet/minecraftforge/eventbus/api/Event;)V"))
|
||||
private static <T extends Event & IModBusEvent> void swapThreadAndPost(ModLoader loader, T event) {
|
||||
RegisterEvent registryEvent = (RegisterEvent)event;
|
||||
var pb = StartupMessageManager.addProgressBar(registryEvent.getRegistryKey().location().toString(), ModList.get().size());
|
||||
try {
|
||||
loader.postEventWithWrapInModOrder(event, (mc, e) -> {
|
||||
ModLoadingContext.get().setActiveContainer(mc);
|
||||
pb.label(pb.name() + " - " + mc.getModInfo().getDisplayName());
|
||||
pb.increment();
|
||||
}, (mc, e) -> {
|
||||
ModLoadingContext.get().setActiveContainer(null);
|
||||
});
|
||||
} finally {
|
||||
pb.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,8 +22,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
public class ClientSetupMixin {
|
||||
@Shadow(remap = false) @Final private static BakedModelOverrideRegistry BAKED_MODEL_OVERRIDE_REGISTRY;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void addDynamicListener(CallbackInfo ci) {
|
||||
@Inject(method = "registerBakedModelOverrides", at = @At("RETURN"), remap = false)
|
||||
private static void addDynamicListener(CallbackInfo ci) {
|
||||
ModernFixClient.CLIENT_INTEGRATIONS.add(new ModernFixClientIntegration() {
|
||||
@Override
|
||||
public BakedModel onBakedModelLoad(ResourceLocation location, UnbakedModel baseModel, BakedModel originalModel, ModelState state, ModelBakery bakery) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package org.embeddedt.modernfix.forge.util;
|
||||
|
||||
import net.minecraftforge.fml.loading.ImmediateWindowHandler;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL;
|
||||
import org.lwjgl.opengl.GLCapabilities;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
|
||||
public class AsyncLoadingScreen extends Thread implements AutoCloseable {
|
||||
private final long theWindow;
|
||||
private final AtomicBoolean keepRunning;
|
||||
|
||||
private static int splashThreadNum = 1;
|
||||
|
||||
private static GLCapabilities caps;
|
||||
|
||||
public AsyncLoadingScreen() {
|
||||
this.setName("ModernFix splash thread " + splashThreadNum++);
|
||||
this.theWindow = GLFW.glfwGetCurrentContext();
|
||||
if(caps == null)
|
||||
caps = GL.createCapabilities();
|
||||
if(this.theWindow == 0)
|
||||
throw new IllegalStateException("No context found but async loading screen was requested");
|
||||
this.keepRunning = new AtomicBoolean(true);
|
||||
this.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void start() {
|
||||
GLFW.glfwMakeContextCurrent(0);
|
||||
super.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
GLFW.glfwMakeContextCurrent(theWindow);
|
||||
GL.setCapabilities(caps);
|
||||
while(keepRunning.get()) {
|
||||
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(50));
|
||||
ImmediateWindowHandler.renderTick();
|
||||
}
|
||||
GLFW.glfwMakeContextCurrent(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
keepRunning.set(false);
|
||||
try {
|
||||
this.join();
|
||||
} catch(InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
GLFW.glfwMakeContextCurrent(theWindow);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user