Skip to content
This repository was archived by the owner on Feb 18, 2021. It is now read-only.

Commit 0a1f3a2

Browse files
committed
Initial commit
0 parents  commit 0a1f3a2

File tree

7 files changed

+221
-0
lines changed

7 files changed

+221
-0
lines changed

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ---> Java
2+
*.class
3+
4+
# Mobile Tools for Java (J2ME)
5+
.mtj.tmp/
6+
7+
# Package Files #
8+
*.jar
9+
*.war
10+
*.ear
11+
12+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
13+
hs_err_pid*
14+
15+
# IntelliJ IDEA
16+
*.iml
17+
.idea/
18+
19+
# Maven
20+
target/
21+
dependency-reduced-pom.xml
22+
23+
# Gradle
24+
!gradle-wrapper.jar
25+
.gradle/
26+
build/
27+
*/build/

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Orion example Mod
2+
3+
This is example mod overriding EULA check on 1.12 Paper server using Mixin
4+
5+
API is not done yet, hence library jar sits in repository as well
6+
7+
Put this into mods dir, remove eula.txt and see how it works :smile:
8+
9+
(See Releases for precompiled mod)
10+
11+
WTFPL

lib/OrionAPI-0.0.1.jar

3.4 KB
Binary file not shown.

pom.xml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>eu.mikroskeem.orion</groupId>
8+
<artifactId>examplemod</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<build>
11+
<plugins>
12+
<plugin>
13+
<groupId>org.apache.maven.plugins</groupId>
14+
<artifactId>maven-compiler-plugin</artifactId>
15+
<version>3.6.1</version>
16+
<configuration>
17+
<source>1.8</source>
18+
<target>1.8</target>
19+
</configuration>
20+
</plugin>
21+
</plugins>
22+
</build>
23+
24+
<repositories>
25+
<!-- SpongePowered repo -->
26+
<repository>
27+
<id>sponge-repo</id>
28+
<url>https://repo.spongepowered.org/maven</url>
29+
</repository>
30+
31+
<!-- Minecraft libraries -->
32+
<repository>
33+
<id>minecraft</id>
34+
<url>https://libraries.minecraft.net</url>
35+
</repository>
36+
37+
<!-- Own repository -->
38+
<repository>
39+
<id>mikroskeem-repo</id>
40+
<name>mikroskeem Maven Repository</name>
41+
<url>https://repo.wut.ee/repository/mikroskeem-repo/</url>
42+
<releases>
43+
<enabled>true</enabled>
44+
</releases>
45+
<snapshots>
46+
<enabled>true</enabled>
47+
</snapshots>
48+
</repository>
49+
</repositories>
50+
51+
<dependencies>
52+
<dependency>
53+
<groupId>com.destroystokyo.paper</groupId>
54+
<artifactId>paper</artifactId>
55+
<version>1.12-R0.1-SNAPSHOT</version>
56+
<scope>provided</scope>
57+
</dependency>
58+
59+
<!-- Orion API -->
60+
<dependency>
61+
<groupId>eu.mikroskeem.orion</groupId>
62+
<artifactId>api</artifactId>
63+
<version>0.0.1</version>
64+
<scope>system</scope>
65+
<systemPath>${project.basedir}/lib/OrionAPI-0.0.1.jar</systemPath>
66+
</dependency>
67+
68+
<!-- Orion API dependencies -->
69+
<dependency>
70+
<groupId>ninja.leaping.configurate</groupId>
71+
<artifactId>configurate-hocon</artifactId>
72+
<version>3.3</version>
73+
<scope>provided</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>com.google.guava</groupId>
77+
<artifactId>guava</artifactId>
78+
<version>21.0</version>
79+
<scope>provided</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>javax.inject</groupId>
83+
<artifactId>javax.inject</artifactId>
84+
<version>1</version>
85+
<scope>provided</scope>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.apache.logging.log4j</groupId>
89+
<artifactId>log4j-api</artifactId>
90+
<version>2.8</version>
91+
<scope>provided</scope>
92+
</dependency>
93+
<dependency>
94+
<groupId>org.spongepowered</groupId>
95+
<artifactId>mixin</artifactId>
96+
<version>0.6.15-SNAPSHOT</version>
97+
<scope>provided</scope>
98+
</dependency>
99+
</dependencies>
100+
</project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package eu.mikroskeem.orion.examplemod;
2+
3+
import com.google.common.eventbus.Subscribe;
4+
import eu.mikroskeem.orion.api.OrionAPI;
5+
import eu.mikroskeem.orion.api.annotations.OrionMod;
6+
import eu.mikroskeem.orion.api.events.ModConstructEvent;
7+
import org.apache.logging.log4j.Logger;
8+
9+
import javax.inject.Inject;
10+
11+
12+
/**
13+
* Orion sample mod
14+
*
15+
* @author Mark Vainomaa
16+
*/
17+
@OrionMod(id = "samplemod")
18+
public final class ExampleMod {
19+
@Inject private Logger logger;
20+
21+
@Subscribe
22+
public void on(ModConstructEvent e) throws Exception {
23+
logger.info("Hello world!");
24+
OrionAPI.getInstance().registerMixinConfig("mixins.examplemod.json");
25+
}
26+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package eu.mikroskeem.orion.examplemod.mixins;
2+
3+
import net.minecraft.server.v1_12_R1.EULA;
4+
import org.apache.logging.log4j.Logger;
5+
import org.spongepowered.asm.mixin.Final;
6+
import org.spongepowered.asm.mixin.Mixin;
7+
import org.spongepowered.asm.mixin.Overwrite;
8+
import org.spongepowered.asm.mixin.Shadow;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12+
13+
import java.io.File;
14+
15+
16+
/**
17+
* @author Mark Vainomaa
18+
*/
19+
@Mixin(value = EULA.class, remap = false)
20+
public abstract class MixinEULA {
21+
@Shadow @Final private static Logger a;
22+
23+
@Inject(method = "<init>", cancellable = true, at = @At("RETURN"))
24+
public void init(File file, CallbackInfo ci) {
25+
a.info("ExampleMod - Agreed to EULA automatically!");
26+
}
27+
28+
/**
29+
* Overwrites EULA file reading and result reading method
30+
*
31+
* @author Mark Vainomaa
32+
* @param file
33+
* @return
34+
*/
35+
@Overwrite
36+
private boolean a(File file) {
37+
return true;
38+
}
39+
40+
/**
41+
* Overwrites EULA file writing method
42+
*
43+
* @author Mark Vainomaa
44+
*/
45+
@Overwrite
46+
public void b() {}
47+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"required": true,
3+
"minVersion": "0.6.15",
4+
"package": "eu.mikroskeem.orion.examplemod.mixins",
5+
"target": "@env(DEFAULT)",
6+
"compatibilityLevel": "JAVA_8",
7+
"server": [
8+
"MixinEULA"
9+
]
10+
}

0 commit comments

Comments
 (0)