Skip to content

Commit 8cdfee1

Browse files
committed
Add forge 1.21.6/1.21.7
1 parent 6a85dcd commit 8cdfee1

20 files changed

+3595
-1
lines changed

bukkit-helper/.settings/org.eclipse.buildship.core.prefs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ arguments=
22
auto.sync=false
33
build.scans.enabled=false
44
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
5-
connection.project.dir=..
5+
connection.project.dir=../forge-1.21.6
66
eclipse.preferences.version=1
77
gradle.user.home=
88
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

forge-1.21.6/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build/

forge-1.21.6/build.gradle

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
buildscript {
2+
repositories {
3+
maven { url = 'https://files.minecraftforge.net/maven' }
4+
jcenter()
5+
mavenCentral()
6+
}
7+
dependencies {
8+
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '[6.0.24,6.2)', changing: true
9+
}
10+
}
11+
apply plugin: 'net.minecraftforge.gradle'
12+
//apply plugin: 'com.github.johnrengelman.shadow'
13+
apply plugin: 'eclipse'
14+
15+
eclipse {
16+
project {
17+
name = "Dynmap(Forge-1.21.6)"
18+
}
19+
}
20+
21+
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaLanguageVersion.of(21) // Need this here so eclipse task generates correctly.
22+
23+
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
24+
25+
ext.buildNumber = System.getenv().BUILD_NUMBER ?: "Dev"
26+
27+
minecraft {
28+
mappings channel: 'official', version: '1.21.6'
29+
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
30+
reobf = false
31+
copyIdeResources = true
32+
runs {
33+
server {
34+
workingDirectory project.file('run').canonicalPath
35+
}
36+
}
37+
}
38+
39+
project.archivesBaseName = "${project.archivesBaseName}-forge-1.21.6"
40+
41+
dependencies {
42+
implementation project(path: ":DynmapCore", configuration: "shadow")
43+
implementation project(path: ':DynmapCoreAPI')
44+
45+
minecraft 'net.minecraftforge:forge:1.21.6-56.0.9'
46+
}
47+
48+
processResources
49+
{
50+
filesMatching('META-INF/mods.toml') {
51+
// replace version and mcversion
52+
expand(
53+
version: project.version + '-' + project.ext.buildNumber,
54+
mcversion: "1.21.6"
55+
)
56+
}
57+
}
58+
59+
shadowJar {
60+
dependencies {
61+
include(dependency(':DynmapCore'))
62+
include(dependency("commons-codec:commons-codec:"))
63+
exclude("META-INF/maven/**")
64+
exclude("META-INF/services/**")
65+
}
66+
relocate('org.apache.commons.codec', 'org.dynmap.forge_1_21_6.commons.codec')
67+
68+
archiveBaseName = "Dynmap"
69+
archiveClassifier = "forge-1.21.6"
70+
destinationDirectory = file '../target'
71+
}
72+
73+
shadowJar.doLast {
74+
task ->
75+
ant.checksum file: task.archivePath
76+
}
77+
78+
build.dependsOn(shadowJar)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package org.dynmap.forge_1_21_6;
2+
3+
public class ClientProxy extends Proxy {
4+
public ClientProxy() {
5+
}
6+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
package org.dynmap.forge_1_21_6;
2+
3+
import java.io.File;
4+
5+
import org.apache.commons.lang3.tuple.Pair;
6+
import org.dynmap.DynmapCommonAPI;
7+
import org.dynmap.DynmapCommonAPIListener;
8+
import org.dynmap.Log;
9+
import org.dynmap.forge_1_21_6.DynmapPlugin.OurLog;
10+
11+
import net.minecraft.server.MinecraftServer;
12+
import net.minecraftforge.fml.common.Mod;
13+
import net.minecraftforge.common.MinecraftForge;
14+
import net.minecraftforge.event.server.ServerAboutToStartEvent;
15+
import net.minecraftforge.event.server.ServerStartedEvent;
16+
import net.minecraftforge.event.server.ServerStartingEvent;
17+
import net.minecraftforge.event.server.ServerStoppingEvent;
18+
import net.minecraftforge.eventbus.api.bus.BusGroup;
19+
import net.minecraftforge.eventbus.api.bus.EventBus;
20+
import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
21+
import net.minecraftforge.fml.DistExecutor;
22+
import net.minecraftforge.fml.IExtensionPoint;
23+
import net.minecraftforge.fml.ModList;
24+
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
25+
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
26+
27+
@Mod("dynmap")
28+
public class DynmapMod
29+
{
30+
// The instance of your mod that Forge uses.
31+
public static DynmapMod instance;
32+
public static BusGroup modBusGroup;
33+
34+
// Says where the client and server 'proxy' code is loaded.
35+
public static Proxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> Proxy::new);
36+
37+
public static DynmapPlugin plugin;
38+
public static File jarfile;
39+
public static String ver;
40+
public static boolean useforcedchunks;
41+
42+
public class APICallback extends DynmapCommonAPIListener {
43+
@Override
44+
public void apiListenerAdded() {
45+
if(plugin == null) {
46+
plugin = proxy.startServer(server);
47+
}
48+
}
49+
@Override
50+
public void apiEnabled(DynmapCommonAPI api) {
51+
}
52+
}
53+
54+
public DynmapMod(FMLJavaModLoadingContext context) {
55+
instance = this;
56+
57+
modBusGroup = context.getModBusGroup();
58+
59+
// Register the commonSetup method for modloading
60+
FMLCommonSetupEvent.getBus(modBusGroup).addListener(this::setup);
61+
62+
MinecraftForge.EVENT_BUS.register(this);
63+
64+
context.registerExtensionPoint(IExtensionPoint.DisplayTest.class,
65+
()->new IExtensionPoint.DisplayTest(()->IExtensionPoint.DisplayTest.IGNORESERVERONLY, (remote, isServer)-> true));
66+
67+
Log.setLogger(new OurLog());
68+
org.dynmap.modsupport.ModSupportImpl.init();
69+
}
70+
71+
public void setup(final FMLCommonSetupEvent event)
72+
{
73+
//TOOO
74+
jarfile = ModList.get().getModFileById("dynmap").getFile().getFilePath().toFile();
75+
76+
ver = ModList.get().getModContainerById("dynmap").get().getModInfo().getVersion().toString();
77+
78+
//// Load configuration file - use suggested (config/WesterosBlocks.cfg)
79+
//Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
80+
//try {
81+
// cfg.load();
82+
//
83+
// useforcedchunks = cfg.get("Settings", "UseForcedChunks", true).getBoolean(true);
84+
//}
85+
//finally
86+
//{
87+
// cfg.save();
88+
//}
89+
}
90+
91+
private MinecraftServer server;
92+
93+
@SubscribeEvent
94+
public void onServerStarting(ServerAboutToStartEvent event) {
95+
server = event.getServer();
96+
if(plugin == null)
97+
plugin = proxy.startServer(server);
98+
plugin.onStarting(server.getCommands().getDispatcher());
99+
}
100+
101+
@SubscribeEvent
102+
public void onServerStarted(ServerStartedEvent event) {
103+
DynmapCommonAPIListener.register(new APICallback());
104+
plugin.serverStarted();
105+
}
106+
107+
@SubscribeEvent
108+
public void serverStopping(ServerStoppingEvent event)
109+
{
110+
proxy.stopServer(plugin);
111+
plugin = null;
112+
}
113+
}

0 commit comments

Comments
 (0)