Skip to content

Commit 8b8d13b

Browse files
authored
Merge pull request #4200 from petersv5/1.21.5-fabric-port
initial port to fabric 1.21.5
2 parents 85f5ec6 + 802f62b commit 8b8d13b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3977
-1
lines changed

fabric-1.21.5/.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# gradle
2+
3+
.gradle/
4+
build/
5+
out/
6+
classes/
7+
8+
# eclipse
9+
10+
*.launch
11+
12+
# idea
13+
14+
.idea/
15+
*.iml
16+
*.ipr
17+
*.iws
18+
19+
# vscode
20+
21+
.settings/
22+
.vscode/
23+
bin/
24+
.classpath
25+
.project
26+
27+
# fabric
28+
29+
run/
30+
31+
# other
32+
*.log

fabric-1.21.5/build.gradle

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
plugins {
2+
id 'fabric-loom' version '1.10-SNAPSHOT'
3+
}
4+
5+
archivesBaseName = "Dynmap"
6+
version = parent.version
7+
group = parent.group
8+
9+
eclipse {
10+
project {
11+
name = "Dynmap(Fabric-1.21.5)"
12+
}
13+
}
14+
15+
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaLanguageVersion.of(21) // Need this here so eclipse task generates correctly.
16+
17+
configurations {
18+
shadow
19+
implementation.extendsFrom(shadow)
20+
}
21+
22+
repositories {
23+
mavenCentral()
24+
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
25+
}
26+
27+
dependencies {
28+
minecraft "com.mojang:minecraft:${project.minecraft_version}"
29+
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
30+
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
31+
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
32+
33+
compileOnly group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
34+
35+
shadow project(path: ':DynmapCore', configuration: 'shadow')
36+
37+
modCompileOnly "me.lucko:fabric-permissions-api:0.1-SNAPSHOT"
38+
compileOnly 'net.luckperms:api:5.4'
39+
}
40+
41+
loom {
42+
accessWidenerPath = file("src/main/resources/dynmap.accesswidener")
43+
}
44+
45+
processResources {
46+
filesMatching('fabric.mod.json') {
47+
expand "version": project.version
48+
}
49+
}
50+
51+
java {
52+
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
53+
// if it is present.
54+
// If you remove this line, sources will not be generated.
55+
withSourcesJar()
56+
}
57+
58+
jar {
59+
from "LICENSE"
60+
from {
61+
configurations.shadow.collect { it.toString().contains("guava") ? null : it.isDirectory() ? it : zipTree(it) }
62+
}
63+
}
64+
65+
remapJar {
66+
archiveFileName = "${archivesBaseName}-${project.version}-fabric-${project.minecraft_version}.jar"
67+
destinationDirectory = file '../target'
68+
}
69+
70+
remapJar.doLast {
71+
task ->
72+
ant.checksum file: task.archivePath
73+
}

fabric-1.21.5/gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
minecraft_version=1.21.5
2+
yarn_mappings=1.21.5+build.1
3+
loader_version=0.16.12
4+
fabric_version=0.119.6+1.21.5
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package org.dynmap.fabric_1_21_5;
2+
3+
import net.fabricmc.api.ModInitializer;
4+
import net.fabricmc.loader.api.FabricLoader;
5+
import net.fabricmc.loader.api.ModContainer;
6+
import org.dynmap.DynmapCore;
7+
import org.dynmap.Log;
8+
9+
import java.io.File;
10+
import java.net.URISyntaxException;
11+
import java.nio.file.Path;
12+
import java.nio.file.Paths;
13+
14+
public class DynmapMod implements ModInitializer {
15+
private static final String MODID = "dynmap";
16+
private static final ModContainer MOD_CONTAINER = FabricLoader.getInstance().getModContainer(MODID)
17+
.orElseThrow(() -> new RuntimeException("Failed to get mod container: " + MODID));
18+
// The instance of your mod that Fabric uses.
19+
public static DynmapMod instance;
20+
21+
public static DynmapPlugin plugin;
22+
public static File jarfile;
23+
public static String ver;
24+
public static boolean useforcedchunks;
25+
26+
@Override
27+
public void onInitialize() {
28+
instance = this;
29+
30+
Path path = MOD_CONTAINER.getRootPath();
31+
try {
32+
jarfile = new File(DynmapCore.class.getProtectionDomain().getCodeSource().getLocation().toURI());
33+
} catch (URISyntaxException e) {
34+
Log.severe("Unable to get DynmapCore jar path", e);
35+
}
36+
37+
if (path.getFileSystem().provider().getScheme().equals("jar")) {
38+
path = Paths.get(path.getFileSystem().toString());
39+
jarfile = path.toFile();
40+
}
41+
42+
ver = MOD_CONTAINER.getMetadata().getVersion().getFriendlyString();
43+
44+
Log.setLogger(new FabricLogger());
45+
org.dynmap.modsupport.ModSupportImpl.init();
46+
47+
// Initialize the plugin, we will enable it fully when the server starts.
48+
plugin = new DynmapPlugin();
49+
}
50+
}

0 commit comments

Comments
 (0)