Skip to content

Commit

Permalink
forge1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
MORIMORI0317 committed Jul 24, 2021
1 parent 18e5084 commit 681c9bd
Show file tree
Hide file tree
Showing 27 changed files with 160 additions and 437 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Disable autocrlf on generated files, they always generate with LF
# Add any extra files or paths here to make git stop saying they
# are changed when only line endings change.
src/generated/**/.cache/cache text eol=lf
src/generated/**/*.json text eol=lf
40 changes: 16 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
# gradle

.gradle/
build/
out/
classes/

# eclipse

bin
*.launch
.settings
.metadata
.classpath
.project

# idea

.idea/
*.iml
out
*.ipr
*.iws
*.iml
.idea

# vscode

.settings/
.vscode/
bin/
.classpath
.project

# macos

*.DS_Store
# gradle
build
.gradle

# fabric
# other
eclipse
run

run/
# Files from Forge MDK
forge*changelog.txt
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MemoryUsageScreen
Shows memory usage during loading (Minecraft MOD)

https://www.curseforge.com/minecraft/mc-mods/memory-usage-screen-fabric
https://www.curseforge.com/minecraft/mc-mods/memory-usage-screen

https://modrinth.com/mod/memory-usage-screen
112 changes: 12 additions & 100 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,105 +1,17 @@
plugins {
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id "com.modrinth.minotaur" version "1.1.0"
}

sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = "${project.archives_base_name}-${project.minecraft_version}"
version = project.mod_version
group = project.maven_group
minecraft {
accessWidener = file("src/main/resources/memoryusagescreen.accesswidener")
}
repositories {
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings minecraft.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modApi include("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

modApi "com.terraformersmc:modmenu:${project.modmenu_version}"

}

processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

tasks.withType(JavaCompile).configureEach {

it.options.encoding = "UTF-8"

it.options.release = 16
}

java {

withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}
publishing {
publications {
mavenJava(MavenPublication) {

artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}

apply from: "https://raw.githubusercontent.com/TeamFelnull/GradleTemplate/main/minecraft/1.17.1/forge.gradle"
apply from: "https://raw.githubusercontent.com/TeamFelnull/GradleTemplate/main/minecraft/upload.gradle"

buildscript {
repositories {

maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
}
if (System.getenv('curesforgeapikey') != null && "${curesfg_id}" != "0") {
curseforge {
apiKey = System.getenv('curesforgeapikey')
project {
id = "${curesfg_id}"
changelog = ""
releaseType = "release"
addGameVersion "${minecraft_version}"
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")) {
displayName = "${archives_base_name}-${minecraft_version}-${mod_version}-Fabric"
relations {
embeddedLibrary 'cloth-config'
}
}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}
if (System.getenv('modrinthapikey') != null && "${modrinth_id}" != "0") {
task publishModrinth(type: com.modrinth.minotaur.TaskModrinthUpload) {

token = System.getenv('modrinthapikey')
projectId = "${modrinth_id}"
versionName = "${archives_base_name}-${minecraft_version}-${mod_version}-Fabric"
versionNumber = "${minecraft_version}-${mod_version}-Fabric"
uploadFile = file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")
addGameVersion("${minecraft_version}")
addLoader('fabric')
}
}
/*
minecraft {
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
}*/
30 changes: 20 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
org.gradle.jvmargs=-Xmx8G
minecraft_version=1.17
loader_version=0.11.6
mod_version=1.1
maven_group=net.morimori
archives_base_name=MemoryUsageScreen
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
#-----------------------------
mc_version=1.17.1
fg_version=1.17.1-37.0.2
#-----------------------------
mod_name=MemoryUsageScreen
mod_id=memoryusagescreen
fabric_version=0.36.0+1.17
cloth_config_version=5.0.34
modmenu_version=2.0.0-beta.7
curesfg_id=500009
mod_version=1.1
mod_group=net.morimori
mod_vendor=MORIMORI0317
mod_implevendor=MORIMORI0317
#-----------------------------
#modmenu_version=2.0.0-beta.7
#cloth_config_version=
#rei_version=6.0.264-alpha
#-----------------------------
curesforge_id=500009
modrinth_id=n9mFA0ax
release_type=release
loader_type=Forge
support_versions=1.17.1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.2-20210702220150+0000-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
Expand Down
9 changes: 0 additions & 9 deletions settings.gradle

This file was deleted.

27 changes: 27 additions & 0 deletions src/main/java/net/morimori/mus/ClientConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package net.morimori.mus;

import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.config.ModConfig;
import org.apache.commons.lang3.tuple.Pair;

public class ClientConfig {
public static ForgeConfigSpec.ConfigValue<Boolean> enableInitLoadingScreen;
public static ForgeConfigSpec.ConfigValue<Boolean> enableWorldLoadingScreen;
public static ForgeConfigSpec.ConfigValue<Boolean> enableToggleMode;

public static void init() {
Pair<ConfigLoder, ForgeConfigSpec> client_config = new ForgeConfigSpec.Builder().configure(ConfigLoder::new);
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, client_config.getRight());
}

public static class ConfigLoder {
public ConfigLoder(ForgeConfigSpec.Builder builder) {
builder.push("Memory Bar");
enableInitLoadingScreen = builder.define("Enable display on the initial loading screen", true);
enableWorldLoadingScreen = builder.define("Enable display on the world loading screen", true);
enableToggleMode = builder.define("Enable toggle display mode", false);
builder.pop();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
package net.morimori.mus.mixin;
package net.morimori.mus;

import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.morimori.mus.MemoryUsageScreen;
import org.jetbrains.annotations.Nullable;
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.callback.CallbackInfo;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

@Mixin(Minecraft.class)
public class MinecraftMixin {
@Shadow
@Nullable
public LocalPlayer player;
private boolean resetFlg;
private boolean pushFlg;
private boolean spushFlg;
public class ClientHandler {
private static final Minecraft mc = Minecraft.getInstance();
private static boolean resetFlg;
private static boolean pushFlg;
private static boolean spushFlg;

@Inject(method = "tick", at = @At("HEAD"))
private void tick(CallbackInfo ci) {
boolean press = InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), MemoryUsageScreen.SHOW_MEMORYUSAGE.key.getValue());
if (MemoryUsageScreen.CONFIG.enableToggleMode) {
@SubscribeEvent
public static void onTick(TickEvent.ClientTickEvent e) {
boolean press = InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), MemoryUsageScreen.SHOW_MEMORYUSAGE.getKey().getValue());
if (ClientConfig.enableToggleMode.get()) {
if (press && !spushFlg) pushFlg = true;

if (pushFlg) {
Expand Down
48 changes: 0 additions & 48 deletions src/main/java/net/morimori/mus/LoadingTexture.java

This file was deleted.

11 changes: 0 additions & 11 deletions src/main/java/net/morimori/mus/MUSConfig.java

This file was deleted.

Loading

0 comments on commit 681c9bd

Please sign in to comment.