Compare commits

..
73 Commits
Author SHA1 Message Date
Martin Robertz 6f52f3d0da sa 2025-06-21 00:02:14 +02:00
Martin Robertz 26a1058f76 update 2025-06-21 00:00:28 +02:00
Martin Robertz 7e0208c0bf Merge remote-tracking branch 'origin/Ethryan-patch-1' into dev 2025-06-21 00:00:07 +02:00
Martin Robertz 43ee6dab14 update 2025-06-20 23:59:49 +02:00
Ethryan c8fc27211c Readd the slot code, since for some reason the Crafting Terminal doesn't extend the Wireless Terminal. 2025-06-17 10:31:54 +02:00
github-actions[bot] b7518b4e47 Spotless apply for branch Ethryan-patch-1 for #41 (#42) 2025-06-16 20:21:00 +02:00
Ethryan 3fcc50d1a1 Update ItemWirelessCraftingTerminal.java 2025-06-16 20:16:38 +02:00
Ethryan bb979c569a typo 2025-06-16 19:52:14 +02:00
Ethryan 0e2c9a88a4 Remove baubles code, since its loaded upstream 2025-06-16 19:51:22 +02:00
lordIcocain 8eae5ade43 make baubles optional (#40) 2025-05-25 15:20:00 +02:00
Martin Robertz c568f2dd29 update 2025-05-16 22:12:23 +02:00
Caedis 0755a0d5f5 Replace Baubles with Baubles Expanded (#38) 2025-05-13 14:18:01 +02:00
Martin Robertz 4e757686c6 update 2025-01-31 20:21:19 +01:00
Michael Doyle 4c491ba2cb [Feature] Shift to pause wireless crafting terminal item movement (#37) 2025-01-28 18:49:55 -06:00
Martin Robertz 2f00f8d5d8 update 2024-10-02 22:40:05 +02:00
Alexdoru 0a761be328 Merge pull request #36 from GTNewHorizons/log
Remove logging that logs time it takes to load each part of the mod
2024-10-02 16:21:37 +02:00
Alexdoru c8fee02cdc remove timing logging 2024-09-30 22:30:57 +02:00
Martin Robertz 9d1e6e9310 Merge pull request #34 from pashabou/master
setItemToCraft (crash fix)
2024-08-04 19:04:36 +07:00
Martin Robertz cbad80517a Merge branch 'master' into master 2024-08-04 19:00:32 +07:00
Martin Robertz 095924d6e5 Merge pull request #35 from Demiu/master
Adjust to AE2 api changes
2024-07-30 23:56:16 +07:00
Dream Master d109fcc774 update 2024-07-30 23:51:48 +07:00
pashabou 76aa7af49b Properly Setup GUI
Don't override away setting the item to craft
2024-07-26 23:40:11 -07:00
Martin Robertz a63db463a7 Merge branch 'master' into master 2024-07-27 09:16:05 +07:00
Demiu e605503e74 Adjust to AE2 api changes 2024-07-26 21:11:43 +02:00
Dream Master d26e3cf04b update 2024-07-25 17:11:34 +07:00
pashabou 12b3381ae5 setItemToCraft (crash fix)
Fixes GTNewHorizons/GT-New-Horizons-Modpack#16769 for change GTNewHorizons/Applied-Energistics-2-Unofficial#523
2024-07-23 01:15:14 -07:00
Martin Robertz 18712943ed update 2024-03-24 13:38:23 +01:00
Martin Robertz 79f601ce0b Merge pull request #33 from nikita23830/master
Update ItemMagnet.java
2024-03-24 13:35:00 +01:00
nikita23830 cace0fcb06 Update ItemMagnet.java
Ordnungsgemäße Trennung in Server und Client. Sonst geht die Logik verloren, wenn "!world.isRemote" ein Paket an den Server sendet...
Es bringt den Server zum Absturz.
2024-03-16 19:02:34 +01:00
Martin Robertz 038b072683 update 2024-02-28 08:34:37 +01:00
Martin Robertz 5508a91b9a Merge pull request #32 from slprime/fix-dynamic-font-size
Fix Dynamic Font Size
2024-02-28 08:34:04 +01:00
Martin Robertz ac219ae225 Update WirelessCraftingTerminal.java 2024-02-28 08:31:03 +01:00
slprime f35eaf95d8 Fix Dynamic Font Size 2024-02-28 08:09:11 +02:00
Raven Szewczyk 0cc9b63f84 [ci skip] upgraded build system 2024-02-04 20:03:04 +00:00
Martin Robertz 529c6a651c update deps + bs 2024-01-08 23:43:23 +01:00
Raven Szewczyk c61f7542a4 [ci skip] upgraded build system 2024-01-08 21:30:36 +00:00
Martin Robertz 8f2f060345 update bs+deps 2023-10-13 16:02:09 +02:00
Martin Robertz 35820c2dd0 update bs+deps 2023-09-27 22:24:05 +02:00
Martin Robertz 14ff6649c1 cleanup wildcard imports 2023-09-27 22:23:55 +02:00
Pilzinsel64 075d77b14e rename keybinds to be uniquie across mods
(cherry picked from commit c5a61e4316)
2023-09-27 22:19:58 +02:00
Martin Robertz f1fb01f8c7 Merge pull request #30 from GTNewHorizons/fix/keybind-lang
Fix lang key for keybind
2023-08-08 13:45:22 +02:00
miozune 07688d5d51 Fix lang key for keybind 2023-08-08 18:36:27 +09:00
miozune 88b764a8a3 Fix formatting in lang files 2023-08-08 18:35:31 +09:00
miozune a0191c1527 Update dependencies 2023-08-08 18:35:11 +09:00
miozune 7ee36e544f updateBuildScript 2023-08-08 18:34:53 +09:00
miozune dd02423102 Remove outdated script 2023-08-08 18:34:31 +09:00
Martin Robertz 089d2fc3c2 Merge pull request #29 from GTNewHorizons/fix/magnet_npe_and_updates
Fix/magnet npe and updates
2023-07-30 17:43:57 +02:00
Firenoo 7a907225d6 Update dependencies 2023-07-30 08:25:27 -07:00
Firenoo bcd6fbbdf5 Update buildscript 2023-07-30 08:23:44 -07:00
Firenoo 9188911cce WCTGuiHandler: clean up some old code w/ Java 17 syntax 2023-07-30 08:23:38 -07:00
Firenoo 44d039a517 Fix NPE when magnet card is used w/o WCT in inventory 2023-07-30 08:22:54 -07:00
Martin Robertz b9ed4fadf1 Merge pull request #27 from GTNewHorizons/firenoo/update
Compat update
2023-05-25 19:34:24 +02:00
Martin Robertz f204823bd9 Update dependencies.gradle 2023-05-25 19:11:20 +02:00
Martin Robertz ed58556f48 Merge pull request #28 from GTNewHorizons/firenoo/update-spotless-fixes
Spotless apply for branch firenoo/update for #27
2023-05-25 19:09:49 +02:00
GitHub GTNH Actions 8f10d413be spotlessApply 2023-05-25 16:44:32 +00:00
Firenoo 9dcc47476c Update dependencies + Fix API incompats
The API has changed since the last update, update.
2023-05-25 08:42:23 -07:00
Firenoo cf14b69af4 Update buildscript + gradle
Signed-off-by: Firenoo <[email protected]>
2023-05-25 08:30:43 -07:00
Martin Robertz e00d328e78 Merge pull request #26 from Pilzinsel64/Pilzinsel64-patch-1
Use more uniquie key names
2023-03-19 21:38:04 +01:00
Pilzinsel64 6d9ac27edc Update KeybindHandler.java
Resolves conflict with other mods (specially AE2FC)
2023-03-19 16:04:06 +01:00
boubou19 8cf8ff33f8 Merge pull request #25 from GTNewHorizons/unregister_recipes
Unregister recipes
2023-02-07 20:54:34 +01:00
boubou19 7acb03bdd5 spotless apply 2023-02-07 20:45:41 +01:00
boubou19 247f366417 don't register recipes if coremod is present 2023-02-07 20:44:54 +01:00
Raven Szewczyk 2c5c1a28c0 [ci skip] upgraded build system 2023-01-31 09:57:15 +00:00
Jason Mitchell af114f19ed [ci skip] Add git-blame-ignore-revs for spotlessApply 2023-01-29 12:16:14 -08:00
Jason Mitchell d8da552c36 [ci skip] spotlessApply with the new settings 2023-01-29 12:16:14 -08:00
Jason Mitchell 67757e72c9 [ci skip] Update buildscript to RetroFuturaGradle 2023-01-29 12:15:45 -08:00
Martin Robertz 0242be58a9 Merge pull request #24 from GTNewHorizons/hotfix-infinity-booster
Fix infinity booster not working anymore
2022-09-25 10:51:00 +02:00
Raven Szewczyk c0afb9eb8f Fix infinity booster not working anymore
The isBoosterInstalled() function was using the wrong slot index after the shift to fix it getting removed from the WCT easily
2022-09-25 09:45:52 +01:00
Martin Robertz 07fd1eef26 Merge pull request #23 from GTNewHorizons/hotfix-infinity-booster
Prevent the infinity booster from getting pulled out by accident
2022-09-19 13:26:38 +02:00
Raven Szewczyk 5c4d3d11c9 Prevent the infinity booster from getting pulled out by accident 2022-09-17 11:03:46 +01:00
Martin Robertz fc8f956316 Update BS+SA 2022-09-16 19:26:59 +02:00
Martin Robertz f920eed9dd Merge pull request #22 from asdflj/master
fix crafting terminal crash
2022-09-16 16:58:57 +02:00
zy f9e3f80f6b fix crafting terminal crash
fix in crafting terminal use hot key to transfer current crafting terminal item to craft slot crash
2022-09-16 22:34:00 +08:00
104 changed files with 1681 additions and 2445 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
# Ignore spotlessApply reformat
d8da552c3601fc920acd7afce95f391ffef74140
+36 -27
View File
@@ -1,35 +1,44 @@
* text eol=lf
*.jar binary
*.[jJ][aA][rR] binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
*.svg text
*.eps binary
*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary
*.kar binary
*.m4a binary
*.mid binary
*.midi binary
*.mp3 binary
*.ogg binary
*.ra binary
*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary
*.7z binary
*.gz binary
*.tar binary
*.tgz binary
*.zip binary
*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary
*.patch -text
*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary
*.[tT][tT][fF] binary
*.[oO][tT][fF] binary
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
*.[pP][aA][tT][cC][hH] -text
*autogenerated binary
*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
-51
View File
@@ -1,51 +0,0 @@
#!/usr/bin/env bash
# bashsupport disable=BP5006 # Global environment variables
RUNDIR="run" \
CRASH="crash-reports" \
SERVERLOG="server.log"
# enable nullglob to get 0 results when no match rather than the pattern
shopt -s nullglob
# store matches in array
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
# if array not empty there are crash_reports
if [ "${#crash_reports[@]}" -gt 0 ]; then
# get the latest crash_report from array
latest_crash_report="${crash_reports[-1]}"
{
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
cat "$latest_crash_report"
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
{
printf 'Fatal errors detected:\n'
cat server.log
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
"$SERVERLOG"; then
{
printf 'Server force stopped:'
cat server.log
} >&2
exit 1
fi
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
{
printf 'Server did not finish startup:'
cat server.log
} >&2
exit 1
fi
printf 'No crash reports detected'
exit 0
+2 -965
View File
@@ -1,968 +1,5 @@
//version: 1661114848
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
*/
//version: 1707058017
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory
import java.nio.file.Files
import java.nio.file.Paths
import java.util.concurrent.TimeUnit
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import java.util.zip.ZipOutputStream
buildscript {
repositories {
mavenCentral()
maven {
name 'forge'
url 'https://maven.minecraftforge.net'
}
maven {
// GTNH ForgeGradle Fork
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.9'
}
}
plugins {
id 'java-library'
id 'idea'
id 'eclipse'
id 'scala'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false
id 'org.ajoberstar.grgit' version '4.1.1'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id 'com.palantir.git-version' version '0.13.0' apply false
id 'de.undercouch.download' version '5.0.1'
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
id 'com.diffplug.spotless' version '6.7.2' apply false
}
boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated)
throw new GradleException("Settings has been updated, please re-run task.")
dependencies {
implementation 'com.diffplug:blowdryer:1.6.0'
}
apply plugin: 'com.diffplug.blowdryer'
if (project.file('.git/HEAD').isFile()) {
apply plugin: 'com.palantir.git-version'
}
def out = services.get(StyledTextOutputFactory).create('an-output')
apply plugin: 'forge'
def projectJavaVersion = JavaLanguageVersion.of(8)
java {
toolchain {
languageVersion.set(projectJavaVersion)
}
}
idea {
module {
inheritOutputDirs = true
downloadJavadoc = true
downloadSources = true
}
}
boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false
if (!disableSpotless) {
apply plugin: 'com.diffplug.spotless'
apply from: Blowdryer.file('spotless.gradle')
}
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}
checkPropertyExists("modName")
checkPropertyExists("modId")
checkPropertyExists("modGroup")
checkPropertyExists("autoUpdateBuildScript")
checkPropertyExists("minecraftVersion")
checkPropertyExists("forgeVersion")
checkPropertyExists("replaceGradleTokenInFile")
checkPropertyExists("gradleTokenModId")
checkPropertyExists("gradleTokenModName")
checkPropertyExists("gradleTokenVersion")
checkPropertyExists("gradleTokenGroupName")
checkPropertyExists("apiPackage")
checkPropertyExists("accessTransformersFile")
checkPropertyExists("usesMixins")
checkPropertyExists("mixinPlugin")
checkPropertyExists("mixinsPackage")
checkPropertyExists("coreModClass")
checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
boolean usesMixinDebug = project.hasProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
boolean forceEnableMixins = project.hasProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false
String channel = project.hasProperty('channel') ? project.channel : 'stable'
String mappingsVersion = project.hasProperty('mappingsVersion') ? project.mappingsVersion : '12'
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/"
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
if (apiPackage) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
}
if (accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
if (!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
}
}
if (usesMixins.toBoolean()) {
if (mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) {
throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!")
}
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
}
}
if (coreModClass) {
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
}
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
// Make sure GregTech build won't time out
System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String)
System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String)
}
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
try {
'git config core.fileMode false'.execute()
}
catch (Exception ignored) {
out.style(Style.Failure).println("git isn't installed at all")
}
// Pulls version first from the VERSION env and then git tag
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
try {
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
}
catch (Exception ignored) {
out.style(Style.Failure).text(
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
)
versionOverride = 'NO-GIT-TAG-SET'
identifiedVersion = versionOverride
}
version = minecraftVersion + '-' + identifiedVersion
ext {
modVersion = identifiedVersion
}
if (identifiedVersion == versionOverride) {
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
}
group = modGroup
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName
} else {
archivesBaseName = modId
}
def arguments = []
def jvmArguments = []
if (usesMixins.toBoolean() || forceEnableMixins) {
arguments += [
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
if (usesMixinDebug.toBoolean()) {
jvmArguments += [
"-Dmixin.debug.countInjections=true",
"-Dmixin.debug.verbose=true",
"-Dmixin.debug.export=true"
]
}
}
minecraft {
version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion
runDir = 'run'
if (replaceGradleTokenInFile) {
replaceIn replaceGradleTokenInFile
if (gradleTokenModId) {
replace gradleTokenModId, modId
}
if (gradleTokenModName) {
replace gradleTokenModName, modName
}
if (gradleTokenVersion) {
replace gradleTokenVersion, modVersion
}
if (gradleTokenGroupName) {
replace gradleTokenGroupName, modGroup
}
}
clientIntellijRun {
args(arguments)
jvmArgs(jvmArguments)
if (developmentEnvironmentUserName) {
args("--username", developmentEnvironmentUserName)
}
}
serverIntellijRun {
args(arguments)
jvmArgs(jvmArguments)
}
}
if (file('addon.gradle').exists()) {
apply from: 'addon.gradle'
}
apply from: 'repositories.gradle'
configurations {
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
implementation.extendsFrom(shadowCompile)
implementation.extendsFrom(shadeCompile)
}
repositories {
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
if (usesMixins.toBoolean() || forceEnableMixins) {
maven {
name 'sponge'
url 'https://repo.spongepowered.org/repository/maven-public'
}
maven {
url 'https://jitpack.io'
}
}
}
dependencies {
if (usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT')
}
if (usesMixins.toBoolean() || forceEnableMixins) {
// using 0.8 to workaround a issue in 0.7 which fails mixin application
compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
compile('com.github.GTNewHorizons:SpongeMixins:1.5.0')
}
}
apply from: 'dependencies.gradle'
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
task generateAssets {
if (usesMixins.toBoolean()) {
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
if (!mixinConfigFile.exists()) {
mixinConfigFile.text = """{
"required": true,
"minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}",
"plugin": "${modGroup}.${mixinPlugin}",
"refmap": "${mixingConfigRefMap}",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8",
"mixins": [],
"client": [],
"server": []
}
"""
}
}
}
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
}
shadowJar {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [
project.configurations.shadowImplementation,
project.configurations.shadowCompile
]
dependsOn(relocateShadowJar)
}
jar {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes(getManifestAttributes())
}
if (usesShadowedDependencies.toBoolean()) {
dependsOn(shadowJar)
enabled = false
}
}
reobf {
if (usesMixins.toBoolean()) {
addExtraSrgFile mixinSrg
}
}
afterEvaluate {
if (usesMixins.toBoolean()) {
tasks.compileJava {
options.compilerArgs += [
"-AreobfSrgFile=${tasks.reobf.srg}",
"-AoutSrgFile=${mixinSrg}",
"-AoutRefMapFile=${refMap}",
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl",
"-XDignore.symbol.file"
]
}
}
}
runClient {
if (developmentEnvironmentUserName) {
arguments += [
"--username",
developmentEnvironmentUserName
]
}
args(arguments)
jvmArgs(jvmArguments)
}
runServer {
args(arguments)
jvmArgs(jvmArguments)
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion = projectJavaVersion
}
)
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
exclude("spotless.gradle")
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace modVersion and minecraftVersion
expand "minecraftVersion": project.minecraft.version,
"modVersion": modVersion,
"modId": modId,
"modName": modName
}
if (usesMixins.toBoolean()) {
from refMap
}
// copy everything else that's not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude 'spotless.gradle'
}
}
def getManifestAttributes() {
def manifestAttributes = [:]
if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
if (accessTransformersFile) {
manifestAttributes += ["FMLAT": accessTransformersFile.toString()]
}
if (coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
if (usesMixins.toBoolean()) {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json",
"ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean()
]
}
return manifestAttributes
}
task sourcesJar(type: Jar) {
from(sourceSets.main.allSource)
from(file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
task shadowDevJar(type: ShadowJar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [
project.configurations.shadowImplementation,
project.configurations.shadowCompile
]
}
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
target = tasks.shadowDevJar
prefix = modGroup + ".shadow"
}
task circularResolverJar(type: Jar) {
dependsOn(relocateShadowDevJar)
dependsOn(shadowDevJar)
enabled = false
}
task devJar(type: Jar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
if (usesShadowedDependencies.toBoolean()) {
dependsOn(circularResolverJar)
enabled = false
}
}
task apiJar(type: Jar) {
from(sourceSets.main.allSource) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from(sourceSets.main.output) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from(sourceSets.main.resources.srcDirs) {
include("LICENSE")
}
getArchiveClassifier().set('api')
}
artifacts {
if (!noPublishedSources) {
archives sourcesJar
}
archives devJar
if (apiPackage) {
archives apiJar
}
}
// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID),
// and isn't strictly needed with the POM so just disable it.
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
// workaround variable hiding in pom processing
def projectConfigs = project.configurations
publishing {
publications {
maven(MavenPublication) {
from components.java
if (usesShadowedDependencies.toBoolean()) {
artifact source: shadowJar, classifier: ""
}
if (!noPublishedSources) {
artifact source: sourcesJar, classifier: "sources"
}
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
if (apiPackage) {
artifact source: apiJar, classifier: "api"
}
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
// remove extra garbage from minecraft and minecraftDeps configuration
pom.withXml {
def badArtifacts = [:].withDefault { [] as Set<String> }
for (configuration in [
projectConfigs.minecraft,
projectConfigs.minecraftDeps
]) {
for (dependency in configuration.allDependencies) {
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
}
}
// example for specifying extra stuff to ignore
// badArtifacts["org.example.group"] += "artifactName"
Node pomNode = asNode()
pomNode.dependencies.'*'.findAll() {
badArtifacts[it.groupId.text()].contains(it.artifactId.text())
}.each() {
it.parent().remove(it)
}
}
}
}
repositories {
maven {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
}
}
}
// Updating
task updateBuildScript {
doLast {
if (performBuildScriptUpdate(projectDir.toString())) return
print("Build script already up-to-date!")
}
}
if (!project.getGradle().startParameter.isOffline() && isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (autoUpdateBuildScript.toBoolean()) {
performBuildScriptUpdate(projectDir.toString())
} else {
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
}
}
static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle")
}
static URL exampleSettingsGradleUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/settings.gradle.example")
}
static URL exampleGitAttributesUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/.gitattributes")
}
boolean verifyGitAttributes() {
def gitattributesFile = getFile(".gitattributes")
if (!gitattributesFile.exists()) {
println("Downloading default .gitattributes")
exampleGitAttributesUrl().withInputStream { i -> gitattributesFile.withOutputStream { it << i } }
exec {
workingDir '.'
commandLine 'git', 'add', '--renormalize', '.'
}
return true
}
return false
}
boolean verifySettingsGradle() {
def settingsFile = getFile("settings.gradle")
if (!settingsFile.exists()) {
println("Downloading default settings.gradle")
exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
return true
}
return false
}
boolean performBuildScriptUpdate(String projectDir) {
if (isNewBuildScriptVersionAvailable(projectDir)) {
def buildscriptFile = getFile("build.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated)
throw new GradleException("Settings has been updated, please re-run task.")
return true
}
return false
}
boolean isNewBuildScriptVersionAvailable(String projectDir) {
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
String availableBuildScriptHash = getVersionHash(availableBuildScript)
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate
}
static String getVersionHash(String buildScriptContent) {
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
if (versionLine != null) {
return versionLine.split(": ").last()
}
return ""
}
configure(updateBuildScript) {
group = 'forgegradle'
description = 'Updates the build script to the latest version'
}
// Parameter Deobfuscation
task deobfParams {
doLast {
String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion"
String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
String paramsCSV = "$mcpDir/params.csv"
download.run {
src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip"
dest mcpZIP
overwrite false
}
if (!file(paramsCSV).exists()) {
println("Extracting MCP archive ...")
unzip(mcpZIP, mcpDir)
}
println("Parsing params.csv ...")
Map<String, String> params = new HashMap<>()
Files.lines(Paths.get(paramsCSV)).forEach { line ->
String[] cells = line.split(",")
if (cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) {
params.put(cells[0], cells[1])
}
}
out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!")
out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.")
}
}
static int replaceParams(File file, Map<String, String> params) {
int fileCount = 0
if (file.isDirectory()) {
for (File f : file.listFiles()) {
fileCount += replaceParams(f, params)
}
return fileCount
}
println("Visiting ${file.getName()} ...")
try {
String content = new String(Files.readAllBytes(file.toPath()))
int hash = content.hashCode()
params.forEach { key, value ->
content = content.replaceAll(key, value)
}
if (hash != content.hashCode()) {
Files.write(file.toPath(), content.getBytes("UTF-8"))
return 1
}
} catch (Exception e) {
e.printStackTrace()
}
return 0
}
// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681)
static unzip(String zipFileName, String outputDir) {
byte[] buffer = new byte[16384]
ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName))
ZipEntry zipEntry = zis.getNextEntry()
while (zipEntry != null) {
File newFile = new File(outputDir + File.separator, zipEntry.name)
if (zipEntry.isDirectory()) {
if (!newFile.isDirectory() && !newFile.mkdirs()) {
throw new IOException("Failed to create directory $newFile")
}
} else {
// fix for Windows-created archives
File parent = newFile.parentFile
if (!parent.isDirectory() && !parent.mkdirs()) {
throw new IOException("Failed to create directory $parent")
}
// write file content
FileOutputStream fos = new FileOutputStream(newFile)
int len = 0
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len)
}
fos.close()
}
zipEntry = zis.getNextEntry()
}
zis.closeEntry()
zis.close()
}
configure(deobfParams) {
group = 'forgegradle'
description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
}
// Dependency Deobfuscation
def deobf(String sourceURL) {
try {
URL url = new URL(sourceURL)
String fileName = url.getFile()
//get rid of directories:
int lastSlash = fileName.lastIndexOf("/")
if (lastSlash > 0) {
fileName = fileName.substring(lastSlash + 1)
}
//get rid of extension:
if (fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
fileName = fileName.substring(0, fileName.lastIndexOf("."))
}
String hostName = url.getHost()
if (hostName.startsWith("www.")) {
hostName = hostName.substring(4)
}
List parts = Arrays.asList(hostName.split("\\."))
Collections.reverse(parts)
hostName = String.join(".", parts)
return deobf(sourceURL, "$hostName/$fileName")
} catch (Exception e) {
return deobf(sourceURL, "deobf/${sourceURL.hashCode()}")
}
}
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
def deobf(String sourceURL, String rawFileName) {
String bon2Version = "2.5.1"
String fileName = URLDecoder.decode(rawFileName, "UTF-8")
String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
String bon2Dir = "$cacheDir/forge_gradle/deobf"
String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
if (file(deobfFile).exists()) {
return files(deobfFile)
}
String mappingsVer
String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
if (remoteMappings) {
String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
zipMappings(mappingsZIP, remoteMappings, bon2Dir)
mappingsVer = "snapshot_$id"
} else {
mappingsVer = "${channel}_$mappingsVersion"
}
download.run {
src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
dest bon2File
quiet true
overwrite false
}
download.run {
src sourceURL
dest obfFile
quiet true
overwrite false
}
exec {
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
workingDir bon2Dir
standardOutput = new FileOutputStream("${deobfFile}.log")
}
return files(deobfFile)
}
def zipMappings(String zipPath, String url, String bon2Dir) {
File zipFile = new File(zipPath)
if (zipFile.exists()) {
return
}
String fieldsCache = "$bon2Dir/data/fields.csv"
String methodsCache = "$bon2Dir/data/methods.csv"
download.run {
src "${url}fields.csv"
dest fieldsCache
quiet true
}
download.run {
src "${url}methods.csv"
dest methodsCache
quiet true
}
zipFile.getParentFile().mkdirs()
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
zos.putNextEntry(new ZipEntry("fields.csv"))
Files.copy(Paths.get(fieldsCache), zos)
zos.closeEntry()
zos.putNextEntry(new ZipEntry("methods.csv"))
Files.copy(Paths.get(methodsCache), zos)
zos.closeEntry()
zos.close()
}
// Helper methods
def checkPropertyExists(String propertyName) {
if (!project.hasProperty(propertyName)) {
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
}
}
def getFile(String relativePath) {
return new File(projectDir, relativePath)
id 'com.gtnewhorizons.gtnhconvention'
}
+7 -7
View File
@@ -1,11 +1,11 @@
// Add your dependencies here
dependencies {
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-99-GTNH:dev")
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
compile("curse.maven:cofh-core-69162:2388751")
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.27-GTNH:dev")
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.4:dev")
compileOnly("com.github.GTNewHorizons:MouseTweaks:2.4.5-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.43:dev") { transitive = false }
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-637-GTNH-pre:dev")
implementation("com.github.GTNewHorizons:Baubles-Expanded:2.1.9-GTNH:dev")
compileOnly("curse.maven:cofh-core-69162:2388751")
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.7.57-GTNH:dev")
compileOnly("com.github.GTNewHorizons:MouseTweaks:2.4.20-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:EnderIO:2.9.18:dev") { transitive = false }
}
+163 -24
View File
@@ -1,64 +1,203 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# Human-readable mod name, available for mcmod.info population.
modName = AE2 Wireless Crafting Terminal
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
modId = ae2wct
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = net.p455w0rd.wirelesscraftingterminal
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Will update your build.gradle automatically whenever an update is available
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
channel = stable
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = Reference.java
gradleTokenModId =
gradleTokenModName =
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile = Reference.java
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter.
customArchiveBaseName = WirelessCraftingTerminal
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
# versionPattern =
# Uncomment to prevent the source code from being published.
# noPublishedSources = true
# Uncomment this to disable Spotless checks.
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
# disableCheckstyle = true
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
Binary file not shown.
+3 -1
View File
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+180 -117
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,80 +15,115 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -97,92 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+27 -33
View File
@@ -13,8 +13,10 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,10 +27,14 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
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="-Xmx64m" "-Xms64m"
@@ -37,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -51,48 +57,36 @@ 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%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
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
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
-10
View File
@@ -1,14 +1,4 @@
// Add any additional repositories for your dependencies here
repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
}
+19 -6
View File
@@ -1,10 +1,23 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
}
apply plugin: 'com.diffplug.blowdryerSetup'
blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
//devLocal '.' // Use this when testing config updates locally
}
@@ -1,6 +1,7 @@
package net.p455w0rd.wirelesscraftingterminal.api;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
public interface IWCTInteractionHelper {
@@ -1,10 +1,12 @@
package net.p455w0rd.wirelesscraftingterminal.api;
import javax.annotation.Nonnull;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public interface IWCTItemDescription {
/**
* Gets the damage, or meta, value of the item.
*
@@ -3,6 +3,7 @@ package net.p455w0rd.wirelesscraftingterminal.api;
import javax.annotation.Nonnull;
public abstract class IWCTItems {
/**
* WirelessCraftingTerminal
*/
@@ -16,16 +17,13 @@ public abstract class IWCTItems {
public IWCTItemDescription InfinityBoosterCard;
/**
* Used for the creat6ive tab
* TODO: remove unneeded item and just
* add the icon properly
* Used for the creat6ive tab TODO: remove unneeded item and just add the icon properly
*/
@Nonnull
public IWCTItemDescription WCTDummyIcon;
/**
* Item used solely for infinity booster
* card slot background icon
* Item used solely for infinity booster card slot background icon
*/
@Nonnull
public IWCTItemDescription WCTBoosterBGIcon;
@@ -1,20 +1,21 @@
package net.p455w0rd.wirelesscraftingterminal.api;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.util.IConfigManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* Provides the required functionality of a wireless terminal.
* Presumably this interface would be implemented on an Item, but that is
* not a requirement.
* Provides the required functionality of a wireless terminal. Presumably this interface would be implemented on an
* Item, but that is not a requirement.
*
* @author Nividica
*
*/
public interface IWirelessCraftingTermHandler extends IWirelessTermHandler, IAEItemPowerStorage {
// public interface IWirelessCraftingTermHandler extends INetworkEncodable, IAEItemPowerStorage {
/**
* Gets the tag used to store the terminal data.
@@ -1,9 +1,10 @@
package net.p455w0rd.wirelesscraftingterminal.api;
import net.minecraft.item.ItemStack;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.core.features.IAEFeature;
import cofh.api.energy.IEnergyContainerItem;
import net.minecraft.item.ItemStack;
public interface IWirelessCraftingTerminalItem
extends IWirelessCraftingTermHandler, IAEItemPowerStorage, IAEFeature, IEnergyContainerItem {
@@ -1,6 +1,7 @@
package net.p455w0rd.wirelesscraftingterminal.api;
import java.lang.reflect.Method;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -8,15 +9,15 @@ public abstract class WCTApi {
protected static WCTApi api = null;
@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings({ "rawtypes", "unchecked" })
@Nullable
public static WCTApi instance() {
// Have we already retrieved the api?
if (WCTApi.api == null) {
try {
// Attempt to locate the API implementation
Class clazz =
Class.forName("net.p455w0rd.wirelesscraftingterminal.implementation.WCTAPIImplementation");
Class clazz = Class
.forName("net.p455w0rd.wirelesscraftingterminal.implementation.WCTAPIImplementation");
// Get the instance method
Method instanceAccessor = clazz.getMethod("instance");
@@ -1,9 +1,10 @@
package net.p455w0rd.wirelesscraftingterminal.api.grid;
import appeng.api.storage.ITerminalHost;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
/**
* Defines the requirements for a terminal that wishes to issue AE2 crafting jobs.
*
@@ -11,6 +12,7 @@ import net.minecraft.item.ItemStack;
*
*/
public interface ICraftingIssuerHost extends ITerminalHost {
/**
* Gets the icon for this terminal.
*
@@ -19,8 +21,7 @@ public interface ICraftingIssuerHost extends ITerminalHost {
ItemStack getIcon();
/**
* Launches the terminal's GUI.
* Used to return to the gui after crafting is confirmed or canceled.
* Launches the terminal's GUI. Used to return to the gui after crafting is confirmed or canceled.
*/
void launchGUI(EntityPlayer player);
}
@@ -1,6 +1,7 @@
package net.p455w0rd.wirelesscraftingterminal.api.gui;
import javax.annotation.Nonnull;
import net.p455w0rd.wirelesscraftingterminal.api.grid.ICraftingIssuerHost;
public interface ICraftingIssuerContainer {
@@ -6,12 +6,10 @@ import appeng.api.networking.IGridNode;
public interface WCTIActionHost extends IGridHost {
/**
* Used to for calculating security rules, you must supply a node from your
* IGridHost for the security test, this should be the primary node for the
* machine, unless the action is preformed by a non primary node.
* Used to for calculating security rules, you must supply a node from your IGridHost for the security test, this
* should be the primary node for the machine, unless the action is preformed by a non primary node.
*
* @return the the gridnode that actions from this IGridHost are preformed
* by.
* @return the the gridnode that actions from this IGridHost are preformed by.
*/
IGridNode getActionableNode();
@@ -1,8 +1,9 @@
package net.p455w0rd.wirelesscraftingterminal.api.networking.security;
import net.minecraft.entity.player.EntityPlayer;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.PlayerSource;
import net.minecraft.entity.player.EntityPlayer;
public class WCTPlayerSource extends PlayerSource {
@@ -7,9 +7,8 @@ import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
public interface IIngredient {
/**
* Acquire a single input stack for the current recipe, if more then one
* ItemStack is possible a RegistrationError exception will be thrown,
* ignore these and let the system handle the error.
* Acquire a single input stack for the current recipe, if more then one ItemStack is possible a RegistrationError
* exception will be thrown, ignore these and let the system handle the error.
*
* @return a single ItemStack for the recipe handler.
*
@@ -19,8 +18,8 @@ public interface IIngredient {
ItemStack getItemStack() throws RegistrationError, MissingIngredientError;
/**
* Acquire a list of all the input stacks for the current recipe, this is
* for handlers that support multiple inputs per slot.
* Acquire a list of all the input stacks for the current recipe, this is for handlers that support multiple inputs
* per slot.
*
* @return an array of ItemStacks for the recipe handler.
*
@@ -30,16 +29,14 @@ public interface IIngredient {
ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError;
/**
* If you wish to support air, you must test before getting the ItemStack,
* or ItemStackSet
* If you wish to support air, you must test before getting the ItemStack, or ItemStackSet
*
* @return true if this slot contains no ItemStack, this is passed as "_"
*/
boolean isAir();
/**
* @return The Name Space of the item. Prefer getItemStack or
* getItemStackSet
* @return The Name Space of the item. Prefer getItemStack or getItemStackSet
*/
String getNameSpace();
@@ -49,14 +46,12 @@ public interface IIngredient {
String getItemName();
/**
* @return The Damage Value of the item. Prefer getItemStack or
* getItemStackSet
* @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
*/
int getDamageValue();
/**
* @return The Damage Value of the item. Prefer getItemStack or
* getItemStackSet
* @return The Damage Value of the item. Prefer getItemStack or getItemStackSet
*/
int getQty();
@@ -3,5 +3,6 @@ package net.p455w0rd.wirelesscraftingterminal.api.recipes.game;
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
public interface IRecipeBakeable {
void bake() throws RegistrationError;
}
@@ -3,6 +3,7 @@ package net.p455w0rd.wirelesscraftingterminal.api.recipes.game;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
@@ -13,6 +14,7 @@ import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
import net.p455w0rd.wirelesscraftingterminal.api.recipes.IIngredient;
public class ShapedRecipe implements IRecipe, IRecipeBakeable {
// Added in for future ease of change, but hard coded for now.
private static final int MAX_CRAFT_GRID_WIDTH = 3;
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
@@ -195,9 +197,8 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable {
if (input == null && target != null || input != null && target == null) {
return false;
}
return (target.getItem() == input.getItem()
&& (target.getItemDamage() == OreDictionary.WILDCARD_VALUE
|| target.getItemDamage() == input.getItemDamage()));
return (target.getItem() == input.getItem() && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE
|| target.getItemDamage() == input.getItemDamage()));
}
public ShapedRecipe setMirrored(final boolean mirror) {
@@ -1,12 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.helpers.Reflected;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -17,7 +10,16 @@ import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.helpers.Reflected;
public class GuiCraftAmount extends appeng.client.gui.implementations.GuiCraftAmount {
private GuiTabButton originalGuiBtn;
private ItemStack myIcon;
@@ -32,7 +34,7 @@ public class GuiCraftAmount extends appeng.client.gui.implementations.GuiCraftAm
myIcon = is;
}
@SuppressWarnings({"unchecked", "unused"})
@SuppressWarnings({ "unchecked", "unused" })
@Override
public void initGui() {
super.initGui();
@@ -52,7 +54,11 @@ public class GuiCraftAmount extends appeng.client.gui.implementations.GuiCraftAm
if (this.originalGui > 0 && myIcon != null) {
this.buttonList.add(
this.originalGuiBtn = new GuiTabButton(
this.guiLeft + 154, this.guiTop - 4, myIcon, myIcon.getDisplayName(), itemRender));
this.guiLeft + 154,
this.guiTop - 4,
myIcon,
myIcon.getDisplayName(),
itemRender));
}
}
@@ -1,12 +1,14 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui;
import appeng.api.storage.ITerminalHost;
import net.minecraft.entity.player.InventoryPlayer;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.storage.ITerminalHost;
public class GuiCraftConfirm extends appeng.client.gui.implementations.GuiCraftConfirm {
public GuiCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(inventoryPlayer, te);
}
@@ -1,11 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerCraftingStatus;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -16,7 +10,15 @@ import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerCraftingStatus;
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus {
private GuiTabButton originalGuiBtn;
private int originalGui;
private ItemStack myIcon = null;
@@ -31,8 +33,7 @@ public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraf
final IParts parts = definitions.parts();
if (target instanceof WirelessTerminalGuiObject) {
for (final ItemStack wirelessTerminalStack :
definitions.items().wirelessTerminal().maybeStack(1).asSet()) {
for (final ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack(1).asSet()) {
this.myIcon = wirelessTerminalStack;
}
@@ -1,10 +1,12 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui;
import cpw.mods.fml.client.IModGuiFactory;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import cpw.mods.fml.client.IModGuiFactory;
public class GuiFactory implements IModGuiFactory {
@Override
@@ -12,6 +12,7 @@ import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerMagnet;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import org.lwjgl.opengl.GL11;
public class GuiMagnet extends GuiContainer {
@@ -58,13 +59,28 @@ public class GuiMagnet extends GuiContainer {
this.modeBtn = new WCTGuiButton(0, this.guiLeft + 104, this.guiTop + 4, 64, 14, getLabel(this.mode)));
this.buttonList.add(
this.ignoreNBTBox = new WCTGuiCheckBox(
1, this.guiLeft + 61, this.guiTop + 20, "Ignore NBT Data", this.ignoreNBT, 107));
1,
this.guiLeft + 61,
this.guiTop + 20,
"Ignore NBT Data",
this.ignoreNBT,
107));
this.buttonList.add(
this.ignoreMetaBox = new WCTGuiCheckBox(
2, this.guiLeft + 61, this.guiTop + 32, "Ignore Meta Data", this.ignoreMeta, 107));
2,
this.guiLeft + 61,
this.guiTop + 32,
"Ignore Meta Data",
this.ignoreMeta,
107));
this.buttonList.add(
this.useOreDictBox = new WCTGuiCheckBox(
3, this.guiLeft + 61, this.guiTop + 44, "Use Ore Dictionary", this.useOreDict, 107));
3,
this.guiLeft + 61,
this.guiTop + 44,
"Use Ore Dictionary",
this.useOreDict,
107));
}
String getLabel(boolean filterMode) {
@@ -1,11 +1,43 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui;
import java.io.IOException;
import java.lang.reflect.Field;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTrashButton;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotTrash;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import appeng.api.config.ActionItems;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.TerminalFontSize;
import appeng.api.config.TerminalStyle;
import appeng.api.config.YesNo;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IDisplayRepo;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.ActionKey;
@@ -33,33 +65,6 @@ import codechicken.nei.TextField;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.ReflectionHelper;
import java.io.IOException;
import java.lang.reflect.Field;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTrashButton;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotTrash;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import yalter.mousetweaks.api.IMTModGuiContainer;
@Optional.Interface(modid = "MouseTweaks", iface = "yalter.mousetweaks.api.IMTModGuiContainer")
@@ -68,24 +73,10 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
private float xSize_lo;
private float ySize_lo;
public static int tick = 0,
GUI_HEIGHT = 240,
GUI_WIDTH = 230,
AE_ROW_HEIGHT = 18,
AE_NUM_ROWS = 0,
GUI_UPPER_HEIGHT = 35,
GUI_SEARCH_ROW = 35,
SEARCH_X = 80,
SEARCH_Y = 4,
SEARCH_WIDTH = 88,
SEARCH_HEIGHT = 12,
SEARCH_MAXCHARS = 15,
GUI_LOWER_HEIGHT,
AE_TOTAL_ROWS_HEIGHT,
BUTTON_SEARCH_MODE_POS_X = -18,
BUTTON_SEARCH_MODE_POS_Y = 68,
BUTTON_SIZE = 16,
NEI_EXTRA_SPACE = 30,
public static int tick = 0, GUI_HEIGHT = 240, GUI_WIDTH = 230, AE_ROW_HEIGHT = 18, AE_NUM_ROWS = 0,
GUI_UPPER_HEIGHT = 35, GUI_SEARCH_ROW = 35, SEARCH_X = 80, SEARCH_Y = 4, SEARCH_WIDTH = 88,
SEARCH_HEIGHT = 12, SEARCH_MAXCHARS = 15, GUI_LOWER_HEIGHT, AE_TOTAL_ROWS_HEIGHT,
BUTTON_SEARCH_MODE_POS_X = -18, BUTTON_SEARCH_MODE_POS_Y = 68, BUTTON_SIZE = 16, NEI_EXTRA_SPACE = 30,
slotYOffset;
protected static final int BUTTON_SEARCH_MODE_ID = 5;
protected static final long TOOLTIP_UPDATE_INTERVAL = 3000L;
@@ -98,7 +89,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
public static int craftingGridOffsetX = 80;
public static int craftingGridOffsetY;
private static String memoryText = "";
private final ItemRepo repo;
private final IDisplayRepo repo;
private final int offsetX = 8;
private final IConfigManager configSrc;
private GuiTabButton craftingStatusBtn;
@@ -152,9 +143,10 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
private void setScrollBar() {
this.getScrollBar().setTop(18).setLeft(174).setHeight(this.rows * 18 - 2);
this.getScrollBar()
.setRange(
0, (this.repo.size() + this.perRow - 1) / this.perRow - this.rows, Math.max(1, this.rows / 6));
this.getScrollBar().setRange(
0,
(this.repo.size() + this.perRow - 1) / this.perRow - this.rows,
Math.max(1, this.rows / 6));
}
@SuppressWarnings("rawtypes")
@@ -170,8 +162,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
final GuiImgButton iBtn = (GuiImgButton) btn;
if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum cv = iBtn.getCurrentValue();
final Enum next =
Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
final Enum next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
if (btn == this.terminalStyleBox) {
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
@@ -182,8 +173,8 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
} else {
try {
NetworkHandler.instance.sendToServer(
new PacketValueConfig(iBtn.getSetting().name(), next.name()));
NetworkHandler.instance
.sendToServer(new PacketValueConfig(iBtn.getSetting().name(), next.name()));
} catch (final IOException e) {
WCTLog.debug(e.getMessage());
}
@@ -205,8 +196,10 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
}
if (s != null) {
final PacketInventoryAction p =
new PacketInventoryAction(InventoryAction.MOVE_REGION, s.slotNumber, 0);
final PacketInventoryAction p = new PacketInventoryAction(
InventoryAction.MOVE_REGION,
s.slotNumber,
0);
NetworkHandler.instance.sendToServer(p);
}
}
@@ -245,8 +238,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
stack = ((SlotME) slot).getAEStack();
if (stack != null
&& action == InventoryAction.PICKUP_OR_SET_DOWN
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN
&& stack.getStackSize() == 0
&& player.inventory.getItemStack() == null) {
action = InventoryAction.AUTO_CRAFT;
@@ -263,8 +255,10 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
}
if (action == InventoryAction.AUTO_CRAFT) {
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
final PacketInventoryAction p =
new PacketInventoryAction(action, this.inventorySlots.inventorySlots.size(), 0);
final PacketInventoryAction p = new PacketInventoryAction(
action,
this.inventorySlots.inventorySlots.size(),
0);
NetworkHandler.instance.sendToServer(p);
return;
}
@@ -296,15 +290,14 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
/**
* Initializes the GUI
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void initGui() {
super.initGui();
Keyboard.enableRepeatEvents(true);
this.maxRows = this.getMaxRows();
this.perRow = AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL
? 9
this.perRow = AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL ? 9
: 9 + ((this.width - this.standardSize) / 18);
this.isNEIEnabled = Loader.isModLoaded("NotEnoughItems");
int top = isNEIEnabled ? 22 : 0;
@@ -346,19 +339,28 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
this.buttonList.clear();
this.buttonList.add(
this.clearBtn = new GuiImgButton(
this.guiLeft + 134, this.guiTop + this.ySize - 160, Settings.ACTIONS, ActionItems.STASH));
this.guiLeft + 134,
this.guiTop + this.ySize - 160,
Settings.ACTIONS,
ActionItems.STASH));
this.buttonList.add(this.trashBtn = new GuiTrashButton(this.guiLeft + 98, this.guiTop + this.ySize - 104));
this.clearBtn.setHalfSize(true);
if (this.customSortOrder) {
this.buttonList.add(
this.SortByBox = new GuiImgButton(
this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting(Settings.SORT_BY)));
this.guiLeft - 18,
offset,
Settings.SORT_BY,
this.configSrc.getSetting(Settings.SORT_BY)));
offset += 20;
}
this.buttonList.add(
this.ViewBox = new GuiImgButton(
this.guiLeft - 18, offset, Settings.VIEW_MODE, this.configSrc.getSetting(Settings.VIEW_MODE)));
this.guiLeft - 18,
offset,
Settings.VIEW_MODE,
this.configSrc.getSetting(Settings.VIEW_MODE)));
offset += 20;
this.buttonList.add(
@@ -440,8 +442,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
}
int getMaxRows() {
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL
? 6
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6
: Integer.MAX_VALUE;
}
@@ -450,18 +451,17 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
}
/**
* Called every tick. It is used in this instance to detect screen size
* changes to automatically update the gui height.
* Called every tick. It is used in this instance to detect screen size changes to automatically update the gui
* height.
* <p>
* reInit variable is used to call initGui() on the next tick. It has to be
* called this way to update correctly.
* reInit variable is used to call initGui() on the next tick. It has to be called this way to update correctly.
*
* @author p455w0rd
*/
@Override
public void updateScreen() {
this.devicePowered = containerWCT.isPowered();
this.repo.setPower(devicePowered);
this.repo.setPowered(devicePowered);
super.updateScreen();
if (this.init) {
@@ -508,8 +508,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
* @author p455w0rd
*/
private boolean hasScreenResChanged() {
if ((this.currScreenWidth != this.mc.displayWidth)
|| (this.currScreenHeight != this.mc.displayHeight)
if ((this.currScreenWidth != this.mc.displayWidth) || (this.currScreenHeight != this.mc.displayHeight)
|| (this.isFullScreen != this.mc.isFullScreen())) {
this.currScreenWidth = this.mc.displayWidth;
this.currScreenHeight = this.mc.displayHeight;
@@ -640,8 +639,8 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
return;
}
final boolean mouseInGui =
this.isPointInRegion(0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY);
final boolean mouseInGui = this
.isPointInRegion(0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY);
if (this.isAutoFocus && !this.searchField.isFocused() && mouseInGui) {
this.searchField.setFocused(true);
}
@@ -656,6 +655,18 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
}
}
@Override
public void handleKeyboardInput() {
super.handleKeyboardInput();
// Pause the terminal when holding shift
this.repo.setPaused(hasShiftDown());
}
private boolean hasShiftDown() {
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
}
protected boolean isPowered() {
return this.repo.hasPower();
}
@@ -665,26 +676,25 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
this.mc.getTextureManager().bindTexture(loc);
}
public List<String> handleItemTooltip(
final ItemStack stack, final int mouseX, final int mouseY, final List<String> currentToolTip) {
public List<String> handleItemTooltip(final ItemStack stack, final int mouseX, final int mouseY,
final List<String> currentToolTip) {
if (stack != null) {
final Slot s = this.getSlot(mouseX, mouseY);
if (s instanceof SlotME) {
final int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
final int BigNumber = AEConfig.instance.getTerminalFontSize() == TerminalFontSize.SMALL ? 9999 : 999;
IAEItemStack myStack = null;
try {
final SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
} catch (final Throwable ignore) {
}
} catch (final Throwable ignore) {}
if (myStack != null) {
if (myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
final String local = ButtonToolTips.ItemsStored.getLocal();
final String formattedAmount =
NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize());
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
.format(myStack.getStackSize());
final String format = String.format(local, formattedAmount);
currentToolTip.add("\u00a77" + format);
@@ -692,16 +702,15 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
if (myStack.getCountRequestable() > 0) {
final String local = ButtonToolTips.ItemsRequestable.getLocal();
final String formattedAmount =
NumberFormat.getNumberInstance(Locale.US).format(myStack.getCountRequestable());
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
.format(myStack.getCountRequestable());
final String format = String.format(local, formattedAmount);
currentToolTip.add("\u00a77" + format);
}
} else if (stack.stackSize > BigNumber || (stack.stackSize > 1 && stack.isItemDamaged())) {
final String local = ButtonToolTips.ItemsStored.getLocal();
final String formattedAmount =
NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize);
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize);
final String format = String.format(local, formattedAmount);
currentToolTip.add("\u00a77" + format);
@@ -711,40 +720,40 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
return currentToolTip;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void renderToolTip(final ItemStack stack, final int x, final int y) {
public void renderToolTip(final ItemStack stack, final int x, final int y) {
final Slot s = this.getSlot(x, y);
if (s instanceof SlotME && stack != null) {
final int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
final int BigNumber = AEConfig.instance.getTerminalFontSize() == TerminalFontSize.SMALL ? 9999 : 999;
IAEItemStack myStack = null;
try {
final SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
} catch (final Throwable ignore) {
}
} catch (final Throwable ignore) {}
if (myStack != null) {
final List<String> currentToolTip =
stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
final List<String> currentToolTip = stack
.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
if (myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
currentToolTip.add("Items Stored: "
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize()));
currentToolTip.add(
"Items Stored: "
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize()));
}
if (myStack.getCountRequestable() > 0) {
currentToolTip.add("Items Requestable: "
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getCountRequestable()));
currentToolTip.add(
"Items Requestable: "
+ NumberFormat.getNumberInstance(Locale.US).format(myStack.getCountRequestable()));
}
this.drawTooltip(x, y, 0, join(currentToolTip, "\n"));
} else if (stack.stackSize > BigNumber) {
final List var4 = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
var4.add("Items Stored: "
+ NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize));
var4.add("Items Stored: " + NumberFormat.getNumberInstance(Locale.US).format(stack.stackSize));
this.drawTooltip(x, y, 0, join(var4, "\n"));
return;
}
@@ -815,8 +824,7 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
int j = this.guiTop;
pointX -= i;
pointY -= j;
return pointX >= rectX - 1
&& pointX < rectX + rectWidth + 1
return pointX >= rectX - 1 && pointX < rectX + rectWidth + 1
&& pointY >= rectY - 1
&& pointY < rectY + rectHeight + 1;
}
@@ -826,8 +834,8 @@ public class GuiWirelessCraftingTerminal extends AEBaseGui
return false;
}
try {
final Class<? super Object> c =
ReflectionHelper.getClass(this.getClass().getClassLoader(), "codechicken.nei.LayoutManager");
final Class<? super Object> c = ReflectionHelper
.getClass(this.getClass().getClassLoader(), "codechicken.nei.LayoutManager");
final Field fldSearchField = c.getField("searchField");
final TextField searchField = (TextField) fldSearchField.get(c);
return searchField.focused();
@@ -1,15 +1,16 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui;
import cpw.mods.fml.client.config.GuiConfig;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import net.p455w0rd.wirelesscraftingterminal.handlers.ConfigHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import cpw.mods.fml.client.config.GuiConfig;
public class WCTGuiConfig extends GuiConfig {
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
public WCTGuiConfig(GuiScreen guiScreen) {
super(
guiScreen,
@@ -1,13 +1,15 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui.widgets;
import appeng.client.gui.widgets.ITooltip;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import org.lwjgl.opengl.GL11;
import appeng.client.gui.widgets.ITooltip;
public class GuiTrashButton extends GuiButton implements ITooltip {
public GuiTrashButton(int x, int y) {
@@ -26,8 +28,7 @@ public class GuiTrashButton extends GuiButton implements ITooltip {
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
mc.renderEngine.bindTexture(new ResourceLocation("appliedenergistics2", "textures/guis/states.png"));
this.field_146123_n = par2 >= this.xPosition
&& par3 >= this.yPosition
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
&& par2 < this.xPosition + this.width
&& par3 < this.yPosition + this.height;
this.drawTexturedModalRect(0, 0, 256 - 16, 256 - 16, 16, 16);
@@ -39,7 +40,11 @@ public class GuiTrashButton extends GuiButton implements ITooltip {
@Override
public String getMessage() {
return EnumChatFormatting.WHITE + "" + LocaleHandler.EmptyTrash.getLocal() + "\n" + EnumChatFormatting.GRAY + ""
return EnumChatFormatting.WHITE + ""
+ LocaleHandler.EmptyTrash.getLocal()
+ "\n"
+ EnumChatFormatting.GRAY
+ ""
+ LocaleHandler.EmptyTrashDesc.getLocal();
}
@@ -5,19 +5,21 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class WCTGuiButton extends GuiButton {
protected static final ResourceLocation buttonTextures =
new ResourceLocation("minecraft", "textures/gui/widgets.png");
protected static final ResourceLocation buttonTextures = new ResourceLocation(
"minecraft",
"textures/gui/widgets.png");
public WCTGuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) {
this(p_i1020_1_, p_i1020_2_, p_i1020_3_, 200, 20, p_i1020_4_);
}
public WCTGuiButton(
int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) {
public WCTGuiButton(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_,
String p_i1021_6_) {
super(p_i1021_1_, p_i1021_2_, p_i1021_3_, p_i1021_4_, p_i1021_5_, p_i1021_6_);
this.width = 200;
this.height = 20;
@@ -37,8 +39,7 @@ public class WCTGuiButton extends GuiButton {
FontRenderer fontrenderer = p_146112_1_.fontRenderer;
p_146112_1_.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = p_146112_2_ >= this.xPosition
&& p_146112_3_ >= this.yPosition
this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition
&& p_146112_2_ < this.xPosition + this.width
&& p_146112_3_ < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
@@ -62,7 +63,12 @@ public class WCTGuiButton extends GuiButton {
this.width - 2,
2);
this.drawTexturedModalRect(
this.xPosition, this.yPosition + (this.height - 1), 200 - this.width, 65 + k * 20, this.width, 1);
this.xPosition,
this.yPosition + (this.height - 1),
200 - this.width,
65 + k * 20,
this.width,
1);
this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
int l = 14737632;
@@ -1,9 +1,10 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui.widgets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import cpw.mods.fml.client.config.GuiCheckBox;
import cpw.mods.fml.client.config.GuiUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
public class WCTGuiCheckBox extends GuiCheckBox {
@@ -22,8 +23,7 @@ public class WCTGuiCheckBox extends GuiCheckBox {
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
this.field_146123_n = mouseX >= this.xPosition
&& mouseY >= this.yPosition
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.boxWidth
&& mouseY < this.yPosition + this.height;
GuiUtils.drawContinuousTexturedBox(
@@ -49,27 +49,25 @@ public class WCTGuiCheckBox extends GuiCheckBox {
} else {
color = 4210752;
}
if (this.isChecked)
this.drawCenteredString(
mc.fontRenderer,
"✔",
this.xPosition + (this.width - this.boxWidth) + this.boxWidth / 2 + 1,
this.yPosition + 1,
0x00FF00);
if (this.isChecked) this.drawCenteredString(
mc.fontRenderer,
"✔",
this.xPosition + (this.width - this.boxWidth) + this.boxWidth / 2 + 1,
this.yPosition + 1,
0x00FF00);
this.drawStringNoShadow(mc.fontRenderer, displayString, xPosition, yPosition + 2, color);
}
}
public void drawStringNoShadow(
FontRenderer p_73731_1_, String p_73731_2_, int p_73731_3_, int p_73731_4_, int p_73731_5_) {
public void drawStringNoShadow(FontRenderer p_73731_1_, String p_73731_2_, int p_73731_3_, int p_73731_4_,
int p_73731_5_) {
p_73731_1_.drawString(p_73731_2_, p_73731_3_, p_73731_4_, p_73731_5_);
}
@Override
public boolean mousePressed(Minecraft p_146116_1_, int p_146116_2_, int p_146116_3_) {
if (this.enabled
&& this.visible
if (this.enabled && this.visible
&& p_146116_2_ >= this.xPosition
&& p_146116_3_ >= this.yPosition
&& p_146116_2_ < this.xPosition + this.width
@@ -1,11 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.common;
import appeng.api.AEApi;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.container.implementations.ContainerCraftingStatus;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -23,71 +17,89 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.AEApi;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.container.implementations.ContainerCraftingStatus;
import cpw.mods.fml.common.network.IGuiHandler;
public class WCTGuiHandler implements IGuiHandler {
public void registerRenderers() {}
@Override
public Object getServerGuiElement(int guiId, EntityPlayer player, World world, int x, int y, int z) {
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance()
.registries()
.wireless()
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
if (wh != null) {
final WirelessTerminalGuiObject obj = new WirelessTerminalGuiObject(
wh, RandomUtils.getWirelessTerm(player.inventory), player, world, x, y, z);
if (obj != null) {
final IPortableCell terminal = obj;
if (guiId == Reference.GUI_WCT) {
return updateGui(
new ContainerWirelessCraftingTerminal(player, player.inventory),
world,
x,
y,
z,
ForgeDirection.UNKNOWN,
obj);
}
if (guiId == Reference.GUI_CRAFTING_STATUS) {
return updateGui(
new ContainerCraftingStatus(player.inventory, terminal),
world,
x,
y,
z,
ForgeDirection.UNKNOWN,
obj);
}
if (guiId == Reference.GUI_CRAFT_AMOUNT) {
return updateGui(
new ContainerCraftAmount(player, terminal), world, x, y, z, ForgeDirection.UNKNOWN, obj);
}
if (guiId == Reference.GUI_CRAFT_CONFIRM) {
return updateGui(
new ContainerCraftConfirm(player, terminal), world, x, y, z, ForgeDirection.UNKNOWN, obj);
}
}
}
if (guiId == Reference.GUI_MAGNET) {
return new ContainerMagnet(player, player.inventory);
}
return null;
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless()
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
if (wh == null) {
return null;
}
final WirelessTerminalGuiObject term = new WirelessTerminalGuiObject(
wh,
RandomUtils.getWirelessTerm(player.inventory),
player,
world,
x,
y,
z);
return switch (guiId) {
case Reference.GUI_WCT -> updateGui(
new ContainerWirelessCraftingTerminal(player, player.inventory),
world,
x,
y,
z,
ForgeDirection.UNKNOWN,
term);
case Reference.GUI_CRAFTING_STATUS -> updateGui(
new ContainerCraftingStatus(player.inventory, term),
world,
x,
y,
z,
ForgeDirection.UNKNOWN,
term);
case Reference.GUI_CRAFT_AMOUNT -> updateGui(
new ContainerCraftAmount(player, term),
world,
x,
y,
z,
ForgeDirection.UNKNOWN,
term);
case Reference.GUI_CRAFT_CONFIRM -> updateGui(
new ContainerCraftConfirm(player, term),
world,
x,
y,
z,
ForgeDirection.UNKNOWN,
term);
default -> null;
};
}
@Override
public Object getClientGuiElement(int guiId, EntityPlayer player, World world, int x, int y, int z) {
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance()
.registries()
.wireless()
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless()
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
if (wh != null) {
final WirelessTerminalGuiObject obj = new WirelessTerminalGuiObject(
wh, RandomUtils.getWirelessTerm(player.inventory), player, world, x, y, z);
wh,
RandomUtils.getWirelessTerm(player.inventory),
player,
world,
x,
y,
z);
if (obj != null) {
final IPortableCell terminal = obj;
@@ -116,19 +128,13 @@ public class WCTGuiHandler implements IGuiHandler {
return null;
}
public static void launchGui(
final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) {
public static void launchGui(final int ID, final EntityPlayer player, final World world, final int x, final int y,
final int z) {
player.openGui(WirelessCraftingTerminal.INSTANCE, ID, world, x, y, z);
}
private Object updateGui(
final Object newContainer,
final World w,
final int x,
final int y,
final int z,
final ForgeDirection side,
final Object myItem) {
private Object updateGui(final Object newContainer, final World w, final int x, final int y, final int z,
final ForgeDirection side, final Object myItem) {
if (newContainer instanceof AEBaseContainer) {
final AEBaseContainer bc = (AEBaseContainer) newContainer;
bc.setOpenContext(new ContainerOpenContext(myItem));
@@ -1,20 +1,8 @@
package net.p455w0rd.wirelesscraftingterminal.common;
import appeng.api.AEApi;
import appeng.api.features.IWirelessTermHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.LoaderState;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import java.io.File;
import net.minecraft.creativetab.CreativeTabs;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.creativetab.CreativeTabWCT;
import net.p455w0rd.wirelesscraftingterminal.handlers.AchievementHandler;
@@ -25,18 +13,36 @@ import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.proxy.CommonProxy;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.AEApi;
import appeng.api.features.IWirelessTermHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.LoaderState;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
@Mod(
modid = Reference.MODID,
acceptedMinecraftVersions = "[1.7.10]",
name = Reference.NAME,
version = Reference.VERSION,
guiFactory = Reference.GUI_FACTORY,
dependencies = "" + "required-after:Forge@[" + net.minecraftforge.common.ForgeVersion.majorVersion
dependencies = "" + "required-after:Forge@["
+ net.minecraftforge.common.ForgeVersion.majorVersion
+ '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",);"
+ "required-after:appliedenergistics2@[rv3-beta-1,);after:NotEnoughItems;")
+ net.minecraftforge.common.ForgeVersion.minorVersion
+ '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion
+ '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion
+ ",);"
+ "required-after:appliedenergistics2@[rv3-beta-328,);after:NotEnoughItems;")
public class WirelessCraftingTerminal {
private static LoaderState WCTState = LoaderState.NOINIT;
@@ -50,36 +56,32 @@ public class WirelessCraftingTerminal {
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
long stopwatch = WCTLog.beginSection("PreInit");
WirelessCraftingTerminal.WCTState = LoaderState.PREINITIALIZATION;
WirelessCraftingTerminal.INSTANCE = this;
creativeTab = new CreativeTabWCT(CreativeTabs.getNextID(), Reference.MODID).setNoScrollbar();
WirelessCraftingTerminal.proxy.registerItems();
ConfigHandler.init(new File(event.getModConfigurationDirectory(), Reference.CONFIG_FILE));
FMLCommonHandler.instance().bus().register(proxy);
AEApi.instance().registries().wireless().registerWirelessHandler((IWirelessTermHandler)
ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem());
WCTLog.endSection("PreInit", stopwatch);
AEApi.instance().registries().wireless()
.registerWirelessHandler((IWirelessTermHandler) ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem());
}
@EventHandler
public void init(FMLInitializationEvent event) {
long stopwatch = WCTLog.beginSection("Init");
IntegrationRegistry.INSTANCE.init();
WirelessCraftingTerminal.WCTState = LoaderState.INITIALIZATION;
RecipeHandler.loadRecipes(!Reference.WCT_MINETWEAKER_OVERRIDE);
if (!Loader.isModLoaded("dreamcraft")) {
RecipeHandler.loadRecipes(!Reference.WCT_MINETWEAKER_OVERRIDE);
}
AchievementHandler.init();
WCTLog.endSection("Init", stopwatch);
}
@EventHandler
public void postInit(final FMLPostInitializationEvent event) {
long stopwatch = WCTLog.beginSection("PostInit");
IntegrationRegistry.INSTANCE.postInit();
NetworkRegistry.INSTANCE.registerGuiHandler(WirelessCraftingTerminal.INSTANCE, new WCTGuiHandler());
NetworkHandler.instance = new NetworkHandler("WCT");
WirelessCraftingTerminal.proxy.removeItemsFromNEI();
WCTLog.endSection("PostInit", stopwatch);
}
public static LoaderState getLoaderState() {
@@ -1,12 +1,14 @@
package net.p455w0rd.wirelesscraftingterminal.common.container;
import appeng.api.implementations.guiobjects.IPortableCell;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.implementations.guiobjects.IPortableCell;
public class ContainerCraftAmount extends appeng.container.implementations.ContainerCraftAmount {
public ContainerCraftAmount(EntityPlayer player, IPortableCell terminal) {
super(player.inventory, terminal);
}
@@ -17,5 +19,6 @@ public class ContainerCraftAmount extends appeng.container.implementations.Conta
int y = (int) player.posY;
int z = (int) player.posZ;
WCTGuiHandler.launchGui(Reference.GUI_CRAFT_CONFIRM, player, player.worldObj, x, y, z);
setupConfirmationGUI(player);
}
}
@@ -1,11 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.common.container;
import appeng.api.implementations.guiobjects.IPortableCell;
import net.minecraft.entity.player.EntityPlayer;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.implementations.guiobjects.IPortableCell;
public class ContainerCraftConfirm extends appeng.container.implementations.ContainerCraftConfirm {
private final EntityPlayer player;
public ContainerCraftConfirm(EntityPlayer player, IPortableCell terminal) {
@@ -3,6 +3,7 @@ package net.p455w0rd.wirelesscraftingterminal.common.container;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@@ -25,11 +26,7 @@ public class ContainerMagnet extends Container {
@SuppressWarnings("rawtypes")
private final Set distributeSlotSet = new HashSet();
private final int PLAYER_INV_START = 0,
PLAYER_INV_END = 26,
HOTBAR_START = 27,
HOTBAR_END = 35,
FILTERS_START = 36,
private final int PLAYER_INV_START = 0, PLAYER_INV_END = 26, HOTBAR_START = 27, HOTBAR_END = 35, FILTERS_START = 36,
FILTERS_END = 62;
public ContainerMagnet(EntityPlayer player, InventoryPlayer inventoryPlayer) {
@@ -84,7 +81,7 @@ public class ContainerMagnet extends Container {
return false;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
if (slotNum >= this.inventorySlots.size()) {
@@ -103,8 +100,7 @@ public class ContainerMagnet extends Container {
}
if (mouseButton == 1) {
player.dropPlayerItemWithRandomChoice(
inventoryplayer.getItemStack().splitStack(1), true);
player.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack().splitStack(1), true);
if (inventoryplayer.getItemStack().stackSize == 0) {
inventoryplayer.setItemStack((ItemStack) null);
@@ -117,7 +113,7 @@ public class ContainerMagnet extends Container {
// Click+drag stack
else if (modifier == 5) {
// if (isInFilters(slotNum)) {
// return null;
// return null;
// }
int currentDistributeState = this.distributeState;
this.distributeState = checkForPressedButton(mouseButton);
@@ -139,8 +135,7 @@ public class ContainerMagnet extends Container {
} else if (this.distributeState == 1) {
Slot slot = (Slot) this.inventorySlots.get(slotNum);
if (slot != null
&& stackFitsInSlot(slot, inventoryplayer.getItemStack(), true)
if (slot != null && stackFitsInSlot(slot, inventoryplayer.getItemStack(), true)
&& slot.isItemValid(inventoryplayer.getItemStack())
&& inventoryplayer.getItemStack().stackSize > this.distributeSlotSet.size()
&& this.canDragIntoSlot(slot)) {
@@ -155,8 +150,7 @@ public class ContainerMagnet extends Container {
while (iterator.hasNext()) {
Slot slot1 = (Slot) iterator.next();
if (slot1 != null
&& stackFitsInSlot(slot1, inventoryplayer.getItemStack(), true)
if (slot1 != null && stackFitsInSlot(slot1, inventoryplayer.getItemStack(), true)
&& slot1.isItemValid(inventoryplayer.getItemStack())
&& inventoryplayer.getItemStack().stackSize >= this.distributeSlotSet.size()
&& this.canDragIntoSlot(slot1)) {
@@ -237,12 +231,12 @@ public class ContainerMagnet extends Container {
}
@SuppressWarnings("rawtypes")
public static void setSlotStack(
Set slotSet, int stackSizeSelector, ItemStack stackToResize, int currentSlotStackSize) {
public static void setSlotStack(Set slotSet, int stackSizeSelector, ItemStack stackToResize,
int currentSlotStackSize) {
switch (stackSizeSelector) {
case 0:
stackToResize.stackSize =
MathHelper.floor_float((float) stackToResize.stackSize / (float) slotSet.size());
stackToResize.stackSize = MathHelper
.floor_float((float) stackToResize.stackSize / (float) slotSet.size());
break;
case 1:
stackToResize.stackSize = 1;
@@ -254,8 +248,7 @@ public class ContainerMagnet extends Container {
public static boolean stackFitsInSlot(Slot slot, ItemStack itemStack, boolean sizeMatters) {
boolean flag1 = slot == null || !slot.getHasStack();
if (slot != null
&& slot.getHasStack()
if (slot != null && slot.getHasStack()
&& itemStack != null
&& itemStack.isItemEqual(slot.getStack())
&& ItemStack.areItemStackTagsEqual(slot.getStack(), itemStack)) {
@@ -439,8 +432,7 @@ public class ContainerMagnet extends Container {
continue;
}
if (itemstack1 != null
&& itemstack1.getItem() == stack.getItem()
if (itemstack1 != null && itemstack1.getItem() == stack.getItem()
&& (!stack.getHasSubtypes() || stack.getItemDamage() == itemstack1.getItemDamage())
&& ItemStack.areItemStackTagsEqual(stack, itemstack1)) {
int l = itemstack1.stackSize + stack.stackSize;
@@ -482,7 +474,8 @@ public class ContainerMagnet extends Container {
break;
} else {
putStackInSlot(
k, new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
k,
new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
stack.stackSize -= slot.getSlotStackLimit();
magnetInventory.markDirty();
flag1 = true;
@@ -1,60 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.common.container;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.me.InternalSlotME;
import appeng.client.me.SlotME;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerNull;
import appeng.container.slot.AppEngCraftingSlot;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.NullSlot;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotCraftingTerm;
import appeng.container.slot.SlotDisabled;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotInaccessible;
import appeng.container.slot.SlotPlayerHotBar;
import appeng.container.slot.SlotPlayerInv;
import appeng.core.AEConfig;
import appeng.core.localization.PlayerMessages;
import appeng.helpers.IContainerCraftingPacket;
import appeng.helpers.InventoryAction;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.AdaptorPlayerHand;
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
@@ -95,13 +48,58 @@ import net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.me.InternalSlotME;
import appeng.client.me.SlotME;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerNull;
import appeng.container.slot.AppEngCraftingSlot;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotCraftingTerm;
import appeng.container.slot.SlotDisabled;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotInaccessible;
import appeng.container.slot.SlotPlayerHotBar;
import appeng.container.slot.SlotPlayerInv;
import appeng.core.AEConfig;
import appeng.core.localization.PlayerMessages;
import appeng.helpers.IContainerCraftingPacket;
import appeng.helpers.InventoryAction;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.AdaptorPlayerHand;
public class ContainerWirelessCraftingTerminal extends AEBaseContainer
implements IConfigManagerHost,
IConfigurableObject,
IMEMonitorHandlerReceiver<IAEItemStack>,
IAEAppEngInventory,
IContainerCraftingPacket,
IViewCellStorage {
implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack>, IAEAppEngInventory,
IContainerCraftingPacket, IViewCellStorage {
private final ItemStack containerstack;
public final WCTInventoryCrafting craftingGrid;
@@ -113,23 +111,14 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
public ItemStack[] craftMatrixInventory;
private final World worldObj;
private final EntityPlayer player;
public static final int HOTBAR_START = 1,
HOTBAR_END = HOTBAR_START + 8,
INV_START = HOTBAR_END + 1,
INV_END = INV_START + 26,
ARMOR_START = INV_END + 1,
ARMOR_END = ARMOR_START + 3,
CRAFT_GRID_START = ARMOR_END + 1,
CRAFT_GRID_END = CRAFT_GRID_START + 8,
CRAFT_RESULT = CRAFT_GRID_END + 1,
VIEW_CELL_START = CRAFT_RESULT + 1,
VIEW_CELL_END = VIEW_CELL_START + 4,
BOOSTER_INDEX = 0,
public static final int HOTBAR_START = 2, HOTBAR_END = HOTBAR_START + 8, INV_START = HOTBAR_END + 1,
INV_END = INV_START + 26, ARMOR_START = INV_END + 1, ARMOR_END = ARMOR_START + 3,
CRAFT_GRID_START = ARMOR_END + 1, CRAFT_GRID_END = CRAFT_GRID_START + 8, CRAFT_RESULT = CRAFT_GRID_END + 1,
VIEW_CELL_START = CRAFT_RESULT + 1, VIEW_CELL_END = VIEW_CELL_START + 4, BOOSTER_INDEX = 1,
MAGNET_INDEX = VIEW_CELL_END + 1;
public static int CRAFTING_SLOT_X_POS = 80, CRAFTING_SLOT_Y_POS = 83;
private SlotBooster boosterSlot;
private final SlotMagnet magnetSlot;
private NullSlot nullSlot;
private final Slot[] hotbarSlot;
private final Slot[] inventorySlot;
private final SlotArmor[] armorSlot;
@@ -192,8 +181,13 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
craftMatrixSlot = new SlotCraftingMatrix[9];
viewCellSlot = new SlotViewCell[5];
this.obj =
getGuiObject(containerstack, player, worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
this.obj = getGuiObject(
containerstack,
player,
worldObj,
(int) player.posX,
(int) player.posY,
(int) player.posZ);
this.civ = this.obj;
final IGridNode node = ((IGridHost) this.obj).getGridNode(ForgeDirection.UNKNOWN);
this.networkNode = node;
@@ -214,17 +208,24 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
this.monitor = null;
}
// Dummy slot at index 0 to work around ME slots all having their slot number set to 0.
this.addSlotToContainer(new SlotInaccessible(new AppEngInternalInventory(null, 1), 0, -1000, -1000));
if (Reference.WCT_BOOSTER_ENABLED) {
boosterSlot = new SlotBooster(this.boosterInventory, 0, 134, -20);
this.addSlotToContainer(boosterSlot);
} else {
nullSlot = new NullSlot();
this.addSlotToContainer(nullSlot);
this.addSlotToContainer(new SlotInaccessible(new AppEngInternalInventory(null, 1), 0, -1000, -1000));
}
// Add hotbar slots
for (int i = 0; i < 9; ++i) {
hotbarSlot[i] = new SlotPlayerHotBar(this.inventoryPlayer, i, i * 18 + 8, 58);
if (player.inventory.getStackInSlot(i) != null
&& player.inventory.getStackInSlot(i).getItem() == this.thisItem) {
hotbarSlot[i] = new SlotDisabled(this.inventoryPlayer, i, i * 18 + 8, 58);
} else {
hotbarSlot[i] = new SlotPlayerHotBar(this.inventoryPlayer, i, i * 18 + 8, 58);
}
this.addSlotToContainer(hotbarSlot[i]);
}
@@ -233,7 +234,12 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
// Add player inventory slots
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
inventorySlot[k] = new SlotPlayerInv(this.inventoryPlayer, j + i * 9 + 9, j * 18 + 8, i * 18);
if (player.inventory.getStackInSlot(j + i * 9 + 9) != null
&& player.inventory.getStackInSlot(j + i * 9 + 9).getItem() == this.thisItem) {
inventorySlot[k] = new SlotDisabled(this.inventoryPlayer, j + i * 9 + 9, j * 18 + 8, i * 18);
} else {
inventorySlot[k] = new SlotPlayerInv(this.inventoryPlayer, j + i * 9 + 9, j * 18 + 8, i * 18);
}
this.addSlotToContainer(inventorySlot[k]);
k++;
}
@@ -248,8 +254,12 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
// Add crafting grid slots
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
craftMatrixSlot[k] =
new SlotCraftingMatrix(this, this.craftingGrid, j + i * 3, 80 + j * 18, (i * 18) - 76);
craftMatrixSlot[k] = new SlotCraftingMatrix(
this,
this.craftingGrid,
j + i * 3,
80 + j * 18,
(i * 18) - 76);
this.addSlotToContainer(craftMatrixSlot[k]);
if (k == 0) {
this.firstCraftingSlotNumber = craftMatrixSlot[k].slotNumber;
@@ -446,7 +456,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
}
ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
if (ais != null) {
adp.addItems(ais.getItemStack());
}
@@ -465,8 +478,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
ais.setStackSize(1);
final IAEItemStack extracted = ais.copy();
ais = Platform.poweredInsert(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
ais = Platform
.poweredInsert(this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
if (ais == null) {
final InventoryAdaptor ia = new AdaptorPlayerHand(player);
@@ -504,7 +517,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
IAEItemStack ais = slotItem.copy();
ais.setStackSize(1);
ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
if (ais != null) {
final InventoryAdaptor ia = new AdaptorPlayerHand(player);
@@ -528,7 +544,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
IAEItemStack ais = slotItem.copy();
ais.setStackSize(ais.getItemStack().getMaxStackSize());
ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
if (ais != null) {
player.inventory.setItemStack(ais.getItemStack());
} else {
@@ -538,8 +557,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
}
} else {
IAEItemStack ais = AEApi.instance().storage().createItemStack(player.inventory.getItemStack());
ais = Platform.poweredInsert(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
ais = Platform
.poweredInsert(this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
if (ais != null) {
player.inventory.setItemStack(ais.getItemStack());
} else {
@@ -565,7 +584,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
final long stackSize = Math.min(maxSize, ais.getStackSize());
ais.setStackSize((stackSize + 1) >> 1);
ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
}
if (ais != null) {
@@ -578,8 +600,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
} else {
IAEItemStack ais = AEApi.instance().storage().createItemStack(player.inventory.getItemStack());
ais.setStackSize(1);
ais = Platform.poweredInsert(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
ais = Platform
.poweredInsert(this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
if (ais == null) {
final ItemStack is = player.inventory.getItemStack();
is.stackSize--;
@@ -621,7 +643,10 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
}
ais = Platform.poweredExtraction(
this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource());
this.getPowerSource(),
this.getCellInventory(),
ais,
this.getActionSource());
if (ais != null) {
adp.addItems(ais.getItemStack());
} else {
@@ -653,12 +678,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
}
@Override
public void onChangeInventory(
final IInventory inv,
final int slot,
final InvOperation mc,
final ItemStack removedStack,
final ItemStack newStack) {
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
// <3
}
@@ -703,11 +724,11 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
return viewCellSlot[index];
}
public static WirelessTerminalGuiObject getGuiObject(
final ItemStack it, final EntityPlayer player, final World w, final int x, final int y, final int z) {
public static WirelessTerminalGuiObject getGuiObject(final ItemStack it, final EntityPlayer player, final World w,
final int x, final int y, final int z) {
if (it != null) {
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler)
AEApi.instance().registries().wireless().getWirelessTerminalHandler(it);
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries()
.wireless().getWirelessTerminalHandler(it);
if (wh != null) {
return new WirelessTerminalGuiObject(wh, it, player, w, x, y, z);
}
@@ -723,7 +744,9 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
if (this.ticks > 10) {
if (!isBoosterInstalled() || !Reference.WCT_BOOSTER_ENABLED) {
this.civ.extractAEPower(
this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG);
this.getPowerMultiplier() * this.ticks,
Actionable.MODULATE,
PowerMultiplier.CONFIG);
} else {
this.civ.extractAEPower((int) (0.5 * this.ticks), Actionable.MODULATE, PowerMultiplier.CONFIG);
}
@@ -744,7 +767,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
for (final Object crafter : this.crafters) {
try {
NetworkHandler.instance.sendTo(
new PacketValueConfig(set.name(), sideLocal.name()), (EntityPlayerMP) crafter);
new PacketValueConfig(set.name(), sideLocal.name()),
(EntityPlayerMP) crafter);
} catch (final IOException e) {
WCTLog.debug(e.getMessage());
}
@@ -791,37 +815,32 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
}
if (!networkIsPowered()) {
if (this.isValidContainer()) {
this.getPlayerInv()
.player
this.getPlayerInv().player
.addChatMessage(new ChatComponentText(LocaleHandler.NoNetworkPower.getLocal()));
}
this.setValidContainer(false);
}
} else if (!hasAccess(SecurityPermissions.CRAFT, true)
|| !hasAccess(SecurityPermissions.EXTRACT, true)
} else if (!hasAccess(SecurityPermissions.CRAFT, true) || !hasAccess(SecurityPermissions.EXTRACT, true)
|| !hasAccess(SecurityPermissions.INJECT, true)) {
if (this.isValidContainer()) {
this.getPlayerInv().player.addChatMessage(PlayerMessages.CommunicationError.get());
}
this.setValidContainer(false);
} else {
this.setPowerMultiplier(AEConfig.instance.wireless_getDrainRate(this.obj.getRange()));
}
if (this.isValidContainer()) {
this.getPlayerInv().player.addChatMessage(PlayerMessages.CommunicationError.get());
}
this.setValidContainer(false);
} else {
this.setPowerMultiplier(AEConfig.instance.wireless_getDrainRate(this.obj.getRange()));
}
super.detectAndSendChanges();
}
public boolean isBoosterInstalled() {
Slot slot = getSlotFromInventory(this.boosterInventory, BOOSTER_INDEX);
Slot slot = getSlotFromInventory(this.boosterInventory, 0);
if (slot == null) {
return false;
}
boolean hasStack =
getSlotFromInventory(this.boosterInventory, BOOSTER_INDEX).getHasStack();
boolean hasStack = getSlotFromInventory(this.boosterInventory, 0).getHasStack();
if (hasStack) {
Item boosterSlotContents = getSlotFromInventory(this.boosterInventory, BOOSTER_INDEX)
.getStack()
.getItem();
Item boosterSlotContents = getSlotFromInventory(this.boosterInventory, 0).getStack().getItem();
return boosterSlotContents instanceof ItemInfinityBooster;
}
return false;
@@ -832,12 +851,9 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
if (slot == null) {
return false;
}
boolean hasStack =
getSlotFromInventory(this.magnetInventory, MAGNET_INDEX).getHasStack();
boolean hasStack = getSlotFromInventory(this.magnetInventory, MAGNET_INDEX).getHasStack();
if (hasStack) {
Item magnetSlotContents = getSlotFromInventory(this.magnetInventory, MAGNET_INDEX)
.getStack()
.getItem();
Item magnetSlotContents = getSlotFromInventory(this.magnetInventory, MAGNET_INDEX).getStack().getItem();
return magnetSlotContents instanceof ItemMagnet;
}
return false;
@@ -894,9 +910,7 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
}
@Override
public void postChange(
final IBaseMonitor<IAEItemStack> monitor,
final Iterable<IAEItemStack> change,
public void postChange(final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change,
final BaseActionSource source) {
for (final IAEItemStack is : change) {
this.items.add(is);
@@ -1313,8 +1327,7 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
@Override
public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) {
try {
if (slot >= 0
&& getSlot(slot) != null
if (slot >= 0 && getSlot(slot) != null
&& getSlot(slot).getStack() == RandomUtils.getWirelessTerm(player.inventory)) {
return null;
}
@@ -1345,8 +1358,7 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
continue;
}
if (itemstack1 != null
&& itemstack1.getItem() == stack.getItem()
if (itemstack1 != null && itemstack1.getItem() == stack.getItem()
&& (!stack.getHasSubtypes() || stack.getItemDamage() == itemstack1.getItemDamage())
&& ItemStack.areItemStackTagsEqual(stack, itemstack1)) {
int l = itemstack1.stackSize + stack.stackSize;
@@ -1388,7 +1400,8 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
break;
} else {
putStackInSlot(
k, new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
k,
new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
stack.stackSize -= slot.getSlotStackLimit();
boosterInventory.markDirty();
flag1 = true;
@@ -1,9 +1,10 @@
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
import appeng.container.slot.SlotFake;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.container.slot.SlotFake;
public class OptionalSlotFake extends SlotFake {
private final int srcX;
@@ -12,15 +13,8 @@ public class OptionalSlotFake extends SlotFake {
private final IOptionalSlotHost host;
private boolean renderDisabled = true;
public OptionalSlotFake(
final IInventory inv,
final IOptionalSlotHost containerBus,
final int idx,
final int x,
final int y,
final int offX,
final int offY,
final int groupNum) {
public OptionalSlotFake(final IInventory inv, final IOptionalSlotHost containerBus, final int idx, final int x,
final int y, final int offX, final int offY, final int groupNum) {
super(inv, idx, x + offX * 18, y + offY * 18);
this.srcX = x;
this.srcY = y;
@@ -1,7 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@@ -9,12 +7,14 @@ import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlotArmor extends appeng.container.slot.AppEngSlot {
/*
* The armor type that can be placed on that slot, it uses the same values
* of armorType field on ItemArmor. Probably could've done just as well
* with vanilla armor slot class. if so, this will be removed in the future.
* The armor type that can be placed on that slot, it uses the same values of armorType field on ItemArmor. Probably
* could've done just as well with vanilla armor slot class. if so, this will be removed in the future.
*/
final int armorType;
@@ -1,14 +1,15 @@
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.p455w0rd.wirelesscraftingterminal.items.ItemBoosterBGIcon;
import net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlotBooster extends appeng.container.slot.AppEngSlot {
/**
@@ -84,8 +84,7 @@ public class SlotTrash extends appeng.container.slot.AppEngSlot {
}
public void readNBT() {
NBTTagCompound nbtTagCompound =
RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
NBTTagCompound nbtTagCompound = RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
NBTTagList tagList = nbtTagCompound.getTagList(this.name, 10);
NBTTagCompound tagCompound = tagList.getCompoundTagAt(0);
if (tagCompound != null) {
@@ -94,8 +93,7 @@ public class SlotTrash extends appeng.container.slot.AppEngSlot {
}
public void writeNBT() {
NBTTagCompound nbtTagCompound =
RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
NBTTagCompound nbtTagCompound = RandomUtils.getWirelessTerm(entityPlayer.inventory).getTagCompound();
NBTTagList tagList = new NBTTagList();
if (itemStack != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
@@ -1,9 +1,10 @@
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
import appeng.container.slot.SlotRestrictedInput;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.container.slot.SlotRestrictedInput;
public class SlotViewCell extends SlotRestrictedInput {
public SlotViewCell(IInventory inv, int index, int xPos, int yPos, InventoryPlayer playerInv) {
@@ -1,17 +1,18 @@
package net.p455w0rd.wirelesscraftingterminal.common.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
import appeng.api.storage.IMEInventory;
import appeng.me.storage.MEIInventoryWrapper;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
public class WCTInventoryCrafting extends AppEngInternalInventory {
@@ -133,17 +134,11 @@ public class WCTInventoryCrafting extends AppEngInternalInventory {
}
/*
* @Override public ItemStack decrStackSize(int slot, int amount) { if
* (this.stackList[slot] != null) { ItemStack itemstack; if
* (this.stackList[slot].stackSize <= amount) { itemstack =
* this.stackList[slot]; this.stackList[slot] = null;
* this.eventHandler.onCraftMatrixChanged(this); return itemstack; } else {
* itemstack = this.stackList[slot].splitStack(amount);
*
* if (this.stackList[slot].stackSize == 0) { this.stackList[slot] = null; }
*
* this.eventHandler.onCraftMatrixChanged(this); return itemstack; } } else
* { return getStackInSlot(slot); } }
* @Override public ItemStack decrStackSize(int slot, int amount) { if (this.stackList[slot] != null) { ItemStack
* itemstack; if (this.stackList[slot].stackSize <= amount) { itemstack = this.stackList[slot]; this.stackList[slot]
* = null; this.eventHandler.onCraftMatrixChanged(this); return itemstack; } else { itemstack =
* this.stackList[slot].splitStack(amount); if (this.stackList[slot].stackSize == 0) { this.stackList[slot] = null;
* } this.eventHandler.onCraftMatrixChanged(this); return itemstack; } } else { return getStackInSlot(slot); } }
*/
public void setInventorySlotContents(int slot, ItemStack stack) {
this.stackList[slot] = stack;
@@ -1,12 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.common.inventory;
import appeng.api.AEApi;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import appeng.api.AEApi;
public class WCTInventoryViewCell implements IInventory {
private final String name = "ViewCells";
@@ -1,8 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.common.utils;
import baubles.api.BaublesApi;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -12,8 +9,15 @@ import net.minecraft.util.EnumChatFormatting;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import baubles.api.BaublesApi;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class RandomUtils {
public static boolean isBaublesLoaded = Loader.isModLoaded("Baubles");
@SideOnly(Side.CLIENT)
public static String color(String color) {
switch (color) {
@@ -61,27 +65,30 @@ public class RandomUtils {
break;
}
}
IInventory handler = BaublesApi.getBaubles(playerInv.player);
if (handler != null) {
invSize = handler.getSizeInventory();
for (int i = 0; i < invSize; ++i) {
ItemStack item = handler.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = item;
break;
if (isBaublesLoaded) {
IInventory handler = BaublesApi.getBaubles(playerInv.player);
if (handler != null) {
invSize = handler.getSizeInventory();
for (int i = 0; i < invSize; ++i) {
ItemStack item = handler.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = item;
break;
}
}
}
}
return wirelessTerm;
}
public static ItemStack getMagnet(InventoryPlayer playerInv) {
// Is player holding a Magnet Card?
if (playerInv.player.getHeldItem() != null
&& playerInv.player.getHeldItem().getItem() instanceof ItemMagnet) {
if (playerInv.player.getHeldItem() != null && playerInv.player.getHeldItem().getItem() instanceof ItemMagnet) {
return playerInv.player.getHeldItem();
}
// if not true, try to return first magnet card from first
@@ -129,9 +136,7 @@ public class RandomUtils {
}
public static boolean isMagnetInstalled(InventoryPlayer ip) {
NBTTagCompound magnetNBTForm = RandomUtils.getWirelessTerm(ip)
.getTagCompound()
.getTagList("MagnetSlot", 10)
NBTTagCompound magnetNBTForm = RandomUtils.getWirelessTerm(ip).getTagCompound().getTagList("MagnetSlot", 10)
.getCompoundTagAt(0);
if (magnetNBTForm != null) {
ItemStack magnetItem = ItemStack.loadItemStackFromNBT(magnetNBTForm);
@@ -1,44 +1,23 @@
package net.p455w0rd.wirelesscraftingterminal.common.utils;
import javax.annotation.Nonnull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class WCTLog {
public static final Logger log = LogManager.getLogger("Wireless Crafting Terminal");
/**
* Displays the section header.
*/
public static long beginSection(final String section) {
log.info(String.format("-=-=-=-=-=-=-=[START] %s=-=-=-=-=-=-=-", section));
return System.currentTimeMillis();
}
/**
* Logs a debug statement.
*
* @param format
* @param data
*/
public static void debug(final String format, final Object... data) {
log.debug(String.format(format, data));
}
/**
* Displays the section footer.
*/
public static void endSection(final String section, final long sectionStartTime) {
log.info(String.format(
"-=-=-=-=-=-=-=[FINISH] %s in %dms=-=-=-=-=-=-=-",
section, (System.currentTimeMillis() - sectionStartTime)));
}
/**
* Logs basic info.
*
* @param format
* @param data
*/
public static void info(final String format, final Object... data) {
log.info(String.format(format, data));
@@ -46,9 +25,6 @@ public class WCTLog {
/**
* Logs an error.
*
* @param format
* @param data
*/
public static void severe(final String format, final Object... data) {
log.error(String.format(format, data));
@@ -56,9 +32,6 @@ public class WCTLog {
/**
* Logs a warning.
*
* @param format
* @param data
*/
public static void warning(final String format, final Object... data) {
log.warn(String.format(format, data));
@@ -1,11 +1,12 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.ByteBuf;
public abstract class WCTPacket {
private ByteBuf p;
@@ -1,11 +1,10 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.DecoderException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketConfigSync;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketCraftRequest;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
@@ -18,11 +17,15 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetMagnet;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.DecoderException;
public class WCTPacketHandlerBase {
private static final Map<Class<? extends WCTPacket>, PacketTypes> REVERSE_LOOKUP =
new HashMap<Class<? extends WCTPacket>, WCTPacketHandlerBase.PacketTypes>();
private static final Map<Class<? extends WCTPacket>, PacketTypes> REVERSE_LOOKUP = new HashMap<Class<? extends WCTPacket>, WCTPacketHandlerBase.PacketTypes>();
public enum PacketTypes {
PACKET_INVENTORY_ACTION(PacketInventoryAction.class),
PACKET_ME_INVENTORY_UPDATE(PacketMEInventoryUpdate.class),
@@ -54,10 +57,7 @@ public class WCTPacketHandlerBase {
Constructor<? extends WCTPacket> x = null;
try {
x = this.packetClass.getConstructor(ByteBuf.class);
} catch (final NoSuchMethodException ignored) {
} catch (final SecurityException ignored) {
} catch (final DecoderException ignored) {
}
} catch (final NoSuchMethodException ignored) {} catch (final SecurityException ignored) {} catch (final DecoderException ignored) {}
this.packetConstructor = x;
REVERSE_LOOKUP.put(this.packetClass, this);
@@ -76,9 +76,8 @@ public class WCTPacketHandlerBase {
return REVERSE_LOOKUP.get(c);
}
public WCTPacket parsePacket(final ByteBuf in)
throws InstantiationException, IllegalAccessException, IllegalArgumentException,
InvocationTargetException {
public WCTPacket parsePacket(final ByteBuf in) throws InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
return this.packetConstructor.newInstance(in);
}
}
@@ -1,3 +1,4 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
public interface INetworkInfo {}
public interface INetworkInfo {
}
@@ -1,8 +1,9 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
public interface IPacketHandler {
void onPacketData(INetworkInfo manager, FMLProxyPacket packet, EntityPlayer player);
@@ -1,14 +1,15 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLEventChannel;
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
public class NetworkHandler {
@@ -1,14 +1,16 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.ByteBuf;
import java.lang.reflect.InvocationTargetException;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacketHandlerBase;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.ByteBuf;
public class WCTClientPacketHandler extends WCTPacketHandlerBase implements IPacketHandler {
@Override
@@ -1,13 +1,15 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.network;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.ByteBuf;
import java.lang.reflect.InvocationTargetException;
import net.minecraft.entity.player.EntityPlayer;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacketHandlerBase;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.ByteBuf;
public final class WCTServerPacketHandler extends WCTPacketHandlerBase implements IPacketHandler {
@Override
@@ -1,7 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
@@ -9,6 +7,10 @@ import net.p455w0rd.wirelesscraftingterminal.handlers.ConfigHandler;
import net.p455w0rd.wirelesscraftingterminal.handlers.RecipeHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import cpw.mods.fml.common.Loader;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PacketConfigSync extends WCTPacket {
int wirelessTermMaxPower, boosterDropChance;
@@ -57,7 +59,9 @@ public class PacketConfigSync extends WCTPacket {
Reference.WCT_MINETWEAKER_OVERRIDE = this.mineTweakerOverride;
ConfigHandler.removeBooster();
ConfigHandler.removeBoosterIcon();
RecipeHandler.loadRecipes(mtChanged);
if (!Loader.isModLoaded("dreamcraft")) {
RecipeHandler.loadRecipes(mtChanged);
}
mtChanged = false;
}
}
@@ -1,5 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import java.util.concurrent.Future;
import net.minecraft.entity.player.EntityPlayer;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.crafting.ICraftingGrid;
@@ -8,12 +16,6 @@ import appeng.container.implementations.ContainerCraftAmount;
import appeng.container.implementations.ContainerCraftConfirm;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.concurrent.Future;
import net.minecraft.entity.player.EntityPlayer;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
public class PacketCraftRequest extends WCTPacket {
@@ -55,7 +57,11 @@ public class PacketCraftRequest extends WCTPacket {
try {
final ICraftingGrid cg = g.getCache(ICraftingGrid.class);
futureJob = cg.beginCraftingJob(
cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.getItemToCraft(), null);
cca.getWorld(),
cca.getGrid(),
cca.getActionSrc(),
cca.getItemToCraft(),
null);
int x = (int) player.posX;
int y = (int) player.posY;
@@ -65,6 +71,7 @@ public class PacketCraftRequest extends WCTPacket {
if (player.openContainer instanceof ContainerCraftConfirm) {
final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
ccc.setItemToCraft(cca.getItemToCraft());
ccc.setAutoStart(this.heldShift);
ccc.setJob(futureJob);
cca.detectAndSendChanges();
@@ -1,7 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -10,6 +8,9 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PacketEmptyTrash extends WCTPacket {
public PacketEmptyTrash(final ByteBuf stream) {}
@@ -1,5 +1,17 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.ClientHelper;
import appeng.container.AEBaseContainer;
@@ -10,16 +22,6 @@ import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
public class PacketInventoryAction extends WCTPacket {
@@ -115,10 +117,8 @@ public class PacketInventoryAction extends WCTPacket {
if (baseContainer instanceof ContainerWirelessCraftingTerminal) {
if (((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack() != null) {
cca.getCraftingItem()
.putStack(((ContainerWirelessCraftingTerminal) baseContainer)
.getTargetStack()
.getItemStack());
cca.getCraftingItem().putStack(
((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack().getItemStack());
cca.setItemToCraft(((ContainerWirelessCraftingTerminal) baseContainer).getTargetStack());
}
}
@@ -126,9 +126,7 @@ public class PacketInventoryAction extends WCTPacket {
if (baseContainer instanceof AEBaseContainer) {
if (((AEBaseContainer) baseContainer).getTargetStack() != null) {
cca.getCraftingItem()
.putStack(((AEBaseContainer) baseContainer)
.getTargetStack()
.getItemStack());
.putStack(((AEBaseContainer) baseContainer).getTargetStack().getItemStack());
cca.setItemToCraft(((AEBaseContainer) baseContainer).getTargetStack());
}
}
@@ -140,9 +138,8 @@ public class PacketInventoryAction extends WCTPacket {
if (baseContainer instanceof ContainerWirelessCraftingTerminal) {
if (RandomUtils.getWirelessTerm(player.inventory) == null)
((ContainerWirelessCraftingTerminal) baseContainer).setValidContainer(false);
else
((ContainerWirelessCraftingTerminal) baseContainer)
.doAction(sender, this.action, this.slot, this.id);
else((ContainerWirelessCraftingTerminal) baseContainer)
.doAction(sender, this.action, this.slot, this.id);
}
if (baseContainer instanceof AEBaseContainer) {
((AEBaseContainer) baseContainer).doAction(sender, this.action, this.slot, this.id);
@@ -1,12 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import appeng.api.storage.data.IAEItemStack;
import appeng.util.item.AEItemStack;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -15,7 +8,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
@@ -25,7 +20,16 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import appeng.api.storage.data.IAEItemStack;
import appeng.util.item.AEItemStack;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PacketMEInventoryUpdate extends WCTPacket {
private static final int UNCOMPRESSED_PACKET_BYTE_LIMIT = 16 * 1024 * 1024;
private static final int OPERATION_BYTE_LIMIT = 2 * 1024;
private static final int TEMP_BUFFER_SIZE = 1024;
@@ -54,6 +58,7 @@ public class PacketMEInventoryUpdate extends WCTPacket {
this.ref = stream.readByte();
final GZIPInputStream gzReader = new GZIPInputStream(new InputStream() {
@Override
public int read() throws IOException {
if (stream.readableBytes() <= 0) {
@@ -94,6 +99,7 @@ public class PacketMEInventoryUpdate extends WCTPacket {
this.data.writeByte(this.ref);
this.compressFrame = new GZIPOutputStream(new OutputStream() {
@Override
public void write(final int value) throws IOException {
PacketMEInventoryUpdate.this.data.writeByte(value);
@@ -1,7 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -10,6 +8,9 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PacketMagnetFilter extends WCTPacket {
// 0 = initialize
@@ -1,5 +1,28 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.config.SecurityPermissions;
@@ -20,27 +43,6 @@ import appeng.util.item.AEItemStack;
import appeng.util.prioitylist.IPartitionList;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
public class PacketNEIRecipe extends WCTPacket {
@@ -80,7 +82,7 @@ public class PacketNEIRecipe extends WCTPacket {
configureWrite(data);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
final EntityPlayerMP pmp = (EntityPlayerMP) player;
@@ -140,15 +142,16 @@ public class PacketNEIRecipe extends WCTPacket {
ItemStack currentItem = craftMatrix.getStackInSlot(x);
if (currentItem != null) {
testInv.setInventorySlotContents(x, currentItem);
final ItemStack newItemStack =
r.matches(testInv, pmp.worldObj) ? r.getCraftingResult(testInv) : null;
final ItemStack newItemStack = r.matches(testInv, pmp.worldObj)
? r.getCraftingResult(testInv)
: null;
testInv.setInventorySlotContents(x, patternItem);
if (newItemStack == null || !Platform.isSameItemPrecise(newItemStack, is)) {
final IAEItemStack in = AEItemStack.create(currentItem);
if (in != null) {
final IAEItemStack out =
Platform.poweredInsert(energy, storage, in, cct.getActionSource());
final IAEItemStack out = Platform
.poweredInsert(energy, storage, in, cct.getActionSource());
if (out != null) {
craftMatrix.setInventorySlotContents(x, out.getItemStack());
} else {
@@ -190,7 +193,10 @@ public class PacketNEIRecipe extends WCTPacket {
if (filter == null || filter.isListed(request)) {
request.setStackSize(1);
final IAEItemStack out = Platform.poweredExtraction(
energy, storage, request, cct.getActionSource());
energy,
storage,
request,
cct.getActionSource());
if (out != null) {
whichItem = out.getItemStack();
break;
@@ -219,18 +225,17 @@ public class PacketNEIRecipe extends WCTPacket {
/**
* Tries to extract an item from the player inventory. Does account for fuzzy items.
*
* @param player the {@link EntityPlayer} to extract from
* @param mode the {@link Actionable} to simulate or modulate the operation
* @param player the {@link EntityPlayer} to extract from
* @param mode the {@link Actionable} to simulate or modulate the operation
* @param patternItem which {@link ItemStack} to extract
* @return null or a found {@link ItemStack}
*/
private ItemStack extractItemFromPlayerInventory(
final EntityPlayer player, final Actionable mode, final ItemStack patternItem) {
private ItemStack extractItemFromPlayerInventory(final EntityPlayer player, final Actionable mode,
final ItemStack patternItem) {
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
final AEItemStack request = AEItemStack.create(patternItem);
// final boolean isSimulated = mode == Actionable.SIMULATE;
final boolean checkFuzzy = request.isOre()
|| patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE
final boolean checkFuzzy = request.isOre() || patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE
|| patternItem.hasTagCompound()
|| patternItem.isItemStackDamageable();
@@ -1,13 +1,14 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ContainerPlayer;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PacketOpenGui extends WCTPacket {
private final int whichGui;
@@ -29,7 +30,12 @@ public class PacketOpenGui extends WCTPacket {
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
if (player.openContainer instanceof ContainerPlayer) {
WCTGuiHandler.launchGui(
this.whichGui, player, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
this.whichGui,
player,
player.worldObj,
(int) player.posX,
(int) player.posY,
(int) player.posZ);
}
}
@@ -1,7 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
@@ -11,6 +9,9 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PacketSetMagnet extends WCTPacket {
int magnetDamage;
@@ -38,18 +39,12 @@ public class PacketSetMagnet extends WCTPacket {
if (magnetItem != null) {
if (magnetItem.getItemDamage() == 2) {
RandomUtils.getWirelessTerm(player.inventory)
.getTagCompound()
.getTagList("MagnetSlot", 10)
.getCompoundTagAt(0)
.setShort("Damage", (short) 0);
RandomUtils.getWirelessTerm(player.inventory).getTagCompound().getTagList("MagnetSlot", 10)
.getCompoundTagAt(0).setShort("Damage", (short) 0);
player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode1.getLocal()));
} else {
RandomUtils.getWirelessTerm(player.inventory)
.getTagCompound()
.getTagList("MagnetSlot", 10)
.getCompoundTagAt(0)
.setShort("Damage", (short) (magnetItem.getItemDamage() + 1));
RandomUtils.getWirelessTerm(player.inventory).getTagCompound().getTagList("MagnetSlot", 10)
.getCompoundTagAt(0).setShort("Damage", (short) (magnetItem.getItemDamage() + 1));
if (magnetItem.getItemDamage() == 0) {
player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode2.getLocal()));
} else {
@@ -1,8 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import appeng.util.Platform;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
@@ -10,6 +7,10 @@ import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import appeng.util.Platform;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PacketSwitchGuis extends WCTPacket {
private final int newGui;
@@ -1,5 +1,18 @@
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
import appeng.api.config.Settings;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
@@ -7,17 +20,6 @@ import appeng.container.AEBaseContainer;
import appeng.helpers.IMouseWheelItem;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
public class PacketValueConfig extends WCTPacket {
@@ -53,8 +55,7 @@ public class PacketValueConfig extends WCTPacket {
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
final Container c = player.openContainer;
if (this.Name.equals("Item")
&& RandomUtils.getWirelessTerm(player.inventory) != null
if (this.Name.equals("Item") && RandomUtils.getWirelessTerm(player.inventory) != null
&& RandomUtils.getWirelessTerm(player.inventory).getItem() instanceof IMouseWheelItem) {
final ItemStack is = RandomUtils.getWirelessTerm(player.inventory);
final IMouseWheelItem si = (IMouseWheelItem) is.getItem();
@@ -1,13 +1,14 @@
package net.p455w0rd.wirelesscraftingterminal.creativetab;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class CreativeTabWCT extends CreativeTabs {
public CreativeTabWCT(int id, String unlocalizedName) {
@@ -17,11 +17,24 @@ public class AchievementHandler {
new ItemStack(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem(), 1),
(Achievement) null);
public static final Achievement boosterAch = new Achievement(
"achievment.boosterAchievement", "boosterAchievement", 0, 2, ItemEnum.BOOSTER_ICON.getItem(), wctAch);
"achievment.boosterAchievement",
"boosterAchievement",
0,
2,
ItemEnum.BOOSTER_ICON.getItem(),
wctAch);
public static final Achievement magnetAch = new Achievement(
"achievement.magnetAchievement", "magnetAchievement", 2, 0, ItemEnum.MAGNET_CARD.getItem(), wctAch);
private static final AchievementPage achPage =
new AchievementPage("Wireless Crafting Term", wctAch, boosterAch, magnetAch);
"achievement.magnetAchievement",
"magnetAchievement",
2,
0,
ItemEnum.MAGNET_CARD.getItem(),
wctAch);
private static final AchievementPage achPage = new AchievementPage(
"Wireless Crafting Term",
wctAch,
boosterAch,
magnetAch);
public static void init() {
registerAchievements();
@@ -1,20 +1,22 @@
package net.p455w0rd.wirelesscraftingterminal.handlers;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import java.io.File;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.p455w0rd.wirelesscraftingterminal.common.WirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ConfigHandler {
/*
* A big part of what goes on here is reloading the cfg on-the-fly
* since Ender-Core adds the abilitty to modify config stuff while in game,
* I figured I'd add support for such possibilities
* A big part of what goes on here is reloading the cfg on-the-fly since Ender-Core adds the abilitty to modify
* config stuff while in game, I figured I'd add support for such possibilities
*/
public static Configuration config;
public static boolean enableInfinityBooster;
@@ -53,18 +55,17 @@ public class ConfigHandler {
String mineTweakerOverrideDesc = LocaleHandler.MineTweakerOverride.getLocal();
String doVersionCheckDesc = LocaleHandler.DoVersionCheck.getLocal();
String saveSearchStringDesc = LocaleHandler.SaveSearchString.getLocal();
enableInfinityBooster =
config.getBoolean("enableInfinityBooster", Configuration.CATEGORY_GENERAL, true, boosterDesc);
enableInfinityBooster = config
.getBoolean("enableInfinityBooster", Configuration.CATEGORY_GENERAL, true, boosterDesc);
enableEasyMode = config.getBoolean("enableEasyMode", Configuration.CATEGORY_GENERAL, false, easyModeDesc);
boosterDropsEnabled =
config.getBoolean("boosterDropsEnabled", Configuration.CATEGORY_GENERAL, true, boosterDropEnabledDesc);
mineTweakerOverride = config.getBoolean(
"mineTweakerOverride", Configuration.CATEGORY_GENERAL, false, mineTweakerOverrideDesc);
boosterDropsEnabled = config
.getBoolean("boosterDropsEnabled", Configuration.CATEGORY_GENERAL, true, boosterDropEnabledDesc);
mineTweakerOverride = config
.getBoolean("mineTweakerOverride", Configuration.CATEGORY_GENERAL, false, mineTweakerOverrideDesc);
doVersionCheck = config.getBoolean("doVersionCheck", Configuration.CATEGORY_GENERAL, true, doVersionCheckDesc);
/*
* I did the max power cfg loading like this because while using
* Configuration#getInt did enforce the min/max values in-game, it
* didn't properly update the config file
* I did the max power cfg loading like this because while using Configuration#getInt did enforce the min/max
* values in-game, it didn't properly update the config file
*/
Property pwrCfgKey = config.get(Configuration.CATEGORY_GENERAL, "ae2wctMaxPower", Reference.WCT_MAX_POWER);
pwrCfgKey.comment = pwrDesc;
@@ -84,8 +85,8 @@ public class ConfigHandler {
doSave = true;
}
Property boosterDropKey =
config.get(Configuration.CATEGORY_GENERAL, "boosterDropChance", Reference.WCT_BOOSTER_DROPCHANCE);
Property boosterDropKey = config
.get(Configuration.CATEGORY_GENERAL, "boosterDropChance", Reference.WCT_BOOSTER_DROPCHANCE);
boosterDropKey.comment = boosterDropDesc;
boosterDropKey.setDefaultValue(Reference.WCT_BOOSTER_DROPCHANCE);
@@ -124,7 +125,9 @@ public class ConfigHandler {
}
public static void reloadRecipes() {
RecipeHandler.loadRecipes(mtChanged);
if (!Loader.isModLoaded("dreamcraft")) {
RecipeHandler.loadRecipes(mtChanged);
}
mtChanged = false;
}
@@ -1,11 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.handlers;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.settings.KeyBinding;
@@ -18,8 +12,16 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketOpenGui;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetMagnet;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class KeybindHandler {
@@ -28,9 +30,9 @@ public class KeybindHandler {
public static KeyBinding changeMagnetMode;
public static void registerKeybinds() {
openTerminal = new KeyBinding("key.OpenTerminal", Keyboard.CHAR_NONE, "key.categories.ae2wct");
openMagnetFilter = new KeyBinding("key.OpenMagnetFilter", Keyboard.CHAR_NONE, "key.categories.ae2wct");
changeMagnetMode = new KeyBinding("key.SwitchMagnetMode", Keyboard.CHAR_NONE, "key.categories.ae2wct");
openTerminal = new KeyBinding("ae2wct.OpenTerminal", Keyboard.CHAR_NONE, "key.categories.ae2wct");
openMagnetFilter = new KeyBinding("ae2wct.OpenMagnetFilter", Keyboard.CHAR_NONE, "key.categories.ae2wct");
changeMagnetMode = new KeyBinding("ae2wct.SwitchMagnetMode", Keyboard.CHAR_NONE, "key.categories.ae2wct");
ClientRegistry.registerKeyBinding(openTerminal);
ClientRegistry.registerKeyBinding(openMagnetFilter);
ClientRegistry.registerKeyBinding(changeMagnetMode);
@@ -3,6 +3,7 @@ package net.p455w0rd.wirelesscraftingterminal.handlers;
import net.minecraft.util.StatCollector;
public enum LocaleHandler {
TitleDesc,
InfinityBoosterDesc,
WirelessTermLabel("gui.labels.ae2wct"),
@@ -1,8 +1,8 @@
package net.p455w0rd.wirelesscraftingterminal.handlers;
import cpw.mods.fml.common.registry.GameRegistry;
import java.util.ArrayList;
import java.util.Iterator;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@@ -12,6 +12,8 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import cpw.mods.fml.common.registry.GameRegistry;
public class RecipeHandler {
public static ArrayList<IRecipe> easyRecipeList = new ArrayList<IRecipe>();
@@ -28,88 +30,53 @@ public class RecipeHandler {
// EASY MODE RECIPES
// Wireless Crafting Terminal
easyRecipeList.add(new ShapedOreRecipe(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(), new Object[] {
"a",
"b",
"c",
Character.valueOf('a'),
new ItemStack(multiMaterial, 1, 41),
Character.valueOf('b'),
new ItemStack(multiPart, 1, 360),
Character.valueOf('c'),
new ItemStack(ae2WirelessTerm, 1, 0)
}));
easyRecipeList.add(
new ShapedOreRecipe(
ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(),
new Object[] { "a", "b", "c", Character.valueOf('a'), new ItemStack(multiMaterial, 1, 41),
Character.valueOf('b'), new ItemStack(multiPart, 1, 360), Character.valueOf('c'),
new ItemStack(ae2WirelessTerm, 1, 0) }));
// Magnet Card
easyRecipeList.add(new ShapedOreRecipe(ItemEnum.MAGNET_CARD.getStack(), new Object[] {
"a b",
"cdc",
"ccc",
Character.valueOf('a'),
"dustRedstone",
Character.valueOf('b'),
"gemLapis",
Character.valueOf('c'),
"ingotIron",
Character.valueOf('d'),
new ItemStack(multiMaterial, 1, 28)
}));
easyRecipeList.add(
new ShapedOreRecipe(
ItemEnum.MAGNET_CARD.getStack(),
new Object[] { "a b", "cdc", "ccc", Character.valueOf('a'), "dustRedstone",
Character.valueOf('b'), "gemLapis", Character.valueOf('c'), "ingotIron",
Character.valueOf('d'), new ItemStack(multiMaterial, 1, 28) }));
// Infinity Booster Card
easyRecipeList.add(new ShapedOreRecipe(ItemEnum.BOOSTER_CARD.getStack(), new Object[] {
"abc",
"ded",
"cba",
Character.valueOf('a'),
new ItemStack(blockSpatialIO, 1, 0),
Character.valueOf('b'),
new ItemStack(multiMaterial, 1, 42),
Character.valueOf('c'),
new ItemStack(blockCraftingStorage, 1, 3),
Character.valueOf('d'),
new ItemStack(multiMaterial, 1, 48),
Character.valueOf('e'),
new ItemStack(itemWAP, 1, 0)
}));
easyRecipeList.add(
new ShapedOreRecipe(
ItemEnum.BOOSTER_CARD.getStack(),
new Object[] { "abc", "ded", "cba", Character.valueOf('a'), new ItemStack(blockSpatialIO, 1, 0),
Character.valueOf('b'), new ItemStack(multiMaterial, 1, 42), Character.valueOf('c'),
new ItemStack(blockCraftingStorage, 1, 3), Character.valueOf('d'),
new ItemStack(multiMaterial, 1, 48), Character.valueOf('e'),
new ItemStack(itemWAP, 1, 0) }));
// ==================
// HARD MODE RECIPES
// Wireless Crafting Terminal
hardRecipeList.add(new ShapedOreRecipe(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(), new Object[] {
"aba",
"cdc",
"efe",
Character.valueOf('a'),
new ItemStack(multiMaterial, 1, 9),
Character.valueOf('b'),
new ItemStack(itemWAP, 1, 0),
Character.valueOf('c'),
new ItemStack(multiMaterial, 1, 12),
Character.valueOf('d'),
new ItemStack(multiPart, 1, 360),
Character.valueOf('e'),
new ItemStack(multiMaterial, 1, 38),
Character.valueOf('f'),
new ItemStack(multiMaterial, 1, 47)
}));
hardRecipeList.add(
new ShapedOreRecipe(
ItemEnum.WIRELESS_CRAFTING_TERMINAL.getStack(),
new Object[] { "aba", "cdc", "efe", Character.valueOf('a'), new ItemStack(multiMaterial, 1, 9),
Character.valueOf('b'), new ItemStack(itemWAP, 1, 0), Character.valueOf('c'),
new ItemStack(multiMaterial, 1, 12), Character.valueOf('d'),
new ItemStack(multiPart, 1, 360), Character.valueOf('e'),
new ItemStack(multiMaterial, 1, 38), Character.valueOf('f'),
new ItemStack(multiMaterial, 1, 47) }));
// Magnet Card
hardRecipeList.add(new ShapedOreRecipe(ItemEnum.MAGNET_CARD.getStack(), new Object[] {
"abc",
"ded",
"ddd",
Character.valueOf('a'),
"blockRedstone",
Character.valueOf('b'),
new ItemStack(multiPart, 1, 300),
Character.valueOf('c'),
"blockLapis",
Character.valueOf('d'),
"blockIron",
Character.valueOf('e'),
new ItemStack(multiMaterial, 1, 28)
}));
hardRecipeList.add(
new ShapedOreRecipe(
ItemEnum.MAGNET_CARD.getStack(),
new Object[] { "abc", "ded", "ddd", Character.valueOf('a'), "blockRedstone",
Character.valueOf('b'), new ItemStack(multiPart, 1, 300), Character.valueOf('c'),
"blockLapis", Character.valueOf('d'), "blockIron", Character.valueOf('e'),
new ItemStack(multiMaterial, 1, 28) }));
}
@SuppressWarnings("unchecked")
@@ -126,8 +93,7 @@ public class RecipeHandler {
}
// remove old recipes
Iterator<IRecipe> iterator =
CraftingManager.getInstance().getRecipeList().iterator();
Iterator<IRecipe> iterator = CraftingManager.getInstance().getRecipeList().iterator();
while (iterator.hasNext()) {
ItemStack r = iterator.next().getRecipeOutput();
for (IRecipe recipe : recipeList2) {
@@ -1,20 +1,22 @@
package net.p455w0rd.wirelesscraftingterminal.handlers;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
public class VersionCheckHandler {
int timer = 150;
@@ -43,8 +45,12 @@ public class VersionCheckHandler {
if (!fetchVersion().equals(Reference.VERSION) && !Reference.WCT_HASCHECKEDVERSION) {
Reference.WCT_HASCHECKEDVERSION = true;
player.addChatMessage(
new ChatComponentText(EnumChatFormatting.BLUE + "-=-=-=-=-=[" + EnumChatFormatting.WHITE
+ "Wireless Crafting Terminal" + EnumChatFormatting.BLUE + "]=-=-=-=-=-"));
new ChatComponentText(
EnumChatFormatting.BLUE + "-=-=-=-=-=["
+ EnumChatFormatting.WHITE
+ "Wireless Crafting Terminal"
+ EnumChatFormatting.BLUE
+ "]=-=-=-=-=-"));
player.addChatMessage(new ChatComponentText(LocaleHandler.NewVersionAvailable.getLocal()));
IChatComponent component = IChatComponent.Serializer.func_150699_a(LocaleHandler.ClickString.getLocal());
player.addChatComponentMessage(component);
@@ -57,9 +63,9 @@ public class VersionCheckHandler {
private String fetchVersion() {
try {
InputStream in = new URL(
new String(
"https://raw.githubusercontent.com/p455w0rd/WirelessCraftingTerminal/master/latestversionrv3.txt"))
.openStream();
new String(
"https://raw.githubusercontent.com/p455w0rd/WirelessCraftingTerminal/master/latestversionrv3.txt"))
.openStream();
BufferedReader r = new BufferedReader(new InputStreamReader(in));
return r.readLine();
} catch (MalformedURLException ignored) {
@@ -9,5 +9,5 @@ import java.lang.annotation.Target;
* Marker interface to help identify invocation of reflection
*/
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE, ElementType.METHOD})
@Target({ ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE, ElementType.METHOD })
public @interface Reflected {}
@@ -1,5 +1,12 @@
package net.p455w0rd.wirelesscraftingterminal.helpers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
import net.p455w0rd.wirelesscraftingterminal.api.networking.security.WCTIActionHost;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -27,12 +34,6 @@ import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.tile.networking.TileWireless;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
import net.p455w0rd.wirelesscraftingterminal.api.networking.security.WCTIActionHost;
public class WirelessTerminalGuiObject
implements IActionHost, IPortableCell, IInventorySlotAware, WCTIActionHost, IGuiItemObject {
@@ -49,14 +50,8 @@ public class WirelessTerminalGuiObject
private double myRange = Double.MAX_VALUE;
private final int inventorySlot;
public WirelessTerminalGuiObject(
final IWirelessTermHandler wh,
final ItemStack is,
final EntityPlayer ep,
final World w,
final int x,
final int y,
final int z) {
public WirelessTerminalGuiObject(final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep,
final World w, final int x, final int y, final int z) {
this.encryptionKey = wh.getEncryptionKey(is);
this.effectiveItem = is;
this.myPlayer = ep;
@@ -133,11 +128,11 @@ public class WirelessTerminalGuiObject
}
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public IItemList<IAEItemStack> getAvailableItems(final IItemList out) {
public IItemList<IAEItemStack> getAvailableItems(final IItemList out, int iteration) {
if (this.itemStorage != null) {
return this.itemStorage.getAvailableItems(out);
return this.itemStorage.getAvailableItems(out, iteration);
}
return out;
}
@@ -1,12 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.implementation;
import cpw.mods.fml.common.LoaderState;
import net.p455w0rd.wirelesscraftingterminal.api.IWCTInteractionHelper;
import net.p455w0rd.wirelesscraftingterminal.api.IWCTItems;
import net.p455w0rd.wirelesscraftingterminal.api.WCTApi;
import net.p455w0rd.wirelesscraftingterminal.common.WirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import cpw.mods.fml.common.LoaderState;
public class WCTAPIImplementation extends WCTApi {
private final WCTItems items;
@@ -1,7 +1,5 @@
package net.p455w0rd.wirelesscraftingterminal.implementation;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
@@ -14,12 +12,14 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketOpenGui;
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
public class WCTInteractionHelper implements IWCTInteractionHelper {
@Override
public void openWirelessCraftingTerminalGui(final EntityPlayer player) {
if ((player == null)
|| (player instanceof FakePlayer)
if ((player == null) || (player instanceof FakePlayer)
|| (player instanceof EntityPlayerMP)
|| FMLCommonHandler.instance().getSide() == Side.SERVER) {
return;
@@ -43,8 +43,8 @@ public class WCTInteractionHelper implements IWCTInteractionHelper {
}
}
public static boolean isTerminalLinked(
final IWirelessCraftingTermHandler wirelessTerminal, final ItemStack wirelessTerminalItemstack) {
public static boolean isTerminalLinked(final IWirelessCraftingTermHandler wirelessTerminal,
final ItemStack wirelessTerminalItemstack) {
return (!wirelessTerminal.getEncryptionKey(wirelessTerminalItemstack).isEmpty());
}
}
@@ -1,13 +1,15 @@
package net.p455w0rd.wirelesscraftingterminal.integration;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Loader;
import crazypants.enderio.enchantment.EnchantmentSoulBound;
import crazypants.enderio.enchantment.Enchantments;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
/**
* @author p455w0rd
@@ -1,6 +1,7 @@
package net.p455w0rd.wirelesscraftingterminal.integration;
public interface IIntegrationModule {
void init() throws Throwable;
void postInit();
@@ -1,10 +1,12 @@
package net.p455w0rd.wirelesscraftingterminal.integration;
import java.lang.reflect.Field;
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.ModNotInstalled;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModAPIManager;
import java.lang.reflect.Field;
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.ModNotInstalled;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
public final class IntegrationNode {
@@ -22,8 +24,8 @@ public final class IntegrationNode {
private Object instance;
private IIntegrationModule mod = null;
public IntegrationNode(
final String displayName, final String modID, final IntegrationType shortName, final String name) {
public IntegrationNode(final String displayName, final String modID, final IntegrationType shortName,
final String name) {
this.displayName = displayName;
this.shortName = shortName;
this.modID = modID;
@@ -53,13 +55,12 @@ public final class IntegrationNode {
switch (stage) {
case PRE_INIT:
final ModAPIManager apiManager = ModAPIManager.INSTANCE;
boolean enabled =
this.modID == null || Loader.isModLoaded(this.modID) || apiManager.hasAPI(this.modID);
boolean enabled = this.modID == null || Loader.isModLoaded(this.modID)
|| apiManager.hasAPI(this.modID);
if (enabled) {
this.classValue = this.getClass().getClassLoader().loadClass(this.name);
this.mod = (IIntegrationModule)
this.classValue.getConstructor().newInstance();
this.mod = (IIntegrationModule) this.classValue.getConstructor().newInstance();
final Field f = this.classValue.getField("instance");
f.set(this.classValue, this.setInstance(this.mod));
} else {
@@ -1,12 +1,15 @@
package net.p455w0rd.wirelesscraftingterminal.integration;
import java.util.Collection;
import java.util.LinkedList;
import javax.annotation.Nonnull;
import cpw.mods.fml.relauncher.FMLLaunchHandler;
import cpw.mods.fml.relauncher.Side;
import java.util.Collection;
import java.util.LinkedList;
import javax.annotation.Nonnull;
public enum IntegrationRegistry {
INSTANCE;
private static final String PACKAGE_PREFIX = "net.p455w0rd.wirelesscraftingterminal.integration.modules.";
@@ -53,8 +56,8 @@ public enum IntegrationRegistry {
builder.append(", ");
}
final String integrationState =
node.getShortName() + ":" + (node.getState() == IntegrationStage.FAILED ? "OFF" : "ON");
final String integrationState = node.getShortName() + ":"
+ (node.getState() == IntegrationStage.FAILED ? "OFF" : "ON");
builder.append(integrationState);
}
@@ -1,6 +1,7 @@
package net.p455w0rd.wirelesscraftingterminal.integration;
public enum IntegrationType {
RFItem(IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI"),
// Waila( IntegrationSide.BOTH, "Waila", "Waila" ),
@@ -1,21 +1,9 @@
package net.p455w0rd.wirelesscraftingterminal.integration.modules;
import appeng.api.AEApi;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler;
import appeng.util.Platform;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.API;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IStackPositioner;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerTooltipHandler;
import codechicken.nei.recipe.IRecipeHandler;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -35,7 +23,22 @@ import net.p455w0rd.wirelesscraftingterminal.integration.abstraction.INEI;
import net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler;
import net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers.NEIGUIHandler;
import appeng.api.AEApi;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler;
import appeng.util.Platform;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.API;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IStackPositioner;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerTooltipHandler;
import codechicken.nei.recipe.IRecipeHandler;
public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
@Reflected
public static NEI instance;
@@ -94,7 +97,12 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
GuiContainerManager.drawItems.renderItemAndEffectIntoGUI(fontRenderer, mc.getTextureManager(), stack, x, y);
GuiContainerManager.drawItems.renderItemOverlayIntoGUI(
fontRenderer, mc.getTextureManager(), stack, x, y, String.valueOf(stack.stackSize));
fontRenderer,
mc.getTextureManager(),
stack,
x,
y,
String.valueOf(stack.stackSize));
}
@Override
@@ -109,24 +117,20 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
}
@Override
public List<String> handleTooltip(
final GuiContainer arg0, final int arg1, final int arg2, final List<String> current) {
public List<String> handleTooltip(final GuiContainer arg0, final int arg1, final int arg2,
final List<String> current) {
return current;
}
@Override
public List<String> handleItemDisplayName(
final GuiContainer arg0, final ItemStack arg1, final List<String> current) {
public List<String> handleItemDisplayName(final GuiContainer arg0, final ItemStack arg1,
final List<String> current) {
return current;
}
@Override
public List<String> handleItemTooltip(
final GuiContainer guiScreen,
final ItemStack stack,
final int mouseX,
final int mouseY,
final List<String> currentToolTip) {
public List<String> handleItemTooltip(final GuiContainer guiScreen, final ItemStack stack, final int mouseX,
final int mouseY, final List<String> currentToolTip) {
if (guiScreen instanceof GuiWirelessCraftingTerminal) {
return ((GuiWirelessCraftingTerminal) guiScreen).handleItemTooltip(stack, mouseX, mouseY, currentToolTip);
}
@@ -146,10 +150,10 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
for (final PositionedStack positionedStack : stacks) {
if (positionedStack.items != null && positionedStack.items.length > 0) {
positionedStack.relx +=
ContainerWirelessCraftingTerminal.CRAFTING_SLOT_X_POS - NEI.NEI_REGULAR_SLOT_OFFSET_X;
positionedStack.rely +=
ContainerWirelessCraftingTerminal.CRAFTING_SLOT_Y_POS - NEI.NEI_REGULAR_SLOT_OFFSET_Y;
positionedStack.relx += ContainerWirelessCraftingTerminal.CRAFTING_SLOT_X_POS
- NEI.NEI_REGULAR_SLOT_OFFSET_X;
positionedStack.rely += ContainerWirelessCraftingTerminal.CRAFTING_SLOT_Y_POS
- NEI.NEI_REGULAR_SLOT_OFFSET_Y;
}
}
return stacks;
@@ -157,6 +161,7 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
}
public class WCTOverlayHandler implements IOverlayHandler {
/**
* Reduces regular slot offsets to 0, 1, or 2
*/
@@ -171,10 +176,10 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
*/
private boolean addCraftingItems(final PositionedStack ingredient, final IAEItemStack[] overlayItems) {
// Calculate the slot positions
int slotX =
(ingredient.relx - NEI.NEI_REGULAR_SLOT_OFFSET_X) / WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
int slotY =
(ingredient.rely - NEI.NEI_REGULAR_SLOT_OFFSET_Y) / WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
int slotX = (ingredient.relx - NEI.NEI_REGULAR_SLOT_OFFSET_X)
/ WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
int slotY = (ingredient.rely - NEI.NEI_REGULAR_SLOT_OFFSET_Y)
/ WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
// Calculate the slot index
int slotIndex = slotX + (slotY * 3);
// Add the item to the list
@@ -193,21 +198,19 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
// overlayItems);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void overlayRecipe(
final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex, final boolean shift) {
public void overlayRecipe(final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex,
final boolean shift) {
try {
final List ingredients = recipe.getIngredientStacks(recipeIndex);
this.overlayRecipe(gui, ingredients, shift);
} catch (final Exception ignored) {
} catch (final Error ignored) {
}
} catch (final Exception ignored) {} catch (final Error ignored) {}
}
@SuppressWarnings("unchecked")
private void overlayRecipe(
final GuiContainer gui, final List<PositionedStack> ingredients, final boolean shift) {
private void overlayRecipe(final GuiContainer gui, final List<PositionedStack> ingredients,
final boolean shift) {
try {
final NBTTagCompound recipe = new NBTTagCompound();
@@ -247,9 +250,7 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
NetworkHandler.instance.sendToServer(new PacketNEIRecipe(recipe));
}
} catch (final Exception ignored) {
} catch (final Error ignored) {
}
} catch (final Exception ignored) {} catch (final Error ignored) {}
}
}
}
@@ -1,5 +1,20 @@
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.MissingIngredientError;
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
import net.p455w0rd.wirelesscraftingterminal.api.recipes.IIngredient;
import net.p455w0rd.wirelesscraftingterminal.api.recipes.game.ShapedRecipe;
import appeng.core.AEConfig;
import appeng.util.Platform;
import codechicken.nei.NEIClientUtils;
@@ -11,19 +26,6 @@ import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.api.IStackPositioner;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.MissingIngredientError;
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
import net.p455w0rd.wirelesscraftingterminal.api.recipes.IIngredient;
import net.p455w0rd.wirelesscraftingterminal.api.recipes.game.ShapedRecipe;
public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler {
@@ -66,30 +68,16 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler {
}
}
}
/*
@Override
public void loadUsageRecipes( final ItemStack ingredient )
{
final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for( final IRecipe recipe : recipes )
{
if( ( recipe instanceof ShapedRecipe ) )
{
final CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
if( ( (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
{
cachedRecipe.computeVisuals();
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
{
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
this.arecipes.add( cachedRecipe );
}
}
}
}
}
*/
/*
* @Override public void loadUsageRecipes( final ItemStack ingredient ) { final List<IRecipe> recipes =
* CraftingManager.getInstance().getRecipeList(); for( final IRecipe recipe : recipes ) { if( ( recipe instanceof
* ShapedRecipe ) ) { final CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe ); if( (
* (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
* { cachedRecipe.computeVisuals(); if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) {
* cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient ); this.arecipes.add( cachedRecipe );
* } } } } }
*/
@Override
public String getGuiTexture() {
return "textures/gui/container/crafting_table.png";
@@ -171,7 +159,10 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler {
try {
final ItemStack[] is = ing.getItemStackSet();
final PositionedStack stack = new PositionedStack(
useSingleItems ? Platform.findPreferred(is) : is, 25 + x * 18, 6 + y * 18, false);
useSingleItems ? Platform.findPreferred(is) : is,
25 + x * 18,
6 + y * 18,
false);
stack.setMaxSize(1);
this.ingredients.add(stack);
} catch (final RegistrationError ignored) {
@@ -1,13 +1,8 @@
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.util.Platform;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.recipe.IRecipeHandler;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@@ -17,20 +12,25 @@ import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTermi
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.util.Platform;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.recipe.IRecipeHandler;
public class NEICraftingHandler implements IOverlayHandler {
public NEICraftingHandler(final int x, final int y) {}
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void overlayRecipe(
final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex, final boolean shift) {
public void overlayRecipe(final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex,
final boolean shift) {
try {
final List ingredients = recipe.getIngredientStacks(recipeIndex);
this.overlayRecipe(gui, ingredients, shift);
} catch (final Exception ignored) {
} catch (final Error ignored) {
}
} catch (final Exception ignored) {} catch (final Error ignored) {}
}
@SuppressWarnings("unchecked")
@@ -74,8 +74,6 @@ public class NEICraftingHandler implements IOverlayHandler {
NetworkHandler.instance.sendToServer(new PacketNEIRecipe(recipe));
}
} catch (final Exception ignored) {
} catch (final Error ignored) {
}
} catch (final Exception ignored) {} catch (final Error ignored) {}
}
}
@@ -1,11 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
import codechicken.nei.api.INEIGuiAdapter;
import java.util.regex.Pattern;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
import codechicken.nei.api.INEIGuiAdapter;
public class NEIGUIHandler extends INEIGuiAdapter {
protected Pattern SPECIAL_REGEX_CHARS = Pattern.compile("[{}()\\[\\].+*?^$\\\\|]");
@@ -15,9 +17,7 @@ public class NEIGUIHandler extends INEIGuiAdapter {
if (gui instanceof GuiWirelessCraftingTerminal && draggedStack != null && draggedStack.getItem() != null) {
GuiWirelessCraftingTerminal gmm = (GuiWirelessCraftingTerminal) gui;
if (gmm.isOverSearchField(mousex, mousey)) {
gmm.setSearchString(SPECIAL_REGEX_CHARS
.matcher(draggedStack.getDisplayName())
.replaceAll("\\\\$0"));
gmm.setSearchString(SPECIAL_REGEX_CHARS.matcher(draggedStack.getDisplayName()).replaceAll("\\\\$0"));
return true;
}
}
@@ -5,6 +5,7 @@ import net.p455w0rd.wirelesscraftingterminal.integration.IIntegrationModule;
import net.p455w0rd.wirelesscraftingterminal.integration.IntegrationHelper;
public class RFItem implements IIntegrationModule {
@Reflected
public static RFItem instance;
@@ -1,8 +1,9 @@
package net.p455w0rd.wirelesscraftingterminal.integration.modules.helpers;
import cofh.api.energy.IEnergyReceiver;
import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyReceiver;
public class NullRFHandler implements IEnergyReceiver {
@Override
@@ -1,12 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBoosterBGIcon extends Item {
public static IIcon[] boosterIcon;
@@ -22,8 +23,7 @@ public class ItemBoosterBGIcon extends Item {
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister register) {
boosterIcon[0] = register.registerIcon(
Reference.MODID + ":" + this.getUnlocalizedName().substring(5));
boosterIcon[0] = register.registerIcon(Reference.MODID + ":" + this.getUnlocalizedName().substring(5));
}
@SideOnly(Side.CLIENT)
@@ -4,6 +4,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public enum ItemEnum {
BOOSTER_CARD("infinityBoosterCard", new ItemInfinityBooster().setUnlocalizedName("infinityBoosterCard")),
BOOSTER_ICON("infinityBoosterIcon", new ItemInfinityBooster().hasEffect(true)),
WIRELESS_CRAFTING_TERMINAL("wirelessCraftingTerminal", new ItemWirelessCraftingTerminal()),
@@ -1,18 +1,22 @@
package net.p455w0rd.wirelesscraftingterminal.items;
import com.google.common.base.Splitter;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import org.apache.commons.lang3.text.WordUtils;
import org.lwjgl.input.Keyboard;
import com.google.common.base.Splitter;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemInfinityBooster extends Item {
public boolean showEffect = false;
@@ -39,14 +43,13 @@ public class ItemInfinityBooster extends Item {
return 1;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack is, EntityPlayer player, List list, boolean par4) {
String shift = LocaleHandler.PressShift.getLocal()
.replace(
"Shift",
color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
String shift = LocaleHandler.PressShift.getLocal().replace(
"Shift",
color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
list.add(color("aqua") + "==============================");
if (isShiftKeyDown()) {
String info = LocaleHandler.InfinityBoosterDesc.getLocal();
@@ -1,22 +1,9 @@
package net.p455w0rd.wirelesscraftingterminal.items;
import appeng.api.config.SecurityPermissions;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.networking.IGrid;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.ISecurityGrid;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
import appeng.util.Platform;
import com.google.common.base.Splitter;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
@@ -38,12 +25,28 @@ import net.p455w0rd.wirelesscraftingterminal.handlers.KeybindHandler;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import org.apache.commons.lang3.text.WordUtils;
import org.lwjgl.input.Keyboard;
import com.google.common.base.Splitter;
import appeng.api.config.SecurityPermissions;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.networking.IGrid;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.ISecurityGrid;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Jotato's amazing magnet item from QuantumFlux adapted for use in the Wireless
* Crafting Terminal
* Jotato's amazing magnet item from QuantumFlux adapted for use in the Wireless Crafting Terminal
*
* @author p455w0rd, Jotato
*
@@ -111,22 +114,31 @@ public class ItemMagnet extends Item {
if (isActivated(itemStack)) {
String boundKey = Keyboard.getKeyName(KeybindHandler.openMagnetFilter.getKeyCode());
if (!boundKey.equals("NONE")) {
list.add(color("italics") + LocaleHandler.OrPress.getLocal() + " " + color("yellow") + color("bold")
+ "[" + boundKey + "]");
list.add(
color("italics") + LocaleHandler.OrPress
.getLocal() + " " + color("yellow") + color("bold") + "[" + boundKey + "]");
}
String boundKey2 = Keyboard.getKeyName(KeybindHandler.changeMagnetMode.getKeyCode());
if (!boundKey2.equals("NONE")) {
list.add(color("italics") + LocaleHandler.Press.getLocal() + " " + color("yellow") + color("bold")
+ "[" + boundKey2 + "] " + color("gray") + color("italics")
+ LocaleHandler.ToSwitchMode.getLocal());
list.add(
color("italics") + LocaleHandler.Press.getLocal()
+ " "
+ color("yellow")
+ color("bold")
+ "["
+ boundKey2
+ "] "
+ color("gray")
+ color("italics")
+ LocaleHandler.ToSwitchMode.getLocal());
}
}
list.add("");
list.add(LocaleHandler.Status.getLocal() + ": "
+ (isActivated(is)
? color("green") + LocaleHandler.Active.getLocal()
: color("red") + LocaleHandler.Inactive.getLocal()));
list.add(
LocaleHandler.Status.getLocal() + ": "
+ (isActivated(is) ? color("green") + LocaleHandler.Active.getLocal()
: color("red") + LocaleHandler.Inactive.getLocal()));
if (is.getItemDamage() == 1) {
list.add(color("white") + " " + LocaleHandler.MagnetActiveDesc1.getLocal());
} else if (is.getItemDamage() == 2) {
@@ -180,13 +192,13 @@ public class ItemMagnet extends Item {
@Override
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
if (!world.isRemote) {
if (player.isSneaking()) {
switchMagnetMode(item, player);
} else {
if (!RandomUtils.isMagnetInitialized(item)) {
NetworkHandler.instance.sendToServer(new PacketMagnetFilter(0, true));
}
if (player.isSneaking() && !world.isRemote) {
switchMagnetMode(item, player);
} else {
if (!RandomUtils.isMagnetInitialized(item) && world.isRemote) {
NetworkHandler.instance.sendToServer(new PacketMagnetFilter(0, true));
}
if (!world.isRemote) {
int x = (int) player.posX;
int y = (int) player.posY;
int z = (int) player.posZ;
@@ -229,13 +241,12 @@ public class ItemMagnet extends Item {
// List<ItemStack> filteredList = getFilteredItems(getItemStack());
// items
Iterator<? extends Entity> iterator = getEntitiesInRange(
EntityItem.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
distanceFromPlayer)
.iterator();
EntityItem.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
distanceFromPlayer).iterator();
while (iterator.hasNext()) {
EntityItem itemToGet = (EntityItem) iterator.next();
if (itemToGet.func_145800_j() != null && itemToGet.func_145800_j().equals(player.getCommandSenderName())) {
@@ -262,13 +273,12 @@ public class ItemMagnet extends Item {
// xp
iterator = getEntitiesInRange(
EntityXPOrb.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
distanceFromPlayer)
.iterator();
EntityXPOrb.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
distanceFromPlayer).iterator();
while (iterator.hasNext()) {
EntityXPOrb xpToGet = (EntityXPOrb) iterator.next();
if (xpToGet.isDead || xpToGet.isInvisible()) {
@@ -288,8 +298,8 @@ public class ItemMagnet extends Item {
}
}
public void doVanillaPickup(
EntityItem itemToGet, EntityPlayer player, ItemStack itemStackToGet, World world, int stackSize) {
public void doVanillaPickup(EntityItem itemToGet, EntityPlayer player, ItemStack itemStackToGet, World world,
int stackSize) {
if (pickupTimer < 100) {
pickupTimer++;
return;
@@ -363,8 +373,7 @@ public class ItemMagnet extends Item {
}
// ignore nothing/don't use oredict--must be exact match
else {
if (isMetaEqual(is, thisStack)
&& ItemStack.areItemStackTagsEqual(is, thisStack)
if (isMetaEqual(is, thisStack) && ItemStack.areItemStackTagsEqual(is, thisStack)
&& is.getItem() == thisStack.getItem()) {
return true;
}
@@ -378,8 +387,8 @@ public class ItemMagnet extends Item {
return is1.getItemDamage() == is2.getItemDamage();
}
public boolean hasNetworkAccess(
final SecurityPermissions perm, final boolean requirePower, EntityPlayer player, ItemStack wirelessTerm) {
public boolean hasNetworkAccess(final SecurityPermissions perm, final boolean requirePower, EntityPlayer player,
ItemStack wirelessTerm) {
if (player.capabilities.isCreativeMode) {
return true;
}
@@ -423,13 +432,8 @@ public class ItemMagnet extends Item {
return null;
}
public boolean doInject(
IAEItemStack ais,
int stackSize,
EntityPlayer player,
EntityItem itemToGet,
ItemStack itemStackToGet,
World world) {
public boolean doInject(IAEItemStack ais, int stackSize, EntityPlayer player, EntityItem itemToGet,
ItemStack itemStackToGet, World world) {
ais = Platform.poweredInsert(powerSrc, cellInv, ais, mySrc);
if (ais != null) {
player.onItemPickup(itemToGet, stackSize);
@@ -475,12 +479,17 @@ public class ItemMagnet extends Item {
return true;
}
public static List<? extends Entity> getEntitiesInRange(
Class<?> entityType, World world, int x, int y, int z, int distance) {
public static List<? extends Entity> getEntitiesInRange(Class<?> entityType, World world, int x, int y, int z,
int distance) {
return world.getEntitiesWithinAABB(
entityType,
AxisAlignedBB.getBoundingBox(
x - distance, y - distance, z - distance, x + distance, y + distance, z + distance));
x - distance,
y - distance,
z - distance,
x + distance,
y + distance,
z + distance));
}
public ItemStack getStack() {
@@ -1,19 +1,7 @@
package net.p455w0rd.wirelesscraftingterminal.items;
import appeng.api.config.*;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.util.IConfigManager;
import appeng.items.tools.powered.powersink.AERootPoweredItem;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import baubles.api.BaubleType;
import baubles.api.IBauble;
import com.google.common.base.Optional;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -31,10 +19,34 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.integration.EnderIO;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import org.lwjgl.input.Keyboard;
import com.google.common.base.Optional;
import appeng.api.config.AccessRestriction;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.PowerUnits;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.util.IConfigManager;
import appeng.core.AppEng;
import appeng.items.tools.powered.powersink.AERootPoweredItem;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import baubles.api.BaubleType;
import baubles.api.expanded.IBaubleExpanded;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@cpw.mods.fml.common.Optional.Interface(iface = "baubles.api.expanded.IBaubleExpanded", modid = "Baubles|Expanded")
public class ItemWirelessCraftingTerminal extends AERootPoweredItem
implements IWirelessCraftingTerminalItem, IWirelessTermHandler, IBauble {
implements IWirelessCraftingTerminalItem, IWirelessTermHandler, IBaubleExpanded {
public static final String LINK_KEY_STRING = "key";
public static double GLOBAL_POWER_MULTIPLIER = PowerMultiplier.CONFIG.multiplier;
@@ -79,62 +91,37 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
return false;
}
/**
* This method return the type of bauble this is.
* Type is used to determine the slots it can go into.
*
* @param itemstack
*/
@Override
public BaubleType getBaubleType(ItemStack itemstack) {
public String[] getBaubleTypes(ItemStack itemstack) {
return new String[] { AppEng.BAUBLESLOT };
}
@Override
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
public BaubleType getBaubleType(ItemStack itemStack) {
return BaubleType.RING;
}
/**
* This method is called once per tick if the bauble is being worn by a player
*
* @param itemstack
* @param player
*/
@Override
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {}
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
public void onWornTick(ItemStack itemstack, EntityLivingBase player) { /**/ }
/**
* This method is called when the bauble is equipped by a player
*
* @param itemstack
* @param player
*/
@Override
public void onEquipped(ItemStack itemstack, EntityLivingBase player) {}
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
public void onEquipped(ItemStack itemstack, EntityLivingBase player) { /**/ }
/**
* This method is called when the bauble is unequipped by a player
*
* @param itemstack
* @param player
*/
@Override
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {}
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) { /**/ }
/**
* can this bauble be placed in a bauble slot
*
* @param itemstack
* @param player
*/
@Override
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
return true;
}
/**
* Can this bauble be removed from a bauble slot
*
* @param itemstack
* @param player
*/
@Override
@cpw.mods.fml.common.Optional.Method(modid = "Baubles")
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
return true;
}
@@ -216,7 +203,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
@Override
public boolean canHandle(final ItemStack is) {
return is.getItem() instanceof IWirelessCraftingTerminalItem;
return is != null && is.getItem() instanceof IWirelessCraftingTerminalItem;
}
@Override
@@ -234,8 +221,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
final ConfigManager out = new ConfigManager(new IConfigManagerHost() {
@Override
public void updateSetting(
final IConfigManager manager,
public void updateSetting(final IConfigManager manager,
@SuppressWarnings("rawtypes") final Enum settingName,
@SuppressWarnings("rawtypes") final Enum newValue) {
final NBTTagCompound data = Platform.openNbtData(target);
@@ -251,7 +237,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
return out;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void getCheckedSubItems(Item item, CreativeTabs creativeTab, List itemList) {
List itemList2 = itemList;
@@ -271,14 +257,13 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
return true;
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
@Override
public void addCheckedInformation(ItemStack is, EntityPlayer player, List list, boolean displayMore) {
String shift = LocaleHandler.PressShift.getLocal()
.replace(
"Shift",
color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
String shift = LocaleHandler.PressShift.getLocal().replace(
"Shift",
color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
final NBTTagCompound tag = ensureTagCompound(is);
String encKey = tag.getString("key");
@@ -292,19 +277,22 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
pctTxtColor = color("red") + "";
}
list.add(color("aqua") + "==============================");
list.add(StatCollector.translateToLocal("gui.appliedenergistics2.StoredEnergy") + ": " + pctTxtColor
+ (int) aeCurrPower + " AE - " + aeCurrPowerPct + "%");
list.add(
StatCollector.translateToLocal("gui.appliedenergistics2.StoredEnergy") + ": "
+ pctTxtColor
+ (int) aeCurrPower
+ " AE - "
+ aeCurrPowerPct
+ "%");
if (isShiftKeyDown()) {
String linked = color("red") + StatCollector.translateToLocal("gui.appliedenergistics2.Unlinked");
if (encKey != null && !encKey.isEmpty()) {
linked = color("blue") + StatCollector.translateToLocal("gui.appliedenergistics2.Linked");
}
list.add(LocaleHandler.LinkStatus.getLocal() + ": " + linked);
String boosterStatus = (checkForBooster(is)
? color("green") + "" + LocaleHandler.Installed.getLocal()
String boosterStatus = (checkForBooster(is) ? color("green") + "" + LocaleHandler.Installed.getLocal()
: color("red") + "" + LocaleHandler.NotInstalled.getLocal());
String magnetStatus = (isMagnetInstalled(is)
? color("green") + "" + LocaleHandler.Installed.getLocal()
String magnetStatus = (isMagnetInstalled(is) ? color("green") + "" + LocaleHandler.Installed.getLocal()
: color("red") + "" + LocaleHandler.NotInstalled.getLocal());
if (Reference.WCT_BOOSTER_ENABLED) {
list.add(getItemName("infinityBoosterCard") + ": " + boosterStatus);
@@ -457,7 +445,8 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
double currentAEPower = getAECurrentPower(container);
if ((int) currentAEPower < Reference.WCT_MAX_POWER) {
int leftOver = (int) PowerUnits.AE.convertTo(
PowerUnits.RF, injectAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxReceive)));
PowerUnits.RF,
injectAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxReceive)));
return maxReceive - leftOver;
} else {
return 0;
@@ -478,7 +467,8 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
}
} else {
return (int) PowerUnits.AE.convertTo(
PowerUnits.RF, extractAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxExtract)));
PowerUnits.RF,
extractAEPower(container, PowerUnits.RF.convertTo(PowerUnits.AE, maxExtract)));
}
}
@@ -1,12 +1,13 @@
package net.p455w0rd.wirelesscraftingterminal.proxy;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.p455w0rd.wirelesscraftingterminal.handlers.KeybindHandler;
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
public class ClientProxy extends CommonProxy {
public ClientProxy() {
@@ -1,18 +1,10 @@
package net.p455w0rd.wirelesscraftingterminal.proxy;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
import appeng.api.storage.data.IAEItemStack;
import baubles.api.BaublesApi;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import static net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils.isBaublesLoaded;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityItem;
@@ -42,6 +34,18 @@ import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
import appeng.api.storage.data.IAEItemStack;
import baubles.api.BaublesApi;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
public class CommonProxy {
Achievement wctAch = AchievementHandler.wctAch;
@@ -72,19 +76,23 @@ public class CommonProxy {
} else {
playerInv = player.inventory;
}
IInventory handler = BaublesApi.getBaubles(player);
if (handler != null) {
for (int i = 0; i < handler.getSizeInventory(); ++i) {
ItemStack item = handler.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = item;
break;
if (isBaublesLoaded) {
IInventory handler = BaublesApi.getBaubles(player);
if (handler != null) {
for (int i = 0; i < handler.getSizeInventory(); ++i) {
ItemStack item = handler.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = item;
break;
}
}
}
}
if (wirelessTerm == null) {
int invSize = playerInv.getSizeInventory();
if (invSize <= 0) {
@@ -137,14 +145,11 @@ public class CommonProxy {
ConfigHandler.reloadRecipes();
}
/* NH fork definitely does not need version checking
if ((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) {
WCTLog.info("Dev environment detected, skipping version check");
}
else {
new VersionCheckHandler();
}
*/
/*
* NH fork definitely does not need version checking if ((Boolean)
* Launch.blackboard.get("fml.deobfuscatedEnvironment")) {
* WCTLog.info("Dev environment detected, skipping version check"); } else { new VersionCheckHandler(); }
*/
} else {
final PacketConfigSync p = new PacketConfigSync(
Reference.WCT_MAX_POWER,
@@ -161,7 +166,11 @@ public class CommonProxy {
if (!Reference.WCT_EASYMODE_ENABLED && Reference.WCT_BOOSTER_ENABLED && Reference.WCT_BOOSTERDROP_ENABLED) {
ItemStack stack = new ItemStack(ItemEnum.BOOSTER_CARD.getItem());
EntityItem drop = new EntityItem(
event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, stack);
event.entity.worldObj,
event.entity.posX,
event.entity.posY,
event.entity.posZ,
stack);
if (event.entity instanceof EntityDragon) {
event.drops.add(drop);
}
@@ -202,7 +211,12 @@ public class CommonProxy {
ItemMagnet magnet = (ItemMagnet) magnetStack.getItem();
magnet.obj = ContainerWirelessCraftingTerminal.getGuiObject(
WCTStack, player, world, (int) player.posX, (int) player.posY, (int) player.posZ);
WCTStack,
player,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ);
magnet.civ = magnet.obj;
magnet.powerSrc = magnet.civ;
magnet.monitor = magnet.civ.getItemInventory();
@@ -216,8 +230,7 @@ public class CommonProxy {
List<ItemStack> filteredList = magnet.getFilteredItems(magnetStack);
IAEItemStack ais = AEApi.instance().storage().createItemStack(stack);
if (magnet.getMode(magnetStack)) { // whitelisting
if (filteredList != null
&& magnet.isItemFiltered(stack, filteredList)
if (filteredList != null && magnet.isItemFiltered(stack, filteredList)
&& filteredList.size() > 0) {
if (magnet.doInject(ais, stack.stackSize, player, itemEntity, stack, world)) {
stack = null;
@@ -234,16 +247,14 @@ public class CommonProxy {
"random.pop",
0.15F,
((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F
+ 1.0F)
* 2.0F);
+ 1.0F) * 2.0F);
}
} else {
magnet.doVanillaPickup(itemEntity, player, stack, world, stack.stackSize);
}
}
} else { // blacklisting
if (!magnet.isItemFiltered(stack, filteredList)
|| filteredList == null
if (!magnet.isItemFiltered(stack, filteredList) || filteredList == null
|| filteredList.size() <= 0) {
if (magnet.doInject(ais, stack.stackSize, player, itemEntity, stack, world)) {
stack = null;
@@ -261,8 +272,7 @@ public class CommonProxy {
"random.pop",
0.15F,
((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F
+ 1.0F)
* 2.0F);
+ 1.0F) * 2.0F);
}
} else {
magnet.doVanillaPickup(itemEntity, player, stack, world, stack.stackSize);
@@ -283,8 +293,7 @@ public class CommonProxy {
@SubscribeEvent
public void onPlayerCraftingEvent(final PlayerEvent.ItemCraftedEvent event) {
if (event.player == null
|| event.player.isDead
if (event.player == null || event.player.isDead
|| event.player instanceof FakePlayer
|| event.crafting == null) {
return;
@@ -302,12 +311,9 @@ public class CommonProxy {
}
/*
* if (event.crafting.getItem() ==
* ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem()) {
* AchievementHandler.triggerAch(wctAch, event.player); if
* (Reference.WCT_BOOSTER_ENABLED) {
* AchievementHandler.addAchievementToPage(AchievementHandler.
* boosterAch, true, event.player); } }
* if (event.crafting.getItem() == ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem()) {
* AchievementHandler.triggerAch(wctAch, event.player); if (Reference.WCT_BOOSTER_ENABLED) {
* AchievementHandler.addAchievementToPage(AchievementHandler. boosterAch, true, event.player); } }
*/
if (Reference.WCT_BOOSTER_ENABLED && Reference.WCT_EASYMODE_ENABLED) {
if (event.crafting.getItem() == ItemEnum.BOOSTER_CARD.getItem()) {
@@ -1,14 +1,14 @@
package net.p455w0rd.wirelesscraftingterminal.reference;
public class Reference {
public static final String MODID = "ae2wct";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String NAME = "AE2 Wireless Crafting Terminal";
public static final String SERVER_PROXY_CLASS = "net.p455w0rd.wirelesscraftingterminal.proxy.CommonProxy";
public static final String CLIENT_PROXY_CLASS = "net.p455w0rd.wirelesscraftingterminal.proxy.ClientProxy";
public static final String GUI_FACTORY = "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiFactory";
public static final String CREDITS_LIST =
"brandon3055, Techjar, AlgorythmX2, thatsIch, Nividica, squeek502, M3gaFr3ak, DrummerMC, cpw, LexManos, Pahimar, diesieben07, Wuppy, Jabelar, blay09, SirSengir, mezz, jotato";
public static final String CREDITS_LIST = "brandon3055, Techjar, AlgorythmX2, thatsIch, Nividica, squeek502, M3gaFr3ak, DrummerMC, cpw, LexManos, Pahimar, diesieben07, Wuppy, Jabelar, blay09, SirSengir, mezz, jotato";
public static final String CONFIG_FILE = "WirelessCraftingTerminal.cfg";
public static boolean WCT_DIDTHEDIDDLE = false;
public static int WCT_MAX_POWER = 1600000;
@@ -22,10 +22,9 @@ public class Reference {
public static boolean WCT_HASCHECKEDVERSION = false;
// Gui IDs
private static int ae2wctGuiIndex = 0;
public static final int GUI_WCT = ++ae2wctGuiIndex;
public static final int GUI_CRAFTING_STATUS = ++ae2wctGuiIndex;
public static final int GUI_CRAFT_AMOUNT = ++ae2wctGuiIndex;
public static final int GUI_CRAFT_CONFIRM = ++ae2wctGuiIndex;
public static final int GUI_MAGNET = ++ae2wctGuiIndex;
public static final int GUI_WCT = 0;
public static final int GUI_CRAFTING_STATUS = 1;
public static final int GUI_CRAFT_AMOUNT = 2;
public static final int GUI_CRAFT_CONFIRM = 3;
public static final int GUI_MAGNET = 4;
}
@@ -1,14 +1,10 @@
//**************************//
//WIRELESS CRAFTING TEMRINAL//
//**************************//
//Items
#Items
item.wirelessCraftingTerminal.name=Drahtlose Fertigungskonsole
item.infinityBoosterCard.name=Unendliche Drahtlosverstärkerkarte
item.magnetCard.name=Magnetkarte
itemGroup.ae2wct=§9AE2 Wireless Crafting Terminal
//Tooltips
#Tooltips
gui.tooltips.ae2wct.PressShift=Infos via Shiftklick
gui.tooltips.ae2wct.OnlyWorks=Funktioniert nur im Slot der drahtlosen Fertigungskonsole
gui.tooltips.ae2wct.TitleDesc=Beschreibung
@@ -41,10 +37,10 @@ gui.tooltips.ae2wct.OrPress=or press
gui.tooltips.ae2wct.Press=Press
gui.tooltips.ae2wct.ToSwitchMode=to switch magnet mode
//Labels
#Labels
gui.labels.ae2wct.WirelessTermLabel=Drahtloskonsole
//Config Descriptions
#Config Descriptions
config.ae2wct.MaxPowerDesc=In der Drahtloskonsole maximal speicherbare Energie in AE
config.ae2wct.InfinityBoosterCfgDesc=Erlaube das unendliche Drahtlosverstärkerupgrade
config.ae2wct.EasyModeDesc=Aktiviere den "Einfachen Modus" (Einfachere Rezepte + Rezept für unendlichen Drahtlosverstärker)
@@ -55,7 +51,7 @@ config.ae2wct.DoVersionCheck=Check for updates
config.ae2wct.NewVersionAvailable=New version of Wireless Crafting Terminal is available!
config.ae2wct.ClickString=["Click here to go to download page [",{"text":"Download","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to download the latest version","color":"green"}},"clickEvent":{"action":"open_url","value":"http://minecraft.curseforge.com/projects/wireless-crafting-terminal"}},"]"]
//Achievements
#Achievements
achievement.wctAchievement=Digitales Fertigen über WLAN
achievement.wctAchievement.desc=Fertige eine drahtlose Fertigungskonsole
achievement.boosterAchievement=Interdimensionales Fertigen
@@ -63,15 +59,15 @@ achievement.boosterAchievement.desc=Erwerbe eine unendliche Drahtlosverstärkerk
achievement.magnetAchievement=Digitales Staubsaugen!
achievement.magnetAchievement.desc=Fertige eine Magnetkarte
//Chat Messages
#Chat Messages
chatmessages.ae2wct.NoNetworkPower=Netzwerk hat keine Energie!
chatmessages.ae2wct.MagnetMode1=Magnetkarte deaktiviert
chatmessages.ae2wct.MagnetMode2=Magnetkarte aktiviert - Items, die nicht im AE-Netzwerk gespeichert sind, werden im Inventar platziert
chatmessages.ae2wct.MagnetMode3=Magnetkarte aktiviert - Items, die nicht im AE-Netzwerk gespeichert sind, werden auf dem Boden liegen gelassen
chatmessages.ae2wct.InitializeMagnet=Vor dem Benutzen des Tastenkürzels muss zuerst mit der Magnetkarte in der Hand ein Rechtsklick ausgeführt werden!
//Keybindings
key.OpenTerminal=Öffne drahtlose Fertigungskonsole
key.OpenMagnetFilter=Öffne Magnetkartenfilter-GUI
key.SwitchMagnetMode=Aktiviere/Deaktiviere Magnetkarte
#Keybindings
ae2wct.OpenTerminal=Öffne drahtlose Fertigungskonsole
ae2wct.OpenMagnetFilter=Öffne Magnetkartenfilter-GUI
ae2wct.SwitchMagnetMode=Aktiviere/Deaktiviere Magnetkarte
key.categories.ae2wct=Wireless Crafting Terminal
@@ -1,14 +1,10 @@
//**************************//
//WIRELESS CRAFTING TEMRINAL//
//**************************//
//Items
#Items
item.wirelessCraftingTerminal.name=Wireless Crafting Terminal
item.infinityBoosterCard.name=Infinity Booster Card
item.magnetCard.name=Magnet Card
itemGroup.ae2wct=§9AE2 Wireless Crafting Terminal
//Tooltips
#Tooltips
gui.tooltips.ae2wct.PressShift=Hold Shift for Info
gui.tooltips.ae2wct.OnlyWorks=Only works when in Wireless Crafting Terminal slot!
gui.tooltips.ae2wct.TitleDesc=Description
@@ -41,10 +37,10 @@ gui.tooltips.ae2wct.OrPress=or press
gui.tooltips.ae2wct.Press=Press
gui.tooltips.ae2wct.ToSwitchMode=to switch magnet mode
//Labels
#Labels
gui.labels.ae2wct.WirelessTermLabel=Wireless Term
//Config Descriptions
#Config Descriptions
config.ae2wct.MaxPowerDesc=Maximum Power in AE units the wireless terminal can hold
config.ae2wct.InfinityBoosterCfgDesc=Enable Infinite Range Booster Upgrade
config.ae2wct.EasyModeDesc=Enable Easy Mode (Easier Recipes+Infinity Booster Recipe)
@@ -54,7 +50,7 @@ config.ae2wct.MineTweakerOverride=Enable MineTweaker Override (true=disables all
config.ae2wct.DoVersionCheck=Check for updates
config.ae2wct.ClickString=["Click here to go to download page [",{"text":"Download","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to download the latest version","color":"green"}},"clickEvent":{"action":"open_url","value":"http://minecraft.curseforge.com/projects/wireless-crafting-terminal"}},"]"]
//Achievements
#Achievements
achievement.wctAchievement=Digital Crafting Over WiFi
achievement.wctAchievement.desc=Craft a Wireless Crafting Terminal
achievement.boosterAchievement=Interdimensional Crafting Sack
@@ -62,15 +58,15 @@ achievement.boosterAchievement.desc=Aquire an Infinity Booster Card
achievement.magnetAchievement=Digital Hoover
achievement.magnetAchievement.desc=Craft a Magnet Card
//Chat Messages
#Chat Messages
chatmessages.ae2wct.NoNetworkPower=Network has no power!
chatmessages.ae2wct.MagnetMode1=Magnet Card Deactivated
chatmessages.ae2wct.MagnetMode2=Magnet Card Activated - Items not stored in AE network will be placed in inventory
chatmessages.ae2wct.MagnetMode3=Magnet Card Activated - Items not stored in AE network will be left on ground
chatmessages.ae2wct.InitializeMagnet=You must first right-click with the Magnet Card in hand before using the keybind!
//Keybindings
key.OpenTerminal=Open Wireless Crafting Terminal
key.OpenMagnetFilter=Open Magnet Card Filter GUI
key.SwitchMagnetMode=Activate/Deactivate Magnet Card
key.categories.ae2wct=Wireless Crafting Terminal
#Keybindings
ae2wct.OpenTerminal=Open Wireless Crafting Terminal
ae2wct.OpenMagnetFilter=Open Magnet Card Filter GUI
ae2wct.SwitchMagnetMode=Activate/Deactivate Magnet Card
key.categories.ae2wct=Wireless Crafting Terminal
Loaded 100 of 104 files, more files were not shown because too many files have changed in this diff. Show more