Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakeJH committed May 1, 2023
1 parent 3e91bb6 commit f7f8cd9
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 68 deletions.
100 changes: 54 additions & 46 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,72 +1,80 @@
plugins {
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'maven-publish'
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}

dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
}

base {
archivesName = project.archives_base_name
}

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

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

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

jar {
from "LICENSE"
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}"}
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java
}
}

// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
loader_version=0.14.19
# Mod Properties
mod_version=1
mod_version=2.1.0-1.19.4
maven_group=com.blake_jh
archives_base_name=noHurtCam
# Dependencies
Expand Down
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.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.blake_jh.nohurtcam;
package com.blake_jh.nohurtcamplus;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
Expand All @@ -8,24 +8,24 @@
import net.minecraft.text.Text;
import org.lwjgl.glfw.GLFW;

public class NoHurtCam implements ModInitializer {
public static boolean toggledOn = true; // Set the toggledOn variable to true
public class NoHurtCamPlus implements ModInitializer {
public static boolean toggledOn = true;
MinecraftClient client = MinecraftClient.getInstance();
@Override
public void onInitialize() {
KeyBinding k = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.noHurtCam.toggle",
KeyBinding k = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.noHurtCam+.toggle",
GLFW.GLFW_KEY_F8,
"category.noHurtCam"));
"category.noHurtCam+"));

ClientTickEvents.END_CLIENT_TICK.register(client -> {
if (k.wasPressed()) {
if (toggledOn) {
toggledOn = false;
client.player.sendMessage(Text.of("§9[NoHurtCam] §rEnabled Hurtcam"), false);
client.player.sendMessage(Text.of("§9[NoHurtCam+] §rEnabled Hurtcam"), false);
}
else {
toggledOn = true;
client.player.sendMessage(Text.of("§9[NoHurtCam] §rDisabled Hurtcam"), false);
client.player.sendMessage(Text.of("§9[NoHurtCam+] §rDisabled Hurtcam"), false);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.blake_jh.nohurtcam.mixin;
package com.blake_jh.nohurtcamplus.mixin;

import com.blake_jh.nohurtcam.NoHurtCam;
import com.blake_jh.nohurtcamplus.NoHurtCamPlus;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -12,6 +12,6 @@
public class GameRendererMixin {
@Inject(at = @At("HEAD"), method = "tiltViewWhenHurt(Lnet/minecraft/client/util/math/MatrixStack;F)V", cancellable = true)
public void bobViewWhenHurt(MatrixStack matrixStack_1, float float_1, CallbackInfo ci) {
if (NoHurtCam.toggledOn) ci.cancel();
if (NoHurtCamPlus.toggledOn) ci.cancel();
}
}
4 changes: 2 additions & 2 deletions src/main/resources/assets/nohurtcam/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"key.noHurtCam.toggle": "Disable Hurt Cam",
"category.noHurtCam": "NoHurtCam"
"key.noHurtCam+.toggle": "Disable Hurt Cam",
"category.noHurtCam+": "NoHurtCam+"
}
14 changes: 7 additions & 7 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"schemaVersion": 1,
"id": "nohurtcam",
"id": "nohurtcamplus",
"version": "${version}",
"name": "NoHurtCam",
"name": "NoHurtCam+",
"description": "Removes the damage Screenshake",
"authors": [
"Blake_JH"
],
"contact": {
"homepage": "https://github.com/UltraBlackLinux/noHurtCam",
"issues": "https://github.com/UltraBlackLinux/noHurtCam/issues"
"homepage": "https://github.com/BlakeJH/noHurtCam",
"issues": "https://github.com/BlakeJH/noHurtCam/issues"
},
"license": "MIT",
"icon": "assets/nohurtcam/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"com.blake_jh.nohurtcam.NoHurtCam"
"com.blake_jh.nohurtcamplus.NoHurtCamPlus"
]
},
"mixins": [
"noHurtCam.mixins.json"
"noHurtCamPlus.mixins.json"
],
"depends": {
"fabricloader": ">=0.11.3",
"fabricloader": ">=0.14.19",
"fabric": "*",
"minecraft": "*"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.blake_jh.nohurtcam.mixin",
"package": "com.blake_jh.nohurtcamplus.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"GameRendererMixin"
Expand Down

0 comments on commit f7f8cd9

Please sign in to comment.