Skip to content

Commit bc52541

Browse files
committed
Start back-port to 1.12.2
1 parent c5f1db5 commit bc52541

File tree

1,343 files changed

+21517
-1
lines changed

Some content is hidden

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

1,343 files changed

+21517
-1
lines changed

core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ eclipse {
99

1010
project.archivesBaseName = "${parent.name}-core"
1111

12-
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaLanguageVersion.of(8) // Need this here so eclipse task generates correctly.
12+
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = 1.8 // Need this here so eclipse task generates correctly.
1313

1414
dependencies {
1515
compileOnly 'com.google.code.gson:gson:2.8.0'

forge-1.12.2/.gitignore

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

forge-1.12.2/build.gradle

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
mavenLocal()
5+
6+
maven {
7+
name = "forgeFS"
8+
url = "http://files.minecraftforge.net/maven"
9+
}
10+
maven {
11+
name = "sonatype"
12+
url = "https://oss.sonatype.org/content/repositories/snapshots/"
13+
}
14+
}
15+
dependencies {
16+
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
17+
}
18+
}
19+
20+
apply plugin: 'net.minecraftforge.gradle.forge'
21+
22+
// define the properties file
23+
ext.configFile = file "build.properties"
24+
25+
configFile.withReader {
26+
def prop = new Properties()
27+
prop.load(it)
28+
project.ext.config = new ConfigSlurper().parse prop
29+
}
30+
31+
version = "${parent.version}"
32+
group= "us.dynmap.forge" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
33+
archivesBaseName = "DynmapBlockScan"
34+
targetCompatibility = '1.8'
35+
sourceCompatibility = '1.8'
36+
ext.buildNumber = System.getenv().BUILD_NUMBER ?: "Dev"
37+
38+
minecraft {
39+
version = config.minecraft_version + "-" + config.forge_version
40+
runDir = "run"
41+
mappings = 'snapshot_nodoc_20171021'
42+
replaceIn "Version.java"
43+
replace "@VERSION@", parent.version + '-' + project.ext.buildNumber
44+
replace "@BUILD_NUMBER@", project.ext.buildNumber
45+
}
46+
47+
repositories {
48+
mavenLocal()
49+
maven { url = "https://repo.mikeprimm.com" }
50+
}
51+
52+
configurations {
53+
dynmap
54+
compile.extendsFrom dynmap
55+
}
56+
57+
dependencies {
58+
dynmap "us.dynmap:DynmapCoreAPI:${parent.version}:all"
59+
implementation project(path: ":core", configuration: "shadow")
60+
}
61+
62+
processResources
63+
{
64+
// replace stuff in mcmod.info, nothing else
65+
from(sourceSets.main.resources.srcDirs) {
66+
include 'mcmod.info'
67+
68+
// replace version and mcversion
69+
expand(
70+
version: parent.version + '-' + project.ext.buildNumber,
71+
mcversion: config.minecraft_version
72+
)
73+
}
74+
75+
// copy everything else, thats not the mcmod.info
76+
from(sourceSets.main.resources.srcDirs) {
77+
exclude 'mcmod.info'
78+
}
79+
// Move access transformer to META-INF
80+
rename '(.+_at.cfg)', 'META-INF/$1'
81+
}
82+
83+
84+
shadowJar {
85+
dependencies {
86+
include(dependency(':core'))
87+
exclude(dependency("us.dynmap:DynmapCoreAPI"))
88+
exclude("META-INF/maven/**")
89+
exclude("META-INF/services/**")
90+
exclude("com/electronwill/**")
91+
}
92+
archiveName = "${parent.name}-${parent.version}-forge-1.12.2.jar"
93+
destinationDir = file '../target'
94+
}
95+
96+
shadowJar.doLast {
97+
task ->
98+
ant.checksum file: task.archivePath
99+
}
100+
101+
102+
reobf {
103+
shadowJar {
104+
mappingType = 'SEARGE'
105+
}
106+
}
107+
108+
task deobfJar(type: Jar) {
109+
from sourceSets.main.output
110+
classifier = 'dev'
111+
}
112+
113+
artifacts {
114+
archives deobfJar
115+
}
116+
117+
build.dependsOn(shadowJar)
118+

forge-1.12.2/build.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
minecraft_version=1.12.2
2+
forge_version=14.23.4.2705
3+
mapping_version=snapshot_nodoc_20171021
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package org.dynmap.blockscan;
2+
3+
import java.lang.reflect.Type;
4+
import java.util.Collections;
5+
import java.util.HashMap;
6+
import java.util.Map;
7+
import java.util.Map.Entry;
8+
9+
import org.dynmap.blockscan.blockstate.BaseCondition;
10+
11+
import com.google.gson.JsonArray;
12+
import com.google.gson.JsonDeserializationContext;
13+
import com.google.gson.JsonDeserializer;
14+
import com.google.gson.JsonElement;
15+
import com.google.gson.JsonObject;
16+
import com.google.gson.JsonParseException;
17+
18+
// Container for JSON-encoded block state overrides (to handle bogus Mojang block state file name options
19+
public class BlockStateOverrides {
20+
public Map<String, Map<String, BlockStateOverride>> overrides = Collections.emptyMap();
21+
public Map<String, Map<String, BlockTintOverride[]>> tinting = Collections.emptyMap();
22+
23+
public static class BlockStateOverride {
24+
public String baseNameProperty = null; // If property used for base name, this is property name
25+
public String nameSuffix = ""; // If base name has suffix
26+
public String blockStateName = null; // If defined, this is name of block state resource
27+
public String blockStateKey = null; // If defined, condition for matching block state
28+
public String blockStateValue = null; // If defined, condition for matching block state
29+
}
30+
public static class BlockTintOverride {
31+
public BaseCondition state; // Condition for matching block state (null=all states)
32+
public String[] colormap; // Colormap resource
33+
34+
// Custom deserializer
35+
public static class Deserializer implements JsonDeserializer<BlockTintOverride> {
36+
@Override
37+
public BlockTintOverride deserialize(JsonElement element, Type type, JsonDeserializationContext context) throws JsonParseException {
38+
BlockTintOverride ovr = new BlockTintOverride();
39+
JsonObject obj = element.getAsJsonObject();
40+
if (obj.has("state")) {
41+
ovr.state = new BaseCondition(obj.get("state").getAsString());
42+
}
43+
if (obj.has("colormap")) {
44+
JsonArray ary = obj.getAsJsonArray("colormap");
45+
ovr.colormap = new String[ary.size()];
46+
for (int i = 0; i < ary.size(); i++) {
47+
ovr.colormap[i] = ary.get(i).getAsString();
48+
}
49+
}
50+
return ovr;
51+
}
52+
}
53+
}
54+
55+
public BlockStateOverride getOverride(String modid, String blkid) {
56+
Map<String, BlockStateOverride> map = overrides.get(modid);
57+
if (map != null) {
58+
return map.get(blkid);
59+
}
60+
return null;
61+
}
62+
63+
public BlockTintOverride getTinting(String modid, String blkid, Map<String,String> prop) {
64+
Map<String, BlockTintOverride[]> modmatch = tinting.get(modid);
65+
if (modmatch != null) {
66+
BlockTintOverride[] blkmatch = modmatch.get(blkid);
67+
if (blkmatch != null) {
68+
for (BlockTintOverride ovr : blkmatch) {
69+
if ((ovr.state == null) || (ovr.state.matches(prop))) {
70+
return ovr;
71+
}
72+
}
73+
}
74+
}
75+
return null;
76+
}
77+
78+
public void merge(BlockStateOverrides ovr) {
79+
// Merge in block state overrides
80+
for (Entry<String, Map<String, BlockStateOverride>> mod : ovr.overrides.entrySet()) {
81+
String modid = mod.getKey();
82+
if (overrides.containsKey(modid) == false) {
83+
overrides.put(modid, new HashMap<String, BlockStateOverride>());
84+
}
85+
Map<String, BlockStateOverride> bso = overrides.get(modid);
86+
for (Entry<String, BlockStateOverride> blk : mod.getValue().entrySet()) {
87+
bso.put(blk.getKey(), blk.getValue());
88+
}
89+
}
90+
// Merge in tinting overrides
91+
for (Entry<String, Map<String, BlockTintOverride[]>> mod : ovr.tinting.entrySet()) {
92+
String modid = mod.getKey();
93+
if (tinting.containsKey(modid) == false) {
94+
tinting.put(modid, new HashMap<String, BlockTintOverride[]>());
95+
}
96+
Map<String, BlockTintOverride[]> bto = tinting.get(modid);
97+
for (Entry<String, BlockTintOverride[]> blk : mod.getValue().entrySet()) {
98+
bto.put(blk.getKey(), blk.getValue());
99+
}
100+
}
101+
}
102+
103+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package org.dynmap.blockscan;
2+
3+
public class ClientProxy extends Proxy {
4+
public ClientProxy() {
5+
}
6+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package org.dynmap.blockscan;
2+
3+
import java.io.File;
4+
import java.util.Map;
5+
6+
import net.minecraft.server.MinecraftServer;
7+
import net.minecraftforge.common.config.Configuration;
8+
import net.minecraftforge.fml.common.Mod;
9+
import net.minecraftforge.fml.common.Mod.EventHandler;
10+
import net.minecraftforge.fml.common.Mod.Instance;
11+
import net.minecraftforge.fml.common.SidedProxy;
12+
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
13+
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
14+
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
15+
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
16+
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
17+
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
18+
import net.minecraftforge.fml.common.network.NetworkCheckHandler;
19+
import net.minecraftforge.fml.relauncher.Side;
20+
21+
@Mod(modid = "dynmapblockscan", name = "DynmapBlockScan", version = Version.VER)
22+
public class DynmapBlockScanMod
23+
{
24+
public static DynmapBlockScanPlugin.OurLog logger = new DynmapBlockScanPlugin.OurLog();
25+
// The instance of your mod that Forge uses.
26+
@Instance("dynmapblockscan")
27+
public static DynmapBlockScanMod instance;
28+
29+
// Says where the client and server 'proxy' code is loaded.
30+
@SidedProxy(clientSide = "org.dynmap.blockscan.ClientProxy", serverSide = "org.dynmap.blockscan.Proxy")
31+
public static Proxy proxy;
32+
33+
public static DynmapBlockScanPlugin plugin;
34+
public static File jarfile;
35+
public static boolean verboselogging = false;
36+
37+
public DynmapBlockScanMod() {
38+
}
39+
40+
@EventHandler
41+
public void preInit(FMLPreInitializationEvent event)
42+
{
43+
jarfile = event.getSourceFile();
44+
// Load configuration file - use suggested (config/DynmapBlockScan.cfg)
45+
Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
46+
try {
47+
cfg.load();
48+
49+
verboselogging = cfg.get("Settings", "verboselog", false).getBoolean(false);
50+
}
51+
finally
52+
{
53+
cfg.save();
54+
}
55+
}
56+
57+
@EventHandler
58+
public void init(FMLInitializationEvent event)
59+
{
60+
}
61+
62+
@EventHandler
63+
public void postInit(FMLPostInitializationEvent event)
64+
{
65+
}
66+
67+
private MinecraftServer server;
68+
@EventHandler
69+
public void serverStarting(FMLServerStartingEvent event) {
70+
server = event.getServer();
71+
if(plugin == null)
72+
plugin = proxy.startServer(server);
73+
plugin.serverStarting();
74+
}
75+
76+
@EventHandler
77+
public void serverStarted(FMLServerStartedEvent event)
78+
{
79+
plugin.serverStarted();
80+
}
81+
@EventHandler
82+
public void serverStopping(FMLServerStoppingEvent event)
83+
{
84+
proxy.stopServer(plugin);
85+
plugin = null;
86+
}
87+
@NetworkCheckHandler
88+
public boolean netCheckHandler(Map<String, String> mods, Side side) {
89+
return true;
90+
}
91+
}

0 commit comments

Comments
 (0)