Compare commits

...
28 Commits
Author SHA1 Message Date
Martin Robertz 626b96a91e Merge pull request #16 from GTNewHorizons/use-new-crafting-monitor
Use the new crafting monitor
2022-05-06 18:24:40 +02:00
Jakub Szewczyk 506cf78f4e Use AE2 crafting status screen instead of a copy of the old one 2022-05-05 18:10:21 +01:00
Jakub Szewczyk 3aa59a3cba Update buildscript 2022-05-05 17:29:47 +01:00
Martin Robertz ee5bfc213d Merge pull request #15 from GTNewHorizons/openTerminal
Fix not being able to open terminal in some cases
2022-05-03 15:22:57 +02:00
miozune c265b71dc3 Fix not being able to open terminal in some cases 2022-05-02 19:42:06 +09:00
Martin Robertz ba49449781 Merge pull request #14 from GTNewHorizons/searchbox-improvements
Searchbox improvements
2022-04-22 18:09:42 +02:00
miozune 89189dbff1 Searchbox improvements 2022-04-22 23:34:06 +09:00
Martin Robertz eb2e654b52 Merge pull request #13 from GTNewHorizons/feature/saveSearchConfig
Use AE2 config setting to save search string in WCT
2022-04-02 16:13:33 +02:00
repo_alt db9977b715 Use AE2 config setting to save search string in WCT
closes https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/9848
2022-04-02 11:51:49 +03:00
Martin Robertz 978fc5f7c6 Merge pull request #12 from GTNewHorizons/feature/CraftingMatrixSave
fix saving WCT crafting matrix
2022-03-05 12:26:06 +01:00
bombcar 4c246b7093 fix build 2022-02-28 13:05:54 -06:00
repo_alt b8ecbbb567 fix saving WCT crafting matrix
closes https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/9293
2022-02-28 21:33:59 +03:00
Jason Mitchell f0978c8e00 update to explicit dependencies 2022-01-18 19:37:14 -08:00
Jason Mitchell 0c3d47b3aa maven publish buildscript update 2022-01-18 19:36:34 -08:00
Martin Robertz 3bf3b800d3 Merge pull request #11 from slprime/escape-drop-to-search
Escape drop to search string
2022-01-04 19:39:54 +01:00
Serghei Borovetchi d73eccc895 escape drop to search string 2022-01-04 20:26:10 +02:00
Martin Robertz e06f6a9e15 Merge pull request #10 from GTNewHorizons/unified-build-script
Unified build script
2021-12-20 12:41:08 +01:00
Johann Bernhardt 16542a5bee Migrated to unified build script 2021-12-19 23:23:09 +01:00
Johann Bernhardt e117e7a9fc Moved sources an resources 2021-12-19 23:22:40 +01:00
Martin Robertz 7a485cd53c Merge pull request #9 from repo-alt/master
Drag & drop from NEI to search support
2021-12-15 13:14:42 +01:00
repo_alt dbf53773c3 Drag & drop from NEI to search support
https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/9094
2021-12-14 12:50:59 +03:00
Martin Robertz 9ce6963f09 Merge pull request #7 from repo-alt/master
Add the Save search string button on the wireless crafting terminal
2021-11-07 07:52:59 +01:00
repo_alt 8e7991d2b7 Add the Save search string button on the wireless crafting terminal
https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/8682
2021-11-07 09:31:58 +03:00
DreamMasterXXL a288f5fcfd bump version 2021-10-16 23:04:12 +02:00
Martin Robertz 8ce8c34a5e Merge pull request #6 from repo-alt/master
Do not allow putting WCT into itself
2021-09-28 18:28:20 +02:00
repo_alt 8e3d9da2f6 Do not allow putting WCT into itself
Close GUI for thrown out terminal
2021-09-28 16:43:17 +03:00
Martin Robertz db504c19bf Merge pull request #5 from D-Cysteine/add-view-cell
Add view cell support
2021-08-07 20:44:10 +02:00
D-Cysteine fe387220ba Add view cell support 2021-08-06 20:12:15 -06:00
195 changed files with 1614 additions and 1438 deletions

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
# This is the universal Text Editor Configuration
# for all GTNewHorizons projects
# See: https://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{bat,ini}]
end_of_line = crlf
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
indent_size = 2
+51
View File
@@ -0,0 +1,51 @@
#!/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
+45
View File
@@ -0,0 +1,45 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build and test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Run server for 1.5 minutes
run: |
mkdir run
echo "eula=true" > run/eula.txt
timeout 90 ./gradlew runServer 2>&1 | tee -a server.log || true
- name: Test no errors reported during server run
run: |
chmod +x .github/scripts/test_no_error_reports
.github/scripts/test_no_error_reports
+51
View File
@@ -0,0 +1,51 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release tagged build
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Release under current tag
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
prerelease: false
title: "${{ env.RELEASE_VERSION }}"
files: build/libs/*.jar
- name: Publish to Maven
run: ./gradlew publish
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
+27 -21
View File
@@ -1,25 +1,31 @@
bin
libs
run
*.class
.gradle
.settings
/.idea/
/run/
/build/
/eclipse/
.classpath
build
.project
.idea
*.launch
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
WirelessCraftingTerminal.iml
WirelessCraftingTerminal.ipr
WirelessCraftingTerminal.iws
/bin/
/config/
/crash-reports/
/logs/
options.txt
/saves/
usernamecache.json
banned-ips.json
banned-players.json
eula.txt
ops.json
server.properties
servers.dat
usercache.json
whitelist.json
/out/
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
*.bat
out/
*.DS_Store
!gradlew.bat
-16
View File
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WirelessCraftingTerminal-Bigbass</name>
<comment/>
<projects/>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<linkedResources/>
</projectDescription>
-14
View File
@@ -1,14 +0,0 @@
#
#Thu Dec 22 15:15:52 EST 2016
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-4
View File
@@ -1,4 +0,0 @@
7b794048-f144-40bb-83dd-4789a5cf7cc8
74e9c6b2-c8e8-449c-a8c5-6bb514544759
7b44b6f9-0610-49fa-af9e-b2703c51a4f1
7a1bb7c4-a3eb-460e-8229-7a40f46f76bd
+3
View File
@@ -0,0 +1,3 @@
# Any Github changes require admin approval
/.github/** @GTNewHorizons/admin
+3
View File
@@ -0,0 +1,3 @@
compileJava {
options.encoding = "UTF-8"
}
+708 -77
View File
@@ -1,116 +1,747 @@
//version: 1650343995
/*
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.
*/
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.util.concurrent.TimeUnit
buildscript {
repositories {
mavenCentral()
maven {
name = "gt"
url = "https://gregtech.overminddl1.com/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
name 'forge'
url 'https://maven.minecraftforge.net'
}
maven {
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/'
}
maven {
name 'jitpack'
url 'https://jitpack.io'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
}
}
apply plugin: 'forge'
targetCompatibility=7
sourceCompatibility=7
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 '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
}
version = minecraft_version + "-" + aeversion + "-" + wctbuild + "" + wctchannel
group = wctgroup
archivesBaseName = wctbasename
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
}
}
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.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
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()) {
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 = minecraft_version + "-" + forge_version
runDir = "run"
replaceIn "Reference.java"
replaceIn "package-info.java"
replace "@version@", project.version
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)
}
}
jar {
include "net/p455w0rd/wirelesscraftingterminal/**"
include "cofh/api/**"
include "assets/**"
include "ic2/**"
include "mcmod.info"
include "pack.mcmeta"
if(file('addon.gradle').exists()) {
apply from: 'addon.gradle'
}
task deobfJar(type: Jar) { // Generate deobfuscated
from sourceSets.main.output
classifier = 'deobf'
}
task sourceJar(type: Jar) { // Generate sources
from sourceSets.main.allSource
classifier = 'sources'
}
tasks.build.dependsOn('sourceJar', 'deobfJar')
artifacts {
archives deobfJar
archives sourceJar
archives jar
apply from: 'repositories.gradle'
configurations {
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
implementation.extendsFrom(shadowCompile)
implementation.extendsFrom(shadeCompile)
}
repositories {
maven {
name "ChickenBones"
url "http://chickenbones.net/maven/"
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
maven { // EnderIO & EnderCore
name 'tterrag Repo'
url "http://maven.tterrag.com"
}
maven {
url = "http://gregtech.overminddl1.com/"
if(usesMixins.toBoolean()) {
maven {
name 'sponge'
url 'https://repo.spongepowered.org/repository/maven-public'
}
maven {
url 'https://jitpack.io'
}
}
maven {
url "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/"
}
}
dependencies {
compile("appeng:appliedenergistics2:rv3-beta-31:dev") {
transitive = false
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')
// 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')
}
compile("com.enderio:EnderIO:1.7.10-2.3.0.417_beta:dev") {
transitive = false
}
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev"
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev"
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev"
compile "com.enderio.core:EnderCore:1.7.10-0.1.0.25_beta:dev"
compile "com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf"
}
sourceSets {
main {
java {
srcDir "src/java/"
}
apply from: 'dependencies.gradle'
resources {
srcDir "src/resources/"
include "assets/ae2wct/lang/*.lang",
"assets/ae2wct/textures/gui/*",
"assets/ae2wct/textures/items/*",
"assets/ae2wct/textures/cape/*",
"mcmod.info",
"pack.mcmeta"
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
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': minecraft_version
// 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'
}
}
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 (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/main/build.gradle")
}
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!")
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'
}
// 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 = 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/" + String.valueOf(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 fileName) {
String cacheDir = System.getProperty("user.home") + "/.gradle/caches/"
String bon2Dir = cacheDir + "forge_gradle/deobf"
String bon2File = bon2Dir + "/BON2-2.5.0.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)
}
download.run {
src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.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', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
workingDir bon2Dir
standardOutput = new ByteArrayOutputStream()
}
return files(deobfFile)
}
// 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)
}
+10
View File
@@ -0,0 +1,10 @@
// Add your dependencies here
dependencies {
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-83-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.12-GTNH:dev")
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev")
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.32:dev") { transitive = false }
}
+63 -10
View File
@@ -1,11 +1,64 @@
aeversion=rv3
wctchannel=
wctbuild=1.8.7.8-GTNH
wctgroup=net.p455w0rd.wirelesscraftingterminal
wctbasename=WirelessCraftingTerminal
modName = AE2 Wireless Crafting Terminal
#########################################################
# Versions #
#########################################################
minecraft_version=1.7.10
forge_version=10.13.4.1614-1.7.10
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = ae2wct
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/
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
minecraftVersion = 1.7.10
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
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 =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# 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
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
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = 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
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.
usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
customArchiveBaseName = WirelessCraftingTerminal
Binary file not shown.
+1 -2
View File
@@ -1,6 +1,5 @@
#Sat Jan 04 01:52:14 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
Vendored Regular → Executable
+77 -53
View File
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
@@ -6,47 +22,6 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@@ -61,9 +36,49 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
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"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# 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
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -90,7 +105,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
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
@@ -110,10 +125,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# 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`
@@ -154,11 +170,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# 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"
# 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")"
fi
exec "$JAVACMD" "$@"
Vendored
+20 -10
View File
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -8,14 +24,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@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"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +62,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
+2
View File
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCIWorkspace
-1
View File
@@ -1 +0,0 @@
1.7.10-rv2-1.8.7b
-1
View File
@@ -1 +0,0 @@
1.7.10-rv3-1.8.7.4b
Binary file not shown.
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
// 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"
}
}
@@ -1,476 +0,0 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.lwjgl.opengl.GL11;
import com.google.common.base.Joiner;
import appeng.api.AEApi;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiScrollbar;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftingCPU;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
public class GuiCraftingCPU extends WCTBaseGui implements ISortSource
{
private static final int GUI_HEIGHT = 184;
private static final int GUI_WIDTH = 238;
private static final int DISPLAYED_ROWS = 6;
private static final int TEXT_COLOR = 0x404040;
private static final int BACKGROUND_ALPHA = 0x5A000000;
private static final int SECTION_LENGTH = 67;
private static final int SCROLLBAR_TOP = 19;
private static final int SCROLLBAR_LEFT = 218;
private static final int SCROLLBAR_HEIGHT = 137;
private static final int CANCEL_LEFT_OFFSET = 163;
private static final int CANCEL_TOP_OFFSET = 25;
private static final int CANCEL_HEIGHT = 20;
private static final int CANCEL_WIDTH = 50;
private static final int TITLE_TOP_OFFSET = 7;
private static final int TITLE_LEFT_OFFSET = 8;
private static final int ITEMSTACK_LEFT_OFFSET = 9;
private static final int ITEMSTACK_TOP_OFFSET = 22;
private final ContainerCraftingCPU craftingCpu;
private IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
private IItemList<IAEItemStack> active = AEApi.instance().storage().createItemList();
private IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
private List<IAEItemStack> visual = new ArrayList<IAEItemStack>();
private GuiButton cancel;
private int tooltip = -1;
public GuiCraftingCPU( final InventoryPlayer inventoryPlayer, final Object te )
{
this( new ContainerCraftingCPU( inventoryPlayer, te ) );
}
protected GuiCraftingCPU( final ContainerCraftingCPU container )
{
super( container );
this.craftingCpu = container;
this.ySize = GUI_HEIGHT;
this.xSize = GUI_WIDTH;
final GuiScrollbar scrollbar = new GuiScrollbar();
this.setScrollBar( scrollbar );
}
public void clearItems()
{
this.storage = AEApi.instance().storage().createItemList();
this.active = AEApi.instance().storage().createItemList();
this.pending = AEApi.instance().storage().createItemList();
this.visual = new ArrayList<IAEItemStack>();
}
@Override
protected void actionPerformed( final GuiButton btn )
{
super.actionPerformed( btn );
if( this.cancel == btn )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileCrafting.Cancel", "Cancel" ) );
}
catch( final IOException e )
{
WCTLog.debug( e.getMessage() );
}
}
}
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
super.initGui();
this.setScrollBar();
this.cancel = new GuiButton( 0, this.guiLeft + CANCEL_LEFT_OFFSET, this.guiTop + this.ySize - CANCEL_TOP_OFFSET, CANCEL_WIDTH, CANCEL_HEIGHT, GuiText.Cancel.getLocal() );
this.buttonList.add( this.cancel );
}
private void setScrollBar()
{
final int size = this.visual.size();
this.getScrollBar().setTop( SCROLLBAR_TOP ).setLeft( SCROLLBAR_LEFT ).setHeight( SCROLLBAR_HEIGHT );
this.getScrollBar().setRange( 0, ( size + 2 ) / 3 - DISPLAYED_ROWS, 1 );
}
@Override
public void drawScreen( final int mouseX, final int mouseY, final float btn )
{
this.cancel.enabled = !this.visual.isEmpty();
final int gx = ( this.width - this.xSize ) / 2;
final int gy = ( this.height - this.ySize ) / 2;
this.tooltip = -1;
final int offY = 23;
int y = 0;
int x = 0;
for( int z = 0; z <= 4 * 5; z++ )
{
final int minX = gx + 9 + x * 67;
final int minY = gy + 22 + y * offY;
if( minX < mouseX && minX + 67 > mouseX )
{
if( minY < mouseY && minY + offY - 2 > mouseY )
{
this.tooltip = z;
break;
}
}
x++;
if( x > 2 )
{
y++;
x = 0;
}
}
super.drawScreen( mouseX, mouseY, btn );
}
@Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{
String title = this.getGuiDisplayName( GuiText.CraftingStatus.getLocal() );
if( this.craftingCpu.getEstimatedTime() > 0 && !this.visual.isEmpty() )
{
final long etaInMilliseconds = TimeUnit.MILLISECONDS.convert( this.craftingCpu.getEstimatedTime(), TimeUnit.NANOSECONDS );
final String etaTimeText = DurationFormatUtils.formatDuration( etaInMilliseconds, GuiText.ETAFormat.getLocal() );
title += " - " + etaTimeText;
}
this.fontRendererObj.drawString( title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR );
int x = 0;
int y = 0;
final int viewStart = this.getScrollBar().getCurrentScroll() * 3;
final int viewEnd = viewStart + 3 * 6;
String dspToolTip = "";
final List<String> lineList = new LinkedList<String>();
int toolPosX = 0;
int toolPosY = 0;
final int offY = 23;
final ReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ )
{
final IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z );
if( refStack != null )
{
GL11.glPushMatrix();
GL11.glScaled( 0.5, 0.5, 0.5 );
final IAEItemStack stored = this.storage.findPrecise( refStack );
final IAEItemStack activeStack = this.active.findPrecise( refStack );
final IAEItemStack pendingStack = this.pending.findPrecise( refStack );
int lines = 0;
if( stored != null && stored.getStackSize() > 0 )
{
lines++;
}
boolean active = false;
if( activeStack != null && activeStack.getStackSize() > 0 )
{
lines++;
active = true;
}
boolean scheduled = false;
if( pendingStack != null && pendingStack.getStackSize() > 0 )
{
lines++;
scheduled = true;
}
if( AEConfig.instance.useColoredCraftingStatus && ( active || scheduled ) )
{
final int bgColor = ( active ? AEColor.Green.blackVariant : AEColor.Yellow.blackVariant ) | BACKGROUND_ALPHA;
final int startX = ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET ) * 2;
final int startY = ( ( y * offY + ITEMSTACK_TOP_OFFSET ) - 3 ) * 2;
drawRect( startX, startY, startX + ( SECTION_LENGTH * 2 ), startY + ( offY * 2 ) - 2, bgColor );
}
final int negY = ( ( lines - 1 ) * 5 ) / 2;
int downY = 0;
if( stored != null && stored.getStackSize() > 0 )
{
final String str = GuiText.Stored.getLocal() + ": " + converter.toWideReadableForm( stored.getStackSize() );
final int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR );
if( this.tooltip == z - viewStart )
{
lineList.add( GuiText.Stored.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
}
downY += 5;
}
if( activeStack != null && activeStack.getStackSize() > 0 )
{
final String str = GuiText.Crafting.getLocal() + ": " + converter.toWideReadableForm( activeStack.getStackSize() );
final int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR );
if( this.tooltip == z - viewStart )
{
lineList.add( GuiText.Crafting.getLocal() + ": " + Long.toString( activeStack.getStackSize() ) );
}
downY += 5;
}
if( pendingStack != null && pendingStack.getStackSize() > 0 )
{
final String str = GuiText.Scheduled.getLocal() + ": " + converter.toWideReadableForm( pendingStack.getStackSize() );
final int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR );
if( this.tooltip == z - viewStart )
{
lineList.add( GuiText.Scheduled.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
}
}
GL11.glPopMatrix();
final int posX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19;
final int posY = y * offY + ITEMSTACK_TOP_OFFSET;
final ItemStack is = refStack.copy().getItemStack();
if( this.tooltip == z - viewStart )
{
dspToolTip = Platform.getItemDisplayName( is );
if( lineList.size() > 0 )
{
addItemTooltip(is, lineList);
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
}
toolPosX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 8;
toolPosY = y * offY + ITEMSTACK_TOP_OFFSET;
}
this.drawItem( posX, posY, is );
x++;
if( x > 2 )
{
y++;
x = 0;
}
}
}
if( this.tooltip >= 0 && dspToolTip.length() > 0 )
{
this.drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
}
}
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{
this.bindTexture( "appliedenergistics2", "guis/craftingcpu.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
public void postUpdate( final List<IAEItemStack> list, final byte ref )
{
switch( ref )
{
case 0:
for( final IAEItemStack l : list )
{
this.handleInput( this.storage, l );
}
break;
case 1:
for( final IAEItemStack l : list )
{
this.handleInput( this.active, l );
}
break;
case 2:
for( final IAEItemStack l : list )
{
this.handleInput( this.pending, l );
}
break;
}
for( final IAEItemStack l : list )
{
final long amt = this.getTotal( l );
if( amt <= 0 )
{
this.deleteVisualStack( l );
}
else
{
final IAEItemStack is = this.findVisualStack( l );
is.setStackSize( amt );
}
}
this.setScrollBar();
}
private void handleInput( final IItemList<IAEItemStack> s, final IAEItemStack l )
{
IAEItemStack a = s.findPrecise( l );
if( l.getStackSize() <= 0 )
{
if( a != null )
{
a.reset();
}
}
else
{
if( a == null )
{
s.add( l.copy() );
a = s.findPrecise( l );
}
if( a != null )
{
a.setStackSize( l.getStackSize() );
}
}
}
private long getTotal( final IAEItemStack is )
{
final IAEItemStack a = this.storage.findPrecise( is );
final IAEItemStack b = this.active.findPrecise( is );
final IAEItemStack c = this.pending.findPrecise( is );
long total = 0;
if( a != null )
{
total += a.getStackSize();
}
if( b != null )
{
total += b.getStackSize();
}
if( c != null )
{
total += c.getStackSize();
}
return total;
}
private void deleteVisualStack( final IAEItemStack l )
{
final Iterator<IAEItemStack> i = this.visual.iterator();
while( i.hasNext() )
{
final IAEItemStack o = i.next();
if( o.equals( l ) )
{
i.remove();
return;
}
}
}
private IAEItemStack findVisualStack( final IAEItemStack l )
{
for( final IAEItemStack o : this.visual )
{
if( o.equals( l ) )
{
return o;
}
}
final IAEItemStack stack = l.copy();
this.visual.add( stack );
return stack;
}
@SuppressWarnings("rawtypes")
@Override
public Enum getSortBy()
{
return SortOrder.NAME;
}
@SuppressWarnings("rawtypes")
@Override
public Enum getSortDir()
{
return SortDir.ASCENDING;
}
@SuppressWarnings("rawtypes")
@Override
public Enum getSortDisplay()
{
return ViewItems.ALL;
}
}
@@ -1,277 +0,0 @@
package net.p455w0rd.wirelesscraftingterminal.common.container;
import java.io.IOException;
import appeng.api.AEApi;
import appeng.api.networking.IGrid;
import appeng.api.networking.crafting.CraftingItemList;
import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.helpers.ICustomNameObject;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.util.Platform;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
import net.p455w0rd.wirelesscraftingterminal.common.container.guisync.GuiSync;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMEInventoryUpdate;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
public class ContainerCraftingCPU extends WCTBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject
{
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
private CraftingCPUCluster monitor = null;
private String cpuName = null;
private final WirelessTerminalGuiObject obj;
@GuiSync( 0 )
public long eta = -1;
public ContainerCraftingCPU( final InventoryPlayer ip, final Object te )
{
super( ip, te );
this.obj = getGuiObject(RandomUtils.getWirelessTerm(ip), ip.player, ip.player.worldObj, (int) ip.player.posX, (int) ip.player.posY, (int) ip.player.posZ);
if (this.obj == null) {
this.setValidContainer(false);
}
/*
final IGridHost host = (IGridHost) ( te instanceof IGridHost ? te : null );
if( host != null )
{
this.findNode( host, ForgeDirection.UNKNOWN );
for( final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
{
this.findNode( host, d );
}
}
if( te instanceof TileCraftingTile )
{
this.setCPU( (ICraftingCPU) ( (IAEMultiBlock) te ).getCluster() );
}
if( this.getNetwork() == null && Platform.isServer() )
{
this.setValidContainer( false );
}
*/
}
protected 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);
if (wh != null) {
return new WirelessTerminalGuiObject(wh, it, player, w, x, y, z);
}
}
return null;
}
protected void setCPU( final ICraftingCPU c )
{
if( c == this.getMonitor() )
{
return;
}
if( this.getMonitor() != null )
{
this.getMonitor().removeListener( this );
}
for( final Object g : this.crafters )
{
if( g instanceof EntityPlayer )
{
try
{
NetworkHandler.instance.sendTo( new PacketValueConfig( "CraftingStatus", "Clear" ), (EntityPlayerMP) g );
}
catch( final IOException e )
{
WCTLog.debug( e.getMessage() );
}
}
}
if( c instanceof CraftingCPUCluster )
{
this.cpuName = c.getName();
this.setMonitor( (CraftingCPUCluster) c );
this.list.resetStatus();
this.getMonitor().getListOfItem( this.list, CraftingItemList.ALL );
this.getMonitor().addListener( this, null );
this.setEstimatedTime( 0 );
}
else
{
this.setMonitor( null );
this.cpuName = "";
this.setEstimatedTime( -1 );
}
}
public void cancelCrafting()
{
if( this.getMonitor() != null )
{
this.getMonitor().cancel();
}
this.setEstimatedTime( -1 );
}
@Override
public void removeCraftingFromCrafters( final ICrafting c )
{
super.removeCraftingFromCrafters( c );
if( this.crafters.isEmpty() && this.getMonitor() != null )
{
this.getMonitor().removeListener( this );
}
}
@Override
public void onContainerClosed( final EntityPlayer player )
{
super.onContainerClosed( player );
if( this.getMonitor() != null )
{
this.getMonitor().removeListener( this );
}
}
@Override
public void detectAndSendChanges()
{
if( Platform.isServer() && this.getMonitor() != null && !this.list.isEmpty() )
{
try
{
if( this.getEstimatedTime() >= 0 )
{
final long elapsedTime = this.getMonitor().getElapsedTime();
final double remainingItems = this.getMonitor().getRemainingItemCount();
final double startItems = this.getMonitor().getStartItemCount();
final long eta = (long) ( elapsedTime / Math.max( 1d, ( startItems - remainingItems ) ) * remainingItems );
this.setEstimatedTime( eta );
}
final PacketMEInventoryUpdate a = new PacketMEInventoryUpdate( (byte) 0 );
final PacketMEInventoryUpdate b = new PacketMEInventoryUpdate( (byte) 1 );
final PacketMEInventoryUpdate c = new PacketMEInventoryUpdate( (byte) 2 );
for( final IAEItemStack out : this.list )
{
a.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.STORAGE ) );
b.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.ACTIVE ) );
c.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.PENDING ) );
}
this.list.resetStatus();
for( final Object g : this.crafters )
{
if( g instanceof EntityPlayer )
{
if( !a.isEmpty() )
{
NetworkHandler.instance.sendTo( a, (EntityPlayerMP) g );
}
if( !b.isEmpty() )
{
NetworkHandler.instance.sendTo( b, (EntityPlayerMP) g );
}
if( !c.isEmpty() )
{
NetworkHandler.instance.sendTo( c, (EntityPlayerMP) g );
}
}
}
}
catch( final IOException e )
{
// :P
}
}
super.detectAndSendChanges();
}
@Override
public boolean isValid( final Object verificationToken )
{
return true;
}
@Override
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final BaseActionSource actionSource )
{
for( IAEItemStack is : change )
{
is = is.copy();
is.setStackSize( 1 );
this.list.add( is );
}
}
@Override
public void onListUpdate()
{
}
@Override
public String getCustomName()
{
return this.cpuName;
}
@Override
public boolean hasCustomName()
{
return this.cpuName != null && this.cpuName.length() > 0;
}
public long getEstimatedTime()
{
return this.eta;
}
private void setEstimatedTime( final long eta )
{
this.eta = eta;
}
CraftingCPUCluster getMonitor()
{
return this.monitor;
}
private void setMonitor( final CraftingCPUCluster monitor )
{
this.monitor = monitor;
}
IGrid getNetwork()
{
return this.obj.getTargetGrid();
}
}
@@ -1,156 +0,0 @@
package net.p455w0rd.wirelesscraftingterminal.common.container;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.google.common.collect.ImmutableSet;
import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.storage.ITerminalHost;
import net.minecraft.entity.player.InventoryPlayer;
import net.p455w0rd.wirelesscraftingterminal.common.container.guisync.GuiSync;
public class ContainerCraftingStatus extends ContainerCraftingCPU
{
private final List<CraftingCPURecord> cpus = new ArrayList<CraftingCPURecord>();
@GuiSync( 5 )
public int selectedCpu = -1;
@GuiSync( 6 )
public boolean noCPU = true;
@GuiSync( 7 )
public String myName = "";
public ContainerCraftingStatus( final InventoryPlayer ip, final ITerminalHost te )
{
super( ip, te );
}
@Override
public void detectAndSendChanges()
{
final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class );
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
int matches = 0;
boolean changed = false;
for( final ICraftingCPU c : cpuSet )
{
boolean found = false;
for( final CraftingCPURecord ccr : this.cpus )
{
if( ccr.getCpu() == c )
{
found = true;
}
}
final boolean matched = this.cpuMatches( c );
if( matched )
{
matches++;
}
if( found == !matched )
{
changed = true;
}
}
if( changed || this.cpus.size() != matches )
{
this.cpus.clear();
for( final ICraftingCPU c : cpuSet )
{
if( this.cpuMatches( c ) )
{
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
}
}
this.sendCPUs();
}
this.noCPU = this.cpus.isEmpty();
super.detectAndSendChanges();
}
private boolean cpuMatches( final ICraftingCPU c )
{
return c.isBusy();
}
private void sendCPUs()
{
Collections.sort( this.cpus );
if( this.selectedCpu >= this.cpus.size() )
{
this.selectedCpu = -1;
this.myName = "";
}
else if( this.selectedCpu != -1 )
{
this.myName = this.cpus.get( this.selectedCpu ).getName();
}
if( this.selectedCpu == -1 && this.cpus.size() > 0 )
{
this.selectedCpu = 0;
}
if( this.selectedCpu != -1 )
{
if( this.cpus.get( this.selectedCpu ).getCpu() != this.getMonitor() )
{
this.setCPU( this.cpus.get( this.selectedCpu ).getCpu() );
}
}
else
{
this.setCPU( null );
}
}
public void cycleCpu( final boolean next )
{
if( next )
{
this.selectedCpu++;
}
else
{
this.selectedCpu--;
}
if( this.selectedCpu < -1 )
{
this.selectedCpu = this.cpus.size() - 1;
}
else if( this.selectedCpu >= this.cpus.size() )
{
this.selectedCpu = -1;
}
if( this.selectedCpu == -1 && this.cpus.size() > 0 )
{
this.selectedCpu = 0;
}
if( this.selectedCpu == -1 )
{
this.myName = "";
this.setCPU( null );
}
else
{
this.myName = this.cpus.get( this.selectedCpu ).getName();
this.setCPU( this.cpus.get( this.selectedCpu ).getCpu() );
}
}
}
@@ -1,50 +0,0 @@
package net.p455w0rd.wirelesscraftingterminal.integration;
import java.lang.invoke.MethodHandle;
import java.util.Iterator;
import java.util.Map;
import cpw.mods.fml.common.Loader;
import crazypants.enderio.enchantment.EnchantmentSoulBound;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
import p455w0rdslib.util.ReflectionUtils;
/**
* @author p455w0rd
*
*/
public class EnderIO {
public static boolean isLoaded() {
return Loader.isModLoaded("EnderIO");
}
@SuppressWarnings("rawtypes")
public static boolean isSoulBound(ItemStack stack) {
if (isLoaded() && crazypants.enderio.config.Config.enchantmentSoulBoundEnabled) {
try {
MethodHandle GET_SOULBOUND = ReflectionUtils.findFieldGetter(crazypants.enderio.enchantment.Enchantments.class, "soulBound");
EnchantmentSoulBound soulbound = (EnchantmentSoulBound) GET_SOULBOUND.invoke(crazypants.enderio.enchantment.Enchantments.getInstance());
MethodHandle GET_ID = ReflectionUtils.findFieldGetter(crazypants.enderio.enchantment.EnchantmentSoulBound.class, "id");
int soulboundId = (int) GET_ID.invoke(soulbound);
//int soulboundId = crazypants.enderio.config.Config.enchantmentSoulBoundId;
Map<Short, Short> enchants = EnchantmentHelper.getEnchantments(stack);
if (enchants != null) {
Iterator i = enchants.keySet().iterator();
while (i.hasNext()) {
int enchId = (int) i.next();
if (soulboundId != enchId) {
continue;
}
return true;
}
}
}
catch (Throwable e) {
}
}
return false;
}
}
@@ -1,35 +1,25 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui;
import java.io.IOException;
import org.lwjgl.input.Mouse;
import appeng.container.implementations.ContainerCraftingStatus;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.core.localization.GuiText;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTabButton;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftingStatus;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
public class GuiCraftingStatus extends GuiCraftingCPU
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus
{
private final ContainerCraftingStatus status;
private GuiButton selectCPU;
private GuiTabButton originalGuiBtn;
private int originalGui;
private ItemStack myIcon = null;
@@ -37,10 +27,10 @@ public class GuiCraftingStatus extends GuiCraftingCPU
@SuppressWarnings("unused")
public GuiCraftingStatus( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
super( new ContainerCraftingStatus( inventoryPlayer, te ) );
super( inventoryPlayer, te );
this.status = (ContainerCraftingStatus) this.inventorySlots;
final Object target = this.status.getTarget();
ContainerCraftingStatus status = (ContainerCraftingStatus) this.inventorySlots;
final Object target = status.getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
@@ -50,7 +40,7 @@ public class GuiCraftingStatus extends GuiCraftingCPU
{
this.myIcon = wirelessTerminalStack;
}
ItemStack is = new ItemStack(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem());
((ItemWirelessCraftingTerminal) is.getItem()).injectAEPower(is, 6400001);
myIcon = is;
@@ -64,20 +54,6 @@ public class GuiCraftingStatus extends GuiCraftingCPU
{
super.actionPerformed( btn );
final boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.selectCPU )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
catch( final IOException e )
{
WCTLog.debug( e.getMessage() );
}
}
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
@@ -90,52 +66,10 @@ public class GuiCraftingStatus extends GuiCraftingCPU
{
super.initGui();
this.selectCPU = new GuiButton( 0, this.guiLeft + 8, this.guiTop + this.ySize - 25, 150, 20, GuiText.CraftingCPU.getLocal() + ": " + GuiText.NoCraftingCPUs );
// selectCPU.enabled = false;
this.buttonList.add( this.selectCPU );
if( this.myIcon != null )
{
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, this.myIcon, this.myIcon.getDisplayName(), itemRender ) );
this.originalGuiBtn.setHideEdge( 13 );
}
}
@Override
public void drawScreen( final int mouseX, final int mouseY, final float btn )
{
this.updateCPUButtonText();
super.drawScreen( mouseX, mouseY, btn );
}
private void updateCPUButtonText()
{
String btnTextText = GuiText.NoCraftingJobs.getLocal();
if( this.status.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if( this.status.myName.length() > 0 )
{
final String name = this.status.myName.substring( 0, Math.min( 20, this.status.myName.length() ) );
btnTextText = GuiText.CPUs.getLocal() + ": " + name;
}
else
{
btnTextText = GuiText.CPUs.getLocal() + ": #" + this.status.selectedCpu;
}
}
if( this.status.noCPU )
{
btnTextText = GuiText.NoCraftingJobs.getLocal();
}
this.selectCPU.displayString = btnTextText;
}
@Override
protected String getGuiDisplayName( final String in )
{
return in; // the cup name is on the button
}
}
@@ -1,6 +1,7 @@
package net.p455w0rd.wirelesscraftingterminal.client.gui;
import java.io.IOException;
import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
@@ -13,6 +14,10 @@ import java.util.Locale;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import appeng.client.ActionKey;
import appeng.core.CommonHelper;
import codechicken.nei.TextField;
import cpw.mods.fml.relauncher.ReflectionHelper;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -21,10 +26,7 @@ import org.lwjgl.opengl.GL12;
import com.google.common.base.Joiner;
import com.google.common.base.Stopwatch;
import appeng.api.config.ActionItems;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.TerminalStyle;
import appeng.api.config.*;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
@@ -94,7 +96,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
private float xSize_lo;
private float ySize_lo;
public static int tick = 0, GUI_HEIGHT = 240, GUI_WIDTH = 198, AE_ROW_HEIGHT = 18, AE_NUM_ROWS = 0,
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 = 81, SEARCH_Y = 5, 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,
@@ -102,7 +104,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
protected static final int BUTTON_SEARCH_MODE_ID = 5;
protected static final long TOOLTIP_UPDATE_INTERVAL = 3000L;
private int currScreenWidth, currScreenHeight;
private static final String bgTexturePath = "gui/crafting.png";
private static final String bgTexturePath = "gui/crafting_viewcell.png";
private final ContainerWirelessCraftingTerminal containerWCT;
private boolean isFullScreen, init = true, reInit, wasResized = false;
public static GuiWirelessCraftingTerminal INSTANCE;
@@ -133,6 +135,10 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
private GuiImgButton clearBtn;
private GuiTrashButton trashBtn;
private GuiImgButton terminalStyleBox;
private GuiImgButton searchStringSave;
private boolean isAutoFocus = false;
private int currentMouseX = 0;
private int currentMouseY = 0;
public boolean devicePowered = false;
private boolean isNEIEnabled;
private boolean wasTextboxFocused = false;
@@ -142,6 +148,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
private int standardSize;
private final int lowerTextureOffset = 0;
private int rows = 0;
private final ItemStack[] myCurrentViewCells = new ItemStack[5];
public GuiWirelessCraftingTerminal(Container container) {
super(container);
@@ -173,7 +180,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
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 ) );
}
protected void setScrollBar(final GuiScrollbar myScrollBar) {
this.scrollBar = myScrollBar;
}
@@ -200,6 +207,10 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
if (btn == this.searchBoxSettings) {
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
}
else if( btn == this.searchStringSave )
{
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
}
else {
try {
NetworkHandler.instance.sendToServer(new PacketValueConfig(iBtn.getSetting().name(), next.name()));
@@ -282,7 +293,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
void setReservedSpace(final int reservedSpace) {
this.reservedSpace = reservedSpace;
}
public int getStandardSize()
{
return this.standardSize;
@@ -370,7 +381,10 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
this.buttonList.add(this.searchBoxSettings = new GuiImgButton(this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE)));
offset += 20;
this.buttonList.add( this.searchStringSave = new GuiImgButton( this.guiLeft - 18, offset, Settings.SAVE_SEARCH, AEConfig.instance.preserveSearchBar ? YesNo.YES : YesNo.NO ) );
offset += 20;
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings.getSetting( Settings.TERMINAL_STYLE ) ) );
this.searchField = new MEGuiTextField(this.fontRendererObj, SEARCH_X, SEARCH_Y, SEARCH_WIDTH, SEARCH_HEIGHT);
@@ -384,14 +398,16 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
this.buttonList.add(this.craftingStatusBtn = new GuiTabButton(this.guiLeft + 169, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(), itemRender));
this.craftingStatusBtn.setHideEdge(13);
final Enum setting = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
this.searchField.setFocused(SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting);
final Enum searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
this.isAutoFocus = SearchBoxMode.AUTOSEARCH == searchMode || SearchBoxMode.NEI_AUTOSEARCH == searchMode;
this.searchField.setFocused(this.isAutoFocus);
if (AEConfig.instance.preserveSearchBar || this.isSubGui()) {
this.searchField.setText(memoryText);
this.repo.setSearchString(memoryText);
}
if (this.isSubGui()) {
if (this.isSubGui()) {
this.searchField.setText(memoryText);
this.repo.setSearchString(memoryText);
}
this.repo.updateView();
this.setScrollBar();
}
@@ -432,10 +448,10 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
/**
* Called every tick. It is used in this instance to detect screen size
* changes to automatically update the gui height.
*
*
* reInit variable is used to call initGui() on the next tick. It has to be
* called this way to update correctly.
*
*
* @author p455w0rd
*/
@Override
@@ -484,7 +500,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
/**
* Detects if the window has been resized
*
*
* @return True if window has been resized
* @author p455w0rd
*/
@@ -637,6 +653,9 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
if (this.searchField != null) {
this.searchField.drawTextBox();
}
this.currentMouseX = mouseX;
this.currentMouseY = mouseY;
}
/**
@@ -674,29 +693,44 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
this.bindTexture(bgTexturePath);
final int x_width = 199;
//draw "over inventory area"
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
for( int x = 0; x < this.rows; x++ )
{
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 );
}
//draw player inv
this.drawTexturedModalRect( offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + this.reservedSpace - this.lowerTextureOffset );
//draw view cells
this.drawTexturedModalRect(offsetX + x_width, offsetY, x_width, 0, 32, 104);
if (Reference.WCT_BOOSTER_ENABLED) {
this.drawTexturedModalRect(this.guiLeft + 132, (this.guiTop + this.rows * 18) + 83, 237, 237, 19, 19);
}
GuiInventory.func_147046_a(this.guiLeft + 51, (this.guiTop + this.rows * 18) + 94, 32, (float) (this.guiLeft + 51) - this.xSize_lo, (float) ((this.guiTop + this.rows * 18) + 50) - this.ySize_lo, this.mc.thePlayer);
boolean update = false;
for (int i = 0; i < 5; i++) {
if (myCurrentViewCells[i] != containerWCT.getCellViewSlot(i).getStack()) {
update = true;
myCurrentViewCells[i] = containerWCT.getCellViewSlot(i).getStack();
}
}
if (update) {
repo.setViewCell(myCurrentViewCells);
}
}
@SuppressWarnings("rawtypes")
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
final Enum searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH) {
if(!this.isAutoFocus) {
this.searchField.mouseClicked(xCoord - this.guiLeft, yCoord - this.guiTop, btn);
}
@@ -1171,11 +1205,31 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
@Override
protected void keyTyped(final char character, final int key) {
if (!this.checkHotbarKeys(key)) {
if (character == ' ' && this.searchField.getText().isEmpty()) {
return;
}
if (isNEIFocused()) {
return;
}
if (this.searchField.textboxKeyTyped(character, key)) {
if (CommonHelper.proxy.isActionKey(ActionKey.TOGGLE_FOCUS, key)) {
this.searchField.setFocused(!this.searchField.isFocused());
return;
}
if (this.searchField.isFocused() && key == Keyboard.KEY_RETURN) {
this.searchField.setFocused( false );
return;
}
if (character == ' ' && this.searchField.getText().isEmpty()) {
return;
}
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);
}
if (this.searchField.textboxKeyTyped(character, key)) {
this.repo.setSearchString(this.searchField.getText());
this.repo.updateView();
this.setScrollBar();
@@ -1351,4 +1405,39 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
return this.configSrc.getSetting(Settings.VIEW_MODE);
}
public boolean isOverSearchField(int x, int y)
{
return searchField.isMouseIn(x - guiLeft, y - guiTop);
}
public void setSearchString(String memoryText)
{
this.searchField.setText(memoryText);
this.repo.setSearchString(memoryText);
this.repo.updateView();
this.setScrollBar();
}
@SuppressWarnings("SameParameterValue")
protected boolean isPointInRegion(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY) {
int i = this.guiLeft;
int j = this.guiTop;
pointX -= i;
pointY -= j;
return pointX >= rectX - 1 && pointX < rectX + rectWidth + 1 && pointY >= rectY - 1 && pointY < rectY + rectHeight + 1;
}
private boolean isNEIFocused() {
if (!Loader.isModLoaded("NotEnoughItems")) {
return false;
}
try {
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();
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
return false;
}
}
@@ -21,7 +21,7 @@ public class MEGuiTextField extends GuiTextField
private final int _width;
private final int _height;
/**
/**
* Uses the values to instantiate a padded version of a text field.
* Pays attention to the '_' caret.
*
@@ -39,7 +39,7 @@ public class MEGuiTextField extends GuiTextField
this._yPos = yPos;
this._width = width;
this._height = height;
}
}
@Override
public void mouseClicked( final int xPos, final int yPos, final int button )
@@ -66,4 +66,19 @@ public class MEGuiTextField extends GuiTextField
return withinXRange && withinYRange;
}
@Override
public void drawTextBox() {
if (this.getVisible()) {
if (this.isFocused()) {
drawRect(this.xPosition - 1, this.yPosition, this.xPosition + this.width - 1, this.yPosition + this.height + 2,
0xFF606060 );
}
else {
drawRect(this.xPosition - 1, this.yPosition, this.xPosition + this.width - 1, this.yPosition + this.height + 2,
0xFFA8A8A8 );
}
super.drawTextBox();
}
}
}
@@ -2,6 +2,7 @@ package net.p455w0rd.wirelesscraftingterminal.common;
import appeng.api.AEApi;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.container.implementations.ContainerCraftingStatus;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@@ -13,7 +14,6 @@ import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiMagnet;
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftAmount;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftingStatus;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerMagnet;
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
@@ -29,7 +29,7 @@ import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
@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 + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",);" + "required-after:appliedenergistics2@[rv3-beta-1,);required-after:p455w0rdslib;after:NotEnoughItems;")
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",);" + "required-after:appliedenergistics2@[rv3-beta-1,);after:NotEnoughItems;")
public class WirelessCraftingTerminal {
@@ -13,6 +13,7 @@ import java.util.List;
import javax.annotation.Nonnull;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
@@ -75,6 +76,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
@@ -96,10 +98,12 @@ import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotMagnet;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotPlayerHotBar;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotPlayerInv;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotTrash;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotViewCell;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryBooster;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryCrafting;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryMagnet;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryTrash;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryViewCell;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
@@ -111,10 +115,12 @@ import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
public class ContainerWirelessCraftingTerminal extends Container implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack>, IAEAppEngInventory, IContainerCraftingPacket {
public class ContainerWirelessCraftingTerminal extends Container implements IConfigManagerHost, IConfigurableObject,
IMEMonitorHandlerReceiver<IAEItemStack>, IAEAppEngInventory, IContainerCraftingPacket, IViewCellStorage {
private final ItemStack containerstack;
public WCTInventoryCrafting craftingGrid;
public final WCTInventoryCrafting craftingGrid;
public final WCTInventoryViewCell viewCellInventory;
public final WCTInventoryBooster boosterInventory;
public final WCTInventoryMagnet magnetInventory;
public final WCTInventoryTrash trashInventory;
@@ -126,7 +132,8 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
private 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,
BOOSTER_INDEX = 0, MAGNET_INDEX = CRAFT_RESULT + 1;
VIEW_CELL_START = CRAFT_RESULT + 1, VIEW_CELL_END = VIEW_CELL_START + 4,
BOOSTER_INDEX = 0, MAGNET_INDEX = VIEW_CELL_END + 1;
public static int CRAFTING_SLOT_X_POS = 80, CRAFTING_SLOT_Y_POS = 83;
private SlotBooster boosterSlot;
private SlotMagnet magnetSlot;
@@ -136,6 +143,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
private SlotArmor[] armorSlot;
private SlotCraftingMatrix[] craftMatrixSlot;
private SlotCraftingTerm craftingSlot;
private SlotViewCell[] viewCellSlot;
public SlotTrash trashSlot;
private int firstCraftingSlotNumber = -1, lastCraftingSlotNumber = -1;
@@ -188,6 +196,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
this.thisItem = (IWirelessCraftingTerminalItem) this.containerstack.getItem();
this.worldObj = player.worldObj;
this.craftingGrid = new WCTInventoryCrafting(this, 3, 3, containerstack);
this.viewCellInventory = new WCTInventoryViewCell(RandomUtils.getWirelessTerm(inventoryPlayer));
this.inventoryPlayer = inventoryPlayer;
this.player = player;
craftMatrixInventory = new ItemStack[9];
@@ -195,6 +204,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
inventorySlot = new Slot[27];
armorSlot = new SlotArmor[4];
craftMatrixSlot = new SlotCraftingMatrix[9];
viewCellSlot = new SlotViewCell[5];
this.obj = getGuiObject(containerstack, player, worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
this.civ = (IPortableCell) this.obj;
@@ -270,6 +280,12 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
// Add crafting result slot
this.addSlotToContainer(craftingSlot);
// Add view cell slots
for (int i = 0; i < 5; i++) {
viewCellSlot[i] = new SlotViewCell(getViewCellStorage(), i, 207, (i * 18) + 8);
addSlotToContainer(viewCellSlot[i]);
}
magnetSlot = new SlotMagnet(this.magnetInventory, 152, -20);
this.addSlotToContainer(magnetSlot);
@@ -695,9 +711,24 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
return null;
}
@Override
public IInventory getViewCellStorage() {
return viewCellInventory;
}
@Override
public ItemStack[] getViewCells() {
return null;
final ItemStack[] list = new ItemStack[viewCellSlot.length];
for (int x = 0; x < viewCellSlot.length; x++) {
list[x] = viewCellSlot[x].getStack();
}
return list;
}
public SlotViewCell getCellViewSlot(final int index) {
return viewCellSlot[index];
}
private WirelessTerminalGuiObject getGuiObject(final ItemStack it, final EntityPlayer player, final World w, final int x, final int y, final int z) {
@@ -1289,6 +1320,9 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
case "crafting":
((WCTInventoryCrafting) craftingGrid).writeNBT(this.containerstack.getTagCompound());
break;
case "viewCell":
((WCTInventoryViewCell) viewCellInventory).writeNBT(this.containerstack.getTagCompound());
break;
case "magnet":
((WCTInventoryMagnet) magnetInventory).writeNBT(this.containerstack.getTagCompound());
break;
@@ -1299,6 +1333,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
default:
((WCTInventoryBooster) boosterInventory).writeNBT(this.containerstack.getTagCompound());
((WCTInventoryCrafting) craftingGrid).writeNBT(this.containerstack.getTagCompound());
((WCTInventoryViewCell) viewCellInventory).writeNBT(this.containerstack.getTagCompound());
((WCTInventoryMagnet) magnetInventory).writeNBT(this.containerstack.getTagCompound());
((WCTInventoryTrash) trashInventory).writeNBT(this.containerstack.getTagCompound());
break;
@@ -1309,10 +1344,10 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx); // require AE SLots!
ItemStack tis = clickSlot.getStack();
if (tis == null) {
if (tis == null || tis == containerstack) {
return null;
}
// Try to place armor in armor slot/booster in booster lost first
// Try to place armor in armor slot/booster in booster slot first
if (isInInventory(idx) || isInHotbar(idx)) {
if (tis.getItem() instanceof ItemArmor) {
int type = ((ItemArmor) tis.getItem()).armorType;
@@ -1327,12 +1362,21 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
return null;
}
}
else {
if (tis.getItem() instanceof ItemMagnet) {
if (this.mergeItemStack(tis, MAGNET_INDEX, MAGNET_INDEX + 1, false)) {
clickSlot.clearStack();
return null;
else if (tis.getItem() instanceof ItemMagnet) {
if (this.mergeItemStack(tis, MAGNET_INDEX, MAGNET_INDEX + 1, false)) {
clickSlot.clearStack();
return null;
}
}
else if (AEApi.instance().definitions().items().viewCell().isSameAs( tis )) {
if (mergeItemStack(tis.copy(), VIEW_CELL_START, VIEW_CELL_END + 1, false)) {
if (tis.stackSize > 1) {
tis.stackSize--;
}
else {
clickSlot.clearStack();
}
return null;
}
}
}
@@ -0,0 +1,21 @@
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
import appeng.api.AEApi;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class SlotViewCell extends AppEngSlot {
public SlotViewCell(IInventory inv, int index, int xPos, int yPos) {
super(inv, index, xPos, yPos);
}
@Override
public boolean isItemValid(ItemStack is) {
if( is == null || is.getItem() == null) {
return false;
}
return AEApi.instance().definitions().items().viewCell().isSameAs( is );
}
}
Loaded 100 of 195 files, more files were not shown because too many files have changed in this diff. Show more