Generate mixin class list at build/run time
This commit is contained in:
parent
d0102af837
commit
4097ba3cce
30
build.gradle
30
build.gradle
|
|
@ -124,6 +124,36 @@ tasks.withType(JavaCompile) {
|
|||
*/
|
||||
}
|
||||
|
||||
processResources {
|
||||
def mixinFileList = []
|
||||
def mixinDirectory = file("src/main/java/org/embeddedt/modernfix/mixin")
|
||||
fileTree(mixinDirectory).visit { FileVisitDetails details ->
|
||||
if(details.file.isFile()) {
|
||||
def fileName = mixinDirectory.relativePath(details.file).toString().replaceFirst(/\.java$/, "").replace('/', '.')
|
||||
mixinFileList << fileName
|
||||
}
|
||||
}
|
||||
|
||||
def mixinClassesStringB = new StringBuilder()
|
||||
for(int i = 0; i < mixinFileList.size(); i++) {
|
||||
mixinClassesStringB.append(" \"")
|
||||
mixinClassesStringB.append(mixinFileList.get(i))
|
||||
mixinClassesStringB.append('"')
|
||||
if(i < (mixinFileList.size() - 1))
|
||||
mixinClassesStringB.append(',')
|
||||
mixinClassesStringB.append('\n')
|
||||
}
|
||||
|
||||
def replacements = [
|
||||
mixin_classes: mixinClassesStringB.toString()
|
||||
]
|
||||
|
||||
inputs.properties replacements
|
||||
filesMatching("modernfix.mixins.json") {
|
||||
expand replacements
|
||||
}
|
||||
}
|
||||
|
||||
task generateChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
|
||||
def details = versionDetails();
|
||||
if(details.commitDistance > 0) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package org.embeddedt.modernfix.annotation;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface ClientOnlyMixin {
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package org.embeddedt.modernfix.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface RequiresMod {
|
||||
String value() default "";
|
||||
}
|
||||
|
|
@ -155,7 +155,10 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
|||
}
|
||||
|
||||
String mixin = mixinClassName.substring(MIXIN_PACKAGE_ROOT.length());
|
||||
return isOptionEnabled(mixin);
|
||||
if(!isOptionEnabled(mixin))
|
||||
return false;
|
||||
String disabledBecauseMod = config.getPermanentlyDisabledMixins().get(mixin);
|
||||
return disabledBecauseMod == null;
|
||||
}
|
||||
|
||||
public boolean isOptionEnabled(String mixin) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,27 @@
|
|||
package org.embeddedt.modernfix.core.config;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ExplodedDirectoryLocator;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.tree.AnnotationNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.TypeAnnotationNode;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ModernFixEarlyConfig {
|
||||
private static final Logger LOGGER = LogManager.getLogger("ModernFixConfig");
|
||||
|
|
@ -35,77 +49,126 @@ public class ModernFixEarlyConfig {
|
|||
return FMLLoader.getLoadingModList().getModFileById(modId) != null;
|
||||
}
|
||||
|
||||
private static final String MIXIN_DESC = "Lorg/spongepowered/asm/mixin/Mixin;";
|
||||
private static final String MIXIN_CLIENT_ONLY_DESC = "Lorg/embeddedt/modernfix/annotation/ClientOnlyMixin;";
|
||||
private static final String MIXIN_REQUIRES_MOD_DESC = "Lorg/embeddedt/modernfix/annotation/RequiresMod;";
|
||||
|
||||
private final Set<String> mixinOptions = new ObjectOpenHashSet<>();
|
||||
private final Map<String, String> mixinsMissingMods = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
public Map<String, String> getPermanentlyDisabledMixins() {
|
||||
return mixinsMissingMods;
|
||||
}
|
||||
|
||||
private void scanForAndBuildMixinOptions() {
|
||||
IModFile file = FMLLoader.getLoadingModList().getModFileById("modernfix").getFile();
|
||||
Path mixinFolder = file.getLocator().findPath(file, "org", "embeddedt", "modernfix", "mixin");
|
||||
try(Stream<Path> mixinFiles = Files.find(mixinFolder, Integer.MAX_VALUE, (p, a) -> true)) {
|
||||
Splitter dotSplitter = Splitter.on('.');
|
||||
// filter via toString
|
||||
mixinFiles
|
||||
.filter(p -> {
|
||||
Path fileName = p.getFileName();
|
||||
return fileName != null && fileName.toString().endsWith(".class");
|
||||
})
|
||||
.forEach(path -> {
|
||||
try(InputStream stream = Files.newInputStream(path)) {
|
||||
ClassReader reader = new ClassReader(stream);
|
||||
ClassNode node = new ClassNode();
|
||||
reader.accept(node, ClassReader.SKIP_CODE | ClassReader.SKIP_FRAMES | ClassReader.SKIP_DEBUG);
|
||||
if(node.invisibleAnnotations == null)
|
||||
return;
|
||||
boolean isMixin = false, isClientOnly = false, requiredModPresent = true;
|
||||
String requiredModId = "";
|
||||
for(AnnotationNode annotation : node.invisibleAnnotations) {
|
||||
if(Objects.equals(annotation.desc, MIXIN_DESC)) {
|
||||
isMixin = true;
|
||||
} else if(Objects.equals(annotation.desc, MIXIN_CLIENT_ONLY_DESC)) {
|
||||
isClientOnly = true;
|
||||
} else if(Objects.equals(annotation.desc, MIXIN_REQUIRES_MOD_DESC)) {
|
||||
for(int i = 0; i < annotation.values.size(); i += 2) {
|
||||
if(annotation.values.get(i).equals("value")) {
|
||||
String modId = (String)annotation.values.get(i + 1);
|
||||
if(modId != null) {
|
||||
requiredModPresent = modPresent(modId);
|
||||
requiredModId = modId;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isMixin) {
|
||||
String mixinClassName = node.name.replace("org/embeddedt/modernfix/mixin/", "").replace('/', '.');
|
||||
if(!requiredModPresent)
|
||||
mixinsMissingMods.put(mixinClassName, requiredModId);
|
||||
else if(isClientOnly && FMLLoader.getDist() != Dist.CLIENT)
|
||||
mixinsMissingMods.put(mixinClassName, "[not client]");
|
||||
List<String> mixinOptionNames = dotSplitter.splitToList(mixinClassName);
|
||||
StringBuilder optionBuilder = new StringBuilder(mixinClassName.length());
|
||||
optionBuilder.append("mixin");
|
||||
for(int i = 0; i < mixinOptionNames.size() - 1; i++) {
|
||||
optionBuilder.append('.');
|
||||
optionBuilder.append(mixinOptionNames.get(i));
|
||||
mixinOptions.add(optionBuilder.toString());
|
||||
}
|
||||
}
|
||||
} catch(IOException e) {
|
||||
ModernFix.LOGGER.error("Error scanning file " + path, e);
|
||||
}
|
||||
});
|
||||
} catch(IOException e) {
|
||||
ModernFix.LOGGER.error("Error scanning for mixins", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static final boolean shouldReplaceSearchTrees;
|
||||
private static final boolean isDevEnv = !FMLLoader.isProduction() && FMLLoader.getLoadingModList().getModFileById("modernfix").getFile().getLocator() instanceof ExplodedDirectoryLocator;;
|
||||
|
||||
static {
|
||||
shouldReplaceSearchTrees = modPresent("jei");
|
||||
}
|
||||
|
||||
private static final ImmutableMap<String, Boolean> DEFAULT_SETTING_OVERRIDES = ImmutableMap.<String, Boolean>builder()
|
||||
.put("mixin.perf.dynamic_resources", false)
|
||||
.put("mixin.feature.reduce_loading_screen_freezes", false)
|
||||
.put("mixin.feature.direct_stack_trace", false)
|
||||
.put("mixin.perf.rewrite_registry", false)
|
||||
.put("mixin.perf.clear_mixin_classinfo", false)
|
||||
.put("mixin.perf.compress_blockstate", false)
|
||||
.put("mixin.bugfix.packet_leak", false)
|
||||
.put("mixin.perf.deduplicate_location", false)
|
||||
.put("mixin.perf.preload_block_classes", false)
|
||||
.put("mixin.perf.faster_singleplayer_load", false)
|
||||
.put("mixin.perf.blast_search_trees", shouldReplaceSearchTrees)
|
||||
.put("mixin.devenv", isDevEnv)
|
||||
.put("mixin.perf.remove_spawn_chunks", isDevEnv)
|
||||
.build();
|
||||
|
||||
private ModernFixEarlyConfig(File file) {
|
||||
this.configFile = file;
|
||||
|
||||
this.scanForAndBuildMixinOptions();
|
||||
for(String optionName : mixinOptions) {
|
||||
boolean defaultEnabled = DEFAULT_SETTING_OVERRIDES.getOrDefault(optionName, true);
|
||||
this.options.putIfAbsent(optionName, new Option(optionName, defaultEnabled, false));
|
||||
}
|
||||
// Defines the default rules which can be configured by the user or other mods.
|
||||
// You must manually add a rule for any new mixins not covered by an existing package rule.
|
||||
this.addMixinRule("core", true); // TODO: Don't actually allow the user to disable this
|
||||
this.addMixinRule("feature.branding", true);
|
||||
this.addMixinRule("feature.measure_time", true);
|
||||
this.addMixinRule("feature.reduce_loading_screen_freezes", false);
|
||||
this.addMixinRule("feature.direct_stack_trace", false);
|
||||
this.addMixinRule("perf.fast_registry_validation", true);
|
||||
// not stable yet
|
||||
this.addMixinRule("perf.rewrite_registry", false);
|
||||
this.addMixinRule("launch.class_search_cache", true);
|
||||
/*
|
||||
this.addMixinRule("perf.use_integrated_resources.jepb", modPresent("jepb"));
|
||||
this.addMixinRule("perf.use_integrated_resources.jeresources", modPresent("jeresources"));
|
||||
this.addMixinRule("perf.jeresources_startup", modPresent("jeresources"));
|
||||
this.addMixinRule("perf.remove_biome_temperature_cache", true);
|
||||
this.addMixinRule("perf.resourcepacks", true);
|
||||
this.addMixinRule("perf.reduce_blockstate_cache_rebuilds", true);
|
||||
this.addMixinRule("perf.boost_worker_count", true);
|
||||
this.addMixinRule("perf.skip_first_datapack_reload", true);
|
||||
this.addMixinRule("perf.reuse_datapacks", true);
|
||||
this.addMixinRule("perf.model_optimizations", true);
|
||||
this.addMixinRule("perf.dynamic_resources", false);
|
||||
this.addMixinRule("perf.dedicated_reload_executor", true);
|
||||
/* Use a simpler ArrayMap if FerriteCore is using the map intelligently anyway */
|
||||
this.addMixinRule("perf.state_definition_construct", modPresent("ferritecore"));
|
||||
this.addMixinRule("perf.cache_strongholds", true);
|
||||
this.addMixinRule("perf.clear_mixin_classinfo", false);
|
||||
this.addMixinRule("perf.cache_upgraded_structures", true);
|
||||
this.addMixinRule("perf.biome_zoomer", true);
|
||||
this.addMixinRule("perf.compress_blockstate", false);
|
||||
this.addMixinRule("bugfix.concurrency", true);
|
||||
this.addMixinRule("bugfix.preserve_early_window_pos", true);
|
||||
this.addMixinRule("bugfix.edge_chunk_not_saved", true);
|
||||
this.addMixinRule("bugfix.starlight_emptiness", modPresent("starlight"));
|
||||
this.addMixinRule("bugfix.packet_leak", false);
|
||||
this.addMixinRule("perf.dynamic_structure_manager", true);
|
||||
this.addMixinRule("bugfix.mc218112", true);
|
||||
this.addMixinRule("bugfix.chunk_deadlock", true);
|
||||
this.addMixinRule("bugfix.remove_block_chunkloading", true);
|
||||
this.addMixinRule("bugfix.paper_chunk_patches", true);
|
||||
this.addMixinRule("bugfix.chunk_deadlock.valhesia", modPresent("valhelsia_structures"));
|
||||
this.addMixinRule("bugfix.tf_cme_on_load", modPresent("twilightforest"));
|
||||
this.addMixinRule("bugfix.refinedstorage", modPresent("refinedstorage"));
|
||||
this.addMixinRule("perf.async_jei", modPresent("jei"));
|
||||
this.addMixinRule("perf.thread_priorities", true);
|
||||
this.addMixinRule("perf.preload_block_classes", false);
|
||||
this.addMixinRule("perf.scan_cache", true);
|
||||
this.addMixinRule("perf.compress_biome_container", true);
|
||||
this.addMixinRule("perf.nuke_empty_chunk_sections", true);
|
||||
this.addMixinRule("perf.flatten_model_predicates", true);
|
||||
this.addMixinRule("perf.deduplicate_location", false);
|
||||
this.addMixinRule("perf.cache_blockstate_cache_arrays", true);
|
||||
this.addMixinRule("perf.cache_model_materials", true);
|
||||
this.addMixinRule("perf.nbt_memory_usage", true);
|
||||
this.addMixinRule("perf.patchouli_deduplicate_books", modPresent("patchouli"));
|
||||
this.addMixinRule("perf.datapack_reload_exceptions", true);
|
||||
this.addMixinRule("perf.dynamic_dfu", true);
|
||||
this.addMixinRule("perf.async_locator", true);
|
||||
this.addMixinRule("perf.faster_texture_stitching", true);
|
||||
this.addMixinRule("perf.faster_texture_loading", true);
|
||||
this.addMixinRule("perf.faster_font_loading", true);
|
||||
this.addMixinRule("perf.kubejs", modPresent("kubejs"));
|
||||
this.addMixinRule("perf.faster_singleplayer_load", false);
|
||||
/* Keep this off if JEI isn't installed to prevent breaking vanilla gameplay */
|
||||
this.addMixinRule("perf.blast_search_trees", modPresent("jei"));
|
||||
this.addMixinRule("safety", true);
|
||||
this.addMixinRule("launch.class_search_cache", true);
|
||||
boolean isDevEnv = !FMLLoader.isProduction() && FMLLoader.getLoadingModList().getModFileById("modernfix").getFile().getLocator() instanceof ExplodedDirectoryLocator;
|
||||
this.addMixinRule("devenv", isDevEnv);
|
||||
this.addMixinRule("perf.remove_spawn_chunks", isDevEnv);
|
||||
*/
|
||||
|
||||
/* Mod compat */
|
||||
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot");
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -14,6 +15,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(value = BlockBehaviour.BlockStateBase.class, priority = 900)
|
||||
@RequiresMod("valhelsia_structures")
|
||||
public abstract class BlockStateBaseMixin {
|
||||
@Shadow public abstract Block getBlock();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@ package org.embeddedt.modernfix.mixin.bugfix.concurrency;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.thread.BlockableEventLoop;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
@ClientOnlyMixin
|
||||
public abstract class MinecraftMixin<R extends Runnable> extends BlockableEventLoop<R> {
|
||||
|
||||
protected MinecraftMixin(String p_i50403_1_) {
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ package org.embeddedt.modernfix.mixin.bugfix.concurrency;
|
|||
import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(RenderType.CompositeRenderType.class)
|
||||
@ClientOnlyMixin
|
||||
public class RenderTypeMixin {
|
||||
@Shadow @Final private static ObjectOpenCustomHashSet<RenderType.CompositeRenderType> INSTANCES;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.embeddedt.modernfix.mixin.bugfix.mc218112;
|
|||
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
|
@ -12,6 +13,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
|
||||
@Mixin(SynchedEntityData.class)
|
||||
@ClientOnlyMixin
|
||||
public abstract class SynchedEntityDataMixin_Client {
|
||||
@Shadow @Final private ReadWriteLock lock;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ package org.embeddedt.modernfix.mixin.bugfix.packet_leak;
|
|||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.duck.IClientNetHandler;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ClientPacketListener.class)
|
||||
@ClientOnlyMixin
|
||||
public class ClientPlayNetHandlerMixin implements IClientNetHandler {
|
||||
private FriendlyByteBuf savedCopy = null;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
|||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.duck.IClientNetHandler;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
@ -13,6 +14,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ClientboundCustomPayloadPacket.class)
|
||||
@ClientOnlyMixin
|
||||
public class SCustomPayloadPlayPacketMixin {
|
||||
@Shadow private FriendlyByteBuf data;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.mojang.blaze3d.platform.ScreenManager;
|
|||
import com.mojang.blaze3d.platform.Window;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.fml.loading.progress.EarlyProgressVisualization;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
@ -16,6 +17,7 @@ import java.util.function.LongSupplier;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(Window.class)
|
||||
@ClientOnlyMixin
|
||||
public class WindowMixin {
|
||||
@Shadow private boolean fullscreen;
|
||||
@Shadow private int width;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage.api.network.INetwork;
|
|||
import com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.FluidExternalStorageCache;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.duck.rs.IFluidExternalStorageCache;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
@ -16,6 +17,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@Mixin(FluidExternalStorageCache.class)
|
||||
@RequiresMod("refinedstorage")
|
||||
public class FluidExternalStorageCacheMixin implements IFluidExternalStorageCache {
|
||||
@Shadow(remap = false) private List<FluidStack> cache;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.FluidExter
|
|||
import com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.ItemExternalStorageCache;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.duck.rs.IFluidExternalStorageCache;
|
||||
import org.embeddedt.modernfix.duck.rs.IItemExternalStorageCache;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
|
@ -16,6 +17,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(FluidExternalStorage.class)
|
||||
@RequiresMod("refinedstorage")
|
||||
public class FluidExternalStorageMixin {
|
||||
@Shadow(remap = false)
|
||||
@Final
|
||||
|
|
|
|||
|
|
@ -11,10 +11,12 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
@Mixin(FluidExternalStorageProvider.class)
|
||||
@RequiresMod("refinedstorage")
|
||||
public class FluidExternalStorageProviderMixin {
|
||||
/**
|
||||
* @author embeddedt
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.ItemExtern
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.duck.rs.IItemExternalStorageCache;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
@ -17,6 +18,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@Mixin(ItemExternalStorageCache.class)
|
||||
@RequiresMod("refinedstorage")
|
||||
public class ItemExternalStorageCacheMixin implements IItemExternalStorageCache {
|
||||
@Shadow(remap = false) private List<ItemStack> cache;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.mixin.bugfix.refinedstorage.te_bug;
|
|||
import com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.ItemExternalStorage;
|
||||
import com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.ItemExternalStorageCache;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.duck.rs.IItemExternalStorageCache;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -13,6 +14,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(ItemExternalStorage.class)
|
||||
@RequiresMod("refinedstorage")
|
||||
public class ItemExternalStorageMixin {
|
||||
@Shadow(remap = false) @Final private ItemExternalStorageCache cache;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,12 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
@Mixin(ItemExternalStorageProvider.class)
|
||||
@RequiresMod("refinedstorage")
|
||||
public class ItemExternalStorageProviderMixin {
|
||||
/**
|
||||
* @author embeddedt
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import ca.spottedleaf.starlight.common.light.StarLightEngine;
|
|||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Pseudo;
|
||||
|
|
@ -13,6 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(StarLightEngine.class)
|
||||
@RequiresMod("starlight")
|
||||
public abstract class StarLightEngineMixin {
|
||||
@Shadow protected abstract LevelChunkSection getChunkSection(int chunkX, int chunkY, int chunkZ);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.embeddedt.modernfix.mixin.bugfix.tf_cme_on_load;
|
||||
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -9,6 +10,7 @@ import twilightforest.TwilightForestMod;
|
|||
import twilightforest.worldgen.biomes.BiomeKeys;
|
||||
|
||||
@Mixin(TwilightForestMod.class)
|
||||
@RequiresMod("twilightforest")
|
||||
public class TwilightForestModMixin {
|
||||
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Ltwilightforest/worldgen/biomes/BiomeKeys;addBiomeTypes()V"), remap = false)
|
||||
private static void avoidBiomeTypes() {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.level.DataPackConfig;
|
|||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -17,6 +18,7 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.function.Function;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
@ClientOnlyMixin
|
||||
public class MinecraftMixin {
|
||||
@Inject(method = "loadWorld", at = @At("HEAD"))
|
||||
private void setLatch(String string, RegistryAccess.RegistryHolder arg, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> function, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> function4, boolean bl, Minecraft.ExperimentalDialogType arg2, boolean creating, CallbackInfo ci) {
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ package org.embeddedt.modernfix.mixin.core;
|
|||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.embeddedt.modernfix.ModernFixClient;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
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.callback.CallbackInfo;
|
||||
|
||||
@Mixin(SynchedEntityData.class)
|
||||
@ClientOnlyMixin
|
||||
public class SynchedEntityDataMixin {
|
||||
/**
|
||||
* Store this in our set of all entity data objects.
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ package org.embeddedt.modernfix.mixin.devenv;
|
|||
import com.mojang.authlib.minecraft.OfflineSocialInteractions;
|
||||
import com.mojang.authlib.minecraft.SocialInteractionsService;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
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.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
@ClientOnlyMixin
|
||||
public class MinecraftMixin {
|
||||
@Inject(method = "createSocialInteractions", at = @At("HEAD"), cancellable = true)
|
||||
private void noSocialInteraction(CallbackInfoReturnable<SocialInteractionsService> cir) {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@ package org.embeddedt.modernfix.mixin.devenv;
|
|||
import com.mojang.text2speech.Narrator;
|
||||
import com.mojang.text2speech.NarratorDummy;
|
||||
import net.minecraft.client.gui.chat.NarratorChatListener;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(NarratorChatListener.class)
|
||||
@ClientOnlyMixin
|
||||
public class NarratorMixin {
|
||||
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lcom/mojang/text2speech/Narrator;getNarrator()Lcom/mojang/text2speech/Narrator;", remap = false))
|
||||
private Narrator useDummyNarrator() {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import net.minecraft.world.level.storage.WorldData;
|
|||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.ModernFixClient;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -18,6 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import java.util.function.Function;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
@ClientOnlyMixin
|
||||
public class MinecraftMixin {
|
||||
private long datapackReloadStartTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
|
@ -13,6 +14,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
@Mixin(ModelBakery.class)
|
||||
@ClientOnlyMixin
|
||||
public class ModelBakeryMixin {
|
||||
@Redirect(method = "uploadTextures", at = @At(value = "INVOKE", target = "Ljava/util/Set;forEach(Ljava/util/function/Consumer;)V", ordinal = 0))
|
||||
private void bakeAndTickGUI(Set instance, Consumer consumer) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import mezz.jei.startup.NetworkHandler;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.jei.async.JEILoadingInterruptedException;
|
||||
import org.embeddedt.modernfix.jei.async.JEIReloadThread;
|
||||
import org.embeddedt.modernfix.util.JEIUtil;
|
||||
|
|
@ -28,6 +30,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import java.util.List;
|
||||
|
||||
@Mixin(ClientLifecycleHandler.class)
|
||||
@RequiresMod("jei")
|
||||
@ClientOnlyMixin
|
||||
public class ClientLifecycleHandlerMixin {
|
||||
@Shadow(remap = false) @Final private JeiStarter starter;
|
||||
@Shadow(remap = false) @Final private List<IModPlugin> plugins;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import mezz.jei.api.runtime.IIngredientManager;
|
|||
import mezz.jei.gui.ingredients.IIngredientListElement;
|
||||
import mezz.jei.ingredients.IngredientListElementFactory;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.jei.async.IAsyncJeiStarter;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -12,6 +13,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(IngredientListElementFactory.class)
|
||||
@RequiresMod("jei")
|
||||
public class IngredientListElementFactoryMixin {
|
||||
private static int ingredientNum = 0;
|
||||
@Inject(method = "addToBaseList", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/NonNullList;add(Ljava/lang/Object;)Z"))
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package org.embeddedt.modernfix.mixin.perf.async_jei;
|
|||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(InputConstants.class)
|
||||
@RequiresMod("jei")
|
||||
public class InputConstantsMixin {
|
||||
@Redirect(method = "isKeyDown", at = @At(value = "INVOKE", target = "Lorg/lwjgl/glfw/GLFW;glfwGetKey(JI)I", remap = false))
|
||||
private static int offThreadKeyFetch(long win, int k) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import mezz.jei.ingredients.IIngredientSorter;
|
|||
import mezz.jei.load.PluginCaller;
|
||||
import mezz.jei.startup.JeiStarter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.jei.async.IAsyncJeiStarter;
|
||||
import org.embeddedt.modernfix.jei.async.JEILoadingInterruptedException;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -25,6 +26,7 @@ import java.util.concurrent.CompletionException;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
@Mixin(JeiStarter.class)
|
||||
@RequiresMod("jei")
|
||||
public class JeiStarterMixin {
|
||||
@Shadow(remap = false) private boolean started;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import mezz.jei.api.IModPlugin;
|
|||
import mezz.jei.load.PluginCaller;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.core.config.ModernFixConfig;
|
||||
import org.embeddedt.modernfix.jei.async.IAsyncJeiStarter;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -18,6 +19,7 @@ import java.util.concurrent.CompletionException;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
@Mixin(PluginCaller.class)
|
||||
@RequiresMod("jei")
|
||||
public class PluginCallerMixin {
|
||||
@Inject(method = "callOnPlugins", at = @At(value = "INVOKE", target = "Ljava/util/Iterator;hasNext()Z"), remap = false)
|
||||
private static void checkForInterrupt(String title, List<IModPlugin> plugins, Consumer<IModPlugin> func, CallbackInfo ci) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.mixin.perf.async_jei;
|
|||
import com.google.common.collect.ImmutableListMultimap;
|
||||
import mezz.jei.recipes.RecipeManagerInternal;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.jei.async.IAsyncJeiStarter;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -10,6 +11,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(RecipeManagerInternal.class)
|
||||
@RequiresMod("jei")
|
||||
public class RecipeManagerInternalMixin {
|
||||
@Inject(method = "addRecipes", at = @At(value = "INVOKE", target = "Lmezz/jei/recipes/RecipeManagerInternal;addRecipeTyped(Ljava/lang/Object;Lnet/minecraft/resources/ResourceLocation;)V"))
|
||||
private void checkForInterrupt(ImmutableListMultimap<ResourceLocation, Object> recipes, CallbackInfo ci) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.mixin.perf.blast_search_trees;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.searchtree.SearchRegistry;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.searchtree.DummySearchTree;
|
||||
import org.embeddedt.modernfix.searchtree.JEIBackedSearchTree;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
|
@ -13,6 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
@ClientOnlyMixin
|
||||
public class MinecraftMixin {
|
||||
@Shadow @Final private SearchRegistry searchRegistry;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.mixin.perf.cache_model_materials;
|
|||
import com.mojang.datafixers.util.Either;
|
||||
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||
import net.minecraft.client.resources.model.Material;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.duck.ICachedMaterialsModel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
@ -19,6 +20,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
@Mixin(BlockModel.class)
|
||||
@ClientOnlyMixin
|
||||
public class BlockModelMixin {
|
||||
@Shadow @Final @Mutable public Map<String, Either<Material, String>> textureMap;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.embeddedt.modernfix.mixin.perf.cache_model_materials;
|
|||
|
||||
import net.minecraft.client.renderer.block.model.multipart.MultiPart;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -10,6 +11,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import java.util.Collection;
|
||||
|
||||
@Mixin(MultiPart.class)
|
||||
@ClientOnlyMixin
|
||||
public class MultipartMixin {
|
||||
private Collection<ResourceLocation> dependencyCache = null;
|
||||
@Inject(method = "getDependencies", at = @At("HEAD"), cancellable = true)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import net.minecraft.client.resources.model.Material;
|
|||
import net.minecraft.client.renderer.block.model.MultiVariant;
|
||||
import net.minecraft.client.renderer.block.model.multipart.MultiPart;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.duck.ICachedMaterialsModel;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -19,6 +20,7 @@ import java.util.Set;
|
|||
import java.util.function.Function;
|
||||
|
||||
@Mixin(value = {MultiVariant.class, MultiPart.class, BlockModel.class})
|
||||
@ClientOnlyMixin
|
||||
public class VanillaModelMixin implements ICachedMaterialsModel {
|
||||
private Collection<Material> materialsCache = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.embeddedt.modernfix.mixin.perf.dedicated_reload_executor;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
|
@ -9,6 +10,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
import java.util.concurrent.Executor;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
@ClientOnlyMixin
|
||||
public class MinecraftMixin {
|
||||
@Redirect(method = { "<init>", "makeServerStem", "reloadResourcePacks" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;backgroundExecutor()Ljava/util/concurrent/Executor;", ordinal = 0))
|
||||
private Executor getResourceReloadExecutor() {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.mixin.perf.dynamic_resources;
|
|||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonElement;
|
||||
import net.minecraft.client.renderer.block.model.BlockElementFace;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.dynamicresources.UVController;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -11,6 +12,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
import java.lang.reflect.Type;
|
||||
|
||||
@Mixin(BlockElementFace.Deserializer.class)
|
||||
@ClientOnlyMixin
|
||||
public class BlockElementFaceDeserializerMixin {
|
||||
|
||||
@Redirect(method = "deserialize(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/client/renderer/block/model/BlockElementFace;",
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.dynamicresources.ModelLocationCache;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -27,6 +28,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Mixin(BlockModelShaper.class)
|
||||
@ClientOnlyMixin
|
||||
public class BlockModelShaperMixin {
|
||||
@Shadow @Final private ModelManager modelManager;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.item.Item;
|
|||
import net.minecraftforge.client.ItemModelMesherForge;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.dynamicresources.ModelLocationCache;
|
||||
import org.embeddedt.modernfix.util.ItemMesherMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
@ -23,6 +24,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
@Mixin(ItemModelMesherForge.class)
|
||||
@ClientOnlyMixin
|
||||
public abstract class ItemModelShaperMixin extends ItemModelShaper {
|
||||
@Shadow @Final @Mutable private Map<IRegistryDelegate<Item>, ModelResourceLocation> locations;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@ import net.minecraft.client.renderer.ItemModelShaper;
|
|||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ItemRenderer.class)
|
||||
@ClientOnlyMixin
|
||||
public class ItemRendererMixin {
|
||||
/**
|
||||
* Don't waste space putting all these locations into the cache, compute them on demand later.
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import net.minecraftforge.registries.ForgeRegistryEntry;
|
|||
import org.apache.commons.lang3.tuple.Triple;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.duck.IExtendedModelBakery;
|
||||
import org.embeddedt.modernfix.dynamicresources.*;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
|
|
@ -71,6 +72,7 @@ import java.util.stream.Stream;
|
|||
|
||||
/* high priority so that our injectors are added before other mods' */
|
||||
@Mixin(value = ModelBakery.class, priority = 600)
|
||||
@ClientOnlyMixin
|
||||
public abstract class ModelBakeryMixin implements IExtendedModelBakery {
|
||||
|
||||
private static final boolean debugDynamicModelLoading = Boolean.getBoolean("modernfix.debugDynamicModelLoading");
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.dynamicresources.DynamicModelBakeEvent;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -21,6 +23,8 @@ import java.util.Map;
|
|||
import java.util.function.BiFunction;
|
||||
|
||||
@Mixin(targets = { "appeng/core/Registration" })
|
||||
@RequiresMod("appliedenergistics2")
|
||||
@ClientOnlyMixin
|
||||
public class RegistrationMixin {
|
||||
private static Field customizerField;
|
||||
@Inject(method = "registerClientEvents", at = @At("TAIL"), remap = false)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
|||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.duck.IExtendedModelBakery;
|
||||
import org.embeddedt.modernfix.dynamicresources.DynamicModelBakeEvent;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
|
@ -36,6 +38,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
@Mixin(CTMPackReloadListener.class)
|
||||
@RequiresMod("ctm")
|
||||
@ClientOnlyMixin
|
||||
public abstract class CTMPackReloadListenerMixin {
|
||||
/* caches the original render checks */
|
||||
@Shadow @Final private static Map<IRegistryDelegate<Block>, Predicate<RenderType>> blockRenderChecks;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.dynamicresources.DynamicModelBakeEvent;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -28,6 +30,8 @@ import java.io.IOException;
|
|||
import java.util.*;
|
||||
|
||||
@Mixin(TextureMetadataHandler.class)
|
||||
@RequiresMod("ctm")
|
||||
@ClientOnlyMixin
|
||||
public abstract class TextureMetadataHandlerMixin {
|
||||
|
||||
@Shadow @Nonnull protected abstract BakedModel wrap(ResourceLocation loc, UnbakedModel model, BakedModel object, ModelLoader loader) throws IOException;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import com.refinedmods.refinedstorage.setup.ClientSetup;
|
|||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.dynamicresources.DynamicModelBakeEvent;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -14,6 +16,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ClientSetup.class)
|
||||
@RequiresMod("refinedstorage")
|
||||
@ClientOnlyMixin
|
||||
public class ClientSetupMixin {
|
||||
@Shadow @Final private BakedModelOverrideRegistry bakedModelOverrideRegistry;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.dynamicresources.DynamicModelBakeEvent;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -25,6 +27,8 @@ import java.util.function.Supplier;
|
|||
import java.util.stream.Stream;
|
||||
|
||||
@Mixin(ClientRegistrationHandler.class)
|
||||
@RequiresMod("supermartijn642corelib")
|
||||
@ClientOnlyMixin
|
||||
public class ClientRegistrationHandlerMixin {
|
||||
@Shadow @Final private List<Pair<Supplier<Stream<ResourceLocation>>, Function<BakedModel, BakedModel>>> modelOverwrites;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.mixin.perf.faster_font_loading;
|
|||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import net.minecraft.client.gui.font.providers.LegacyUnicodeBitmapsProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
@ -21,6 +22,7 @@ import java.util.Map;
|
|||
* only to do it again later.
|
||||
*/
|
||||
@Mixin(LegacyUnicodeBitmapsProvider.class)
|
||||
@ClientOnlyMixin
|
||||
public abstract class LegacyUnicodeBitmapsProviderMixin {
|
||||
@Shadow protected abstract ResourceLocation getSheetLocation(int i);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import net.minecraftforge.client.ForgeHooksClient;
|
|||
import net.minecraftforge.fml.ModLoader;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -28,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
@Mixin(TextureAtlas.class)
|
||||
@ClientOnlyMixin
|
||||
public abstract class TextureAtlasMixin {
|
||||
@Shadow protected abstract ResourceLocation getResourceLocation(ResourceLocation location);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
|||
import net.minecraft.client.renderer.texture.Stitcher;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.textures.StbStitcher;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -20,6 +21,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
@Mixin(Stitcher.class)
|
||||
@ClientOnlyMixin
|
||||
public class StitcherMixin {
|
||||
@Shadow @Final private Set<Stitcher.Holder> texturesToBeStitched;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import jeresources.entry.VillagerEntry;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.entity.npc.Villager;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -13,6 +14,7 @@ import java.lang.ref.WeakReference;
|
|||
|
||||
/* Cache the created villager instead of reconstructing it every time */
|
||||
@Mixin(VillagerEntry.class)
|
||||
@RequiresMod("jeresources")
|
||||
public class VillagerEntryMixin {
|
||||
private WeakReference<Villager> cachedVillager = new WeakReference<>(null);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.mixin.perf.kubejs;
|
|||
import dev.latvian.kubejs.item.ItemStackJS;
|
||||
import dev.latvian.kubejs.item.ingredient.CustomIngredient;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.duck.ICachedIngredientJS;
|
||||
import org.embeddedt.modernfix.util.KubeUtil;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
|
@ -11,6 +12,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
import java.util.Set;
|
||||
|
||||
@Mixin(CustomIngredient.class)
|
||||
@RequiresMod("kubejs")
|
||||
public abstract class CustomIngredientMixin implements ICachedIngredientJS {
|
||||
@Shadow @Final private Ingredient ingredient;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.embeddedt.modernfix.mixin.perf.kubejs;
|
|||
import dev.latvian.kubejs.recipe.RecipeJS;
|
||||
import dev.latvian.kubejs.recipe.filter.IDFilter;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.util.KubeUtil;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -10,6 +11,7 @@ import org.spongepowered.asm.mixin.Overwrite;
|
|||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(IDFilter.class)
|
||||
@RequiresMod("kubejs")
|
||||
public class IDFilterMixin {
|
||||
@Shadow @Final private ResourceLocation id;
|
||||
private RecipeJS _target;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import dev.latvian.kubejs.recipe.filter.RecipeFilter;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.crafting.RecipeManager;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.util.KubeUtil;
|
||||
import org.embeddedt.modernfix.util.ModUtil;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
|
@ -27,6 +28,7 @@ import java.util.function.Consumer;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Mixin(RecipeEventJS.class)
|
||||
@RequiresMod("kubejs")
|
||||
public class RecipeEventJSMixin {
|
||||
@Shadow(remap = false) @Final private List<RecipeJS> originalRecipes;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import dev.latvian.kubejs.item.ingredient.TagIngredientJS;
|
|||
import dev.latvian.kubejs.recipe.RecipeJS;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.duck.ICachedIngredientJS;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -14,6 +15,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
import java.util.Set;
|
||||
|
||||
@Mixin(RecipeJS.class)
|
||||
@RequiresMod("kubejs")
|
||||
public class RecipeJSMixin {
|
||||
/**
|
||||
* @author embeddedt
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import dev.latvian.kubejs.item.ingredient.IngredientJS;
|
|||
import dev.latvian.kubejs.item.ingredient.TagIngredientJS;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.world.item.Item;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.duck.ICachedIngredientJS;
|
||||
import org.embeddedt.modernfix.util.KubeUtil;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -16,6 +17,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import java.util.Set;
|
||||
|
||||
@Mixin(TagIngredientJS.class)
|
||||
@RequiresMod("kubejs")
|
||||
public abstract class TagIngredientJSMixin implements ICachedIngredientJS {
|
||||
@Shadow public abstract Tag<Item> getActualTag();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import dev.latvian.kubejs.server.TagEventJS;
|
|||
import dev.latvian.kubejs.util.UtilsJS;
|
||||
import me.shedaniel.architectury.registry.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.embeddedt.modernfix.util.KubeUtil;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -18,6 +19,7 @@ import java.util.regex.Pattern;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Mixin(TagEventJS.TagWrapper.class)
|
||||
@RequiresMod("kubejs")
|
||||
public class TagWrapperMixin<T> {
|
||||
private String currentPatternStr = null;
|
||||
@Inject(method = "add", at = @At(value = "INVOKE", target = "Lme/shedaniel/architectury/registry/Registry;getIds()Ljava/util/Set;", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD, remap = false)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraftforge.client.model.obj.MaterialLibrary;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJModel;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -16,6 +17,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Mixin(OBJLoader.class)
|
||||
@ClientOnlyMixin
|
||||
public class OBJLoaderMixin {
|
||||
@Final
|
||||
@Mutable
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.client.renderer.block.model.multipart.Selector;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -13,6 +14,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
@Mixin(Selector.class)
|
||||
@ClientOnlyMixin
|
||||
public class SelectorMixin {
|
||||
private ConcurrentHashMap<StateDefinition<Block, BlockState>, Predicate<BlockState>> predicateCache = new ConcurrentHashMap<>();
|
||||
@Inject(method = "getPredicate", at = @At("HEAD"), cancellable = true)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.embeddedt.modernfix.mixin.perf.model_optimizations;
|
|||
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.mojang.math.Transformation;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
|
@ -10,6 +11,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
import java.util.Objects;
|
||||
|
||||
@Mixin(Transformation.class)
|
||||
@ClientOnlyMixin
|
||||
public class TransformationMatrixMixin {
|
||||
@Shadow @Final private Matrix4f matrix;
|
||||
private Integer cachedHashCode = null;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.Items;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -23,6 +25,8 @@ import java.lang.reflect.Field;
|
|||
import java.util.List;
|
||||
|
||||
@Mixin(ClientBookRegistry.class)
|
||||
@RequiresMod("patchouli")
|
||||
@ClientOnlyMixin
|
||||
public class ClientBookRegistryMixin {
|
||||
@Inject(method = "reload", at = @At("RETURN"), remap = false)
|
||||
private void performDeduplication(CallbackInfo ci) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import net.minecraft.server.packs.repository.Pack;
|
|||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.world.level.DataPackConfig;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.duck.reuse_datapacks.ICachingResourceClient;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
@ -24,6 +25,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.Executor;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
@ClientOnlyMixin
|
||||
public abstract class MinecraftMixin implements ICachingResourceClient {
|
||||
@Shadow public abstract boolean isLocalServer();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import net.minecraft.server.MinecraftServer;
|
|||
import net.minecraft.server.ServerResources;
|
||||
import net.minecraft.server.packs.repository.Pack;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.duck.reuse_datapacks.ICachingResourceClient;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -14,6 +15,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
@ClientOnlyMixin
|
||||
public class MinecraftServerMixin {
|
||||
|
||||
@Shadow @Final private PackRepository packRepository;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import net.minecraft.world.level.storage.WorldData;
|
|||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.ModernFixClient;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.duck.ILevelSave;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -23,6 +24,7 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.function.Function;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
@ClientOnlyMixin
|
||||
public abstract class MinecraftMixin {
|
||||
@Shadow public abstract Minecraft.ServerStem makeServerStem(RegistryAccess.RegistryHolder dynamicRegistries, Function<LevelStorageSource.LevelStorageAccess, DataPackConfig> worldStorageToDatapackFunction, Function4<LevelStorageSource.LevelStorageAccess, RegistryAccess.RegistryHolder, ResourceManager, DataPackConfig, WorldData> quadFunction, boolean vanillaOnly, LevelStorageSource.LevelStorageAccess worldStorage) throws InterruptedException, ExecutionException;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
|
|||
import net.minecraft.world.level.storage.WorldData;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.core.config.ModernFixConfig;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
@ -19,6 +20,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(IntegratedServer.class)
|
||||
@ClientOnlyMixin
|
||||
public class IntegratedServerMixin {
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void adjustServerPriority(Thread pServerThread, Minecraft pMinecraft, RegistryAccess.RegistryHolder pRegistryHolder, LevelStorageSource.LevelStorageAccess pStorageSource, PackRepository pPackRepository, ServerResources pResources, WorldData pWorldData, MinecraftSessionService pSessionService, GameProfileRepository pProfileRepository, GameProfileCache pProfileCache, ChunkProgressListenerFactory pProgressListenerfactory, CallbackInfo ci) {
|
||||
|
|
|
|||
|
|
@ -4,11 +4,15 @@ import com.thenatekirby.jepb.plugin.PiglinBarteringRecipeBuilder;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(PiglinBarteringRecipeBuilder.class)
|
||||
@RequiresMod("jepb")
|
||||
@ClientOnlyMixin
|
||||
public class PiglinBarteringRecipeBuilderMixin {
|
||||
@Redirect(method = "getManager(Lnet/minecraft/world/level/Level;)Lnet/minecraft/world/level/storage/loot/LootTables;", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getServer()Lnet/minecraft/server/MinecraftServer;"))
|
||||
private static MinecraftServer useIntegrated(Level level) {
|
||||
|
|
|
|||
|
|
@ -4,11 +4,15 @@ import jeresources.util.LootTableHelper;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.annotation.RequiresMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(LootTableHelper.class)
|
||||
@RequiresMod("jeresources")
|
||||
@ClientOnlyMixin
|
||||
public class LootTableHelperMixin {
|
||||
@Redirect(method = "getManager(Lnet/minecraft/world/level/Level;)Lnet/minecraft/world/level/storage/loot/LootTables;", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getServer()Lnet/minecraft/server/MinecraftServer;"))
|
||||
private static MinecraftServer useIntegrated(Level level) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.client.color.block.BlockColor;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -13,6 +14,7 @@ import java.util.concurrent.locks.Lock;
|
|||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@Mixin(value = BlockColors.class, priority = 700)
|
||||
@ClientOnlyMixin
|
||||
public class BlockColorsMixin {
|
||||
private Lock mapLock = new ReentrantLock();
|
||||
@Inject(method = "register", at = @At("HEAD"))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.embeddedt.modernfix.mixin.safety;
|
||||
|
||||
import net.minecraft.client.color.item.ItemColors;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -10,6 +11,7 @@ import java.util.concurrent.locks.Lock;
|
|||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@Mixin(value = ItemColors.class, priority = 700)
|
||||
@ClientOnlyMixin
|
||||
public class ItemColorsMixin {
|
||||
private Lock mapLock = new ReentrantLock();
|
||||
@Inject(method = "register", at = @At("HEAD"))
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
package org.embeddedt.modernfix.packet;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
import net.minecraftforge.fml.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.network.simple.SimpleChannel;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.ModernFixClient;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class PacketHandler {
|
||||
private static final String PROTOCOL_VERSION = "1";
|
||||
public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
|
||||
|
|
@ -17,6 +22,10 @@ public class PacketHandler {
|
|||
|
||||
public static void register() {
|
||||
int id = 1;
|
||||
INSTANCE.registerMessage(id++, EntityIDSyncPacket.class, EntityIDSyncPacket::serialize, EntityIDSyncPacket::deserialize, ModernFixClient::handleEntityIDSync);
|
||||
INSTANCE.registerMessage(id++, EntityIDSyncPacket.class, EntityIDSyncPacket::serialize, EntityIDSyncPacket::deserialize, PacketHandler::handleSyncPacket);
|
||||
}
|
||||
|
||||
private static void handleSyncPacket(EntityIDSyncPacket packet, Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ModernFixClient.handleEntityIDSync(packet, contextSupplier));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,135 +6,7 @@
|
|||
"compatibilityLevel": "JAVA_8",
|
||||
"refmap": "modernfix.refmap.json",
|
||||
"mixins": [
|
||||
"core.BootstrapMixin",
|
||||
"bugfix.edge_chunk_not_saved.ChunkManagerMixin",
|
||||
"bugfix.starlight_emptiness.StarLightEngineMixin",
|
||||
"bugfix.paper_chunk_patches.ChunkMapMixin",
|
||||
"bugfix.paper_chunk_patches.ChunkHolderMixin",
|
||||
"bugfix.paper_chunk_patches.SortedArraySetMixin",
|
||||
"perf.dynamic_structure_manager.StructureManagerMixin",
|
||||
"bugfix.tf_cme_on_load.TwilightForestModMixin",
|
||||
"bugfix.refinedstorage.te_bug.ItemExternalStorageProviderMixin",
|
||||
"bugfix.refinedstorage.te_bug.FluidExternalStorageProviderMixin",
|
||||
"bugfix.refinedstorage.te_bug.FluidExternalStorageCacheMixin",
|
||||
"bugfix.refinedstorage.te_bug.FluidExternalStorageMixin",
|
||||
"bugfix.refinedstorage.te_bug.ItemExternalStorageCacheMixin",
|
||||
"bugfix.refinedstorage.te_bug.ItemExternalStorageMixin",
|
||||
"bugfix.remove_block_chunkloading.RemoveBlockGoalMixin",
|
||||
"bugfix.chunk_deadlock.ServerChunkCacheMixin",
|
||||
"bugfix.chunk_deadlock.valhesia.BlockStateBaseMixin",
|
||||
"perf.dedicated_reload_executor.MinecraftServerMixin",
|
||||
"perf.dynamic_dfu.DataFixersMixin",
|
||||
"perf.remove_biome_temperature_cache.BiomeMixin",
|
||||
"perf.resourcepacks.ModFileResourcePackMixin",
|
||||
"perf.resourcepacks.VanillaPackMixin",
|
||||
"perf.skip_first_datapack_reload.LevelSaveMixin",
|
||||
"perf.skip_first_datapack_reload.SaveFormatAccessor",
|
||||
"perf.boost_worker_count.UtilMixin",
|
||||
"perf.thread_priorities.UtilMixin",
|
||||
"perf.reduce_blockstate_cache_rebuilds.GameDataMixin",
|
||||
"perf.reduce_blockstate_cache_rebuilds.BlockCallbacksMixin",
|
||||
"perf.reduce_blockstate_cache_rebuilds.BlocksMixin",
|
||||
"perf.reduce_blockstate_cache_rebuilds.BlockStateBaseMixin",
|
||||
"perf.deduplicate_location.MixinResourceLocation",
|
||||
"perf.compress_biome_container.MixinBiomeContainer",
|
||||
"perf.nuke_empty_chunk_sections.MixinChunk",
|
||||
"perf.cache_blockstate_cache_arrays.AbstractBlockStateCacheMixin",
|
||||
"perf.datapack_reload_exceptions.LootTableManagerMixin",
|
||||
"perf.datapack_reload_exceptions.RecipeManagerMixin",
|
||||
"perf.async_locator.CommandSourceStackAccess",
|
||||
"perf.async_locator.DolphinSwimToTreasureGoalMixin",
|
||||
"perf.async_locator.EnderEyeItemMixin",
|
||||
"perf.async_locator.ExplorationMapFunctionMixin",
|
||||
"perf.async_locator.EyeOfEnderAccess",
|
||||
"perf.async_locator.EyeOfEnderMixin",
|
||||
"perf.async_locator.LocateCommandAccess",
|
||||
"perf.async_locator.LocateCommandMixin",
|
||||
"perf.async_locator.MapItemAccess",
|
||||
"perf.async_locator.MerchantOfferAccess",
|
||||
"perf.async_locator.TreasureMapForEmeraldsMixin",
|
||||
"feature.measure_time.BootstrapMixin",
|
||||
"feature.measure_time.SimpleReloadableResourceManagerMixin",
|
||||
"feature.measure_time.ProfiledReloadInstanceMixin",
|
||||
"feature.branding.BrandingControlMixin",
|
||||
"feature.direct_stack_trace.CrashReportMixin",
|
||||
"perf.kubejs.TagIngredientJSMixin",
|
||||
"perf.kubejs.TagWrapperMixin",
|
||||
"perf.kubejs.RecipeEventJSMixin",
|
||||
"perf.kubejs.RecipeJSMixin",
|
||||
"perf.kubejs.IDFilterMixin",
|
||||
"perf.kubejs.CustomIngredientMixin",
|
||||
"perf.nbt_memory_usage.CompoundTagMixin",
|
||||
"perf.fast_registry_validation.ForgeRegistryMixin",
|
||||
"perf.rewrite_registry.ForgeRegistryMixin",
|
||||
"perf.rewrite_registry.ForgeRegistrySnapshotMixin",
|
||||
"perf.fast_registry_validation.ResourceKeyMixin",
|
||||
"perf.cache_strongholds.ChunkGeneratorMixin",
|
||||
"perf.cache_upgraded_structures.StructureManagerMixin",
|
||||
"perf.cache_strongholds.ServerLevelMixin",
|
||||
"perf.state_definition_construct.StateDefinitionMixin",
|
||||
"perf.biome_zoomer.FuzzyOffsetBiomeZoomerMixin",
|
||||
"perf.compress_blockstate.BlockStateBaseMixin",
|
||||
"perf.compress_blockstate.BlockBehaviourMixin",
|
||||
"perf.remove_spawn_chunks.ServerChunkCacheAccessor",
|
||||
"perf.remove_spawn_chunks.MinecraftServerMixin",
|
||||
"perf.remove_spawn_chunks.ServerLevelMixin",
|
||||
"devenv.GameDataMixin"
|
||||
],
|
||||
"client": [
|
||||
"core.MinecraftMixin",
|
||||
"core.SynchedEntityDataMixin",
|
||||
"feature.measure_time.MinecraftMixin",
|
||||
"feature.reduce_loading_screen_freezes.ModelBakeryMixin",
|
||||
"perf.skip_first_datapack_reload.MinecraftMixin",
|
||||
"bugfix.preserve_early_window_pos.WindowMixin",
|
||||
"bugfix.concurrency.RenderTypeMixin",
|
||||
"bugfix.concurrency.MinecraftMixin",
|
||||
"bugfix.concurrency.StaticTagHelperMixin",
|
||||
"perf.dedicated_reload_executor.MinecraftMixin",
|
||||
"perf.dynamic_resources.BlockElementFaceDeserializerMixin",
|
||||
"perf.dynamic_resources.BlockModelShaperMixin",
|
||||
"perf.dynamic_resources.ItemModelShaperMixin",
|
||||
"perf.dynamic_resources.ItemRendererMixin",
|
||||
"perf.dynamic_resources.ModelBakeryMixin",
|
||||
"perf.dynamic_resources.ae2.RegistrationMixin",
|
||||
"perf.dynamic_resources.rs.ClientSetupMixin",
|
||||
"perf.dynamic_resources.ctm.TextureMetadataHandlerMixin",
|
||||
"perf.dynamic_resources.ctm.CTMPackReloadListenerMixin",
|
||||
"perf.dynamic_resources.supermartijncore.ClientRegistrationHandlerMixin",
|
||||
"perf.model_optimizations.OBJLoaderMixin",
|
||||
"perf.model_optimizations.SelectorMixin",
|
||||
"perf.model_optimizations.TransformationMatrixMixin",
|
||||
"perf.model_optimizations.BooleanPropertyMixin",
|
||||
"perf.model_optimizations.PropertyMixin",
|
||||
"perf.patchouli_deduplicate_books.ClientBookRegistryMixin",
|
||||
"perf.async_jei.InputConstantsMixin",
|
||||
"perf.async_jei.IngredientListElementFactoryMixin",
|
||||
"perf.async_jei.ClientLifecycleHandlerMixin",
|
||||
"perf.async_jei.JeiStarterMixin",
|
||||
"perf.async_jei.PluginCallerMixin",
|
||||
"perf.async_jei.RecipeManagerInternalMixin",
|
||||
"perf.thread_priorities.IntegratedServerMixin",
|
||||
"safety.BlockColorsMixin",
|
||||
"safety.ItemColorsMixin",
|
||||
"perf.blast_search_trees.MinecraftMixin",
|
||||
"perf.blast_search_trees.IngredientFilterInvoker",
|
||||
"perf.cache_model_materials.VanillaModelMixin",
|
||||
"perf.cache_model_materials.BlockModelMixin",
|
||||
"perf.cache_model_materials.MultipartMixin",
|
||||
"perf.faster_texture_stitching.StitcherMixin",
|
||||
"perf.faster_texture_loading.TextureAtlasMixin",
|
||||
"perf.faster_font_loading.LegacyUnicodeBitmapsProviderMixin",
|
||||
"bugfix.packet_leak.ClientPlayNetHandlerMixin",
|
||||
"bugfix.packet_leak.SCustomPayloadPlayPacketMixin",
|
||||
"perf.reuse_datapacks.MinecraftMixin",
|
||||
"perf.reuse_datapacks.MinecraftServerMixin",
|
||||
"perf.use_integrated_resources.jeresources.LootTableHelperMixin",
|
||||
"perf.use_integrated_resources.jepb.PiglinBarteringRecipeBuilderMixin",
|
||||
"perf.jeresources_startup.VillagerEntryMixin",
|
||||
"bugfix.mc218112.SynchedEntityDataMixin_Client",
|
||||
"devenv.MinecraftMixin",
|
||||
"devenv.NarratorMixin"
|
||||
${mixin_classes}
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user