Skip to content

Commit

Permalink
Fixed bugs breaking the mod
Browse files Browse the repository at this point in the history
  • Loading branch information
kada49 authored Feb 15, 2022
1 parent 7ea40ff commit 11e24a1
Show file tree
Hide file tree
Showing 9 changed files with 552 additions and 540 deletions.
194 changes: 103 additions & 91 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,91 +1,103 @@
plugins {
id "java"
id "com.github.johnrengelman.shadow" version "6.1.0"
id "net.minecraftforge.gradle.forge" version "6f53277"
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
}

version = "0.5.0"
group = "it.kada49.fpsDisplay"
archivesBaseName = "FPS-Display"

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
compileJava.options.encoding = 'UTF-8'

/**
* This task simply moves resources so they can be accessed at runtime, Forge is quite weird isn't it
*/
sourceSets {
main {
output.resourcesDir = java.outputDir
}
}

minecraft {
version = "1.8.9-11.15.1.2318-1.8.9"
runDir = "run"
mappings = "stable_22"
makeObfSourceJar = false
}

repositories {
maven { url = "https://repo.sk1er.club/repository/maven-public" }
}

configurations {
// Creates an extra configuration that implements `implementation` to be used later as the configuration that shades libraries
include
implementation.extendsFrom(include)
}

dependencies {
include "com.squareup.okhttp3:okhttp:4.9.3"
include "gg.essential:loader-launchwrapper:1.1.3"
implementation "gg.essential:essential-1.8.9-forge:1884"
}

/**
* This task simply replaces the `${version}` and `${mcversion}` properties in the mcmod.info with the data from Gradle
*/
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}

// This adds support to ("embed", "shade", "include") libraries into our JAR
shadowJar {
archiveClassifier.set('')
configurations = [project.configurations.include]
duplicatesStrategy DuplicatesStrategy.EXCLUDE

manifest.attributes(
"ForceLoadAsMod": true,
"ModSide": "CLIENT",
"TweakClass": "gg.essential.loader.stage0.EssentialSetupTweaker"
)

("com.squareup.okhttp3:okhttp:4.9.3")
}

build.dependsOn shadowJar
repositories {
mavenCentral()
}

reobf {
shadowJar {}
}
plugins {
id "java"
id "com.github.johnrengelman.shadow" version "6.1.0"
id "net.minecraftforge.gradle.forge" version "6f53277"
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
}

version = "0.5.1"
group = "it.kada49.fpsDisplay"
archivesBaseName = "FPS-Display"

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
compileJava.options.encoding = 'UTF-8'

sourceSets {
main {
output.resourcesDir = java.outputDir
}
}

minecraft {
version = "1.8.9-11.15.1.2318-1.8.9"
runDir = "run"
mappings = "stable_22"
makeObfSourceJar = false
}

repositories {
maven { url = "https://repo.sk1er.club/repository/maven-public" }
}

configurations {
// Creates an extra configuration that implements `implementation` to be used later as the configuration that shades libraries
include
implementation.extendsFrom(include)
}

dependencies {
include "com.squareup.okhttp3:okhttp:4.9.3"
include "gg.essential:loader-launchwrapper:1.1.3"
implementation "gg.essential:essential-1.8.9-forge:1884"
}

/**
* This task simply replaces the `${version}` and `${mcversion}` properties in the mcmod.info with the data from Gradle
*/
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}

/**
* This task simply moves resources so they can be accessed at runtime, Forge is quite weird isn't it
*/

/*
task moveResources {
doLast {
ant.move file: "${buildDir}/resources/main",
todir: "${buildDir}/classes/java"
}
}
moveResources.dependsOn processResources
classes.dependsOn moveResources
*/
// This adds support to ("embed", "shade", "include") libraries into our JAR
shadowJar {
archiveClassifier.set('')
configurations = [project.configurations.include]
duplicatesStrategy DuplicatesStrategy.EXCLUDE

manifest.attributes(
"ForceLoadAsMod": true,
"ModSide": "CLIENT",
"TweakClass": "gg.essential.loader.stage0.EssentialSetupTweaker"
)

("com.squareup.okhttp3:okhttp:4.9.3")
}

build.dependsOn shadowJar
repositories {
mavenCentral()
}

reobf {
shadowJar {}
}
32 changes: 16 additions & 16 deletions src/main/kotlin/it/kada49/fpsDisplay/Command.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package it.kada49.fpsDisplay

import net.minecraft.command.CommandBase
import net.minecraft.command.ICommandSender

class Command: CommandBase() {
override fun getCommandName() = "fps"
override fun getRequiredPermissionLevel(): Int = 0
override fun getCommandUsage(sender: ICommandSender?): String = "/fps = Setup for the ${Constants.Data.NAME} Mod configuration"
override fun processCommand(sender: ICommandSender?, args: Array<String>) {
if (args.isEmpty()) { FpsMod.vigilantGui = Configuration.gui() }
if (args.isNotEmpty()) {
if (args[0] == "update") Update().checkForModUpdates(true)
}

}
package it.kada49.fpsDisplay

import net.minecraft.command.CommandBase
import net.minecraft.command.ICommandSender

class Command: CommandBase() {
override fun getCommandName() = "fps"
override fun getRequiredPermissionLevel(): Int = 0
override fun getCommandUsage(sender: ICommandSender?): String = "/fps = Setup for the ${Constants.Data.NAME} Mod configuration"
override fun processCommand(sender: ICommandSender?, args: Array<String>) {
if (args.isEmpty()) { FpsMod.vigilantGui = Configuration.gui() }
if (args.isNotEmpty()) {
if (args[0] == "update") Update().checkForModUpdates(true)
}

}
}
Loading

0 comments on commit 11e24a1

Please sign in to comment.