Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit a119633

Browse files
committed
Fixed set-cookie header getting the 2nd header, removed Lombok, done activeAd header, cleaned code, add support for new forge simplified some code
1 parent f562c1b commit a119633

20 files changed

+1382
-1227
lines changed

build.gradle

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,40 @@
1-
buildscript {
2-
repositories {
3-
jcenter()
4-
maven {
5-
name = "forge"
6-
url = "http://files.minecraftforge.net/maven"
7-
}
8-
}
9-
dependencies {
10-
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
11-
}
12-
}
13-
apply plugin: 'net.minecraftforge.gradle.forge'
14-
compileJava {
15-
sourceCompatibility = '8'
16-
targetCompatibility = '1.8'
1+
plugins {
2+
id "java"
3+
id "com.github.johnrengelman.shadow" version "6.1.0"
4+
id "net.minecraftforge.gradle.forge" version "6f53277"
175
}
186

7+
sourceCompatibility = targetCompatibility = 1.8
8+
compileJava.options.encoding = 'UTF-8'
9+
1910
archivesBaseName = 'RewardClaim'
20-
version = '0.1.1'
11+
version = '0.2'
2112
group = 'me.dancedog.rewardclaim'
13+
2214
minecraft {
23-
version = '1.8.9-11.15.1.1722'
24-
runDir = 'run'
25-
mappings = 'stable_20'
15+
version = "1.8.9-11.15.1.2318-1.8.9"
16+
runDir = "run"
17+
mappings = "stable_22"
18+
makeObfSourceJar = false
2619
}
2720

2821
configurations {
29-
shade
30-
shade.transitive = false
31-
compile.extendsFrom(shade)
32-
}
33-
repositories {
34-
mavenCentral()
22+
// Creates an extra configuration that implements `implementation` to be used later as the configuration that shades libraries
23+
include
24+
compile.extendsFrom(include)
3525
}
26+
3627
dependencies {
37-
compileOnly 'org.projectlombok:lombok:1.18.12'
38-
annotationProcessor 'org.projectlombok:lombok:1.18.12'
39-
shade 'org.jsoup:jsoup:1.13.1'
40-
}
41-
jar {
42-
from configurations.shade.collect {
43-
it.isDirectory() ? it : zipTree(it)
44-
}
28+
// How to normally add a dependency (If you don't want it to be added to the jar)
29+
// implementation "com.example:example:1.0.0"
30+
// If you would like to include it (have the library inside your jar) instead use
31+
// include "com.example:example:1.0.0"
32+
include 'org.jsoup:jsoup:1.14.1'
4533
}
4634

35+
/**
36+
* This task simply replaces the `${version}` and `${mcversion}` properties in the mcmod.info with the data from Gradle
37+
*/
4738
processResources {
4839
// this will ensure that this task is redone when the versions change.
4940
inputs.property "version", project.version
@@ -54,7 +45,7 @@ processResources {
5445
include 'mcmod.info'
5546

5647
// replace version and mcversion
57-
expand 'version':project.version, 'mcversion':project.minecraft.version
48+
expand 'version': project.version, 'mcversion': project.minecraft.version
5849
}
5950

6051
// copy everything else, thats not the mcmod.info
@@ -63,5 +54,24 @@ processResources {
6354
}
6455
}
6556

66-
//noinspection GrDeprecatedAPIUsage
67-
sourceSets.main.output.classesDir = new File(buildDir, "classes/main")
57+
/**
58+
* This task simply moves resources so they can be accessed at runtime, Forge is quite weird isn't it
59+
*/
60+
task moveResources {
61+
doLast {
62+
ant.move file: "${buildDir}/resources/main",
63+
todir: "${buildDir}/classes/java"
64+
}
65+
}
66+
67+
moveResources.dependsOn processResources
68+
classes.dependsOn moveResources
69+
70+
// This adds support to ("embed", "shade", "include") libraries into our JAR
71+
shadowJar {
72+
archiveClassifier.set('')
73+
duplicatesStrategy DuplicatesStrategy.EXCLUDE
74+
configurations = [project.configurations.include]
75+
}
76+
77+
reobfJar.dependsOn tasks.shadowJar

gradle/wrapper/gradle-wrapper.jar

4.67 KB
Binary file not shown.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Sun Mar 29 22:07:45 EDT 2020
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
31
distributionBase=GRADLE_USER_HOME
42
distributionPath=wrapper/dists
5-
zipStorePath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
64
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

gradlew.bat

Lines changed: 24 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/me/dancedog/rewardclaim/Mod.java

Lines changed: 0 additions & 58 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package me.dancedog.rewardclaim;
2+
3+
import net.minecraft.client.Minecraft;
4+
import net.minecraft.util.ChatComponentText;
5+
import net.minecraft.util.EnumChatFormatting;
6+
import net.minecraft.util.ResourceLocation;
7+
import net.minecraftforge.common.MinecraftForge;
8+
import net.minecraftforge.fml.common.Mod.EventHandler;
9+
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
10+
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
11+
import org.apache.logging.log4j.LogManager;
12+
import org.apache.logging.log4j.Logger;
13+
14+
import java.util.concurrent.Executors;
15+
import java.util.concurrent.ThreadPoolExecutor;
16+
17+
@net.minecraftforge.fml.common.Mod(
18+
modid = RewardClaim.MODID,
19+
version = RewardClaim.VERSION,
20+
name = RewardClaim.MODNAME,
21+
useMetadata = true)
22+
public class RewardClaim {
23+
24+
public static final ThreadPoolExecutor pool = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
25+
public static final String MODID = "rewardclaim";
26+
public static final String VERSION = "0.2";
27+
static final String MODNAME = "RewardClaim";
28+
29+
private static Logger logger = LogManager.getLogger(MODID);
30+
31+
public static Logger getLogger() {
32+
return RewardClaim.logger;
33+
}
34+
35+
@EventHandler
36+
public void preInit(FMLPreInitializationEvent event) {
37+
logger = event.getModLog();
38+
}
39+
40+
@EventHandler
41+
public void init(FMLInitializationEvent event) {
42+
MinecraftForge.EVENT_BUS.register(new RewardListener());
43+
}
44+
45+
/**
46+
* Get a resource from the mod's GUI asset folder
47+
*
48+
* @param path Path to the resource (appended to /gui/)
49+
* @return ResourceLocation of the requested asset
50+
*/
51+
public static ResourceLocation getGuiTexture(String path) {
52+
return new ResourceLocation(MODID + ":textures/gui/" + path);
53+
}
54+
55+
public static void printWarning(String message, Throwable t, boolean inChat) {
56+
logger.warn(message, t);
57+
58+
if (inChat && Minecraft.getMinecraft().thePlayer != null) {
59+
ChatComponentText chatMessage = new ChatComponentText("[" + MODNAME + "] " + message);
60+
chatMessage.getChatStyle().setBold(true).setColor(EnumChatFormatting.RED);
61+
Minecraft.getMinecraft().thePlayer.addChatMessage(chatMessage);
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)