> cir) {
+ if (!PatcherConfig.tooltipCache) {
+ return;
+ }
+ TooltipHandler.INSTANCE.tooltipCache = cir.getReturnValue();
+ TooltipHandler.INSTANCE.shouldToolTipRender = false;
+ }
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/MathHelperMixin_CompactLUT.java b/src/main/java/club/sk1er/patcher/mixins/performance/MathHelperMixin_CompactLUT.java
new file mode 100644
index 000000000..c7ca61bf0
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/MathHelperMixin_CompactLUT.java
@@ -0,0 +1,28 @@
+package club.sk1er.patcher.mixins.performance;
+
+import me.jellysquid.mods.lithium.common.util.math.CompactSineLUT;
+import net.minecraft.util.MathHelper;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Overwrite;
+
+@Mixin(MathHelper.class)
+public class MathHelperMixin_CompactLUT {
+
+ /**
+ * @author Wyvest
+ * @reason Use a compact LUT for sine calculations
+ */
+ @Overwrite
+ public static float sin(float f) {
+ return CompactSineLUT.sin(f);
+ }
+
+ /**
+ * @author Wyvest
+ * @reason Use a compact LUT for cosine calculations
+ */
+ @Overwrite
+ public static float cos(float f) {
+ return CompactSineLUT.cos(f);
+ }
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/RenderChunkMixin_OptimizeSpecialTileEntities.java b/src/main/java/club/sk1er/patcher/mixins/performance/RenderChunkMixin_OptimizeSpecialTileEntities.java
new file mode 100644
index 000000000..7589ba8bd
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/RenderChunkMixin_OptimizeSpecialTileEntities.java
@@ -0,0 +1,29 @@
+package club.sk1er.patcher.mixins.performance;
+
+import net.minecraft.client.renderer.chunk.CompiledChunk;
+import net.minecraft.client.renderer.chunk.RenderChunk;
+import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+@Mixin(RenderChunk.class)
+public class RenderChunkMixin_OptimizeSpecialTileEntities {
+//#if MC==10809
+ /**
+ * Minecraft typically renders special tile entities twice per frame. This is noticeable by comparing the opacity
+ * of a beacon beam when the beacon is in view versus when it's out of view (fly 50 blocks above, for instance).
+ *
+ * This fix is based off a Forge PR that was added to 1.11.x:
+ * forge PR
+ */
+ @Redirect(method = "rebuildChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/chunk/CompiledChunk;addTileEntity(Lnet/minecraft/tileentity/TileEntity;)V"))
+ private void patcher$renderSpecialTileEntitiesOnce(CompiledChunk instance, TileEntity tileEntityIn) {
+ TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileEntityIn);
+ if (!tileentityspecialrenderer.forceTileEntityRender()) instance.addTileEntity(tileEntityIn);
+ }
+//#endif
+}
+
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/SimpleReloadableResourceManager_OnlyRefreshNecessaryListeners.java b/src/main/java/club/sk1er/patcher/mixins/performance/SimpleReloadableResourceManager_OnlyRefreshNecessaryListeners.java
new file mode 100644
index 000000000..7b8f32374
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/SimpleReloadableResourceManager_OnlyRefreshNecessaryListeners.java
@@ -0,0 +1,51 @@
+package club.sk1er.patcher.mixins.performance;
+
+import club.sk1er.patcher.hooks.ResourceReloadHooks;
+import net.minecraft.client.resources.IResourceManagerReloadListener;
+import net.minecraft.client.resources.LanguageManager;
+import net.minecraft.client.resources.SimpleReloadableResourceManager;
+import net.minecraft.client.resources.model.ModelManager;
+import org.spongepowered.asm.mixin.Final;
+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.Redirect;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import java.util.List;
+
+@Mixin(SimpleReloadableResourceManager.class)
+public class SimpleReloadableResourceManager_OnlyRefreshNecessaryListeners {
+
+ @Shadow
+ @Final
+ private List reloadListeners;
+
+ @Inject(method = "registerReloadListener", at = @At("HEAD"))
+ private void onReloadListenerRegister(IResourceManagerReloadListener reloadListener, CallbackInfo ci) {
+ if (reloadListener instanceof LanguageManager) {
+ ResourceReloadHooks.setLanguageManager(reloadListener);
+ } else if (reloadListener instanceof ModelManager) {
+ ResourceReloadHooks.setModelManager(reloadListener);
+ }
+ }
+
+ @Redirect(method = "notifyReloadListeners", at = @At(value = "FIELD", target = "Lnet/minecraft/client/resources/SimpleReloadableResourceManager;reloadListeners:Ljava/util/List;"))
+ private List redirectNotifyReloadListeners(SimpleReloadableResourceManager simpleReloadableResourceManager) {
+ if (ResourceReloadHooks.shouldLoadLanguage()) {
+ return ResourceReloadHooks.getLanguageManager();
+ } else if (ResourceReloadHooks.shouldLoadMipmaps()) {
+ return ResourceReloadHooks.getModelManager();
+ } else {
+ return reloadListeners;
+ }
+ }
+
+ @Inject(method = "notifyReloadListeners", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/ProgressManager;pop(Lnet/minecraftforge/fml/common/ProgressManager$ProgressBar;)V"))
+ private void callOptiFineLanguage(CallbackInfo ci) {
+ if (ResourceReloadHooks.shouldLoadLanguage()) {
+ ResourceReloadHooks.reloadOptiFineLanguage();
+ }
+ }
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/TextureManagerMixin_MemoryLeak.java b/src/main/java/club/sk1er/patcher/mixins/performance/TextureManagerMixin_MemoryLeak.java
new file mode 100644
index 000000000..80cc32880
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/TextureManagerMixin_MemoryLeak.java
@@ -0,0 +1,27 @@
+package club.sk1er.patcher.mixins.performance;
+
+import net.minecraft.client.renderer.texture.ITextureObject;
+import net.minecraft.client.renderer.texture.TextureManager;
+import net.minecraft.util.ResourceLocation;
+import org.spongepowered.asm.mixin.Final;
+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;
+
+import java.util.Map;
+
+@Mixin(TextureManager.class)
+public class TextureManagerMixin_MemoryLeak {
+ //#if MC==10809
+ @Shadow
+ @Final
+ private Map mapTextureObjects;
+
+ @Inject(method = "deleteTexture", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureUtil;deleteTexture(I)V", shift = At.Shift.BEFORE))
+ private void patcher$removeEntry(ResourceLocation textureLocation, CallbackInfo ci) {
+ this.mapTextureObjects.remove(textureLocation);
+ }
+ //#endif
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/forge/ASMDataTableMixin_ComputeParallel.java b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ASMDataTableMixin_ComputeParallel.java
new file mode 100644
index 000000000..bd90d4cc6
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ASMDataTableMixin_ComputeParallel.java
@@ -0,0 +1,43 @@
+package club.sk1er.patcher.mixins.performance.forge;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSetMultimap;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+import net.minecraftforge.fml.common.ModContainer;
+import net.minecraftforge.fml.common.discovery.ASMDataTable;
+import org.apache.commons.lang3.tuple.Pair;
+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.CallbackInfoReturnable;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Mixin(value = ASMDataTable.class, remap = false)
+public class ASMDataTableMixin_ComputeParallel {
+ //#if MC==10809
+ @Shadow
+ private Map> containerAnnotationData;
+
+ @Shadow
+ private List containers;
+
+ @Shadow
+ private SetMultimap globalAnnotationData;
+
+ @Inject(method = "getAnnotationsFor", at = @At("HEAD"))
+ private void computeParallel(ModContainer container, CallbackInfoReturnable> cir) {
+ if (containerAnnotationData == null) {
+ //concurrently filter the values to speed this up
+ containerAnnotationData = containers.parallelStream()
+ .map(cont -> Pair.of(cont, ImmutableSetMultimap.copyOf(Multimaps.filterValues(globalAnnotationData, data -> cont.getSource().equals(data.getCandidate().getModContainer())))))
+ .collect(Collectors.toMap(Pair::getKey, Pair::getValue));
+ containerAnnotationData = ImmutableMap.copyOf(containerAnnotationData);
+ }
+ }
+ //#endif
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/forge/FMLControlledNamespacedRegistryMixin_TrimAvailabilityMap.java b/src/main/java/club/sk1er/patcher/mixins/performance/forge/FMLControlledNamespacedRegistryMixin_TrimAvailabilityMap.java
new file mode 100644
index 000000000..cfa6b2cd9
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/forge/FMLControlledNamespacedRegistryMixin_TrimAvailabilityMap.java
@@ -0,0 +1,44 @@
+package club.sk1er.patcher.mixins.performance.forge;
+
+//#if MC==10809
+import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry;
+//#endif
+
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.fml.relauncher.ReflectionHelper;
+import org.spongepowered.asm.mixin.Final;
+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.ModifyArg;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import java.util.BitSet;
+
+@Mixin(
+ //#if MC==10809
+ value = FMLControlledNamespacedRegistry.class, remap = false
+ //#else
+ //$$ net.minecraft.client.Minecraft.class
+ //#endif
+)
+public class FMLControlledNamespacedRegistryMixin_TrimAvailabilityMap {
+ //#if MC==10809
+ @Shadow @Final private BitSet availabilityMap;
+
+ @ModifyArg(method = "(Lnet/minecraft/util/ResourceLocation;IILjava/lang/Class;ZLnet/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry$AddCallback;)V", at = @At(value = "NEW", target = "Ljava/util/BitSet;(I)V"), index = 0)
+ public int noPreAllocate(int nbits) {
+ return Math.min(nbits, 0xFFFF);
+ }
+
+ @Inject(method = "validateContent", at = @At("HEAD"))
+ public void trimToSize(ResourceLocation registryName, CallbackInfo ci) {
+ try {
+ ReflectionHelper.findMethod(BitSet.class, this.availabilityMap, new String[]{"trimToSize"}).invoke(this.availabilityMap);
+ } catch (Exception ignored) {
+
+ }
+ }
+ //#endif
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/forge/ItemLayerModelMixin_ReduceQuadCount.java b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ItemLayerModelMixin_ReduceQuadCount.java
index 048d80a88..64597ed7e 100644
--- a/src/main/java/club/sk1er/patcher/mixins/performance/forge/ItemLayerModelMixin_ReduceQuadCount.java
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ItemLayerModelMixin_ReduceQuadCount.java
@@ -1,5 +1,6 @@
package club.sk1er.patcher.mixins.performance.forge;
+import club.sk1er.patcher.config.PatcherConfig;
import club.sk1er.patcher.hooks.FaceDataHook;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
@@ -26,7 +27,7 @@ public abstract class ItemLayerModelMixin_ReduceQuadCount {
//#if MC==10809
@Unique
- private static final EnumFacing[] patcher$HORIZONTALS = new EnumFacing[] { EnumFacing.UP, EnumFacing.DOWN };;
+ private static final EnumFacing[] patcher$HORIZONTALS = new EnumFacing[] { EnumFacing.UP, EnumFacing.DOWN };
@Unique
private static final EnumFacing[] patcher$VERTICALS = new EnumFacing[] { EnumFacing.WEST, EnumFacing.EAST };
@@ -200,12 +201,12 @@ else if (!building && face) {
float u3 = 16.0f * (x2 - dx);
float v2 = 16.0f * (1.0f - y0 - dy);
float v3 = 16.0f * (1.0f - y2 - dy);
- cir.setReturnValue(buildQuad(format, transform, patcher$remap(side), tint, x0, y0, z0, sprite.getInterpolatedU((double)u2), sprite.getInterpolatedV((double)v2), x2, y2, z0, sprite.getInterpolatedU((double)u3), sprite.getInterpolatedV((double)v3), x2, y2, z2, sprite.getInterpolatedU((double)u3), sprite.getInterpolatedV((double)v3), x0, y0, z2, sprite.getInterpolatedU((double)u2), sprite.getInterpolatedV((double)v2)));
+ cir.setReturnValue(buildQuad(format, transform, patcher$remap(side), tint, x0, y0, z0, sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v2), x2, y2, z0, sprite.getInterpolatedU(u3), sprite.getInterpolatedV(v3), x2, y2, z2, sprite.getInterpolatedU(u3), sprite.getInterpolatedV(v3), x0, y0, z2, sprite.getInterpolatedU(u2), sprite.getInterpolatedV(v2)));
}
@Unique
private static EnumFacing patcher$remap(EnumFacing side) {
- return (side.getAxis() == EnumFacing.Axis.Y) ? side.getOpposite() : side;
+ return !PatcherConfig.heldItemLighting || (side.getAxis() == EnumFacing.Axis.Y) ? side.getOpposite() : side;
}
//#endif
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/forge/JarDiscovererMixin_ReplaceRegex.java b/src/main/java/club/sk1er/patcher/mixins/performance/forge/JarDiscovererMixin_ReplaceRegex.java
new file mode 100644
index 000000000..573e85bee
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/forge/JarDiscovererMixin_ReplaceRegex.java
@@ -0,0 +1,40 @@
+package club.sk1er.patcher.mixins.performance.forge;
+
+import net.minecraftforge.fml.common.discovery.ITypeDiscoverer;
+import net.minecraftforge.fml.common.discovery.JarDiscoverer;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Unique;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Mixin(value = JarDiscoverer.class, remap = false)
+public class JarDiscovererMixin_ReplaceRegex { // todo i cba to put this in directorydiscoverer as well
+
+ @Unique private static final Matcher patcher$dummyMatcher = ITypeDiscoverer.classFile.matcher("null");
+
+ @Unique
+ private static final String patcher$replaceRegexMethod =
+ //#if MC==10809
+ "discover";
+ //#else
+ //$$ "findClassesASM";
+ //#endif
+
+ @Unique private String patcher$fileName;
+
+ @Redirect(method = patcher$replaceRegexMethod, at = @At(value = "INVOKE", target = "Ljava/util/regex/Pattern;matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;"))
+ private Matcher patcher$replaceRegex(Pattern instance, CharSequence input) {
+ if (input != null) {
+ patcher$fileName = input.toString();
+ }
+ return patcher$dummyMatcher;
+ }
+
+ @Redirect(method = patcher$replaceRegexMethod, at = @At(value = "INVOKE", target = "Ljava/util/regex/Matcher;matches()Z"))
+ private boolean patcher$replaceRegex(Matcher instance) {
+ return patcher$fileName != null && patcher$fileName.endsWith(".class") && !patcher$fileName.startsWith("$") && !patcher$fileName.endsWith("$");
+ }
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModDiscovererMixin_Logging.java b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModDiscovererMixin_Logging.java
new file mode 100644
index 000000000..99b01d97b
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModDiscovererMixin_Logging.java
@@ -0,0 +1,28 @@
+package club.sk1er.patcher.mixins.performance.forge;
+
+import club.sk1er.patcher.util.forge.EntrypointCaching;
+import net.minecraftforge.fml.common.ModContainer;
+import net.minecraftforge.fml.common.discovery.ModDiscoverer;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Unique;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+import java.util.List;
+
+@Mixin(value = ModDiscoverer.class, remap = false)
+public class ModDiscovererMixin_Logging {
+ @Unique
+ private long patcher$time;
+
+ @Inject(method = "identifyMods", at = @At("HEAD"))
+ private void patcher$logStart(CallbackInfoReturnable> cir) {
+ patcher$time = System.currentTimeMillis();
+ }
+
+ @Inject(method = "identifyMods", at = @At("TAIL"))
+ private void patcher$logEnd(CallbackInfoReturnable> cir) {
+ EntrypointCaching.INSTANCE.logger.info("ModDiscoverer.identifyMods took " + (System.currentTimeMillis() - patcher$time) + "ms");
+ }
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModDiscovererMixin_ReplaceRegex.java b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModDiscovererMixin_ReplaceRegex.java
new file mode 100644
index 000000000..a03f37fdb
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/forge/ModDiscovererMixin_ReplaceRegex.java
@@ -0,0 +1,42 @@
+package club.sk1er.patcher.mixins.performance.forge;
+
+import net.minecraftforge.fml.common.discovery.ModDiscoverer;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.Unique;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Mixin(value = ModDiscoverer.class, remap = false)
+public class ModDiscovererMixin_ReplaceRegex {
+
+ //#if MC<=10809
+ @Shadow
+ private static Pattern zipJar;
+ @Unique
+ private static final Matcher patcher$dummyMatcher = zipJar.matcher("null");
+ @Unique private String patcher$fileName;
+
+ @Redirect(method = "findModDirMods(Ljava/io/File;[Ljava/io/File;)V", at = @At(value = "INVOKE", target = "Ljava/util/regex/Pattern;matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;"))
+ private Matcher patcher$replaceRegex(Pattern instance, CharSequence input) {
+ if (input != null) {
+ patcher$fileName = input.toString();
+ }
+ return patcher$dummyMatcher;
+ }
+
+ @Redirect(method = "findModDirMods(Ljava/io/File;[Ljava/io/File;)V", at = @At(value = "INVOKE", target = "Ljava/util/regex/Matcher;matches()Z"))
+ private boolean patcher$replaceRegex(Matcher instance) {
+ return patcher$fileName != null && (patcher$fileName.endsWith(".jar") || patcher$fileName.endsWith(".zip"));
+ }
+
+ @Redirect(method = "findModDirMods(Ljava/io/File;[Ljava/io/File;)V", at = @At(value = "INVOKE", target = "Ljava/util/regex/Matcher;group(I)Ljava/lang/String;"))
+ private String patcher$replaceRegex(Matcher instance, int group) {
+ return patcher$fileName; // we could cut out the file extension but it's not necessary cause this is just for logging
+ }
+
+ //#endif
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/optifine/GameSettingsMixin_RefreshOFMipmaps.java b/src/main/java/club/sk1er/patcher/mixins/performance/optifine/GameSettingsMixin_RefreshOFMipmaps.java
new file mode 100644
index 000000000..cff425f13
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/optifine/GameSettingsMixin_RefreshOFMipmaps.java
@@ -0,0 +1,25 @@
+package club.sk1er.patcher.mixins.performance.optifine;
+
+import club.sk1er.patcher.hooks.ResourceReloadHooks;
+import net.minecraft.client.settings.GameSettings;
+import org.spongepowered.asm.mixin.Dynamic;
+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(GameSettings.class)
+public class GameSettingsMixin_RefreshOFMipmaps {
+
+ @Dynamic("OptiFine")
+ @Inject(method = "setOptionFloatValueOF", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;refreshResources()V"))
+ private void onMipmapTypeChange(GameSettings.Options settingsOption, float value, CallbackInfo ci) {
+ ResourceReloadHooks.setLoadMipmaps(true);
+ }
+
+ @Dynamic("OptiFine")
+ @Inject(method = "setOptionFloatValueOF", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;refreshResources()V", shift = At.Shift.AFTER))
+ private void onMipmapTypeChangeAfter(GameSettings.Options settingsOption, float value, CallbackInfo ci) {
+ ResourceReloadHooks.setLoadMipmaps(false);
+ }
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/optifine/MathHelperMixin_OFFastMath.java b/src/main/java/club/sk1er/patcher/mixins/performance/optifine/MathHelperMixin_OFFastMath.java
new file mode 100644
index 000000000..e1f398b20
--- /dev/null
+++ b/src/main/java/club/sk1er/patcher/mixins/performance/optifine/MathHelperMixin_OFFastMath.java
@@ -0,0 +1,39 @@
+package club.sk1er.patcher.mixins.performance.optifine;
+
+import me.jellysquid.mods.lithium.common.util.math.CompactSineLUT;
+import net.minecraft.util.MathHelper;
+import org.spongepowered.asm.mixin.*;
+
+@Mixin(MathHelper.class)
+public class MathHelperMixin_OFFastMath {
+
+ @Dynamic("OptiFine")
+ @Shadow
+ private static float[] SIN_TABLE_FAST;
+
+ @Dynamic("OptiFine")
+ @Shadow
+ private static float radToIndex;
+
+ @Dynamic("OptiFine")
+ @Shadow
+ public static boolean fastMath;
+
+ /**
+ * @author Wyvest
+ * @reason Use a compact LUT for sine calculations
+ */
+ @Overwrite
+ public static float sin(float f) {
+ return fastMath ? SIN_TABLE_FAST[(int)(f * radToIndex) & 4095] : CompactSineLUT.sin(f);
+ }
+
+ /**
+ * @author Wyvest
+ * @reason Use a compact LUT for cosine calculations
+ */
+ @Overwrite
+ public static float cos(float f) {
+ return fastMath ? SIN_TABLE_FAST[(int)(f * radToIndex + 1024.0F) & 4095] : CompactSineLUT.cos(f);
+ }
+}
diff --git a/src/main/java/club/sk1er/patcher/mixins/plugin/PatcherMixinPlugin.java b/src/main/java/club/sk1er/patcher/mixins/plugin/PatcherMixinPlugin.java
index 70372b3d8..e1900408a 100644
--- a/src/main/java/club/sk1er/patcher/mixins/plugin/PatcherMixinPlugin.java
+++ b/src/main/java/club/sk1er/patcher/mixins/plugin/PatcherMixinPlugin.java
@@ -3,6 +3,7 @@
import club.sk1er.patcher.tweaker.ClassTransformer;
import com.google.common.collect.ArrayListMultimap;
import kotlin.text.StringsKt;
+import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
@@ -12,16 +13,26 @@
public class PatcherMixinPlugin implements IMixinConfigPlugin {
private static final String LABYMOD_CLASS = "net/labymod/main/LabyMod.class";
private static final String SMOOTHFONT_CLASS = "bre/smoothfont/mod_SmoothFont.class";
+ private static final String OF_CONFIG_CLASS = "Config.class";
private static final ArrayListMultimap CONFLICTING_CLASSES = ArrayListMultimap.create();
+ private static boolean isEarsMod = false;
static {
+ MixinEnvironment.getDefaultEnvironment().addTransformerExclusion("com.unascribed.ears.asm.PlatformTransformerAdapter");
CONFLICTING_CLASSES.put("GuiContainerMixin_MouseBindFixThatLabyBreaks", LABYMOD_CLASS);
CONFLICTING_CLASSES.put("FontRendererMixin_Optimization", SMOOTHFONT_CLASS);
+ CONFLICTING_CLASSES.put("MathHelperMixin_CompactLUT", OF_CONFIG_CLASS);
}
@Override
public void onLoad(String mixinPackage) {
+ try {
+ Class.forName("com.unascribed.ears.Ears", false, getClass().getClassLoader());
+ isEarsMod = true;
+ } catch (ClassNotFoundException ignored) {
+ isEarsMod = false;
+ }
}
@Override
@@ -31,6 +42,9 @@ public String getRefMapperConfig() {
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
+ if (mixinClassName.endsWith("_EarsMod")) {
+ return isEarsMod;
+ }
String mixinPackage = StringsKt.substringBeforeLast(mixinClassName, '.', mixinClassName);
if (mixinPackage.endsWith("optifine") && "NONE".equals(ClassTransformer.optifineVersion)) {
// OptiFine isn't present, let's not apply this
diff --git a/src/main/java/club/sk1er/patcher/screen/PatcherMenuEditor.java b/src/main/java/club/sk1er/patcher/screen/PatcherMenuEditor.java
index f39c572bd..6dc2bca2d 100644
--- a/src/main/java/club/sk1er/patcher/screen/PatcherMenuEditor.java
+++ b/src/main/java/club/sk1er/patcher/screen/PatcherMenuEditor.java
@@ -203,7 +203,6 @@ public void keyboardInput(GuiScreenEvent.KeyboardInputEvent.Post event) {
if (next > 9) {
next = 0;
tripped = !tripped;
- Patcher.instance.getLogger().info("yep");
}
}
}
diff --git a/src/main/java/club/sk1er/patcher/tweaker/ClassTransformer.java b/src/main/java/club/sk1er/patcher/tweaker/ClassTransformer.java
index 8a00f1f93..3e57c3c4f 100644
--- a/src/main/java/club/sk1er/patcher/tweaker/ClassTransformer.java
+++ b/src/main/java/club/sk1er/patcher/tweaker/ClassTransformer.java
@@ -4,10 +4,7 @@
import club.sk1er.patcher.asm.external.forge.ForgeChunkManagerTransformer;
//#endif
import club.sk1er.patcher.asm.external.forge.ModelLoaderTransformer;
-import club.sk1er.patcher.asm.external.forge.loader.ASMModParserTransformer;
-import club.sk1er.patcher.asm.external.forge.loader.MinecraftForgeTransformer;
-import club.sk1er.patcher.asm.external.forge.loader.ModClassLoaderTransformer;
-import club.sk1er.patcher.asm.external.forge.loader.ModContainerFactoryTransformer;
+import club.sk1er.patcher.asm.external.forge.loader.*;
import club.sk1er.patcher.asm.external.forge.render.ForgeHooksClientTransformer;
import club.sk1er.patcher.asm.external.forge.render.block.BlockInfoTransformer;
import club.sk1er.patcher.asm.external.forge.render.block.ForgeBlockModelRendererTransformer;
@@ -154,7 +151,7 @@ public ClassTransformer() {
registerTransformer(new ModContainerFactoryTransformer());
//#endif
registerTransformer(new GuiIngameForgeTransformer());
- //registerTransformer(new JarDiscovererTransformer());
+ registerTransformer(new JarDiscovererTransformer());
// lwjgl
registerTransformer(new WindowsDisplayTransformer());
diff --git a/src/main/java/club/sk1er/patcher/util/chat/ChatHandler.java b/src/main/java/club/sk1er/patcher/util/chat/ChatHandler.java
index f6594008e..4180ea4cb 100644
--- a/src/main/java/club/sk1er/patcher/util/chat/ChatHandler.java
+++ b/src/main/java/club/sk1er/patcher/util/chat/ChatHandler.java
@@ -10,7 +10,6 @@
import net.minecraft.util.ChatStyle;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
-import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
@@ -46,15 +45,6 @@ public class ChatHandler {
public static int currentMessageHash = -1;
private int ticks;
- //#if MC==10809
- @SubscribeEvent
- public void renderChat(RenderGameOverlayEvent.Chat event) {
- if (event.type == RenderGameOverlayEvent.ElementType.CHAT && PatcherConfig.chatPosition) {
- event.posY -= 12;
- }
- }
- //#endif
-
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onChatMessage(ClientChatReceivedEvent event) {
//#if MC==10809
diff --git a/src/main/java/club/sk1er/patcher/util/forge/EntrypointCaching.java b/src/main/java/club/sk1er/patcher/util/forge/EntrypointCaching.java
index bdc54ac09..47f6d7ae8 100644
--- a/src/main/java/club/sk1er/patcher/util/forge/EntrypointCaching.java
+++ b/src/main/java/club/sk1er/patcher/util/forge/EntrypointCaching.java
@@ -1,6 +1,8 @@
package club.sk1er.patcher.util.forge;
+import cc.polyfrost.oneconfig.utils.Notifications;
import club.sk1er.patcher.config.PatcherConfig;
+import com.google.common.collect.ImmutableList;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
@@ -27,17 +29,17 @@
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
-/*public class EntrypointCaching {
+public class EntrypointCaching {
public static EntrypointCaching INSTANCE = new EntrypointCaching();
- private final Logger logger = LogManager.getLogger("Patcher Entrypoint Cache");
- private final Type mapType = new TypeToken