mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-18 11:29:08 +00:00
Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
104eda0b51 | ||
|
|
7fb8cde66d | ||
|
|
0e4421f2ce | ||
|
|
3cf3d096fd | ||
|
|
ffa1193dd2 | ||
|
|
d180023469 | ||
|
|
762275a6da | ||
|
|
0e66bcf42f | ||
|
|
979ad344a1 | ||
|
|
5f328e9b57 | ||
|
|
2dba62bf20 | ||
|
|
0fd4d457e2 | ||
|
|
b56e803622 | ||
|
|
3ab965ded7 | ||
|
|
538b38898c | ||
|
|
e43cd6f18e | ||
|
|
38285087c9 | ||
|
|
deb6c2b6e5 | ||
|
|
e11985a913 | ||
|
|
4bbf39eb4d |
No files matched your search
@@ -18,6 +18,14 @@ body:
|
||||
placeholder: "Example: 1.0.0-alpha1"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: report
|
||||
attributes:
|
||||
label: Bug Report
|
||||
description: "Relevant information, as well as relevant logs attached such as `logs/fml-client-latest.log."
|
||||
placeholder: "Example: https://mclo.gs/ OR submit the file to github by dragging it to this textbox."
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: java
|
||||
attributes:
|
||||
@@ -69,14 +77,6 @@ body:
|
||||
- "Yes: I don't read and shouldn't be creating an issue"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: report
|
||||
attributes:
|
||||
label: Bug Report
|
||||
description: "Relevant information, as well as relevant logs attached such as `logs/fml-client-latest.log."
|
||||
placeholder: "Example: https://mclo.gs/ OR submit the file to github by dragging it to this textbox."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: modlist
|
||||
attributes:
|
||||
@@ -97,6 +97,5 @@ body:
|
||||
required: true
|
||||
- label: "I am running an officially released version. (Or, if I've compiled it myself I plan to fix the issue)"
|
||||
required: true
|
||||
- label: "This issue is not related to a feature that is disabed by default - MCPF, etc. [They'll be enabled when they're ready for testing]"
|
||||
required: true
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
* HUDCaching
|
||||
* Created by [Moulberry](https://github.com/Moulberry/MCHUDCaching), backported from [Patcher](https://github.com/Sk1erLLC/Patcher) mod by Alexdoru under the CC-BY-SA-NC 4.0 license
|
||||
* Angelica
|
||||
* mitchej123, Omni, Makamys, Embeddedt, NanoLive, Caedis, Cardinalstar, Alexdoru, Eigenraven, mist475, Clepto for helping get Angelica up and running!
|
||||
* mitchej123, Omni, Makamys, Embeddedt, NanoLive, Caedis, Cardinalstar, Alexdoru, Eigenraven, mist475, Clepto, kurrycat for helping get Angelica up and running!
|
||||
* IMS, jss2a98aj, || dbp ||, roadhog360 for advice and moral support
|
||||
* Forge 1.12+
|
||||
* Some files have been taken from Minecraft Forge under the LGPL 2.1 license and are marked as such
|
||||
|
||||
@@ -98,8 +98,6 @@ dependencies {
|
||||
compileOnly("com.github.GTNewHorizons:NotEnoughIds-Legacy:1.4.7:dev") // ASM Version
|
||||
|
||||
compileOnly(rfg.deobf("curse.maven:campfirebackport-387444:4611675"))
|
||||
// HMMMMM
|
||||
compileOnly(rfg.deobf("curse.maven:journeymap-32274:2367915"))
|
||||
compileOnly(rfg.deobf("curse.maven:xaeros-minimap-263420:5060684"))
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:HoloInventory:2.4.12-GTNH:dev")
|
||||
|
||||
@@ -107,21 +107,6 @@ public class AngelicaConfig {
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean optimizeTextureLoading;
|
||||
|
||||
@Config.Comment("Fix thread-safety in lotrs rendering")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixLotrSodiumCompat;
|
||||
|
||||
@Config.Comment("Fix thread-safety in Extra Utilities rendering")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixExtraUtilsSodiumCompat;
|
||||
|
||||
@Config.Comment("Fix thread-safety issues in MineFactory Reloaded")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixMineFactoryReloadedSodiumCompat;
|
||||
|
||||
@Config.Comment("Fix RenderBlockFluid reading the block type from the world access multiple times")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
@@ -138,8 +123,18 @@ public class AngelicaConfig {
|
||||
@Config.RangeInt(min = 32, max = 2048)
|
||||
public static int droppedItemLimit;
|
||||
|
||||
@Config.Comment("Use total world time instead of normal world time. Allows most shader animations to play when "
|
||||
+ "doDaylightCycle is off, but causes shader animations to desync from time of day.")
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean useTotalWorldTime;
|
||||
|
||||
@Config.Comment("Enable Debug Logging")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableDebugLogging;
|
||||
|
||||
@Config.Comment("Enable Zoom")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableZoom;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gtnewhorizons.angelica.config;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.config.Config;
|
||||
|
||||
@Config(modid = "angelica", filename = "angelica-compat")
|
||||
public class CompatConfig {
|
||||
|
||||
@Config.Comment("Apply fixes to the LOTR mod")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixLotr;
|
||||
|
||||
@Config.Comment("Apply fixes to Extra Utilities")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixExtraUtils;
|
||||
|
||||
@Config.Comment("Apply fixes to Stacks on Stacks")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixStacksOnStacks;
|
||||
|
||||
@Config.Comment("Apply fixes to Minefactory Reloaded")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixMinefactoryReloaded;
|
||||
|
||||
@Config.Comment("Apply fixes to Thaumcraft")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixThaumcraft;
|
||||
|
||||
@Config.Comment("Apply fixes to ThaumicHorizons")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixThaumicHorizons;
|
||||
|
||||
@Config.Comment("Apply fixes to Immersive Engineering")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean fixImmersiveEngineering;
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import java.util.function.Predicate;
|
||||
public class DynamicLights {
|
||||
private static DynamicLights instance;
|
||||
public static DynamicLightsMode Mode = DynamicLightsMode.OFF;
|
||||
public static boolean ShaderForce = false;
|
||||
|
||||
private static final double MAX_RADIUS = 7.75;
|
||||
private static final double MAX_RADIUS_SQUARED = MAX_RADIUS * MAX_RADIUS;
|
||||
@@ -52,7 +53,11 @@ public class DynamicLights {
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
return AngelicaConfig.enableDynamicLights && Mode.isEnabled() && !IrisApi.getInstance().isShaderPackInUse();
|
||||
return AngelicaConfig.enableDynamicLights &&
|
||||
Mode.isEnabled() &&
|
||||
// if shader force is enabled then true
|
||||
// if not, then true when shaders are not in use
|
||||
(ShaderForce || !IrisApi.getInstance().isShaderPackInUse());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +70,7 @@ public class DynamicLights {
|
||||
return;
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if (now >= this.lastUpdate + 50) {
|
||||
if (now >= this.lastUpdate + Mode.getDelay()) {
|
||||
this.lastUpdate = now;
|
||||
this.lastUpdateCount = 0;
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ public enum DynamicLightsMode
|
||||
OFF("Off", 0),
|
||||
FASTEST("Fastest", 500),
|
||||
FAST("Fast", 250),
|
||||
FANCY("Fancy", 0);
|
||||
FANCY("Fancy", 50),
|
||||
REALTIME("Realtime", 0);
|
||||
|
||||
private final String name;
|
||||
private final int delay;
|
||||
|
||||
@@ -73,13 +73,6 @@ public interface IDynamicLightSource {
|
||||
*/
|
||||
void angelica$dynamicLightTick();
|
||||
|
||||
/**
|
||||
* Returns whether this dynamic light source should update.
|
||||
*
|
||||
* @return {@code true} if this dynamic light source should update, else {@code false}
|
||||
*/
|
||||
boolean angelica$shouldUpdateDynamicLight();
|
||||
|
||||
boolean angelica$updateDynamicLight(@NotNull SodiumWorldRenderer renderer);
|
||||
|
||||
void angelica$scheduleTrackedChunksRebuild(@NotNull SodiumWorldRenderer renderer);
|
||||
|
||||
@@ -19,9 +19,7 @@ import org.lwjgl.opengl.GL30;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiIngame;
|
||||
@@ -29,9 +27,7 @@ import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraftforge.client.GuiIngameForge;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import xaero.common.core.XaeroMinimapCore;
|
||||
@@ -70,31 +66,6 @@ public class HUDCaching {
|
||||
|
||||
private HUDCaching() {}
|
||||
|
||||
/* TODO START REMOVE DEBUG STUFF */
|
||||
|
||||
private final List<Long> updateTimeList = new ArrayList<>(21);
|
||||
private static boolean isEnabled = true;
|
||||
|
||||
// moved initialization to when its registered to avoid an empty Debug category, which can cause crashes when
|
||||
// opening the controls menu and hudcaching is disabled in the config
|
||||
private static KeyBinding toggle;
|
||||
|
||||
public static void registerKeyBindings() {
|
||||
toggle = new KeyBinding("Toggle HUDCaching", 0, "Debug");
|
||||
ClientRegistry.registerKeyBinding(toggle);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeypress(InputEvent.KeyInputEvent event) {
|
||||
if (toggle != null && toggle.isPressed()) {
|
||||
isEnabled = !isEnabled;
|
||||
final String msg = isEnabled ? "Enabled HUDCaching" : "Disabled HUDCaching";
|
||||
if (mc.thePlayer != null) mc.thePlayer.addChatMessage(new ChatComponentText(msg));
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO END REMOVE DEBUG STUFF */
|
||||
|
||||
// highest so it runs before the GLSM load event
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onJoinWorld(WorldEvent.Load event) {
|
||||
@@ -112,7 +83,7 @@ public class HUDCaching {
|
||||
XaeroMinimapCore.beforeIngameGuiRender(partialTicks);
|
||||
}
|
||||
|
||||
if (!OpenGlHelper.isFramebufferEnabled() || !isEnabled || framebuffer == null) {
|
||||
if (!OpenGlHelper.isFramebufferEnabled() || framebuffer == null) {
|
||||
ingame.renderGameOverlay(partialTicks, hasScreen, mouseX, mouseY);
|
||||
return;
|
||||
}
|
||||
@@ -244,13 +215,14 @@ public class HUDCaching {
|
||||
|
||||
// moved to here due to the method being called from a mixin
|
||||
public static void disableHoloInventory() {
|
||||
if (ModStatus.isHoloInventoryLoaded){
|
||||
Renderer.INSTANCE.angelicaOverride = isEnabled;
|
||||
if (ModStatus.isHoloInventoryLoaded) {
|
||||
Renderer.INSTANCE.angelicaOverride = true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // called via ASM
|
||||
public static class HUDCachingHooks {
|
||||
public static boolean shouldReturnEarly(){
|
||||
public static boolean shouldReturnEarly() {
|
||||
return renderingCacheOverride;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,12 @@ import com.gtnewhorizon.gtnhlib.config.ConfigException;
|
||||
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
|
||||
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.config.CompatConfig;
|
||||
import com.gtnewhorizons.angelica.mixins.Mixins;
|
||||
import com.gtnewhorizons.angelica.mixins.TargetedMod;
|
||||
import com.gtnewhorizons.angelica.transform.compat.CompatASMTransformers;
|
||||
import com.gtnewhorizons.angelica.transform.compat.GenericCompatTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.compat.handlers.CompatHandler;
|
||||
import com.gtnewhorizons.angelica.transform.compat.handlers.CompatHandlers;
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
import jss.notfine.asm.AsmTransformers;
|
||||
import jss.notfine.asm.mappings.Namer;
|
||||
@@ -52,6 +55,7 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
|
||||
try {
|
||||
// Angelica Config
|
||||
ConfigurationManager.registerConfig(AngelicaConfig.class);
|
||||
ConfigurationManager.registerConfig(CompatConfig.class);
|
||||
final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||
final Configuration config = ctx.getConfiguration();
|
||||
final LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
|
||||
@@ -76,10 +80,24 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
|
||||
mixinTweakClasses.add(MixinCompatHackTweaker.class.getName());
|
||||
}
|
||||
if (transformerClasses == null) {
|
||||
final List<String> transformers = new ArrayList<>(CompatASMTransformers.getTransformers());
|
||||
final List<String> transformers = new ArrayList<>();
|
||||
|
||||
// Regsiter compat handlers, and add extra specific transformers, then build and register the generic transformer
|
||||
for (CompatHandler handler : CompatHandlers.getHandlers()) {
|
||||
GenericCompatTransformer.register(handler);
|
||||
if (handler.extraTransformers() != null) {
|
||||
transformers.addAll(handler.extraTransformers());
|
||||
}
|
||||
}
|
||||
|
||||
GenericCompatTransformer.build();
|
||||
transformers.add(GenericCompatTransformer.class.getName());
|
||||
|
||||
// Add NotFine transformers
|
||||
final List<String> notFineTransformers = AsmTransformers.getTransformers();
|
||||
if (!notFineTransformers.isEmpty()) Namer.initNames();
|
||||
transformers.addAll(notFineTransformers);
|
||||
|
||||
transformerClasses = transformers.toArray(new String[0]);
|
||||
}
|
||||
return transformerClasses;
|
||||
|
||||
@@ -4,15 +4,24 @@ import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.transform.BlockTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.RedirectorTransformer;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.CoreModManager;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import net.minecraft.launchwrapper.ITweaker;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
import org.spongepowered.asm.launch.platform.MixinContainer;
|
||||
import org.spongepowered.asm.launch.platform.MixinPlatformManager;
|
||||
import org.spongepowered.asm.launch.platform.container.IContainerHandle;
|
||||
import org.spongepowered.asm.mixin.transformer.Config;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
|
||||
|
||||
@@ -23,8 +32,8 @@ public class MixinCompatHackTweaker implements ITweaker {
|
||||
verifyDependencies();
|
||||
|
||||
if(DISABLE_OPTIFINE_FASTCRAFT_BETTERFPS) {
|
||||
LOGGER.info("Disabling Optifine, Fastcraft, and BetterFPS (if present)");
|
||||
disableOptifineFastcraftAndBetterFPS();
|
||||
LOGGER.info("Disabling Optifine, Fastcraft, BetterFPS, and other incompatible mods (if present)");
|
||||
disableIncompatibleMods();
|
||||
}
|
||||
|
||||
if (AngelicaConfig.enableHudCaching){
|
||||
@@ -40,8 +49,8 @@ public class MixinCompatHackTweaker implements ITweaker {
|
||||
|
||||
private void disableXaerosMinimapWaypointTransformer(){
|
||||
try {
|
||||
LaunchClassLoader lcl = Launch.classLoader;
|
||||
Field xformersField = lcl.getClass().getDeclaredField("transformers");
|
||||
final LaunchClassLoader lcl = Launch.classLoader;
|
||||
final Field xformersField = lcl.getClass().getDeclaredField("transformers");
|
||||
xformersField.setAccessible(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<IClassTransformer> xformers = (List<IClassTransformer>) xformersField.get(lcl);
|
||||
@@ -57,14 +66,14 @@ public class MixinCompatHackTweaker implements ITweaker {
|
||||
}
|
||||
}
|
||||
|
||||
private void disableOptifineFastcraftAndBetterFPS() {
|
||||
// Remove Optifine, Fastcraft, and BetterFPS transformers & Mod Containers
|
||||
@SuppressWarnings("unchecked")
|
||||
private void disableIncompatibleMods() {
|
||||
// Remove transformers, Mod Containers, and mixins for Optifine, Fastcraft, BetterFPS and other incompatible mods
|
||||
try {
|
||||
LaunchClassLoader lcl = Launch.classLoader;
|
||||
Field xformersField = lcl.getClass().getDeclaredField("transformers");
|
||||
final LaunchClassLoader lcl = Launch.classLoader;
|
||||
final Field xformersField = lcl.getClass().getDeclaredField("transformers");
|
||||
xformersField.setAccessible(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<IClassTransformer> xformers = (List<IClassTransformer>) xformersField.get(lcl);
|
||||
final List<IClassTransformer> xformers = (List<IClassTransformer>) xformersField.get(lcl);
|
||||
for (int idx = xformers.size() - 1; idx >= 0; idx--) {
|
||||
final String name = xformers.get(idx).getClass().getName();
|
||||
if (name.startsWith("optifine") || name.startsWith("fastcraft") || name.startsWith("me.guichaguri.betterfps")) {
|
||||
@@ -76,17 +85,70 @@ public class MixinCompatHackTweaker implements ITweaker {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
Field injectedContainersField = Loader.class.getDeclaredField("injectedContainers");
|
||||
final Field injectedContainersField = Loader.class.getDeclaredField("injectedContainers");
|
||||
injectedContainersField.setAccessible(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> containers = (List<String> ) injectedContainersField.get(Loader.class);
|
||||
final List<String> containers = (List<String> ) injectedContainersField.get(Loader.class);
|
||||
for (int idx = containers.size() - 1; idx >= 0; idx--) {
|
||||
final String name = containers.get(idx);
|
||||
final String name = containers.get(idx);
|
||||
if (name.startsWith("optifine") || name.startsWith("fastcraft")) {
|
||||
LOGGER.info("Removing mod container " + name);
|
||||
containers.remove(idx);
|
||||
}
|
||||
}
|
||||
|
||||
final Field reparsedCoremodsField = CoreModManager.class.getDeclaredField("reparsedCoremods");
|
||||
final Field loadedCoremodsField = CoreModManager.class.getDeclaredField("loadedCoremods");
|
||||
reparsedCoremodsField.setAccessible(true);
|
||||
loadedCoremodsField.setAccessible(true);
|
||||
final ArrayList<String> reparsedCoremods = (ArrayList<String>) reparsedCoremodsField.get(CoreModManager.class);
|
||||
final ArrayList<String> loadedCoremods = (ArrayList<String>) loadedCoremodsField.get(CoreModManager.class);
|
||||
for (int idx = reparsedCoremods.size() - 1; idx >= 0; idx--) {
|
||||
final String coreMod = reparsedCoremods.get(idx);
|
||||
if (coreMod.startsWith("optimizationsandtweaks")) {
|
||||
LOGGER.info("Removing reparsed coremod " + coreMod);
|
||||
// Fool the CoreModManager into not checking for a mod container again later
|
||||
loadedCoremods.add(reparsedCoremods.remove(idx));
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
final ArrayList<String> mixinConfigsDefault = (ArrayList<String>) Launch.blackboard.get("mixin.configs.default");
|
||||
if (mixinConfigsDefault != null) {
|
||||
for (int idx = mixinConfigsDefault.size() - 1; idx >= 0; idx--) {
|
||||
final String name = mixinConfigsDefault.get(idx);
|
||||
if (name.contains("optimizationsandtweaks")) {
|
||||
LOGGER.info("Removing mixin config " + name);
|
||||
mixinConfigsDefault.remove(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
final Set<Config> mixinConfigs = (Set<Config>) Launch.blackboard.get("mixin.configs.queue");
|
||||
final Set<Config> toRemove = new HashSet<>();
|
||||
if (mixinConfigs != null) {
|
||||
for (Config config : mixinConfigs) {
|
||||
if (config.getName().contains("optimizationsandtweaks")) {
|
||||
LOGGER.info("Removing queued mixin config " + config.getName());
|
||||
toRemove.add(config);
|
||||
}
|
||||
}
|
||||
mixinConfigs.removeAll(toRemove);
|
||||
}
|
||||
final MixinPlatformManager platformManager = (MixinPlatformManager) Launch.blackboard.get("mixin.platform");
|
||||
if (platformManager != null) {
|
||||
final Field containersField = platformManager.getClass().getDeclaredField("containers");
|
||||
containersField.setAccessible(true);
|
||||
final Map<IContainerHandle, MixinContainer> containers = (Map<IContainerHandle, MixinContainer>) containersField.get(platformManager);
|
||||
for (Map.Entry<IContainerHandle, MixinContainer> entry : containers.entrySet()) {
|
||||
if(entry.getKey().getAttribute("MixinConfigs").contains("optimizationsandtweaks")) {
|
||||
LOGGER.info("Removing mixin container " + entry.getKey().toString());
|
||||
containers.remove(entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gtnewhorizons.angelica.mixins;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.config.CompatConfig;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import jss.notfine.config.MCPatcherForgeConfig;
|
||||
@@ -147,11 +148,8 @@ public enum Mixins {
|
||||
,"shaders.MixinLocale"
|
||||
,"shaders.MixinOpenGlHelper"
|
||||
,"shaders.MixinRender"
|
||||
,"shaders.MixinRenderDragon"
|
||||
,"shaders.MixinRenderEnderman"
|
||||
,"shaders.MixinRendererLivingEntity"
|
||||
,"shaders.MixinRenderGlobal"
|
||||
,"shaders.MixinRenderSpider"
|
||||
,"shaders.MixinTileEntityBeaconRenderer"
|
||||
)
|
||||
),
|
||||
@@ -173,6 +171,14 @@ public enum Mixins {
|
||||
,"angelica.textures.MixinTextureUtil"
|
||||
)),
|
||||
|
||||
ANGELICA_ZOOM(new Builder("Zoom").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableZoom)
|
||||
.addMixinClasses(
|
||||
"angelica.zoom.MixinEntityRenderer_Zoom",
|
||||
"angelica.zoom.MixinMinecraft_Zoom",
|
||||
"angelica.zoom.MixinMouseFilter"
|
||||
)),
|
||||
|
||||
HUD_CACHING(new Builder("Renders the HUD elements 20 times per second maximum to improve performance")
|
||||
.addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT).setPhase(Phase.EARLY)
|
||||
.setApplyIf(() -> AngelicaConfig.enableHudCaching).addMixinClasses(
|
||||
@@ -207,7 +213,7 @@ public enum Mixins {
|
||||
|
||||
EXTRA_UTILITIES_THREAD_SAFETY(new Builder("Enable thread safety fixes in Extra Utilities").setPhase(Phase.LATE)
|
||||
.addTargetedMod(TargetedMod.EXTRAUTILS).setSide(Side.CLIENT)
|
||||
.setApplyIf(() -> AngelicaConfig.fixExtraUtilsSodiumCompat)
|
||||
.setApplyIf(() -> CompatConfig.fixExtraUtils)
|
||||
.addMixinClasses(
|
||||
"client.extrautils.MixinRenderBlockConnectedTextures",
|
||||
"client.extrautils.MixinRenderBlockConnectedTexturesEthereal",
|
||||
@@ -215,7 +221,7 @@ public enum Mixins {
|
||||
|
||||
MFR_THREAD_SAFETY(new Builder("Enable thread safety fixes for MineFactory Reloaded").setPhase(Phase.LATE)
|
||||
.addTargetedMod(TargetedMod.MINEFACTORY_RELOADED).setSide(Side.CLIENT)
|
||||
.setApplyIf(() -> AngelicaConfig.fixMineFactoryReloadedSodiumCompat)
|
||||
.setApplyIf(() -> CompatConfig.fixMinefactoryReloaded)
|
||||
.addMixinClasses("client.minefactoryreloaded.MixinRedNetCableRenderer")),
|
||||
|
||||
SPEEDUP_CAMPFIRE_BACKPORT_ANIMATIONS(new Builder("Add animation speedup support to Campfire Backport").setPhase(Phase.LATE)
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.gtnewhorizon.gtnhlib.client.renderer.vertex.VertexFormat;
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
import com.gtnewhorizons.angelica.compat.bettercrashes.BetterCrashesCompat;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.config.CompatConfig;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.debug.OpenGLDebugging;
|
||||
@@ -14,6 +15,7 @@ import com.gtnewhorizons.angelica.models.VanillaModels;
|
||||
import com.gtnewhorizons.angelica.render.CloudRenderer;
|
||||
import com.gtnewhorizons.angelica.rendering.AngelicaBlockSafetyRegistry;
|
||||
import com.gtnewhorizons.angelica.utils.AssetLoader;
|
||||
import com.gtnewhorizons.angelica.zoom.Zoom;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
@@ -95,8 +97,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
if (AngelicaConfig.enableHudCaching) {
|
||||
FMLCommonHandler.instance().bus().register(HUDCaching.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(HUDCaching.INSTANCE); // TODO remove debug stuff, unused registration}
|
||||
HUDCaching.registerKeyBindings();
|
||||
MinecraftForge.EVENT_BUS.register(HUDCaching.INSTANCE);
|
||||
}
|
||||
if (AngelicaConfig.enableSodium) {
|
||||
MinecraftForge.EVENT_BUS.register(SodiumDebugScreenHandler.INSTANCE);
|
||||
@@ -129,7 +130,7 @@ public class ClientProxy extends CommonProxy {
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
glsmKeyBinding = new KeyBinding("Print GLSM Debug", Keyboard.KEY_NONE, "Angelica Keybinds");
|
||||
glsmKeyBinding = new KeyBinding("Print GLSM Debug", Keyboard.KEY_NONE, "Angelica");
|
||||
ClientRegistry.registerKeyBinding(glsmKeyBinding);
|
||||
|
||||
VanillaModels.init();
|
||||
@@ -137,6 +138,9 @@ public class ClientProxy extends CommonProxy {
|
||||
if (ModStatus.isBetterCrashesLoaded) {
|
||||
BetterCrashesCompat.init();
|
||||
}
|
||||
if (AngelicaConfig.enableZoom) {
|
||||
Zoom.init();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean wasGLSMKeyPressed;
|
||||
@@ -154,7 +158,7 @@ public class ClientProxy extends CommonProxy {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
super.postInit(event);
|
||||
|
||||
if (ModStatus.isLotrLoaded && AngelicaConfig.enableSodium && AngelicaConfig.fixLotrSodiumCompat) {
|
||||
if (ModStatus.isLotrLoaded && AngelicaConfig.enableSodium && CompatConfig.fixLotr) {
|
||||
try {
|
||||
Class<?> lotrRendering = Class.forName("lotr.common.coremod.LOTRReplacedMethods$BlockRendering");
|
||||
ReflectionHelper.setPrivateValue(lotrRendering, null, new ConcurrentHashMap<>(), "naturalBlockClassTable");
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.gtnewhorizons.angelica.transform;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
|
||||
public class AsmUtil {
|
||||
|
||||
public static String obf(String deobf, String obf) {
|
||||
if (AngelicaTweaker.isObfEnv()) {
|
||||
return obf;
|
||||
}
|
||||
return deobf;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.transform;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.spongepowered.asm.lib.ClassReader;
|
||||
import org.spongepowered.asm.lib.ClassWriter;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.JumpInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.transformers.MixinClassWriter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class HUDCachingTransformer implements IClassTransformer, Opcodes {
|
||||
|
||||
private static final String HUDCaching = "com/gtnewhorizons/angelica/hudcaching/HUDCaching$HUDCachingHooks";
|
||||
private static final Map<String, List<String>> ReturnEarlyMethods = ImmutableMap.of(
|
||||
"thaumcraft.client.lib.RenderEventHandler", ImmutableList.of("renderOverlay"),
|
||||
"com.kentington.thaumichorizons.client.lib.RenderEventHandler", ImmutableList.of("renderOverlay")
|
||||
);
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (ReturnEarlyMethods.containsKey(transformedName)) {
|
||||
ClassReader cr = new ClassReader(basicClass);
|
||||
ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
for (String targetMethod : ReturnEarlyMethods.get(transformedName)) {
|
||||
for (MethodNode method : cn.methods) {
|
||||
if (!method.name.equals(targetMethod)) continue;
|
||||
|
||||
InsnList list = new InsnList();
|
||||
LabelNode exitLabel = new LabelNode();
|
||||
AngelicaTweaker.LOGGER.info("Injecting HUDCaching Conditional Return: " + transformedName + "#" + method.name);
|
||||
list.add(new MethodInsnNode(INVOKESTATIC, HUDCaching, "shouldReturnEarly", "()Z", false));
|
||||
list.add(new JumpInsnNode(IFEQ, exitLabel));
|
||||
if (method.desc.endsWith("Z") || method.desc.endsWith("I")) {
|
||||
list.add(new InsnNode(ICONST_0));
|
||||
list.add(new InsnNode(IRETURN));
|
||||
} else if (method.desc.endsWith("V")) {
|
||||
list.add(new InsnNode(RETURN));
|
||||
} else {
|
||||
AngelicaTweaker.LOGGER.warn("HUDCaching Conditional Return - Unknown return type: " + transformedName + "#" + method.name + ":" + method.desc);
|
||||
return basicClass;
|
||||
}
|
||||
list.add(exitLabel);
|
||||
method.instructions.insert(list);
|
||||
}
|
||||
}
|
||||
|
||||
MixinClassWriter cw = new MixinClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
return basicClass;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum CompatASMTransformers {
|
||||
|
||||
EXTRA_UTILITIES_ISBRH("RenderBlockColor Transformer", () -> AngelicaConfig.fixExtraUtilsSodiumCompat, Side.CLIENT,
|
||||
"com.gtnewhorizons.angelica.transform.compat.ExtraUtilsTransformer"
|
||||
),
|
||||
HUD_CACHING("HUDCaching Early Return Transformer", () -> AngelicaConfig.enableHudCaching && AngelicaConfig.enableHudCachingEventTransformer, Side.CLIENT,
|
||||
"com.gtnewhorizons.angelica.transform.HUDCachingTransformer")
|
||||
;
|
||||
|
||||
private final Supplier<Boolean> applyIf;
|
||||
private final Side side;
|
||||
private final String[] transformerClasses;
|
||||
|
||||
CompatASMTransformers(String description, Supplier<Boolean> applyIf, Side side, String... transformers) {
|
||||
this.applyIf = applyIf;
|
||||
this.side = side;
|
||||
this.transformerClasses = transformers;
|
||||
}
|
||||
|
||||
private boolean shouldBeLoaded() { return applyIf.get() && shouldLoadSide(); }
|
||||
|
||||
private boolean shouldLoadSide() {
|
||||
return side == Side.BOTH || (side == Side.SERVER && FMLLaunchHandler.side()
|
||||
.isServer())
|
||||
|| (side == Side.CLIENT && FMLLaunchHandler.side()
|
||||
.isClient());
|
||||
}
|
||||
|
||||
public static List<String> getTransformers() {
|
||||
final List<String> list = new ArrayList<>();
|
||||
for (CompatASMTransformers transformer : values()) {
|
||||
if (transformer.shouldBeLoaded()) {
|
||||
AngelicaTweaker.LOGGER.info("Loading transformer {}", (Object[]) transformer.transformerClasses);
|
||||
list.addAll(Arrays.asList(transformer.transformerClasses));
|
||||
} else {
|
||||
AngelicaTweaker.LOGGER.info("Not loading transformer {}", (Object[]) transformer.transformerClasses);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private enum Side {
|
||||
BOTH,
|
||||
CLIENT,
|
||||
SERVER
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.AnnotationNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ExtraUtilsTransformer implements IClassTransformer {
|
||||
|
||||
private static final String RenderBlockColor = "com.rwtema.extrautils.block.render.RenderBlockColor";
|
||||
private static final String RenderBlockConnectedTextures = "com.rwtema.extrautils.block.render.RenderBlockConnectedTextures";
|
||||
private static final String RenderBlockConnectedTexturesEthereal = "com.rwtema.extrautils.block.render.RenderBlockConnectedTexturesEthereal";
|
||||
private static final String RenderBlockFullBright = "com.rwtema.extrautils.block.render.RenderBlockFullBright";
|
||||
private static final String RenderBlockSpike = "com.rwtema.extrautils.block.render.RenderBlockSpike";
|
||||
|
||||
private static final List<String> transformedClasses = Arrays.asList(RenderBlockColor, RenderBlockConnectedTextures, RenderBlockConnectedTexturesEthereal, RenderBlockFullBright, RenderBlockSpike);
|
||||
|
||||
private static final Map<String, Boolean> perThreadMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
perThreadMap.put(RenderBlockColor, false);
|
||||
perThreadMap.put(RenderBlockConnectedTextures, true);
|
||||
perThreadMap.put(RenderBlockConnectedTexturesEthereal, true);
|
||||
perThreadMap.put(RenderBlockFullBright, false);
|
||||
perThreadMap.put(RenderBlockSpike, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] transform(final String className, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (!transformedClasses.contains(transformedName)) {
|
||||
return basicClass;
|
||||
}
|
||||
|
||||
AngelicaTweaker.LOGGER.info("Adding ThreadSafeISBRH for Extra Utilities to: {}", transformedName);
|
||||
|
||||
final ClassReader cr = new ClassReader(basicClass);
|
||||
final ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
addThreadSafeISBRHAnnotation(transformedName, cn);
|
||||
|
||||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public void addThreadSafeISBRHAnnotation(String transformedName, ClassNode cn) {
|
||||
|
||||
AnnotationNode isbrhAnnotation = new AnnotationNode("Lcom/gtnewhorizons/angelica/api/ThreadSafeISBRH;");
|
||||
|
||||
Boolean perThread = perThreadMap.get(transformedName);
|
||||
if (perThread == null) {
|
||||
perThread = false;
|
||||
AngelicaTweaker.LOGGER.info("Tried to add ThreadSafeISBRH annotation to {} which is missing from perThreadMap. Using false for perThread.", transformedName);
|
||||
}
|
||||
isbrhAnnotation.values = Arrays.asList("perThread", perThread);
|
||||
|
||||
if (cn.visibleAnnotations == null) {
|
||||
cn.visibleAnnotations = new ArrayList<>();
|
||||
}
|
||||
cn.visibleAnnotations.add(isbrhAnnotation);
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import com.gtnewhorizons.angelica.transform.compat.handlers.CompatHandler;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.generic.FieldLevelTessellatorTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.generic.HUDCachingEarlyReturnTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.generic.ThreadSafeISBRHAnnotationTransformer;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.generic.TileEntityNullGuardTransformer;
|
||||
import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.spongepowered.asm.lib.ClassReader;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.transformers.MixinClassWriter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class GenericCompatTransformer implements IClassTransformer {
|
||||
|
||||
private static final Map<String, List<String>> fieldLevelTessellator = new Object2ObjectOpenHashMap<>();
|
||||
private static final Map<String, List<String>> tileEntityNullGuard = new Object2ObjectOpenHashMap<>();
|
||||
private static final Map<String, Boolean> threadSafeIBSRH = new Object2BooleanOpenHashMap<>();
|
||||
private static final Map<String, List<String>> hudCachingEarlyReturn = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
private static final Set<String> transformedClasses = new ObjectOpenHashSet<>();
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (!transformedClasses.contains(transformedName)) return basicClass;
|
||||
|
||||
ClassReader cr = new ClassReader(basicClass);
|
||||
ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
if (fieldLevelTessellator.containsKey(transformedName)) {
|
||||
FieldLevelTessellatorTransformer.transform(cn, fieldLevelTessellator.get(transformedName));
|
||||
}
|
||||
|
||||
if (tileEntityNullGuard.containsKey(transformedName)) {
|
||||
TileEntityNullGuardTransformer.transform(cn, tileEntityNullGuard.get(transformedName));
|
||||
}
|
||||
|
||||
if (threadSafeIBSRH.containsKey(transformedName)) {
|
||||
ThreadSafeISBRHAnnotationTransformer.transform(cn, threadSafeIBSRH.get(transformedName));
|
||||
}
|
||||
|
||||
if (hudCachingEarlyReturn.containsKey(transformedName)) {
|
||||
HUDCachingEarlyReturnTransformer.transform(cn, hudCachingEarlyReturn.get(transformedName));
|
||||
}
|
||||
|
||||
MixinClassWriter cw = new MixinClassWriter(MixinClassWriter.COMPUTE_MAXS | MixinClassWriter.COMPUTE_FRAMES);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static void register(CompatHandler handler) {
|
||||
if (handler.getFieldLevelTessellator() != null)
|
||||
fieldLevelTessellator.putAll(handler.getFieldLevelTessellator());
|
||||
if (handler.getTileEntityNullGuard() != null)
|
||||
tileEntityNullGuard.putAll(handler.getTileEntityNullGuard());
|
||||
if (handler.getThreadSafeISBRHAnnotations() != null)
|
||||
threadSafeIBSRH.putAll(handler.getThreadSafeISBRHAnnotations());
|
||||
if (handler.getHUDCachingEarlyReturn() != null)
|
||||
hudCachingEarlyReturn.putAll(handler.getHUDCachingEarlyReturn());
|
||||
}
|
||||
|
||||
public static void build() {
|
||||
transformedClasses.addAll(fieldLevelTessellator.keySet());
|
||||
transformedClasses.addAll(tileEntityNullGuard.keySet());
|
||||
transformedClasses.addAll(threadSafeIBSRH.keySet());
|
||||
transformedClasses.addAll(hudCachingEarlyReturn.keySet());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface CompatHandler {
|
||||
|
||||
default Map<String, List<String>> getFieldLevelTessellator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Map<String, List<String>> getTileEntityNullGuard() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Map<String, Boolean> getThreadSafeISBRHAnnotations() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Map<String, List<String>> getHUDCachingEarlyReturn() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default List<String> extraTransformers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.CompatConfig;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum CompatHandlers {
|
||||
|
||||
STACKS_ON_STACKS(() -> CompatConfig.fixStacksOnStacks, new StacksOnStacksCompatHandler()),
|
||||
EXTRA_UTILS(() -> CompatConfig.fixExtraUtils, new ExtraUtilsCompatHandler()),
|
||||
IMMERSIVE_ENGINEERING(() -> CompatConfig.fixImmersiveEngineering, new ImmersiveEngineeringCompatHandler()),
|
||||
THAUMCRAFT(() -> CompatConfig.fixThaumcraft, new ThaumcraftCompatHandler()),
|
||||
THAUMIC_HORIZONS(() -> CompatConfig.fixThaumicHorizons, new ThaumicHorizonsCompatHandler());
|
||||
|
||||
private final Supplier<Boolean> applyIf;
|
||||
private final CompatHandler handler;
|
||||
|
||||
CompatHandlers(Supplier<Boolean> applyIf, CompatHandler handler) {
|
||||
this.applyIf = applyIf;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
private static List<CompatHandler> compatHandlers = null;
|
||||
|
||||
public static List<CompatHandler> getHandlers() {
|
||||
if (compatHandlers != null) {
|
||||
return compatHandlers;
|
||||
}
|
||||
compatHandlers = new ArrayList<>();
|
||||
for (CompatHandlers value : values()) {
|
||||
if (value.applyIf.get()) {
|
||||
compatHandlers.add(value.handler);
|
||||
}
|
||||
}
|
||||
return compatHandlers;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ExtraUtilsCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getThreadSafeISBRHAnnotations() {
|
||||
return ImmutableMap.of(
|
||||
"com.rwtema.extrautils.block.render.RenderBlockColor",
|
||||
false,
|
||||
"com.rwtema.extrautils.block.render.RenderBlockConnectedTextures",
|
||||
true,
|
||||
"com.rwtema.extrautils.block.render.RenderBlockConnectedTexturesEthereal",
|
||||
true,
|
||||
"com.rwtema.extrautils.block.render.RenderBlockFullBright",
|
||||
false,
|
||||
"com.rwtema.extrautils.block.render.RenderBlockSpike",
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.specific.ImmersiveEngineeringTransformer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ImmersiveEngineeringCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getTileEntityNullGuard() {
|
||||
final List<String> renderWorldBlockExclusive = ImmutableList.of("renderWorldBlock");
|
||||
return ImmutableMap.<String, List<String>>builder()
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderClothDevices", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDecoration", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices2", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderWoodenDecoration", renderWorldBlockExclusive)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderWoodenDevices", renderWorldBlockExclusive)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getThreadSafeISBRHAnnotations() {
|
||||
return ImmutableMap.<String, Boolean>builder()
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderClothDevices", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDecoration", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices2", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderMetalMultiblocks", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderStoneDevices", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderWoodenDecoration", false)
|
||||
.put("blusunrize.immersiveengineering.client.render.BlockRenderWoodenDevices", false)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> extraTransformers() {
|
||||
return ImmutableList.of(ImmersiveEngineeringTransformer.class.getName());
|
||||
}
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.gtnewhorizons.angelica.transform.compat.transformers.specific.StacksOnStacksTransformer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class StacksOnStacksCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getFieldLevelTessellator() {
|
||||
return ImmutableMap
|
||||
.of("com.tierzero.stacksonstacks.util.ClientUtils", ImmutableList.of("drawQuad", "drawRectangularPrism"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getTileEntityNullGuard() {
|
||||
return ImmutableMap
|
||||
.of("com.tierzero.stacksonstacks.client.render.RenderTilePile", ImmutableList.of("renderWorldBlock"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getThreadSafeISBRHAnnotations() {
|
||||
return ImmutableMap.of("com.tierzero.stacksonstacks.client.render.RenderTilePile", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> extraTransformers() {
|
||||
return ImmutableList.of(StacksOnStacksTransformer.class.getName());
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ThaumcraftCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getHUDCachingEarlyReturn() {
|
||||
return ImmutableMap.of("thaumcraft.client.lib.RenderEventHandler", ImmutableList.of("renderOverlay"));
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ThaumicHorizonsCompatHandler implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getHUDCachingEarlyReturn() {
|
||||
return ImmutableMap
|
||||
.of("com.kentington.thaumichorizons.client.lib.RenderEventHandler", ImmutableList.of("renderOverlay"));
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.generic;
|
||||
|
||||
import com.gtnewhorizons.angelica.transform.AsmUtil;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.AbstractInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.FieldInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.LocalVariableNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.lib.tree.VarInsnNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FieldLevelTessellatorTransformer {
|
||||
|
||||
public static void transform(ClassNode cn, List<String> patchMethods) {
|
||||
for (MethodNode method : cn.methods) {
|
||||
if (patchMethods.contains(method.name)) {
|
||||
injectLocalTessellatorAndReplaceFieldUsage(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void injectLocalTessellatorAndReplaceFieldUsage(MethodNode mn) {
|
||||
// This part searches the instructions to see if there is any usage of a Tessellator field
|
||||
// which is NOT owned by Minecraft itself. This means anyone that caches it into a field will get caught
|
||||
// but not direct usage of Tessellator.instance.whatever()
|
||||
List<String> fields = new ArrayList<>();
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in instanceof FieldInsnNode fin) {
|
||||
if ((fin.getOpcode() == Opcodes.GETSTATIC || fin.getOpcode() == Opcodes.GETFIELD)
|
||||
&& fin.desc.equals("Lnet/minecraft/client/renderer/Tessellator;")
|
||||
&& !fin.owner.equals("net/minecraft/client/renderer/Tessellator")) {
|
||||
fields.add(fin.owner + ";" + fin.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fields.isEmpty()) return;
|
||||
|
||||
// Injects a new local to store our new local Tessellator in
|
||||
int localIndex = mn.maxLocals;
|
||||
LabelNode startLabel = new LabelNode();
|
||||
LabelNode endLabel = new LabelNode();
|
||||
LocalVariableNode tesNode = new LocalVariableNode(
|
||||
"tes",
|
||||
"Lnet/minecraft/client/renderer/Tessellator;",
|
||||
null,
|
||||
startLabel,
|
||||
endLabel,
|
||||
localIndex);
|
||||
mn.localVariables.add(tesNode);
|
||||
|
||||
// Actually initialize the new local Tessellator
|
||||
InsnList list = new InsnList();
|
||||
list.add(startLabel);
|
||||
list.add(
|
||||
new FieldInsnNode(
|
||||
Opcodes.GETSTATIC,
|
||||
"net/minecraft/client/renderer/Tessellator",
|
||||
AsmUtil.obf("instance", "field_78398_a"),
|
||||
"Lnet/minecraft/client/renderer/Tessellator;"));
|
||||
list.add(new VarInsnNode(Opcodes.ASTORE, localIndex));
|
||||
mn.instructions.insert(list);
|
||||
|
||||
// This searches through all the instructions and finds usage of the previously discovered fields, then it
|
||||
// replaces them
|
||||
// with an ALOAD for our new local instead of the GETSTATIC/GETFIELD
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in instanceof FieldInsnNode fin) {
|
||||
String hash = fin.owner + ";" + fin.name;
|
||||
if ((fin.getOpcode() == Opcodes.GETSTATIC || fin.getOpcode() == Opcodes.GETFIELD)
|
||||
&& fin.desc.equals("Lnet/minecraft/client/renderer/Tessellator;")
|
||||
&& fields.contains(hash)) {
|
||||
mn.instructions.insertBefore(in, new VarInsnNode(Opcodes.ALOAD, localIndex));
|
||||
mn.instructions.remove(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
mn.instructions.add(endLabel);
|
||||
}
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.generic;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.JumpInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HUDCachingEarlyReturnTransformer {
|
||||
|
||||
private static final String HUDCaching = "com/gtnewhorizons/angelica/hudcaching/HUDCaching$HUDCachingHooks";
|
||||
|
||||
public static void transform(ClassNode cn, List<String> patchMethods) {
|
||||
for (MethodNode method : cn.methods) {
|
||||
if (patchMethods.contains(method.name)) {
|
||||
InsnList list = new InsnList();
|
||||
LabelNode exitLabel = new LabelNode();
|
||||
list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, HUDCaching, "shouldReturnEarly", "()Z", false));
|
||||
list.add(new JumpInsnNode(Opcodes.IFEQ, exitLabel));
|
||||
if (method.desc.endsWith("Z") || method.desc.endsWith("I")) {
|
||||
list.add(new InsnNode(Opcodes.ICONST_0));
|
||||
list.add(new InsnNode(Opcodes.IRETURN));
|
||||
} else if (method.desc.endsWith("V")) {
|
||||
list.add(new InsnNode(Opcodes.RETURN));
|
||||
} else {
|
||||
AngelicaTweaker.LOGGER.warn(
|
||||
"HUDCaching Conditional Return - Unknown return type: {}#{}:{}", cn.name, method.name, method.desc
|
||||
);
|
||||
return;
|
||||
}
|
||||
list.add(exitLabel);
|
||||
method.instructions.insert(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.generic;
|
||||
|
||||
import org.spongepowered.asm.lib.tree.AnnotationNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ThreadSafeISBRHAnnotationTransformer {
|
||||
|
||||
public static void transform(ClassNode cn, boolean perThread) {
|
||||
if (cn.visibleAnnotations == null) {
|
||||
cn.visibleAnnotations = new ArrayList<>();
|
||||
}
|
||||
|
||||
AnnotationNode isbrhAnnotation = new AnnotationNode("Lcom/gtnewhorizons/angelica/api/ThreadSafeISBRH;");
|
||||
isbrhAnnotation.values = Arrays.asList("perThread", perThread);
|
||||
cn.visibleAnnotations.add(isbrhAnnotation);
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.generic;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import com.gtnewhorizons.angelica.transform.AsmUtil;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.AbstractInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.JumpInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.lib.tree.TypeInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.VarInsnNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityNullGuardTransformer {
|
||||
|
||||
public static void transform(ClassNode cn, List<String> patchMethods) {
|
||||
for (MethodNode method : cn.methods) {
|
||||
if (patchMethods.contains(method.name)) {
|
||||
injectGetTileEntityNullGuard(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void injectGetTileEntityNullGuard(MethodNode mn) {
|
||||
/*
|
||||
* Searching for the following pattern:
|
||||
* L0 {
|
||||
* ...
|
||||
* INVOKEINTERFACE net/minecraft/world/IBlockAccess.getTileEntity(III)Lnet/minecraft/tileentity/TileEntity;
|
||||
* CHECKCAST *
|
||||
* ASTORE x
|
||||
* }
|
||||
* L1 {...
|
||||
* Then injecting the following after the ASTORE such that we get
|
||||
* L0 {
|
||||
* ASTORE x
|
||||
* ALOAD x
|
||||
* IFNONNULL L1
|
||||
* ICONST_0
|
||||
* IRETURN
|
||||
* }
|
||||
* L1 {...
|
||||
* Ultimately this converts:
|
||||
* MyTileEntity tile = (MyTileEntity) world.getTileEntity(x, y, z);
|
||||
* doSomethingWithTileEntity(tile);
|
||||
* into:
|
||||
* MyTileEntity tile = (MyTileEntity) world.getTileEntity(x, y, z);
|
||||
* if (tile == null) {
|
||||
* return false;
|
||||
* } else {
|
||||
* doSomethingWithTileEntity(tile);
|
||||
* }
|
||||
*/
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in instanceof MethodInsnNode min) {
|
||||
if (min.getOpcode() == Opcodes.INVOKEINTERFACE
|
||||
&& min.name.equals(AsmUtil.obf("getTileEntity", "func_147438_o"))
|
||||
&& min.owner.equals("net/minecraft/world/IBlockAccess")) {
|
||||
AbstractInsnNode castNodeAbstract = min.getNext();
|
||||
if (castNodeAbstract instanceof TypeInsnNode castNodeType) {
|
||||
if (castNodeType.getOpcode() == Opcodes.CHECKCAST) {
|
||||
AbstractInsnNode astoreNodeAbstract = castNodeType.getNext();
|
||||
if (astoreNodeAbstract instanceof VarInsnNode astoreNodeVar) {
|
||||
if (astoreNodeVar.getOpcode() == Opcodes.ASTORE) {
|
||||
InsnList list = new InsnList();
|
||||
LabelNode exit = new LabelNode();
|
||||
list.add(new VarInsnNode(Opcodes.ALOAD, astoreNodeVar.var));
|
||||
list.add(new JumpInsnNode(Opcodes.IFNONNULL, exit));
|
||||
if (mn.desc.endsWith("Z") || mn.desc.endsWith("I")) {
|
||||
list.add(new InsnNode(Opcodes.ICONST_0));
|
||||
list.add(new InsnNode(Opcodes.IRETURN));
|
||||
} else if (mn.desc.endsWith("V")) {
|
||||
list.add(new InsnNode(Opcodes.RETURN));
|
||||
} else {
|
||||
AngelicaTweaker.LOGGER.warn("TileEntityNullGuard - Unknown Return Type: {}:{}", mn.name, mn.desc);
|
||||
return;
|
||||
}
|
||||
list.add(exit);
|
||||
mn.instructions.insert(astoreNodeVar, list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.specific;
|
||||
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.spongepowered.asm.lib.ClassReader;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.AbstractInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.FieldInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.JumpInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.transformers.MixinClassWriter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ImmersiveEngineeringTransformer implements IClassTransformer {
|
||||
|
||||
private static final String BlockRenderClothDevices = "blusunrize.immersiveengineering.client.render.BlockRenderClothDevices";
|
||||
private static final String BlockRenderMetalDevices2 = "blusunrize.immersiveengineering.client.render.BlockRenderMetalDevices2";
|
||||
private static final String BlockRenderStoneDevices = "blusunrize.immersiveengineering.client.render.BlockRenderStoneDevices";
|
||||
private static final String ClientUtils = "blusunrize.immersiveengineering.client.ClientUtils";
|
||||
|
||||
private static final List<String> transformedClasses = new ArrayList<>();
|
||||
|
||||
private static final List<String> staticRenderPassPatches = new ArrayList<>();
|
||||
|
||||
static {
|
||||
transformedClasses.add(BlockRenderClothDevices);
|
||||
transformedClasses.add(BlockRenderMetalDevices2);
|
||||
transformedClasses.add(BlockRenderStoneDevices);
|
||||
transformedClasses.add(ClientUtils);
|
||||
|
||||
staticRenderPassPatches.add(BlockRenderClothDevices);
|
||||
staticRenderPassPatches.add(BlockRenderMetalDevices2);
|
||||
staticRenderPassPatches.add(BlockRenderStoneDevices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (!transformedClasses.contains(transformedName)) return basicClass;
|
||||
|
||||
final ClassReader cr = new ClassReader(basicClass);
|
||||
final ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
if (transformedName.equals(ClientUtils)) {
|
||||
transformClientUtils(cn);
|
||||
}
|
||||
|
||||
if (staticRenderPassPatches.contains(transformedName)) {
|
||||
staticRenderPassPatcher(cn);
|
||||
}
|
||||
|
||||
MixinClassWriter cw = new MixinClassWriter(MixinClassWriter.COMPUTE_FRAMES);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.LOGGER.info("[AngelicaCompat]Extra Transformers: Applied ImmersiveEngineeringTransformer");
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private void staticRenderPassPatcher(ClassNode cn) {
|
||||
for (MethodNode mn : cn.methods) {
|
||||
if (mn.name.equals("renderWorldBlock")) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode ain = mn.instructions.get(i);
|
||||
// So far every one of these has been named renderPass, eventually might need to make the name dynamic and possibly care about owner?
|
||||
// Maybe this is common in other mods, possibly could generalize this transformation further if it comes up more.
|
||||
if (ain instanceof FieldInsnNode fin && fin.getOpcode() == Opcodes.GETSTATIC && fin.name.equals("renderPass")) {
|
||||
MethodInsnNode getRenderPass = new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraftforge/client/ForgeHooksClient", "getWorldRenderPass", "()I");
|
||||
mn.instructions.insert(fin, getRenderPass);
|
||||
mn.instructions.remove(fin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void transformClientUtils(ClassNode cn) {
|
||||
for (MethodNode mn : cn.methods) {
|
||||
// This patches an if (world != null) check to just be if (false) in order to make the block of code not run
|
||||
// The block of code in question calls OpenGL to update the lightmap texture coordinates, which is illegal from an ISBRH
|
||||
// in Angelica. It doesn't seem to make anything not work by causing this to not happen.
|
||||
if (mn.name.equals("renderStaticWavefrontModelWithIcon") || mn.name.equals("renderStaticWavefrontModel")) {
|
||||
if (
|
||||
mn.desc.equals("(Lnet/minecraft/world/IBlockAccess;IIILnet/minecraftforge/client/model/obj/WavefrontObject;Lnet/minecraft/util/IIcon;Lnet/minecraft/client/renderer/Tessellator;Lblusunrize/immersiveengineering/common/util/chickenbones/Matrix4;Lblusunrize/immersiveengineering/common/util/chickenbones/Matrix4;IZFFF[Ljava/lang/String;)V")
|
||||
|| mn.desc.equals("(Lnet/minecraft/world/IBlockAccess;IIILnet/minecraftforge/client/model/obj/WavefrontObject;Lnet/minecraft/client/renderer/Tessellator;Lblusunrize/immersiveengineering/common/util/chickenbones/Matrix4;Lblusunrize/immersiveengineering/common/util/chickenbones/Matrix4;IZFFF[Ljava/lang/String;)V")
|
||||
) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode ain = mn.instructions.get(i);
|
||||
if (ain instanceof JumpInsnNode jump && jump.getOpcode() == Opcodes.IFNULL) {
|
||||
InsnNode iconst = new InsnNode(Opcodes.ICONST_0);
|
||||
jump.setOpcode(Opcodes.IFEQ);
|
||||
mn.instructions.insertBefore(jump, iconst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package com.gtnewhorizons.angelica.transform.compat.transformers.specific;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.spongepowered.asm.lib.ClassReader;
|
||||
import org.spongepowered.asm.lib.ClassWriter;
|
||||
import org.spongepowered.asm.lib.Opcodes;
|
||||
import org.spongepowered.asm.lib.tree.AbstractInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.ClassNode;
|
||||
import org.spongepowered.asm.lib.tree.FieldInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.FieldNode;
|
||||
import org.spongepowered.asm.lib.tree.InsnList;
|
||||
import org.spongepowered.asm.lib.tree.InsnNode;
|
||||
import org.spongepowered.asm.lib.tree.LabelNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.MethodNode;
|
||||
import org.spongepowered.asm.lib.tree.TypeInsnNode;
|
||||
import org.spongepowered.asm.lib.tree.VarInsnNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class StacksOnStacksTransformer implements IClassTransformer {
|
||||
|
||||
private static final String RenderTilePile = "com.tierzero.stacksonstacks.client.render.RenderTilePile";
|
||||
private static final List<String> staticRemovers = ImmutableList.of("ingotRender", "gemRender", "dustRender");
|
||||
|
||||
private static final String ClientUtils = "com.tierzero.stacksonstacks.util.ClientUtils";
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if (basicClass == null) return null;
|
||||
|
||||
if (!transformedName.equals(RenderTilePile) && !transformedName.equals(ClientUtils)) return basicClass;
|
||||
|
||||
final ClassReader cr = new ClassReader(basicClass);
|
||||
final ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, 0);
|
||||
|
||||
if (transformedName.equals(RenderTilePile)) {
|
||||
transformRenderTilePile(cn);
|
||||
} else {
|
||||
transformClientUtils(cn);
|
||||
}
|
||||
|
||||
ClassWriter cw = new ClassWriter(0);
|
||||
cn.accept(cw);
|
||||
final byte[] bytes = cw.toByteArray();
|
||||
AngelicaTweaker.LOGGER.info("[AngelicaCompat]Extra Transformers: Applied StacksOnStacksTransformer");
|
||||
AngelicaTweaker.dumpClass(transformedName, basicClass, bytes, this);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injects initializers for the field level PileRender objects which used to be static into the <init>
|
||||
*/
|
||||
private static InsnList buildPilerRenderInitializer(String type) {
|
||||
LabelNode start = new LabelNode();
|
||||
LabelNode end = new LabelNode();
|
||||
InsnList list = new InsnList();
|
||||
list.add(start);
|
||||
list.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
list.add(new TypeInsnNode(Opcodes.NEW, "com/tierzero/stacksonstacks/client/render/PileRender" + type));
|
||||
list.add(new InsnNode(Opcodes.DUP));
|
||||
list.add(
|
||||
new MethodInsnNode(
|
||||
Opcodes.INVOKESPECIAL,
|
||||
"com/tierzero/stacksonstacks/client/render/PileRender" + type,
|
||||
"<init>",
|
||||
"()V"));
|
||||
list.add(
|
||||
new FieldInsnNode(
|
||||
Opcodes.PUTFIELD,
|
||||
"com/tierzero/stacksonstacks/client/render/RenderTilePile",
|
||||
type.toLowerCase() + "Render",
|
||||
"Lcom/tierzero/stacksonstacks/client/render/PileRender;"));
|
||||
list.add(end);
|
||||
return list;
|
||||
}
|
||||
|
||||
private static void transformRenderTilePile(ClassNode cn) {
|
||||
MethodNode clinit = null;
|
||||
for (MethodNode mn : cn.methods) {
|
||||
// Handles injecting field initializers for the various PileRender fields which used to be static
|
||||
// but we're removing <clinit> entirely and doing the initialization in <init>
|
||||
if (mn.name.equals("<init>")) {
|
||||
AbstractInsnNode objectInsn = null;
|
||||
// This removes the early return, and gets a reference to the self initialization so we can insert after
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode ain = mn.instructions.get(i);
|
||||
if (ain.getOpcode() == Opcodes.RETURN) mn.instructions.remove(ain);
|
||||
if (ain.getOpcode() == Opcodes.INVOKESPECIAL) objectInsn = mn.instructions.get(i);
|
||||
}
|
||||
// Build the initializer InsnLists and then insert them in reverse order, such that the dustRender comes
|
||||
// last
|
||||
// because we are adding the return opcode back in as part of that one's InsnList
|
||||
InsnList ingotRender = buildPilerRenderInitializer("Ingot");
|
||||
InsnList gemRender = buildPilerRenderInitializer("Gem");
|
||||
InsnList dustRender = buildPilerRenderInitializer("Dust");
|
||||
dustRender.add(new InsnNode(Opcodes.RETURN));
|
||||
mn.instructions.insert(objectInsn, dustRender);
|
||||
mn.instructions.insert(objectInsn, gemRender);
|
||||
mn.instructions.insert(objectInsn, ingotRender);
|
||||
}
|
||||
// Just catching the MethodNode for <clinit> so we can remove it later after we're done iterating
|
||||
if (mn.name.equals("<clinit>")) {
|
||||
clinit = mn;
|
||||
}
|
||||
if (mn.name.equals("renderWorldBlock")) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
// This part removes the GETSTATIC for the field level PileRender objects which used to be static,
|
||||
// and replaces them with
|
||||
// a non-static GETFIELD
|
||||
if (in instanceof FieldInsnNode fin) {
|
||||
if (fin.getOpcode() == Opcodes.GETSTATIC && staticRemovers.contains(fin.name)) {
|
||||
FieldInsnNode nonStatic = new FieldInsnNode(
|
||||
Opcodes.GETFIELD,
|
||||
"com/tierzero/stacksonstacks/client/render/RenderTilePile",
|
||||
fin.name,
|
||||
"Lcom/tierzero/stacksonstacks/client/render/PileRender;");
|
||||
mn.instructions.insertBefore(fin, new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
mn.instructions.insertBefore(fin, nonStatic);
|
||||
mn.instructions.remove(fin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove clinit after iterating. Nothing else happens in here besides the field initialization, so no reason to
|
||||
// drill down
|
||||
// into the instructions
|
||||
if (clinit != null) cn.methods.remove(clinit);
|
||||
|
||||
// Remove the static access bits from the desired field names
|
||||
for (FieldNode fn : cn.fields) {
|
||||
if (staticRemovers.contains(fn.name)) {
|
||||
fn.access = fn.access & (~Opcodes.ACC_STATIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void transformClientUtils(ClassNode cn) {
|
||||
// Various things throughout the ISBRH call these functions which in turn call GL11.glPush/PopMatrix
|
||||
// Upon checking, these aren't called anywhere but in the ISBRH, and they're entirely unnecessary in there.
|
||||
// This just makes the methods no-op, since they aren't required by any other part of the mod to be working.
|
||||
for (MethodNode mn : cn.methods) {
|
||||
if (mn.name.equals("pushMatrix")) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in.getOpcode() == Opcodes.INVOKESTATIC) {
|
||||
mn.instructions.remove(in);
|
||||
}
|
||||
}
|
||||
} else if (mn.name.equals("popMatrix")) {
|
||||
for (int i = 0; i < mn.instructions.size(); i++) {
|
||||
AbstractInsnNode in = mn.instructions.get(i);
|
||||
if (in.getOpcode() == Opcodes.INVOKESTATIC) {
|
||||
mn.instructions.remove(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.gtnewhorizons.angelica.zoom;
|
||||
|
||||
public interface IMouseFilterExt {
|
||||
void angelica$reset();
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.gtnewhorizons.angelica.zoom;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class Zoom {
|
||||
|
||||
@Getter
|
||||
private static float zoom = 4.0F;
|
||||
@Getter
|
||||
private static final KeyBinding zoomKey = new KeyBinding("Zoom", 0, "key.categories.misc");
|
||||
|
||||
public static final float ZOOM_MIN = 1.0F;
|
||||
public static final float ZOOM_MAX = 64.0F;
|
||||
public static final float ZOOM_STEP = 1.2F;
|
||||
|
||||
private static boolean lastSmoothCameraState = false;
|
||||
|
||||
public static void init() {
|
||||
ClientRegistry.registerKeyBinding(zoomKey);
|
||||
FMLCommonHandler.instance().bus().register(new Zoom());
|
||||
}
|
||||
|
||||
public static void modifyZoom(int eventDWheel) {
|
||||
if (eventDWheel == 0) return;
|
||||
zoom = MathHelper.clamp_float((float) (zoom * Math.pow(ZOOM_STEP, Integer.signum(eventDWheel))), ZOOM_MIN, ZOOM_MAX);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyPress(InputEvent.KeyInputEvent e) {
|
||||
final int keyCode = zoomKey.getKeyCode();
|
||||
if (keyCode == 0 || Keyboard.getEventKey() != keyCode || Keyboard.isRepeatEvent()) return;
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (Keyboard.getEventKeyState()) {
|
||||
lastSmoothCameraState = mc.gameSettings.smoothCamera;
|
||||
mc.gameSettings.smoothCamera = true;
|
||||
} else {
|
||||
zoom = 4.0F;
|
||||
if (mc.gameSettings.smoothCamera != lastSmoothCameraState) {
|
||||
((IMouseFilterExt) mc.entityRenderer.mouseFilterXAxis).angelica$reset();
|
||||
((IMouseFilterExt) mc.entityRenderer.mouseFilterYAxis).angelica$reset();
|
||||
}
|
||||
mc.gameSettings.smoothCamera = lastSmoothCameraState;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,13 @@ public enum Settings {
|
||||
DYNAMIC_LIGHTS(new NotFineOptionCycling(DynamicLightsMode.FANCY, OptionImpact.VARIES)){
|
||||
@Override
|
||||
public void applyChanges() {
|
||||
DynamicLights.Mode = (DynamicLightsMode) DYNAMIC_LIGHTS.option.getStore();
|
||||
DynamicLights.Mode = (DynamicLightsMode) this.option.getStore();
|
||||
}
|
||||
},
|
||||
DYNAMIC_LIGHTS_SHADER_FORCE(new NotFineOptionTickBox(false, OptionImpact.VARIES)){
|
||||
@Override
|
||||
public void applyChanges() {
|
||||
DynamicLights.ShaderForce = (boolean) this.option.getStore();
|
||||
}
|
||||
},
|
||||
FOG_NEAR_DISTANCE(new NotFineOptionSliderPercentage(75, 1, 100, 1, OptionImpact.LOW)),
|
||||
|
||||
@@ -191,6 +191,7 @@ public class NotFineGameOptionPages {
|
||||
.add(Settings.DOWNFALL_DISTANCE.option)
|
||||
.add(Settings.MODE_VIGNETTE.option)
|
||||
.add(Settings.DYNAMIC_LIGHTS.option, AngelicaConfig.enableDynamicLights)
|
||||
.add(Settings.DYNAMIC_LIGHTS_SHADER_FORCE.option, AngelicaConfig.enableDynamicLights)
|
||||
.add(Settings.MODE_SHADOWS.option)
|
||||
.add(Settings.VOID_FOG.option)
|
||||
.add(Settings.MODE_DROPPED_ITEMS.option)
|
||||
|
||||
@@ -243,6 +243,7 @@ public class SodiumGameOptionPages {
|
||||
.add(Settings.MODE_SHADOWS.option)
|
||||
.add(Settings.MODE_VIGNETTE.option)
|
||||
.add(Settings.DYNAMIC_LIGHTS.option, AngelicaConfig.enableDynamicLights)
|
||||
.add(Settings.DYNAMIC_LIGHTS_SHADER_FORCE.option, AngelicaConfig.enableDynamicLights)
|
||||
.build());
|
||||
|
||||
|
||||
|
||||
+19
-3
@@ -3,6 +3,7 @@ package me.jellysquid.mods.sodium.client.render.chunk.tasks;
|
||||
import com.gtnewhorizon.gtnhlib.blockpos.BlockPos;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.util.WorldUtil;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.ChunkOcclusionDataBuilder;
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache;
|
||||
import com.gtnewhorizons.angelica.rendering.AngelicaBlockSafetyRegistry;
|
||||
@@ -23,6 +24,7 @@ import me.jellysquid.mods.sodium.client.util.MathUtil;
|
||||
import me.jellysquid.mods.sodium.client.util.task.CancellationSource;
|
||||
import me.jellysquid.mods.sodium.client.world.WorldSlice;
|
||||
import me.jellysquid.mods.sodium.client.world.cloned.ChunkRenderContext;
|
||||
import net.coderbot.iris.block_rendering.BlockRenderingSettings;
|
||||
import net.coderbot.iris.vertices.ExtendedDataHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -35,6 +37,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import org.joml.Vector3d;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
@@ -104,6 +107,19 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canRenderInPass(Block block, BlockRenderPass pass) {
|
||||
boolean canRender = block.canRenderInPass(pass.ordinal());
|
||||
Map<Block, RenderLayer> blockTypeIds = BlockRenderingSettings.INSTANCE.getBlockTypeIds();
|
||||
RenderLayer renderLayer;
|
||||
if (blockTypeIds != null && (renderLayer = blockTypeIds.get(block)) != null) {
|
||||
canRender = switch (pass) {
|
||||
case CUTOUT_MIPPED -> renderLayer == RenderLayer.cutout();
|
||||
case TRANSLUCENT -> renderLayer == RenderLayer.translucent();
|
||||
};
|
||||
}
|
||||
return canRender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkBuildResult<T> performBuild(ChunkRenderCacheLocal cache, ChunkBuildBuffers buffers, CancellationSource cancellationSource) {
|
||||
final ChunkRenderData.Builder renderData = new ChunkRenderData.Builder();
|
||||
@@ -153,7 +169,7 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
|
||||
if (rendersOffThread(block)) {
|
||||
// Do regular block rendering
|
||||
for (BlockRenderPass pass : BlockRenderPass.VALUES) {
|
||||
if (block.canRenderInPass(pass.ordinal()) && !shouldUseSodiumFluidRendering(block)) {
|
||||
if (canRenderInPass(block, pass) && !shouldUseSodiumFluidRendering(block)) {
|
||||
ChunkRenderManager.setWorldRenderPass(pass);
|
||||
final long seed = MathUtil.hashPos(pos.x, pos.y, pos.z);
|
||||
if(AngelicaConfig.enableIris) buffers.iris$setMaterialId(block, ExtendedDataHelper.BLOCK_RENDER_TYPE);
|
||||
@@ -171,7 +187,7 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
|
||||
// Do fluid rendering without RenderBlocks
|
||||
if (shouldUseSodiumFluidRendering(block)) {
|
||||
for (BlockRenderPass pass : BlockRenderPass.VALUES) {
|
||||
if (block.canRenderInPass(pass.ordinal())) {
|
||||
if (canRenderInPass(block, pass)) {
|
||||
ChunkRenderManager.setWorldRenderPass(pass);
|
||||
if(AngelicaConfig.enableIris) buffers.iris$setMaterialId(block, ExtendedDataHelper.FLUID_RENDER_TYPE);
|
||||
|
||||
@@ -273,7 +289,7 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
|
||||
|
||||
// Do regular block rendering
|
||||
for (BlockRenderPass pass : BlockRenderPass.VALUES) {
|
||||
if (block.canRenderInPass(pass.ordinal()) && !shouldUseSodiumFluidRendering(block)) {
|
||||
if (canRenderInPass(block, pass) && !shouldUseSodiumFluidRendering(block)) {
|
||||
ChunkRenderManager.setWorldRenderPass(pass);
|
||||
final long seed = MathUtil.hashPos(pos.x, pos.y, pos.z);
|
||||
if(AngelicaConfig.enableIris) buffers.iris$setMaterialId(block, ExtendedDataHelper.BLOCK_RENDER_TYPE);
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
package net.coderbot.iris.gl.program;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.OptionalInt;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gl.state.ValueUpdateNotifier;
|
||||
import net.coderbot.iris.gl.uniform.DynamicLocationalUniformHolder;
|
||||
@@ -11,20 +19,13 @@ import net.coderbot.iris.gl.uniform.UniformType;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import net.coderbot.iris.uniforms.SystemTimeUniforms;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.ARBShaderImageLoadStore;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
public class ProgramUniforms {
|
||||
private static ProgramUniforms active;
|
||||
private final ImmutableList<Uniform> perTick;
|
||||
@@ -52,8 +53,11 @@ public class ProgramUniforms {
|
||||
}
|
||||
|
||||
private static long getCurrentTick() {
|
||||
if (Minecraft.getMinecraft().theWorld != null) {
|
||||
return Minecraft.getMinecraft().theWorld.getWorldTime();
|
||||
final WorldClient world = Minecraft.getMinecraft().theWorld;
|
||||
if (world != null) {
|
||||
return AngelicaConfig.useTotalWorldTime
|
||||
? world.getTotalWorldTime()
|
||||
: world.getWorldTime();
|
||||
} else {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.coderbot.iris.gl.shader;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.gtnewhorizons.angelica.Tags;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.coderbot.iris.pipeline.HandRenderer;
|
||||
import net.coderbot.iris.pipeline.WorldRenderingPhase;
|
||||
@@ -52,6 +53,8 @@ public class StandardMacros {
|
||||
define(standardDefines, "MC_SPECULAR_MAP");
|
||||
define(standardDefines, "MC_RENDER_QUALITY", "1.0");
|
||||
define(standardDefines, "MC_SHADOW_QUALITY", "1.0");
|
||||
define(standardDefines, "IS_ANGELICA");
|
||||
define(standardDefines, "ANGELICA_VERSION", Tags.VERSION);
|
||||
define(standardDefines, "MC_HAND_DEPTH", Float.toString(HandRenderer.DEPTH));
|
||||
|
||||
TextureFormat textureFormat = TextureFormatLoader.getFormat();
|
||||
|
||||
@@ -108,8 +108,11 @@ public abstract class IrisGuiSlot extends GuiSlot {
|
||||
if (scrolling) {
|
||||
this.amountScrolled += ((float) mouseY - this.initialClickY);
|
||||
this.initialClickY = mouseY;
|
||||
} else {
|
||||
for (; !this.mc.gameSettings.touchscreen && Mouse.next(); this.mc.currentScreen.handleMouseInput()) {
|
||||
} else if (this.mc.currentScreen != null ){
|
||||
while (!this.mc.gameSettings.touchscreen && Mouse.next()) {
|
||||
if(this.mc.currentScreen != null) {
|
||||
this.mc.currentScreen.handleMouseInput();
|
||||
}
|
||||
int dWheel = Mouse.getEventDWheel();
|
||||
|
||||
if (dWheel != 0) {
|
||||
|
||||
@@ -111,6 +111,12 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
|
||||
}
|
||||
}
|
||||
|
||||
if (hoveredElement != null) {
|
||||
hoveredElementCommentTimer++;
|
||||
} else {
|
||||
hoveredElementCommentTimer = 0;
|
||||
}
|
||||
|
||||
final float previousHoverTimer = this.guiButtonHoverTimer;
|
||||
super.drawScreen(mouseX, mouseY, delta);
|
||||
if (previousHoverTimer == this.guiButtonHoverTimer) {
|
||||
@@ -134,8 +140,10 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
|
||||
if (this.isDisplayingComment()) {
|
||||
// Determine panel height and position
|
||||
final int panelHeight = Math.max(50, 18 + (this.hoveredElementCommentBody.size() * 10));
|
||||
final int x = (int) (0.5 * this.width) - 157;
|
||||
final int y = this.height - (panelHeight + 4);
|
||||
int x = mouseX + 5;
|
||||
if (x + 314 >= (this.width - 4)) x = this.width - (318);
|
||||
int y = mouseY + 8;
|
||||
if (y + panelHeight >= (this.height - 4)) y = this.height - (panelHeight + 4);
|
||||
// Draw panel
|
||||
GuiUtil.drawPanel(x, y, COMMENT_PANEL_WIDTH, panelHeight);
|
||||
// Draw text
|
||||
@@ -374,6 +382,8 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
|
||||
public void applyChanges() {
|
||||
final ShaderPackEntry entry = this.shaderPackList.getSelected();
|
||||
|
||||
if (entry == null) return;
|
||||
|
||||
this.shaderPackList.setApplied(entry);
|
||||
|
||||
final String name = entry.getPackName();
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.coderbot.iris.pipeline;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.Camera;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.InteractionHand;
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.rendering.RenderingState;
|
||||
import net.coderbot.iris.block_rendering.BlockRenderingSettings;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
@@ -119,6 +120,7 @@ public class HandRenderer {
|
||||
mc.entityRenderer.itemRenderer.renderItemInFirstPerson(tickDelta);
|
||||
mc.entityRenderer.disableLightmap(tickDelta);
|
||||
|
||||
GLStateManager.defaultBlendFunc();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
@@ -5,8 +5,12 @@ import com.gtnewhorizons.angelica.compat.mojang.Camera;
|
||||
import com.gtnewhorizons.angelica.compat.toremove.MatrixStack;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.IRenderGlobalExt;
|
||||
import com.gtnewhorizons.angelica.rendering.RenderingState;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import me.jellysquid.mods.sodium.client.gl.device.RenderDevice;
|
||||
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
|
||||
import me.jellysquid.mods.sodium.client.render.chunk.passes.BlockRenderPass;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.shaderpack.OptionalBoolean;
|
||||
import net.coderbot.iris.shaderpack.PackDirectives;
|
||||
@@ -27,9 +31,12 @@ import net.coderbot.iris.uniforms.CelestialUniforms;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.culling.Frustrum;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
@@ -349,17 +356,13 @@ public class ShadowRenderer {
|
||||
}
|
||||
|
||||
private void renderEntities(EntityRenderer levelRenderer, Frustrum frustum, Object bufferSource, MatrixStack modelView, double cameraX, double cameraY, double cameraZ, float tickDelta) {
|
||||
// TODO: Render
|
||||
// EntityRenderDispatcher dispatcher = levelRenderer.getEntityRenderDispatcher();
|
||||
|
||||
int shadowEntities = 0;
|
||||
int shadowEntities = 0;
|
||||
|
||||
profiler.startSection("cull");
|
||||
|
||||
List<Entity> renderedEntities = new ArrayList<>(32);
|
||||
|
||||
// TODO: I'm sure that this can be improved / optimized.
|
||||
// TODO: Render
|
||||
// TODO: Entity culling
|
||||
for (Entity entity : getLevel().loadedEntityList) {
|
||||
if (false/*!dispatcher.shouldRender(entity, frustum, cameraX, cameraY, cameraZ) || entity.isSpectator()*/) {
|
||||
@@ -383,7 +386,7 @@ public class ShadowRenderer {
|
||||
modelView.peek().getModel().get(MODELVIEW_BUFFER);
|
||||
GL11.glLoadMatrix(MODELVIEW_BUFFER);
|
||||
for (Entity entity : renderedEntities) {
|
||||
RenderManager.instance.renderEntitySimple(entity, tickDelta);//(entity, cameraX, cameraY, cameraZ, tickDelta, modelView, bufferSource);
|
||||
RenderManager.instance.renderEntitySimple(entity, tickDelta);
|
||||
shadowEntities++;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
@@ -394,13 +397,11 @@ public class ShadowRenderer {
|
||||
}
|
||||
|
||||
private void renderPlayerEntity(EntityRenderer levelRenderer, Frustrum frustum, Object bufferSource, MatrixStack modelView, double cameraX, double cameraY, double cameraZ, float tickDelta) {
|
||||
// TODO: Render
|
||||
// EntityRenderDispatcher dispatcher = levelRenderer.getEntityRenderDispatcher();
|
||||
|
||||
profiler.startSection("cull");
|
||||
|
||||
Entity player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
// TODO: Entity culling
|
||||
// if (!dispatcher.shouldRender(player, frustum, cameraX, cameraY, cameraZ) || player.isSpectator()) {
|
||||
// return;
|
||||
// }
|
||||
@@ -409,19 +410,24 @@ public class ShadowRenderer {
|
||||
|
||||
int shadowEntities = 0;
|
||||
|
||||
// if (!player.getPassengers().isEmpty()) {
|
||||
// for (int i = 0; i < player.getPassengers().size(); i++) {
|
||||
// levelRenderer.invokeRenderEntity(player.getPassengers().get(i), cameraX, cameraY, cameraZ, tickDelta, modelView, bufferSource);
|
||||
// shadowEntities++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (player.getVehicle() != null) {
|
||||
// levelRenderer.invokeRenderEntity(player.getVehicle(), cameraX, cameraY, cameraZ, tickDelta, modelView, bufferSource);
|
||||
// shadowEntities++;
|
||||
// }
|
||||
//
|
||||
// levelRenderer.invokeRenderEntity(player, cameraX, cameraY, cameraZ, tickDelta, modelView, bufferSource);
|
||||
GL11.glPushMatrix();
|
||||
MODELVIEW_BUFFER.clear().rewind();
|
||||
modelView.peek().getModel().get(MODELVIEW_BUFFER);
|
||||
GL11.glLoadMatrix(MODELVIEW_BUFFER);
|
||||
|
||||
if (player.riddenByEntity != null) {
|
||||
RenderManager.instance.renderEntitySimple(player.riddenByEntity, tickDelta);
|
||||
shadowEntities++;
|
||||
}
|
||||
|
||||
if (player.ridingEntity != null) {
|
||||
RenderManager.instance.renderEntitySimple(player.ridingEntity, tickDelta);
|
||||
shadowEntities++;
|
||||
}
|
||||
|
||||
RenderManager.instance.renderEntitySimple(player, tickDelta);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
shadowEntities++;
|
||||
|
||||
@@ -430,6 +436,21 @@ public class ShadowRenderer {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void renderTileEntity(TileEntity tile, double cameraX, double cameraY, double cameraZ, float partialTicks) {
|
||||
if (tile.getDistanceFrom(cameraX, cameraY, cameraZ) >= tile.getMaxRenderDistanceSquared()) {
|
||||
return;
|
||||
}
|
||||
int brightness = tile.getWorldObj().getLightBrightnessForSkyBlocks(tile.xCoord, tile.yCoord, tile.zCoord, 0);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) brightness % 65536, (float) brightness / 65536);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(tile,
|
||||
(double)tile.xCoord - cameraX,
|
||||
(double)tile.yCoord - cameraY,
|
||||
(double)tile.zCoord - cameraZ,
|
||||
partialTicks
|
||||
);
|
||||
}
|
||||
|
||||
private void renderTileEntities(Object bufferSource, MatrixStack modelView, double cameraX, double cameraY, double cameraZ, float partialTicks, boolean hasEntityFrustum) {
|
||||
profiler.startSection("build blockentities");
|
||||
|
||||
@@ -440,17 +461,19 @@ public class ShadowRenderer {
|
||||
culler.setPosition(cameraX, cameraY, cameraZ);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
MODELVIEW_BUFFER.clear().rewind();
|
||||
modelView.peek().getModel().get(MODELVIEW_BUFFER);
|
||||
GL11.glLoadMatrix(MODELVIEW_BUFFER);
|
||||
for (TileEntity tileEntity : visibleTileEntities) {
|
||||
if (hasEntityFrustum && (culler.isCulled(tileEntity.xCoord - 1, tileEntity.yCoord - 1, tileEntity.zCoord - 1, tileEntity.xCoord + 1, tileEntity.yCoord + 1, tileEntity.zCoord + 1))) {
|
||||
continue;
|
||||
}
|
||||
modelView.push();
|
||||
modelView.translate(tileEntity.xCoord - cameraX, tileEntity.yCoord - cameraY, tileEntity.zCoord - cameraZ);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity, partialTicks);
|
||||
modelView.pop();
|
||||
renderTileEntity(tileEntity, cameraX, cameraY, cameraZ, partialTicks);
|
||||
|
||||
shadowTileEntities++;
|
||||
}
|
||||
GLStateManager.glPopMatrix();
|
||||
|
||||
renderedShadowTileEntities = shadowTileEntities;
|
||||
|
||||
@@ -465,8 +488,6 @@ public class ShadowRenderer {
|
||||
// If the profiler is inactive, it will return InactiveProfiler.INSTANCE
|
||||
this.profiler = Minecraft.getMinecraft().mcProfiler;
|
||||
|
||||
Minecraft client = Minecraft.getMinecraft();
|
||||
|
||||
profiler.endStartSection("shadows");
|
||||
ACTIVE = true;
|
||||
|
||||
@@ -523,7 +544,6 @@ public class ShadowRenderer {
|
||||
|
||||
// Execute the vanilla terrain setup / culling routines using our shadow frustum.
|
||||
mc.renderGlobal.clipRenderersByFrustum(terrainFrustumHolder.getFrustum(), playerCamera.getPartialTicks());
|
||||
// levelRenderer.invokeSetupRender(playerCamera, terrainFrustumHolder.getFrustum(), false, levelRenderer.getFrameId(), false);
|
||||
|
||||
// Don't forget to increment the frame counter! This variable is arbitrary and only used in terrain setup,
|
||||
// and if it's not incremented, the vanilla culling code will get confused and think that it's already seen
|
||||
@@ -536,11 +556,8 @@ public class ShadowRenderer {
|
||||
|
||||
// Render all opaque terrain unless pack requests not to
|
||||
if (shouldRenderTerrain) {
|
||||
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
rg.sortAndRender(mc.thePlayer, 0, playerCamera.getPartialTicks());
|
||||
|
||||
// levelRenderer.invokeRenderChunkLayer(RenderLayer.solid(), modelView, cameraX, cameraY, cameraZ);
|
||||
// levelRenderer.invokeRenderChunkLayer(RenderLayer.cutout(), modelView, cameraX, cameraY, cameraZ);
|
||||
// levelRenderer.invokeRenderChunkLayer(RenderLayer.cutoutMipped(), modelView, cameraX, cameraY, cameraZ);
|
||||
}
|
||||
|
||||
profiler.endStartSection("entities");
|
||||
@@ -564,27 +581,15 @@ public class ShadowRenderer {
|
||||
entityShadowFrustum.setPosition(cameraX, cameraY, cameraZ);
|
||||
|
||||
// Render nearby entities
|
||||
//
|
||||
// Note: We must use a separate BuilderBufferStorage object here, or else very weird things will happen during
|
||||
// rendering.
|
||||
// if (renderBuffersExt != null) {
|
||||
// renderBuffersExt.beginLevelRendering();
|
||||
// }
|
||||
|
||||
// if (buffers instanceof DrawCallTrackingRenderBuffers) {
|
||||
// ((DrawCallTrackingRenderBuffers) buffers).resetDrawCounts();
|
||||
// }
|
||||
|
||||
// BufferSource bufferSource = buffers.bufferSource();
|
||||
|
||||
if (shouldRenderEntities) {
|
||||
renderEntities(levelRenderer, entityShadowFrustum, null, modelView, cameraX, cameraY, cameraZ, tickDelta);
|
||||
} else if (shouldRenderPlayer) {
|
||||
// renderPlayerEntity(levelRenderer, entityShadowFrustum, bufferSource, modelView, cameraX, cameraY, cameraZ, tickDelta);
|
||||
renderPlayerEntity(levelRenderer, entityShadowFrustum, null, modelView, cameraX, cameraY, cameraZ, tickDelta);
|
||||
}
|
||||
|
||||
if (shouldRenderBlockEntities) {
|
||||
// renderTileEntities(bufferSource, modelView, cameraX, cameraY, cameraZ, tickDelta, hasEntityFrustum);
|
||||
renderTileEntities(null, modelView, cameraX, cameraY, cameraZ, tickDelta, hasEntityFrustum);
|
||||
}
|
||||
|
||||
profiler.endStartSection("draw entities");
|
||||
@@ -592,21 +597,16 @@ public class ShadowRenderer {
|
||||
// NB: Don't try to draw the translucent parts of entities afterwards. It'll cause problems since some
|
||||
// shader packs assume that everything drawn afterwards is actually translucent and should cast a colored
|
||||
// shadow...
|
||||
// bufferSource.endBatch();
|
||||
|
||||
copyPreTranslucentDepth();
|
||||
|
||||
profiler.endStartSection("translucent terrain");
|
||||
|
||||
// TODO: Prevent these calls from scheduling translucent sorting...
|
||||
// TODO (Iris): Prevent these calls from scheduling translucent sorting...
|
||||
// It doesn't matter a ton, since this just means that they won't be sorted in the getNormal rendering pass.
|
||||
// Just something to watch out for, however...
|
||||
if (shouldRenderTranslucent) {
|
||||
// TODO: Render
|
||||
// TODO -- This makes everything look... weird
|
||||
// rg.sortAndRender(mc.thePlayer, 1, playerCamera.getPartialTicks());
|
||||
|
||||
// levelRenderer.invokeRenderChunkLayer(RenderLayer.translucent(), modelView, cameraX, cameraY, cameraZ);
|
||||
rg.sortAndRender(mc.thePlayer, 1, playerCamera.getPartialTicks());
|
||||
}
|
||||
|
||||
// Note: Apparently tripwire isn't rendered in the shadow pass.
|
||||
@@ -616,7 +616,6 @@ public class ShadowRenderer {
|
||||
// renderBuffersExt.endLevelRendering();
|
||||
// }
|
||||
|
||||
// TODO: Render
|
||||
debugStringTerrain = SodiumWorldRenderer.getInstance().getChunksDebugString();
|
||||
|
||||
profiler.endStartSection("generate mipmaps");
|
||||
@@ -631,9 +630,6 @@ public class ShadowRenderer {
|
||||
((CullingDataCache) levelRenderer).restoreState();
|
||||
}
|
||||
|
||||
// TODO: Render
|
||||
// levelRenderer.setRenderBuffers(playerBuffers);
|
||||
|
||||
ACTIVE = false;
|
||||
profiler.endSection();
|
||||
profiler.endStartSection("updatechunks");
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package net.coderbot.iris.pipeline.transform;
|
||||
|
||||
import org.taumc.glsl.grammar.GLSLParser;
|
||||
|
||||
class CompositeTransformer {
|
||||
public static void transform(GLSLParser.Translation_unitContext translationUnit, int version) {
|
||||
CompositeDepthTransformer.transform(translationUnit);
|
||||
|
||||
// TODO: how to do this using glsl-transformation-lib?
|
||||
// Need to specifically find that these functions are called, not 100% sure how to do that
|
||||
// Also, is it possible to inject something before declarations?
|
||||
// Modern Iris doesn't seem to have this patch, so maybe it's just not even needed
|
||||
// More likely it's just an OpenGL core thing that ensures it's present
|
||||
|
||||
// if using a lod texture sampler and on version 120, patch in the extension
|
||||
// #extension GL_ARB_shader_texture_lod : require
|
||||
// if (version <= 120
|
||||
// && Stream.concat(
|
||||
// root.identifierIndex.getStream("texture2DLod"),
|
||||
// root.identifierIndex.getStream("texture3DLod"))
|
||||
// .filter(id -> id.getParent() instanceof FunctionCallExpression)
|
||||
// .findAny().isPresent()) {
|
||||
// tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_DECLARATIONS,
|
||||
// "#extension GL_ARB_shader_texture_lod : require\n")
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,13 @@ import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gl.shader.ShaderType;
|
||||
import net.coderbot.iris.pipeline.transform.parameter.Parameters;
|
||||
import net.coderbot.iris.pipeline.transform.parameter.AttributeParameters;
|
||||
import org.antlr.v4.runtime.BailErrorStrategy;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
import org.antlr.v4.runtime.ConsoleErrorListener;
|
||||
import org.antlr.v4.runtime.DefaultErrorStrategy;
|
||||
import org.antlr.v4.runtime.Parser;
|
||||
import org.antlr.v4.runtime.atn.PredictionMode;
|
||||
import org.antlr.v4.runtime.tree.ParseTree;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
import org.taumc.glsl.Util;
|
||||
@@ -33,11 +38,23 @@ public class ShaderTransformer {
|
||||
private static final Object2ObjectLinkedOpenHashMap<TransformKey, Map<PatchShaderType, String>> shaderTransformationCache = new Object2ObjectLinkedOpenHashMap<>();
|
||||
private static final boolean useCache = true;
|
||||
|
||||
/**
|
||||
* These are words which need to be renamed by iris if a shader uses them, regardless o the GLSL version.
|
||||
* The words will get caught and renamed to iris_renamed_$WORD
|
||||
*/
|
||||
private static final List<String> fullReservedWords = new ArrayList<>();
|
||||
private static final Map<Integer, List<String>> versionedReservedWords = new HashMap<>();;
|
||||
|
||||
/**
|
||||
* This does the same thing as fullReservedWords, but based on a maximum GLSL version. As an example
|
||||
* if something was register to 400 here, it would get applied on any version below 400.
|
||||
*/
|
||||
private static final Map<Integer, List<String>> versionedReservedWords = new HashMap<>();
|
||||
|
||||
static {
|
||||
// texture seems to be reserved by some drivers but not others, however this is not actually reserved by the GLSL spec
|
||||
fullReservedWords.add("texture");
|
||||
|
||||
// sample was added as a keyword in GLSL 400, many shaders use it
|
||||
versionedReservedWords.put(400, Arrays.asList("sample"));
|
||||
}
|
||||
|
||||
@@ -118,10 +135,23 @@ public class ShaderTransformer {
|
||||
}
|
||||
}
|
||||
|
||||
private static void configureNoError(Parser parser) {
|
||||
parser.setErrorHandler(new BailErrorStrategy());
|
||||
parser.removeErrorListeners();
|
||||
parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
|
||||
}
|
||||
|
||||
private static void configureError(Parser parser) {
|
||||
parser.setErrorHandler(new DefaultErrorStrategy());
|
||||
parser.addErrorListener(ConsoleErrorListener.INSTANCE);
|
||||
parser.getInterpreter().setPredictionMode(PredictionMode.LL);
|
||||
}
|
||||
|
||||
private static <P extends Parameters> Map<PatchShaderType, String> transformInternal(EnumMap<PatchShaderType, String> inputs, Patch patchType, P parameters) {
|
||||
EnumMap<PatchShaderType, String> result = new EnumMap<>(PatchShaderType.class);
|
||||
EnumMap<PatchShaderType, GLSLParser.Translation_unitContext> types = new EnumMap<>(PatchShaderType.class);
|
||||
EnumMap<PatchShaderType, String> prepatched = new EnumMap<>(PatchShaderType.class);
|
||||
List<GLSLParser.Translation_unitContext> textureLodExtensionPatches = new ArrayList<>();
|
||||
|
||||
Stopwatch watch = Stopwatch.createStarted();
|
||||
|
||||
@@ -154,9 +184,9 @@ public class ShaderTransformer {
|
||||
|
||||
String profileString = "#version " + versionString + " " + profile + "\n";
|
||||
|
||||
// This handles some reserved keywords which cause the AST parser to fail
|
||||
// but aren't necessarily invalid for GLSL versions prior to 400. This simple
|
||||
// renames the matching strings and prefixes them with iris_renamed_
|
||||
// The primary reason we rename words here using regex, is because if the words cause invalid
|
||||
// GLSL, regardless of the version being used, it will cause glsl-transformation-lib to fail
|
||||
// so we need to rename them prior to passing the shader input to glsl-transformation-lib.
|
||||
for (String reservedWord : fullReservedWords) {
|
||||
String newName = "iris_renamed_" + reservedWord;
|
||||
input = input.replaceAll("\\b" + reservedWord + "\\b", newName);
|
||||
@@ -173,34 +203,63 @@ public class ShaderTransformer {
|
||||
GLSLLexer lexer = new GLSLLexer(CharStreams.fromString(input));
|
||||
GLSLParser parser = new GLSLParser(new CommonTokenStream(lexer));
|
||||
parser.setBuildParseTree(true);
|
||||
var translationUnit = parser.translation_unit();
|
||||
configureNoError(parser);
|
||||
|
||||
switch(patchType) {
|
||||
case SODIUM_TERRAIN:
|
||||
SodiumTransformer.transform(translationUnit, parameters);
|
||||
break;
|
||||
case COMPOSITE:
|
||||
CompositeTransformer.transform(translationUnit, versionInt);
|
||||
break;
|
||||
case ATTRIBUTES:
|
||||
AttributeTransformer.transform(translationUnit, (AttributeParameters) parameters, profile, versionInt);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unknown patch type: " + patchType.name());
|
||||
GLSLParser.Translation_unitContext translationUnit;
|
||||
try {
|
||||
translationUnit = doTransform(parser, patchType, parameters, profile, versionInt);
|
||||
} catch (Exception e) {
|
||||
lexer.reset();
|
||||
parser.reset();
|
||||
configureError(parser);
|
||||
translationUnit = doTransform(parser, patchType, parameters, profile, versionInt);
|
||||
}
|
||||
|
||||
// Check if we need to patch in texture LOD extension enabling
|
||||
if (versionInt <= 120 && (Util.containsCall(translationUnit, "texture2DLod") || Util.containsCall(translationUnit, "texture3DLod"))) {
|
||||
textureLodExtensionPatches.add(translationUnit);
|
||||
}
|
||||
CompatibilityTransformer.transformEach(translationUnit, parameters);
|
||||
types.put(type, translationUnit);
|
||||
prepatched.put(type, profileString);
|
||||
}
|
||||
CompatibilityTransformer.transformGrouped(types, parameters);
|
||||
for (var entry : types.entrySet()) {
|
||||
result.put(entry.getKey(), getFormattedShader(entry.getValue(), prepatched.get(entry.getKey())));
|
||||
// This is a hack to inject an extension declaration when the GLSL version is less than 120
|
||||
// Doing this as a string manipulation on the final shader output since it needs to put this
|
||||
// before variables, didn't see an easy way to do that with glsl-transformation-lib
|
||||
// Eventually this can probably be moved to use glsl-transformation-lib
|
||||
String formattedShader = getFormattedShader(entry.getValue(), prepatched.get(entry.getKey()));
|
||||
if (textureLodExtensionPatches.contains(entry.getValue())) {
|
||||
String[] parts = formattedShader.split("\n", 2);
|
||||
parts[1] = "#extension GL_ARB_shader_texture_lod : require\n" + parts[1];
|
||||
formattedShader = parts[0] + "\n" + parts[1];
|
||||
}
|
||||
result.put(entry.getKey(), formattedShader);
|
||||
}
|
||||
watch.stop();
|
||||
Iris.logger.info("Transformed shader for {} in {}", patchType.name(), watch);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static GLSLParser.Translation_unitContext doTransform(GLSLParser parser, Patch patchType, Parameters parameters, String profile, int versionInt) {
|
||||
GLSLParser.Translation_unitContext translationUnit = parser.translation_unit();
|
||||
switch (patchType) {
|
||||
case SODIUM_TERRAIN:
|
||||
SodiumTransformer.transform(translationUnit, parameters);
|
||||
break;
|
||||
case COMPOSITE:
|
||||
CompositeDepthTransformer.transform(translationUnit);
|
||||
break;
|
||||
case ATTRIBUTES:
|
||||
AttributeTransformer.transform(translationUnit, (AttributeParameters) parameters, profile, versionInt);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unknown patch type: " + patchType.name());
|
||||
}
|
||||
CompatibilityTransformer.transformEach(translationUnit, parameters);
|
||||
return translationUnit;
|
||||
}
|
||||
|
||||
public static void applyIntelHd4000Workaround(GLSLParser.Translation_unitContext translationUnit) {
|
||||
Util.renameFunctionCall(translationUnit, "ftransform", "iris_ftransform");
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class PackDirectives {
|
||||
sun = properties.getSun().orElse(true);
|
||||
moon = properties.getMoon().orElse(true);
|
||||
rainDepth = properties.getRainDepth().orElse(false);
|
||||
separateAo = properties.getSeparateAo().orElse(false);
|
||||
separateAo = false; //properties.getSeparateAo().orElse(false);
|
||||
oldLighting = properties.getOldLighting().orElse(false);
|
||||
concurrentCompute = properties.getConcurrentCompute().orElse(false);
|
||||
oldHandLight = properties.getOldHandLight().orElse(true);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package net.coderbot.iris.uniforms;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.rendering.RenderingState;
|
||||
import net.coderbot.iris.gl.uniform.UniformHolder;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import net.coderbot.iris.uniforms.transforms.SmoothedFloat;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.joml.Math;
|
||||
import org.joml.Vector3d;
|
||||
@@ -157,7 +159,8 @@ public class HardcodedCustomUniforms {
|
||||
}
|
||||
|
||||
private static int getWorldDayTime() {
|
||||
return (int) (Minecraft.getMinecraft().theWorld.getWorldTime() % 24000L);
|
||||
final WorldClient world = Minecraft.getMinecraft().theWorld;
|
||||
return (int) ((AngelicaConfig.useTotalWorldTime ? world.getTotalWorldTime() : world.getWorldTime()) % 24000L);
|
||||
// Level level = Minecraft.getMinecraft().theWorld;
|
||||
// long timeOfDay = level.getDayTime();
|
||||
// long dayTime = ((DimensionTypeAccessor) level.dimensionType()).getFixedTime().orElse(timeOfDay % 24000L);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package net.coderbot.iris.uniforms;
|
||||
|
||||
import static net.coderbot.iris.gl.uniform.UniformUpdateFrequency.PER_TICK;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import java.util.Objects;
|
||||
import net.coderbot.iris.gl.uniform.UniformHolder;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static net.coderbot.iris.gl.uniform.UniformUpdateFrequency.PER_TICK;
|
||||
|
||||
public final class WorldTimeUniforms {
|
||||
private WorldTimeUniforms() {
|
||||
}
|
||||
@@ -25,13 +25,14 @@ public final class WorldTimeUniforms {
|
||||
}
|
||||
|
||||
static int getWorldDayTime() {
|
||||
return (int) (getWorld().getWorldTime() % 24000L);
|
||||
final WorldClient world = getWorld();
|
||||
return (int) ((AngelicaConfig.useTotalWorldTime ? world.getTotalWorldTime() : world.getWorldTime()) % 24000L);
|
||||
|
||||
// long dayTime = ((DimensionTypeAccessor) getWorld().dimensionType()).getFixedTime().orElse(timeOfDay % 24000L);
|
||||
}
|
||||
|
||||
private static int getWorldDay() {
|
||||
return (int) (getWorld().getWorldTime() / 24000L);
|
||||
return (int) (getWorld().getTotalWorldTime() / 24000L);
|
||||
}
|
||||
|
||||
private static WorldClient getWorld() {
|
||||
|
||||
@@ -8,6 +8,8 @@ public net.minecraft.client.renderer.EntityRenderer field_78503_V # cameraZoom
|
||||
public net.minecraft.client.renderer.EntityRenderer field_78502_W # cameraYaw
|
||||
public net.minecraft.client.renderer.EntityRenderer field_78509_X # cameraPitch
|
||||
public net.minecraft.client.renderer.EntityRenderer field_78530_s # farPlaneDistance
|
||||
public net.minecraft.client.renderer.EntityRenderer field_78527_v # mouseFilterXAxis
|
||||
public net.minecraft.client.renderer.EntityRenderer field_78526_w # mouseFilterYAxis
|
||||
|
||||
public net.minecraft.client.renderer.RenderGlobal field_72765_l # worldRenderers
|
||||
|
||||
|
||||
@@ -132,7 +132,9 @@ options.iris.shadowDistance.disabled=Your current shader pack has already set a
|
||||
options.iris.gui.hide=Hide GUI
|
||||
options.iris.gui.show=Show GUI
|
||||
options.dynamic_lights=Dynamic Lights
|
||||
options.dynamic_lights.tooltip=Enables dynamic lights. Modes: OFF - off, FASTEST - 500ms delay, FAST - 250ms delay, FANCY - no delay. Disabled if shaders are in use.
|
||||
options.dynamic_lights.tooltip=Enables dynamic lights. Modes: OFF - off, FASTEST - 500ms delay, FAST - 250ms delay, FANCY - 50ms delay, REALTIME - no delay.
|
||||
options.dynamic_lights_shader_force=Dynamic Lights - Forced With Shaders
|
||||
options.dynamic_lights_shader_force.tooltip=Enabled - Dynamic Lights are shown even when a shader is active, Disabled - Dynamic Lights are disabled when a shader is active.
|
||||
options.angelica.droppedItemLimit=Dropped Item Render Limit
|
||||
options.angelica.droppedItemLimit.tooltip=The maximum number of dropped items that will be rendered. Lower values can improve performance.
|
||||
pack.iris.select.title=Select
|
||||
|
||||
+1
-2
@@ -18,8 +18,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
public class MixinRenderGlobal_DestroyBlock {
|
||||
@Inject(
|
||||
method = "drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;startDrawingQuads()V"),
|
||||
remap = false
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;startDrawingQuads()V")
|
||||
)
|
||||
private void iris$beginDrawBlockDamageTexture(Tessellator tessellator, EntityLivingBase entity, float partialTicks, CallbackInfo ci, @Share("lastMin") LocalIntRef lastMin, @Share("lastMag") LocalIntRef lastMag) {
|
||||
TextureInfo info = TextureInfoCache.INSTANCE.getInfo(GLStateManager.getBoundTexture());
|
||||
|
||||
-15
@@ -73,19 +73,6 @@ public abstract class MixinEntity implements IDynamicLightSource {
|
||||
this.angelica$lastLuminance = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean angelica$shouldUpdateDynamicLight() {
|
||||
if (DynamicLights.Mode.hasDelay()) {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (currentTime < angelica$lastUpdate + DynamicLights.Mode.getDelay())
|
||||
return false;
|
||||
|
||||
angelica$lastUpdate = currentTime;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "onEntityUpdate", at = @At("TAIL"))
|
||||
public void angelica$onUpdate(CallbackInfo ci) {
|
||||
@@ -111,8 +98,6 @@ public abstract class MixinEntity implements IDynamicLightSource {
|
||||
|
||||
@Override
|
||||
public boolean angelica$updateDynamicLight(@NotNull SodiumWorldRenderer renderer) {
|
||||
if (!this.angelica$shouldUpdateDynamicLight())
|
||||
return false;
|
||||
double deltaX = this.posX - this.angelica$prevX;
|
||||
double deltaY = this.posY - this.angelica$prevY;
|
||||
double deltaZ = this.posZ - this.angelica$prevZ;
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.angelica.zoom;
|
||||
|
||||
import com.gtnewhorizons.angelica.zoom.Zoom;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(EntityRenderer.class)
|
||||
public class MixinEntityRenderer_Zoom {
|
||||
|
||||
@ModifyReturnValue(method = "getFOVModifier", at = @At("RETURN"))
|
||||
private float angelica$modifyFOV(float original) {
|
||||
if (Zoom.getZoomKey().getIsKeyPressed()) {
|
||||
return original / Zoom.getZoom();
|
||||
}
|
||||
return original;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "updateCameraAndRender", constant = @Constant(floatValue = 8.0F))
|
||||
private float angelica$modifyMouseSensitivity(float original) {
|
||||
if (Zoom.getZoomKey().getIsKeyPressed()) {
|
||||
return original / (1.0F + 0.2F * (Zoom.getZoom() - Zoom.ZOOM_MIN));
|
||||
}
|
||||
return original;
|
||||
}
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.angelica.zoom;
|
||||
|
||||
import com.gtnewhorizons.angelica.zoom.Zoom;
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public class MixinMinecraft_Zoom {
|
||||
|
||||
@ModifyExpressionValue(method = "runTick", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I", remap = false))
|
||||
private int angelica$captureMouseWheel(int original) {
|
||||
if (Zoom.getZoomKey().getIsKeyPressed()) {
|
||||
Zoom.modifyZoom(original);
|
||||
return 0;
|
||||
}
|
||||
return original;
|
||||
}
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.angelica.zoom;
|
||||
|
||||
import com.gtnewhorizons.angelica.zoom.IMouseFilterExt;
|
||||
import net.minecraft.util.MouseFilter;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(MouseFilter.class)
|
||||
public class MixinMouseFilter implements IMouseFilterExt {
|
||||
|
||||
@Shadow
|
||||
private float field_76336_a;
|
||||
|
||||
@Shadow
|
||||
private float field_76334_b;
|
||||
|
||||
@Shadow
|
||||
private float field_76335_c;
|
||||
|
||||
@Override
|
||||
public void angelica$reset() {
|
||||
this.field_76336_a = 0.0F;
|
||||
this.field_76334_b = 0.0F;
|
||||
this.field_76335_c = 0.0F;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -46,7 +46,7 @@ public abstract class MixinEntityRenderer implements IResourceManagerReloadListe
|
||||
pipeline.get().beginLevelRendering();
|
||||
}
|
||||
|
||||
@Inject(method = "renderWorld(FJ)V", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/ForgeHooksClient;dispatchRenderLast(Lnet/minecraft/client/renderer/RenderGlobal;F)V"))
|
||||
@Inject(method = "renderWorld(FJ)V", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/ForgeHooksClient;dispatchRenderLast(Lnet/minecraft/client/renderer/RenderGlobal;F)V", remap = false))
|
||||
private void iris$endLevelRender(float partialTicks, long limitTime, CallbackInfo callback, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
|
||||
// TODO: Iris
|
||||
final Camera camera = new Camera(mc.renderViewEntity, partialTicks);
|
||||
@@ -109,7 +109,7 @@ public abstract class MixinEntityRenderer implements IResourceManagerReloadListe
|
||||
pipeline.get().setPhase(WorldRenderingPhase.NONE);
|
||||
}
|
||||
|
||||
@WrapOperation(method = "renderWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderGlobal;drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V"))
|
||||
@WrapOperation(method = "renderWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderGlobal;drawBlockDamageTexture(Lnet/minecraft/client/renderer/Tessellator;Lnet/minecraft/entity/EntityLivingBase;F)V", remap = false))
|
||||
private void iris$blockDamageTexture(RenderGlobal instance, Tessellator tessellator, EntityLivingBase entity, float partialTicks, Operation<Void> original, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
|
||||
pipeline.get().setPhase(WorldRenderingPhase.DESTROY);
|
||||
original.call(instance, tessellator, entity, partialTicks);
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.SpecialCondition;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.minecraft.client.renderer.entity.RenderDragon;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
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(RenderDragon.class)
|
||||
public class MixinRenderDragon {
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/entity/RenderDragon;shouldRenderPass(Lnet/minecraft/entity/boss/EntityDragon;IF)I", at = @At(value="RETURN", ordinal = 1))
|
||||
private void onShouldRenderPass(EntityDragon entity, int pass, float partialTicks, CallbackInfoReturnable<Integer> cir) {
|
||||
GbufferPrograms.setupSpecialRenderCondition(SpecialCondition.ENTITY_EYES);
|
||||
}
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.SpecialCondition;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.minecraft.client.renderer.entity.RenderEnderman;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
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(RenderEnderman.class)
|
||||
public class MixinRenderEnderman {
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/entity/RenderEnderman;shouldRenderPass(Lnet/minecraft/entity/monster/EntityEnderman;IF)I", at = @At(value="RETURN", ordinal = 1))
|
||||
private void onShouldRenderPass(EntityEnderman entity, int pass, float partialTicks, CallbackInfoReturnable<Integer> cir) {
|
||||
GbufferPrograms.setupSpecialRenderCondition(SpecialCondition.ENTITY_EYES);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.SpecialCondition;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.minecraft.client.renderer.entity.RenderSpider;
|
||||
import net.minecraft.entity.monster.EntitySpider;
|
||||
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(RenderSpider.class)
|
||||
public class MixinRenderSpider {
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/entity/RenderSpider;shouldRenderPass(Lnet/minecraft/entity/monster/EntitySpider;IF)I", at = @At(value="RETURN", ordinal = 1))
|
||||
private void onShouldRenderPass(EntitySpider entity, int pass, float partialTicks, CallbackInfoReturnable<Integer> cir) {
|
||||
GbufferPrograms.setupSpecialRenderCondition(SpecialCondition.ENTITY_EYES);
|
||||
}
|
||||
|
||||
}
|
||||
+22
-8
@@ -2,18 +2,22 @@ package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.SpecialCondition;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.coderbot.iris.uniforms.CapturedRenderingState;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderDragon;
|
||||
import net.minecraft.client.renderer.entity.RenderEnderman;
|
||||
import net.minecraft.client.renderer.entity.RenderSpider;
|
||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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;
|
||||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
|
||||
@Mixin(RendererLivingEntity.class)
|
||||
public class MixinRendererLivingEntity {
|
||||
|
||||
@WrapOperation(
|
||||
method="doRender",
|
||||
at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/entity/RendererLivingEntity;getColorMultiplier(Lnet/minecraft/entity/EntityLivingBase;FF)I")
|
||||
@@ -28,11 +32,21 @@ public class MixinRendererLivingEntity {
|
||||
return j;
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method="Lnet/minecraft/client/renderer/entity/RendererLivingEntity;doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V", at=@At(value="INVOKE",
|
||||
target="Lnet/minecraft/client/renderer/entity/RendererLivingEntity;renderEquippedItems(Lnet/minecraft/entity/EntityLivingBase;F)V", shift=At.Shift.BEFORE)
|
||||
@WrapOperation(
|
||||
method = "doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelBase;render(Lnet/minecraft/entity/Entity;FFFFFF)V", ordinal = 0),
|
||||
slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RendererLivingEntity;shouldRenderPass(Lnet/minecraft/entity/EntityLivingBase;IF)I")
|
||||
)
|
||||
)
|
||||
private void iris$teardownSpecialRenderConditions(EntityLivingBase entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
|
||||
GbufferPrograms.teardownSpecialRenderCondition();
|
||||
private void iris$specialRenderConditionEntityEyes(ModelBase instance, Entity entity, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_, Operation<Void> original) {
|
||||
RendererLivingEntity self = (RendererLivingEntity) (Object) this;
|
||||
if (self instanceof RenderSpider || self instanceof RenderDragon || self instanceof RenderEnderman) {
|
||||
GbufferPrograms.setupSpecialRenderCondition(SpecialCondition.ENTITY_EYES);
|
||||
original.call(instance, entity, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_);
|
||||
GbufferPrograms.teardownSpecialRenderCondition();
|
||||
} else {
|
||||
original.call(instance, entity, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-5
@@ -140,6 +140,14 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Unique
|
||||
private void iris$beginTranslucents(WorldRenderingPipeline pipeline, Camera camera) {
|
||||
pipeline.beginHand();
|
||||
HandRenderer.INSTANCE.renderSolid(camera.getPartialTicks(), camera, mc.renderGlobal, pipeline);
|
||||
mc.mcProfiler.endStartSection("iris_pre_translucent");
|
||||
pipeline.beginTranslucents();
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Sodium
|
||||
* @reason Redirect to our renderer
|
||||
@@ -156,13 +164,11 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
} else if(pass == 1) {
|
||||
final Camera camera = new Camera(mc.renderViewEntity, (float) partialTicks);
|
||||
|
||||
// iris$beginTranslucents
|
||||
pipeline.beginHand();
|
||||
HandRenderer.INSTANCE.renderSolid((float) partialTicks, camera, mc.renderGlobal, pipeline);
|
||||
if (!ShadowRenderer.ACTIVE) {
|
||||
iris$beginTranslucents(pipeline, camera);
|
||||
}
|
||||
|
||||
mc.mcProfiler.endStartSection("iris_pre_translucent");
|
||||
pipeline.setPhase(WorldRenderingPhase.TERRAIN_TRANSLUCENT);
|
||||
pipeline.beginTranslucents();
|
||||
this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
}
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.late.client.journeymap;
|
||||
|
||||
import journeymap.client.render.map.TileDrawStep;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(TileDrawStep.class)
|
||||
public class MixinTileDrawStep {
|
||||
@Redirect(method = "*", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Ljourneymap/client/render/map/TileDrawStep;debug:Z", remap = false))
|
||||
private boolean getDebug(TileDrawStep instance) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user