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

Commit

Permalink
Fixed set-cookie header getting the 2nd header, removed Lombok, done …
Browse files Browse the repository at this point in the history
…activeAd header, cleaned code, add support for new forge simplified some code
  • Loading branch information
DevBefell committed Jul 22, 2021
1 parent f562c1b commit a119633
Show file tree
Hide file tree
Showing 20 changed files with 1,382 additions and 1,227 deletions.
84 changes: 47 additions & 37 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,49 +1,40 @@
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
compileJava {
sourceCompatibility = '8'
targetCompatibility = '1.8'
plugins {
id "java"
id "com.github.johnrengelman.shadow" version "6.1.0"
id "net.minecraftforge.gradle.forge" version "6f53277"
}

sourceCompatibility = targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'

archivesBaseName = 'RewardClaim'
version = '0.1.1'
version = '0.2'
group = 'me.dancedog.rewardclaim'

minecraft {
version = '1.8.9-11.15.1.1722'
runDir = 'run'
mappings = 'stable_20'
version = "1.8.9-11.15.1.2318-1.8.9"
runDir = "run"
mappings = "stable_22"
makeObfSourceJar = false
}

configurations {
shade
shade.transitive = false
compile.extendsFrom(shade)
}
repositories {
mavenCentral()
// Creates an extra configuration that implements `implementation` to be used later as the configuration that shades libraries
include
compile.extendsFrom(include)
}

dependencies {
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
shade 'org.jsoup:jsoup:1.13.1'
}
jar {
from configurations.shade.collect {
it.isDirectory() ? it : zipTree(it)
}
// How to normally add a dependency (If you don't want it to be added to the jar)
// implementation "com.example:example:1.0.0"
// If you would like to include it (have the library inside your jar) instead use
// include "com.example:example:1.0.0"
include 'org.jsoup:jsoup:1.14.1'
}

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

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
expand 'version': project.version, 'mcversion': project.minecraft.version
}

// copy everything else, thats not the mcmod.info
Expand All @@ -63,5 +54,24 @@ processResources {
}
}

//noinspection GrDeprecatedAPIUsage
sourceSets.main.output.classesDir = new File(buildDir, "classes/main")
/**
* This task simply moves resources so they can be accessed at runtime, Forge is quite weird isn't it
*/
task moveResources {
doLast {
ant.move file: "${buildDir}/resources/main",
todir: "${buildDir}/classes/java"
}
}

moveResources.dependsOn processResources
classes.dependsOn moveResources

// This adds support to ("embed", "shade", "include") libraries into our JAR
shadowJar {
archiveClassifier.set('')
duplicatesStrategy DuplicatesStrategy.EXCLUDE
configurations = [project.configurations.include]
}

reobfJar.dependsOn tasks.shadowJar
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sun Mar 29 22:07:45 EDT 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
43 changes: 24 additions & 19 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -45,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
58 changes: 0 additions & 58 deletions src/main/java/me/dancedog/rewardclaim/Mod.java

This file was deleted.

64 changes: 64 additions & 0 deletions src/main/java/me/dancedog/rewardclaim/RewardClaim.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package me.dancedog.rewardclaim;

import net.minecraft.client.Minecraft;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

@net.minecraftforge.fml.common.Mod(
modid = RewardClaim.MODID,
version = RewardClaim.VERSION,
name = RewardClaim.MODNAME,
useMetadata = true)
public class RewardClaim {

public static final ThreadPoolExecutor pool = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
public static final String MODID = "rewardclaim";
public static final String VERSION = "0.2";
static final String MODNAME = "RewardClaim";

private static Logger logger = LogManager.getLogger(MODID);

public static Logger getLogger() {
return RewardClaim.logger;
}

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
logger = event.getModLog();
}

@EventHandler
public void init(FMLInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(new RewardListener());
}

/**
* Get a resource from the mod's GUI asset folder
*
* @param path Path to the resource (appended to /gui/)
* @return ResourceLocation of the requested asset
*/
public static ResourceLocation getGuiTexture(String path) {
return new ResourceLocation(MODID + ":textures/gui/" + path);
}

public static void printWarning(String message, Throwable t, boolean inChat) {
logger.warn(message, t);

if (inChat && Minecraft.getMinecraft().thePlayer != null) {
ChatComponentText chatMessage = new ChatComponentText("[" + MODNAME + "] " + message);
chatMessage.getChatStyle().setBold(true).setColor(EnumChatFormatting.RED);
Minecraft.getMinecraft().thePlayer.addChatMessage(chatMessage);
}
}
}
Loading

0 comments on commit a119633

Please sign in to comment.