mirror of
https://github.com/GTNewHorizons/WirelessCraftingTerminal.git
synced 2026-11-26 06:42:55 +00:00
Compare commits
17
Commits
1.8.7.7-GTNH
...
1.8.8.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb50b49cc3 | ||
|
|
9ce6963f09 | ||
|
|
8e7991d2b7 | ||
|
|
a288f5fcfd | ||
|
|
8ce8c34a5e | ||
|
|
8e3d9da2f6 | ||
|
|
db504c19bf | ||
|
|
fe387220ba | ||
|
|
9098efd2bf | ||
|
|
d0b2c6a118 | ||
|
|
299cf1887a | ||
|
|
de05046f38 | ||
|
|
a0e5119ea5 | ||
|
|
60b17db02f | ||
|
|
8d69577ff5 | ||
|
|
b16d5f8e62 | ||
|
|
37fc3c22eb |
No files matched your search
@@ -0,0 +1,9 @@
|
||||
directory="run/crash-reports"
|
||||
if [ -d $directory ]; then
|
||||
echo "Crash reports detected:"
|
||||
cat $directory/*
|
||||
exit 1
|
||||
else
|
||||
echo "No crash reports detected"
|
||||
exit 0
|
||||
fi
|
||||
@@ -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 minute
|
||||
run: |
|
||||
mkdir run
|
||||
echo "eula=true" > run/eula.txt
|
||||
timeout 60 ./gradlew runServer || true
|
||||
|
||||
- name: Test no crashes happend
|
||||
run: |
|
||||
chmod +x .github/scripts/test-no-crash-reports.sh
|
||||
.github/scripts/test-no-crash-reports.sh
|
||||
@@ -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: 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
|
||||
+25
-22
@@ -1,25 +1,28 @@
|
||||
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
|
||||
*.bat
|
||||
out/
|
||||
/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
|
||||
+489
-76
@@ -1,116 +1,529 @@
|
||||
//version: 928ecf7feb33a1149538b0e2cd17e3bc5f281428
|
||||
/*
|
||||
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/SinTh0r4s/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 java.util.concurrent.TimeUnit
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "gt"
|
||||
url = "https://gregtech.overminddl1.com/"
|
||||
}
|
||||
maven {
|
||||
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.4'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'idea'
|
||||
id 'scala'
|
||||
id("org.ajoberstar.grgit") version("3.1.1")
|
||||
id("com.github.johnrengelman.shadow") version("4.0.4")
|
||||
id("com.palantir.git-version") version("0.12.3")
|
||||
}
|
||||
|
||||
apply plugin: 'forge'
|
||||
targetCompatibility=7
|
||||
sourceCompatibility=7
|
||||
|
||||
version = minecraft_version + "-" + aeversion + "-" + wctbuild + "" + wctchannel
|
||||
group = wctgroup
|
||||
archivesBaseName = wctbasename
|
||||
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")
|
||||
|
||||
|
||||
String javaSourceDir = "src/main/java/"
|
||||
String scalaSourceDir = "src/main/scala/"
|
||||
|
||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
||||
}
|
||||
|
||||
if(apiPackage) {
|
||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
||||
}
|
||||
}
|
||||
|
||||
if(accessTransformersFile) {
|
||||
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
||||
if(getFile(targetFile).exists() == false) {
|
||||
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("\\.", "/")
|
||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
||||
}
|
||||
|
||||
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"
|
||||
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
|
||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
'git config core.fileMode false'.execute()
|
||||
// Pulls version from git tag
|
||||
try {
|
||||
version = minecraftVersion + "-" + gitVersion()
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
|
||||
}
|
||||
|
||||
group = modGroup
|
||||
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||
archivesBaseName = customArchiveBaseName
|
||||
}
|
||||
else {
|
||||
archivesBaseName = modId
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = minecraft_version + "-" + forge_version
|
||||
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
|
||||
runDir = "run"
|
||||
|
||||
replaceIn "Reference.java"
|
||||
replaceIn "package-info.java"
|
||||
|
||||
replace "@version@", project.version
|
||||
|
||||
if (replaceGradleTokenInFile) {
|
||||
replaceIn replaceGradleTokenInFile
|
||||
if(gradleTokenModId) {
|
||||
replace gradleTokenModId, modId
|
||||
}
|
||||
if(gradleTokenModName) {
|
||||
replace gradleTokenModName, modName
|
||||
}
|
||||
if(gradleTokenVersion) {
|
||||
replace gradleTokenVersion, versionDetails().lastTag
|
||||
}
|
||||
if(gradleTokenGroupName) {
|
||||
replace gradleTokenGroupName, modGroup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
|
||||
// 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.3.3:dev")
|
||||
}
|
||||
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()) {
|
||||
getFile("/src/main/resources/mixins." + modId + ".json").text = """{
|
||||
"required": true,
|
||||
"minVersion": "0.7.11",
|
||||
"package": "${modGroup}.${mixinsPackage}",
|
||||
"plugin": "${modGroup}.${mixinPlugin}",
|
||||
"refmap": "${mixingConfigRefMap}",
|
||||
"target": "@env(DEFAULT)",
|
||||
"compatibilityLevel": "JAVA_8"
|
||||
}
|
||||
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
||||
target = tasks.shadowJar
|
||||
prefix = modGroup + ".shadow"
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
minimize() // This will only allow shading for actually used classes
|
||||
configurations = [project.configurations.shadowImplementation]
|
||||
dependsOn(relocateShadowJar)
|
||||
}
|
||||
|
||||
jar {
|
||||
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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
expand 'version': project.version, 'mcversion': minecraft_version
|
||||
runClient {
|
||||
def arguments = []
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
arguments += [
|
||||
"--mods=../build/libs/$modId-${version}.jar",
|
||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||
]
|
||||
}
|
||||
|
||||
if(developmentEnvironmentUserName) {
|
||||
arguments += [
|
||||
"--username",
|
||||
developmentEnvironmentUserName
|
||||
]
|
||||
}
|
||||
|
||||
args(arguments)
|
||||
}
|
||||
|
||||
runServer {
|
||||
def arguments = []
|
||||
|
||||
if (usesMixins.toBoolean()) {
|
||||
arguments += [
|
||||
"--mods=../build/libs/$modId-${version}.jar",
|
||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||
]
|
||||
}
|
||||
|
||||
args(arguments)
|
||||
}
|
||||
|
||||
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'
|
||||
|
||||
// replace version and mcversion
|
||||
expand "minecraftVersion": project.minecraft.version,
|
||||
"modVersion": versionDetails().lastTag,
|
||||
"modId": modId,
|
||||
"modName": modName
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
from refMap
|
||||
}
|
||||
|
||||
// copy everything else, thats not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
}
|
||||
|
||||
def getManifestAttributes() {
|
||||
def manifestAttributes = [:]
|
||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (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() == false
|
||||
]
|
||||
}
|
||||
return manifestAttributes
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from (sourceSets.main.allJava)
|
||||
from (file("$projectDir/LICENSE"))
|
||||
getArchiveClassifier().set('sources')
|
||||
}
|
||||
|
||||
task shadowDevJar(type: ShadowJar) {
|
||||
from sourceSets.main.output
|
||||
getArchiveClassifier().set("dev")
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
minimize() // This will only allow shading for actually used classes
|
||||
configurations = [project.configurations.shadowImplementation]
|
||||
}
|
||||
|
||||
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
|
||||
target = tasks.shadowDevJar
|
||||
prefix = modGroup + ".shadow"
|
||||
}
|
||||
|
||||
task circularResolverJar(type: Jar) {
|
||||
dependsOn(relocateShadowDevJar)
|
||||
dependsOn(shadowDevJar)
|
||||
enabled = false
|
||||
}
|
||||
|
||||
task devJar(type: Jar) {
|
||||
from sourceSets.main.output
|
||||
getArchiveClassifier().set("dev")
|
||||
|
||||
manifest {
|
||||
attributes(getManifestAttributes())
|
||||
}
|
||||
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
dependsOn(circularResolverJar)
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
task apiJar(type: Jar) {
|
||||
from (sourceSets.main.allJava) {
|
||||
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 {
|
||||
archives sourcesJar
|
||||
archives devJar
|
||||
if(apiPackage) {
|
||||
archives apiJar
|
||||
}
|
||||
}
|
||||
|
||||
// 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 {
|
||||
println("Build script update available! Run 'gradle updateBuildScript'")
|
||||
}
|
||||
}
|
||||
|
||||
static URL availableBuildScriptUrl() {
|
||||
new URL("https://raw.githubusercontent.com/SinTh0r4s/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 } }
|
||||
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'
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
def checkPropertyExists(String propertyName) {
|
||||
if (project.hasProperty(propertyName) == false) {
|
||||
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/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties")
|
||||
}
|
||||
}
|
||||
|
||||
def getFile(String relativePath) {
|
||||
return new File(projectDir, relativePath)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
implementation "com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev"
|
||||
implementation("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:dev") {
|
||||
transitive = false
|
||||
}
|
||||
implementation("com.github.GTNewHorizons:EnderIO:master-SNAPSHOT:dev") {
|
||||
transitive = false
|
||||
}
|
||||
implementation("com.github.GTNewHorizons:EnderCore:master-SNAPSHOT:dev") {
|
||||
transitive = false
|
||||
}
|
||||
implementation("com.github.GTNewHorizons:Baubles:master-SNAPSHOT:dev") {
|
||||
transitive = false
|
||||
}
|
||||
}
|
||||
+63
-10
@@ -1,11 +1,64 @@
|
||||
aeversion=rv3
|
||||
wctchannel=
|
||||
wctbuild=1.8.7.7-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 = Tags.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 =
|
||||
|
||||
# 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 =
|
||||
Vendored
BIN
Binary file not shown.
+1
-2
@@ -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
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
before_install:
|
||||
- ./gradlew setupCIWorkspace
|
||||
@@ -0,0 +1,13 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://gregtech.overminddl1.com/"
|
||||
}
|
||||
maven {
|
||||
url = "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/"
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
@@ -311,6 +311,7 @@ public class GuiCraftConfirm extends WCTBaseGui {
|
||||
dspToolTip = Platform.getItemDisplayName(is);
|
||||
|
||||
if (lineList.size() > 0) {
|
||||
addItemTooltip(is, lineList);
|
||||
dspToolTip = dspToolTip + '\n' + Joiner.on("\n").join(lineList);
|
||||
}
|
||||
|
||||
+1
@@ -293,6 +293,7 @@ public class GuiCraftingCPU extends WCTBaseGui implements ISortSource
|
||||
|
||||
if( lineList.size() > 0 )
|
||||
{
|
||||
addItemTooltip(is, lineList);
|
||||
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+36
-12
@@ -21,10 +21,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;
|
||||
@@ -84,6 +81,7 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAc
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwapSlots;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
|
||||
import net.p455w0rd.wirelesscraftingterminal.handlers.ConfigHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.integration.IntegrationRegistry;
|
||||
import net.p455w0rd.wirelesscraftingterminal.integration.IntegrationType;
|
||||
@@ -94,7 +92,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 +100,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 +131,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
private GuiImgButton clearBtn;
|
||||
private GuiTrashButton trashBtn;
|
||||
private GuiImgButton terminalStyleBox;
|
||||
private GuiImgButton searchStringSave;
|
||||
public boolean devicePowered = false;
|
||||
private boolean isNEIEnabled;
|
||||
private boolean wasTextboxFocused = false;
|
||||
@@ -142,6 +141,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);
|
||||
@@ -200,6 +200,10 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
if (btn == this.searchBoxSettings) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
}
|
||||
else if( btn == this.searchStringSave )
|
||||
{
|
||||
ConfigHandler.saveSearchString = next == YesNo.YES;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
NetworkHandler.instance.sendToServer(new PacketValueConfig(iBtn.getSetting().name(), next.name()));
|
||||
@@ -370,7 +374,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, ConfigHandler.saveSearchString ? 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);
|
||||
@@ -387,11 +394,11 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
final Enum setting = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
this.searchField.setFocused(SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting);
|
||||
|
||||
if (ConfigHandler.saveSearchString || 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();
|
||||
}
|
||||
@@ -674,19 +681,36 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+16
@@ -21,6 +21,7 @@ import com.google.common.base.Stopwatch;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
@@ -771,4 +772,19 @@ public abstract class WCTBaseGui extends GuiContainer {
|
||||
public static final synchronized void setSwitchingGuis(final boolean switchingGuis) {
|
||||
WCTBaseGui.switchingGuis = switchingGuis;
|
||||
}
|
||||
protected void addItemTooltip(ItemStack is, List<String> lineList)
|
||||
{
|
||||
if (isShiftKeyDown())
|
||||
{
|
||||
List l = is.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
if (!l.isEmpty())
|
||||
l.remove(0);
|
||||
lineList.addAll(l);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: update AE2 on maven and dependency in build gradle
|
||||
// lineList.add(GuiText.HoldShiftForTooltip.getLocal());
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+55
-11
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+21
@@ -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 );
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+137
@@ -0,0 +1,137 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.common.inventory;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class WCTInventoryViewCell implements IInventory {
|
||||
|
||||
private final String name = "ViewCells";
|
||||
private final ItemStack invItem;
|
||||
private ItemStack[] inventory;
|
||||
|
||||
public WCTInventoryViewCell(ItemStack stack) {
|
||||
super();
|
||||
inventory = new ItemStack[5];
|
||||
invItem = stack;
|
||||
if (stack != null) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
readFromNBT(stack.getTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return name.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int amount) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
if (stack != null) {
|
||||
if (stack.stackSize > amount) {
|
||||
stack = stack.splitStack(amount);
|
||||
markDirty();
|
||||
}
|
||||
else {
|
||||
setInventorySlotContents(slot, null);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
if (inventory[slot] != null) {
|
||||
ItemStack itemStack = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
return itemStack;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
inventory[slot] = stack;
|
||||
|
||||
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
|
||||
stack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
writeNBT(invItem.getTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
|
||||
return (AEApi.instance().definitions().items().viewCell().isSameAs( itemstack ));
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||
NBTTagList tagList = nbtTagCompound.getTagList(this.name, 10);
|
||||
inventory = new ItemStack[this.getSizeInventory()];
|
||||
for (int i = 0; i < tagList.tagCount(); ++i) {
|
||||
NBTTagCompound tagCompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
int slot = tagCompound.getInteger("Slot");
|
||||
if (slot >= 0 && slot < inventory.length) {
|
||||
inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbtTagCompound) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) {
|
||||
if (inventory[currentIndex] != null) {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setInteger("Slot", currentIndex);
|
||||
inventory[currentIndex].writeToNBT(tagCompound);
|
||||
tagList.appendTag(tagCompound);
|
||||
}
|
||||
}
|
||||
nbtTagCompound.setTag(this.name, tagList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 162 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user