Skip to content

Commit 1fe60ff

Browse files
committed
Initial commit
0 parents  commit 1fe60ff

12 files changed

+569
-0
lines changed

.gitignore

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# User-specific stuff
2+
.idea/
3+
4+
*.iml
5+
*.ipr
6+
*.iws
7+
8+
# IntelliJ
9+
out/
10+
# mpeltonen/sbt-idea plugin
11+
.idea_modules/
12+
13+
# JIRA plugin
14+
atlassian-ide-plugin.xml
15+
16+
# Compiled class file
17+
*.class
18+
19+
# Log file
20+
*.log
21+
22+
# BlueJ files
23+
*.ctxt
24+
25+
# Package Files #
26+
*.jar
27+
*.war
28+
*.nar
29+
*.ear
30+
*.zip
31+
*.tar.gz
32+
*.rar
33+
34+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
35+
hs_err_pid*
36+
37+
*~
38+
39+
# temporary files which can be created if a process still has a handle open of a deleted file
40+
.fuse_hidden*
41+
42+
# KDE directory preferences
43+
.directory
44+
45+
# Linux trash folder which might appear on any partition or disk
46+
.Trash-*
47+
48+
# .nfs files are created when an open file is removed but is still being accessed
49+
.nfs*
50+
51+
# General
52+
.DS_Store
53+
.AppleDouble
54+
.LSOverride
55+
56+
# Icon must end with two \r
57+
Icon
58+
59+
# Thumbnails
60+
._*
61+
62+
# Files that might appear in the root of a volume
63+
.DocumentRevisions-V100
64+
.fseventsd
65+
.Spotlight-V100
66+
.TemporaryItems
67+
.Trashes
68+
.VolumeIcon.icns
69+
.com.apple.timemachine.donotpresent
70+
71+
# Directories potentially created on remote AFP share
72+
.AppleDB
73+
.AppleDesktop
74+
Network Trash Folder
75+
Temporary Items
76+
.apdisk
77+
78+
# Windows thumbnail cache files
79+
Thumbs.db
80+
Thumbs.db:encryptable
81+
ehthumbs.db
82+
ehthumbs_vista.db
83+
84+
# Dump file
85+
*.stackdump
86+
87+
# Folder config file
88+
[Dd]esktop.ini
89+
90+
# Recycle Bin used on file shares
91+
$RECYCLE.BIN/
92+
93+
# Windows Installer files
94+
*.cab
95+
*.msi
96+
*.msix
97+
*.msm
98+
*.msp
99+
100+
# Windows shortcuts
101+
*.lnk
102+
103+
.gradle
104+
build/
105+
106+
# Ignore Gradle GUI config
107+
gradle-app.setting
108+
109+
# Cache of project
110+
.gradletasknamecache
111+
112+
**/build/
113+
114+
# Common working directory
115+
run/
116+
117+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
118+
!gradle-wrapper.jar

LICENSE

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Copyright (c) 2023
2+
All rights reserved.

build.gradle

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
plugins {
2+
id 'fabric-loom' version '1.2-SNAPSHOT'
3+
id 'maven-publish'
4+
}
5+
6+
version = project.mod_version
7+
group = project.maven_group
8+
9+
repositories {
10+
// Add repositories to retrieve artifacts from in here.
11+
// You should only use this when depending on other mods because
12+
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
13+
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
14+
// for more information about repositories.
15+
}
16+
17+
dependencies {
18+
// To change the versions see the gradle.properties file
19+
minecraft "com.mojang:minecraft:${project.minecraft_version}"
20+
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
21+
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
22+
23+
}
24+
25+
processResources {
26+
inputs.property "version", project.version
27+
inputs.property "minecraft_version", project.minecraft_version
28+
inputs.property "loader_version", project.loader_version
29+
filteringCharset "UTF-8"
30+
31+
filesMatching("fabric.mod.json") {
32+
expand "version": project.version,
33+
"minecraft_version": project.minecraft_version,
34+
"loader_version": project.loader_version
35+
}
36+
}
37+
38+
def targetJavaVersion = 17
39+
tasks.withType(JavaCompile).configureEach {
40+
// ensure that the encoding is set to UTF-8, no matter what the system default is
41+
// this fixes some edge cases with special characters not displaying correctly
42+
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
43+
// If Javadoc is generated, this must be specified in that task too.
44+
it.options.encoding = "UTF-8"
45+
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
46+
it.options.release = targetJavaVersion
47+
}
48+
}
49+
50+
java {
51+
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
52+
if (JavaVersion.current() < javaVersion) {
53+
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
54+
}
55+
archivesBaseName = project.archives_base_name
56+
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
57+
// if it is present.
58+
// If you remove this line, sources will not be generated.
59+
withSourcesJar()
60+
}
61+
62+
jar {
63+
from("LICENSE") {
64+
rename { "${it}_${project.archivesBaseName}"}
65+
}
66+
}
67+
68+
// configure the maven publication
69+
publishing {
70+
publications {
71+
mavenJava(MavenPublication) {
72+
from components.java
73+
}
74+
}
75+
76+
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
77+
repositories {
78+
// Add repositories to publish to here.
79+
// Notice: This block does NOT have the same function as the block in the top level.
80+
// The repositories here will be used for publishing your artifact, not for
81+
// retrieving dependencies.
82+
}
83+
}

gradle.properties

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Done to increase the memory available to gradle.
2+
org.gradle.jvmargs=-Xmx1G
3+
4+
# Fabric Properties
5+
# check these on https://modmuss50.me/fabric.html
6+
minecraft_version=1.20.1
7+
yarn_mappings=1.20.1+build.10
8+
loader_version=0.14.23
9+
10+
# Mod Properties
11+
mod_version = 1.0-SNAPSHOT
12+
maven_group = org.rusherhack
13+
archives_base_name = example-plugin
14+
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip

settings.gradle

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pluginManagement {
2+
repositories {
3+
maven {
4+
name = 'Fabric'
5+
url = 'https://maven.fabricmc.net/'
6+
}
7+
gradlePluginPortal()
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package org.rusherhack.example;
2+
3+
import org.rusherhack.client.api.feature.command.Command;
4+
import org.rusherhack.core.command.annotations.CommandExecutor;
5+
6+
import java.util.ArrayList;
7+
import java.util.Arrays;
8+
import java.util.List;
9+
import java.util.Optional;
10+
11+
/**
12+
* Example rusherhack command
13+
*
14+
* @author John200410
15+
*/
16+
public class ExampleCommand extends Command {
17+
18+
private final List<String> stringList = new ArrayList<>(Arrays.asList("test1", "test2"));
19+
20+
public ExampleCommand() {
21+
super("ExampleCommand", "description");
22+
}
23+
24+
/**
25+
* base command that takes in no arguments
26+
*/
27+
@CommandExecutor
28+
private String example() {
29+
//when return type is String you return the message you want to return to the user
30+
return "Hello World!";
31+
}
32+
33+
/**
34+
* arguments example
35+
*/
36+
@CommandExecutor
37+
@CommandExecutor.Argument({"string", "boolean"}) //must set argument names
38+
private String exampleWithArguments(String requiredString, Optional<Boolean> optionalBoolean) {
39+
return requiredString + " " + optionalBoolean.orElse(false);
40+
}
41+
42+
/**
43+
* sub command examples
44+
*/
45+
@CommandExecutor(subCommand = "list")
46+
private String exampleList() {
47+
return String.join(", ", this.stringList);
48+
}
49+
50+
@CommandExecutor(subCommand = "list add")
51+
@CommandExecutor.Argument("string") //must set argument names
52+
private String addToExampleList(String string) {
53+
this.stringList.add(string);
54+
return "Added " + string;
55+
}
56+
57+
@CommandExecutor(subCommand = {"list remove", "list del"})
58+
@CommandExecutor.Argument("string") //must set argument names
59+
private String removeFromExampleList(String string) {
60+
if(this.stringList.remove(string)) {
61+
return "Removed " + string;
62+
}
63+
return string + " not found";
64+
}
65+
66+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package org.rusherhack.example;
2+
3+
import org.rusherhack.client.api.feature.hud.ResizeableHudElement;
4+
import org.rusherhack.client.api.render.RenderContext;
5+
import org.rusherhack.client.api.render.graphic.TextureGraphic;
6+
7+
/**
8+
* Example rusherhack hud element
9+
* <p>
10+
* There are other hud element types than ResizeableHudElement, look at the other classes in the package
11+
*
12+
* @author John200410
13+
*/
14+
public class ExampleHudElement extends ResizeableHudElement {
15+
16+
private TextureGraphic graphic = null;
17+
18+
public ExampleHudElement() {
19+
super("ExampleHudElement");
20+
21+
//try loading graphic
22+
try {
23+
this.graphic = new TextureGraphic("exampleplugin/graphics/rh_head.png", 235, 234);
24+
} catch (Throwable t) {
25+
t.printStackTrace();
26+
}
27+
}
28+
29+
@Override
30+
public void renderContent(RenderContext context, int mouseX, int mouseY) {
31+
//positions are relative to the top left corner of the hud element, so start drawing stuff from 0,0
32+
33+
if (this.graphic != null) {
34+
this.getRenderer().drawGraphicRectangle(this.graphic, 0, 0, this.getWidth(), this.getHeight());
35+
}
36+
}
37+
38+
@Override
39+
public double getWidth() {
40+
return 200;
41+
}
42+
43+
@Override
44+
public double getHeight() {
45+
return 200;
46+
}
47+
}

0 commit comments

Comments
 (0)