aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--settings.gradle.kts3
-rw-r--r--versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java18
-rw-r--r--versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java94
-rw-r--r--versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java36
-rw-r--r--versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java23
-rw-r--r--versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java21
-rw-r--r--versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java14
-rw-r--r--versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java8
-rw-r--r--versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java21
-rw-r--r--versions/1.8.9-1.16.2.txt19
-rw-r--r--versions/root.gradle.kts1
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java4
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java2
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java32
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java166
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java64
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java42
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java38
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java4
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java12
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java38
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/ClassTransformer.java1
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java23
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java4
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/TestMod_Test.java6
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl.java3
26 files changed, 251 insertions, 446 deletions
diff --git a/settings.gradle.kts b/settings.gradle.kts
index a78ecd3..84d4c0d 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -35,7 +35,8 @@ project(":platform").apply {
listOf(
"1.8.9-forge",
- "1.12.2-forge"
+ "1.12.2-forge",
+ "1.16.2-forge"
).forEach { version ->
include(":platform:$version")
project(":platform:$version").apply {
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java
deleted file mode 100644
index 775e055..0000000
--- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package cc.polyfrost.oneconfig.internal.mixin;
-
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.HudRenderEvent;
-import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
-import net.minecraftforge.client.GuiIngameForge;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(value = GuiIngameForge.class, remap = false)
-public class GuiIngameForgeMixin {
- @Inject(method = "renderGameOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/GuiIngameForge;post(Lnet/minecraftforge/client/event/RenderGameOverlayEvent$ElementType;)V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onRenderGameOverlay(float partialTicks, CallbackInfo ci) {
- EventManager.INSTANCE.post(new HudRenderEvent(new UMatrixStack(), partialTicks));
- }
-} \ No newline at end of file
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
deleted file mode 100644
index 9492238..0000000
--- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package cc.polyfrost.oneconfig.internal.mixin;
-
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.*;
-import cc.polyfrost.oneconfig.internal.OneConfig;
-import net.minecraft.client.Minecraft;
-import net.minecraft.util.Timer;
-import net.minecraftforge.client.event.GuiOpenEvent;
-import net.minecraftforge.fml.common.eventhandler.Event;
-import org.spongepowered.asm.mixin.Final;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.ModifyArg;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(Minecraft.class)
-public class MinecraftMixin {
- @Final
- @Shadow
- private Timer timer;
-
- @Inject(method = "shutdownMinecraftApplet", at = @At("HEAD"))
- private void onShutdown(CallbackInfo ci) {
- EventManager.INSTANCE.post(new PreShutdownEvent());
- }
-
- @Inject(method = "init", at = @At("HEAD"))
- private void onStart(CallbackInfo ci) {
- EventManager.INSTANCE.post(new StartEvent());
- Runtime.getRuntime().addShutdownHook(new Thread(() -> EventManager.INSTANCE.post(new ShutdownEvent())));
- }
-
- @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;beginMinecraftLoading(Lnet/minecraft/client/Minecraft;Ljava/util/List;Lnet/minecraft/client/resources/IReloadableResourceManager;Lnet/minecraft/client/resources/data/MetadataSerializer;)V", remap = false), remap = true)
- private void onPreLaunch(CallbackInfo ci) {
- OneConfig.preLaunch();
- }
-
- @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;onInitializationComplete()V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onInit(CallbackInfo ci) {
- EventManager.INSTANCE.post(new InitializationEvent());
- OneConfig.init();
- }
-
- @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onRenderTickStart(F)V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onRenderTickStart(CallbackInfo ci) {
- EventManager.INSTANCE.post(new RenderEvent(Stage.START, timer.renderPartialTicks));
- }
-
- @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onRenderTickEnd(F)V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onRenderTickEnd(CallbackInfo ci) {
- EventManager.INSTANCE.post(new RenderEvent(Stage.END, timer.renderPartialTicks));
- }
-
- @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onPreClientTick()V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onClientTickStart(CallbackInfo ci) {
- EventManager.INSTANCE.post(new TickEvent(Stage.START));
- }
-
- @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onPostClientTick()V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onClientTickEnd(CallbackInfo ci) {
- EventManager.INSTANCE.post(new TickEvent(Stage.END));
- }
-
- @ModifyArg(method = "displayGuiScreen", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/eventhandler/EventBus;post(Lnet/minecraftforge/fml/common/eventhandler/Event;)Z", remap = false), remap = true)
- private Event onGuiOpenEvent(Event a) {
- if (a instanceof GuiOpenEvent) {
- GuiOpenEvent forgeEvent = (GuiOpenEvent) a;
- ScreenOpenEvent event = new ScreenOpenEvent(forgeEvent.getGui());
- EventManager.INSTANCE.post(event);
- if (event.isCancelled) {
- forgeEvent.setCanceled(true);
- }
- return forgeEvent;
- }
- return a;
- }
-
- @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Timer;updateTimer()V", shift = At.Shift.AFTER))
- private void onDeltaTickTimerUpdate(CallbackInfo ci) {
- EventManager.INSTANCE.post(new TimerUpdateEvent(timer, true));
- }
-
- @Inject(method = "runTickKeyboard", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;fireKeyInput()V"))
- private void onKeyEvent(CallbackInfo ci) {
- EventManager.INSTANCE.post(new KeyInputEvent());
- }
-
- @Inject(method = "runTickMouse", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;fireMouseInput()V"))
- private void onMouseEvent(CallbackInfo ci) {
- EventManager.INSTANCE.post(new MouseInputEvent());
- }
-} \ No newline at end of file
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java
deleted file mode 100644
index 5b54e8e..0000000
--- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package cc.polyfrost.oneconfig.internal.mixin;
-
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.ChatReceiveEvent;
-import cc.polyfrost.oneconfig.events.event.SendPacketEvent;
-import net.minecraft.client.network.NetHandlerPlayClient;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.SPacketChat;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(value = NetHandlerPlayClient.class, priority = Integer.MAX_VALUE)
-public class NetHandlerPlayClientMixin {
-
- @Inject(method = "sendPacket", at = @At("HEAD"), cancellable = true)
- private void onSendPacket(Packet<?> p_147297_1_, CallbackInfo ci) {
- SendPacketEvent event = new SendPacketEvent(p_147297_1_);
- EventManager.INSTANCE.post(event);
- if (event.isCancelled) {
- ci.cancel();
- }
- }
-
- @Inject(method = "handleChat", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/event/ForgeEventFactory;onClientChat(Lnet/minecraft/util/text/ChatType;Lnet/minecraft/util/text/ITextComponent;)Lnet/minecraft/util/text/ITextComponent;", remap = false), cancellable = true, remap = true)
- private void onClientChat(SPacketChat packetIn, CallbackInfo ci) {
- if (packetIn.getType().getId() == 0) {
- ChatReceiveEvent event = new ChatReceiveEvent(packetIn.getChatComponent());
- EventManager.INSTANCE.post(event);
- if (event.isCancelled) {
- ci.cancel();
- }
- }
- }
-} \ No newline at end of file
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java
deleted file mode 100644
index 7ddaf80..0000000
--- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package cc.polyfrost.oneconfig.internal.mixin;
-
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.ReceivePacketEvent;
-import io.netty.channel.ChannelHandlerContext;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(value = NetworkManager.class, priority = Integer.MAX_VALUE)
-public class NetworkManagerMixin {
- @Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
- private void onReceivePacket(ChannelHandlerContext p_channelRead0_1_, Packet<?> p_channelRead0_2_, CallbackInfo ci) {
- ReceivePacketEvent event = new ReceivePacketEvent(p_channelRead0_2_);
- EventManager.INSTANCE.post(event);
- if (event.isCancelled) {
- ci.cancel();
- }
- }
-} \ No newline at end of file
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java
deleted file mode 100644
index eb6fc03..0000000
--- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package cc.polyfrost.oneconfig.internal.mixin;
-
-import cc.polyfrost.oneconfig.internal.plugin.hooks.OptifineConfigHook;
-import org.spongepowered.asm.mixin.Dynamic;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Pseudo;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-@Pseudo
-@Mixin(targets = "Config", remap = false)
-public class OptifineConfigMixin {
- @Dynamic("OptiFine")
- @Inject(method = "isFastRender", at = @At("HEAD"), cancellable = true)
- private static void cancelFastRender(CallbackInfoReturnable<Boolean> cir) {
- if (OptifineConfigHook.shouldNotApplyFastRender()) {
- cir.setReturnValue(false);
- }
- }
-} \ No newline at end of file
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java
deleted file mode 100644
index 2ec0024..0000000
--- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package cc.polyfrost.oneconfig.internal.mixin;
-
-import net.minecraft.client.shader.Shader;
-import net.minecraft.client.shader.ShaderGroup;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-import java.util.List;
-
-@Mixin(ShaderGroup.class)
-public interface ShaderGroupAccessor {
- @Accessor("listShaders")
- List<Shader> getListShaders();
-} \ No newline at end of file
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java
deleted file mode 100644
index 04e3fe9..0000000
--- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package cc.polyfrost.oneconfig.internal.mixin;
-
-import gg.essential.vigilance.Vigilant;
-import org.spongepowered.asm.mixin.Mixin;
-
-@Mixin(Vigilant.class)
-public class VigilantMixin {
-} \ No newline at end of file
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java
deleted file mode 100644
index 42caec3..0000000
--- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package cc.polyfrost.oneconfig.internal.mixin;
-
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.WorldLoadEvent;
-import net.minecraft.client.multiplayer.WorldClient;
-import net.minecraft.client.network.NetHandlerPlayClient;
-import net.minecraft.profiler.Profiler;
-import net.minecraft.world.EnumDifficulty;
-import net.minecraft.world.WorldSettings;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(WorldClient.class)
-public class WorldClientMixin {
- @Inject(method = "<init>", at = @At("RETURN"))
- private void onWorldLoad(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_, CallbackInfo ci) {
- EventManager.INSTANCE.post(new WorldLoadEvent());
- }
-} \ No newline at end of file
diff --git a/versions/1.8.9-1.16.2.txt b/versions/1.8.9-1.16.2.txt
new file mode 100644
index 0000000..1f07e30
--- /dev/null
+++ b/versions/1.8.9-1.16.2.txt
@@ -0,0 +1,19 @@
+net.minecraft.util.IChatComponent getUnformattedText() getUnformattedComponentText()
+net.minecraft.util.IChatComponent net.minecraft.util.text.ITextComponent
+net.minecraft.util.BlockPos net.minecraft.util.math.BlockPos
+net.minecraft.client.renderer.WorldRenderer net.minecraft.client.renderer.BufferBuilder
+net.minecraft.network.Packet net.minecraft.network.IPacket
+net.minecraft.client.gui.GuiScreen net.minecraft.client.gui.screen.Screen
+net.minecraft.client.gui.GuiChat net.minecraft.client.gui.screen.ChatScreen
+net.minecraft.client.Minecraft getMinecraft() getInstance()
+net.minecraft.client.Minecraft isCallingFromMinecraftThread() isOnExecutionThread()
+net.minecraft.client.entity.EntityPlayerSP getClientBrand() getServerBrand()
+net.minecraft.client.entity.EntityPlayerSP net.minecraft.client.entity.player.ClientPlayerEntity
+net.minecraft.launchwrapper.IClassTransformer transform() transformClassBytes()
+net.minecraft.launchwrapper.IClassTransformer org.spongepowered.asm.service.ILegacyClassTransformer
+net.minecraft.client.Minecraft entityRenderer gameRenderer
+net.minecraftforge.fml.common.event.FMLInitializationEvent net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
+net.minecraft.client.shader.ShaderUniform net.minecraft.client.shader.ShaderDefault
+net.minecraftforge.fml.common.Loader instance() get()
+net.minecraftforge.fml.common.Loader net.minecraftforge.fml.ModLoadingContext
+net.minecraftforge.fml.common.ModContainer net.minecraftforge.fml.ModContainer \ No newline at end of file
diff --git a/versions/root.gradle.kts b/versions/root.gradle.kts
index 20d3be6..a35e559 100644
--- a/versions/root.gradle.kts
+++ b/versions/root.gradle.kts
@@ -7,5 +7,6 @@ plugins {
preprocess {
"1.8.9-forge"(10809, "srg") {
"1.12.2-forge"(11202, "srg", file("1.8.9-1.12.2.txt"))
+ "1.16.2-forge"(11605, "srg", file("1.8.9-1.16.2.txt"))
}
} \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
index 7ecfe98..5b928a8 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
@@ -22,7 +22,11 @@ import java.util.ServiceLoader;
/**
* The main class of OneConfig.
*/
+//#if MC<=11202
@net.minecraftforge.fml.common.Mod(modid = "@ID@", name = "@NAME@", version = "@VER@")
+//#else
+//$$ @net.minecraftforge.fml.common.Mod("@ID@")
+//#endif
public class OneConfig {
public OneConfig() {
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java
index 0ef5f2b..8d0d550 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java
@@ -65,7 +65,7 @@ public class BlurHandlerImpl implements BlurHandler {
// Why is this being computed every tick? Surely there is a better way?
// This needs to be optimized.
try {
- final List<Shader> listShaders = ((ShaderGroupAccessor) Minecraft.getMinecraft().entityRenderer.getShaderGroup()).getListShaders();
+ final List<Shader> listShaders = ((ShaderGroupAccessor) UMinecraft.getMinecraft().entityRenderer.getShaderGroup()).getListShaders();
// Should not happen. Something bad happened.
if (listShaders == null) {
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java
index ebf4f0a..2a49f74 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java
@@ -1,20 +1,20 @@
//#if MC==10809
-package cc.polyfrost.oneconfig.internal.mixin;
+ package cc.polyfrost.oneconfig.internal.mixin;
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.HudRenderEvent;
-import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
-import net.minecraftforge.client.GuiIngameForge;
-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 cc.polyfrost.oneconfig.events.EventManager;
+ import cc.polyfrost.oneconfig.events.event.HudRenderEvent;
+ import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
+ import net.minecraftforge.client.GuiIngameForge;
+ import org.spongepowered.asm.mixin.Mixin;
+ import org.spongepowered.asm.mixin.injection.At;
+ import org.spongepowered.asm.mixin.injection.Inject;
+ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(value = GuiIngameForge.class, remap = false)
-public class GuiIngameForgeMixin {
- @Inject(method = "renderGameOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/GuiIngameForge;post(Lnet/minecraftforge/client/event/RenderGameOverlayEvent$ElementType;)V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onRenderGameOverlay(float partialTicks, CallbackInfo ci) {
- EventManager.INSTANCE.post(new HudRenderEvent(new UMatrixStack(), partialTicks));
- }
-}
+ @Mixin(value = GuiIngameForge.class, remap = false)
+ public class GuiIngameForgeMixin {
+ @Inject(method = "renderGameOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/GuiIngameForge;post(Lnet/minecraftforge/client/event/RenderGameOverlayEvent$ElementType;)V", shift = At.Shift.AFTER, remap = false), remap = true)
+ private void onRenderGameOverlay(float partialTicks, CallbackInfo ci) {
+ EventManager.INSTANCE.post(new HudRenderEvent(new UMatrixStack(), partialTicks));
+ }
+ }
//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
index 0603d12..46d9bbc 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
@@ -1,100 +1,100 @@
//#if MC==10809
-package cc.polyfrost.oneconfig.internal.mixin;
+ package cc.polyfrost.oneconfig.internal.mixin;
-import cc.polyfrost.oneconfig.internal.OneConfig;
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.*;
-import net.minecraft.client.Minecraft;
-import net.minecraft.util.Timer;
-import net.minecraftforge.client.event.GuiOpenEvent;
-import net.minecraftforge.fml.common.eventhandler.Event;
-import org.objectweb.asm.Opcodes;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.ModifyArg;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+ import cc.polyfrost.oneconfig.internal.OneConfig;
+ import cc.polyfrost.oneconfig.events.EventManager;
+ import cc.polyfrost.oneconfig.events.event.*;
+ import net.minecraft.client.Minecraft;
+ import net.minecraft.util.Timer;
+ import net.minecraftforge.client.event.GuiOpenEvent;
+ import net.minecraftforge.fml.common.eventhandler.Event;
+ import org.objectweb.asm.Opcodes;
+ import org.spongepowered.asm.mixin.Mixin;
+ import org.spongepowered.asm.mixin.Shadow;
+ import org.spongepowered.asm.mixin.injection.At;
+ import org.spongepowered.asm.mixin.injection.Inject;
+ import org.spongepowered.asm.mixin.injection.ModifyArg;
+ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(Minecraft.class)
-public class MinecraftMixin {
- @Shadow
- private Timer timer;
+ @Mixin(Minecraft.class)
+ public class MinecraftMixin {
+ @Shadow
+ private Timer timer;
- @Inject(method = "shutdownMinecraftApplet", at = @At("HEAD"))
- private void onShutdown(CallbackInfo ci) {
- EventManager.INSTANCE.post(new PreShutdownEvent());
- }
+ @Inject(method = "shutdownMinecraftApplet", at = @At("HEAD"))
+ private void onShutdown(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new PreShutdownEvent());
+ }
- @Inject(method = "startGame", at = @At("HEAD"))
- private void onStart(CallbackInfo ci) {
- EventManager.INSTANCE.post(new StartEvent());
- Runtime.getRuntime().addShutdownHook(new Thread(() -> EventManager.INSTANCE.post(new ShutdownEvent())));
- }
+ @Inject(method = "startGame", at = @At("HEAD"))
+ private void onStart(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new StartEvent());
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> EventManager.INSTANCE.post(new ShutdownEvent())));
+ }
- @Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;beginMinecraftLoading(Lnet/minecraft/client/Minecraft;Ljava/util/List;Lnet/minecraft/client/resources/IReloadableResourceManager;)V", remap = false), remap = true)
- private void onPreLaunch(CallbackInfo ci) {
- OneConfig.preLaunch();
- }
+ @Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;beginMinecraftLoading(Lnet/minecraft/client/Minecraft;Ljava/util/List;Lnet/minecraft/client/resources/IReloadableResourceManager;)V", remap = false), remap = true)
+ private void onPreLaunch(CallbackInfo ci) {
+ OneConfig.preLaunch();
+ }
- @Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;onInitializationComplete()V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onInit(CallbackInfo ci) {
- EventManager.INSTANCE.post(new InitializationEvent());
- OneConfig.init();
- }
+ @Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;onInitializationComplete()V", shift = At.Shift.AFTER, remap = false), remap = true)
+ private void onInit(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new InitializationEvent());
+ OneConfig.init();
+ }
- @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onRenderTickStart(F)V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onRenderTickStart(CallbackInfo ci) {
- EventManager.INSTANCE.post(new RenderEvent(Stage.START, timer.renderPartialTicks));
- }
+ @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onRenderTickStart(F)V", shift = At.Shift.AFTER, remap = false), remap = true)
+ private void onRenderTickStart(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new RenderEvent(Stage.START, timer.renderPartialTicks));
+ }
- @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onRenderTickEnd(F)V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onRenderTickEnd(CallbackInfo ci) {
- EventManager.INSTANCE.post(new RenderEvent(Stage.END, timer.renderPartialTicks));
- }
+ @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onRenderTickEnd(F)V", shift = At.Shift.AFTER, remap = false), remap = true)
+ private void onRenderTickEnd(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new RenderEvent(Stage.END, timer.renderPartialTicks));
+ }
- @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onPreClientTick()V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onClientTickStart(CallbackInfo ci) {
- EventManager.INSTANCE.post(new TickEvent(Stage.START));
- }
+ @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onPreClientTick()V", shift = At.Shift.AFTER, remap = false), remap = true)
+ private void onClientTickStart(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new TickEvent(Stage.START));
+ }
- @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onPostClientTick()V", shift = At.Shift.AFTER, remap = false), remap = true)
- private void onClientTickEnd(CallbackInfo ci) {
- EventManager.INSTANCE.post(new TickEvent(Stage.END));
- }
+ @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;onPostClientTick()V", shift = At.Shift.AFTER, remap = false), remap = true)
+ private void onClientTickEnd(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new TickEvent(Stage.END));
+ }
- @ModifyArg(method = "displayGuiScreen", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/eventhandler/EventBus;post(Lnet/minecraftforge/fml/common/eventhandler/Event;)Z", remap = false), remap = true)
- private Event onGuiOpenEvent(Event a) {
- if (a instanceof GuiOpenEvent) {
- GuiOpenEvent forgeEvent = (GuiOpenEvent) a;
- ScreenOpenEvent event = new ScreenOpenEvent(forgeEvent.gui);
- EventManager.INSTANCE.post(event);
- if (event.isCancelled) {
- forgeEvent.setCanceled(true);
- }
- return forgeEvent;
- }
- return a;
- }
+ @ModifyArg(method = "displayGuiScreen", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/eventhandler/EventBus;post(Lnet/minecraftforge/fml/common/eventhandler/Event;)Z", remap = false), remap = true)
+ private Event onGuiOpenEvent(Event a) {
+ if (a instanceof GuiOpenEvent) {
+ GuiOpenEvent forgeEvent = (GuiOpenEvent) a;
+ ScreenOpenEvent event = new ScreenOpenEvent(forgeEvent.gui);
+ EventManager.INSTANCE.post(event);
+ if (event.isCancelled) {
+ forgeEvent.setCanceled(true);
+ }
+ return forgeEvent;
+ }
+ return a;
+ }
- @Inject(method = "runGameLoop", at = @At(value = "FIELD", target = "Lnet/minecraft/util/Timer;renderPartialTicks:F", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER))
- private void onNonDeltaTickTimerUpdate(CallbackInfo ci) {
- EventManager.INSTANCE.post(new TimerUpdateEvent(timer, false));
- }
+ @Inject(method = "runGameLoop", at = @At(value = "FIELD", target = "Lnet/minecraft/util/Timer;renderPartialTicks:F", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER))
+ private void onNonDeltaTickTimerUpdate(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new TimerUpdateEvent(timer, false));
+ }
- @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Timer;updateTimer()V", shift = At.Shift.AFTER, ordinal = 1))
- private void onDeltaTickTimerUpdate(CallbackInfo ci) {
- EventManager.INSTANCE.post(new TimerUpdateEvent(timer, true));
- }
+ @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Timer;updateTimer()V", shift = At.Shift.AFTER, ordinal = 1))
+ private void onDeltaTickTimerUpdate(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new TimerUpdateEvent(timer, true));
+ }
- @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;fireKeyInput()V"))
- private void onKeyEvent(CallbackInfo ci) {
- EventManager.INSTANCE.post(new KeyInputEvent());
- }
+ @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;fireKeyInput()V"))
+ private void onKeyEvent(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new KeyInputEvent());
+ }
- @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;fireMouseInput()V"))
- private void onMouseEvent(CallbackInfo ci) {
- EventManager.INSTANCE.post(new MouseInputEvent());
- }
-}
+ @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/FMLCommonHandler;fireMouseInput()V"))
+ private void onMouseEvent(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new MouseInputEvent());
+ }
+ }
//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java
index 7a446c7..0496e98 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java
@@ -1,38 +1,38 @@
//#if MC==10809
-package cc.polyfrost.oneconfig.internal.mixin;
+ package cc.polyfrost.oneconfig.internal.mixin;
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.ChatReceiveEvent;
-import cc.polyfrost.oneconfig.events.event.SendPacketEvent;
-import net.minecraft.client.network.NetHandlerPlayClient;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S02PacketChat;
-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 cc.polyfrost.oneconfig.events.EventManager;
+ import cc.polyfrost.oneconfig.events.event.ChatReceiveEvent;
+ import cc.polyfrost.oneconfig.events.event.SendPacketEvent;
+ import net.minecraft.client.network.NetHandlerPlayClient;
+ import net.minecraft.network.Packet;
+ import net.minecraft.network.play.server.S02PacketChat;
+ import org.spongepowered.asm.mixin.Mixin;
+ import org.spongepowered.asm.mixin.injection.At;
+ import org.spongepowered.asm.mixin.injection.Inject;
+ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(value = NetHandlerPlayClient.class, priority = Integer.MAX_VALUE)
-public class NetHandlerPlayClientMixin {
+ @Mixin(value = NetHandlerPlayClient.class, priority = Integer.MAX_VALUE)
+ public class NetHandlerPlayClientMixin {
- @Inject(method = "addToSendQueue", at = @At("HEAD"), cancellable = true)
- private void onSendPacket(Packet<?> p_147297_1_, CallbackInfo ci) {
- SendPacketEvent event = new SendPacketEvent(p_147297_1_);
- EventManager.INSTANCE.post(event);
- if (event.isCancelled) {
- ci.cancel();
- }
- }
+ @Inject(method = "addToSendQueue", at = @At("HEAD"), cancellable = true)
+ private void onSendPacket(Packet<?> p_147297_1_, CallbackInfo ci) {
+ SendPacketEvent event = new SendPacketEvent(p_147297_1_);
+ EventManager.INSTANCE.post(event);
+ if (event.isCancelled) {
+ ci.cancel();
+ }
+ }
- @Inject(method = "handleChat", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/event/ForgeEventFactory;onClientChat(BLnet/minecraft/util/IChatComponent;)Lnet/minecraft/util/IChatComponent;", remap = false), cancellable = true, remap = true)
- private void onClientChat(S02PacketChat packetIn, CallbackInfo ci) {
- if (packetIn.getType() == 0) {
- ChatReceiveEvent event = new ChatReceiveEvent(packetIn.getChatComponent());
- EventManager.INSTANCE.post(event);
- if (event.isCancelled) {
- ci.cancel();
- }
- }
- }
-}
+ @Inject(method = "handleChat", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/event/ForgeEventFactory;onClientChat(BLnet/minecraft/util/IChatComponent;)Lnet/minecraft/util/IChatComponent;", remap = false), cancellable = true, remap = true)
+ private void onClientChat(S02PacketChat packetIn, CallbackInfo ci) {
+ if (packetIn.getType() == 0) {
+ ChatReceiveEvent event = new ChatReceiveEvent(packetIn.getChatComponent());
+ EventManager.INSTANCE.post(event);
+ if (event.isCancelled) {
+ ci.cancel();
+ }
+ }
+ }
+ }
//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java
index 3da0c91..ac81645 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java
@@ -1,25 +1,25 @@
//#if MC==10809
-package cc.polyfrost.oneconfig.internal.mixin;
+ package cc.polyfrost.oneconfig.internal.mixin;
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.ReceivePacketEvent;
-import io.netty.channel.ChannelHandlerContext;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-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 cc.polyfrost.oneconfig.events.EventManager;
+ import cc.polyfrost.oneconfig.events.event.ReceivePacketEvent;
+ import io.netty.channel.ChannelHandlerContext;
+ import net.minecraft.network.NetworkManager;
+ import net.minecraft.network.Packet;
+ import org.spongepowered.asm.mixin.Mixin;
+ import org.spongepowered.asm.mixin.injection.At;
+ import org.spongepowered.asm.mixin.injection.Inject;
+ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(value = NetworkManager.class, priority = Integer.MAX_VALUE)
-public class NetworkManagerMixin {
- @Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
- private void onReceivePacket(ChannelHandlerContext p_channelRead0_1_, Packet<?> p_channelRead0_2_, CallbackInfo ci) {
- ReceivePacketEvent event = new ReceivePacketEvent(p_channelRead0_2_);
- EventManager.INSTANCE.post(event);
- if (event.isCancelled) {
- ci.cancel();
- }
- }
-}
+ @Mixin(value = NetworkManager.class, priority = Integer.MAX_VALUE)
+ public class NetworkManagerMixin {
+ @Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
+ private void onReceivePacket(ChannelHandlerContext p_channelRead0_1_, Packet<?> p_channelRead0_2_, CallbackInfo ci) {
+ ReceivePacketEvent event = new ReceivePacketEvent(p_channelRead0_2_);
+ EventManager.INSTANCE.post(event);
+ if (event.isCancelled) {
+ ci.cancel();
+ }
+ }
+ }
//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java
index 9012091..3794daf 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java
@@ -1,23 +1,23 @@
//#if MC==10809
-package cc.polyfrost.oneconfig.internal.mixin;
+ package cc.polyfrost.oneconfig.internal.mixin;
-import cc.polyfrost.oneconfig.internal.plugin.hooks.OptifineConfigHook;
-import org.spongepowered.asm.mixin.Dynamic;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Pseudo;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+ import cc.polyfrost.oneconfig.internal.plugin.hooks.OptifineConfigHook;
+ import org.spongepowered.asm.mixin.Dynamic;
+ import org.spongepowered.asm.mixin.Mixin;
+ import org.spongepowered.asm.mixin.Pseudo;
+ import org.spongepowered.asm.mixin.injection.At;
+ import org.spongepowered.asm.mixin.injection.Inject;
+ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-@Pseudo
-@Mixin(targets = "Config", remap = false)
-public class OptifineConfigMixin {
- @Dynamic("OptiFine")
- @Inject(method = "isFastRender", at = @At("HEAD"), cancellable = true)
- private static void cancelFastRender(CallbackInfoReturnable<Boolean> cir) {
- if (OptifineConfigHook.shouldNotApplyFastRender()) {
- cir.setReturnValue(false);
- }
- }
-}
+ @Pseudo
+ @Mixin(targets = "Config", remap = false)
+ public class OptifineConfigMixin {
+ @Dynamic("OptiFine")
+ @Inject(method = "isFastRender", at = @At("HEAD"), cancellable = true)
+ private static void cancelFastRender(CallbackInfoReturnable<Boolean> cir) {
+ if (OptifineConfigHook.shouldNotApplyFastRender()) {
+ cir.setReturnValue(false);
+ }
+ }
+ }
//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java
index 588da19..2ec0024 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java
@@ -1,4 +1,3 @@
-//#if MC==10809
package cc.polyfrost.oneconfig.internal.mixin;
import net.minecraft.client.shader.Shader;
@@ -12,5 +11,4 @@ import java.util.List;
public interface ShaderGroupAccessor {
@Accessor("listShaders")
List<Shader> getListShaders();
-}
-//#endif \ No newline at end of file
+} \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java
index 6b474ab..11a5590 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java
@@ -1,10 +1,10 @@
//#if MC==10809
-package cc.polyfrost.oneconfig.internal.mixin;
+ package cc.polyfrost.oneconfig.internal.mixin;
-import gg.essential.vigilance.Vigilant;
-import org.spongepowered.asm.mixin.Mixin;
+ import gg.essential.vigilance.Vigilant;
+ import org.spongepowered.asm.mixin.Mixin;
-@Mixin(Vigilant.class)
-public class VigilantMixin {
-}
+ @Mixin(Vigilant.class)
+ public class VigilantMixin {
+ }
//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java
index 05c6920..fbf39fc 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java
@@ -1,23 +1,23 @@
//#if MC==10809
-package cc.polyfrost.oneconfig.internal.mixin;
+ package cc.polyfrost.oneconfig.internal.mixin;
-import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.events.event.WorldLoadEvent;
-import net.minecraft.client.multiplayer.WorldClient;
-import net.minecraft.client.network.NetHandlerPlayClient;
-import net.minecraft.profiler.Profiler;
-import net.minecraft.world.EnumDifficulty;
-import net.minecraft.world.WorldSettings;
-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 cc.polyfrost.oneconfig.events.EventManager;
+ import cc.polyfrost.oneconfig.events.event.WorldLoadEvent;
+ import net.minecraft.client.multiplayer.WorldClient;
+ import net.minecraft.client.network.NetHandlerPlayClient;
+ import net.minecraft.profiler.Profiler;
+ import net.minecraft.world.EnumDifficulty;
+ import net.minecraft.world.WorldSettings;
+ import org.spongepowered.asm.mixin.Mixin;
+ import org.spongepowered.asm.mixin.injection.At;
+ import org.spongepowered.asm.mixin.injection.Inject;
+ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(WorldClient.class)
-public class WorldClientMixin {
- @Inject(method = "<init>", at = @At("RETURN"))
- private void onWorldLoad(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_, CallbackInfo ci) {
- EventManager.INSTANCE.post(new WorldLoadEvent());
- }
-}
+ @Mixin(WorldClient.class)
+ public class WorldClientMixin {
+ @Inject(method = "<init>", at = @At("RETURN"))
+ private void onWorldLoad(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_, CallbackInfo ci) {
+ EventManager.INSTANCE.post(new WorldLoadEvent());
+ }
+ }
//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/ClassTransformer.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/ClassTransformer.java
index 52256ca..dca53a1 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/ClassTransformer.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/ClassTransformer.java
@@ -39,7 +39,6 @@ public class ClassTransformer implements IClassTransformer {
transformerMap.put(cls, transformer);
}
}
-
@Override
public byte[] transform(String name, String transformedName, byte[] bytes) {
if (bytes == null) return null;
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java
index 3ee962b..b53b357 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java
@@ -1,10 +1,9 @@
package cc.polyfrost.oneconfig.platform.impl;
+import cc.polyfrost.oneconfig.libs.universal.UGraphics;
import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
import cc.polyfrost.oneconfig.platform.GLPlatform;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -33,23 +32,23 @@ public class GLPlatformImpl implements GLPlatform {
float j = (float)(color & 0xFF) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
- GlStateManager.enableBlend();
- GlStateManager.disableTexture2D();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.color(g, h, j, f);
+ UGraphics.enableBlend();
+ UGraphics.disableTexture2D();
+ UGraphics.tryBlendFuncSeparate(770, 771, 1, 0);
+ UGraphics.color4f(g, h, j, f);
worldRenderer.begin(7, DefaultVertexFormats.POSITION);
worldRenderer.pos(x, y2, 0.0).endVertex();
worldRenderer.pos(x2, y2, 0.0).endVertex();
worldRenderer.pos(x2, y, 0.0).endVertex();
worldRenderer.pos(x, y, 0.0).endVertex();
tessellator.draw();
- GlStateManager.enableTexture2D();
- GlStateManager.disableBlend();
+ UGraphics.enableTexture2D();
+ UGraphics.disableBlend();
}
@Override
public void enableStencil() {
- Framebuffer framebuffer = Minecraft.getMinecraft().getFramebuffer();
+ Framebuffer framebuffer = UMinecraft.getMinecraft().getFramebuffer();
if (!framebuffer.isStencilEnabled()) {
framebuffer.enableStencil();
}
@@ -57,7 +56,13 @@ public class GLPlatformImpl implements GLPlatform {
@Override
public float drawText(UMatrixStack matrixStack, String text, float x, float y, int color, boolean shadow) {
+ //#if MC<=11202
return UMinecraft.getFontRenderer().drawString(text, x, y, color, shadow);
+ //#else
+ //$$ if(shadow) {
+ //$$ return UMinecraft.getFontRenderer().drawStringWithShadow(matrixStack.toMC(), text, x, y, color);
+ //$$ } else return UMinecraft.getFontRenderer().drawString(matrixStack.toMC(), text, x, y, color);
+ //#endif
}
@Override
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java
index 01269cd..2755f7f 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java
@@ -21,6 +21,10 @@ public class LoaderPlatformImpl implements LoaderPlatform {
ModContainer container = Loader.instance().activeModContainer();
if (container == null)
return null;
+ //#if MC<=11202
return new ActiveMod(container.getName(), container.getModId(), container.getVersion());
+ //#else
+ //$$ return new ActiveMod(container.getModInfo().getDisplayName(), container.getModId(), container.getModInfo().getVersion().getQualifier());
+ //#endif
}
}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestMod_Test.java b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestMod_Test.java
index ab7587e..f7672ff 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestMod_Test.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestMod_Test.java
@@ -3,11 +3,17 @@ package cc.polyfrost.oneconfig.test;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
+//#if MC<=11202
@net.minecraftforge.fml.common.Mod(modid = "oneconfig-test-mod", name = "Test Mod", version = "0")
+//#else
+//$$ @Mod("oneconfig-test-mod")
+//#endif
public class TestMod_Test {
private TestConfig_Test config;
+ //#if MC<=11202
@Mod.EventHandler
+ //#endif
public void init(FMLInitializationEvent event) {
config = new TestConfig_Test();
}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl.java
index 76dab84..c38fbff 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl.java
@@ -27,6 +27,7 @@ public class PlatformCommandManagerImpl implements PlatformCommandManager {
@Override
public void createCommand(CommandManager.InternalCommand root, Command annotation) {
+ //#if MC<=11202
ClientCommandHandler.instance.registerCommand(new CommandBase() {
@Override
public String getCommandName() {
@@ -65,6 +66,8 @@ public class PlatformCommandManagerImpl implements PlatformCommandManager {
return handleTabCompletion(root, annotation, args);
}
});
+ //#else
+ //#endif
}
private void handleCommand(CommandManager.InternalCommand root, Command annotation, String[] args) {