Skip to content

Commit

Permalink
Port to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dima-dencep committed Dec 24, 2023
1 parent be36a42 commit 29f403f
Show file tree
Hide file tree
Showing 24 changed files with 73 additions and 107 deletions.
22 changes: 4 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,7 @@ loom {
silentMojangMappingsLicense()
accessWidenerPath = file("src/main/resources/iris.accesswidener")

forge {
convertAccessWideners = true
mixinConfigs = [
"mixins.oculus.json",
"mixins.oculus.fantastic.json",
"mixins.oculus.vertexformat.json",
"mixins.oculus.bettermipmaps.json",
"mixins.oculus.fixes.maxfpscrash.json",
"oculus-batched-entity-rendering.mixins.json",
"mixins.oculus.compat.sodium.json",
"mixins.oculus.compat.indigo.json",
"mixins.oculus.compat.dh.json",
"mixins.oculus.compat.indium.json",
"mixins.oculus.compat.pixelmon.json"
]
}
mixin.defaultRefmapName = "oculus-mixins-refmap.json"
// mixin.defaultRefmapName = "oculus-mixins-refmap.json"
}

configurations {
Expand Down Expand Up @@ -103,7 +87,7 @@ repositories {
dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()
forge "net.neoforged:forge:${minecraft_version}-${forge_version}"
neoForge "net.neoforged:neoforge:${forge_version}"

modCompileOnly "org.embeddedt:embeddium-${minecraft_version}:${embeddium_version}"
compileOnly "maven.modrinth:distanthorizons:2.0.1-a-1.20.1"
Expand Down Expand Up @@ -139,6 +123,8 @@ shadowJar {
}

remapJar {
atAccessWideners.add(loom.accessWidenerPath.get().asFile.name)

inputFile.set shadowJar.archiveFile
dependsOn shadowJar
}
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx3G

loom.platform = forge
loom.platform = neoforge

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
forge_version=47.1.84
minecraft_version=1.20.4
forge_version=20.4.56-beta

# Mod Properties
mod_version = 1.6.13
mod_version = 1.6.14
maven_group = net.coderbot
archives_base_name = oculus

# Dependencies
embeddium_version=0.2.14-git.dbe9f77+mc1.20.1
embeddium_version=0.2.13-git.43882f7+mc1.20.4
40 changes: 18 additions & 22 deletions src/main/java/net/coderbot/iris/Iris.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@

import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraftforge.client.ConfigScreenHandler;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.IExtensionPoint;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.network.NetworkConstants;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.client.ConfigScreenHandler;
import net.neoforged.neoforge.client.event.InputEvent;
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.fml.IExtensionPoint;
import net.neoforged.fml.ModList;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.loading.FMLPaths;
import net.neoforged.neoforge.network.NetworkConstants;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFW;

Expand Down Expand Up @@ -89,9 +89,9 @@ public class Iris {
private static PipelineManager pipelineManager;
private static IrisConfig irisConfig;
private static FileSystem zipFileSystem;
private static KeyMapping reloadKeybind;
private static KeyMapping toggleShadersKeybind;
private static KeyMapping shaderpackScreenKeybind;
private static final KeyMapping reloadKeybind = new KeyMapping("iris.keybind.reload", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_R, "iris.keybinds");
private static final KeyMapping toggleShadersKeybind = new KeyMapping("iris.keybind.toggleShaders", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_K, "iris.keybinds");
private static final KeyMapping shaderpackScreenKeybind = new KeyMapping("iris.keybind.shaderPackSelection", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_O, "iris.keybinds");

private static final Map<String, String> shaderPackOptionQueue = new HashMap<>();
// Flag variable used when reloading
Expand All @@ -105,10 +105,10 @@ public class Iris {
// Change this for snapshots!
private static String backupVersionNumber = "1.20.3";

public Iris() {
public Iris(IEventBus bus) {
try {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onKeyRegister);
MinecraftForge.EVENT_BUS.addListener(this::onKeyInput);
bus.addListener(this::onKeyRegister);
NeoForge.EVENT_BUS.addListener(this::onKeyInput);

IRIS_VERSION = ModList.get().getModContainerById(MODID).get().getModInfo().getVersion().toString();

Expand All @@ -127,11 +127,7 @@ public Iris() {
*
* <p>This is called right before options are loaded, so we can add key bindings here.</p>
*/
public void onEarlyInitialize() {
reloadKeybind = new KeyMapping("iris.keybind.reload", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_R, "iris.keybinds");
toggleShadersKeybind = new KeyMapping("iris.keybind.toggleShaders", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_K, "iris.keybinds");
shaderpackScreenKeybind = new KeyMapping("iris.keybind.shaderPackSelection", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_O, "iris.keybinds");

public static void onEarlyInitialize() {
try {
if (!Files.exists(getShaderpacksDirectory())) {
Files.createDirectories(getShaderpacksDirectory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraftforge.client.ChunkRenderTypeSet;
import net.neoforged.neoforge.client.ChunkRenderTypeSet;

import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.ChunkRenderTypeSet;
import net.neoforged.neoforge.client.ChunkRenderTypeSet;
import org.jetbrains.annotations.Nullable;

import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.coderbot.iris.compat.dh.mixin;

import net.minecraftforge.fml.loading.FMLLoader;
import net.neoforged.fml.loading.FMLLoader;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.coderbot.iris.compat.indigo.mixin;

import net.minecraftforge.fml.loading.FMLLoader;
import net.neoforged.fml.loading.FMLLoader;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.coderbot.iris.compat.indium.mixin;

import net.minecraftforge.fml.loading.FMLLoader;
import net.neoforged.fml.loading.FMLLoader;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.coderbot.iris.compat.pixelmon.mixin;

import net.minecraftforge.fml.loading.FMLLoader;
import net.neoforged.fml.loading.FMLLoader;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/coderbot/iris/gui/OldImageButton.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package net.coderbot.iris.gui;

import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;

@Environment(EnvType.CLIENT)
@OnlyIn(Dist.CLIENT)
public class OldImageButton extends Button {
protected final ResourceLocation resourceLocation;
protected final int xTexStart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.ChunkRenderTypeSet;
import net.neoforged.neoforge.client.ChunkRenderTypeSet;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public class MixinOptions_Entrypoint {
}

iris$initialized = true;
new Iris().onEarlyInitialize();
Iris.onEarlyInitialize();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.coderbot.iris.mixin;

import net.minecraftforge.fml.loading.LoadingModList;
import net.neoforged.fml.loading.LoadingModList;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.ChunkRenderTypeSet;
import net.minecraftforge.client.model.data.ModelData;
import net.neoforged.neoforge.client.ChunkRenderTypeSet;
import net.neoforged.neoforge.client.model.data.ModelData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.ChunkRenderTypeSet;
import net.minecraftforge.client.model.data.ModelData;
import net.neoforged.neoforge.client.ChunkRenderTypeSet;
import net.neoforged.neoforge.client.model.data.ModelData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/coderbot/iris/pipeline/HandRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.data.ModelData;
import net.neoforged.neoforge.client.model.data.ModelData;
import org.joml.Matrix4f;
import net.coderbot.batchedentityrendering.impl.FullyBufferedMultiBufferSource;
import net.coderbot.iris.mixin.GameRendererAccessor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import net.coderbot.iris.Iris;
import net.coderbot.iris.pipeline.transform.PatchShaderType;
import net.minecraftforge.fml.loading.FMLPaths;
import net.neoforged.fml.loading.FMLPaths;

/**
* Static class that deals with printing the patched_shader folder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import net.minecraft.server.packs.resources.Resource;
import net.minecraft.server.packs.resources.ResourceProvider;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraftforge.fml.loading.FMLPaths;
import net.neoforged.fml.loading.FMLPaths;
import org.apache.commons.io.IOUtils;

import java.io.ByteArrayInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import net.coderbot.iris.shaderpack.preprocessor.PropertiesPreprocessor;
import net.coderbot.iris.shaderpack.texture.TextureStage;
import net.coderbot.iris.uniforms.custom.CustomUniforms;
import net.minecraftforge.fml.loading.FMLPaths;
import net.neoforged.fml.loading.FMLPaths;

import java.io.IOException;
import java.io.StringReader;
Expand Down
27 changes: 25 additions & 2 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,39 @@ provides = ["iris"]
"mixin.features.render.entity"=false
"mixin.features.render.gui.font"=false

[[mixins]]
config = "mixins.oculus.json"
[[mixins]]
config = "mixins.oculus.fantastic.json"
[[mixins]]
config = "mixins.oculus.vertexformat.json"
[[mixins]]
config = "mixins.oculus.bettermipmaps.json"
[[mixins]]
config = "mixins.oculus.fixes.maxfpscrash.json"
[[mixins]]
config = "oculus-batched-entity-rendering.mixins.json"
[[mixins]]
config = "mixins.oculus.compat.sodium.json"
[[mixins]]
config = "mixins.oculus.compat.indigo.json"
[[mixins]]
config = "mixins.oculus.compat.dh.json"
[[mixins]]
config = "mixins.oculus.compat.indium.json"
[[mixins]]
config = "mixins.oculus.compat.pixelmon.json"

[[dependencies.oculus]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20.1]"
versionRange = "[1.20.3,]"
ordering = "NONE"
side = "BOTH"

[[dependencies.oculus]]
modId = "embeddium"
mandatory = false
versionRange = "[0.2.14,)"
versionRange = "[0.2.13,)"
ordering = "NONE"
side = "CLIENT"
1 change: 0 additions & 1 deletion src/main/resources/iris.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ accessible class net/minecraft/client/renderer/RenderType$CompositeState
accessible class net/minecraft/client/renderer/FogRenderer$FogData
accessible class net/minecraft/client/renderer/texture/Stitcher$Holder
accessible class net/minecraft/world/level/biome/Biome$ClimateSettings
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
accessible class net/minecraft/client/Options$FieldAccess
accessible class net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture
accessible class net/minecraft/client/renderer/texture/SpriteContents$FrameInfo
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/mixins.oculus.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"entity_render_context.MixinHumanoidArmorLayer",
"entity_render_context.MixinItemRenderer",
"fabulous.MixinDisableFabulousGraphics",
"gui.MixinForgeGui",
"gui.MixinGui",
"gui.MixinVideoSettingsScreen",
"math.MixinMatrix4f",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.coderbot.iris.compat.sodium.mixin;

import net.minecraftforge.fml.loading.LoadingModList;
import net.neoforged.fml.loading.LoadingModList;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
Expand Down

This file was deleted.

0 comments on commit 29f403f

Please sign in to comment.