Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BluCobalt committed Jan 7, 2024
1 parent 0bc0fdc commit f7ccddd
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 80 deletions.
21 changes: 0 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,10 @@ base.archivesName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {}

loom {
// Only needed for versions not available from vanilla launcher by default.
// customMinecraftManifest.set("https://meta.legacyfabric.net/v2/manifest/${minecraft_version}")

// Required by 1.7.x
// runs {
// client {
// programArgs "--userProperties", "{}"
// }
// }
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings(legacy.yarn(project.minecraft_version, project.yarn_build))
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default.
// If you know for a fact you don't, it's not required and can be safely removed.
modImplementation "net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${project.fabric_version}"

// You can retrieve a specific api module using this notation.
// modImplementation(legacy.apiModule("legacy-fabric-item-groups-v1", project.fabric_version))
}

processResources {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ org.gradle.jvmargs=-Xmx1G

# Mod Properties
mod_version = 1.0.0
maven_group = net.fabricmc
archives_base_name = fabric-example-mod
maven_group = net.legacyfabric
archives_base_name = sanitychecker
30 changes: 30 additions & 0 deletions sane.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash


if [[ -z "$RUNCOMMAND" ]]; then
echo "RUNCOMMAND is not set"
exit 1
fi

if [[ -z "$RUNDIR" ]]; then
echo "RUNDIR is not set"
exit 1
fi

echo "copying files"
cp "sanitycheck.jar" "$RUNDIR/mods/sanitycheck.jar"

$RUNCOMMAND

if [[ $? -ne 0 ]]; then
echo "command failed"
exit 1
fi

if [[ -e "$RUNDIR/sane" ]]; then
echo "sane file exists"
exit 0
else
echo "sane file does not exist"
exit 1
fi
14 changes: 0 additions & 14 deletions src/main/java/net/fabricmc/example/ExampleMod.java

This file was deleted.

15 changes: 0 additions & 15 deletions src/main/java/net/fabricmc/example/mixin/ExampleMixin.java

This file was deleted.

23 changes: 23 additions & 0 deletions src/main/java/net/legacyfabric/sanitychecker/SanityChecker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package net.legacyfabric.sanitychecker;


import net.fabricmc.loader.api.FabricLoader;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;


public class SanityChecker
{
public static void markSane()
{
Path runDir = FabricLoader.getInstance().getGameDir();
Path target = runDir.resolve("sane");
try {
Files.createFile(target);
} catch (IOException e) {
// what
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package net.legacyfabric.sanitychecker.mixin;

import net.legacyfabric.sanitychecker.SanityChecker;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.TitleScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(TitleScreen.class)
public class TitleScreenMixin
{
@Unique
private static long initialTime;

@Inject(at = @At("TAIL"), method = "render")
private void init(CallbackInfo info)
{
if (initialTime == 0)
{
initialTime = System.currentTimeMillis();
}

long currentTime = System.currentTimeMillis();
long timeElapsed = currentTime - initialTime;

if (timeElapsed > 5000)
{
System.out.println("sane");
SanityChecker.markSane();
MinecraftClient.getInstance().scheduleStop();
}
}
}
Binary file removed src/main/resources/assets/modid/icon.png
Binary file not shown.
28 changes: 4 additions & 24 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
{
"schemaVersion": 1,
"id": "modid",
"version": "${version}",
"name": "Example Mod",
"description": "This is an example description! Tell everyone what your mod is about!",
"authors": [
"Me!"
],
"contact": {
"homepage": "https://legacyfabric.net/",
"sources": "https://github.com/Legacy-Fabric/fabric-example-mod"
},
"license": "CC0-1.0",
"icon": "assets/modid/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"net.fabricmc.example.ExampleMod"
]
},
"id": "sanitychecker",
"version": "1.0.0",
"mixins": [
"modid.mixins.json"
"sanitychecker.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.19",
"minecraft": "1.8.9"
},
"suggests": {
"another-mod": "*"
"minecraft": ">=1.3.2"
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"required": true,
"minVersion": "0.8",
"package": "net.fabricmc.example.mixin",
"package": "net.legacyfabric.sanitychecker.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
],
"client": [
"ExampleMixin"
"TitleScreenMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit f7ccddd

Please sign in to comment.