Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ac259dce6a | |||
| 7a6d49412e | |||
| 10f47a560a | |||
| a8f0bbe06b | |||
| dd3cdfcec5 | |||
| 503f14f0a6 | |||
| 30af345ceb | |||
| e8af0f228b | |||
| 0291ceff30 | |||
| d0614ba7d8 | |||
| 54366e2b35 | |||
| d128b0c228 | |||
| f7aa4c92bc | |||
| 0709d2dfc4 | |||
| 2ea08a3fc9 | |||
| 8c7185f8ff | |||
| f7651fff29 | |||
| 51f2a42367 | |||
| 4829ec8286 | |||
| 0b7341e4a8 | |||
| b252d1c891 | |||
| a31de25257 | |||
| 01f56ae633 | |||
| 669aa3188e | |||
| 219de337be | |||
| 7747899e90 | |||
| 82751e761e | |||
| c4c0585fd3 | |||
| 496e159010 | |||
| 754ee1ba83 | |||
| ffe1a52456 | |||
| 28696bd531 | |||
| 29098372af | |||
| 9dbcf21fa9 | |||
| a5a1f79102 | |||
| 8fb12119ef | |||
| 7f83c73a28 | |||
| 80a473a93b | |||
| adac94555b | |||
| 2f11054132 | |||
| 1314ee4588 | |||
| 4484863452 | |||
| ba9b790a02 | |||
| e4d862dbfd | |||
| 812e8c5990 | |||
| e3eeee7784 | |||
| 467bb91628 | |||
| 10a12a9b97 | |||
| e5f345d49c | |||
| 95ce9694aa | |||
| d1ec1a88ee | |||
| bfe82cdc0a | |||
| 4fe0d5e767 | |||
| b38148e095 | |||
| d528d9f205 | |||
| 60211cccdd | |||
| c3a331c13f | |||
| add866443d | |||
| bf83de08b2 | |||
| 6f822af262 |
@@ -1,25 +0,0 @@
|
||||
name: Build mod
|
||||
|
||||
on: [ push, pull_request, workflow_dispatch ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build mod
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '8'
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew -Pnet.minecraftforge.gradle.disableUpdateChecker=true build
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: appliedenergistics2
|
||||
path: build/libs
|
||||
@@ -0,0 +1,68 @@
|
||||
# Publishes built jars to distribution platforms
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+' # any semver tag, e.g. 1.2.3
|
||||
|
||||
env:
|
||||
# type of release
|
||||
RELEASE_TYPE: "release"
|
||||
|
||||
jobs:
|
||||
Publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write # needed to create GitHub releases
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check for Duplicate Tags
|
||||
run: |
|
||||
if git rev-parse -q --verify "refs/tags/${{ github.ref }}" >/dev/null; then
|
||||
echo "Tag already exists. A version bump is required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '17'
|
||||
|
||||
- name: Build Project
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: 'build --build-cache --daemon' # use the daemon here so the rest of the process is faster
|
||||
generate-job-summary: false
|
||||
gradle-home-cache-includes: |
|
||||
caches
|
||||
jdks
|
||||
notifications
|
||||
wrapper
|
||||
|
||||
- name: Publish to GitHub
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: "build/libs/*.jar"
|
||||
generate_release_notes: true
|
||||
fail_on_unmatched_files: true
|
||||
|
||||
- name: Publish to Curseforge
|
||||
uses: gradle/gradle-build-action@v2
|
||||
env:
|
||||
CURSEFORGE_API_KEY: "${{secrets.CURSEFORGE_API_KEY}}"
|
||||
CURSEFORGE_PROJECT_ID: "${{secrets.CURSEFORGE_PROJECT_ID}}"
|
||||
RELEASE_TYPE: "${{env.RELEASE_TYPE}}"
|
||||
with:
|
||||
arguments: 'curseforge --daemon'
|
||||
generate-job-summary: false
|
||||
gradle-home-cache-includes: |
|
||||
caches
|
||||
jdks
|
||||
notifications
|
||||
wrapper
|
||||
@@ -0,0 +1,39 @@
|
||||
# Updates the Gradle Cache when relevant files change
|
||||
name: Update Gradle Cache
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- "gradle**" # covers gradle folder, gradle.properties, gradlew
|
||||
- "build.gradle*"
|
||||
- "settings.gradle*"
|
||||
- "src/main/resources/*_at.cfg" # access transformers
|
||||
|
||||
jobs:
|
||||
Update_Cache:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '17'
|
||||
|
||||
- name: Update Cache
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: 'test --build-cache --no-daemon' # disable daemon since only one gradle operation will happen
|
||||
generate-job-summary: false
|
||||
gradle-home-cache-includes: |
|
||||
caches
|
||||
jdks
|
||||
notifications
|
||||
wrapper
|
||||
cache-write-only: true
|
||||
+76
-25
@@ -1,32 +1,83 @@
|
||||
# exclude all
|
||||
/*
|
||||
.nopublish
|
||||
|
||||
# include important folders
|
||||
# need gradle
|
||||
!gradle/
|
||||
!gradlew
|
||||
!gradlew.bat
|
||||
!build.gradle
|
||||
!gradle.properties
|
||||
!settings.gradle
|
||||
!.travis.yml
|
||||
### Windows ###
|
||||
|
||||
# include markdowns
|
||||
!README.md
|
||||
!LICENSE
|
||||
thumbs.db
|
||||
*.db
|
||||
|
||||
# include sourcecode
|
||||
!src/
|
||||
### Java ###
|
||||
|
||||
# include git important files
|
||||
!.gitmodules
|
||||
!.gitignore
|
||||
*.class
|
||||
|
||||
# code format to reduce noise in git commits
|
||||
!codeformat/
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Github specific files and directories
|
||||
!.github/
|
||||
# Package Files #
|
||||
*.war
|
||||
*.ear
|
||||
*.txt
|
||||
|
||||
# Explicit ignores
|
||||
Thumbs.db
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
### Eclipse ###
|
||||
|
||||
*.pydevproject
|
||||
.metadata
|
||||
.gradle
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
/eclipse
|
||||
|
||||
# Eclipse Core
|
||||
.project
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
### Intellij IDEA ###
|
||||
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
.idea/
|
||||
.idea_modules/
|
||||
/classes/
|
||||
/out/
|
||||
/build/
|
||||
|
||||
# Linux
|
||||
*~
|
||||
|
||||
run/
|
||||
|
||||
logs/
|
||||
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
language: java
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
- openjdk8
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json
|
||||
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json.etag
|
||||
- rm -fr $HOME/.gradle/caches/minecraft/deobfedDeps
|
||||
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
|
||||
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- '$HOME/.m2/repository'
|
||||
- '$HOME/.sonar/cache'
|
||||
- '$HOME/.gradle/wrapper'
|
||||
- '$HOME/.gradle/caches'
|
||||
|
||||
addons:
|
||||
sonarcloud:
|
||||
organization: "appliedenergistics"
|
||||
|
||||
install: "./gradlew setupCIWorkspace"
|
||||
script:
|
||||
- "./gradlew build"
|
||||
- "./gradlew test"
|
||||
- "./gradlew sonarqube"
|
||||
@@ -1,19 +1,25 @@
|
||||
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack.
|
||||
# Applied Energistics 2 Unofficial Extended Life
|
||||
|
||||
See [AE2-Omnifactory](https://github.com/PrototypeTrousers/Applied-Energistics-2/tree/AE2-Omnifactory) branch for commits and [Releases](https://github.com/PrototypeTrousers/Applied-Energistics-2/releases) for the compiled jars.
|
||||
[](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [](https://github.com/AE2-UEL/Applied-Energistics-2/issues) [](https://github.com/AE2-UEL/Applied-Energistics-2/pulls)
|
||||
|
||||
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory)
|
||||
---
|
||||
|
||||
## About
|
||||
A Mod about Matter, Energy and using them to conquer the world.
|
||||
|
||||
A maintained fork of a Mod about Matter, Energy and using them to conquer the world.
|
||||
|
||||
This project started as a fork of [Applied Energistics 2](https://github.com/AppliedEnergistics/Applied-Energistics-2) by [PrototypeTrousers](https://github.com/PrototypeTrousers), initially addressing issues related to the [Nomifactory](https://www.curseforge.com/minecraft/modpacks/nomifactory) modpack. It is now being maintained by the [AE2 Unofficial Extended Life Team](https://github.com/AE2-UEL).
|
||||
|
||||
See [Releases](https://github.com/PrototypeTrousers/Applied-Energistics-2/releases) for the compiled jars.
|
||||
|
||||
## RecipeStages
|
||||
|
||||
You need to add the following into a CraftTweaker script:
|
||||
```
|
||||
mods.recipestages.Recipes.setPackageStage("appeng", allStages);
|
||||
```
|
||||
|
||||
The second argument allows you to customize which stages exactly you want to be craftable with AE2. Idk why would you like to restrict any, but you can.
|
||||
The second argument allows you to customize which stages exactly you want to be craftable with AE2. Not sure why you would do that, but we support that nonetheless!
|
||||
|
||||
## License
|
||||
* Applied Energistics 2 API
|
||||
@@ -29,8 +35,10 @@ The second argument allows you to customize which stages exactly you want to be
|
||||
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||
|
||||
## Credits
|
||||
Thanks to
|
||||
|
||||
|
||||
Special thanks to:
|
||||
|
||||
* PrototypeTrousers for the initial fork
|
||||
* Notch et al for Minecraft
|
||||
* Lex et al for MinecraftForge
|
||||
* AlgorithmX2 for AppliedEnergistics2
|
||||
|
||||
+338
-138
@@ -1,3 +1,4 @@
|
||||
//version: 1704659416
|
||||
/*
|
||||
* DO NOT CHANGE THIS FILE!
|
||||
* Also, you may replace this file at any time if there is an update available.
|
||||
@@ -19,23 +20,24 @@ import static org.gradle.internal.logging.text.StyledTextOutput.Style
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'base'
|
||||
id 'eclipse'
|
||||
id 'maven-publish'
|
||||
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.19'
|
||||
id 'net.darkhax.curseforgegradle' version '1.0.14' apply false
|
||||
id 'com.modrinth.minotaur' version '2.8.0' apply false
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.25'
|
||||
id 'net.darkhax.curseforgegradle' version '1.1.17' apply false
|
||||
id 'com.modrinth.minotaur' version '2.8.6' apply false
|
||||
id 'com.diffplug.spotless' version '6.13.0' apply false
|
||||
id 'com.palantir.git-version' version '3.0.0' apply false
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||
}
|
||||
|
||||
if (verifySettingsGradle()) {
|
||||
throw new GradleException("Settings has been updated, please re-run task.")
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
|
||||
id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false
|
||||
id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
|
||||
}
|
||||
|
||||
def out = services.get(StyledTextOutputFactory).create('an-output')
|
||||
|
||||
|
||||
// Project properties
|
||||
|
||||
// Required properties: we don't know how to handle these being missing gracefully
|
||||
@@ -50,31 +52,72 @@ checkPropertyExists("mixinsPackage")
|
||||
checkPropertyExists("coreModClass")
|
||||
checkPropertyExists("containsMixinsAndOrCoreModOnly")
|
||||
|
||||
// Optional properties: we can assume some default behavior if these are missing
|
||||
propertyDefaultIfUnset("modVersion", "")
|
||||
propertyDefaultIfUnset("includeMCVersionJar", false)
|
||||
propertyDefaultIfUnset("autoUpdateBuildScript", false)
|
||||
propertyDefaultIfUnset("modArchivesBaseName", project.modId)
|
||||
propertyDefaultIfUnsetWithEnvVar("developmentEnvironmentUserName", "Developer", "DEV_USERNAME")
|
||||
propertyDefaultIfUnset("generateGradleTokenClass", "")
|
||||
propertyDefaultIfUnset("gradleTokenModId", "")
|
||||
propertyDefaultIfUnset("gradleTokenModName", "")
|
||||
propertyDefaultIfUnset("gradleTokenVersion", "")
|
||||
propertyDefaultIfUnset("useSrcApiPath", false)
|
||||
propertyDefaultIfUnset("includeWellKnownRepositories", true)
|
||||
propertyDefaultIfUnset("includeCommonDevEnvMods", true)
|
||||
propertyDefaultIfUnset("noPublishedSources", false)
|
||||
propertyDefaultIfUnset("forceEnableMixins", false)
|
||||
propertyDefaultIfUnsetWithEnvVar("enableCoreModDebug", false, "CORE_MOD_DEBUG")
|
||||
propertyDefaultIfUnset("generateMixinConfig", true)
|
||||
propertyDefaultIfUnset("usesShadowedDependencies", false)
|
||||
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
|
||||
propertyDefaultIfUnset("relocateShadowedDependencies", true)
|
||||
propertyDefaultIfUnset("separateRunDirectories", false)
|
||||
propertyDefaultIfUnset("versionDisplayFormat", '$MOD_NAME \u2212 $VERSION')
|
||||
propertyDefaultIfUnsetWithEnvVar("modrinthProjectId", "", "MODRINTH_PROJECT_ID")
|
||||
propertyDefaultIfUnset("modrinthRelations", "")
|
||||
propertyDefaultIfUnsetWithEnvVar("curseForgeProjectId", "", "CURSEFORGE_PROJECT_ID")
|
||||
propertyDefaultIfUnset("curseForgeRelations", "")
|
||||
propertyDefaultIfUnsetWithEnvVar("releaseType", "release", "RELEASE_TYPE")
|
||||
propertyDefaultIfUnset("generateDefaultChangelog", false)
|
||||
propertyDefaultIfUnset("customMavenPublishUrl", "")
|
||||
propertyDefaultIfUnset("mavenArtifactGroup", getDefaultArtifactGroup())
|
||||
propertyDefaultIfUnset("enableModernJavaSyntax", false)
|
||||
propertyDefaultIfUnset("enableSpotless", false)
|
||||
propertyDefaultIfUnset("enableJUnit", false)
|
||||
propertyDefaultIfUnsetWithEnvVar("deploymentDebug", false, "DEPLOYMENT_DEBUG")
|
||||
|
||||
|
||||
// Project property assertions
|
||||
|
||||
final String javaSourceDir = 'src/main/java/'
|
||||
final String scalaSourceDir = 'src/main/scala/'
|
||||
// If Kotlin is supported, add the path here
|
||||
final String kotlinSourceDir = 'src/main/kotlin/'
|
||||
|
||||
final String modGroupPath = modGroup.toString().replace('.' as char, '/' as char)
|
||||
final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char)
|
||||
|
||||
String targetPackageJava = javaSourceDir + modGroupPath
|
||||
String targetPackageScala = scalaSourceDir + modGroupPath
|
||||
String targetPackageKotlin = kotlinSourceDir + modGroupPath
|
||||
|
||||
// If Kotlin is supported, add the path here
|
||||
|
||||
if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists()) {
|
||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find ${targetPackageJava} or ${targetPackageScala}")
|
||||
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 = 'src/api/java/' + modGroupPath + '/api'
|
||||
targetPackageScala = 'src/api/java/' + modGroupPath + '/api'
|
||||
if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists()) {
|
||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala}")
|
||||
final String endApiPath = modGroupPath + '/' + apiPackagePath
|
||||
if (useSrcApiPath) {
|
||||
targetPackageJava = 'src/api/java/' + endApiPath
|
||||
targetPackageScala = 'src/api/scala/' + endApiPath
|
||||
targetPackageKotlin = 'src/api/kotlin/' + endApiPath
|
||||
} else {
|
||||
targetPackageJava = javaSourceDir + endApiPath
|
||||
targetPackageScala = scalaSourceDir + endApiPath
|
||||
targetPackageKotlin = kotlinSourceDir + endApiPath
|
||||
}
|
||||
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}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,8 +139,9 @@ if (usesMixins.toBoolean()) {
|
||||
final String mixinPackagePath = mixinsPackage.toString().replaceAll('\\.', '/')
|
||||
targetPackageJava = javaSourceDir + modGroupPath + '/' + mixinPackagePath
|
||||
targetPackageScala = scalaSourceDir + modGroupPath + '/' + mixinPackagePath
|
||||
if (!getFile(targetPackageJava).exists()) {
|
||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala}")
|
||||
targetPackageKotlin = kotlinSourceDir + modGroupPath + '/' + mixinPackagePath
|
||||
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}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,13 +150,105 @@ if (coreModClass) {
|
||||
String targetFileJava = javaSourceDir + modGroupPath + '/' + coreModPath + '.java'
|
||||
String targetFileScala = scalaSourceDir + modGroupPath + '/' + coreModPath + '.scala'
|
||||
String targetFileScalaJava = scalaSourceDir + modGroupPath + '/' + coreModPath + '.java'
|
||||
if (!getFile(targetFileJava).exists() && !getFile(targetFileScala).exists() && !getFile(targetFileScalaJava).exists()) {
|
||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava)
|
||||
String targetFileKotlin = kotlinSourceDir + modGroupPath + '/' + coreModPath + '.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}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Plugin application
|
||||
|
||||
// Scala
|
||||
if (getFile('src/main/scala').exists()) {
|
||||
apply plugin: 'scala'
|
||||
}
|
||||
|
||||
if (getFile('src/main/kotlin').exists()) {
|
||||
apply plugin: 'org.jetbrains.kotlin.jvm'
|
||||
}
|
||||
|
||||
// Kotlin
|
||||
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
|
||||
kotlin {
|
||||
jvmToolchain(8)
|
||||
}
|
||||
def disabledKotlinTaskList = [
|
||||
"kaptGenerateStubsMcLauncherKotlin",
|
||||
"kaptGenerateStubsPatchedMcKotlin",
|
||||
"kaptGenerateStubsInjectedTagsKotlin",
|
||||
"compileMcLauncherKotlin",
|
||||
"compilePatchedMcKotlin",
|
||||
"compileInjectedTagsKotlin",
|
||||
"kaptMcLauncherKotlin",
|
||||
"kaptPatchedMcKotlin",
|
||||
"kaptInjectedTagsKotlin",
|
||||
"kspMcLauncherKotlin",
|
||||
"kspPatchedMcKotlin",
|
||||
"kspInjectedTagsKotlin",
|
||||
]
|
||||
tasks.configureEach { task ->
|
||||
if (task.name in disabledKotlinTaskList) {
|
||||
task.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Spotless
|
||||
//noinspection GroovyAssignabilityCheck
|
||||
project.extensions.add(com.diffplug.blowdryer.Blowdryer, 'Blowdryer', com.diffplug.blowdryer.Blowdryer) // make Blowdryer available in plugin application
|
||||
if (enableSpotless.toBoolean()) {
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
|
||||
// Spotless auto-formatter
|
||||
// See https://github.com/diffplug/spotless/tree/main/plugin-gradle
|
||||
// Can be locally toggled via spotless:off/spotless:on comments
|
||||
spotless {
|
||||
encoding 'UTF-8'
|
||||
|
||||
format 'misc', {
|
||||
target '.gitignore'
|
||||
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces(4)
|
||||
endWithNewline()
|
||||
}
|
||||
java {
|
||||
target 'src/main/java/**/*.java', 'src/test/java/**/*.java' // exclude api as they are not our files
|
||||
|
||||
def orderFile = project.file('spotless.importorder')
|
||||
if (!orderFile.exists()) {
|
||||
orderFile = Blowdryer.file('spotless.importorder')
|
||||
}
|
||||
def formatFile = project.file('spotless.eclipseformat.xml')
|
||||
if (!formatFile.exists()) {
|
||||
formatFile = Blowdryer.file('spotless.eclipseformat.xml')
|
||||
}
|
||||
|
||||
toggleOffOn()
|
||||
importOrderFile(orderFile)
|
||||
removeUnusedImports()
|
||||
endWithNewline()
|
||||
//noinspection GroovyAssignabilityCheck
|
||||
eclipse('4.19.0').configFile(formatFile)
|
||||
}
|
||||
kotlin {
|
||||
target 'src/*/kotlin/**/*.kt'
|
||||
|
||||
toggleOffOn()
|
||||
ktfmt('0.39')
|
||||
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces(4)
|
||||
endWithNewline()
|
||||
}
|
||||
scala {
|
||||
target 'src/*/scala/**/*.scala'
|
||||
scalafmt('3.7.1')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Git version checking, also checking for if this is a submodule
|
||||
if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) {
|
||||
apply plugin: 'com.palantir.git-version'
|
||||
@@ -123,6 +259,9 @@ if (usesShadowedDependencies.toBoolean()) {
|
||||
apply plugin: 'com.github.johnrengelman.shadow'
|
||||
}
|
||||
|
||||
|
||||
// Configure Java
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
if (enableModernJavaSyntax.toBoolean()) {
|
||||
@@ -164,8 +303,11 @@ tasks.withType(ScalaCompile).configureEach {
|
||||
// Allow others using this buildscript to have custom gradle code run
|
||||
if (getFile('addon.gradle').exists()) {
|
||||
apply from: 'addon.gradle'
|
||||
} else if (getFile('addon.gradle.kts').exists()) {
|
||||
apply from: 'addon.gradle.kts'
|
||||
}
|
||||
|
||||
|
||||
// Configure Minecraft
|
||||
|
||||
// Try to gather mod version from git tags if version is not manually specified
|
||||
@@ -181,23 +323,24 @@ if (!modVersion) {
|
||||
}
|
||||
}
|
||||
|
||||
if (includeMCVersionJar.toBoolean()) {
|
||||
if (includeMCVersionJar.toBoolean()){
|
||||
version = "${minecraftVersion}-${modVersion}"
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
version = modVersion
|
||||
}
|
||||
|
||||
group = modGroup
|
||||
archivesBaseName = modArchivesBaseName
|
||||
|
||||
base {
|
||||
archivesName = modArchivesBaseName
|
||||
}
|
||||
|
||||
minecraft {
|
||||
mcVersion = minecraftVersion
|
||||
username = developmentEnvironmentUserName.toString()
|
||||
useDependencyAccessTransformers = true
|
||||
|
||||
setMcpMappingChannel("snapshot")
|
||||
setMcpMappingVersion("20171003")
|
||||
|
||||
// Automatic token injection with RetroFuturaGradle
|
||||
if (gradleTokenModId) {
|
||||
injectedTags.put gradleTokenModId, modId
|
||||
@@ -209,22 +352,30 @@ minecraft {
|
||||
injectedTags.put gradleTokenVersion, modVersion
|
||||
}
|
||||
|
||||
injectedTags.put("VERSION", project.version)
|
||||
injectedTags.put("AEVERSION", aeversion)
|
||||
injectedTags.put("AECHANNEL", aechannel)
|
||||
injectedTags.put("AEBUILD", aebuild)
|
||||
|
||||
// JVM arguments
|
||||
extraRunJvmArguments.add("-ea:${modGroup}")
|
||||
if (usesMixins.toBoolean()) {
|
||||
extraRunJvmArguments.addAll([
|
||||
'-Dmixin.hotSwap=true',
|
||||
'-Dmixin.checks.interfaces=true',
|
||||
'-Dmixin.debug.export=true'
|
||||
'-Dmixin.hotSwap=true',
|
||||
'-Dmixin.checks.interfaces=true',
|
||||
'-Dmixin.debug.export=true'
|
||||
])
|
||||
}
|
||||
if (coreModClass) {
|
||||
extraRunJvmArguments.add("-Dfml.coreMods.load=${modGroup}.${coreModClass}")
|
||||
|
||||
if (enableCoreModDebug.toBoolean()) {
|
||||
extraRunJvmArguments.addAll([
|
||||
'-Dlegacy.debugClassLoading=true',
|
||||
'-Dlegacy.debugClassLoadingFiner=true',
|
||||
'-Dlegacy.debugClassLoadingSave=true'
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
if (coreModClass) {
|
||||
for (runTask in ['runClient', 'runServer']) {
|
||||
tasks.named(runTask).configure {
|
||||
extraJvmArgs.add("-Dfml.coreMods.load=${modGroup}.${coreModClass}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,17 +387,6 @@ tasks.named('processIdeaSettings').configure {
|
||||
dependsOn('injectTags')
|
||||
}
|
||||
|
||||
tasks.register("generateMcModInfo") {
|
||||
|
||||
}
|
||||
|
||||
tasks.register("generatePackMcMeta") {
|
||||
|
||||
}
|
||||
|
||||
tasks.named('processIdeaSettings').configure {
|
||||
dependsOn('injectTags')
|
||||
}
|
||||
|
||||
// Repositories
|
||||
|
||||
@@ -263,46 +403,63 @@ repositories.configureEach { repo ->
|
||||
// Allow adding custom repositories to the buildscript
|
||||
if (getFile('repositories.gradle').exists()) {
|
||||
apply from: 'repositories.gradle'
|
||||
} else if (getFile('repositories.gradle.kts').exists()) {
|
||||
apply from: 'repositories.gradle.kts'
|
||||
}
|
||||
|
||||
repositories {
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
//noinspection ForeignDelegate
|
||||
maven {
|
||||
name = 'Curse Maven'
|
||||
url = 'https://www.cursemaven.com'
|
||||
if (includeWellKnownRepositories.toBoolean() || includeCommonDevEnvMods.toBoolean()) {
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
//noinspection ForeignDelegate
|
||||
maven {
|
||||
name = 'Curse Maven'
|
||||
url = 'https://www.cursemaven.com'
|
||||
// url = 'https://beta.cursemaven.com'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup 'curse.maven'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup 'curse.maven'
|
||||
}
|
||||
}
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
//noinspection ForeignDelegate
|
||||
maven {
|
||||
name = 'Modrinth'
|
||||
url = 'https://api.modrinth.com/maven'
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
//noinspection ForeignDelegate
|
||||
maven {
|
||||
name = 'Modrinth'
|
||||
url = 'https://api.modrinth.com/maven'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup 'maven.modrinth'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup 'maven.modrinth'
|
||||
maven {
|
||||
name 'Cleanroom Maven'
|
||||
url 'https://maven.cleanroommc.com'
|
||||
}
|
||||
maven {
|
||||
name 'BlameJared Maven'
|
||||
url 'https://maven.blamejared.com'
|
||||
}
|
||||
maven {
|
||||
name 'GTNH Maven'
|
||||
url 'https://nexus.gtnewhorizons.com/repository/public/'
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name 'Cleanroom Maven'
|
||||
url 'https://maven.cleanroommc.com'
|
||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||
// need to add this here even if we did not above
|
||||
if (!includeWellKnownRepositories.toBoolean()) {
|
||||
maven {
|
||||
name 'Cleanroom Maven'
|
||||
url 'https://maven.cleanroommc.com'
|
||||
}
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name 'BlameJared Maven'
|
||||
url 'https://maven.blamejared.com'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
mavenLocal() // Must be last for caching to work
|
||||
}
|
||||
|
||||
|
||||
// Dependencies
|
||||
|
||||
// Configure dependency configurations
|
||||
@@ -318,32 +475,31 @@ configurations {
|
||||
}
|
||||
}
|
||||
|
||||
String mixinProviderSpec = 'zone.rong:mixinbooter:8.9'
|
||||
dependencies {
|
||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||
implementation 'zone.rong:mixinbooter:7.0'
|
||||
String mixin = 'org.spongepowered:mixin:0.8.3'
|
||||
if (usesMixins.toBoolean()) {
|
||||
mixin = modUtils.enableMixins(mixin, "mixins.${modId}.refmap.json")
|
||||
}
|
||||
|
||||
api(mixin) {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
annotationProcessor(mixin) {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
if (usesMixins.toBoolean()) {
|
||||
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
|
||||
// should use 24.1.1 but 30.0+ has a vulnerability fix
|
||||
annotationProcessor 'com.google.guava:guava:30.0-jre'
|
||||
// should use 2.8.6 but 2.8.9+ has a vulnerability fix
|
||||
annotationProcessor 'com.google.code.gson:gson:2.8.9'
|
||||
|
||||
mixinProviderSpec = modUtils.enableMixins(mixinProviderSpec, "mixins.${modId}.refmap.json")
|
||||
api (mixinProviderSpec) {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
annotationProcessor(mixinProviderSpec) {
|
||||
transitive = false
|
||||
}
|
||||
} else if (forceEnableMixins.toBoolean()) {
|
||||
runtimeOnly(mixinProviderSpec)
|
||||
}
|
||||
|
||||
if (enableJUnit.toBoolean()) {
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1'
|
||||
testImplementation 'org.hamcrest:hamcrest:2.2'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
}
|
||||
|
||||
if (enableModernJavaSyntax.toBoolean()) {
|
||||
@@ -364,8 +520,11 @@ dependencies {
|
||||
testCompileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0"
|
||||
}
|
||||
|
||||
compileOnlyApi 'org.jetbrains:annotations:23.0.0'
|
||||
annotationProcessor 'org.jetbrains:annotations:23.0.0'
|
||||
compileOnlyApi 'org.jetbrains:annotations:24.1.0'
|
||||
annotationProcessor 'org.jetbrains:annotations:24.1.0'
|
||||
patchedMinecraft('net.minecraft:launchwrapper:1.17.2') {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
if (includeCommonDevEnvMods.toBoolean()) {
|
||||
implementation 'mezz.jei:jei_1.12.2:4.16.1.302'
|
||||
@@ -374,11 +533,20 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
if (getFile('gradle/scripts/dependencies.gradle').exists()) {
|
||||
apply from: 'gradle/scripts/dependencies.gradle'
|
||||
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
|
||||
if (usesMixins.toBoolean()) {
|
||||
dependencies {
|
||||
kapt(mixinProviderSpec)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (getFile('dependencies.gradle').exists()) {
|
||||
apply from: 'dependencies.gradle'
|
||||
} else if (getFile('dependencies.gradle.kts').exists()) {
|
||||
apply from: 'dependencies.gradle.kts'
|
||||
}
|
||||
|
||||
apply from: 'gradle/scripts/optional.gradle'
|
||||
|
||||
// Test configuration
|
||||
|
||||
@@ -412,6 +580,7 @@ test {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Resource processing and jar building
|
||||
|
||||
processResources {
|
||||
@@ -464,20 +633,20 @@ tasks.register('generateAssets') {
|
||||
mcmodInfoFile.text = """[{
|
||||
"modid": "\${modid}",
|
||||
"name": "\${modname}",
|
||||
"description": "A Mod about Matter, Energy and using them to conquer the world..",
|
||||
"description": "An example mod for Minecraft 1.12.2 with Forge",
|
||||
"version": "\${version}",
|
||||
"mcversion": "\${mcversion}",
|
||||
"logoFile": "assets/appliedenergistics2/meta/logo.png",
|
||||
"url": "https://github.com/PrototypeTrousers/Applied-Energistics-2",
|
||||
"authorList": ["AlgorithmX2"],
|
||||
"credits": "AlgorithmX2",
|
||||
"logoFile": "",
|
||||
"url": "",
|
||||
"authorList": [],
|
||||
"credits": "",
|
||||
"dependencies": []
|
||||
}]
|
||||
"""
|
||||
}
|
||||
|
||||
// mixins.{modid}.json
|
||||
if (usesMixins.toBoolean()) {
|
||||
if (usesMixins.toBoolean() && generateMixinConfig.toBoolean()) {
|
||||
def mixinConfigFile = getFile("src/main/resources/mixins.${modId}.json")
|
||||
if (!mixinConfigFile.exists()) {
|
||||
def mixinConfigRefmap = "mixins.${modId}.refmap.json"
|
||||
@@ -514,26 +683,49 @@ jar {
|
||||
}
|
||||
}
|
||||
|
||||
from sourceSets.api.output
|
||||
dependsOn apiClasses
|
||||
if (useSrcApiPath && apiPackage) {
|
||||
from sourceSets.api.output
|
||||
dependsOn apiClasses
|
||||
|
||||
// specify which files are really included, can control which APIs should be in
|
||||
include "appeng/**"
|
||||
include "assets/**"
|
||||
include "mcmod.info"
|
||||
include "pack.mcmeta"
|
||||
include "META-INF/appliedenergistics2_at.cfg"
|
||||
include "${modGroupPath}/**"
|
||||
include "assets/**"
|
||||
include "mcmod.info"
|
||||
include "pack.mcmeta"
|
||||
if (accessTransformersFile) {
|
||||
include "META-INF/${accessTransformersFile}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Configure default run tasks
|
||||
if (separateRunDirectories.toBoolean()) {
|
||||
runClient {
|
||||
workingDir = file('run/client')
|
||||
}
|
||||
|
||||
runServer {
|
||||
workingDir = file('run/server')
|
||||
}
|
||||
}
|
||||
|
||||
// Create API library jar
|
||||
tasks.register('apiJar', Jar) {
|
||||
archiveClassifier.set 'api'
|
||||
from(sourceSets.api.java) {
|
||||
include "${modGroupPath}/${apiPackagePath}/**"
|
||||
}
|
||||
if (useSrcApiPath) {
|
||||
from(sourceSets.api.java) {
|
||||
include "${modGroupPath}/${apiPackagePath}/**"
|
||||
}
|
||||
from(sourceSets.api.output) {
|
||||
include "${modGroupPath}/${apiPackagePath}/**"
|
||||
}
|
||||
} else {
|
||||
from(sourceSets.main.java) {
|
||||
include "${modGroupPath}/${apiPackagePath}/**"
|
||||
}
|
||||
|
||||
from(sourceSets.api.output) {
|
||||
include "${modGroupPath}/${apiPackagePath}/**"
|
||||
from(sourceSets.main.output) {
|
||||
include "${modGroupPath}/${apiPackagePath}/**"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +758,7 @@ if (usesShadowedDependencies.toBoolean()) {
|
||||
finalizedBy(tasks.shadowJar)
|
||||
}
|
||||
tasks.named('reobfJar', ReobfuscatedJar) {
|
||||
inputJar.set(tasks.named('shadowJar', ShadowJar).flatMap({ it.archiveFile }))
|
||||
inputJar.set(tasks.named('shadowJar', ShadowJar).flatMap({it.archiveFile}))
|
||||
}
|
||||
AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.findByName('java')
|
||||
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
|
||||
@@ -701,7 +893,7 @@ tasks.register('generateChangelog') {
|
||||
.collect { ['--', it] }).flatten())
|
||||
|
||||
if (changelog) {
|
||||
changelog = "Changes since ${lastTag}:\n${{ ("\n" + changelog).replaceAll("\n", "\n* ") }}"
|
||||
changelog = "Changes since ${lastTag}:\n${{("\n" + changelog).replaceAll("\n", "\n* ")}}"
|
||||
}
|
||||
def f = getFile('build/changelog.md')
|
||||
changelog = changelog ?: 'There have been no changes.'
|
||||
@@ -727,7 +919,7 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
||||
def changelogFile = getChangelog()
|
||||
def changelogRaw = changelogFile.exists() ? changelogFile.getText('UTF-8') : ""
|
||||
|
||||
mainFile.displayName = "${modName}: ${modVersion}"
|
||||
mainFile.displayName = versionDisplayFormat.replace('$MOD_NAME', modName).replace('$VERSION', modVersion)
|
||||
mainFile.releaseType = getReleaseType()
|
||||
mainFile.changelog = changelogRaw
|
||||
mainFile.changelogType = 'markdown'
|
||||
@@ -743,6 +935,12 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
||||
}
|
||||
String[] parts = dep.split(':')
|
||||
String type = parts[0], slug = parts[1]
|
||||
def types = [
|
||||
'req' : 'requiredDependency', 'required': 'requiredDependency',
|
||||
'opt' : 'optionalDependency', 'optional': 'optionalDependency',
|
||||
'embed' : 'embeddedLibrary', 'embedded': 'embeddedLibrary',
|
||||
'incomp': 'incompatible', 'fail' : 'incompatible']
|
||||
if (types.containsKey(type)) type = types[type]
|
||||
if (!(type in ['requiredDependency', 'embeddedLibrary', 'optionalDependency', 'tool', 'incompatible'])) {
|
||||
throw new Exception('Invalid Curseforge dependency type: ' + type)
|
||||
}
|
||||
@@ -767,6 +965,7 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
||||
modrinth {
|
||||
token = modrinthApiKey.getOrElse('debug_token')
|
||||
projectId = modrinthProjectId
|
||||
versionName = versionDisplayFormat.replace('$MOD_NAME', modName).replace('$VERSION', modVersion)
|
||||
changelog = changelogFile.exists() ? changelogFile.getText('UTF-8') : ""
|
||||
versionType = getReleaseType()
|
||||
versionNumber = modVersion
|
||||
@@ -784,7 +983,7 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
||||
}
|
||||
String[] parts = dep.split(':')
|
||||
String[] qual = parts[0].split('-')
|
||||
addModrinthDep(qual[0], qual[1], parts[1])
|
||||
addModrinthDep(qual[0], qual.length > 1 ? qual[1] : 'project', parts[1])
|
||||
}
|
||||
}
|
||||
tasks.modrinth.dependsOn(build)
|
||||
@@ -793,9 +992,17 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
||||
|
||||
def addModrinthDep(String scope, String type, String name) {
|
||||
com.modrinth.minotaur.dependencies.Dependency dep
|
||||
def types = [
|
||||
'req' : 'required',
|
||||
'opt' : 'optional',
|
||||
'embed' : 'embedded',
|
||||
'incomp': 'incompatible', 'fail': 'incompatible']
|
||||
if (types.containsKey(scope)) scope = types[scope]
|
||||
if (!(scope in ['required', 'optional', 'incompatible', 'embedded'])) {
|
||||
throw new Exception('Invalid modrinth dependency scope: ' + scope)
|
||||
}
|
||||
types = ['proj': 'project', '': 'project', 'p': 'project', 'ver': 'version', 'v': 'version']
|
||||
if (types.containsKey(type)) type = types[type]
|
||||
switch (type) {
|
||||
case 'project':
|
||||
dep = new ModDependency(name, scope)
|
||||
@@ -823,8 +1030,8 @@ if (customMavenPublishUrl) {
|
||||
}
|
||||
|
||||
// providers is not available here, use System for getting env vars
|
||||
groupId = System.getenv('ARTIFACT_GROUP_ID') ?: project.group
|
||||
artifactId = System.getenv('ARTIFACT_ID') ?: project.name
|
||||
groupId = System.getenv('ARTIFACT_GROUP_ID') ?: project.mavenArtifactGroup
|
||||
artifactId = System.getenv('ARTIFACT_ID') ?: project.modArchivesBaseName
|
||||
version = System.getenv('RELEASE_VERSION') ?: publishedVersion
|
||||
}
|
||||
}
|
||||
@@ -862,7 +1069,6 @@ def getReleaseType() {
|
||||
* Next, if 'generateDefaultChangelog' option is enabled, use that.
|
||||
* Otherwise, try to use a CHANGELOG.md file at root directory.
|
||||
*/
|
||||
|
||||
def getChangelog() {
|
||||
def final changelogEnv = providers.environmentVariable('CHANGELOG_LOCATION')
|
||||
if (changelogEnv.isPresent()) {
|
||||
@@ -877,7 +1083,7 @@ def getChangelog() {
|
||||
|
||||
// Buildscript updating
|
||||
|
||||
def buildscriptGradleVersion = '8.1.1'
|
||||
def buildscriptGradleVersion = '8.5'
|
||||
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
gradleVersion = buildscriptGradleVersion
|
||||
@@ -912,29 +1118,18 @@ static URL availableBuildScriptUrl() {
|
||||
new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/build.gradle")
|
||||
}
|
||||
|
||||
static URL exampleSettingsGradleUrl() {
|
||||
static URL availableSettingsGradleUrl() {
|
||||
new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/settings.gradle")
|
||||
}
|
||||
|
||||
boolean verifySettingsGradle() {
|
||||
def settingsFile = getFile("settings.gradle")
|
||||
if (!settingsFile.exists()) {
|
||||
println("Downloading default settings.gradle")
|
||||
exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
boolean performBuildScriptUpdate() {
|
||||
if (isNewBuildScriptVersionAvailable()) {
|
||||
def buildscriptFile = getFile("build.gradle")
|
||||
def settingsFile = getFile("settings.gradle")
|
||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
||||
availableSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
|
||||
def out = services.get(StyledTextOutputFactory).create('buildscript-update-output')
|
||||
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
||||
if (verifySettingsGradle()) {
|
||||
throw new GradleException("Settings has been updated, please re-run task.")
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -981,6 +1176,11 @@ tasks.register('faq') {
|
||||
|
||||
// Helpers
|
||||
|
||||
def getDefaultArtifactGroup() {
|
||||
def lastIndex = project.modGroup.lastIndexOf('.')
|
||||
return lastIndex < 0 ? project.modGroup : project.modGroup.substring(0, lastIndex)
|
||||
}
|
||||
|
||||
def getFile(String relativePath) {
|
||||
return new File(projectDir, relativePath)
|
||||
}
|
||||
@@ -1024,4 +1224,4 @@ def getLastTag() {
|
||||
def githubTag = providers.environmentVariable('GITHUB_TAG')
|
||||
return runShell('git describe --abbrev=0 --tags ' +
|
||||
(githubTag.isPresent() ? runShell('git rev-list --tags --skip=1 --max-count=1') : ''))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//file:noinspection DependencyNotationArgument
|
||||
// TODO remove when fixed in RFG ^
|
||||
/*
|
||||
* Add your dependencies here. Common configurations:
|
||||
* - implementation("group:name:version:classifier"): if you need this for internal implementation details of the mod.
|
||||
* Available at compiletime and runtime for your environment.
|
||||
*
|
||||
* - compileOnlyApi("g:n:v:c"): if you need this for internal implementation details of the mod.
|
||||
* Available at compiletime but not runtime for your environment.
|
||||
*
|
||||
* - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry
|
||||
*
|
||||
* - testCONFIG("g:n:v:c"): replace CONFIG by one of the above, same as above but for the test sources instead of main
|
||||
*
|
||||
* You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed.
|
||||
*
|
||||
* To add a mod with CurseMaven, replace '("g:n:v:c")' in the above with 'rfg.deobf("curse.maven:project_slug-project_id:file_id")'
|
||||
* Example: implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4527757")
|
||||
*
|
||||
* To shadow a dependency, use 'shadowImplementation'. For more info, see https://github.com/GregTechCEu/Buildscripts/blob/master/docs/shadow.md
|
||||
*
|
||||
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
||||
*/
|
||||
dependencies {
|
||||
|
||||
// Mods always in-game
|
||||
implementation rfg.deobf("curse.maven:gregtechceu-557242:4429261") // GTCEu
|
||||
implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // CCL 3.2.3.358
|
||||
implementation rfg.deobf("curse.maven:baubles-227083:2518667") // Baubles
|
||||
implementation rfg.deobf("curse.maven:industrial-craft-242638:2547175") // IC2
|
||||
implementation rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry
|
||||
|
||||
// Mods only in code by default
|
||||
compileOnly "curse.maven:chisel-235279:2915375"
|
||||
compileOnly "curse.maven:hwyla-253449:2568751"
|
||||
compileOnly "curse.maven:recipe-stages-280554:3405072"
|
||||
compileOnly "curse.maven:item-stages-280316:2696769"
|
||||
compileOnly "curse.maven:game-stages-268655:2951844"
|
||||
compileOnly "net.darkhax.tesla:Tesla-1.12.2:1.0.63"
|
||||
compileOnly "curse.maven:CoFHCore-69162:2920433"
|
||||
compileOnly "CraftTweaker2:CraftTweaker2-API:4.1.20.684"
|
||||
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
|
||||
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
|
||||
compileOnly rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31
|
||||
compileOnly rfg.deobf("curse.maven:actually-additions-228404:3117927") // ActuallyAdditions r152
|
||||
}
|
||||
|
||||
minecraft {
|
||||
injectedTags.put('AEVERSION', aeversion)
|
||||
injectedTags.put('AECHANNEL', aechannel)
|
||||
injectedTags.put('AEBUILD', aebuild)
|
||||
}
|
||||
+109
-73
@@ -1,148 +1,184 @@
|
||||
modName = AE2 Unofficial Extended Life
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
modId = appliedenergistics2
|
||||
|
||||
modGroup = appeng
|
||||
|
||||
# Version of your mod.
|
||||
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
|
||||
modVersion =
|
||||
|
||||
# AE2 Specific Version Settings
|
||||
aeversion=rv6
|
||||
aechannel=stable
|
||||
aebuild=7
|
||||
aegroup=appeng
|
||||
aebasename=appliedenergistics2
|
||||
#########################################################
|
||||
# Versions #
|
||||
#########################################################
|
||||
minecraft_version=1.12.2
|
||||
mcp_mappings=snapshot_20171003
|
||||
forge_version=14.23.5.2847
|
||||
#########################################################
|
||||
# Installable #
|
||||
#########################################################
|
||||
hwyla_version=1.8.26-B41_1.12.2
|
||||
#########################################################
|
||||
# Provided APIs #
|
||||
#########################################################
|
||||
jei_version=4.16.1.302
|
||||
tesla_version=1.0.63
|
||||
ic2_version=2.8.73-ex112
|
||||
top_version=1.12-1.4.23-16
|
||||
crafttweaker_version=4.1.20.684
|
||||
ctm_version=MC1.12.2-0.3.1.16
|
||||
forestry_version=5.8.2.387
|
||||
#########################################################
|
||||
# Deployment #
|
||||
#########################################################
|
||||
website_version=1.12.2
|
||||
curse_versions=1.12.2
|
||||
mapping_channel=snapshot
|
||||
mapping_version=20171003
|
||||
# Run Configurations
|
||||
minecraft_username=Developer
|
||||
extra_jvm_args=
|
||||
modName=Applied Energistics 2
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
modId=appliedenergistics2
|
||||
modGroup=appeng
|
||||
# Version of your mod.
|
||||
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
|
||||
modVersion=rv6-stable-7-extended_life-v0.55.21
|
||||
|
||||
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
|
||||
includeMCVersionJar=false
|
||||
includeMCVersionJar = false
|
||||
|
||||
# The name of your jar when you produce builds, not including any versioning info
|
||||
modArchivesBaseName=appliedenergistics2
|
||||
modArchivesBaseName = ae2-uel
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
autoUpdateBuildScript=false
|
||||
minecraftVersion=1.12.2
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
minecraftVersion = 1.12.2
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username 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
|
||||
# Alternatively this can be set with the 'DEV_USERNAME' environment variable.
|
||||
developmentEnvironmentUserName=Developer
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
# Using this requires that you use a Java 17 JDK for development.
|
||||
enableModernJavaSyntax=true
|
||||
enableModernJavaSyntax = true
|
||||
|
||||
# Generate a class with String fields for the mod id, name and version named with the fields below
|
||||
generateGradleTokenClass=appeng.Tags
|
||||
gradleTokenModId=
|
||||
gradleTokenModName=
|
||||
gradleTokenVersion=VERSION
|
||||
generateGradleTokenClass = appeng.Tags
|
||||
gradleTokenModId = MODID
|
||||
gradleTokenModName = MODNAME
|
||||
gradleTokenVersion = VERSION
|
||||
|
||||
# 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
|
||||
apiPackage = api
|
||||
|
||||
# If you want to keep your API code in src/api instead of src/main
|
||||
useSrcApiPath = true
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/
|
||||
# There can be multiple files in a comma-separated list.
|
||||
# Example value: mymodid_at.cfg,jei_at.cfg
|
||||
accessTransformersFile=appliedenergistics2_at.cfg
|
||||
accessTransformersFile = appliedenergistics2_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins=false
|
||||
usesMixins = false
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage=
|
||||
mixinsPackage =
|
||||
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
|
||||
generateMixinConfig = false
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass=core.AE2ELCore
|
||||
coreModClass = core.AE2ELCore
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that
|
||||
# there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly=false
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins=false
|
||||
forceEnableMixins = false
|
||||
|
||||
# Outputs pre-transformed and post-transformed loaded classes to run/CLASSLOADER_TEMP. Can be used in combination with
|
||||
# diff to see exactly what your ASM or Mixins are changing in the target file.
|
||||
# Optionally can be specified with the 'CORE_MOD_DEBUG' env var. Will output a lot of files!
|
||||
enableCoreModDebug = false
|
||||
|
||||
# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
|
||||
includeWellKnownRepositories=true
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will
|
||||
# be available at compiletime and runtime for your mod (in-game and in-code).
|
||||
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
|
||||
includeCommonDevEnvMods=true
|
||||
includeCommonDevEnvMods = true
|
||||
|
||||
|
||||
# If enabled, you may use 'shadowCompile' 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
|
||||
usesShadowedDependencies = false
|
||||
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
|
||||
# their own classes, making the minimization unreliable.
|
||||
minimizeShadowedDependencies=true
|
||||
minimizeShadowedDependencies = true
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies=true
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Separate run directories into "run/client" for runClient task, and "run/server" for runServer task.
|
||||
# Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/"
|
||||
separateRunDirectories = false
|
||||
|
||||
# The display name format of versions published to Curse and Modrinth. $MOD_NAME and $VERSION are available variables.
|
||||
# Default: $MOD_NAME \u2212 $VERSION. \u2212 is the minus character which looks much better than the hyphen minus on Curse.
|
||||
versionDisplayFormat = $MOD_NAME \u2212 $VERSION
|
||||
|
||||
# Publishing to modrinth requires you to set the MODRINTH_API_KEY environment variable to your current modrinth API token.
|
||||
|
||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||
# Leave this empty if you don't want to publish on Modrinth.
|
||||
# Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable.
|
||||
modrinthProjectId=
|
||||
modrinthProjectId =
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:jei;optional-project:top;incompatible-project:gregtech
|
||||
modrinthRelations=
|
||||
modrinthRelations =
|
||||
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_API_KEY environment variable to one of your CurseForge API tokens.
|
||||
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
# Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable.
|
||||
curseForgeProjectId=
|
||||
curseForgeProjectId =
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
curseForgeRelations=
|
||||
curseForgeRelations =
|
||||
|
||||
# This project's release type on CurseForge and/or Modrinth
|
||||
# Alternatively this can be set with the 'RELEASE_TYPE' environment variable.
|
||||
# Allowed types: release, beta, alpha
|
||||
releaseType=beta
|
||||
releaseType = release
|
||||
|
||||
# Generate a default changelog for releases. Requires git to be installed, as it uses it to generate a changelog of
|
||||
# commits since the last tagged release.
|
||||
generateDefaultChangelog=false
|
||||
generateDefaultChangelog = false
|
||||
|
||||
# Prevent the source code from being published
|
||||
noPublishedSources=false
|
||||
noPublishedSources = false
|
||||
|
||||
|
||||
# Publish to a custom maven location. Follows a few rules:
|
||||
# Group ID can be set with the 'ARTIFACT_GROUP_ID' environment variable, default to 'project.group'
|
||||
# Artifact ID can be set with the 'ARTIFACT_ID' environment variable, default to 'project.name'
|
||||
# Version can be set with the 'RELEASE_VERSION' environment variable, default to 'modVersion'
|
||||
# For maven credentials:
|
||||
# Username is set with the 'MAVEN_USER' environment variable, default to "NONE"
|
||||
# Password is set with the 'MAVEN_PASSWORD' environment variable, default to "NONE"
|
||||
customMavenPublishUrl =
|
||||
|
||||
# The group for maven artifacts. Defaults to the 'project.modGroup' until the last '.' (if any).
|
||||
# So 'mymod' becomes 'mymod' and 'com.myname.mymodid' 'becomes com.myname'
|
||||
mavenArtifactGroup =
|
||||
|
||||
# Enable spotless checks
|
||||
# Enforces code formatting on your source code
|
||||
# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless
|
||||
# to format your code. However, you can create your own version of these files and place them in your project's
|
||||
# root directory to apply your own formatting options instead.
|
||||
enableSpotless=false
|
||||
enableSpotless = false
|
||||
|
||||
# Enable JUnit testing platform used for testing your code.
|
||||
# Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/
|
||||
enableJUnit=true
|
||||
enableJUnit = true
|
||||
|
||||
# Deployment debug setting
|
||||
# Uncomment this to test deployments to CurseForge and Modrinth
|
||||
# Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable.
|
||||
deploymentDebug=false
|
||||
deploymentDebug = false
|
||||
|
||||
|
||||
# Gradle Settings
|
||||
# Effectively applies the '--stacktrace' flag by default
|
||||
org.gradle.logging.stacktrace=all
|
||||
org.gradle.logging.stacktrace = all
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.jvmargs = -Xmx3G
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
maven {
|
||||
url "https://cursemaven.com"
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "CurseForge"
|
||||
url = "https://minecraft.curseforge.com/api/maven/"
|
||||
}
|
||||
|
||||
maven {
|
||||
name "Mobius"
|
||||
url "http://mobiusstrip.eu/maven"
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "JEI repo"
|
||||
url "http://dvs1.progwml6.com/files/maven"
|
||||
}
|
||||
|
||||
maven {
|
||||
name "Ellpeck"
|
||||
url "https://maven.ellpeck.de"
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "IC2 repo"
|
||||
url = "http://maven.ic2.player.to"
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "CoFH Maven"
|
||||
url = "http://maven.covers1624.net"
|
||||
}
|
||||
|
||||
maven { // TheOneProbe
|
||||
name 'tterrag maven'
|
||||
url "http://maven.tterrag.com/"
|
||||
}
|
||||
|
||||
maven { // McJtyLib
|
||||
name 'mcjty'
|
||||
url "http://maven.k-4u.nl/"
|
||||
}
|
||||
|
||||
maven { // CraftTweaker
|
||||
name 'jared maven'
|
||||
url "http://maven.blamejared.com/"
|
||||
}
|
||||
|
||||
//maven { // modmaven, maven proxy
|
||||
// name 'modmaven'
|
||||
// url "https://modmaven.k-4u.nl/"
|
||||
//}
|
||||
}
|
||||
|
||||
configurations {
|
||||
mods
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
||||
// installable runtime dependencies
|
||||
implementation rfg.deobf("curse.maven:gregtechceu-557242:4429261")
|
||||
|
||||
compileOnly "curse.maven:chisel-235279:2915375"
|
||||
|
||||
implementation rfg.deobf("curse.maven:baubles-227083:2518667")
|
||||
//mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
mods "curse.maven:hwyla-253449:2568751"
|
||||
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
||||
|
||||
// compile against provided APIs
|
||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
compileOnly "curse.maven:hwyla-253449:2568751"
|
||||
//Code chicken lib, GTCE dependency
|
||||
implementation rfg.deobf("curse.maven:CCL-242818:2779848")
|
||||
|
||||
compileOnly "curse.maven:recipe-stages-280554:3405072"
|
||||
compileOnly "curse.maven:item-stages-280316:2696769"
|
||||
compileOnly "curse.maven:game-stages-268655:2951844"
|
||||
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||
compileOnly "curse.maven:CoFHCore-69162:2920433"
|
||||
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
|
||||
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
|
||||
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
|
||||
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
|
||||
implementation rfg.deobf("net.sengir.forestry:forestry_${minecraft_version}:$forestry_version")
|
||||
|
||||
// at runtime, use the full JEI jar
|
||||
runtimeOnly "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||
|
||||
// unit test dependencies
|
||||
testImplementation "junit:junit:4.12"
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
// HWYLA
|
||||
tasks.register('installHwyla', Copy) {
|
||||
dependsOn "deinstallHwyla"
|
||||
from { configurations.mods }
|
||||
include "**/*Hwyla*.jar"
|
||||
into file("/run/mods")
|
||||
}
|
||||
|
||||
tasks.register('deinstallHwyla', Delete) {
|
||||
delete fileTree(dir: "/run/mods", include: "*Hwyla*.jar")
|
||||
}
|
||||
|
||||
// IC2
|
||||
tasks.register('installIC2', Copy) {
|
||||
dependsOn "deinstallIC2"
|
||||
from { configurations.mods }
|
||||
include "**/*industrialcraft-2*.jar"
|
||||
into file("/run/mods")
|
||||
}
|
||||
|
||||
tasks.register('deinstallIC2', Delete) {
|
||||
delete fileTree(dir: "/run/mods", include: "*industrialcraft-2*.jar")
|
||||
}
|
||||
|
||||
// TOP
|
||||
tasks.register('installTop', Copy) {
|
||||
dependsOn["deinstallTop"]
|
||||
from { configurations.mods }
|
||||
include "**/*TheOneProbe*.jar"
|
||||
into file("/run/mods")
|
||||
}
|
||||
|
||||
tasks.register('deinstallTop', Delete) {
|
||||
delete fileTree(dir: "/run/mods", include: "*TheOneProbe*.jar")
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -85,9 +85,6 @@ done
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# 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
|
||||
|
||||
@@ -133,10 +130,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
||||
Vendored
+32
-24
@@ -1,4 +1,20 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@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
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -9,19 +25,23 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -35,7 +55,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -45,38 +65,26 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
+9
-5
@@ -3,9 +3,7 @@ pluginManagement {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name 'GTNH Maven'
|
||||
//noinspection HttpUrlsUsage
|
||||
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
|
||||
allowInsecureProtocol = true
|
||||
url 'https://nexus.gtnewhorizons.com/repository/public/'
|
||||
//noinspection GroovyAssignabilityCheck
|
||||
mavenContent {
|
||||
includeGroup 'com.gtnewhorizons'
|
||||
@@ -19,8 +17,14 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.7.0'
|
||||
// Automatic toolchain provisioning
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||
}
|
||||
|
||||
rootProject.name = rootProject.projectDir.getName()
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'spotless'
|
||||
github 'GregTechCEu/Buildscripts', 'tag', 'v1.0.7'
|
||||
}
|
||||
|
||||
rootProject.name = rootProject.projectDir.getName()
|
||||
|
||||
@@ -81,7 +81,11 @@ public enum Settings
|
||||
|
||||
PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
|
||||
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) );
|
||||
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) ),
|
||||
|
||||
STICKY_MODE( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||
|
||||
;
|
||||
|
||||
private final EnumSet<? extends Enum<?>> values;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public enum Upgrades {
|
||||
REDSTONE(0),
|
||||
CRAFTING(0),
|
||||
MAGNET(0),
|
||||
STICKY(0),
|
||||
|
||||
/**
|
||||
* Diamond Tier Upgrades.
|
||||
|
||||
@@ -100,6 +100,8 @@ public interface IMaterials {
|
||||
|
||||
IItemDefinition cardCrafting();
|
||||
|
||||
IItemDefinition cardSticky();
|
||||
|
||||
IItemDefinition enderDust();
|
||||
|
||||
IItemDefinition flour();
|
||||
|
||||
@@ -40,11 +40,13 @@ public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable
|
||||
/**
|
||||
* 0 - cell is missing.
|
||||
*
|
||||
* 1 - green,
|
||||
* 1 - green, the cell is present and partially empty
|
||||
*
|
||||
* 2 - orange,
|
||||
* 2 - orange, the cell is present and full on types
|
||||
*
|
||||
* 3 - red
|
||||
* 3 - red, the cell is present and full on bytes
|
||||
*
|
||||
* 4 - blue, the cell is present but totally empty
|
||||
*
|
||||
* @param slot slot index
|
||||
*
|
||||
|
||||
@@ -41,6 +41,13 @@ import appeng.api.util.AEPartLocation;
|
||||
public interface IFacadeContainer
|
||||
{
|
||||
|
||||
/**
|
||||
* Checks if the {@link IFacadePart} can be added to the given side.
|
||||
*
|
||||
* @return true if the facade can be successfully added
|
||||
*/
|
||||
boolean canAddFacade( IFacadePart a );
|
||||
|
||||
/**
|
||||
* Attempts to add the {@link IFacadePart} to the given side.
|
||||
*
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
package appeng.api.parts;
|
||||
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
@@ -32,35 +33,11 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public interface IPartHelper
|
||||
{
|
||||
/**
|
||||
* Register a new layer with the part layer system, this allows you to write an in between between tile entities and
|
||||
* parts.
|
||||
*
|
||||
* AE By Default includes,
|
||||
*
|
||||
* 1. ISidedInventory ( and by extension IInventory. )
|
||||
*
|
||||
* 2. IFluidHandler Forge Fluids
|
||||
*
|
||||
* 3. IPowerEmitter BC Power output.
|
||||
*
|
||||
* 4. IPowerReceptor BC Power input.
|
||||
*
|
||||
* 5. IEnergySink IC2 Power input.
|
||||
*
|
||||
* 6. IEnergySource IC2 Power output.
|
||||
*
|
||||
* 7. IPipeConnection BC Pipe Connections
|
||||
*
|
||||
* As long as a valid layer is registered for a interface you can simply implement that interface on a part get
|
||||
* implement it.
|
||||
*
|
||||
* @return true on success, false on failure, usually a error will be logged as well.
|
||||
*/
|
||||
boolean registerNewLayer( String string, String layerInterface );
|
||||
|
||||
/**
|
||||
* use in use item, to try and place a IBusItem
|
||||
@@ -79,4 +56,51 @@ public interface IPartHelper
|
||||
* @return the render mode
|
||||
*/
|
||||
CableRenderMode getCableRenderMode();
|
||||
|
||||
/**
|
||||
* Try to get a part at a specific place in the world.
|
||||
*
|
||||
* @param w world the part is in
|
||||
* @param pos pos of the part host
|
||||
* @param side side to test for a part on.
|
||||
*
|
||||
* @return the part if it exists, null otherwise
|
||||
*/
|
||||
@Nullable
|
||||
IPart getPart( World w, BlockPos pos, AEPartLocation side );
|
||||
|
||||
/**
|
||||
* Try to get a part host at a specific place in the world.
|
||||
*
|
||||
* @param w world the part host is in
|
||||
* @param pos pos of the part host
|
||||
*
|
||||
* @return the part host if it exists, null otherwise
|
||||
*/
|
||||
@Nullable
|
||||
IPartHost getPartHost( World w, BlockPos pos );
|
||||
|
||||
/**
|
||||
* Get a part host if it exists, or place one if it doesn't.
|
||||
*
|
||||
* @param w world the part host is in
|
||||
* @param pos pos to get or place the part host
|
||||
* @param force whether to skip permission and existing block checks and forcibly place the part host here.
|
||||
* @param p the placing player, or null if none
|
||||
*
|
||||
* @return the existing or created part host, or null if it didn't already exist and part host is unable to be placed.
|
||||
*/
|
||||
@Nullable
|
||||
IPartHost getOrPlacePartHost( World w, BlockPos pos, boolean force, @Nullable EntityPlayer p );
|
||||
|
||||
/**
|
||||
* Test if a part host can be successfully placed at a given position by the provided player.
|
||||
*
|
||||
* @param w world the part host is in
|
||||
* @param pos pos to test for part host placement
|
||||
* @param p the placing player, or null if none
|
||||
*
|
||||
* @return if the part can be placed at the provided world and position
|
||||
*/
|
||||
boolean canPlacePartHost( World w, BlockPos pos, @Nullable EntityPlayer p );
|
||||
}
|
||||
|
||||
@@ -145,13 +145,24 @@ public interface IPartHost extends ICustomCableConnection
|
||||
*/
|
||||
SelectedPart selectPart( Vec3d pos );
|
||||
|
||||
/**
|
||||
* Same as {@link #selectPart(Vec3d)}, but with global instead of local coordinates.
|
||||
*/
|
||||
default SelectedPart selectPartGlobal( Vec3d pos ) {
|
||||
DimensionalCoord globalPos = getLocation();
|
||||
return selectPart(pos.subtract(
|
||||
globalPos.getPos().getX(),
|
||||
globalPos.getPos().getY(),
|
||||
globalPos.getPos().getZ()));
|
||||
}
|
||||
|
||||
/**
|
||||
* can be used by parts to trigger the tile or part to save.
|
||||
*/
|
||||
void markForSave();
|
||||
|
||||
/**
|
||||
* part of the {@link LayerBase}
|
||||
* called when parts are added or removed
|
||||
*/
|
||||
void partChanged();
|
||||
|
||||
@@ -169,11 +180,6 @@ public interface IPartHost extends ICustomCableConnection
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* @return a mutable list of flags you can adjust to track state.
|
||||
*/
|
||||
Set<LayerFlags> getLayerFlags();
|
||||
|
||||
/**
|
||||
* remove host from world...
|
||||
*/
|
||||
@@ -191,4 +197,4 @@ public interface IPartHost extends ICustomCableConnection
|
||||
*/
|
||||
boolean isInWorld();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.parts;
|
||||
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
|
||||
/**
|
||||
* All Layers must extends this, this get part implementation is provided to interface with the parts, however a real
|
||||
* implementation will be used at runtime.
|
||||
*
|
||||
* TODO: Consider removing and replacing with capabilities.
|
||||
*/
|
||||
public abstract class LayerBase extends TileEntity // implements IPartHost
|
||||
{
|
||||
|
||||
/**
|
||||
* Grants access for the layer to the parts of the host.
|
||||
*
|
||||
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
|
||||
*
|
||||
* @param side side of part
|
||||
*
|
||||
* @return the part for the requested side.
|
||||
*/
|
||||
public IPart getPart( final AEPartLocation side )
|
||||
{
|
||||
return null; // place holder.
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants access for the layer to the parts of the host.
|
||||
*
|
||||
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
|
||||
*
|
||||
* @param side side of part
|
||||
*
|
||||
* @return the part for the requested side.
|
||||
*/
|
||||
public IPart getPart( final EnumFacing side )
|
||||
{
|
||||
return null; // place holder.
|
||||
}
|
||||
|
||||
/**
|
||||
* called when the parts change in the container, YOU MUST CALL super.PartChanged();
|
||||
*/
|
||||
public void notifyNeighbors()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* called when the parts change in the container, YOU MUST CALL super.PartChanged();
|
||||
*/
|
||||
public void partChanged()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a mutable list of flags you can adjust to track state.
|
||||
*/
|
||||
public Set<LayerFlags> getLayerFlags()
|
||||
{
|
||||
return null; // place holder.
|
||||
}
|
||||
|
||||
public void markForSave()
|
||||
{
|
||||
// something!
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.parts;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Consider removing and replacing with capabilities.
|
||||
*/
|
||||
public enum LayerFlags
|
||||
{
|
||||
|
||||
IC2_ENET
|
||||
|
||||
}
|
||||
@@ -123,6 +123,8 @@ public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
|
||||
*
|
||||
* 3 - red, ( usually means the cell is 100% full )
|
||||
*
|
||||
* 4 - blue, ( usually means the cell is available and completely empty. )
|
||||
*
|
||||
* @return get the status of the cell based on its contents.
|
||||
*/
|
||||
int getStatusForCell();
|
||||
|
||||
@@ -89,4 +89,12 @@ public interface IMEInventoryHandler<T extends IAEStack<T>> extends IMEInventory
|
||||
* @return true, if this inventory is valid for this pass.
|
||||
*/
|
||||
boolean validForPass( int i );
|
||||
|
||||
/**
|
||||
* Gets whether an inventory is "Sticky" i.e. only it and other sticky storages that have partitions with certain
|
||||
* items are allowed to be put into sticky storages.
|
||||
*/
|
||||
default boolean isSticky() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
package yalter.mousetweaks.api;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
/**
|
||||
* This is the interface you want to implement in your GuiScreen to make it compatible with Mouse Tweaks.
|
||||
* If this interface is not enough (for example, you need a custom slot click function, or if you use a custom Container
|
||||
* which happens to be incompatible), check IMTModGuiContainer2Ex instead.
|
||||
* If you just need to disable Mouse Tweaks or the wheel tweak, see the MouseTweaksIgnore
|
||||
* or the MouseTweaksDisableWheelTweak annotations.
|
||||
*/
|
||||
public interface IMTModGuiContainer2 {
|
||||
/**
|
||||
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
|
||||
*
|
||||
* @return True if Mouse Tweaks should be disabled, false otherwise.
|
||||
*/
|
||||
boolean MT_isMouseTweaksDisabled();
|
||||
|
||||
/**
|
||||
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
|
||||
*
|
||||
* @return True if the Wheel Tweak should be disabled, false otherwise.
|
||||
*/
|
||||
boolean MT_isWheelTweakDisabled();
|
||||
|
||||
/**
|
||||
* Returns the Container.
|
||||
*
|
||||
* @return Container that is currently in use.
|
||||
*/
|
||||
Container MT_getContainer();
|
||||
|
||||
/**
|
||||
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
|
||||
*
|
||||
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
|
||||
*/
|
||||
Slot MT_getSlotUnderMouse();
|
||||
|
||||
/**
|
||||
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
|
||||
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
|
||||
*
|
||||
* @param slot the slot to check
|
||||
* @return True if slot is a crafting output slot.
|
||||
*/
|
||||
boolean MT_isCraftingOutput(Slot slot);
|
||||
|
||||
/**
|
||||
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
|
||||
* slots and the Destroy Item slot in the vanilla creative inventory.
|
||||
*
|
||||
* @param slot the slot to check
|
||||
* @return Tru if slot should be ignored by Mouse Tweaks.
|
||||
*/
|
||||
boolean MT_isIgnored(Slot slot);
|
||||
|
||||
/**
|
||||
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
|
||||
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
|
||||
* events are handled (although note these events are handled every game tick, which is far less frequent than every
|
||||
* render tick).<br><br>
|
||||
*
|
||||
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
|
||||
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
|
||||
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
|
||||
*
|
||||
* For vanilla containers this method looks like this:
|
||||
* <pre>
|
||||
* this.ignoreMouseUp = true;
|
||||
*
|
||||
* if (this.dragSplitting) {
|
||||
* if (this.dragSplittingButton == 1) {
|
||||
* this.dragSplitting = false;
|
||||
* return true;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* return false;
|
||||
* </pre>
|
||||
*
|
||||
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
|
||||
*/
|
||||
boolean MT_disableRMBDraggingFunctionality();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package yalter.mousetweaks.api;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Put this on your GuiScreen to disable Mouse Tweaks.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface MouseTweaksIgnore {
|
||||
}
|
||||
@@ -307,13 +307,13 @@ public abstract class AEBaseBlock extends Block {
|
||||
return dir;
|
||||
}
|
||||
|
||||
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
||||
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
||||
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
||||
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
|
||||
final int west_y = forward.getZOffset() * up.getYOffset() - forward.getXOffset() * up.getZOffset();
|
||||
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
|
||||
|
||||
EnumFacing west = null;
|
||||
for (final EnumFacing dx : EnumFacing.VALUES) {
|
||||
if (dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z) {
|
||||
if (dx.getXOffset() == west_x && dx.getYOffset() == west_y && dx.getZOffset() == west_z) {
|
||||
west = dx;
|
||||
}
|
||||
}
|
||||
@@ -348,12 +348,12 @@ public abstract class AEBaseBlock extends Block {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
|
||||
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
|
||||
return this.getClass().getSimpleName() + "[" + regName + "]";
|
||||
}
|
||||
|
||||
protected String getUnlocalizedName(final ItemStack is) {
|
||||
return this.getUnlocalizedName();
|
||||
protected String getTranslationKey(final ItemStack is) {
|
||||
return this.getTranslationKey();
|
||||
}
|
||||
|
||||
protected boolean hasCustomRotation() {
|
||||
|
||||
@@ -38,6 +38,7 @@ import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -77,8 +78,9 @@ public class AEBaseItemBlock extends ItemBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(final ItemStack is) {
|
||||
return this.blockType.getUnlocalizedName(is);
|
||||
@NotNull
|
||||
public String getTranslationKey(final ItemStack is) {
|
||||
return this.blockType.getTranslationKey(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,7 +139,7 @@ public class AEBaseItemBlock extends ItemBlock {
|
||||
ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos);
|
||||
up = side;
|
||||
forward = EnumFacing.SOUTH;
|
||||
if (up.getFrontOffsetY() == 0) {
|
||||
if (up.getYOffset() == 0) {
|
||||
forward = EnumFacing.UP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,16 +36,16 @@ public abstract class AEBaseStairBlock extends BlockStairs {
|
||||
super(block.getDefaultState());
|
||||
|
||||
Preconditions.checkNotNull(block);
|
||||
Preconditions.checkNotNull(block.getUnlocalizedName());
|
||||
Preconditions.checkArgument(block.getUnlocalizedName().length() > 0);
|
||||
Preconditions.checkNotNull(block.getTranslationKey());
|
||||
Preconditions.checkArgument(block.getTranslationKey().length() > 0);
|
||||
|
||||
this.setUnlocalizedName("stair." + type);
|
||||
this.setTranslationKey("stair." + type);
|
||||
this.setLightOpacity(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
|
||||
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
|
||||
return this.getClass().getSimpleName() + "[" + regName + "]";
|
||||
}
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
return false;
|
||||
}
|
||||
|
||||
final String name = this.getUnlocalizedName();
|
||||
final String name = this.getTranslationKey();
|
||||
|
||||
if (player.isSneaking()) {
|
||||
final NBTTagCompound data = tileEntity.downloadSettings(SettingsFrom.MEMORY_CARD);
|
||||
@@ -300,7 +300,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
final String savedName = memoryCard.getSettingsName(heldItem);
|
||||
final NBTTagCompound data = memoryCard.getData(heldItem);
|
||||
|
||||
if (this.getUnlocalizedName().equals(savedName)) {
|
||||
if (this.getTranslationKey().equals(savedName)) {
|
||||
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
|
||||
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
||||
} else {
|
||||
|
||||
@@ -43,6 +43,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.EnumSet;
|
||||
|
||||
|
||||
@@ -111,7 +112,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class BlockMolecularAssembler extends AEBaseTileBlock {
|
||||
|
||||
@@ -72,7 +74,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock {
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,15 +121,15 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision {
|
||||
final EnumFacing forward = tile.getForward();
|
||||
final AEAxisAlignedBB bb = new AEAxisAlignedBB(twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels);
|
||||
|
||||
if (up.getFrontOffsetX() != 0) {
|
||||
if (up.getXOffset() != 0) {
|
||||
bb.minX = 0;
|
||||
bb.maxX = 1;
|
||||
}
|
||||
if (up.getFrontOffsetY() != 0) {
|
||||
if (up.getYOffset() != 0) {
|
||||
bb.minY = 0;
|
||||
bb.maxY = 1;
|
||||
}
|
||||
if (up.getFrontOffsetZ() != 0) {
|
||||
if (up.getZOffset() != 0) {
|
||||
bb.minZ = 0;
|
||||
bb.maxZ = 1;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class BlockInscriber extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(final ItemStack is) {
|
||||
return super.getUnlocalizedName(is);
|
||||
public String getTranslationKey(final ItemStack is) {
|
||||
return super.getTranslationKey(is);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -115,9 +116,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
|
||||
final EnumFacing up = this.getOrientable(w, pos).getUp();
|
||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||
final double xOff = -0.3 * up.getXOffset();
|
||||
final double yOff = -0.3 * up.getYOffset();
|
||||
final double zOff = -0.3 * up.getZOffset();
|
||||
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
|
||||
}
|
||||
|
||||
@@ -167,7 +168,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -107,9 +108,9 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity e, final boolean isVisual) {
|
||||
final EnumFacing up = this.getOrientable(w, pos).getUp();
|
||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||
final double xOff = -0.3 * up.getXOffset();
|
||||
final double yOff = -0.3 * up.getYOffset();
|
||||
final double zOff = -0.3 * up.getZOffset();
|
||||
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
|
||||
}
|
||||
|
||||
@@ -134,9 +135,9 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
}
|
||||
|
||||
final EnumFacing up = this.getOrientable(w, pos).getUp();
|
||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||
final double xOff = -0.3 * up.getXOffset();
|
||||
final double yOff = -0.3 * up.getYOffset();
|
||||
final double zOff = -0.3 * up.getZOffset();
|
||||
for (int bolts = 0; bolts < 3; bolts++) {
|
||||
if (AppEng.proxy.shouldAddParticles(r)) {
|
||||
final LightningFX fx = new LightningFX(w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D);
|
||||
@@ -192,7 +193,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
double ry = 0.5 + pos.getY();
|
||||
double rz = 0.5 + pos.getZ();
|
||||
|
||||
rx += up.getFrontOffsetX() * d0;
|
||||
ry += up.getFrontOffsetY() * d0;
|
||||
rz += up.getFrontOffsetZ() * d0;
|
||||
rx += up.getXOffset() * d0;
|
||||
ry += up.getYOffset() * d0;
|
||||
rz += up.getZOffset() * d0;
|
||||
|
||||
final int x = pos.getX();
|
||||
final int y = pos.getY();
|
||||
@@ -103,25 +103,25 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
case 0:
|
||||
dx = 0.6;
|
||||
dz = d1;
|
||||
pt = new BlockPos(x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ());
|
||||
pt = new BlockPos(x + west.getXOffset(), y + west.getYOffset(), z + west.getZOffset());
|
||||
|
||||
break;
|
||||
case 1:
|
||||
dx = d1;
|
||||
dz += 0.6;
|
||||
pt = new BlockPos(x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ());
|
||||
pt = new BlockPos(x + forward.getXOffset(), y + forward.getYOffset(), z + forward.getZOffset());
|
||||
|
||||
break;
|
||||
case 2:
|
||||
dx = d1;
|
||||
dz = -0.6;
|
||||
pt = new BlockPos(x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ());
|
||||
pt = new BlockPos(x - forward.getXOffset(), y - forward.getYOffset(), z - forward.getZOffset());
|
||||
|
||||
break;
|
||||
case 3:
|
||||
dx = -0.6;
|
||||
dz = d1;
|
||||
pt = new BlockPos(x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ());
|
||||
pt = new BlockPos(x - west.getXOffset(), y - west.getYOffset(), z - west.getZOffset());
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -130,13 +130,13 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
return;
|
||||
}
|
||||
|
||||
rx += dx * west.getFrontOffsetX();
|
||||
ry += dx * west.getFrontOffsetY();
|
||||
rz += dx * west.getFrontOffsetZ();
|
||||
rx += dx * west.getXOffset();
|
||||
ry += dx * west.getYOffset();
|
||||
rz += dx * west.getZOffset();
|
||||
|
||||
rx += dz * forward.getFrontOffsetX();
|
||||
ry += dz * forward.getFrontOffsetY();
|
||||
rz += dz * forward.getFrontOffsetZ();
|
||||
rx += dz * forward.getXOffset();
|
||||
ry += dz * forward.getYOffset();
|
||||
rz += dz * forward.getZOffset();
|
||||
|
||||
final LightningFX fx = new LightningFX(w, rx, ry, rz, 0.0D, 0.0D, 0.0D);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
@@ -56,7 +57,7 @@ public class BlockSecurityStation extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
if (world.isBlockIndirectlyGettingPowered(pos) > 0) {
|
||||
if (world.getRedstonePowerFromNeighbors(pos) > 0) {
|
||||
this.startFuse(world, pos, null);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
|
||||
public void onBlockAdded(final World w, final BlockPos pos, final IBlockState state) {
|
||||
super.onBlockAdded(w, pos, state);
|
||||
|
||||
if (w.isBlockIndirectlyGettingPowered(pos) > 0) {
|
||||
if (w.getRedstonePowerFromNeighbors(pos) > 0) {
|
||||
this.startFuse(w, pos, null);
|
||||
w.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
@@ -102,20 +102,20 @@ public final class BlockVibrationChamber extends AEBaseTileBlock {
|
||||
final EnumFacing forward = tc.getForward();
|
||||
final EnumFacing up = tc.getUp();
|
||||
|
||||
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
||||
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
||||
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
||||
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
|
||||
final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
|
||||
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
|
||||
|
||||
f1 += forward.getFrontOffsetX() * 0.6;
|
||||
f2 += forward.getFrontOffsetY() * 0.6;
|
||||
f3 += forward.getFrontOffsetZ() * 0.6;
|
||||
f1 += forward.getXOffset() * 0.6;
|
||||
f2 += forward.getYOffset() * 0.6;
|
||||
f3 += forward.getZOffset() * 0.6;
|
||||
|
||||
final float ox = r.nextFloat();
|
||||
final float oy = r.nextFloat() * 0.2f;
|
||||
|
||||
f1 += up.getFrontOffsetX() * (-0.3 + oy);
|
||||
f2 += up.getFrontOffsetY() * (-0.3 + oy);
|
||||
f3 += up.getFrontOffsetZ() * (-0.3 + oy);
|
||||
f1 += up.getXOffset() * (-0.3 + oy);
|
||||
f2 += up.getYOffset() * (-0.3 + oy);
|
||||
f3 += up.getZOffset() * (-0.3 + oy);
|
||||
|
||||
f1 += west_x * (0.3 * ox - 0.15);
|
||||
f2 += west_y * (0.3 * ox - 0.15);
|
||||
|
||||
@@ -29,9 +29,10 @@ import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.UnlistedProperty;
|
||||
import appeng.client.render.cablebus.CableBusBakedModel;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.core.Api;
|
||||
import appeng.client.render.cablebus.FacadeRenderState;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketCableBusLandingParticle;
|
||||
import appeng.core.sync.packets.PacketClick;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.integration.abstraction.IAEFacade;
|
||||
@@ -71,10 +72,12 @@ import net.minecraft.util.math.RayTraceResult.Type;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -91,10 +94,6 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
||||
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
|
||||
private static Class<? extends AEBaseTile> noTesrTile;
|
||||
|
||||
private static Class<? extends AEBaseTile> tesrTile;
|
||||
|
||||
public BlockCableBus() {
|
||||
super(AEGlassMaterial.INSTANCE);
|
||||
this.setLightOpacity(0);
|
||||
@@ -152,7 +151,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) {
|
||||
public void onEntityCollision(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) {
|
||||
this.cb(w, pos).onEntityCollision(entityIn);
|
||||
}
|
||||
|
||||
@@ -303,6 +302,90 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addRunningEffects(IBlockState state, World world, BlockPos pos, Entity entity) {
|
||||
if (world.isRemote) {
|
||||
addRunningParticle(world, pos, entity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void addRunningParticle(World world, BlockPos pos, Entity entity) {
|
||||
final ICableBusContainer cb = this.cb(world, pos);
|
||||
final IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
|
||||
|
||||
if (!(model instanceof CableBusBakedModel cableBusModel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final CableBusRenderState renderState = cb.getRenderState();
|
||||
final TextureAtlasSprite texture = getSpriteForParticle(renderState, cableBusModel);
|
||||
if (texture != null) {
|
||||
final double d0 = entity.posX + (world.rand.nextFloat() - 0.5f) * entity.width;
|
||||
final double d1 = entity.getEntityBoundingBox().minY + 0.1f;
|
||||
final double d2 = entity.posZ + (world.rand.nextFloat() - 0.5f) * entity.width;
|
||||
|
||||
final ParticleDigging particle = new DestroyFX(world, d0, d1, d2, -entity.motionX * 4.0f, 1.5f, -entity.motionZ * 4.0f, this.getDefaultState()).setBlockPos(pos);
|
||||
particle.setParticleTexture(texture);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLandingEffects(IBlockState state, WorldServer world, BlockPos pos, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) {
|
||||
// for reasons only notch can explain, this method is only called on the server, so we have to sync
|
||||
// a packet to all tracking players for landing particle effects
|
||||
if (!world.isRemote) {
|
||||
final PacketCableBusLandingParticle packet = new PacketCableBusLandingParticle(pos, entity, numberOfParticles);
|
||||
final NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 32);
|
||||
NetworkHandler.instance().sendToAllTracking(packet, point);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addLandingParticle(BlockPos pos, double entityX, double entityY, double entityZ, int numberOfParticles) {
|
||||
final World world = Minecraft.getMinecraft().world;
|
||||
final ICableBusContainer cb = this.cb(world, pos);
|
||||
final IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
|
||||
|
||||
if (!(model instanceof CableBusBakedModel cableBusModel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final TextureAtlasSprite texture = getSpriteForParticle(cb.getRenderState(), cableBusModel);
|
||||
if (texture != null) {
|
||||
final Vec3d startVec = new Vec3d(entityX, entityY, entityZ);
|
||||
final Vec3d endVec = startVec.add(0.0f, -4.0f, 0.0f);
|
||||
RayTraceResult result = world.rayTraceBlocks(startVec, endVec, true, false, true);
|
||||
final double speed = 0.15f;
|
||||
|
||||
if (result != null && result.typeOfHit == Type.BLOCK && numberOfParticles != 0) {
|
||||
for (int i = 0; i < numberOfParticles; i++) {
|
||||
final double d0 = world.rand.nextGaussian() * speed;
|
||||
final double d1 = world.rand.nextGaussian() * speed;
|
||||
final double d2 = world.rand.nextGaussian() * speed;
|
||||
|
||||
final ParticleDigging particle = new DestroyFX(world, entityX, entityY, entityZ, d0, d1, d2, this.getDefaultState()).setBlockPos(pos);
|
||||
particle.setParticleTexture(texture);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private TextureAtlasSprite getSpriteForParticle(CableBusRenderState renderState, CableBusBakedModel cableBusModel) {
|
||||
final FacadeRenderState frs = renderState.getFacades().get(EnumFacing.UP);
|
||||
if (frs != null) {
|
||||
final IBlockState state = frs.getSourceBlock();
|
||||
final IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
|
||||
return model.getParticleTexture();
|
||||
}
|
||||
return Platform.pickRandom(cableBusModel.getParticleTextures(renderState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
if (Platform.isServer()) {
|
||||
@@ -378,10 +461,9 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
||||
}
|
||||
|
||||
public void setupTile() {
|
||||
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance(TileCableBus.class);
|
||||
this.setTileEntity(noTesrTile);
|
||||
this.setTileEntity(TileCableBus.class);
|
||||
|
||||
GameRegistry.registerTileEntity(noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
|
||||
GameRegistry.registerTileEntity(TileCableBus.class, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
|
||||
|
||||
if (Platform.isClient()) {
|
||||
setupTesr();
|
||||
@@ -390,9 +472,8 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static void setupTesr() {
|
||||
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance(TileCableBusTESR.class);
|
||||
GameRegistry.registerTileEntity(tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(BlockCableBus.getTesrTile(), new CableBusTESR());
|
||||
GameRegistry.registerTileEntity(TileCableBusTESR.class, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCableBusTESR.class, new CableBusTESR());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -438,14 +519,6 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
||||
super.onEntityWalk(world, pos, entityIn);
|
||||
}
|
||||
|
||||
public static Class<? extends AEBaseTile> getNoTesrTile() {
|
||||
return noTesrTile;
|
||||
}
|
||||
|
||||
public static Class<? extends AEBaseTile> getTesrTile() {
|
||||
return tesrTile;
|
||||
}
|
||||
|
||||
// Helper to get access to the protected constructor
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class DestroyFX extends ParticleDigging {
|
||||
|
||||
@@ -33,6 +33,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class BlockController extends AEBaseTileBlock {
|
||||
|
||||
@@ -144,7 +146,7 @@ public class BlockController extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -68,7 +69,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
@@ -81,7 +82,7 @@ public class BlockPaint extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision {
|
||||
|
||||
@@ -86,7 +88,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,9 +105,9 @@ class QnbFormedBakedModel implements IBakedModel {
|
||||
for (EnumFacing facing : EnumFacing.values()) {
|
||||
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
||||
// (avoids z-fighting)
|
||||
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f);
|
||||
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f);
|
||||
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f);
|
||||
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
|
||||
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
|
||||
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
|
||||
|
||||
builder.setDrawFaces(EnumSet.of(facing));
|
||||
builder.addCube(
|
||||
@@ -130,9 +130,9 @@ class QnbFormedBakedModel implements IBakedModel {
|
||||
for (EnumFacing facing : EnumFacing.values()) {
|
||||
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
||||
// (avoids z-fighting)
|
||||
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f);
|
||||
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f);
|
||||
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f);
|
||||
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
|
||||
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
|
||||
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
|
||||
|
||||
builder.setDrawFaces(EnumSet.of(facing));
|
||||
builder.addCube(
|
||||
|
||||
@@ -26,12 +26,15 @@ import appeng.tile.spatial.TileSpatialIOPort;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -39,8 +42,11 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class BlockSpatialIOPort extends AEBaseTileBlock {
|
||||
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
|
||||
public BlockSpatialIOPort() {
|
||||
super(Material.IRON);
|
||||
setDefaultState(getDefaultState().withProperty(POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,6 +57,19 @@ public class BlockSpatialIOPort extends AEBaseTileBlock {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
TileSpatialIOPort te = this.getTileEntity(worldIn, pos);
|
||||
boolean powered = te != null && te.isActive();
|
||||
return super.getActualState(state, worldIn, pos)
|
||||
.withProperty(POWERED, powered);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates() {
|
||||
return new IProperty[]{POWERED};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (p.isSneaking()) {
|
||||
|
||||
@@ -34,6 +34,8 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class BlockSpatialPylon extends AEBaseTileBlock {
|
||||
|
||||
@@ -83,7 +85,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
@@ -56,7 +57,7 @@ public class BlockChest extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
@@ -52,7 +53,7 @@ public class BlockDrive extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
@@ -26,12 +27,15 @@ import appeng.tile.storage.TileIOPort;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -39,15 +43,34 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class BlockIOPort extends AEBaseTileBlock {
|
||||
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
|
||||
public BlockIOPort() {
|
||||
super(Material.IRON);
|
||||
setDefaultState(getDefaultState().withProperty(POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
TileIOPort te = this.getTileEntity(worldIn, pos);
|
||||
boolean powred = te != null && te.isActive();
|
||||
|
||||
return super.getActualState(state, worldIn, pos)
|
||||
.withProperty(POWERED, powred);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates() {
|
||||
return new IProperty[]{POWERED};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
final TileIOPort te = this.getTileEntity(world, pos);
|
||||
if (te != null) {
|
||||
te.updateRedstoneState();
|
||||
if (te.getInstalledUpgrades(Upgrades.REDSTONE) != 0) {
|
||||
te.updateRedstoneState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -48,6 +50,8 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
|
||||
private static final double AABB_OFFSET_SIDES = 0.06;
|
||||
private static final double AABB_OFFSET_TOP = 0.125;
|
||||
|
||||
public static final PropertyBool NATURAL = PropertyBool.create("natural");
|
||||
|
||||
public enum SkyChestType {
|
||||
STONE, BLOCK
|
||||
}
|
||||
@@ -61,6 +65,22 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
|
||||
this.setHardness(50);
|
||||
this.blockResistance = 150.0f;
|
||||
this.type = type;
|
||||
setDefaultState(getDefaultState().withProperty(NATURAL, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates() {
|
||||
return new IProperty[]{NATURAL};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(NATURAL) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(NATURAL, meta == 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,18 +119,18 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
|
||||
o = sk.getUp();
|
||||
}
|
||||
|
||||
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||
final double offsetX = o.getXOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||
final double offsetY = o.getYOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||
final double offsetZ = o.getZOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||
|
||||
// for x/z top and bottom is swapped
|
||||
final double minX = Math.max(0.0, offsetX + (o.getFrontOffsetX() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetX() * AABB_OFFSET_TOP)));
|
||||
final double minY = Math.max(0.0, offsetY + (o.getFrontOffsetY() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetY() * AABB_OFFSET_BOTTOM)));
|
||||
final double minZ = Math.max(0.0, offsetZ + (o.getFrontOffsetZ() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetZ() * AABB_OFFSET_TOP)));
|
||||
final double minX = Math.max(0.0, offsetX + (o.getXOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getXOffset() * AABB_OFFSET_TOP)));
|
||||
final double minY = Math.max(0.0, offsetY + (o.getYOffset() < 0 ? AABB_OFFSET_TOP : (o.getYOffset() * AABB_OFFSET_BOTTOM)));
|
||||
final double minZ = Math.max(0.0, offsetZ + (o.getZOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getZOffset() * AABB_OFFSET_TOP)));
|
||||
|
||||
final double maxX = Math.min(1.0, 1.0 - offsetX - (o.getFrontOffsetX() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetX() * AABB_OFFSET_BOTTOM)));
|
||||
final double maxY = Math.min(1.0, 1.0 - offsetY - (o.getFrontOffsetY() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetY() * AABB_OFFSET_TOP)));
|
||||
final double maxZ = Math.min(1.0, 1.0 - offsetZ - (o.getFrontOffsetZ() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetZ() * AABB_OFFSET_BOTTOM)));
|
||||
final double maxX = Math.min(1.0, 1.0 - offsetX - (o.getXOffset() < 0 ? AABB_OFFSET_TOP : (o.getXOffset() * AABB_OFFSET_BOTTOM)));
|
||||
final double maxY = Math.min(1.0, 1.0 - offsetY - (o.getYOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getYOffset() * AABB_OFFSET_TOP)));
|
||||
final double maxZ = Math.min(1.0, 1.0 - offsetZ - (o.getZOffset() < 0 ? AABB_OFFSET_TOP : (o.getZOffset() * AABB_OFFSET_BOTTOM)));
|
||||
|
||||
return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,10 @@ public enum DriveSlotState implements IStringSerializable {
|
||||
TYPES_FULL("types_full"),
|
||||
|
||||
// Completely full
|
||||
FULL("full");
|
||||
FULL("full"),
|
||||
|
||||
// Online and completely empty
|
||||
NO_CONTENTS("no_contents");
|
||||
|
||||
private final String name;
|
||||
|
||||
@@ -64,6 +67,8 @@ public enum DriveSlotState implements IStringSerializable {
|
||||
return DriveSlotState.TYPES_FULL;
|
||||
case 3:
|
||||
return DriveSlotState.FULL;
|
||||
case 4:
|
||||
return DriveSlotState.NO_CONTENTS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ class BlockDefinitionBuilder implements IBlockBuilder {
|
||||
// Create block and matching item, and set factory name of both
|
||||
Block block = this.blockSupplier.get();
|
||||
block.setRegistryName(AppEng.MOD_ID, this.registryName);
|
||||
block.setUnlocalizedName("appliedenergistics2." + this.registryName);
|
||||
block.setTranslationKey("appliedenergistics2." + this.registryName);
|
||||
|
||||
ItemBlock item = this.constructItemFromBlock(block);
|
||||
if (item != null) {
|
||||
|
||||
@@ -116,11 +116,11 @@ class BlockRendering implements IBlockRendering, ISelectiveResourceReloadListene
|
||||
}
|
||||
|
||||
if (this.modelCustomizer != null) {
|
||||
factory.addModelOverride(block.getRegistryName().getResourcePath(), this.modelCustomizer);
|
||||
factory.addModelOverride(block.getRegistryName().getPath(), this.modelCustomizer);
|
||||
} else if (block instanceof AEBaseTileBlock) {
|
||||
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||
// extended props
|
||||
factory.addModelOverride(block.getRegistryName().getResourcePath(), (l, m) -> {
|
||||
factory.addModelOverride(block.getRegistryName().getPath(), (l, m) -> {
|
||||
AutoRotatingModel model = new AutoRotatingModel(m);
|
||||
BlockRendering.this.reloads.add(model);
|
||||
return model;
|
||||
|
||||
@@ -126,7 +126,7 @@ class ItemDefinitionBuilder implements IItemBuilder {
|
||||
|
||||
ItemDefinition definition = new ItemDefinition(this.registryName, item);
|
||||
|
||||
item.setUnlocalizedName("appliedenergistics2." + this.registryName);
|
||||
item.setTranslationKey("appliedenergistics2." + this.registryName);
|
||||
item.setCreativeTab(this.creativeTab);
|
||||
|
||||
// Register all extra handlers
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
|
||||
IModel missingModel = ModelLoaderRegistry.getMissingModel();
|
||||
|
||||
for (ModelResourceLocation location : keys) {
|
||||
if (!location.getResourceDomain().equals(AppEng.MOD_ID)) {
|
||||
if (!location.getNamespace().equals(AppEng.MOD_ID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
|
||||
continue;
|
||||
}
|
||||
|
||||
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getResourcePath());
|
||||
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getPath());
|
||||
if (customizer != null) {
|
||||
IBakedModel newModel = customizer.apply(location, orgModel);
|
||||
|
||||
|
||||
@@ -69,13 +69,11 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import yalter.mousetweaks.api.IMTModGuiContainer2;
|
||||
import yalter.mousetweaks.api.MouseTweaksIgnore;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -88,8 +86,8 @@ import static appeng.integration.modules.jei.JEIPlugin.aeGuiHandler;
|
||||
import static appeng.integration.modules.jei.JEIPlugin.runtime;
|
||||
|
||||
|
||||
@Optional.Interface(iface = "yalter.mousetweaks.api.IMTModGuiContainer2", modid = "mousetweaks")
|
||||
public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContainer2 {
|
||||
@MouseTweaksIgnore
|
||||
public abstract class AEBaseGui extends GuiContainer {
|
||||
private final List<InternalSlotME> meSlots = new ArrayList<>();
|
||||
// drag y
|
||||
private final Set<Slot> drag_click = new HashSet<>();
|
||||
@@ -570,9 +568,9 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
|
||||
if (stack != null
|
||||
&& action == InventoryAction.PICKUP_OR_SET_DOWN
|
||||
&& (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown())
|
||||
&& player.inventory.getItemStack().isEmpty()) {
|
||||
&& action == InventoryAction.PICKUP_OR_SET_DOWN
|
||||
&& (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown())
|
||||
&& player.inventory.getItemStack().isEmpty()) {
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
}
|
||||
|
||||
@@ -935,6 +933,10 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
}
|
||||
} else if (s instanceof AppEngSlot) {
|
||||
AppEngSlot appEngSlot = ((AppEngSlot) s);
|
||||
if (s.getStack().isEmpty()) {
|
||||
super.drawSlot(s);
|
||||
return;
|
||||
}
|
||||
appEngSlot.setDisplay(true);
|
||||
appEngSlot.setReturnAsSingleStack(true);
|
||||
|
||||
@@ -986,47 +988,4 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
protected List<InternalSlotME> getMeSlots() {
|
||||
return this.meSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "mousetweaks")
|
||||
public boolean MT_isMouseTweaksDisabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "mousetweaks")
|
||||
public boolean MT_isWheelTweakDisabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "mousetweaks")
|
||||
public Container MT_getContainer() {
|
||||
return this.inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "mousetweaks")
|
||||
public Slot MT_getSlotUnderMouse() {
|
||||
return getSlotUnderMouse();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "mousetweaks")
|
||||
public boolean MT_isCraftingOutput(Slot slot) {
|
||||
return slot instanceof SlotOutput || slot instanceof AppEngCraftingSlot;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "mousetweaks")
|
||||
public boolean MT_isIgnored(Slot slot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "mousetweaks")
|
||||
public boolean MT_disableRMBDraggingFunctionality() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
package appeng.client.gui;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Collections;
|
||||
import java.util.Stack;
|
||||
|
||||
public class MathExpressionParser {
|
||||
|
||||
private final Stack<String> postfixStack = new Stack<>();
|
||||
private final Stack<Character> opStack = new Stack<>();
|
||||
private static final int[] OPERATOR_PRIORITY = new int[] { 0, 3, 2, 1, -1, 1, 0, 2 };
|
||||
|
||||
public static double parse(String expression) {
|
||||
double result;
|
||||
|
||||
if (expression == null) return Double.NaN;
|
||||
|
||||
expression = expression.replace(" ", "");
|
||||
|
||||
if (expression.length() == 1 && Character.isDigit(expression.charAt(0))) {
|
||||
return expression.charAt(0) - '0';
|
||||
}
|
||||
try {
|
||||
expression = transform(expression);
|
||||
result = new MathExpressionParser().calculate(expression);
|
||||
} catch (Exception e) {
|
||||
return Double.NaN;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* replace '-' with '~'
|
||||
* e.g.-2+-1*(-3E-2)-(-1) -> ~2+~1*(~3E~2)-(~1)
|
||||
*/
|
||||
private static String transform(String expression) {
|
||||
char[] arr = expression.toCharArray();
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (arr[i] == '-') {
|
||||
if (i == 0) {
|
||||
arr[i] = '~';
|
||||
} else {
|
||||
char c = arr[i - 1];
|
||||
if (c == '+' || c == '-' || c == '*' || c == '/' || c == '(' || c == 'E' || c == 'e') {
|
||||
arr[i] = '~';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (arr[0] == '~' || arr[1] == '(') {
|
||||
arr[0] = '-';
|
||||
return "0" + new String(arr);
|
||||
} else {
|
||||
return new String(arr);
|
||||
}
|
||||
}
|
||||
|
||||
public double calculate(String expression) {
|
||||
Stack<String> resultStack = new Stack<>();
|
||||
prepare(expression);
|
||||
Collections.reverse(postfixStack);
|
||||
String firstValue, secondValue, currentValue;
|
||||
while (!postfixStack.isEmpty()) {
|
||||
currentValue = postfixStack.pop();
|
||||
if (!isOperator(currentValue.charAt(0))) {
|
||||
currentValue = currentValue.replace("~", "-");
|
||||
resultStack.push(currentValue);
|
||||
} else {
|
||||
secondValue = resultStack.pop();
|
||||
firstValue = resultStack.pop();
|
||||
|
||||
firstValue = firstValue.replace("~", "-");
|
||||
secondValue = secondValue.replace("~", "-");
|
||||
|
||||
String tempResult = calculate(firstValue, secondValue, currentValue.charAt(0));
|
||||
resultStack.push(String.valueOf(tempResult));
|
||||
}
|
||||
}
|
||||
return Double.parseDouble(resultStack.pop());
|
||||
}
|
||||
|
||||
private void prepare(String expression) {
|
||||
opStack.push(',');
|
||||
char[] arr = expression.toCharArray();
|
||||
int currentIndex = 0;
|
||||
int count = 0;
|
||||
char currentOp, peekOp;
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
currentOp = arr[i];
|
||||
if (isOperator(currentOp)) {
|
||||
if (count > 0) {
|
||||
postfixStack.push(new String(arr, currentIndex, count));
|
||||
}
|
||||
peekOp = opStack.peek();
|
||||
if (currentOp == ')') {
|
||||
while (opStack.peek() != '(') {
|
||||
postfixStack.push(String.valueOf(opStack.pop()));
|
||||
}
|
||||
opStack.pop();
|
||||
} else {
|
||||
while (currentOp != '(' && peekOp != ',' && compare(currentOp, peekOp)) {
|
||||
postfixStack.push(String.valueOf(opStack.pop()));
|
||||
peekOp = opStack.peek();
|
||||
}
|
||||
opStack.push(currentOp);
|
||||
}
|
||||
count = 0;
|
||||
currentIndex = i + 1;
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count > 1 || (count == 1 && !isOperator(arr[currentIndex]))) {
|
||||
postfixStack.push(new String(arr, currentIndex, count));
|
||||
}
|
||||
|
||||
while (opStack.peek() != ',') {
|
||||
postfixStack.push(String.valueOf(opStack.pop()));
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isOperator(char c) {
|
||||
return c == '+' || c == '-' || c == '*' || c == '/' || c == '(' || c == ')';
|
||||
}
|
||||
|
||||
private static boolean compare(char cur, char peek) {
|
||||
return OPERATOR_PRIORITY[(peek) - 40] >= OPERATOR_PRIORITY[(cur) - 40];
|
||||
}
|
||||
|
||||
private String calculate(String firstValue, String secondValue, char currentOp) {
|
||||
return switch (currentOp) {
|
||||
case '+' -> add(firstValue, secondValue);
|
||||
case '-' -> sub(firstValue, secondValue);
|
||||
case '*' -> mul(firstValue, secondValue);
|
||||
case '/' -> div(firstValue, secondValue);
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
public static String add(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return String.valueOf(b1.add(b2));
|
||||
}
|
||||
|
||||
/**
|
||||
* subtraction
|
||||
*
|
||||
* @param v1 p1
|
||||
* @param v2 p2
|
||||
* @return sub
|
||||
*/
|
||||
public static String sub(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return String.valueOf(b1.subtract(b2));
|
||||
}
|
||||
|
||||
/**
|
||||
* multiplication
|
||||
*
|
||||
* @param v1 p1
|
||||
* @param v2 p2
|
||||
* @return mul
|
||||
*/
|
||||
public static String mul(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return String.valueOf(b1.multiply(b2));
|
||||
}
|
||||
|
||||
/**
|
||||
* division. e = 10^-10
|
||||
*
|
||||
* @param v1 p1
|
||||
* @param v2 p2
|
||||
* @return div
|
||||
*/
|
||||
public static String div(String v1, String v2) {
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return String.valueOf(b1.divide(b2, 16, RoundingMode.HALF_UP));
|
||||
}
|
||||
|
||||
/**
|
||||
* rounding
|
||||
*
|
||||
* @param v p
|
||||
* @param scale scale
|
||||
* @return result
|
||||
*/
|
||||
public static double round(double v, int scale) {
|
||||
if (scale < 0) {
|
||||
throw new IllegalArgumentException("The scale must be a positive integer or zero");
|
||||
}
|
||||
BigDecimal b = new BigDecimal(Double.toString(v));
|
||||
return b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
public static String round(String v, int scale) {
|
||||
if (scale < 0) {
|
||||
throw new IllegalArgumentException("The scale must be a positive integer or zero");
|
||||
}
|
||||
BigDecimal b = new BigDecimal(v);
|
||||
return String.valueOf(b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP));
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,9 @@ package appeng.client.gui.implementations;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiNumberBox;
|
||||
import appeng.client.gui.MathExpressionParser;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
@@ -42,6 +41,7 @@ import appeng.parts.reporting.PartExpandedProcessingPatternTerminal;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -50,7 +50,7 @@ import java.io.IOException;
|
||||
|
||||
|
||||
public class GuiCraftAmount extends AEBaseGui {
|
||||
private GuiNumberBox amountToCraft;
|
||||
private GuiTextField amountToCraft;
|
||||
private GuiTabButton originalGuiBtn;
|
||||
|
||||
private GuiButton next;
|
||||
@@ -126,7 +126,7 @@ public class GuiCraftAmount extends AEBaseGui {
|
||||
this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender));
|
||||
}
|
||||
|
||||
this.amountToCraft = new GuiNumberBox(this.fontRenderer, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRenderer.FONT_HEIGHT, Integer.class);
|
||||
this.amountToCraft = new GuiTextField(0, this.fontRenderer, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRenderer.FONT_HEIGHT);
|
||||
this.amountToCraft.setEnableBackgroundDrawing(false);
|
||||
this.amountToCraft.setMaxStringLength(16);
|
||||
this.amountToCraft.setTextColor(0xFFFFFF);
|
||||
@@ -149,8 +149,17 @@ public class GuiCraftAmount extends AEBaseGui {
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
try {
|
||||
long amt = Long.parseLong(this.amountToCraft.getText());
|
||||
this.next.enabled = (!this.amountToCraft.getText().isEmpty() && amt > 0);
|
||||
String out = this.amountToCraft.getText();
|
||||
double resultD = MathExpressionParser.parse(out);
|
||||
long amt;
|
||||
|
||||
if (resultD <= 0 || Double.isNaN(resultD)) {
|
||||
amt = 0;
|
||||
} else {
|
||||
amt = (long) MathExpressionParser.round(resultD, 0);
|
||||
}
|
||||
|
||||
this.next.enabled = amt > 0;
|
||||
} catch (final NumberFormatException e) {
|
||||
this.next.enabled = false;
|
||||
}
|
||||
@@ -164,33 +173,7 @@ public class GuiCraftAmount extends AEBaseGui {
|
||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
this.actionPerformed(this.next);
|
||||
}
|
||||
if ((key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit(character)) && this.amountToCraft
|
||||
.textboxKeyTyped(character, key)) {
|
||||
try {
|
||||
String out = this.amountToCraft.getText();
|
||||
|
||||
boolean fixed = false;
|
||||
while (out.startsWith("0") && out.length() > 1) {
|
||||
out = out.substring(1);
|
||||
fixed = true;
|
||||
}
|
||||
|
||||
if (fixed) {
|
||||
this.amountToCraft.setText(out);
|
||||
}
|
||||
|
||||
if (out.isEmpty()) {
|
||||
out = "0";
|
||||
}
|
||||
|
||||
final long result = Long.parseLong(out);
|
||||
if (result < 0) {
|
||||
this.amountToCraft.setText("1");
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
// :P
|
||||
}
|
||||
} else {
|
||||
if (!this.amountToCraft.textboxKeyTyped(character, key)) {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
@@ -207,7 +190,15 @@ public class GuiCraftAmount extends AEBaseGui {
|
||||
}
|
||||
|
||||
if (btn == this.next) {
|
||||
NetworkHandler.instance().sendToServer(new PacketCraftRequest(Integer.parseInt(this.amountToCraft.getText()), isShiftKeyDown()));
|
||||
double resultD = MathExpressionParser.parse(this.amountToCraft.getText());
|
||||
int result;
|
||||
if (resultD <= 0 || Double.isNaN(resultD)) {
|
||||
result = 1;
|
||||
} else {
|
||||
result = (int) MathExpressionParser.round(resultD, 0);
|
||||
}
|
||||
|
||||
NetworkHandler.instance().sendToServer(new PacketCraftRequest(result, isShiftKeyDown()));
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
// nope..
|
||||
@@ -226,22 +217,15 @@ public class GuiCraftAmount extends AEBaseGui {
|
||||
try {
|
||||
String out = this.amountToCraft.getText();
|
||||
|
||||
boolean fixed = false;
|
||||
while (out.startsWith("0") && out.length() > 1) {
|
||||
out = out.substring(1);
|
||||
fixed = true;
|
||||
}
|
||||
double resultD = MathExpressionParser.parse(out);
|
||||
int result;
|
||||
|
||||
if (fixed) {
|
||||
this.amountToCraft.setText(out);
|
||||
if (resultD <= 0 || Double.isNaN(resultD)) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = (int) MathExpressionParser.round(resultD, 0);
|
||||
}
|
||||
|
||||
if (out.isEmpty()) {
|
||||
out = "0";
|
||||
}
|
||||
|
||||
long result = Integer.parseInt(out);
|
||||
|
||||
if (result == 1 && i > 1) {
|
||||
result = 0;
|
||||
}
|
||||
@@ -251,8 +235,7 @@ public class GuiCraftAmount extends AEBaseGui {
|
||||
result = 1;
|
||||
}
|
||||
|
||||
out = Long.toString(result);
|
||||
Integer.parseInt(out);
|
||||
out = Integer.toString(result);
|
||||
this.amountToCraft.setText(out);
|
||||
} catch (final NumberFormatException e) {
|
||||
// :P
|
||||
|
||||
+5
-3
@@ -394,7 +394,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean foundMatchingItemStack = false;
|
||||
boolean foundMatchingFluidStack = false;
|
||||
|
||||
final String displayName = Platform.getFluidDisplayName(iaeFluidStack).toLowerCase();
|
||||
|
||||
@@ -405,10 +405,12 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
||||
return false;
|
||||
}
|
||||
} else if (displayName.contains(term)) {
|
||||
foundMatchingItemStack = true;
|
||||
foundMatchingFluidStack = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return foundMatchingItemStack;
|
||||
return foundMatchingFluidStack;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -409,6 +409,8 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
}
|
||||
} else if (displayName.contains(term)) {
|
||||
foundMatchingItemStack = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return foundMatchingItemStack;
|
||||
|
||||
@@ -50,6 +50,7 @@ import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
@@ -567,15 +568,15 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
||||
return searchTerm.matches(GuiText.InvalidPattern.getLocal());
|
||||
}
|
||||
|
||||
NBTTagList tag = new NBTTagList();
|
||||
|
||||
final NBTTagList tag;
|
||||
if (pass == 0) {
|
||||
tag = encodedValue.getTagList("in", 10);
|
||||
tag = encodedValue.getTagList("in", Constants.NBT.TAG_COMPOUND);
|
||||
} else {
|
||||
tag = encodedValue.getTagList("out", 10);
|
||||
tag = encodedValue.getTagList("out", Constants.NBT.TAG_COMPOUND);
|
||||
}
|
||||
|
||||
boolean foundMatchingItemStack = false;
|
||||
final String[] splitTerm = searchTerm.split(" ");
|
||||
|
||||
for (int i = 0; i < tag.tagCount(); i++) {
|
||||
final ItemStack parsedItemStack = new ItemStack(tag.getCompoundTagAt(i));
|
||||
@@ -584,7 +585,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
||||
.getItemDisplayName(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack))
|
||||
.toLowerCase();
|
||||
|
||||
for (String term : searchTerm.split(" ")) {
|
||||
for (String term : splitTerm) {
|
||||
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
|
||||
term = term.substring(1);
|
||||
if (displayName.contains(term)) {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package appeng.client.gui.toasts;
|
||||
|
||||
import appeng.core.localization.GuiText;
|
||||
import net.minecraft.client.gui.toasts.GuiToast;
|
||||
import net.minecraft.client.gui.toasts.IToast;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CraftingStatusToast implements IToast {
|
||||
private final ItemStack itemStack;
|
||||
private final boolean cancelled;
|
||||
private long firstDrawTime;
|
||||
private boolean newDisplay;
|
||||
|
||||
public CraftingStatusToast(@NotNull ItemStack itemStack, boolean cancelled) {
|
||||
this.itemStack = itemStack;
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Visibility draw(@NotNull GuiToast toastGui, long delta)
|
||||
{
|
||||
if (this.newDisplay)
|
||||
{
|
||||
this.firstDrawTime = delta;
|
||||
this.newDisplay = false;
|
||||
}
|
||||
var minecraft = toastGui.getMinecraft();
|
||||
var fontRenderer = minecraft.fontRenderer;
|
||||
|
||||
// Texture
|
||||
minecraft.getTextureManager().bindTexture(TEXTURE_TOASTS);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
||||
toastGui.drawTexturedModalRect(0, 0, 0, 32, 160, 32);
|
||||
|
||||
// Text
|
||||
var statusText = cancelled ? GuiText.CraftingToastCancelled : GuiText.CraftingToastDone;
|
||||
fontRenderer.drawString(statusText.getLocal(), 30, 7, -11534256);
|
||||
fontRenderer.drawString(itemStack.getDisplayName(), 30, 18, -16777216);
|
||||
|
||||
// Item
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
minecraft.getRenderItem().renderItemAndEffectIntoGUI(null, itemStack, 8, 8);
|
||||
|
||||
return delta - this.firstDrawTime < 5000L ? Visibility.SHOW : Visibility.HIDE;
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class TesrRenderHelper {
|
||||
* at the center of a block.
|
||||
*/
|
||||
public static void moveToFace(EnumFacing face) {
|
||||
GlStateManager.translate(face.getFrontOffsetX() * 0.50, face.getFrontOffsetY() * 0.50, face.getFrontOffsetZ() * 0.50);
|
||||
GlStateManager.translate(face.getXOffset() * 0.50, face.getYOffset() * 0.50, face.getZOffset() * 0.50);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -331,6 +331,10 @@ class CableBuilder {
|
||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||
|
||||
// Thin part of connector, here to prevent the color of the channels
|
||||
// from leaking into it
|
||||
addCoveredCableSizedCube(facing, cubeBuilder);
|
||||
|
||||
// For to-machine connections, use a thicker end-cap for the connection
|
||||
if (connectionType != AECableType.GLASS && !cableBusAdjacent) {
|
||||
this.addBigCoveredCableSizedCube(facing, cubeBuilder);
|
||||
@@ -351,7 +355,6 @@ class CableBuilder {
|
||||
cubeBuilder.setTexture(texture);
|
||||
}
|
||||
|
||||
addCoveredCableSizedCube(facing, cubeBuilder);
|
||||
|
||||
// Render the channel indicators brightly lit at night
|
||||
cubeBuilder.setRenderFullBright(true);
|
||||
@@ -467,8 +470,8 @@ class CableBuilder {
|
||||
// Dense cables show used channels in groups of 4, rounded up
|
||||
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
|
||||
|
||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
|
||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
|
||||
|
||||
// Render the channel indicators brightly lit at night
|
||||
cubeBuilder.setRenderFullBright(true);
|
||||
@@ -493,7 +496,7 @@ class CableBuilder {
|
||||
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_COVERED).get(cableColor);
|
||||
cubeBuilder.setTexture(texture);
|
||||
|
||||
setStraightCableUVs(cubeBuilder, facing, 5, 11);
|
||||
setStraightCableUVs(cubeBuilder, facing, 3, 13);
|
||||
|
||||
addStraightDenseCableSizedCube(facing, cubeBuilder);
|
||||
}
|
||||
@@ -504,15 +507,15 @@ class CableBuilder {
|
||||
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_SMART).get(cableColor);
|
||||
cubeBuilder.setTexture(texture);
|
||||
|
||||
setStraightCableUVs(cubeBuilder, facing, 5, 11);
|
||||
setStraightCableUVs(cubeBuilder, facing, 3, 13);
|
||||
|
||||
addStraightDenseCableSizedCube(facing, cubeBuilder);
|
||||
|
||||
// Dense cables show used channels in groups of 4, rounded up
|
||||
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
|
||||
|
||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
|
||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
|
||||
|
||||
// Render the channel indicators brightly lit at night
|
||||
cubeBuilder.setRenderFullBright(true);
|
||||
@@ -556,14 +559,14 @@ class CableBuilder {
|
||||
case DOWN:
|
||||
case UP:
|
||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
||||
cubeBuilder.addCube(3, 0, 3, 13, 16, 13);
|
||||
cubeBuilder.addCube(3, -0.01f, 3, 13, 16.01f, 13);
|
||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
|
||||
break;
|
||||
case EAST:
|
||||
case WEST:
|
||||
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
|
||||
cubeBuilder.setUvRotation(EnumFacing.NORTH, 3);
|
||||
cubeBuilder.addCube(0, 3, 3, 16, 13, 13);
|
||||
cubeBuilder.addCube(-0.01f, 3, 3, 16.01f, 13, 13);
|
||||
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0);
|
||||
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
|
||||
break;
|
||||
@@ -571,7 +574,7 @@ class CableBuilder {
|
||||
case SOUTH:
|
||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
||||
cubeBuilder.setUvRotation(EnumFacing.WEST, 3);
|
||||
cubeBuilder.addCube(3, 3, 0, 13, 13, 16);
|
||||
cubeBuilder.addCube(3, 3, -0.01f, 13, 13, 16.01f);
|
||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
|
||||
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
|
||||
break;
|
||||
@@ -611,14 +614,14 @@ class CableBuilder {
|
||||
case DOWN:
|
||||
case UP:
|
||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
||||
cubeBuilder.addCube(5, 0, 5, 11, 16, 11);
|
||||
cubeBuilder.addCube(5, -0.01f, 5, 11, 16.01f, 11);
|
||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
|
||||
break;
|
||||
case EAST:
|
||||
case WEST:
|
||||
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
|
||||
cubeBuilder.setUvRotation(EnumFacing.NORTH, 3);
|
||||
cubeBuilder.addCube(0, 5, 5, 16, 11, 11);
|
||||
cubeBuilder.addCube(-0.01f, 5, 5, 16.01f, 11, 11);
|
||||
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0);
|
||||
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
|
||||
break;
|
||||
@@ -626,7 +629,7 @@ class CableBuilder {
|
||||
case SOUTH:
|
||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
||||
cubeBuilder.setUvRotation(EnumFacing.WEST, 3);
|
||||
cubeBuilder.addCube(5, 5, 0, 11, 11, 16);
|
||||
cubeBuilder.addCube(5, 5, -0.01f, 11, 11, 16.01f);
|
||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
|
||||
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
|
||||
break;
|
||||
@@ -702,6 +705,7 @@ class CableBuilder {
|
||||
}
|
||||
|
||||
Collections.addAll(locations, SmartCableTextures.SMART_CHANNELS_TEXTURES);
|
||||
Collections.addAll(locations, SmartCableTextures.DENSE_SMART_CHANNELS_TEXTURES);
|
||||
|
||||
return locations;
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ public class CubeBuilder {
|
||||
builder.put(i, x, y, z);
|
||||
break;
|
||||
case NORMAL:
|
||||
builder.put(i, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ());
|
||||
builder.put(i, face.getXOffset(), face.getYOffset(), face.getZOffset());
|
||||
break;
|
||||
case COLOR:
|
||||
// Color format is RGBA
|
||||
|
||||
@@ -72,7 +72,7 @@ public class QuadRotator {
|
||||
// Figure out where the position is in the array
|
||||
VertexFormat format = quad.getFormat();
|
||||
int posIdx = this.findPositionOffset(format) / 4;
|
||||
int stride = format.getNextOffset() / 4;
|
||||
int stride = format.getSize() / 4;
|
||||
int normalIdx = format.getNormalOffset();
|
||||
VertexFormatElement.EnumType normalType = null;
|
||||
// Figure out the type of the normals
|
||||
|
||||
@@ -32,20 +32,43 @@ import java.util.function.Function;
|
||||
*/
|
||||
public class SmartCableTextures {
|
||||
|
||||
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_01"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_02"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_03"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_04"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_10"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_11"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_12"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_13"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14")
|
||||
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_01"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_02"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_03"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_04"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_10"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_11"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_12"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_13"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14"),
|
||||
};
|
||||
|
||||
// Textures used to display channels on smart cables. There's two sets of 5 textures each, and
|
||||
// one of each set are composed together to get even/odd colored channels
|
||||
private final TextureAtlasSprite[] textures;
|
||||
|
||||
public static final ResourceLocation[] DENSE_SMART_CHANNELS_TEXTURES = {
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_00"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_01"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_02"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_03"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_04"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_10"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_11"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_12"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_13"),
|
||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_14"),
|
||||
};
|
||||
|
||||
// Textures used to display channels on dense smart cables. There's two sets of 5 textures each, and
|
||||
// one of each set are composed together to get even/odd colored channels
|
||||
private final TextureAtlasSprite[] denseTextures;
|
||||
|
||||
public SmartCableTextures(Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||
this.textures = Arrays.stream(SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new);
|
||||
this.denseTextures = Arrays.stream(DENSE_SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,8 +84,18 @@ public class SmartCableTextures {
|
||||
}
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getOddTextureForDenseChannels(int channels) {
|
||||
if (channels < 0) {
|
||||
return this.denseTextures[0];
|
||||
} else if (channels <= 4) {
|
||||
return this.denseTextures[channels];
|
||||
} else {
|
||||
return this.denseTextures[4];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The odd variant is used for displaying channels 5-8 as in use.
|
||||
* The even variant is used for displaying channels 5-8 as in use.
|
||||
*/
|
||||
public TextureAtlasSprite getEvenTextureForChannels(int channels) {
|
||||
if (channels < 5) {
|
||||
@@ -73,4 +106,14 @@ public class SmartCableTextures {
|
||||
return this.textures[9];
|
||||
}
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getEvenTextureForDenseChannels(int channels) {
|
||||
if (channels < 5) {
|
||||
return this.denseTextures[5];
|
||||
} else if (channels <= 8) {
|
||||
return this.denseTextures[1 + channels];
|
||||
} else {
|
||||
return this.denseTextures[9];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,16 +43,16 @@ public class BuiltInModelLoader implements ICustomModelLoader {
|
||||
|
||||
@Override
|
||||
public boolean accepts(ResourceLocation modelLocation) {
|
||||
if (!modelLocation.getResourceDomain().equals(AppEng.MOD_ID)) {
|
||||
if (!modelLocation.getNamespace().equals(AppEng.MOD_ID)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.builtInModels.containsKey(modelLocation.getResourcePath());
|
||||
return this.builtInModels.containsKey(modelLocation.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModel loadModel(ResourceLocation modelLocation) throws Exception {
|
||||
return this.builtInModels.get(modelLocation.getResourcePath());
|
||||
return this.builtInModels.get(modelLocation.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,12 +42,14 @@ public class DriveModel implements IModel {
|
||||
|
||||
private static final ResourceLocation MODEL_BASE = new ResourceLocation("appliedenergistics2:block/drive_base");
|
||||
|
||||
private static final Map<DriveSlotState, ResourceLocation> MODELS_CELLS = ImmutableMap.of(
|
||||
DriveSlotState.EMPTY, new ResourceLocation("appliedenergistics2:block/drive_cell_empty"),
|
||||
DriveSlotState.OFFLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_off"),
|
||||
DriveSlotState.ONLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_on"),
|
||||
DriveSlotState.TYPES_FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_types_full"),
|
||||
DriveSlotState.FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_full"));
|
||||
private static final Map<DriveSlotState, ResourceLocation> MODELS_CELLS = ImmutableMap.<DriveSlotState, ResourceLocation>builder()
|
||||
.put(DriveSlotState.EMPTY, new ResourceLocation("appliedenergistics2:block/drive_cell_empty"))
|
||||
.put(DriveSlotState.OFFLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_off"))
|
||||
.put(DriveSlotState.ONLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_on"))
|
||||
.put(DriveSlotState.TYPES_FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_types_full"))
|
||||
.put(DriveSlotState.FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_full"))
|
||||
.put(DriveSlotState.NO_CONTENTS, new ResourceLocation("appliedenergistics2:block/drive_cell_no_contents"))
|
||||
.build();
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getDependencies() {
|
||||
|
||||
@@ -137,14 +137,14 @@ public enum UVLModelLoader implements ICustomModelLoader {
|
||||
|
||||
@Override
|
||||
public boolean accepts(ResourceLocation modelLocation) {
|
||||
String modelPath = modelLocation.getResourcePath();
|
||||
if (modelLocation.getResourcePath().startsWith("models/")) {
|
||||
String modelPath = modelLocation.getPath();
|
||||
if (modelLocation.getPath().startsWith("models/")) {
|
||||
modelPath = modelPath.substring("models/".length());
|
||||
}
|
||||
|
||||
try (InputStreamReader io = new InputStreamReader(Minecraft.getMinecraft()
|
||||
.getResourceManager()
|
||||
.getResource(new ResourceLocation(modelLocation.getResourceDomain(), "models/" + modelPath + ".json"))
|
||||
.getResource(new ResourceLocation(modelLocation.getNamespace(), "models/" + modelPath + ".json"))
|
||||
.getInputStream())) {
|
||||
return gson.fromJson(io, UVLMarker.class).ae2_uvl_marker;
|
||||
} catch (Exception e) {
|
||||
@@ -174,11 +174,11 @@ public enum UVLModelLoader implements ICustomModelLoader {
|
||||
private final IModel parent;
|
||||
|
||||
public UVLModelWrapper(ResourceLocation modelLocation) {
|
||||
String modelPath = modelLocation.getResourcePath();
|
||||
if (modelLocation.getResourcePath().startsWith("models/")) {
|
||||
String modelPath = modelLocation.getPath();
|
||||
if (modelLocation.getPath().startsWith("models/")) {
|
||||
modelPath = modelPath.substring("models/".length());
|
||||
}
|
||||
ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json");
|
||||
ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getNamespace(), "armatures/" + modelPath + ".json");
|
||||
ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(UVLModelLoader.this.resourceManager, armatureLocation);
|
||||
ModelBlock model;
|
||||
{
|
||||
@@ -187,12 +187,12 @@ public enum UVLModelLoader implements ICustomModelLoader {
|
||||
ModelBlock lvt_5_1_ = null;
|
||||
|
||||
try {
|
||||
String s = modelLocation.getResourcePath();
|
||||
String s = modelLocation.getPath();
|
||||
|
||||
iresource = Minecraft.getMinecraft()
|
||||
.getResourceManager()
|
||||
.getResource(
|
||||
new ResourceLocation(modelLocation.getResourceDomain(), "models/" + modelPath + ".json"));
|
||||
new ResourceLocation(modelLocation.getNamespace(), "models/" + modelPath + ".json"));
|
||||
reader = new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8);
|
||||
|
||||
lvt_5_1_ = JsonUtils.gsonDeserialize(this.UVLSERIALIZER, reader, ModelBlock.class, false);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SpatialPylonRendering extends BlockRenderingCustomizer {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
||||
rendering.builtInModel(MODEL_ID.getResourcePath(), new SpatialPylonModel());
|
||||
rendering.builtInModel(MODEL_ID.getPath(), new SpatialPylonModel());
|
||||
rendering.stateMapper(this::mapState);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,15 +39,7 @@ import appeng.client.me.SlotME;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.guisync.SyncData;
|
||||
import appeng.container.implementations.ContainerInterface;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotCraftingTerm;
|
||||
import appeng.container.slot.SlotDisabled;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.container.slot.SlotInaccessible;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.*;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlacableItemType;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
@@ -65,14 +57,12 @@ import appeng.util.item.AEItemStack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -409,10 +399,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
return ItemStack.EMPTY; // don't insert duplicate encoded patterns to interfaces
|
||||
}
|
||||
|
||||
int maxSize = t.getMaxStackSize();
|
||||
if (maxSize > d.getSlotStackLimit()) {
|
||||
maxSize = d.getSlotStackLimit();
|
||||
}
|
||||
int maxSize = Math.min(tis.getMaxStackSize(), d.getSlotStackLimit());
|
||||
|
||||
int placeAble = maxSize - t.getCount();
|
||||
|
||||
@@ -448,10 +435,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
|
||||
if (d.isItemValid(tis)) {
|
||||
if (!d.getHasStack()) {
|
||||
int maxSize = tis.getMaxStackSize();
|
||||
if (maxSize > d.getSlotStackLimit()) {
|
||||
maxSize = d.getSlotStackLimit();
|
||||
}
|
||||
int maxSize = Math.min(tis.getMaxStackSize(), d.getSlotStackLimit());
|
||||
|
||||
final ItemStack tmp = tis.copy();
|
||||
if (tmp.getCount() > maxSize) {
|
||||
@@ -967,6 +951,55 @@ public abstract class AEBaseContainer extends Container {
|
||||
b.putStack(testB);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, @NotNull EntityPlayer player) {
|
||||
if (slotId >= 0 && clickTypeIn == ClickType.PICKUP) {
|
||||
final var slot = this.getSlot(slotId);
|
||||
if (slot instanceof AppEngSlot appEngSlot) {
|
||||
var slotStack = slot.getStack();
|
||||
var draggedStack = this.invPlayer.getItemStack();
|
||||
|
||||
// The default vanilla behavior assumes that slots can't hold more items than the default stack size.
|
||||
// Thus, it's possible to underflow the vanilla code when clicking non-empty slots with an item stack.
|
||||
if (!draggedStack.isEmpty()) {
|
||||
if (appEngSlot.isItemValid(draggedStack)) {
|
||||
if (slotStack.getItem() == draggedStack.getItem() && slotStack.getMetadata() == draggedStack.getMetadata() && ItemStack.areItemStackTagsEqual(slotStack, draggedStack)) {
|
||||
// Slot size or stack size, whichever is smaller.
|
||||
var maxSize = Math.min(appEngSlot.getSlotStackLimit(), draggedStack.getMaxStackSize());
|
||||
|
||||
// The maximum number of items that can be inserted into the slot, non-negative.
|
||||
var maxInsertable = Math.min(draggedStack.getCount(),
|
||||
Math.max(0, maxSize - appEngSlot.getStack().getCount()));
|
||||
|
||||
if (maxInsertable != 0) {
|
||||
var toInsert = Math.min(maxInsertable, dragType == 0 ? maxInsertable : 1);
|
||||
|
||||
draggedStack.shrink(toInsert);
|
||||
slotStack.grow(toInsert);
|
||||
|
||||
slot.putStack(slot.getStack());
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fixes taking and halving issues from oversized slots.
|
||||
else if (dragType == 0 || dragType == 1) {
|
||||
if (slot.canTakeStack(player) && !slotStack.isEmpty()) {
|
||||
var result = slotStack.copy();
|
||||
var toTake = Math.min(slotStack.getCount(), slotStack.getMaxStackSize());
|
||||
this.invPlayer.setItemStack(slot.decrStackSize(dragType == 0 ? toTake : (toTake + 1) / 2));
|
||||
|
||||
slot.putStack(slot.getStack());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
}
|
||||
|
||||
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -163,7 +163,7 @@ public final class ContainerFluidInterfaceConfigurationTerminal extends AEBaseCo
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.data.hasNoTags()) {
|
||||
if (!this.data.isEmpty()) {
|
||||
try {
|
||||
NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
|
||||
} catch (final IOException e) {
|
||||
@@ -251,7 +251,7 @@ public final class ContainerFluidInterfaceConfigurationTerminal extends AEBaseCo
|
||||
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
|
||||
final NBTTagCompound tag = data.getCompoundTag(name);
|
||||
|
||||
if (tag.hasNoTags()) {
|
||||
if (tag.isEmpty()) {
|
||||
tag.setLong("sortBy", inv.sortBy);
|
||||
tag.setString("un", inv.unlocalizedName);
|
||||
tag.setTag("pos", NBTUtil.createPosTag(inv.pos));
|
||||
|
||||
@@ -28,13 +28,8 @@ import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.*;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.AppEngInternalOversizedInventory;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ClickType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost {
|
||||
@@ -71,19 +66,6 @@ public class ContainerInterface extends ContainerUpgradeable implements IOptiona
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
|
||||
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
|
||||
if (this.inventorySlots.get(slotId) instanceof SlotOversized) {
|
||||
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(true);
|
||||
ItemStack ret = super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(false);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeight() {
|
||||
return 256;
|
||||
|
||||
+2
-2
@@ -153,7 +153,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.data.hasNoTags()) {
|
||||
if (!this.data.isEmpty()) {
|
||||
try {
|
||||
NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
|
||||
} catch (final IOException e) {
|
||||
@@ -296,7 +296,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
||||
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
|
||||
final NBTTagCompound tag = data.getCompoundTag(name);
|
||||
|
||||
if (tag.hasNoTags()) {
|
||||
if (tag.isEmpty()) {
|
||||
tag.setLong("sortBy", inv.sortBy);
|
||||
tag.setString("un", inv.unlocalizedName);
|
||||
tag.setTag("pos", NBTUtil.createPosTag(inv.pos));
|
||||
|
||||
@@ -25,9 +25,12 @@ import appeng.api.config.YesNo;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.client.me.SlotDisconnected;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketCompressedNBT;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.InventoryAction;
|
||||
@@ -44,6 +47,7 @@ import appeng.util.inv.WrapperCursorItemHandler;
|
||||
import appeng.util.inv.WrapperFilteredItemHandler;
|
||||
import appeng.util.inv.WrapperRangeItemHandler;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -51,6 +55,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@@ -160,7 +165,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.data.hasNoTags()) {
|
||||
if (!this.data.isEmpty()) {
|
||||
try {
|
||||
NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
|
||||
} catch (final IOException e) {
|
||||
@@ -175,6 +180,26 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
||||
public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slot, final long id) {
|
||||
final InvTracker inv = this.byId.get(id);
|
||||
if (inv != null) {
|
||||
// The code below this block assumes "slot" is an interface slot id. Not in this case.
|
||||
if (action == InventoryAction.PLACE_SINGLE) {
|
||||
final AppEngSlot playerSlot;
|
||||
try {
|
||||
playerSlot = (AppEngSlot) this.inventorySlots.get(slot);
|
||||
} catch (IndexOutOfBoundsException ignored) { return; }
|
||||
|
||||
if (!playerSlot.isPlayerSide() || !playerSlot.getHasStack()) return;
|
||||
|
||||
var itemStack = playerSlot.getStack();
|
||||
if (!itemStack.isEmpty()) {
|
||||
var handler = new WrapperFilteredItemHandler(
|
||||
new WrapperRangeItemHandler(inv.server, 0, 9 * (inv.numUpgrades + 1)), new PatternSlotFilter());
|
||||
playerSlot.putStack(ItemHandlerHelper.insertItem(handler, itemStack, false));
|
||||
detectAndSendChanges();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemStack is = inv.server.getStackInSlot(slot);
|
||||
final boolean hasItemInHand = !player.inventory.getItemStack().isEmpty();
|
||||
|
||||
@@ -271,8 +296,6 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateHeld(player);
|
||||
@@ -330,7 +353,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
||||
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
|
||||
final NBTTagCompound tag = data.getCompoundTag(name);
|
||||
|
||||
if (tag.hasNoTags()) {
|
||||
if (tag.isEmpty()) {
|
||||
tag.setLong("sortBy", inv.sortBy);
|
||||
tag.setString("un", inv.unlocalizedName);
|
||||
tag.setTag("pos", NBTUtil.createPosTag(inv.pos));
|
||||
@@ -356,6 +379,27 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
||||
data.setTag(name, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
|
||||
if (Platform.isClient()) {
|
||||
var playerSlot = this.inventorySlots.get(idx);
|
||||
if (playerSlot instanceof AppEngSlot playerAppEngSlot && playerAppEngSlot.isPlayerSide()) {
|
||||
for (var slot : this.inventorySlots) {
|
||||
if (slot instanceof SlotDisconnected slotDisconnected && !slot.getHasStack()) {
|
||||
// Signal the server to move the pattern.
|
||||
var packet = new PacketInventoryAction(InventoryAction.PLACE_SINGLE,
|
||||
playerAppEngSlot.slotNumber, slotDisconnected.getSlot().getId());
|
||||
|
||||
NetworkHandler.instance().sendToServer(packet);
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.transferStackInSlot(p, idx);
|
||||
}
|
||||
|
||||
private static class InvTracker {
|
||||
|
||||
private final long sortBy;
|
||||
|
||||
@@ -38,8 +38,6 @@ public class ContainerOreDictStorageBus extends AEBaseContainer {
|
||||
public ContainerOreDictStorageBus(final InventoryPlayer ip, final PartOreDicStorageBus anchor) {
|
||||
super(ip, anchor);
|
||||
this.part = anchor;
|
||||
|
||||
this.bindPlayerInventory(ip, 14, 256 - /* height of player inventory */82);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,6 +50,9 @@ public class ContainerStorageBus extends ContainerUpgradeable {
|
||||
@GuiSync(4)
|
||||
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
|
||||
|
||||
@GuiSync(7)
|
||||
public YesNo stickyMode = YesNo.NO;
|
||||
|
||||
public ContainerStorageBus(final InventoryPlayer ip, final PartStorageBus te) {
|
||||
super(ip, te);
|
||||
this.storageBus = te;
|
||||
@@ -111,6 +114,7 @@ public class ContainerStorageBus extends ContainerUpgradeable {
|
||||
this.setFuzzyMode((FuzzyMode) this.getUpgradeable().getConfigManager().getSetting(Settings.FUZZY_MODE));
|
||||
this.setReadWriteMode((AccessRestriction) this.getUpgradeable().getConfigManager().getSetting(Settings.ACCESS));
|
||||
this.setStorageFilter((StorageFilter) this.getUpgradeable().getConfigManager().getSetting(Settings.STORAGE_FILTER));
|
||||
this.setStickyMode((YesNo) this.getUpgradeable().getConfigManager().getSetting(Settings.STICKY_MODE));
|
||||
}
|
||||
|
||||
this.standardDetectAndSendChanges();
|
||||
@@ -168,4 +172,12 @@ public class ContainerStorageBus extends ContainerUpgradeable {
|
||||
private void setStorageFilter(final StorageFilter storageFilter) {
|
||||
this.storageFilter = storageFilter;
|
||||
}
|
||||
|
||||
public YesNo getStickyMode() {
|
||||
return this.stickyMode;
|
||||
}
|
||||
|
||||
private void setStickyMode(final YesNo stickyMode) {
|
||||
this.stickyMode = stickyMode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
@@ -51,7 +52,7 @@ public class ContainerWireless extends AEBaseContainer {
|
||||
final int boosters = this.boosterSlot.getStack().isEmpty() ? 0 : this.boosterSlot.getStack().getCount();
|
||||
|
||||
this.setRange((long) (10 * AEConfig.instance().wireless_getMaxRange(boosters)));
|
||||
this.setDrain((long) (100 * AEConfig.instance().wireless_getPowerDrain(boosters)));
|
||||
this.setDrain((long) (100 * PowerMultiplier.CONFIG.multiply(AEConfig.instance().wireless_getPowerDrain(boosters))));
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@@ -63,8 +63,6 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEPortableTermin
|
||||
this.addSlotToContainer(this.outputSlot = new SlotCraftingTerm(this.getPlayerInv().player, this.getActionSource(), this
|
||||
.getPowerSource(), this.wirelessTerminalGUIObject, crafting, crafting, this.output, 131, -72 + 18, this));
|
||||
|
||||
this.bindPlayerInventory(ip, 0, 0);
|
||||
|
||||
this.onCraftMatrixChanged(new WrapperInvItemHandler(crafting));
|
||||
}
|
||||
|
||||
|
||||
@@ -133,15 +133,18 @@ public class AppEngCraftingSlot extends AppEngSlot {
|
||||
|
||||
@Override
|
||||
public ItemStack onTake(final EntityPlayer playerIn, final ItemStack stack) {
|
||||
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, new WrapperInvItemHandler(this.craftMatrix));
|
||||
this.onCrafting(stack);
|
||||
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
|
||||
stack.getItem().onCreated(stack, playerIn.world, playerIn);
|
||||
|
||||
final InventoryCrafting ic = new InventoryCrafting(this.getContainer(), 3, 3);
|
||||
|
||||
for (int x = 0; x < this.craftMatrix.getSlots(); x++) {
|
||||
ic.setInventorySlotContents(x, this.craftMatrix.getStackInSlot(x));
|
||||
}
|
||||
|
||||
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, ic);
|
||||
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
|
||||
|
||||
final NonNullList<ItemStack> aitemstack = this.getRemainingItems(ic, playerIn.world);
|
||||
|
||||
ItemHandlerUtil.copy(ic, this.craftMatrix, false);
|
||||
|
||||
@@ -158,6 +158,24 @@ public class AppEngSlot extends Slot {
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(final EntityPlayer par1EntityPlayer) {
|
||||
if (this.isSlotEnabled()) {
|
||||
var draggedStack = par1EntityPlayer.inventory.getItemStack();
|
||||
ItemStack slotStack = this.getStack();
|
||||
|
||||
|
||||
if (!draggedStack.isEmpty()) {
|
||||
if (draggedStack.isItemEqual(slotStack)) {
|
||||
if (draggedStack.getCount() >= draggedStack.getMaxStackSize()) {
|
||||
// Prevent over-pulling.
|
||||
return false;
|
||||
}
|
||||
} else if (slotStack.getCount() > slotStack.getMaxStackSize()) {
|
||||
// Prevent swapping when clicking slots that hold more items than the max stack size.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isSlotEnabled()) {
|
||||
return !this.itemHandler.extractItem(this.index, Integer.MAX_VALUE, true).isEmpty();
|
||||
}
|
||||
|
||||
@@ -97,26 +97,9 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
||||
return is;
|
||||
}
|
||||
|
||||
// Don't render the item client-side if the item stage for it is not unlocked yet
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
if (Platform.isClient() && Loader.isModLoaded("itemstages")) {
|
||||
return itemstageStack();
|
||||
}
|
||||
return super.getStack();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ItemStack itemstageStack() {
|
||||
final ItemStack item = super.getStack();
|
||||
final String itemsStage = ItemStages.getStage(item);
|
||||
final String enchantStage = ItemStages.getEnchantStage(item);
|
||||
final EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
|
||||
if ((itemsStage != null && !GameStageHelper.hasStage(player, itemsStage))
|
||||
|| (enchantStage != null && !GameStageHelper.hasStage(player, enchantStage)))
|
||||
return ItemStack.EMPTY;
|
||||
return super.getStack();
|
||||
public boolean shouldDisplay() {
|
||||
return !getStack().isEmpty();
|
||||
}
|
||||
|
||||
public void doClick(final InventoryAction action, final EntityPlayer who) {
|
||||
@@ -196,15 +179,6 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
||||
}
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("itemstages")) {
|
||||
final String itemsStage = ItemStages.getStage(recipe.getRecipeOutput());
|
||||
final String enchantStage = ItemStages.getEnchantStage(recipe.getRecipeOutput());
|
||||
|
||||
if ((itemsStage != null && !GameStageHelper.hasStage(player, itemsStage))
|
||||
|| (enchantStage != null && !GameStageHelper.hasStage(player, enchantStage)))
|
||||
return null;
|
||||
}
|
||||
|
||||
return recipe;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
private int craftingCalculationTimePerTick = 5;
|
||||
private PowerUnits selectedPowerUnit = PowerUnits.AE;
|
||||
private boolean showCraftableTooltip = true;
|
||||
private boolean showPlacementPreview = true;
|
||||
|
||||
// Spatial IO/Dimension
|
||||
private int storageProviderID = -1;
|
||||
@@ -257,6 +258,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
this.useLargeFonts = this.get("Client", "useTerminalUseLargeFont", false).getBoolean(false);
|
||||
this.useColoredCraftingStatus = this.get("Client", "useColoredCraftingStatus", true).getBoolean(true);
|
||||
this.showCraftableTooltip = this.get("Client", "showCraftableTooltip", true, "Whether to add \"Craftable\" to item tooltips when they can be crafted automatically.").getBoolean(true);
|
||||
this.showPlacementPreview = this.get("Client", "showPlacementPreview", true, "Whether to show a preview of part and facade placement.").getBoolean(true);
|
||||
|
||||
// load buttons..
|
||||
for (int btnNum = 0; btnNum < 4; btnNum++) {
|
||||
@@ -268,7 +270,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
|
||||
this.craftByStacks[btnNum] = Math.abs(cmb.getInt(this.craftByStacks[btnNum]));
|
||||
this.priorityByStacks[btnNum] = Math.abs(pmb.getInt(this.priorityByStacks[btnNum]));
|
||||
this.levelByStacks[btnNum] = Math.abs(pmb.getInt(this.levelByStacks[btnNum]));
|
||||
this.levelByStacks[btnNum] = Math.abs(lmb.getInt(this.levelByStacks[btnNum]));
|
||||
|
||||
cmb.setComment("Controls buttons on Crafting Screen : Capped at " + buttonCap);
|
||||
pmb.setComment("Controls buttons on Priority Screen : Capped at " + buttonCap);
|
||||
@@ -514,6 +516,10 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
return this.showCraftableTooltip;
|
||||
}
|
||||
|
||||
public boolean showPlacementPreview() {
|
||||
return this.showPlacementPreview;
|
||||
}
|
||||
|
||||
public boolean isDisableColoredCableRecipesInJEI() {
|
||||
return this.disableColoredCableRecipesInJEI;
|
||||
}
|
||||
|
||||
@@ -40,12 +40,12 @@ public final class CreativeTab extends CreativeTabs {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTabIconItem() {
|
||||
return this.getIconItemStack();
|
||||
public ItemStack getIcon() {
|
||||
return this.createIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
public ItemStack createIcon() {
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IItems items = definitions.items();
|
||||
|
||||
@@ -42,12 +42,12 @@ public final class CreativeTabFacade extends CreativeTabs {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTabIconItem() {
|
||||
return this.getIconItemStack();
|
||||
public ItemStack getIcon() {
|
||||
return this.createIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
public ItemStack createIcon() {
|
||||
final Optional<Item> maybeFacade = AEApi.instance().definitions().items().facade().maybeItem();
|
||||
if (maybeFacade.isPresent()) {
|
||||
return ((ItemFacade) maybeFacade.get()).getCreativeTabIcon();
|
||||
|
||||
@@ -54,13 +54,13 @@ import appeng.core.stats.PartItemPredicate;
|
||||
import appeng.core.stats.Stats;
|
||||
import appeng.core.worlddata.SpatialDimensionManager;
|
||||
import appeng.fluids.registries.BasicFluidCellGuiHandler;
|
||||
import appeng.hooks.WrenchClickHook;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.items.materials.ItemMaterial;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.items.parts.ItemPart;
|
||||
import appeng.loot.ChestLoot;
|
||||
import appeng.me.cache.*;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.recipes.AEItemResolver;
|
||||
import appeng.recipes.AERecipeLoader;
|
||||
import appeng.recipes.game.DisassembleRecipe;
|
||||
@@ -109,7 +109,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@@ -193,7 +192,7 @@ final class Registration {
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(TickHandler.INSTANCE);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new PartPlacement());
|
||||
MinecraftForge.EVENT_BUS.register(new WrenchClickHook());
|
||||
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHEST_LOOT)) {
|
||||
MinecraftForge.EVENT_BUS.register(new ChestLoot());
|
||||
@@ -365,15 +364,19 @@ final class Registration {
|
||||
// Storage Cells
|
||||
Upgrades.FUZZY.registerItem(items.cell1k(), 1);
|
||||
Upgrades.INVERTER.registerItem(items.cell1k(), 1);
|
||||
Upgrades.STICKY.registerItem(items.cell1k(), 1);
|
||||
|
||||
Upgrades.FUZZY.registerItem(items.cell4k(), 1);
|
||||
Upgrades.INVERTER.registerItem(items.cell4k(), 1);
|
||||
Upgrades.STICKY.registerItem(items.cell4k(), 1);
|
||||
|
||||
Upgrades.FUZZY.registerItem(items.cell16k(), 1);
|
||||
Upgrades.INVERTER.registerItem(items.cell16k(), 1);
|
||||
Upgrades.STICKY.registerItem(items.cell16k(), 1);
|
||||
|
||||
Upgrades.FUZZY.registerItem(items.cell64k(), 1);
|
||||
Upgrades.INVERTER.registerItem(items.cell64k(), 1);
|
||||
Upgrades.STICKY.registerItem(items.cell64k(), 1);
|
||||
|
||||
Upgrades.FUZZY.registerItem(items.portableCell(), 1);
|
||||
Upgrades.INVERTER.registerItem(items.portableCell(), 1);
|
||||
@@ -388,10 +391,12 @@ final class Registration {
|
||||
Upgrades.FUZZY.registerItem(parts.storageBus(), 1);
|
||||
Upgrades.INVERTER.registerItem(parts.storageBus(), 1);
|
||||
Upgrades.CAPACITY.registerItem(parts.storageBus(), 5);
|
||||
Upgrades.STICKY.registerItem(parts.storageBus(), 1);
|
||||
|
||||
// Storage Bus Fluids
|
||||
Upgrades.INVERTER.registerItem(parts.fluidStorageBus(), 1);
|
||||
Upgrades.CAPACITY.registerItem(parts.fluidStorageBus(), 5);
|
||||
Upgrades.STICKY.registerItem(parts.fluidStorageBus(), 1);
|
||||
|
||||
// Formation Plane
|
||||
Upgrades.FUZZY.registerItem(parts.formationPlane(), 1);
|
||||
|
||||
@@ -60,6 +60,10 @@ public class ApiClientHelper implements IClientHelper {
|
||||
lines.add("[" + GuiText.Partitioned.getLocal() + "]" + " - " + list + ' ' + GuiText.Precise.getLocal());
|
||||
}
|
||||
|
||||
if (handler.isSticky()) {
|
||||
lines.add(GuiText.Sticky.getLocal());
|
||||
}
|
||||
|
||||
if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||
IItemHandler inv = cellInventory.getConfigInventory();
|
||||
cellInventory.getAvailableItems((IItemList) itemList);
|
||||
|
||||
@@ -19,18 +19,18 @@
|
||||
package appeng.core.api;
|
||||
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.api.parts.CableRenderMode;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.parts.LayerBase;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -39,243 +39,15 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.commons.ClassRemapper;
|
||||
import org.objectweb.asm.commons.Remapper;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
public class ApiPart implements IPartHelper {
|
||||
|
||||
private final LoadingCache<CacheKey, Class<? extends AEBaseTile>> cache = CacheBuilder.newBuilder()
|
||||
.build(new CacheLoader<CacheKey, Class<? extends AEBaseTile>>() {
|
||||
@Override
|
||||
public Class<? extends AEBaseTile> load(CacheKey key) throws Exception {
|
||||
return ApiPart.this.generateCombinedClass(key);
|
||||
}
|
||||
});
|
||||
|
||||
private final Map<Class<?>, String> interfaces2Layer = new HashMap<>();
|
||||
private final List<String> desc = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a
|
||||
* chain of all registered layers.
|
||||
* <p/>
|
||||
* To accomplish this, it takes the first registered layer, replaces it's inheritance from LayerBase with an
|
||||
* inheritance from the given baseClass,
|
||||
* and uses the resulting class as the parent class for the next registered layer, for which it repeats this
|
||||
* process. This process is then repeated
|
||||
* until a class hierarchy of all layers is formed. While janking out the inheritance from LayerBase, it'll make
|
||||
* also sure that calls to that
|
||||
* classes method will instead be forwarded to the superclass that was inserted as part of the described process.
|
||||
* <p/>
|
||||
* Example: If layers A and B are registered, and TileCableBus is passed in as the baseClass, a synthetic class
|
||||
* A_B_TileCableBus should be returned,
|
||||
* which has A_B_TileCableBus -extends-> B_TileCableBus -extends-> TileCableBus as it's class hierarchy, where
|
||||
* A_B_TileCableBus has been generated
|
||||
* from A, and B_TileCableBus has been generated from B.
|
||||
*/
|
||||
public Class<? extends AEBaseTile> getCombinedInstance(final Class<? extends AEBaseTile> baseClass) {
|
||||
if (this.desc.isEmpty()) {
|
||||
// No layers registered...
|
||||
return baseClass;
|
||||
}
|
||||
|
||||
return this.cache.getUnchecked(new CacheKey(baseClass, this.desc));
|
||||
}
|
||||
|
||||
private Class<? extends AEBaseTile> generateCombinedClass(CacheKey cacheKey) {
|
||||
final Class<? extends AEBaseTile> parentClass;
|
||||
|
||||
// Get the list of interfaces that still need to be implemented beyond the current one
|
||||
List<String> remainingInterfaces = cacheKey.getInterfaces().subList(1, cacheKey.getInterfaces().size());
|
||||
|
||||
// We are not at the root of the class hierarchy yet
|
||||
if (!remainingInterfaces.isEmpty()) {
|
||||
CacheKey parentKey = new CacheKey(cacheKey.getBaseClass(), remainingInterfaces);
|
||||
parentClass = this.cache.getUnchecked(parentKey);
|
||||
} else {
|
||||
parentClass = cacheKey.getBaseClass();
|
||||
}
|
||||
|
||||
// Which interface should be implemented in this layer?
|
||||
String interfaceName = cacheKey.getInterfaces().get(0);
|
||||
|
||||
try {
|
||||
// This is the particular interface that this layer was registered for. Loading the class may fail if i.e.
|
||||
// an API is broken or not present
|
||||
// and in this case, the layer will be skipped!
|
||||
Class<?> interfaceClass = Class.forName(interfaceName);
|
||||
String layerImpl = this.interfaces2Layer.get(interfaceClass);
|
||||
|
||||
return this.getClassByDesc(parentClass, layerImpl);
|
||||
} catch (final Throwable t) {
|
||||
AELog.warn("Error loading " + interfaceName);
|
||||
AELog.debug(t);
|
||||
return parentClass;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Class<? extends AEBaseTile> getClassByDesc(Class<? extends AEBaseTile> baseClass, final String next) {
|
||||
final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||
final ClassNode n = this.getReader(next);
|
||||
final String originalName = n.name;
|
||||
|
||||
try {
|
||||
n.name = n.name + '_' + baseClass.getSimpleName();
|
||||
n.superName = baseClass.getName().replace('.', '/');
|
||||
} catch (final Throwable t) {
|
||||
AELog.debug(t);
|
||||
}
|
||||
|
||||
for (final MethodNode mn : n.methods) {
|
||||
final Iterator<AbstractInsnNode> i = mn.instructions.iterator();
|
||||
while (i.hasNext()) {
|
||||
this.processNode(i.next(), n.superName);
|
||||
}
|
||||
}
|
||||
|
||||
final DefaultPackageClassNameRemapper remapper = new DefaultPackageClassNameRemapper();
|
||||
remapper.inputOutput.put("appeng/api/parts/LayerBase", n.superName);
|
||||
remapper.inputOutput.put(originalName, n.name);
|
||||
n.accept(new ClassRemapper(cw, remapper));
|
||||
// n.accept( cw );
|
||||
|
||||
// n.accept( new TraceClassVisitor( new PrintWriter( System.out ) ) );
|
||||
final byte[] byteArray = cw.toByteArray();
|
||||
final int size = byteArray.length;
|
||||
final Class clazz = this.loadClass(n.name.replace("/", "."), byteArray);
|
||||
|
||||
try {
|
||||
final Object fish = clazz.newInstance();
|
||||
|
||||
boolean hasError = false;
|
||||
|
||||
if (!baseClass.isInstance(fish)) {
|
||||
hasError = true;
|
||||
AELog.error("Error, Expected layer to implement " + baseClass + " did not.");
|
||||
}
|
||||
|
||||
if (fish instanceof LayerBase) {
|
||||
hasError = true;
|
||||
AELog.error("Error, Expected layer to NOT implement LayerBase but it DID.");
|
||||
}
|
||||
|
||||
if (!(fish instanceof TileCableBus)) {
|
||||
hasError = true;
|
||||
AELog.error("Error, Expected layer to implement TileCableBus did not.");
|
||||
}
|
||||
|
||||
if (!(fish instanceof TileEntity)) {
|
||||
hasError = true;
|
||||
AELog.error("Error, Expected layer to implement TileEntity did not.");
|
||||
}
|
||||
|
||||
if (!hasError) {
|
||||
AELog.info("Layer: " + n.name + " loaded successfully - " + size + " bytes");
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
AELog.error("Layer: " + n.name + " Failed.");
|
||||
AELog.debug(t);
|
||||
}
|
||||
|
||||
return clazz;
|
||||
}
|
||||
|
||||
private ClassNode getReader(final String name) {
|
||||
final String path = '/' + name.replace(".", "/") + ".class";
|
||||
final InputStream is = this.getClass().getResourceAsStream(path);
|
||||
try {
|
||||
final ClassReader cr = new ClassReader(is);
|
||||
|
||||
final ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, ClassReader.EXPAND_FRAMES);
|
||||
|
||||
return cn;
|
||||
} catch (final IOException e) {
|
||||
throw new IllegalStateException("Error loading " + name, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void processNode(final AbstractInsnNode next, final String nePar) {
|
||||
if (next instanceof MethodInsnNode) {
|
||||
final MethodInsnNode min = (MethodInsnNode) next;
|
||||
if (min.owner.equals("appeng/api/parts/LayerBase")) {
|
||||
min.owner = nePar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Class loadClass(final String name, byte[] b) {
|
||||
// override classDefine (as it is protected) and define the class.
|
||||
Class clazz = null;
|
||||
try {
|
||||
final ClassLoader loader = this.getClass().getClassLoader();// ClassLoader.getSystemClassLoader();
|
||||
final Class<ClassLoader> root = ClassLoader.class;
|
||||
final Class<? extends ClassLoader> cls = loader.getClass();
|
||||
final Method defineClassMethod = root.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class);
|
||||
final Method runTransformersMethod = cls.getDeclaredMethod("runTransformers", String.class, String.class, byte[].class);
|
||||
|
||||
runTransformersMethod.setAccessible(true);
|
||||
defineClassMethod.setAccessible(true);
|
||||
try {
|
||||
final Object[] argsA = {
|
||||
name,
|
||||
name,
|
||||
b
|
||||
};
|
||||
b = (byte[]) runTransformersMethod.invoke(loader, argsA);
|
||||
|
||||
final Object[] args = {
|
||||
name,
|
||||
b,
|
||||
0,
|
||||
b.length
|
||||
};
|
||||
clazz = (Class) defineClassMethod.invoke(loader, args);
|
||||
} finally {
|
||||
runTransformersMethod.setAccessible(false);
|
||||
defineClassMethod.setAccessible(false);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
AELog.debug(e);
|
||||
throw new IllegalStateException("Unable to manage part API.", e);
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerNewLayer(final String layer, final String layerInterface) {
|
||||
try {
|
||||
final Class<?> layerInterfaceClass = Class.forName(layerInterface);
|
||||
if (this.interfaces2Layer.get(layerInterfaceClass) == null) {
|
||||
this.interfaces2Layer.put(layerInterfaceClass, layer);
|
||||
this.desc.add(layerInterface);
|
||||
return true;
|
||||
} else {
|
||||
AELog.info("Layer " + layer + " not registered, " + layerInterface + " already has a layer.");
|
||||
}
|
||||
} catch (final Throwable ignored) {
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult placeBus(final ItemStack is, final BlockPos pos, final EnumFacing side, final EntityPlayer player, final EnumHand hand, final World w) {
|
||||
return PartPlacement.place(is, pos, side, player, hand, w, PartPlacement.PlaceType.PLACE_ITEM, 0);
|
||||
return PartPlacement.place(is, pos, side, player, hand, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -283,57 +55,55 @@ public class ApiPart implements IPartHelper {
|
||||
return AppEng.proxy.getRenderMode();
|
||||
}
|
||||
|
||||
private static class DefaultPackageClassNameRemapper extends Remapper {
|
||||
@Nullable
|
||||
@Override
|
||||
public IPart getPart(World w, BlockPos pos, AEPartLocation side) {
|
||||
final TileEntity tile = w.getTileEntity(pos);
|
||||
if (tile instanceof IPartHost partHost) {
|
||||
return partHost.getPart(side);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private final HashMap<String, String> inputOutput = new HashMap<>();
|
||||
@Nullable
|
||||
@Override
|
||||
public IPartHost getPartHost(World w, BlockPos pos) {
|
||||
final TileEntity tile = w.getTileEntity(pos);
|
||||
if (tile instanceof IPartHost partHost) {
|
||||
return partHost;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(final String typeName) {
|
||||
final String o = this.inputOutput.get(typeName);
|
||||
if (o == null) {
|
||||
return typeName;
|
||||
@Nullable
|
||||
@Override
|
||||
public IPartHost getOrPlacePartHost(World w, BlockPos pos, boolean force, @Nullable EntityPlayer p) {
|
||||
final TileEntity tile = w.getTileEntity(pos);
|
||||
if (tile instanceof IPartHost partHost) {
|
||||
return partHost;
|
||||
} else {
|
||||
if (!force && !canPlacePartHost(w, pos, p)) {
|
||||
return null;
|
||||
}
|
||||
return o;
|
||||
|
||||
final ITileDefinition multiPart = AEApi.instance().definitions().blocks().multiPart();
|
||||
if (!multiPart.isEnabled()) return null;
|
||||
Block blk = multiPart.maybeBlock().orElse(null);
|
||||
if (blk == null) return null;
|
||||
|
||||
final IBlockState state = blk.getDefaultState();
|
||||
w.setBlockState(pos, state, 3);
|
||||
return w.getTileEntity(pos) instanceof IPartHost host ? host : null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class CacheKey {
|
||||
private final Class<? extends AEBaseTile> baseClass;
|
||||
|
||||
private final List<String> interfaces;
|
||||
|
||||
private CacheKey(Class<? extends AEBaseTile> baseClass, List<String> interfaces) {
|
||||
this.baseClass = baseClass;
|
||||
this.interfaces = ImmutableList.copyOf(interfaces);
|
||||
@Override
|
||||
public boolean canPlacePartHost(World w, BlockPos pos, @Nullable EntityPlayer p) {
|
||||
if (p != null && !Platform.hasPermissions(w, pos, p)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private Class<? extends AEBaseTile> getBaseClass() {
|
||||
return this.baseClass;
|
||||
}
|
||||
|
||||
private List<String> getInterfaces() {
|
||||
return this.interfaces;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || this.getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CacheKey cacheKey = (CacheKey) o;
|
||||
|
||||
return this.baseClass.equals(cacheKey.baseClass) && this.interfaces.equals(cacheKey.interfaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = this.baseClass.hashCode();
|
||||
result = 31 * result + this.interfaces.hashCode();
|
||||
return result;
|
||||
}
|
||||
final Block blk = w.getBlockState(pos).getBlock();
|
||||
return blk == null || blk.isReplaceable(w, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,6 +561,10 @@ public final class ApiBlocks implements IBlocks {
|
||||
})
|
||||
.build();
|
||||
|
||||
if (!stairs.maybeBlock().isPresent()) {
|
||||
return new BlockDefinition(registryName, null, null);
|
||||
}
|
||||
|
||||
Verify.verify(stairs.maybeBlock().isPresent());
|
||||
|
||||
return stairs;
|
||||
|
||||
@@ -90,6 +90,7 @@ public final class ApiMaterials implements IMaterials {
|
||||
private final IItemDefinition cardFuzzy;
|
||||
private final IItemDefinition cardInverter;
|
||||
private final IItemDefinition cardCrafting;
|
||||
private final IItemDefinition cardSticky;
|
||||
|
||||
private final IItemDefinition enderDust;
|
||||
private final IItemDefinition flour;
|
||||
@@ -208,6 +209,7 @@ public final class ApiMaterials implements IMaterials {
|
||||
this.cardFuzzy = new DamagedItemDefinition("material.card.fuzzy", materials.createMaterial(MaterialType.CARD_FUZZY));
|
||||
this.cardInverter = new DamagedItemDefinition("material.card.inverter", materials.createMaterial(MaterialType.CARD_INVERTER));
|
||||
this.cardCrafting = new DamagedItemDefinition("material.card.crafting", materials.createMaterial(MaterialType.CARD_CRAFTING));
|
||||
this.cardSticky = new DamagedItemDefinition("material.card.sticky", materials.createMaterial(MaterialType.CARD_STICKY));
|
||||
|
||||
this.enderDust = new DamagedItemDefinition("material.dust.ender", materials.createMaterial(MaterialType.ENDER_DUST));
|
||||
this.flour = new DamagedItemDefinition("material.flour", materials.createMaterial(MaterialType.FLOUR));
|
||||
@@ -425,6 +427,11 @@ public final class ApiMaterials implements IMaterials {
|
||||
return this.cardCrafting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cardSticky() {
|
||||
return this.cardSticky;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition enderDust() {
|
||||
return this.enderDust;
|
||||
|
||||
@@ -166,6 +166,7 @@ public enum AEFeature {
|
||||
MOLECULAR_ASSEMBLER("MolecularAssembler", Constants.CATEGORY_CRAFTING_FEATURES),
|
||||
PATTERNS("Patterns", Constants.CATEGORY_CRAFTING_FEATURES),
|
||||
CRAFTING_CPU("CraftingCPU", Constants.CATEGORY_CRAFTING_FEATURES),
|
||||
CRAFTING_TOASTS("CraftingToasts", Constants.CATEGORY_CRAFTING_FEATURES),
|
||||
|
||||
BASIC_CARDS("BasicCards", Constants.CATEGORY_UPGRADES),
|
||||
ADVANCED_CARDS("AdvancedCards", Constants.CATEGORY_UPGRADES),
|
||||
|
||||
@@ -252,7 +252,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry {
|
||||
|
||||
// Use the mod id as last option.
|
||||
for (final Entry<String, TunnelType> entry : this.modIdTunnels.entrySet()) {
|
||||
if (trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getResourceDomain().equals(entry.getKey())) {
|
||||
if (trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getNamespace().equals(entry.getKey())) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
|
||||
return null;
|
||||
}
|
||||
|
||||
this.log("Recipe for '%1$s' found '%2$s'", input.getUnlocalizedName(), Platform.getItemDisplayName(recipe.getOutput()));
|
||||
this.log("Recipe for '%1$s' found '%2$s'", input.getTranslationKey(), Platform.getItemDisplayName(recipe.getOutput()));
|
||||
return recipe;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,13 +195,18 @@ public enum GuiText {
|
||||
Partitioned,
|
||||
Precise,
|
||||
Fuzzy,
|
||||
Sticky,
|
||||
|
||||
// Used in a terminal to indicate that an item is craftable
|
||||
SmallFontCraft,
|
||||
LargeFontCraft,
|
||||
|
||||
// Used in a ME Interface when no appropriate TileEntity was detected near it
|
||||
Nothing;
|
||||
Nothing,
|
||||
|
||||
// Used in Crafting Toasts
|
||||
CraftingToastDone,
|
||||
CraftingToastCancelled;
|
||||
|
||||
private final String root;
|
||||
|
||||
|
||||
@@ -44,8 +44,6 @@ public class AppEngPacketHandlerBase {
|
||||
|
||||
PACKET_CONFIG_BUTTON(PacketConfigButton.class),
|
||||
|
||||
PACKET_PART_PLACEMENT(PacketPartPlacement.class),
|
||||
|
||||
PACKET_LIGHTNING(PacketLightning.class),
|
||||
|
||||
PACKET_MATTER_CANNON(PacketMatterCannon.class),
|
||||
@@ -86,7 +84,15 @@ public class AppEngPacketHandlerBase {
|
||||
|
||||
PACKET_CRAFTING_CPUS_UPDATE(PacketCraftingCPUsUpdate.class),
|
||||
|
||||
PACKET_TERMINAL_KEYBIND(PacketTerminalUse.class);
|
||||
PACKET_TERMINAL_KEYBIND(PacketTerminalUse.class),
|
||||
|
||||
PACKET_CRAFTING_TOAST(PacketCraftingToast.class),
|
||||
|
||||
PACKET_COLOR_APPLICATOR_SELECT_COLOR(PacketColorApplicatorSelectColor.class),
|
||||
|
||||
PACKET_CABLE_BUS_LANDING_PARTICLE(PacketCableBusLandingParticle.class),
|
||||
|
||||
;
|
||||
|
||||
|
||||
private final Class<? extends AppEngPacket> packetClass;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user