Skip to content

Commit

Permalink
nearly done
Browse files Browse the repository at this point in the history
  • Loading branch information
ferriarnus committed Aug 13, 2024
1 parent f1f5881 commit f5e7910
Show file tree
Hide file tree
Showing 94 changed files with 1,692 additions and 1,980 deletions.
41 changes: 17 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
plugins {
id 'dev.architectury.loom' version '1.6-SNAPSHOT'
id 'dev.architectury.loom' version '1.7-SNAPSHOT'
id 'maven-publish'
id "com.github.johnrengelman.shadow" version "8.1.1"
}

//https://github.com/ReplayMod/ReplayMod/compare/1bf1e0d7be382b8a48208ef90ba9c8a6d3faec8a..9f5a8c3d0ff0ed80fe632496e929224e420a927d GuiKeyframeTimeline
version = project.mod_version
group = project.maven_group

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

loom {
forge {
mixinConfigs = [
"mixins.compat.mapwriter.replaymod.json",
"mixins.compat.shaders.replaymod.json",
"mixins.core.replaymod.json",
"mixins.extras.playeroverview.replaymod.json",
"mixins.jgui.json",
"mixins.recording.replaymod.json",
"mixins.render.blend.replaymod.json",
"mixins.render.replaymod.json",
"mixins.replay.replaymod.json"
]
}
runs {
it.configureEach {
vmArgs("-Xmx8G", "-XX:+UseZGC")
Expand All @@ -44,7 +31,7 @@ configurations {
processResources {
inputs.property "version", project.version
archivesBaseName = "reforgedplaymod-${project.minecraft_version}"
filesMatching("META-INF/mods.toml") {
filesMatching("META-INF/neoforge.mods.toml") {
expand "version": project.version
}
}
Expand All @@ -63,6 +50,13 @@ repositories {
maven { url "https://maven.neoforged.net" }
maven { url "https://jitpack.io" }

maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}

shadowJar {
Expand All @@ -81,15 +75,15 @@ dependencies {

mappings loom.layered() {
it.mappings("net.fabricmc:yarn:${project.yarn_mappings}:v2")
it.mappings file("mappings/yarnpatch.tiny")
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:1.21+build.4")
}
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
//mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
forge "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"
neoForge "net.neoforged:neoforge:${project.neoforge_version}"

bundle("com.github.ReplayMod:ReplayStudio:d9f7c11-slim")
minecraftRuntimeLibraries(implementation("com.github.ReplayMod:ReplayStudio:d9f7c11"))
bundle("com.github.ReplayMod:ReplayStudio:master-SNAPSHOT")
minecraftRuntimeLibraries(implementation("com.github.ReplayMod:ReplayStudio:master-SNAPSHOT"))
include(implementation("com.github.viaversion:opennbt:0a02214"))
include(implementation("com.github.ReplayMod:lwjgl-utils:27dcd66"))
minecraftRuntimeLibraries("com.github.ReplayMod:lwjgl-utils:27dcd66")
Expand Down Expand Up @@ -117,6 +111,5 @@ dependencies {

testImplementation 'junit:junit:4.11'

compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.6"))
implementation(include("io.github.llamalad7:mixinextras-forge:0.3.6"))
modCompileOnly "maven.modrinth:iris:1.7.0+1.20.6"
}
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx3G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html

minecraft_version=1.20.1
yarn_mappings=1.20.1+build.9
minecraft_version=1.21
yarn_mappings=1.21+build.1
loader_version=0.15.0

#Fabric api
Expand All @@ -16,5 +16,5 @@ maven_group=com.replaymod
archives_base_name=replaymod
# Dependencies
# check this on https://modmuss50.me/fabric.html
loom.platform=forge
forge_version=47.1.3
loom.platform=neoforge
neoforge_version=21.0.0-beta
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Binary file added libs/ReplayStudio-master-SNAPSHOT.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
maven { url = 'https://maven.neoforged.net/releases' }
maven { url "https://maven.neoforged.net" }
maven { url "https://maven.architectury.dev/" }
maven {
name = 'Fabric'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private void onRenderTickStart() {
//#if MC>=11400
mc.gameRenderer.getCamera(),
//#endif
mc.getTickDelta(), 0);
mc.getRenderTickCounter().getTickDelta(true), 0);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/replaymod/core/KeyBindingRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
//#endif
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.Identifier;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;

import static com.replaymod.core.ReplayMod.MOD_ID;
//#else
Expand All @@ -42,7 +42,7 @@
import java.util.function.Consumer;
import java.util.function.Supplier;

@Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
@EventBusSubscriber(modid = MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class KeyBindingRegistry extends EventRegistrations {
private static final String CATEGORY = "replaymod.title";
//#if FABRIC>=1 && MC<11600
Expand Down Expand Up @@ -73,7 +73,7 @@ private Binding registerKeyBinding(String name, int keyCode, boolean onlyInRepay
if (keyCode == 0) {
keyCode = -1;
}
Identifier id = new Identifier(MOD_ID, name.substring(LangResourcePack.LEGACY_KEY_PREFIX.length()));
Identifier id = Identifier.of(MOD_ID, name.substring(LangResourcePack.LEGACY_KEY_PREFIX.length()));
//#if MC>=11600
String key = String.format("key.%s.%s", id.getNamespace(), id.getPath());
KeyBinding keyBinding = new KeyBinding(key, InputUtil.Type.KEYSYM, keyCode, CATEGORY);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/replaymod/core/ReForgedPlayModStub.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.replaymod.core;

import net.minecraftforge.fml.common.Mod;
import net.neoforged.fml.common.Mod;

@Mod("reforgedplaymod")
public class ReForgedPlayModStub {
Expand Down
20 changes: 14 additions & 6 deletions src/main/java/com/replaymod/core/ReplayMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.replaymod.simplepathing.ReplayModSimplePathing;
import net.minecraft.client.MinecraftClient;
import net.minecraft.resource.DirectoryResourcePack;
import net.minecraft.text.LiteralTextContent;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableTextContent;
Expand All @@ -36,6 +35,13 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;

//#if MC>=12006
import net.minecraft.resource.ResourcePackInfo;
import net.minecraft.resource.ResourcePackSource;
import net.minecraft.text.Text;
import java.util.Optional;
//#endif

//#if MC>=11900
//#else
//$$ import net.minecraft.client.option.Option;
Expand All @@ -45,9 +51,9 @@ public class ReplayMod implements Module, Scheduler {

public static final String MOD_ID = "replaymod";

public static final Identifier TEXTURE = new Identifier("replaymod", "replay_gui.png");
public static final Identifier TEXTURE = Identifier.of("replaymod", "replay_gui.png");
public static final int TEXTURE_SIZE = 256;
public static final Identifier LOGO_FAVICON = new Identifier("replaymod", "favicon_logo.png");
public static final Identifier LOGO_FAVICON = Identifier.of("replaymod", "favicon_logo.png");

private static final MinecraftClient mc = MCVer.getMinecraft();

Expand Down Expand Up @@ -120,14 +126,16 @@ private static DirectoryResourcePack createJGuiResourcePack() {
return null;
}
}
//#if MC>=11903
return new DirectoryResourcePack(JGUI_RESOURCE_PACK_NAME, folder.toPath(), true) {
//#if MC>=12006
return new DirectoryResourcePack(new ResourcePackInfo(JGUI_RESOURCE_PACK_NAME, Text.literal("jGui"), ResourcePackSource.NONE, Optional.empty()), folder.toPath()) {
//#elseif MC>=11903
//$$ return new DirectoryResourcePack(JGUI_RESOURCE_PACK_NAME, folder.toPath(), true) {
//#else
//$$ return new DirectoryResourcePack(folder) {
//#endif
@Override
//#if MC>=11400
public String getName() {
public String getId() {
//#else
//$$ public String getPackName() {
//#endif
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/replaymod/core/ReplayModBackend.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.replaymod.core;

import net.minecraft.SharedConstants;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
import net.minecraftforge.fml.loading.LoadingModList;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLConstructModEvent;
import net.neoforged.fml.loading.LoadingModList;

import static com.replaymod.core.ReplayMod.MOD_ID;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = MOD_ID, value = Dist.CLIENT)
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD, modid = MOD_ID, value = Dist.CLIENT)
@Mod(MOD_ID)
public class ReplayModBackend {
private final ReplayMod mod = new ReplayMod(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.replaymod.core;

import net.minecraftforge.fml.loading.LoadingModList;
import net.neoforged.fml.loading.LoadingModList;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/replaymod/core/gui/GuiReplayButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraft.util.Identifier;

public class GuiReplayButton extends GuiButton {
public static final Identifier ICON = new Identifier("replaymod", "logo_button.png");
public static final Identifier ICON = Identifier.of("replaymod", "logo_button.png");

@Override
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
Expand Down
21 changes: 15 additions & 6 deletions src/main/java/com/replaymod/core/mixin/MinecraftAccessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
import java.util.Queue;

//#if MC>=11800
import java.util.function.Supplier;
//$$ import java.util.function.Supplier;
//#endif

//#if MC>=11400
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
//#endif

//#if MC<11400
Expand All @@ -29,13 +30,21 @@

@Mixin(MinecraftClient.class)
public interface MinecraftAccessor {
//#if MC>=12100
@Accessor("renderTickCounter")
RenderTickCounter getTimer();
RenderTickCounter.Dynamic getTimer();
@Accessor("renderTickCounter")
//#if MC>=11200
@Mutable
void setTimer(RenderTickCounter.Dynamic value);
//#else
//$$@Accessor("renderTickCounter")
//$$RenderTickCounter getTimer();
//$$@Accessor("renderTickCounter")
//#if MC>=11200
//$$@Mutable
//#endif
//$$void setTimer(RenderTickCounter value);
//#endif
void setTimer(RenderTickCounter value);

//#if MC>=11400
@Accessor
Expand All @@ -53,9 +62,9 @@ public interface MinecraftAccessor {
//#endif

@Accessor("crashReportSupplier")
//#if MC>=11800
//#if MC>=11800
Supplier<CrashReport> getCrashReporter();
//#else
//#else
//$$ CrashReport getCrashReporter();
//#endif

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//#if MC>=11400
package com.replaymod.core.mixin;

import com.replaymod.core.events.PostRenderWorldCallback;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.util.math.MatrixStack;
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;

//#if MC>=11500
import com.llamalad7.mixinextras.sugar.Local;
//#endif

@Mixin(WorldRenderer.class)
public class Mixin_PostRenderWorldCalback {
//#if MC>=12005
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lorg/joml/Matrix4fStack;popMatrix()Lorg/joml/Matrix4fStack;"))
private void postRenderWorld(CallbackInfo ci) {
MatrixStack matrixStack = new MatrixStack();
//#else
//$$ @Inject(method = "render", at = @At("RETURN"))
//#if MC>=11500
//$$ private void postRenderWorld(CallbackInfo ci, @Local(argsOnly = true) MatrixStack matrixStack) {
//#else
//$$ private void postRenderWorld(CallbackInfo ci) {
//$$ MatrixStack matrixStack = new MatrixStack();
//#endif
//#endif
PostRenderWorldCallback.EVENT.invoker().postRenderWorld(matrixStack);
}
}
//#endif
Loading

0 comments on commit f5e7910

Please sign in to comment.