Compare commits
124 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d1205412c | |||
| ad8b7aa7bd | |||
| 26bb5986c6 | |||
| e175bccace | |||
| 127872b310 | |||
| b030cb9f00 | |||
| f1e5a33a6e | |||
| f42a5778d2 | |||
| d131e12498 | |||
| f1d9fda6ce | |||
| 2141ffe7f0 | |||
| 7baf538a76 | |||
| e833aa1e61 | |||
| 202259ef2a | |||
| fabc9bd82c | |||
| 9c021867f0 | |||
| 9749faa692 | |||
| 37e7c02c3c | |||
| 7f2318f89c | |||
| 925cf092be | |||
| 7c6ceefd94 | |||
| c7ec7e0890 | |||
| 0a7799a664 | |||
| 1316f035cd | |||
| 10a0453bea | |||
| efe726ecdd | |||
| 9a255432f5 | |||
| eba3e2456a | |||
| d40b9831c1 | |||
| 6632344f87 | |||
| 724f3baf4c | |||
| f7562db2e9 | |||
| 68de8fa1a2 | |||
| 6864f7ae07 | |||
| 7fa7b726f2 | |||
| c814fe591d | |||
| cd0a5d631b | |||
| d82cdabc6d | |||
| 2e976a609f | |||
| a13f9955f2 | |||
| a65b5015e6 | |||
| 07eb6c1238 | |||
| 529ea5e239 | |||
| a9b7faa98b | |||
| 78c7235bea | |||
| 59edb38208 | |||
| 08a7aff600 | |||
| 9f19e05592 | |||
| 5f20e3346c | |||
| fd188dc96c | |||
| e471293e60 | |||
| f28a3574df | |||
| b2b21eae41 | |||
| e8a186df60 | |||
| 6425ef6ecd | |||
| 7ebb2a0fbb | |||
| 20a1fec6fb | |||
| 0fffc829ab | |||
| 88635d9a8d | |||
| 0fd0ed1b1c | |||
| 87f884228e | |||
| 3495d3dfd4 | |||
| 0acb03b83d | |||
| 9adb0359dd | |||
| 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 |
+17
-19
@@ -1,25 +1,23 @@
|
|||||||
name: Build mod
|
name: Build
|
||||||
|
|
||||||
on: [ push, pull_request, workflow_dispatch ]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build mod
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK 1.8
|
- name: Set up OpenJDK 17
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'adopt'
|
java-version: '17'
|
||||||
java-version: '8'
|
distribution: 'adopt' # You can choose other OpenJDK distributions.
|
||||||
- name: Grant execute permission for gradlew
|
- name: Update Build Script (Before Build)
|
||||||
run: chmod +x gradlew
|
run: ./gradlew updateBuildScript
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew -Pnet.minecraftforge.gradle.disableUpdateChecker=true build
|
run: ./gradlew build
|
||||||
- name: Upload artifacts
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: appliedenergistics2
|
name: AE2-UEL
|
||||||
path: build/libs
|
path: build/libs/*.jar # Make sure this path matches the location of your build artifacts
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
# 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 Maven
|
||||||
|
uses: gradle/gradle-build-action@v2
|
||||||
|
env:
|
||||||
|
MAVEN_USER: "${{secrets.MAVEN_USER}}"
|
||||||
|
MAVEN_PASSWORD: "${{secrets.MAVEN_PASSWORD}}"
|
||||||
|
with:
|
||||||
|
arguments: 'publish --daemon'
|
||||||
|
generate-job-summary: false
|
||||||
|
gradle-home-cache-includes: |
|
||||||
|
caches
|
||||||
|
jdks
|
||||||
|
notifications
|
||||||
|
wrapper
|
||||||
|
|
||||||
|
- 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
|
### Windows ###
|
||||||
# need gradle
|
|
||||||
!gradle/
|
|
||||||
!gradlew
|
|
||||||
!gradlew.bat
|
|
||||||
!build.gradle
|
|
||||||
!gradle.properties
|
|
||||||
!settings.gradle
|
|
||||||
!.travis.yml
|
|
||||||
|
|
||||||
# include markdowns
|
thumbs.db
|
||||||
!README.md
|
*.db
|
||||||
!LICENSE
|
|
||||||
|
|
||||||
# include sourcecode
|
### Java ###
|
||||||
!src/
|
|
||||||
|
|
||||||
# include git important files
|
*.class
|
||||||
!.gitmodules
|
|
||||||
!.gitignore
|
|
||||||
|
|
||||||
# code format to reduce noise in git commits
|
# Mobile Tools for Java (J2ME)
|
||||||
!codeformat/
|
.mtj.tmp/
|
||||||
|
|
||||||
# Github specific files and directories
|
# Package Files #
|
||||||
!.github/
|
*.war
|
||||||
|
*.ear
|
||||||
|
*.txt
|
||||||
|
|
||||||
# Explicit ignores
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
Thumbs.db
|
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
|
## 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
|
## RecipeStages
|
||||||
|
|
||||||
You need to add the following into a CraftTweaker script:
|
You need to add the following into a CraftTweaker script:
|
||||||
```
|
```
|
||||||
mods.recipestages.Recipes.setPackageStage("appeng", allStages);
|
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
|
## License
|
||||||
* Applied Energistics 2 API
|
* 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/)
|
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
Thanks to
|
|
||||||
|
Special thanks to:
|
||||||
|
|
||||||
|
* PrototypeTrousers for the initial fork
|
||||||
* Notch et al for Minecraft
|
* Notch et al for Minecraft
|
||||||
* Lex et al for MinecraftForge
|
* Lex et al for MinecraftForge
|
||||||
* AlgorithmX2 for AppliedEnergistics2
|
* AlgorithmX2 for AppliedEnergistics2
|
||||||
|
|||||||
+338
-138
@@ -1,3 +1,4 @@
|
|||||||
|
//version: 1704659416
|
||||||
/*
|
/*
|
||||||
* DO NOT CHANGE THIS FILE!
|
* DO NOT CHANGE THIS FILE!
|
||||||
* Also, you may replace this file at any time if there is an update available.
|
* 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 {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
|
id 'base'
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
|
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
|
||||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.19'
|
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.25'
|
||||||
id 'net.darkhax.curseforgegradle' version '1.0.14' apply false
|
id 'net.darkhax.curseforgegradle' version '1.1.17' apply false
|
||||||
id 'com.modrinth.minotaur' version '2.8.0' apply false
|
id 'com.modrinth.minotaur' version '2.8.6' apply false
|
||||||
id 'com.diffplug.spotless' version '6.13.0' 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.palantir.git-version' version '3.0.0' apply false
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
}
|
id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
|
||||||
|
id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false
|
||||||
if (verifySettingsGradle()) {
|
id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
|
||||||
throw new GradleException("Settings has been updated, please re-run task.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def out = services.get(StyledTextOutputFactory).create('an-output')
|
def out = services.get(StyledTextOutputFactory).create('an-output')
|
||||||
|
|
||||||
|
|
||||||
// Project properties
|
// Project properties
|
||||||
|
|
||||||
// Required properties: we don't know how to handle these being missing gracefully
|
// Required properties: we don't know how to handle these being missing gracefully
|
||||||
@@ -50,31 +52,72 @@ checkPropertyExists("mixinsPackage")
|
|||||||
checkPropertyExists("coreModClass")
|
checkPropertyExists("coreModClass")
|
||||||
checkPropertyExists("containsMixinsAndOrCoreModOnly")
|
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("customMavenPublishUrl", "")
|
||||||
|
propertyDefaultIfUnset("mavenArtifactGroup", getDefaultArtifactGroup())
|
||||||
|
propertyDefaultIfUnset("enableModernJavaSyntax", false)
|
||||||
|
propertyDefaultIfUnset("enableSpotless", false)
|
||||||
|
propertyDefaultIfUnset("enableJUnit", false)
|
||||||
|
propertyDefaultIfUnsetWithEnvVar("deploymentDebug", false, "DEPLOYMENT_DEBUG")
|
||||||
|
|
||||||
|
|
||||||
// Project property assertions
|
// Project property assertions
|
||||||
|
|
||||||
final String javaSourceDir = 'src/main/java/'
|
final String javaSourceDir = 'src/main/java/'
|
||||||
final String scalaSourceDir = 'src/main/scala/'
|
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 modGroupPath = modGroup.toString().replace('.' as char, '/' as char)
|
||||||
final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char)
|
final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char)
|
||||||
|
|
||||||
String targetPackageJava = javaSourceDir + modGroupPath
|
String targetPackageJava = javaSourceDir + modGroupPath
|
||||||
String targetPackageScala = scalaSourceDir + modGroupPath
|
String targetPackageScala = scalaSourceDir + modGroupPath
|
||||||
|
String targetPackageKotlin = kotlinSourceDir + modGroupPath
|
||||||
|
|
||||||
// If Kotlin is supported, add the path here
|
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 (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists()) {
|
|
||||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find ${targetPackageJava} or ${targetPackageScala}")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apiPackage) {
|
if (apiPackage) {
|
||||||
targetPackageJava = 'src/api/java/' + modGroupPath + '/api'
|
final String endApiPath = modGroupPath + '/' + apiPackagePath
|
||||||
targetPackageScala = 'src/api/java/' + modGroupPath + '/api'
|
if (useSrcApiPath) {
|
||||||
if (!getFile(targetPackageJava).exists() && !getFile(targetPackageScala).exists()) {
|
targetPackageJava = 'src/api/java/' + endApiPath
|
||||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala}")
|
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('\\.', '/')
|
final String mixinPackagePath = mixinsPackage.toString().replaceAll('\\.', '/')
|
||||||
targetPackageJava = javaSourceDir + modGroupPath + '/' + mixinPackagePath
|
targetPackageJava = javaSourceDir + modGroupPath + '/' + mixinPackagePath
|
||||||
targetPackageScala = scalaSourceDir + modGroupPath + '/' + mixinPackagePath
|
targetPackageScala = scalaSourceDir + modGroupPath + '/' + mixinPackagePath
|
||||||
if (!getFile(targetPackageJava).exists()) {
|
targetPackageKotlin = kotlinSourceDir + modGroupPath + '/' + mixinPackagePath
|
||||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find ${targetPackageJava} or ${targetPackageScala}")
|
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 targetFileJava = javaSourceDir + modGroupPath + '/' + coreModPath + '.java'
|
||||||
String targetFileScala = scalaSourceDir + modGroupPath + '/' + coreModPath + '.scala'
|
String targetFileScala = scalaSourceDir + modGroupPath + '/' + coreModPath + '.scala'
|
||||||
String targetFileScalaJava = scalaSourceDir + modGroupPath + '/' + coreModPath + '.java'
|
String targetFileScalaJava = scalaSourceDir + modGroupPath + '/' + coreModPath + '.java'
|
||||||
if (!getFile(targetFileJava).exists() && !getFile(targetFileScala).exists() && !getFile(targetFileScalaJava).exists()) {
|
String targetFileKotlin = kotlinSourceDir + modGroupPath + '/' + coreModPath + '.kt'
|
||||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava)
|
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
|
// 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
|
// Git version checking, also checking for if this is a submodule
|
||||||
if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) {
|
if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) {
|
||||||
apply plugin: 'com.palantir.git-version'
|
apply plugin: 'com.palantir.git-version'
|
||||||
@@ -123,6 +259,9 @@ if (usesShadowedDependencies.toBoolean()) {
|
|||||||
apply plugin: 'com.github.johnrengelman.shadow'
|
apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Configure Java
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
if (enableModernJavaSyntax.toBoolean()) {
|
if (enableModernJavaSyntax.toBoolean()) {
|
||||||
@@ -164,8 +303,11 @@ tasks.withType(ScalaCompile).configureEach {
|
|||||||
// Allow others using this buildscript to have custom gradle code run
|
// Allow others using this buildscript to have custom gradle code run
|
||||||
if (getFile('addon.gradle').exists()) {
|
if (getFile('addon.gradle').exists()) {
|
||||||
apply from: 'addon.gradle'
|
apply from: 'addon.gradle'
|
||||||
|
} else if (getFile('addon.gradle.kts').exists()) {
|
||||||
|
apply from: 'addon.gradle.kts'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Configure Minecraft
|
// Configure Minecraft
|
||||||
|
|
||||||
// Try to gather mod version from git tags if version is not manually specified
|
// 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}"
|
version = "${minecraftVersion}-${modVersion}"
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
version = modVersion
|
version = modVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
group = modGroup
|
group = modGroup
|
||||||
archivesBaseName = modArchivesBaseName
|
|
||||||
|
base {
|
||||||
|
archivesName = modArchivesBaseName
|
||||||
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
mcVersion = minecraftVersion
|
mcVersion = minecraftVersion
|
||||||
username = developmentEnvironmentUserName.toString()
|
username = developmentEnvironmentUserName.toString()
|
||||||
useDependencyAccessTransformers = true
|
useDependencyAccessTransformers = true
|
||||||
|
|
||||||
setMcpMappingChannel("snapshot")
|
|
||||||
setMcpMappingVersion("20171003")
|
|
||||||
|
|
||||||
// Automatic token injection with RetroFuturaGradle
|
// Automatic token injection with RetroFuturaGradle
|
||||||
if (gradleTokenModId) {
|
if (gradleTokenModId) {
|
||||||
injectedTags.put gradleTokenModId, modId
|
injectedTags.put gradleTokenModId, modId
|
||||||
@@ -209,22 +352,30 @@ minecraft {
|
|||||||
injectedTags.put gradleTokenVersion, modVersion
|
injectedTags.put gradleTokenVersion, modVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
injectedTags.put("VERSION", project.version)
|
|
||||||
injectedTags.put("AEVERSION", aeversion)
|
|
||||||
injectedTags.put("AECHANNEL", aechannel)
|
|
||||||
injectedTags.put("AEBUILD", aebuild)
|
|
||||||
|
|
||||||
// JVM arguments
|
// JVM arguments
|
||||||
extraRunJvmArguments.add("-ea:${modGroup}")
|
extraRunJvmArguments.add("-ea:${modGroup}")
|
||||||
if (usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean()) {
|
||||||
extraRunJvmArguments.addAll([
|
extraRunJvmArguments.addAll([
|
||||||
'-Dmixin.hotSwap=true',
|
'-Dmixin.hotSwap=true',
|
||||||
'-Dmixin.checks.interfaces=true',
|
'-Dmixin.checks.interfaces=true',
|
||||||
'-Dmixin.debug.export=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')
|
dependsOn('injectTags')
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("generateMcModInfo") {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("generatePackMcMeta") {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named('processIdeaSettings').configure {
|
|
||||||
dependsOn('injectTags')
|
|
||||||
}
|
|
||||||
|
|
||||||
// Repositories
|
// Repositories
|
||||||
|
|
||||||
@@ -263,46 +403,63 @@ repositories.configureEach { repo ->
|
|||||||
// Allow adding custom repositories to the buildscript
|
// Allow adding custom repositories to the buildscript
|
||||||
if (getFile('repositories.gradle').exists()) {
|
if (getFile('repositories.gradle').exists()) {
|
||||||
apply from: 'repositories.gradle'
|
apply from: 'repositories.gradle'
|
||||||
|
} else if (getFile('repositories.gradle.kts').exists()) {
|
||||||
|
apply from: 'repositories.gradle.kts'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
exclusiveContent {
|
if (includeWellKnownRepositories.toBoolean() || includeCommonDevEnvMods.toBoolean()) {
|
||||||
forRepository {
|
exclusiveContent {
|
||||||
//noinspection ForeignDelegate
|
forRepository {
|
||||||
maven {
|
//noinspection ForeignDelegate
|
||||||
name = 'Curse Maven'
|
maven {
|
||||||
url = 'https://www.cursemaven.com'
|
name = 'Curse Maven'
|
||||||
|
url = 'https://www.cursemaven.com'
|
||||||
|
// url = 'https://beta.cursemaven.com'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter {
|
||||||
|
includeGroup 'curse.maven'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filter {
|
exclusiveContent {
|
||||||
includeGroup 'curse.maven'
|
forRepository {
|
||||||
}
|
//noinspection ForeignDelegate
|
||||||
}
|
maven {
|
||||||
exclusiveContent {
|
name = 'Modrinth'
|
||||||
forRepository {
|
url = 'https://api.modrinth.com/maven'
|
||||||
//noinspection ForeignDelegate
|
}
|
||||||
maven {
|
}
|
||||||
name = 'Modrinth'
|
filter {
|
||||||
url = 'https://api.modrinth.com/maven'
|
includeGroup 'maven.modrinth'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filter {
|
maven {
|
||||||
includeGroup 'maven.modrinth'
|
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 {
|
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
||||||
name 'Cleanroom Maven'
|
// need to add this here even if we did not above
|
||||||
url 'https://maven.cleanroommc.com'
|
if (!includeWellKnownRepositories.toBoolean()) {
|
||||||
|
maven {
|
||||||
|
name 'Cleanroom Maven'
|
||||||
|
url 'https://maven.cleanroommc.com'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
maven {
|
mavenLocal() // Must be last for caching to work
|
||||||
name 'BlameJared Maven'
|
|
||||||
url 'https://maven.blamejared.com'
|
|
||||||
}
|
|
||||||
gradlePluginPortal()
|
|
||||||
mavenCentral()
|
|
||||||
mavenLocal()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
|
|
||||||
// Configure dependency configurations
|
// Configure dependency configurations
|
||||||
@@ -318,32 +475,31 @@ configurations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String mixinProviderSpec = 'zone.rong:mixinbooter:8.9'
|
||||||
dependencies {
|
dependencies {
|
||||||
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
|
if (usesMixins.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
|
|
||||||
}
|
|
||||||
|
|
||||||
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
|
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
|
||||||
// should use 24.1.1 but 30.0+ has a vulnerability fix
|
// should use 24.1.1 but 30.0+ has a vulnerability fix
|
||||||
annotationProcessor 'com.google.guava:guava:30.0-jre'
|
annotationProcessor 'com.google.guava:guava:30.0-jre'
|
||||||
// should use 2.8.6 but 2.8.9+ has a vulnerability fix
|
// should use 2.8.6 but 2.8.9+ has a vulnerability fix
|
||||||
annotationProcessor 'com.google.code.gson:gson:2.8.9'
|
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()) {
|
if (enableJUnit.toBoolean()) {
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1'
|
|
||||||
testImplementation 'org.hamcrest:hamcrest:2.2'
|
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()) {
|
if (enableModernJavaSyntax.toBoolean()) {
|
||||||
@@ -364,8 +520,11 @@ dependencies {
|
|||||||
testCompileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0"
|
testCompileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOnlyApi 'org.jetbrains:annotations:23.0.0'
|
compileOnlyApi 'org.jetbrains:annotations:24.1.0'
|
||||||
annotationProcessor 'org.jetbrains:annotations:23.0.0'
|
annotationProcessor 'org.jetbrains:annotations:24.1.0'
|
||||||
|
patchedMinecraft('net.minecraft:launchwrapper:1.17.2') {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
|
|
||||||
if (includeCommonDevEnvMods.toBoolean()) {
|
if (includeCommonDevEnvMods.toBoolean()) {
|
||||||
implementation 'mezz.jei:jei_1.12.2:4.16.1.302'
|
implementation 'mezz.jei:jei_1.12.2:4.16.1.302'
|
||||||
@@ -374,11 +533,20 @@ dependencies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getFile('gradle/scripts/dependencies.gradle').exists()) {
|
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
|
||||||
apply from: 'gradle/scripts/dependencies.gradle'
|
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
|
// Test configuration
|
||||||
|
|
||||||
@@ -412,6 +580,7 @@ test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resource processing and jar building
|
// Resource processing and jar building
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
@@ -464,20 +633,20 @@ tasks.register('generateAssets') {
|
|||||||
mcmodInfoFile.text = """[{
|
mcmodInfoFile.text = """[{
|
||||||
"modid": "\${modid}",
|
"modid": "\${modid}",
|
||||||
"name": "\${modname}",
|
"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}",
|
"version": "\${version}",
|
||||||
"mcversion": "\${mcversion}",
|
"mcversion": "\${mcversion}",
|
||||||
"logoFile": "assets/appliedenergistics2/meta/logo.png",
|
"logoFile": "",
|
||||||
"url": "https://github.com/PrototypeTrousers/Applied-Energistics-2",
|
"url": "",
|
||||||
"authorList": ["AlgorithmX2"],
|
"authorList": [],
|
||||||
"credits": "AlgorithmX2",
|
"credits": "",
|
||||||
"dependencies": []
|
"dependencies": []
|
||||||
}]
|
}]
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
// mixins.{modid}.json
|
// mixins.{modid}.json
|
||||||
if (usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean() && generateMixinConfig.toBoolean()) {
|
||||||
def mixinConfigFile = getFile("src/main/resources/mixins.${modId}.json")
|
def mixinConfigFile = getFile("src/main/resources/mixins.${modId}.json")
|
||||||
if (!mixinConfigFile.exists()) {
|
if (!mixinConfigFile.exists()) {
|
||||||
def mixinConfigRefmap = "mixins.${modId}.refmap.json"
|
def mixinConfigRefmap = "mixins.${modId}.refmap.json"
|
||||||
@@ -514,26 +683,49 @@ jar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
from sourceSets.api.output
|
if (useSrcApiPath && apiPackage) {
|
||||||
dependsOn apiClasses
|
from sourceSets.api.output
|
||||||
|
dependsOn apiClasses
|
||||||
|
|
||||||
// specify which files are really included, can control which APIs should be in
|
include "${modGroupPath}/**"
|
||||||
include "appeng/**"
|
include "assets/**"
|
||||||
include "assets/**"
|
include "mcmod.info"
|
||||||
include "mcmod.info"
|
include "pack.mcmeta"
|
||||||
include "pack.mcmeta"
|
if (accessTransformersFile) {
|
||||||
include "META-INF/appliedenergistics2_at.cfg"
|
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
|
// Create API library jar
|
||||||
tasks.register('apiJar', Jar) {
|
tasks.register('apiJar', Jar) {
|
||||||
archiveClassifier.set 'api'
|
archiveClassifier.set 'api'
|
||||||
from(sourceSets.api.java) {
|
if (useSrcApiPath) {
|
||||||
include "${modGroupPath}/${apiPackagePath}/**"
|
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) {
|
from(sourceSets.main.output) {
|
||||||
include "${modGroupPath}/${apiPackagePath}/**"
|
include "${modGroupPath}/${apiPackagePath}/**"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,7 +758,7 @@ if (usesShadowedDependencies.toBoolean()) {
|
|||||||
finalizedBy(tasks.shadowJar)
|
finalizedBy(tasks.shadowJar)
|
||||||
}
|
}
|
||||||
tasks.named('reobfJar', ReobfuscatedJar) {
|
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')
|
AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.findByName('java')
|
||||||
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
|
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
|
||||||
@@ -701,7 +893,7 @@ tasks.register('generateChangelog') {
|
|||||||
.collect { ['--', it] }).flatten())
|
.collect { ['--', it] }).flatten())
|
||||||
|
|
||||||
if (changelog) {
|
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')
|
def f = getFile('build/changelog.md')
|
||||||
changelog = changelog ?: 'There have been no changes.'
|
changelog = changelog ?: 'There have been no changes.'
|
||||||
@@ -727,7 +919,7 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
|||||||
def changelogFile = getChangelog()
|
def changelogFile = getChangelog()
|
||||||
def changelogRaw = changelogFile.exists() ? changelogFile.getText('UTF-8') : ""
|
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.releaseType = getReleaseType()
|
||||||
mainFile.changelog = changelogRaw
|
mainFile.changelog = changelogRaw
|
||||||
mainFile.changelogType = 'markdown'
|
mainFile.changelogType = 'markdown'
|
||||||
@@ -743,6 +935,12 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
|||||||
}
|
}
|
||||||
String[] parts = dep.split(':')
|
String[] parts = dep.split(':')
|
||||||
String type = parts[0], slug = parts[1]
|
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'])) {
|
if (!(type in ['requiredDependency', 'embeddedLibrary', 'optionalDependency', 'tool', 'incompatible'])) {
|
||||||
throw new Exception('Invalid Curseforge dependency type: ' + type)
|
throw new Exception('Invalid Curseforge dependency type: ' + type)
|
||||||
}
|
}
|
||||||
@@ -767,6 +965,7 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
|||||||
modrinth {
|
modrinth {
|
||||||
token = modrinthApiKey.getOrElse('debug_token')
|
token = modrinthApiKey.getOrElse('debug_token')
|
||||||
projectId = modrinthProjectId
|
projectId = modrinthProjectId
|
||||||
|
versionName = versionDisplayFormat.replace('$MOD_NAME', modName).replace('$VERSION', modVersion)
|
||||||
changelog = changelogFile.exists() ? changelogFile.getText('UTF-8') : ""
|
changelog = changelogFile.exists() ? changelogFile.getText('UTF-8') : ""
|
||||||
versionType = getReleaseType()
|
versionType = getReleaseType()
|
||||||
versionNumber = modVersion
|
versionNumber = modVersion
|
||||||
@@ -784,7 +983,7 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
|||||||
}
|
}
|
||||||
String[] parts = dep.split(':')
|
String[] parts = dep.split(':')
|
||||||
String[] qual = parts[0].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)
|
tasks.modrinth.dependsOn(build)
|
||||||
@@ -793,9 +992,17 @@ if (modrinthApiKey.isPresent() || deploymentDebug.toBoolean()) {
|
|||||||
|
|
||||||
def addModrinthDep(String scope, String type, String name) {
|
def addModrinthDep(String scope, String type, String name) {
|
||||||
com.modrinth.minotaur.dependencies.Dependency dep
|
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'])) {
|
if (!(scope in ['required', 'optional', 'incompatible', 'embedded'])) {
|
||||||
throw new Exception('Invalid modrinth dependency scope: ' + scope)
|
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) {
|
switch (type) {
|
||||||
case 'project':
|
case 'project':
|
||||||
dep = new ModDependency(name, scope)
|
dep = new ModDependency(name, scope)
|
||||||
@@ -823,8 +1030,8 @@ if (customMavenPublishUrl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// providers is not available here, use System for getting env vars
|
// providers is not available here, use System for getting env vars
|
||||||
groupId = System.getenv('ARTIFACT_GROUP_ID') ?: project.group
|
groupId = System.getenv('ARTIFACT_GROUP_ID') ?: project.mavenArtifactGroup
|
||||||
artifactId = System.getenv('ARTIFACT_ID') ?: project.name
|
artifactId = System.getenv('ARTIFACT_ID') ?: project.modArchivesBaseName
|
||||||
version = System.getenv('RELEASE_VERSION') ?: publishedVersion
|
version = System.getenv('RELEASE_VERSION') ?: publishedVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -862,7 +1069,6 @@ def getReleaseType() {
|
|||||||
* Next, if 'generateDefaultChangelog' option is enabled, use that.
|
* Next, if 'generateDefaultChangelog' option is enabled, use that.
|
||||||
* Otherwise, try to use a CHANGELOG.md file at root directory.
|
* Otherwise, try to use a CHANGELOG.md file at root directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
def getChangelog() {
|
def getChangelog() {
|
||||||
def final changelogEnv = providers.environmentVariable('CHANGELOG_LOCATION')
|
def final changelogEnv = providers.environmentVariable('CHANGELOG_LOCATION')
|
||||||
if (changelogEnv.isPresent()) {
|
if (changelogEnv.isPresent()) {
|
||||||
@@ -877,7 +1083,7 @@ def getChangelog() {
|
|||||||
|
|
||||||
// Buildscript updating
|
// Buildscript updating
|
||||||
|
|
||||||
def buildscriptGradleVersion = '8.1.1'
|
def buildscriptGradleVersion = '8.5'
|
||||||
|
|
||||||
tasks.named('wrapper', Wrapper).configure {
|
tasks.named('wrapper', Wrapper).configure {
|
||||||
gradleVersion = buildscriptGradleVersion
|
gradleVersion = buildscriptGradleVersion
|
||||||
@@ -912,29 +1118,18 @@ static URL availableBuildScriptUrl() {
|
|||||||
new URL("https://raw.githubusercontent.com/GregTechCEu/Buildscripts/master/build.gradle")
|
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")
|
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() {
|
boolean performBuildScriptUpdate() {
|
||||||
if (isNewBuildScriptVersionAvailable()) {
|
if (isNewBuildScriptVersionAvailable()) {
|
||||||
def buildscriptFile = getFile("build.gradle")
|
def buildscriptFile = getFile("build.gradle")
|
||||||
|
def settingsFile = getFile("settings.gradle")
|
||||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
||||||
|
availableSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } }
|
||||||
def out = services.get(StyledTextOutputFactory).create('buildscript-update-output')
|
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!")
|
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 true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -981,6 +1176,11 @@ tasks.register('faq') {
|
|||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
|
|
||||||
|
def getDefaultArtifactGroup() {
|
||||||
|
def lastIndex = project.modGroup.lastIndexOf('.')
|
||||||
|
return lastIndex < 0 ? project.modGroup : project.modGroup.substring(0, lastIndex)
|
||||||
|
}
|
||||||
|
|
||||||
def getFile(String relativePath) {
|
def getFile(String relativePath) {
|
||||||
return new File(projectDir, relativePath)
|
return new File(projectDir, relativePath)
|
||||||
}
|
}
|
||||||
@@ -1024,4 +1224,4 @@ def getLastTag() {
|
|||||||
def githubTag = providers.environmentVariable('GITHUB_TAG')
|
def githubTag = providers.environmentVariable('GITHUB_TAG')
|
||||||
return runShell('git describe --abbrev=0 --tags ' +
|
return runShell('git describe --abbrev=0 --tags ' +
|
||||||
(githubTag.isPresent() ? runShell('git rev-list --tags --skip=1 --max-count=1') : ''))
|
(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
|
aeversion=rv6
|
||||||
aechannel=stable
|
aechannel=stable
|
||||||
aebuild=7
|
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)
|
# 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
|
# 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
|
# Will update your build.gradle automatically whenever an update is available
|
||||||
autoUpdateBuildScript=false
|
autoUpdateBuildScript = false
|
||||||
minecraftVersion=1.12.2
|
|
||||||
|
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
|
# 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:
|
# 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 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
|
# 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.
|
# 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.
|
# 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.
|
# See https://github.com/bsideup/jabel for details on how this works.
|
||||||
# Using this requires that you use a Java 17 JDK for development.
|
# 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
|
# Generate a class with String fields for the mod id, name and version named with the fields below
|
||||||
generateGradleTokenClass=appeng.Tags
|
generateGradleTokenClass = appeng.Tags
|
||||||
gradleTokenModId=
|
gradleTokenModId = MODID
|
||||||
gradleTokenModName=
|
gradleTokenModName = MODNAME
|
||||||
gradleTokenVersion=VERSION
|
gradleTokenVersion = VERSION
|
||||||
|
|
||||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
# 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.
|
# leave this property empty.
|
||||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||||
apiPackage=api
|
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/
|
# 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.
|
# There can be multiple files in a comma-separated list.
|
||||||
# Example value: mymodid_at.cfg,jei_at.cfg
|
# 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!
|
# 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!
|
# 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!
|
# 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
|
# 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
|
# 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!
|
# 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.
|
# 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
|
# 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
|
# 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).
|
# 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
|
# 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
|
# 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.
|
# 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
|
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
|
||||||
# their own classes, making the minimization unreliable.
|
# their own classes, making the minimization unreliable.
|
||||||
minimizeShadowedDependencies=true
|
minimizeShadowedDependencies = true
|
||||||
# If disabled, won't rename the shadowed classes.
|
# 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.
|
# 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.
|
# 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.
|
# Leave this empty if you don't want to publish on Modrinth.
|
||||||
# Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable.
|
# 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.
|
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||||
# type can be one of [project, version],
|
# type can be one of [project, version],
|
||||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
# 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
|
# 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.
|
# 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.
|
# 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.
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
# Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable.
|
# 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.
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
# Syntax: type1:name1;type2:name2;...
|
# Syntax: type1:name1;type2:name2;...
|
||||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
# and the name is the CurseForge project slug of the other mod.
|
# and the name is the CurseForge project slug of the other mod.
|
||||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
curseForgeRelations=
|
curseForgeRelations =
|
||||||
|
|
||||||
# This project's release type on CurseForge and/or Modrinth
|
# 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
|
# 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
|
# 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.
|
# commits since the last tagged release.
|
||||||
generateDefaultChangelog=false
|
generateDefaultChangelog = false
|
||||||
|
|
||||||
# Prevent the source code from being published
|
# 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 = https://maven.gtceu.com
|
||||||
|
|
||||||
|
# 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
|
# Enable spotless checks
|
||||||
# Enforces code formatting on your source code
|
# Enforces code formatting on your source code
|
||||||
# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless
|
# 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
|
# 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.
|
# root directory to apply your own formatting options instead.
|
||||||
enableSpotless=false
|
enableSpotless = false
|
||||||
|
|
||||||
# Enable JUnit testing platform used for testing your code.
|
# 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/
|
# Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/
|
||||||
enableJUnit=true
|
enableJUnit = true
|
||||||
|
|
||||||
# Deployment debug setting
|
# Deployment debug setting
|
||||||
# Uncomment this to test deployments to CurseForge and Modrinth
|
# Uncomment this to test deployments to CurseForge and Modrinth
|
||||||
# Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable.
|
# Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable.
|
||||||
deploymentDebug=false
|
deploymentDebug = false
|
||||||
|
|
||||||
|
|
||||||
# Gradle Settings
|
# Gradle Settings
|
||||||
# Effectively applies the '--stacktrace' flag by default
|
# 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.
|
# 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.
|
# 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
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -85,9 +85,6 @@ done
|
|||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
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.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
|
||||||
@@ -133,10 +130,13 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
@@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
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;
|
# Collect all arguments for the java command;
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
# 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
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -9,19 +25,23 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
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.
|
@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
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
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_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
@@ -45,38 +65,26 @@ echo location of your Java installation.
|
|||||||
|
|
||||||
goto fail
|
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
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@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
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
+9
-5
@@ -3,9 +3,7 @@ pluginManagement {
|
|||||||
maven {
|
maven {
|
||||||
// RetroFuturaGradle
|
// RetroFuturaGradle
|
||||||
name 'GTNH Maven'
|
name 'GTNH Maven'
|
||||||
//noinspection HttpUrlsUsage
|
url 'https://nexus.gtnewhorizons.com/repository/public/'
|
||||||
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
|
|
||||||
allowInsecureProtocol = true
|
|
||||||
//noinspection GroovyAssignabilityCheck
|
//noinspection GroovyAssignabilityCheck
|
||||||
mavenContent {
|
mavenContent {
|
||||||
includeGroup 'com.gtnewhorizons'
|
includeGroup 'com.gtnewhorizons'
|
||||||
@@ -19,8 +17,14 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
id 'com.diffplug.blowdryerSetup' version '1.7.0'
|
||||||
// Automatic toolchain provisioning
|
// 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()
|
||||||
|
|||||||
@@ -38,8 +38,12 @@ public enum ActionItems
|
|||||||
DIVIDE_BY_THREE,
|
DIVIDE_BY_THREE,
|
||||||
DECREASE_BY_ONE,
|
DECREASE_BY_ONE,
|
||||||
MAX_COUNT,
|
MAX_COUNT,
|
||||||
FREE_MOLECULAR_SLOT_SHORTCUT,
|
MOLECULAR_ASSEMBLERS_ON,
|
||||||
|
MOLECULAR_ASSEMBLERS_OFF,
|
||||||
TOGGLE_SHOW_FULL_INTERFACES_ON,
|
TOGGLE_SHOW_FULL_INTERFACES_ON,
|
||||||
TOGGLE_SHOW_FULL_INTERFACES_OFF,
|
TOGGLE_SHOW_FULL_INTERFACES_OFF,
|
||||||
HIGHLIGHT_INTERFACE
|
TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON,
|
||||||
}
|
TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF,
|
||||||
|
HIGHLIGHT_INTERFACE,
|
||||||
|
CONFIGURE_INTERFACE
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package appeng.api.config;
|
||||||
|
|
||||||
|
public enum LockCraftingMode {
|
||||||
|
/**
|
||||||
|
* Crafting is never locked.
|
||||||
|
*/
|
||||||
|
NONE,
|
||||||
|
/**
|
||||||
|
* After pushing a pattern to an adjacent machine, the interface will not accept further crafts until a
|
||||||
|
* redstone pulse is received.
|
||||||
|
*/
|
||||||
|
LOCK_UNTIL_PULSE,
|
||||||
|
/**
|
||||||
|
* Crafting is locked while the interface is receiving a redstone signal.
|
||||||
|
*/
|
||||||
|
LOCK_WHILE_HIGH,
|
||||||
|
/**
|
||||||
|
* Crafting is locked while the interface is not receiving a redstone signal.
|
||||||
|
*/
|
||||||
|
LOCK_WHILE_LOW,
|
||||||
|
/**
|
||||||
|
* After pushing a pattern to an adjacent machine, the interface will not accept further crafts until the
|
||||||
|
* primary pattern result is returned to the network through the interface.
|
||||||
|
*/
|
||||||
|
LOCK_UNTIL_RESULT
|
||||||
|
}
|
||||||
@@ -57,6 +57,8 @@ public enum Settings
|
|||||||
|
|
||||||
IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
|
IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
|
||||||
|
|
||||||
|
UNLOCK(EnumSet.allOf(LockCraftingMode.class)),
|
||||||
|
|
||||||
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||||
|
|
||||||
OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
|
OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
|
||||||
@@ -81,7 +83,11 @@ public enum Settings
|
|||||||
|
|
||||||
PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
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;
|
private final EnumSet<? extends Enum<?>> values;
|
||||||
|
|
||||||
|
|||||||
@@ -24,16 +24,65 @@
|
|||||||
package appeng.api.config;
|
package appeng.api.config;
|
||||||
|
|
||||||
|
|
||||||
public enum TunnelType
|
import appeng.api.AEApi;
|
||||||
{
|
import appeng.api.definitions.IItemDefinition;
|
||||||
ME, // Network Tunnel
|
import appeng.api.definitions.IParts;
|
||||||
IC2_POWER, // EU Tunnel
|
import appeng.api.parts.IPartItem;
|
||||||
FE_POWER, // Forge Energy tunnel
|
import com.google.common.base.Preconditions;
|
||||||
GTEU_POWER, // Forge Energy tunnel
|
import net.minecraft.item.ItemStack;
|
||||||
REDSTONE, // Redstone Tunnel
|
import net.minecraftforge.common.util.EnumHelper;
|
||||||
FLUID, // Fluid Tunnel
|
|
||||||
ITEM, // Item Tunnel
|
import javax.annotation.Nonnull;
|
||||||
LIGHT, // Light Tunnel
|
import java.util.function.Function;
|
||||||
BUNDLED_REDSTONE, // Bundled Redstone Tunnel
|
import java.util.function.Supplier;
|
||||||
COMPUTER_MESSAGE // Computer Message Tunnel
|
|
||||||
|
public enum TunnelType {
|
||||||
|
ME(tryPartStack(IParts::p2PTunnelME)),
|
||||||
|
IC2_POWER(tryPartStack(IParts::p2PTunnelEU)),
|
||||||
|
FE_POWER(tryPartStack(IParts::p2PTunnelFE)),
|
||||||
|
GTEU_POWER(tryPartStack(IParts::p2PTunnelGTEU)),
|
||||||
|
REDSTONE(tryPartStack(IParts::p2PTunnelRedstone)),
|
||||||
|
FLUID(tryPartStack(IParts::p2PTunnelFE)),
|
||||||
|
ITEM(tryPartStack(IParts::p2PTunnelItems)),
|
||||||
|
LIGHT(tryPartStack(IParts::p2PTunnelLight));
|
||||||
|
|
||||||
|
private ItemStack partItemStack;
|
||||||
|
private Supplier<ItemStack> partItemStackSupplier;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
TunnelType() {
|
||||||
|
this.partItemStack = ItemStack.EMPTY;
|
||||||
|
this.partItemStackSupplier = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public facing.
|
||||||
|
TunnelType(ItemStack partItemStack) {
|
||||||
|
this.partItemStack = partItemStack;
|
||||||
|
this.partItemStackSupplier = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Work around things instantiating this class too early.
|
||||||
|
TunnelType(Supplier<ItemStack> supplier) {
|
||||||
|
this.partItemStack = null;
|
||||||
|
this.partItemStackSupplier = supplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Supplier<ItemStack> tryPartStack(Function<IParts, IItemDefinition> supplier) {
|
||||||
|
return () -> supplier.apply(AEApi.instance().definitions().parts()).maybeStack(1).orElse(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TunnelType registerTunnelType(@Nonnull String name, @Nonnull ItemStack partItemStack) {
|
||||||
|
Preconditions.checkArgument(partItemStack.isEmpty() || partItemStack.getItem() instanceof IPartItem<?>,
|
||||||
|
"Part item must be an instance of IPartItem");
|
||||||
|
|
||||||
|
return EnumHelper.addEnum(TunnelType.class, name, new Class[]{ItemStack.class}, partItemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getPartItemStack() {
|
||||||
|
if (this.partItemStackSupplier != null) {
|
||||||
|
this.partItemStack = this.partItemStackSupplier.get();
|
||||||
|
this.partItemStackSupplier = null;
|
||||||
|
}
|
||||||
|
return partItemStack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public enum Upgrades {
|
|||||||
REDSTONE(0),
|
REDSTONE(0),
|
||||||
CRAFTING(0),
|
CRAFTING(0),
|
||||||
MAGNET(0),
|
MAGNET(0),
|
||||||
|
STICKY(0),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Diamond Tier Upgrades.
|
* Diamond Tier Upgrades.
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public interface IItems {
|
|||||||
|
|
||||||
IItemDefinition wirelessPatternTerminal();
|
IItemDefinition wirelessPatternTerminal();
|
||||||
|
|
||||||
|
IItemDefinition wirelessInterfaceTerminal();
|
||||||
|
|
||||||
IItemDefinition wirelessFluidTerminal();
|
IItemDefinition wirelessFluidTerminal();
|
||||||
|
|
||||||
IItemDefinition biometricCard();
|
IItemDefinition biometricCard();
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ public interface IMaterials {
|
|||||||
|
|
||||||
IItemDefinition cardCrafting();
|
IItemDefinition cardCrafting();
|
||||||
|
|
||||||
|
IItemDefinition cardSticky();
|
||||||
|
|
||||||
IItemDefinition enderDust();
|
IItemDefinition enderDust();
|
||||||
|
|
||||||
IItemDefinition flour();
|
IItemDefinition flour();
|
||||||
|
|||||||
@@ -19,12 +19,11 @@
|
|||||||
package appeng.api.features;
|
package appeng.api.features;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import net.minecraft.item.ItemStack;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.List;
|
||||||
import net.minecraft.item.ItemStack;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,21 +56,35 @@ public interface IInscriberRecipe
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
ItemStack getOutput();
|
ItemStack getOutput();
|
||||||
|
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
List<ItemStack> getTopInputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the top optional
|
* gets the top optional
|
||||||
*
|
*
|
||||||
* @return item which is used top
|
* @return item which is used top
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@Nonnull
|
@Nonnull
|
||||||
Optional<ItemStack> getTopOptional();
|
default Optional<ItemStack> getTopOptional(){
|
||||||
|
return getTopInputs().isEmpty() ? Optional.empty() : Optional.of(getTopInputs().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
List<ItemStack> getBottomInputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the bottom optional
|
* gets the bottom optional
|
||||||
*
|
*
|
||||||
* @return item which is used bottom
|
* @return item which is used bottom
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@Nonnull
|
@Nonnull
|
||||||
Optional<ItemStack> getBottomOptional();
|
default Optional<ItemStack> getBottomOptional() {
|
||||||
|
return getBottomInputs().isEmpty() ? Optional.empty() : Optional.of(getBottomInputs().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* type of inscriber process
|
* type of inscriber process
|
||||||
|
|||||||
@@ -19,11 +19,11 @@
|
|||||||
package appeng.api.features;
|
package appeng.api.features;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.Collection;
|
||||||
import net.minecraft.item.ItemStack;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +66,7 @@ public interface IInscriberRecipeBuilder
|
|||||||
* @return currently used builder
|
* @return currently used builder
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
IInscriberRecipeBuilder withTopOptional( @Nonnull ItemStack topOptional );
|
IInscriberRecipeBuilder withTopOptional(@Nonnull Collection<ItemStack> topOptional );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an inscriber recipe with bot.
|
* Creates an inscriber recipe with bot.
|
||||||
@@ -77,7 +77,7 @@ public interface IInscriberRecipeBuilder
|
|||||||
* @return currently used builder
|
* @return currently used builder
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
IInscriberRecipeBuilder withBottomOptional( @Nonnull ItemStack bottomOptional );
|
IInscriberRecipeBuilder withBottomOptional( @Nonnull Collection<ItemStack> bottomOptional );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an inscriber recipe with type.
|
* Creates an inscriber recipe with type.
|
||||||
@@ -104,4 +104,14 @@ public interface IInscriberRecipeBuilder
|
|||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
IInscriberRecipe build();
|
IInscriberRecipe build();
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
default IInscriberRecipeBuilder withTopOptional(@Nonnull ItemStack topOptional){
|
||||||
|
return withTopOptional(Collections.singleton(topOptional));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
default IInscriberRecipeBuilder withBottomOptional(@Nonnull ItemStack bottomOptional){
|
||||||
|
return withBottomOptional(Collections.singleton(bottomOptional));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,13 +24,12 @@
|
|||||||
package appeng.api.features;
|
package appeng.api.features;
|
||||||
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.config.TunnelType;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
|
||||||
import appeng.api.config.TunnelType;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +58,8 @@ public interface IP2PTunnelRegistry
|
|||||||
*
|
*
|
||||||
* @return null if no attunement can be found or attunement
|
* @return null if no attunement can be found or attunement
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nullable
|
||||||
TunnelType getTunnelTypeByItem( ItemStack trigger );
|
TunnelType getTunnelTypeByItem( ItemStack trigger );
|
||||||
|
|
||||||
|
TunnelType registerTunnelType( @Nonnull String enumName, @Nonnull ItemStack partStack );
|
||||||
}
|
}
|
||||||
@@ -40,11 +40,13 @@ public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable
|
|||||||
/**
|
/**
|
||||||
* 0 - cell is missing.
|
* 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
|
* @param slot slot index
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -77,6 +77,14 @@ public interface ICraftingPatternDetails
|
|||||||
*/
|
*/
|
||||||
IAEItemStack[] getCondensedOutputs();
|
IAEItemStack[] getCondensedOutputs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary output of this pattern. The pattern will only be used to craft the primary output; the others are
|
||||||
|
* just byproducts.
|
||||||
|
*/
|
||||||
|
default IAEItemStack getPrimaryOutput() {
|
||||||
|
return getOutputs()[0];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of the outputs, will include nulls.
|
* @return a list of the outputs, will include nulls.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ import appeng.api.util.AEPartLocation;
|
|||||||
public interface IFacadeContainer
|
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.
|
* Attempts to add the {@link IFacadePart} to the given side.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
package appeng.api.parts;
|
package appeng.api.parts;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.api.util.AEPartLocation;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
@@ -32,35 +33,11 @@ import net.minecraft.util.EnumHand;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
public interface IPartHelper
|
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
|
* use in use item, to try and place a IBusItem
|
||||||
@@ -79,4 +56,51 @@ public interface IPartHelper
|
|||||||
* @return the render mode
|
* @return the render mode
|
||||||
*/
|
*/
|
||||||
CableRenderMode getCableRenderMode();
|
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 );
|
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.
|
* can be used by parts to trigger the tile or part to save.
|
||||||
*/
|
*/
|
||||||
void markForSave();
|
void markForSave();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* part of the {@link LayerBase}
|
* called when parts are added or removed
|
||||||
*/
|
*/
|
||||||
void partChanged();
|
void partChanged();
|
||||||
|
|
||||||
@@ -169,11 +180,6 @@ public interface IPartHost extends ICustomCableConnection
|
|||||||
*/
|
*/
|
||||||
boolean isEmpty();
|
boolean isEmpty();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return a mutable list of flags you can adjust to track state.
|
|
||||||
*/
|
|
||||||
Set<LayerFlags> getLayerFlags();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove host from world...
|
* remove host from world...
|
||||||
*/
|
*/
|
||||||
@@ -191,4 +197,4 @@ public interface IPartHost extends ICustomCableConnection
|
|||||||
*/
|
*/
|
||||||
boolean isInWorld();
|
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 )
|
* 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.
|
* @return get the status of the cell based on its contents.
|
||||||
*/
|
*/
|
||||||
int getStatusForCell();
|
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.
|
* @return true, if this inventory is valid for this pass.
|
||||||
*/
|
*/
|
||||||
boolean validForPass( int i );
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,77 +11,77 @@ import net.minecraft.inventory.Slot;
|
|||||||
* or the MouseTweaksDisableWheelTweak annotations.
|
* or the MouseTweaksDisableWheelTweak annotations.
|
||||||
*/
|
*/
|
||||||
public interface IMTModGuiContainer2 {
|
public interface IMTModGuiContainer2 {
|
||||||
/**
|
/**
|
||||||
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
|
* 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.
|
* @return True if Mouse Tweaks should be disabled, false otherwise.
|
||||||
*/
|
*/
|
||||||
boolean MT_isMouseTweaksDisabled();
|
boolean MT_isMouseTweaksDisabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
|
* 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.
|
* @return True if the Wheel Tweak should be disabled, false otherwise.
|
||||||
*/
|
*/
|
||||||
boolean MT_isWheelTweakDisabled();
|
boolean MT_isWheelTweakDisabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Container.
|
* Returns the Container.
|
||||||
*
|
*
|
||||||
* @return Container that is currently in use.
|
* @return Container that is currently in use.
|
||||||
*/
|
*/
|
||||||
Container MT_getContainer();
|
Container MT_getContainer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
|
* 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.
|
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
|
||||||
*/
|
*/
|
||||||
Slot MT_getSlotUnderMouse();
|
Slot MT_getSlotUnderMouse();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
|
* 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.
|
* 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
|
* @param slot the slot to check
|
||||||
* @return True if slot is a crafting output slot.
|
* @return True if slot is a crafting output slot.
|
||||||
*/
|
*/
|
||||||
boolean MT_isCraftingOutput(Slot 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
|
* 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.
|
* slots and the Destroy Item slot in the vanilla creative inventory.
|
||||||
*
|
*
|
||||||
* @param slot the slot to check
|
* @param slot the slot to check
|
||||||
* @return Tru if slot should be ignored by Mouse Tweaks.
|
* @return Tru if slot should be ignored by Mouse Tweaks.
|
||||||
*/
|
*/
|
||||||
boolean MT_isIgnored(Slot slot);
|
boolean MT_isIgnored(Slot slot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
|
* 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
|
* 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
|
* events are handled (although note these events are handled every game tick, which is far less frequent than every
|
||||||
* render tick).<br><br>
|
* render tick).<br><br>
|
||||||
*
|
* <p>
|
||||||
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
|
* 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
|
* 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>
|
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
|
||||||
*
|
* <p>
|
||||||
* For vanilla containers this method looks like this:
|
* For vanilla containers this method looks like this:
|
||||||
* <pre>
|
* <pre>
|
||||||
* this.ignoreMouseUp = true;
|
* this.ignoreMouseUp = true;
|
||||||
*
|
*
|
||||||
* if (this.dragSplitting) {
|
* if (this.dragSplitting) {
|
||||||
* if (this.dragSplittingButton == 1) {
|
* if (this.dragSplittingButton == 1) {
|
||||||
* this.dragSplitting = false;
|
* this.dragSplitting = false;
|
||||||
* return true;
|
* return true;
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* return false;
|
* return false;
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
|
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
|
||||||
*/
|
*/
|
||||||
boolean MT_disableRMBDraggingFunctionality();
|
boolean MT_disableRMBDraggingFunctionality();
|
||||||
}
|
}
|
||||||
@@ -307,13 +307,13 @@ public abstract class AEBaseBlock extends Block {
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
|
||||||
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
final int west_y = forward.getZOffset() * up.getYOffset() - forward.getXOffset() * up.getZOffset();
|
||||||
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
|
||||||
|
|
||||||
EnumFacing west = null;
|
EnumFacing west = null;
|
||||||
for (final EnumFacing dx : EnumFacing.VALUES) {
|
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;
|
west = dx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,12 +348,12 @@ public abstract class AEBaseBlock extends Block {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
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 + "]";
|
return this.getClass().getSimpleName() + "[" + regName + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getUnlocalizedName(final ItemStack is) {
|
protected String getTranslationKey(final ItemStack is) {
|
||||||
return this.getUnlocalizedName();
|
return this.getTranslationKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasCustomRotation() {
|
protected boolean hasCustomRotation() {
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import net.minecraft.util.math.MathHelper;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -77,8 +78,9 @@ public class AEBaseItemBlock extends ItemBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(final ItemStack is) {
|
@NotNull
|
||||||
return this.blockType.getUnlocalizedName(is);
|
public String getTranslationKey(final ItemStack is) {
|
||||||
|
return this.blockType.getTranslationKey(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -137,7 +139,7 @@ public class AEBaseItemBlock extends ItemBlock {
|
|||||||
ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos);
|
ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos);
|
||||||
up = side;
|
up = side;
|
||||||
forward = EnumFacing.SOUTH;
|
forward = EnumFacing.SOUTH;
|
||||||
if (up.getFrontOffsetY() == 0) {
|
if (up.getYOffset() == 0) {
|
||||||
forward = EnumFacing.UP;
|
forward = EnumFacing.UP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,10 @@ package appeng.block;
|
|||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerUnits;
|
|
||||||
import appeng.api.definitions.IBlockDefinition;
|
import appeng.api.definitions.IBlockDefinition;
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
import appeng.core.Api;
|
import appeng.core.Api;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.Tooltips;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
@@ -35,7 +34,6 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@@ -57,10 +55,7 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
|
|||||||
internalCurrentPower = tag.getDouble("internalCurrentPower");
|
internalCurrentPower = tag.getDouble("internalCurrentPower");
|
||||||
}
|
}
|
||||||
|
|
||||||
final double percent = internalCurrentPower / internalMaxPower;
|
lines.add(Tooltips.energyStorageComponent(internalCurrentPower, internalMaxPower).getFormattedText());
|
||||||
|
|
||||||
lines.add(GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower) + Platform
|
|
||||||
.gui_localize(PowerUnits.AE.unlocalizedName) + " - " + MessageFormat.format(" {0,number,#.##%} ", percent));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,16 +36,16 @@ public abstract class AEBaseStairBlock extends BlockStairs {
|
|||||||
super(block.getDefaultState());
|
super(block.getDefaultState());
|
||||||
|
|
||||||
Preconditions.checkNotNull(block);
|
Preconditions.checkNotNull(block);
|
||||||
Preconditions.checkNotNull(block.getUnlocalizedName());
|
Preconditions.checkNotNull(block.getTranslationKey());
|
||||||
Preconditions.checkArgument(block.getUnlocalizedName().length() > 0);
|
Preconditions.checkArgument(block.getTranslationKey().length() > 0);
|
||||||
|
|
||||||
this.setUnlocalizedName("stair." + type);
|
this.setTranslationKey("stair." + type);
|
||||||
this.setLightOpacity(0);
|
this.setLightOpacity(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
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 + "]";
|
return this.getClass().getSimpleName() + "[" + regName + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String name = this.getUnlocalizedName();
|
final String name = this.getTranslationKey();
|
||||||
|
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
final NBTTagCompound data = tileEntity.downloadSettings(SettingsFrom.MEMORY_CARD);
|
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 String savedName = memoryCard.getSettingsName(heldItem);
|
||||||
final NBTTagCompound data = memoryCard.getData(heldItem);
|
final NBTTagCompound data = memoryCard.getData(heldItem);
|
||||||
|
|
||||||
if (this.getUnlocalizedName().equals(savedName)) {
|
if (this.getTranslationKey().equals(savedName)) {
|
||||||
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
|
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
|||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
|
||||||
@@ -111,7 +112,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public class BlockMolecularAssembler extends AEBaseTileBlock {
|
public class BlockMolecularAssembler extends AEBaseTileBlock {
|
||||||
|
|
||||||
@@ -72,7 +74,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock {
|
|||||||
*/
|
*/
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,15 +121,15 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision {
|
|||||||
final EnumFacing forward = tile.getForward();
|
final EnumFacing forward = tile.getForward();
|
||||||
final AEAxisAlignedBB bb = new AEAxisAlignedBB(twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels);
|
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.minX = 0;
|
||||||
bb.maxX = 1;
|
bb.maxX = 1;
|
||||||
}
|
}
|
||||||
if (up.getFrontOffsetY() != 0) {
|
if (up.getYOffset() != 0) {
|
||||||
bb.minY = 0;
|
bb.minY = 0;
|
||||||
bb.maxY = 1;
|
bb.maxY = 1;
|
||||||
}
|
}
|
||||||
if (up.getFrontOffsetZ() != 0) {
|
if (up.getZOffset() != 0) {
|
||||||
bb.minZ = 0;
|
bb.minZ = 0;
|
||||||
bb.maxZ = 1;
|
bb.maxZ = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class BlockInscriber extends AEBaseTileBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(final ItemStack is) {
|
public String getTranslationKey(final ItemStack is) {
|
||||||
return super.getUnlocalizedName(is);
|
return super.getTranslationKey(is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,14 @@ import appeng.block.AEBaseTileBlock;
|
|||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.tile.misc.TileInterface;
|
import appeng.tile.misc.TileInterface;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -93,4 +95,12 @@ public class BlockInterface extends AEBaseTileBlock {
|
|||||||
((TileInterface) rotatable).setSide(axis);
|
((TileInterface) rotatable).setSide(axis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||||
|
TileEntity tileEntity = this.getTileEntity(worldIn, pos);
|
||||||
|
if (tileEntity != null) {
|
||||||
|
((TileInterface) tileEntity).updateRedstoneState();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -115,9 +116,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
|||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
|
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 EnumFacing up = this.getOrientable(w, pos).getUp();
|
||||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
final double xOff = -0.3 * up.getXOffset();
|
||||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
final double yOff = -0.3 * up.getYOffset();
|
||||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
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));
|
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
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -107,9 +108,9 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
|||||||
@Override
|
@Override
|
||||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity e, final boolean isVisual) {
|
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 EnumFacing up = this.getOrientable(w, pos).getUp();
|
||||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
final double xOff = -0.3 * up.getXOffset();
|
||||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
final double yOff = -0.3 * up.getYOffset();
|
||||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
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));
|
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 EnumFacing up = this.getOrientable(w, pos).getUp();
|
||||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
final double xOff = -0.3 * up.getXOffset();
|
||||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
final double yOff = -0.3 * up.getYOffset();
|
||||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
final double zOff = -0.3 * up.getZOffset();
|
||||||
for (int bolts = 0; bolts < 3; bolts++) {
|
for (int bolts = 0; bolts < 3; bolts++) {
|
||||||
if (AppEng.proxy.shouldAddParticles(r)) {
|
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);
|
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
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
|||||||
double ry = 0.5 + pos.getY();
|
double ry = 0.5 + pos.getY();
|
||||||
double rz = 0.5 + pos.getZ();
|
double rz = 0.5 + pos.getZ();
|
||||||
|
|
||||||
rx += up.getFrontOffsetX() * d0;
|
rx += up.getXOffset() * d0;
|
||||||
ry += up.getFrontOffsetY() * d0;
|
ry += up.getYOffset() * d0;
|
||||||
rz += up.getFrontOffsetZ() * d0;
|
rz += up.getZOffset() * d0;
|
||||||
|
|
||||||
final int x = pos.getX();
|
final int x = pos.getX();
|
||||||
final int y = pos.getY();
|
final int y = pos.getY();
|
||||||
@@ -103,25 +103,25 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
|||||||
case 0:
|
case 0:
|
||||||
dx = 0.6;
|
dx = 0.6;
|
||||||
dz = d1;
|
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;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
dx = d1;
|
dx = d1;
|
||||||
dz += 0.6;
|
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;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
dx = d1;
|
dx = d1;
|
||||||
dz = -0.6;
|
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;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
dx = -0.6;
|
dx = -0.6;
|
||||||
dz = d1;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
@@ -130,13 +130,13 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rx += dx * west.getFrontOffsetX();
|
rx += dx * west.getXOffset();
|
||||||
ry += dx * west.getFrontOffsetY();
|
ry += dx * west.getYOffset();
|
||||||
rz += dx * west.getFrontOffsetZ();
|
rz += dx * west.getZOffset();
|
||||||
|
|
||||||
rx += dz * forward.getFrontOffsetX();
|
rx += dz * forward.getXOffset();
|
||||||
ry += dz * forward.getFrontOffsetY();
|
ry += dz * forward.getYOffset();
|
||||||
rz += dz * forward.getFrontOffsetZ();
|
rz += dz * forward.getZOffset();
|
||||||
|
|
||||||
final LightningFX fx = new LightningFX(w, rx, ry, rz, 0.0D, 0.0D, 0.0D);
|
final LightningFX fx = new LightningFX(w, rx, ry, rz, 0.0D, 0.0D, 0.0D);
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ public class BlockSecurityStation extends AEBaseTileBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
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);
|
this.startFuse(world, pos, null);
|
||||||
world.setBlockToAir(pos);
|
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) {
|
public void onBlockAdded(final World w, final BlockPos pos, final IBlockState state) {
|
||||||
super.onBlockAdded(w, pos, state);
|
super.onBlockAdded(w, pos, state);
|
||||||
|
|
||||||
if (w.isBlockIndirectlyGettingPowered(pos) > 0) {
|
if (w.getRedstonePowerFromNeighbors(pos) > 0) {
|
||||||
this.startFuse(w, pos, null);
|
this.startFuse(w, pos, null);
|
||||||
w.setBlockToAir(pos);
|
w.setBlockToAir(pos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,20 +102,20 @@ public final class BlockVibrationChamber extends AEBaseTileBlock {
|
|||||||
final EnumFacing forward = tc.getForward();
|
final EnumFacing forward = tc.getForward();
|
||||||
final EnumFacing up = tc.getUp();
|
final EnumFacing up = tc.getUp();
|
||||||
|
|
||||||
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
|
||||||
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
|
||||||
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
|
||||||
|
|
||||||
f1 += forward.getFrontOffsetX() * 0.6;
|
f1 += forward.getXOffset() * 0.6;
|
||||||
f2 += forward.getFrontOffsetY() * 0.6;
|
f2 += forward.getYOffset() * 0.6;
|
||||||
f3 += forward.getFrontOffsetZ() * 0.6;
|
f3 += forward.getZOffset() * 0.6;
|
||||||
|
|
||||||
final float ox = r.nextFloat();
|
final float ox = r.nextFloat();
|
||||||
final float oy = r.nextFloat() * 0.2f;
|
final float oy = r.nextFloat() * 0.2f;
|
||||||
|
|
||||||
f1 += up.getFrontOffsetX() * (-0.3 + oy);
|
f1 += up.getXOffset() * (-0.3 + oy);
|
||||||
f2 += up.getFrontOffsetY() * (-0.3 + oy);
|
f2 += up.getYOffset() * (-0.3 + oy);
|
||||||
f3 += up.getFrontOffsetZ() * (-0.3 + oy);
|
f3 += up.getZOffset() * (-0.3 + oy);
|
||||||
|
|
||||||
f1 += west_x * (0.3 * ox - 0.15);
|
f1 += west_x * (0.3 * ox - 0.15);
|
||||||
f2 += west_y * (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.UnlistedProperty;
|
||||||
import appeng.client.render.cablebus.CableBusBakedModel;
|
import appeng.client.render.cablebus.CableBusBakedModel;
|
||||||
import appeng.client.render.cablebus.CableBusRenderState;
|
import appeng.client.render.cablebus.CableBusRenderState;
|
||||||
import appeng.core.Api;
|
import appeng.client.render.cablebus.FacadeRenderState;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketCableBusLandingParticle;
|
||||||
import appeng.core.sync.packets.PacketClick;
|
import appeng.core.sync.packets.PacketClick;
|
||||||
import appeng.helpers.AEGlassMaterial;
|
import appeng.helpers.AEGlassMaterial;
|
||||||
import appeng.integration.abstraction.IAEFacade;
|
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.util.math.Vec3d;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
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.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
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 final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||||
|
|
||||||
private static Class<? extends AEBaseTile> noTesrTile;
|
|
||||||
|
|
||||||
private static Class<? extends AEBaseTile> tesrTile;
|
|
||||||
|
|
||||||
public BlockCableBus() {
|
public BlockCableBus() {
|
||||||
super(AEGlassMaterial.INSTANCE);
|
super(AEGlassMaterial.INSTANCE);
|
||||||
this.setLightOpacity(0);
|
this.setLightOpacity(0);
|
||||||
@@ -152,7 +151,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
this.cb(w, pos).onEntityCollision(entityIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,6 +302,90 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
|||||||
return true;
|
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
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||||
if (Platform.isServer()) {
|
if (Platform.isServer()) {
|
||||||
@@ -378,10 +461,9 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setupTile() {
|
public void setupTile() {
|
||||||
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance(TileCableBus.class);
|
this.setTileEntity(TileCableBus.class);
|
||||||
this.setTileEntity(noTesrTile);
|
|
||||||
|
|
||||||
GameRegistry.registerTileEntity(noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
|
GameRegistry.registerTileEntity(TileCableBus.class, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
|
||||||
|
|
||||||
if (Platform.isClient()) {
|
if (Platform.isClient()) {
|
||||||
setupTesr();
|
setupTesr();
|
||||||
@@ -390,9 +472,8 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
|||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private static void setupTesr() {
|
private static void setupTesr() {
|
||||||
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance(TileCableBusTESR.class);
|
GameRegistry.registerTileEntity(TileCableBusTESR.class, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
|
||||||
GameRegistry.registerTileEntity(tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
|
ClientRegistry.bindTileEntitySpecialRenderer(TileCableBusTESR.class, new CableBusTESR());
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(BlockCableBus.getTesrTile(), new CableBusTESR());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -438,14 +519,6 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
|||||||
super.onEntityWalk(world, pos, entityIn);
|
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
|
// Helper to get access to the protected constructor
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private static class DestroyFX extends ParticleDigging {
|
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.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public class BlockController extends AEBaseTileBlock {
|
public class BlockController extends AEBaseTileBlock {
|
||||||
|
|
||||||
@@ -144,7 +146,7 @@ public class BlockController extends AEBaseTileBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
|||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -81,7 +82,7 @@ public class BlockPaint extends AEBaseTileBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
|||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision {
|
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision {
|
||||||
|
|
||||||
@@ -86,7 +88,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,9 +105,9 @@ class QnbFormedBakedModel implements IBakedModel {
|
|||||||
for (EnumFacing facing : EnumFacing.values()) {
|
for (EnumFacing facing : EnumFacing.values()) {
|
||||||
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
||||||
// (avoids z-fighting)
|
// (avoids z-fighting)
|
||||||
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f);
|
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
|
||||||
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f);
|
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
|
||||||
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f);
|
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
|
||||||
|
|
||||||
builder.setDrawFaces(EnumSet.of(facing));
|
builder.setDrawFaces(EnumSet.of(facing));
|
||||||
builder.addCube(
|
builder.addCube(
|
||||||
@@ -130,9 +130,9 @@ class QnbFormedBakedModel implements IBakedModel {
|
|||||||
for (EnumFacing facing : EnumFacing.values()) {
|
for (EnumFacing facing : EnumFacing.values()) {
|
||||||
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
|
||||||
// (avoids z-fighting)
|
// (avoids z-fighting)
|
||||||
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f);
|
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
|
||||||
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f);
|
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
|
||||||
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f);
|
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
|
||||||
|
|
||||||
builder.setDrawFaces(EnumSet.of(facing));
|
builder.setDrawFaces(EnumSet.of(facing));
|
||||||
builder.addCube(
|
builder.addCube(
|
||||||
|
|||||||
@@ -26,12 +26,15 @@ import appeng.tile.spatial.TileSpatialIOPort;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
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.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@@ -39,8 +42,11 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
public class BlockSpatialIOPort extends AEBaseTileBlock {
|
public class BlockSpatialIOPort extends AEBaseTileBlock {
|
||||||
|
|
||||||
|
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||||
|
|
||||||
public BlockSpatialIOPort() {
|
public BlockSpatialIOPort() {
|
||||||
super(Material.IRON);
|
super(Material.IRON);
|
||||||
|
setDefaultState(getDefaultState().withProperty(POWERED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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) {
|
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()) {
|
if (p.isSneaking()) {
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
|||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public class BlockSpatialPylon extends AEBaseTileBlock {
|
public class BlockSpatialPylon extends AEBaseTileBlock {
|
||||||
|
|
||||||
@@ -83,7 +85,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ public class BlockChest extends AEBaseTileBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
|||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ public class BlockDrive extends AEBaseTileBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer() {
|
public BlockRenderLayer getRenderLayer() {
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package appeng.block.storage;
|
package appeng.block.storage;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.api.config.Upgrades;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.block.AEBaseTileBlock;
|
import appeng.block.AEBaseTileBlock;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
@@ -26,12 +27,15 @@ import appeng.tile.storage.TileIOPort;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
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.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@@ -39,15 +43,34 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
public class BlockIOPort extends AEBaseTileBlock {
|
public class BlockIOPort extends AEBaseTileBlock {
|
||||||
|
|
||||||
|
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||||
|
|
||||||
public BlockIOPort() {
|
public BlockIOPort() {
|
||||||
super(Material.IRON);
|
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
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||||
final TileIOPort te = this.getTileEntity(world, pos);
|
final TileIOPort te = this.getTileEntity(world, pos);
|
||||||
if (te != null) {
|
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.tile.storage.TileSkyChest;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import net.minecraft.block.material.Material;
|
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.block.state.IBlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
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_SIDES = 0.06;
|
||||||
private static final double AABB_OFFSET_TOP = 0.125;
|
private static final double AABB_OFFSET_TOP = 0.125;
|
||||||
|
|
||||||
|
public static final PropertyBool NATURAL = PropertyBool.create("natural");
|
||||||
|
|
||||||
public enum SkyChestType {
|
public enum SkyChestType {
|
||||||
STONE, BLOCK
|
STONE, BLOCK
|
||||||
}
|
}
|
||||||
@@ -61,6 +65,22 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
|
|||||||
this.setHardness(50);
|
this.setHardness(50);
|
||||||
this.blockResistance = 150.0f;
|
this.blockResistance = 150.0f;
|
||||||
this.type = type;
|
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
|
@Override
|
||||||
@@ -99,18 +119,18 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
|
|||||||
o = sk.getUp();
|
o = sk.getUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
final double offsetX = o.getXOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||||
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
final double offsetY = o.getYOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||||
final double offsetZ = o.getFrontOffsetZ() == 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
|
// 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 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.getFrontOffsetY() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetY() * AABB_OFFSET_BOTTOM)));
|
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.getFrontOffsetZ() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetZ() * AABB_OFFSET_TOP)));
|
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 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.getFrontOffsetY() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetY() * AABB_OFFSET_TOP)));
|
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.getFrontOffsetZ() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetZ() * AABB_OFFSET_BOTTOM)));
|
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);
|
return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,10 @@ public enum DriveSlotState implements IStringSerializable {
|
|||||||
TYPES_FULL("types_full"),
|
TYPES_FULL("types_full"),
|
||||||
|
|
||||||
// Completely full
|
// Completely full
|
||||||
FULL("full");
|
FULL("full"),
|
||||||
|
|
||||||
|
// Online and completely empty
|
||||||
|
NO_CONTENTS("no_contents");
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
@@ -64,6 +67,8 @@ public enum DriveSlotState implements IStringSerializable {
|
|||||||
return DriveSlotState.TYPES_FULL;
|
return DriveSlotState.TYPES_FULL;
|
||||||
case 3:
|
case 3:
|
||||||
return DriveSlotState.FULL;
|
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
|
// Create block and matching item, and set factory name of both
|
||||||
Block block = this.blockSupplier.get();
|
Block block = this.blockSupplier.get();
|
||||||
block.setRegistryName(AppEng.MOD_ID, this.registryName);
|
block.setRegistryName(AppEng.MOD_ID, this.registryName);
|
||||||
block.setUnlocalizedName("appliedenergistics2." + this.registryName);
|
block.setTranslationKey("appliedenergistics2." + this.registryName);
|
||||||
|
|
||||||
ItemBlock item = this.constructItemFromBlock(block);
|
ItemBlock item = this.constructItemFromBlock(block);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
|||||||
@@ -116,11 +116,11 @@ class BlockRendering implements IBlockRendering, ISelectiveResourceReloadListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.modelCustomizer != null) {
|
if (this.modelCustomizer != null) {
|
||||||
factory.addModelOverride(block.getRegistryName().getResourcePath(), this.modelCustomizer);
|
factory.addModelOverride(block.getRegistryName().getPath(), this.modelCustomizer);
|
||||||
} else if (block instanceof AEBaseTileBlock) {
|
} 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
|
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||||
// extended props
|
// extended props
|
||||||
factory.addModelOverride(block.getRegistryName().getResourcePath(), (l, m) -> {
|
factory.addModelOverride(block.getRegistryName().getPath(), (l, m) -> {
|
||||||
AutoRotatingModel model = new AutoRotatingModel(m);
|
AutoRotatingModel model = new AutoRotatingModel(m);
|
||||||
BlockRendering.this.reloads.add(model);
|
BlockRendering.this.reloads.add(model);
|
||||||
return model;
|
return model;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class ItemDefinitionBuilder implements IItemBuilder {
|
|||||||
|
|
||||||
ItemDefinition definition = new ItemDefinition(this.registryName, item);
|
ItemDefinition definition = new ItemDefinition(this.registryName, item);
|
||||||
|
|
||||||
item.setUnlocalizedName("appliedenergistics2." + this.registryName);
|
item.setTranslationKey("appliedenergistics2." + this.registryName);
|
||||||
item.setCreativeTab(this.creativeTab);
|
item.setCreativeTab(this.creativeTab);
|
||||||
|
|
||||||
// Register all extra handlers
|
// Register all extra handlers
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
|
|||||||
IModel missingModel = ModelLoaderRegistry.getMissingModel();
|
IModel missingModel = ModelLoaderRegistry.getMissingModel();
|
||||||
|
|
||||||
for (ModelResourceLocation location : keys) {
|
for (ModelResourceLocation location : keys) {
|
||||||
if (!location.getResourceDomain().equals(AppEng.MOD_ID)) {
|
if (!location.getNamespace().equals(AppEng.MOD_ID)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getResourcePath());
|
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getPath());
|
||||||
if (customizer != null) {
|
if (customizer != null) {
|
||||||
IBakedModel newModel = customizer.apply(location, orgModel);
|
IBakedModel newModel = customizer.apply(location, orgModel);
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ import appeng.helpers.IMouseWheelItem;
|
|||||||
import appeng.hooks.TickHandler;
|
import appeng.hooks.TickHandler;
|
||||||
import appeng.hooks.TickHandler.PlayerColor;
|
import appeng.hooks.TickHandler.PlayerColor;
|
||||||
import appeng.items.tools.powered.Terminal;
|
import appeng.items.tools.powered.Terminal;
|
||||||
import appeng.items.tools.powered.ToolWirelessTerminal;
|
|
||||||
import appeng.server.ServerHelper;
|
import appeng.server.ServerHelper;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -62,8 +61,6 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.*;
|
import net.minecraftforge.client.event.*;
|
||||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
import net.minecraftforge.client.settings.KeyConflictContext;
|
|
||||||
import net.minecraftforge.client.settings.KeyModifier;
|
|
||||||
import net.minecraftforge.common.ForgeModContainer;
|
import net.minecraftforge.common.ForgeModContainer;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||||
@@ -72,21 +69,12 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
|||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import static appeng.client.KeyBindings.WCT;
|
import static appeng.client.KeyBindings.*;
|
||||||
import static appeng.client.KeyBindings.WFT;
|
|
||||||
import static appeng.client.KeyBindings.WPT;
|
|
||||||
import static appeng.client.KeyBindings.WT;
|
|
||||||
|
|
||||||
|
|
||||||
public class ClientHelper extends ServerHelper {
|
public class ClientHelper extends ServerHelper {
|
||||||
@@ -352,6 +340,8 @@ public class ClientHelper extends ServerHelper {
|
|||||||
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_PATTERN_TERMINAL));
|
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_PATTERN_TERMINAL));
|
||||||
} else if (k == WFT.getKeyBinding()) {
|
} else if (k == WFT.getKeyBinding()) {
|
||||||
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_FLUID_TERMINAL));
|
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_FLUID_TERMINAL));
|
||||||
|
} else if (k == WIT.getKeyBinding()) {
|
||||||
|
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_INTERFACE_TERMINAL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -372,4 +362,16 @@ public class ClientHelper extends ServerHelper {
|
|||||||
public boolean isActionKey(ActionKey key, int pressedKeyCode) {
|
public boolean isActionKey(ActionKey key, int pressedKeyCode) {
|
||||||
return this.bindings.get(key).isActiveAndMatches(pressedKeyCode);
|
return this.bindings.get(key).isActiveAndMatches(pressedKeyCode);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public EntityPlayer getPlayerByUUID(UUID uuid) {
|
||||||
|
if (Platform.isClient()) {
|
||||||
|
if (Minecraft.getMinecraft().player.getUniqueID().equals(uuid)) {
|
||||||
|
return Minecraft.getMinecraft().player;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return super.getPlayerByUUID(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ public enum KeyBindings {
|
|||||||
WT(new KeyBinding("key.open_wireless_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_T, KEY_CATEGORY)),
|
WT(new KeyBinding("key.open_wireless_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_T, KEY_CATEGORY)),
|
||||||
WCT(new KeyBinding("key.open_wireless_crafting_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_E, KEY_CATEGORY)),
|
WCT(new KeyBinding("key.open_wireless_crafting_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_E, KEY_CATEGORY)),
|
||||||
WPT(new KeyBinding("key.open_wireless_pattern_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_R, KEY_CATEGORY)),
|
WPT(new KeyBinding("key.open_wireless_pattern_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_R, KEY_CATEGORY)),
|
||||||
WFT(new KeyBinding("key.open_wireless_fluid_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_F, KEY_CATEGORY));
|
WFT(new KeyBinding("key.open_wireless_fluid_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_F, KEY_CATEGORY)),
|
||||||
|
WIT(new KeyBinding("key.open_wireless_interface_terminal.desc",KeyConflictContext.UNIVERSAL,KeyModifier.SHIFT,Keyboard.KEY_I,KEY_CATEGORY));
|
||||||
|
|
||||||
private KeyBinding keyBinding;
|
private KeyBinding keyBinding;
|
||||||
|
|
||||||
|
|||||||
@@ -69,13 +69,11 @@ import net.minecraftforge.fluids.Fluid;
|
|||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
import net.minecraftforge.fml.common.Optional;
|
import net.minecraftforge.fml.common.Optional;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import yalter.mousetweaks.api.IMTModGuiContainer2;
|
import yalter.mousetweaks.api.IMTModGuiContainer2;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@@ -87,7 +85,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import static appeng.integration.modules.jei.JEIPlugin.aeGuiHandler;
|
import static appeng.integration.modules.jei.JEIPlugin.aeGuiHandler;
|
||||||
import static appeng.integration.modules.jei.JEIPlugin.runtime;
|
import static appeng.integration.modules.jei.JEIPlugin.runtime;
|
||||||
|
|
||||||
|
|
||||||
@Optional.Interface(iface = "yalter.mousetweaks.api.IMTModGuiContainer2", modid = "mousetweaks")
|
@Optional.Interface(iface = "yalter.mousetweaks.api.IMTModGuiContainer2", modid = "mousetweaks")
|
||||||
public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContainer2 {
|
public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContainer2 {
|
||||||
private final List<InternalSlotME> meSlots = new ArrayList<>();
|
private final List<InternalSlotME> meSlots = new ArrayList<>();
|
||||||
@@ -186,6 +183,12 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
this.drawTooltip((ITooltip) c, mouseX, mouseY);
|
this.drawTooltip((ITooltip) c, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (final Object o : this.labelList) {
|
||||||
|
if (o instanceof ITooltip) {
|
||||||
|
this.drawTooltip((ITooltip) o, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
GlStateManager.enableDepth();
|
GlStateManager.enableDepth();
|
||||||
if (Platform.isModLoaded("jei")) {
|
if (Platform.isModLoaded("jei")) {
|
||||||
bookmarkedJEIghostItem(mouseX, mouseY);
|
bookmarkedJEIghostItem(mouseX, mouseY);
|
||||||
@@ -260,7 +263,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawTooltip(ITooltip tooltip, int mouseX, int mouseY) {
|
protected void drawTooltip(ITooltip tooltip, int mouseX, int mouseY) {
|
||||||
final int x = tooltip.xPos(); // ((GuiImgButton) c).x;
|
final int x = tooltip.xPos(); // ((GuiImgButton) c).x;
|
||||||
int y = tooltip.yPos(); // ((GuiImgButton) c).y;
|
int y = tooltip.yPos(); // ((GuiImgButton) c).y;
|
||||||
|
|
||||||
@@ -570,9 +573,9 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
stack = ((SlotME) slot).getAEStack();
|
stack = ((SlotME) slot).getAEStack();
|
||||||
|
|
||||||
if (stack != null
|
if (stack != null
|
||||||
&& action == InventoryAction.PICKUP_OR_SET_DOWN
|
&& action == InventoryAction.PICKUP_OR_SET_DOWN
|
||||||
&& (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown())
|
&& (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown())
|
||||||
&& player.inventory.getItemStack().isEmpty()) {
|
&& player.inventory.getItemStack().isEmpty()) {
|
||||||
action = InventoryAction.AUTO_CRAFT;
|
action = InventoryAction.AUTO_CRAFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -935,6 +938,10 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
}
|
}
|
||||||
} else if (s instanceof AppEngSlot) {
|
} else if (s instanceof AppEngSlot) {
|
||||||
AppEngSlot appEngSlot = ((AppEngSlot) s);
|
AppEngSlot appEngSlot = ((AppEngSlot) s);
|
||||||
|
if (s.getStack().isEmpty()) {
|
||||||
|
super.drawSlot(s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
appEngSlot.setDisplay(true);
|
appEngSlot.setDisplay(true);
|
||||||
appEngSlot.setReturnAsSingleStack(true);
|
appEngSlot.setReturnAsSingleStack(true);
|
||||||
|
|
||||||
@@ -948,10 +955,42 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
this.zLevel = 0.0F;
|
this.zLevel = 0.0F;
|
||||||
this.itemRender.zLevel = 0.0F;
|
this.itemRender.zLevel = 0.0F;
|
||||||
|
|
||||||
|
boolean wasDragSplitting = this.dragSplitting;
|
||||||
|
this.dragSplitting = false; // to prevent the vanilla slot renderer from rendering the stack count during drag splitting, we're re-enabling it later
|
||||||
|
|
||||||
// Annoying but easier than trying to splice into render item
|
// Annoying but easier than trying to splice into render item
|
||||||
super.drawSlot(s);
|
super.drawSlot(s);
|
||||||
|
|
||||||
this.stackSizeRenderer.renderStackSize(this.fontRenderer, AEItemStack.fromItemStack(appEngSlot.getDisplayStack()), s.xPos, s.yPos);
|
ItemStack stackInSlot = ((AppEngSlot)s).getDisplayStack();
|
||||||
|
ItemStack stackUnderCursor = this.mc.player.inventory.getItemStack();
|
||||||
|
|
||||||
|
if (wasDragSplitting
|
||||||
|
&& this.dragSplittingSlots.contains(s)
|
||||||
|
&& this.dragSplittingSlots.size() > 1
|
||||||
|
&& !stackUnderCursor.isEmpty()) {
|
||||||
|
if (Container.canAddItemToSlot(s, stackUnderCursor, true) && this.inventorySlots.canDragIntoSlot(s))
|
||||||
|
{
|
||||||
|
drawRect(s.xPos, s.yPos, s.xPos + 16, s.yPos + 16, -2130706433);
|
||||||
|
|
||||||
|
stackInSlot = stackUnderCursor.copy();
|
||||||
|
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, stackInSlot, s.getStack().isEmpty() ? 0 : s.getStack().getCount());
|
||||||
|
int k = Math.min(stackInSlot.getMaxStackSize(), s.getItemStackLimit(stackInSlot));
|
||||||
|
|
||||||
|
if (stackInSlot.getCount() > k)
|
||||||
|
{
|
||||||
|
stackInSlot.setCount(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.dragSplittingSlots.remove(s);
|
||||||
|
this.updateDragSplitting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dragSplitting = wasDragSplitting;
|
||||||
|
this.stackSizeRenderer.renderStackSize(this.fontRenderer, AEItemStack.fromItemStack(stackInSlot), s.xPos, s.yPos);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
super.drawSlot(s);
|
super.drawSlot(s);
|
||||||
@@ -987,6 +1026,40 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
return this.meSlots;
|
return this.meSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove this when refactoring slot rendering
|
||||||
|
private void updateDragSplitting()
|
||||||
|
{
|
||||||
|
ItemStack itemstack = this.mc.player.inventory.getItemStack();
|
||||||
|
|
||||||
|
if (!itemstack.isEmpty() && this.dragSplitting)
|
||||||
|
{
|
||||||
|
if (this.dragSplittingLimit == 2)
|
||||||
|
{
|
||||||
|
this.dragSplittingRemnant = itemstack.getMaxStackSize();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.dragSplittingRemnant = itemstack.getCount();
|
||||||
|
|
||||||
|
for (Slot slot : this.dragSplittingSlots)
|
||||||
|
{
|
||||||
|
ItemStack itemstack1 = itemstack.copy();
|
||||||
|
ItemStack itemstack2 = slot.getStack();
|
||||||
|
int i = itemstack2.isEmpty() ? 0 : itemstack2.getCount();
|
||||||
|
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack1, i);
|
||||||
|
int j = Math.min(itemstack1.getMaxStackSize(), slot.getItemStackLimit(itemstack1));
|
||||||
|
|
||||||
|
if (itemstack1.getCount() > j)
|
||||||
|
{
|
||||||
|
itemstack1.setCount(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dragSplittingRemnant -= itemstack1.getCount() - i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Optional.Method(modid = "mousetweaks")
|
@Optional.Method(modid = "mousetweaks")
|
||||||
public boolean MT_isMouseTweaksDisabled() {
|
public boolean MT_isMouseTweaksDisabled() {
|
||||||
@@ -1026,7 +1099,14 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
@Override
|
@Override
|
||||||
@Optional.Method(modid = "mousetweaks")
|
@Optional.Method(modid = "mousetweaks")
|
||||||
public boolean MT_disableRMBDraggingFunctionality() {
|
public boolean MT_disableRMBDraggingFunctionality() {
|
||||||
return false;
|
if (this.dragSplitting && this.dragSplittingButton == 1) {
|
||||||
|
this.dragSplitting = false;
|
||||||
|
// Don't ignoreMouseUp on slots that can't accept the item. (crafting output, ME slot, etc.)
|
||||||
|
if (this.getSlotUnderMouse() != null && this.getSlotUnderMouse().isItemValid(this.mc.player.inventory.getItemStack())) {
|
||||||
|
this.ignoreMouseUp = true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,21 @@
|
|||||||
package appeng.client.gui;
|
package appeng.client.gui;
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.client.gui.implementations.*;
|
import appeng.client.gui.implementations.GuiCraftAmount;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||||
|
import appeng.client.gui.implementations.GuiExpandedProcessingPatternTerm;
|
||||||
|
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||||
|
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||||
|
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||||
import appeng.container.interfaces.IJEIGhostIngredients;
|
import appeng.container.interfaces.IJEIGhostIngredients;
|
||||||
import appeng.container.slot.SlotFake;
|
import appeng.container.interfaces.ISpecialSlotIngredient;
|
||||||
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
|
import appeng.container.slot.IJEITargetSlot;
|
||||||
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
||||||
import mezz.jei.api.gui.IGhostIngredientHandler;
|
import mezz.jei.api.gui.IGhostIngredientHandler;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@@ -59,11 +67,39 @@ public class AEGuiHandler implements IAdvancedGuiHandler<AEBaseGui>, IGhostIngre
|
|||||||
if (guiContainer instanceof GuiCraftAmount) {
|
if (guiContainer instanceof GuiCraftAmount) {
|
||||||
if (guiContainer.getSlotUnderMouse() != null) {
|
if (guiContainer.getSlotUnderMouse() != null) {
|
||||||
result = guiContainer.getSlotUnderMouse().getStack();
|
result = guiContainer.getSlotUnderMouse().getStack();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Slot slot = guiContainer.getSlotUnderMouse();
|
||||||
|
if (slot instanceof ISpecialSlotIngredient ss) {
|
||||||
|
return ss.getIngredient();
|
||||||
|
}
|
||||||
|
for (GuiCustomSlot customSlot : guiContainer.guiSlots) {
|
||||||
|
if (this.checkSlotArea(guiContainer, customSlot, mouseX, mouseY)) {
|
||||||
|
return customSlot.getIngredient();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkSlotArea(GuiContainer gui, GuiCustomSlot slot, int mouseX, int mouseY) {
|
||||||
|
int i = gui.guiLeft;
|
||||||
|
int j = gui.guiTop;
|
||||||
|
mouseX = mouseX - i;
|
||||||
|
mouseY = mouseY - j;
|
||||||
|
return mouseX >= slot.xPos() - 1 &&
|
||||||
|
mouseX < slot.xPos() + slot.getWidth() + 1 &&
|
||||||
|
mouseY >= slot.yPos() - 1 &&
|
||||||
|
mouseY < slot.yPos() + slot.getHeight() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
private int getSlotidx(AEBaseGui guiContainer, int mouseX, int mouseY, int rows) {
|
private int getSlotidx(AEBaseGui guiContainer, int mouseX, int mouseY, int rows) {
|
||||||
int guileft = guiContainer.getGuiLeft();
|
int guileft = guiContainer.getGuiLeft();
|
||||||
int guitop = guiContainer.getGuiTop();
|
int guitop = guiContainer.getGuiTop();
|
||||||
@@ -78,12 +114,12 @@ public class AEGuiHandler implements IAdvancedGuiHandler<AEBaseGui>, IGhostIngre
|
|||||||
return (guiSloty * 3) + guiSlotx + (currentScroll * 3);
|
return (guiSloty * 3) + guiSlotx + (currentScroll * 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public <I> List<Target<I>> getTargets(@Nonnull AEBaseGui gui, @Nonnull I ingredient, boolean doStart) {
|
public <I> List<Target<I>> getTargets(@Nonnull AEBaseGui gui, @Nonnull I ingredient, boolean doStart) {
|
||||||
ArrayList<Target<I>> targets = new ArrayList<>();
|
ArrayList<Target<I>> targets = new ArrayList<>();
|
||||||
if (gui instanceof IJEIGhostIngredients) {
|
if (gui instanceof IJEIGhostIngredients g) {
|
||||||
IJEIGhostIngredients g = (IJEIGhostIngredients) gui;
|
|
||||||
List<Target<?>> phantomTargets = g.getPhantomTargets(ingredient);
|
List<Target<?>> phantomTargets = g.getPhantomTargets(ingredient);
|
||||||
targets.addAll((List<Target<I>>) (Object) phantomTargets);
|
targets.addAll((List<Target<I>>) (Object) phantomTargets);
|
||||||
}
|
}
|
||||||
@@ -91,13 +127,8 @@ public class AEGuiHandler implements IAdvancedGuiHandler<AEBaseGui>, IGhostIngre
|
|||||||
if (gui instanceof GuiUpgradeable || gui instanceof GuiPatternTerm || gui instanceof GuiExpandedProcessingPatternTerm) {
|
if (gui instanceof GuiUpgradeable || gui instanceof GuiPatternTerm || gui instanceof GuiExpandedProcessingPatternTerm) {
|
||||||
IJEIGhostIngredients ghostGui = ((IJEIGhostIngredients) gui);
|
IJEIGhostIngredients ghostGui = ((IJEIGhostIngredients) gui);
|
||||||
for (Target<I> target : targets) {
|
for (Target<I> target : targets) {
|
||||||
if (ghostGui.getFakeSlotTargetMap().get(target) instanceof SlotFake) {
|
if (ghostGui.getFakeSlotTargetMap().get(target) instanceof IJEITargetSlot jeiSlot) {
|
||||||
if (((SlotFake) ghostGui.getFakeSlotTargetMap().get(target)).getStack().isEmpty()) {
|
if (jeiSlot.needAccept()) {
|
||||||
target.accept(ingredient);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (ghostGui.getFakeSlotTargetMap().get(target) instanceof GuiFluidSlot) {
|
|
||||||
if (((GuiFluidSlot) ghostGui.getFakeSlotTargetMap().get(target)).getFluidStack() == null) {
|
|
||||||
target.accept(ingredient);
|
target.accept(ingredient);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.AEApi;
|
||||||
import appeng.api.definitions.IDefinitions;
|
import appeng.api.definitions.IDefinitions;
|
||||||
import appeng.api.definitions.IParts;
|
import appeng.api.definitions.IParts;
|
||||||
import appeng.api.features.IWirelessTermHandler;
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
import appeng.client.gui.widgets.GuiNumberBox;
|
import appeng.client.gui.MathExpressionParser;
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.implementations.ContainerCraftAmount;
|
import appeng.container.implementations.ContainerCraftAmount;
|
||||||
@@ -42,6 +41,7 @@ import appeng.parts.reporting.PartExpandedProcessingPatternTerminal;
|
|||||||
import appeng.parts.reporting.PartPatternTerminal;
|
import appeng.parts.reporting.PartPatternTerminal;
|
||||||
import appeng.parts.reporting.PartTerminal;
|
import appeng.parts.reporting.PartTerminal;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
@@ -50,7 +50,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
|
|
||||||
public class GuiCraftAmount extends AEBaseGui {
|
public class GuiCraftAmount extends AEBaseGui {
|
||||||
private GuiNumberBox amountToCraft;
|
private GuiTextField amountToCraft;
|
||||||
private GuiTabButton originalGuiBtn;
|
private GuiTabButton originalGuiBtn;
|
||||||
|
|
||||||
private GuiButton next;
|
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.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.setEnableBackgroundDrawing(false);
|
||||||
this.amountToCraft.setMaxStringLength(16);
|
this.amountToCraft.setMaxStringLength(16);
|
||||||
this.amountToCraft.setTextColor(0xFFFFFF);
|
this.amountToCraft.setTextColor(0xFFFFFF);
|
||||||
@@ -149,8 +149,17 @@ public class GuiCraftAmount extends AEBaseGui {
|
|||||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
long amt = Long.parseLong(this.amountToCraft.getText());
|
String out = this.amountToCraft.getText();
|
||||||
this.next.enabled = (!this.amountToCraft.getText().isEmpty() && amt > 0);
|
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) {
|
} catch (final NumberFormatException e) {
|
||||||
this.next.enabled = false;
|
this.next.enabled = false;
|
||||||
}
|
}
|
||||||
@@ -164,33 +173,7 @@ public class GuiCraftAmount extends AEBaseGui {
|
|||||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||||
this.actionPerformed(this.next);
|
this.actionPerformed(this.next);
|
||||||
}
|
}
|
||||||
if ((key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit(character)) && this.amountToCraft
|
if (!this.amountToCraft.textboxKeyTyped(character, key)) {
|
||||||
.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 {
|
|
||||||
super.keyTyped(character, key);
|
super.keyTyped(character, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +190,15 @@ public class GuiCraftAmount extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (btn == this.next) {
|
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) {
|
} catch (final NumberFormatException e) {
|
||||||
// nope..
|
// nope..
|
||||||
@@ -226,22 +217,15 @@ public class GuiCraftAmount extends AEBaseGui {
|
|||||||
try {
|
try {
|
||||||
String out = this.amountToCraft.getText();
|
String out = this.amountToCraft.getText();
|
||||||
|
|
||||||
boolean fixed = false;
|
double resultD = MathExpressionParser.parse(out);
|
||||||
while (out.startsWith("0") && out.length() > 1) {
|
int result;
|
||||||
out = out.substring(1);
|
|
||||||
fixed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fixed) {
|
if (resultD <= 0 || Double.isNaN(resultD)) {
|
||||||
this.amountToCraft.setText(out);
|
result = 0;
|
||||||
|
} else {
|
||||||
|
result = (int) MathExpressionParser.round(resultD, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out.isEmpty()) {
|
|
||||||
out = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
long result = Integer.parseInt(out);
|
|
||||||
|
|
||||||
if (result == 1 && i > 1) {
|
if (result == 1 && i > 1) {
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
@@ -251,8 +235,7 @@ public class GuiCraftAmount extends AEBaseGui {
|
|||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
out = Long.toString(result);
|
out = Integer.toString(result);
|
||||||
Integer.parseInt(out);
|
|
||||||
this.amountToCraft.setText(out);
|
this.amountToCraft.setText(out);
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
// :P
|
// :P
|
||||||
|
|||||||
+5
-3
@@ -394,7 +394,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean foundMatchingItemStack = false;
|
boolean foundMatchingFluidStack = false;
|
||||||
|
|
||||||
final String displayName = Platform.getFluidDisplayName(iaeFluidStack).toLowerCase();
|
final String displayName = Platform.getFluidDisplayName(iaeFluidStack).toLowerCase();
|
||||||
|
|
||||||
@@ -405,10 +405,12 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (displayName.contains(term)) {
|
} else if (displayName.contains(term)) {
|
||||||
foundMatchingItemStack = true;
|
foundMatchingFluidStack = true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return foundMatchingItemStack;
|
return foundMatchingFluidStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,9 +19,11 @@
|
|||||||
package appeng.client.gui.implementations;
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.api.config.LockCraftingMode;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.config.YesNo;
|
import appeng.api.config.YesNo;
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiImgLabel;
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
import appeng.client.gui.widgets.GuiToggleButton;
|
import appeng.client.gui.widgets.GuiToggleButton;
|
||||||
import appeng.container.implementations.ContainerInterface;
|
import appeng.container.implementations.ContainerInterface;
|
||||||
@@ -41,14 +43,22 @@ import java.io.IOException;
|
|||||||
public class GuiInterface extends GuiUpgradeable {
|
public class GuiInterface extends GuiUpgradeable {
|
||||||
|
|
||||||
private GuiTabButton priority;
|
private GuiTabButton priority;
|
||||||
|
private GuiImgButton UnlockMode;
|
||||||
private GuiImgButton BlockMode;
|
private GuiImgButton BlockMode;
|
||||||
private GuiToggleButton interfaceMode;
|
private GuiToggleButton interfaceMode;
|
||||||
|
private GuiImgLabel lockReason;
|
||||||
|
|
||||||
public GuiInterface(final InventoryPlayer inventoryPlayer, final IInterfaceHost te) {
|
public GuiInterface(final InventoryPlayer inventoryPlayer, final IInterfaceHost te) {
|
||||||
super(new ContainerInterface(inventoryPlayer, te));
|
super(new ContainerInterface(inventoryPlayer, te));
|
||||||
this.ySize = 256;
|
this.ySize = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.addLabel();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addButtons() {
|
protected void addButtons() {
|
||||||
this.priority = new GuiTabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender);
|
this.priority = new GuiTabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender);
|
||||||
@@ -57,16 +67,41 @@ public class GuiInterface extends GuiUpgradeable {
|
|||||||
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO);
|
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO);
|
||||||
this.buttonList.add(this.BlockMode);
|
this.buttonList.add(this.BlockMode);
|
||||||
|
|
||||||
this.interfaceMode = new GuiToggleButton(this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal());
|
this.UnlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + 26, Settings.UNLOCK, LockCraftingMode.NONE);
|
||||||
|
this.buttonList.add(this.UnlockMode);
|
||||||
|
|
||||||
|
this.interfaceMode = new GuiToggleButton(this.guiLeft - 18, this.guiTop + 44, 84, 85, GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal());
|
||||||
this.buttonList.add(this.interfaceMode);
|
this.buttonList.add(this.interfaceMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void addLabel() {
|
||||||
|
if (lockReason != null) {
|
||||||
|
labelList.remove(this.lockReason);
|
||||||
|
}
|
||||||
|
this.lockReason = new GuiImgLabel(this.fontRenderer, guiLeft + 40, guiTop + 12, Settings.UNLOCK, LockCraftingMode.NONE);
|
||||||
|
this.lockReason.setVisibility(false);
|
||||||
|
labelList.add(lockReason);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
if (this.BlockMode != null) {
|
if (this.BlockMode != null) {
|
||||||
this.BlockMode.set(((ContainerInterface) this.cvb).getBlockingMode());
|
this.BlockMode.set(((ContainerInterface) this.cvb).getBlockingMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.UnlockMode != null) {
|
||||||
|
this.UnlockMode.set(((ContainerInterface) this.cvb).getUnlockMode());
|
||||||
|
|
||||||
|
if (this.lockReason != null) {
|
||||||
|
if (this.UnlockMode.getCurrentValue() == LockCraftingMode.NONE) {
|
||||||
|
this.lockReason.setVisibility(false);
|
||||||
|
} else {
|
||||||
|
this.lockReason.setVisibility(true);
|
||||||
|
this.lockReason.set(((ContainerInterface) this.cvb).getCraftingLockedReason());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.interfaceMode != null) {
|
if (this.interfaceMode != null) {
|
||||||
this.interfaceMode.setState(((ContainerInterface) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
|
this.interfaceMode.setState(((ContainerInterface) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
|
||||||
}
|
}
|
||||||
@@ -106,6 +141,10 @@ public class GuiInterface extends GuiUpgradeable {
|
|||||||
if (btn == this.BlockMode) {
|
if (btn == this.BlockMode) {
|
||||||
NetworkHandler.instance().sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
|
NetworkHandler.instance().sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (btn == this.UnlockMode) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.UnlockMode.getSetting(), backwards));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -409,6 +409,8 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
}
|
}
|
||||||
} else if (displayName.contains(term)) {
|
} else if (displayName.contains(term)) {
|
||||||
foundMatchingItemStack = true;
|
foundMatchingItemStack = true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return foundMatchingItemStack;
|
return foundMatchingItemStack;
|
||||||
|
|||||||
@@ -27,14 +27,22 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
|||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
import appeng.client.gui.widgets.GuiScrollbar;
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
import appeng.client.gui.widgets.MEGuiTextField;
|
import appeng.client.gui.widgets.MEGuiTooltipTextField;
|
||||||
import appeng.client.me.ClientDCInternalInv;
|
import appeng.client.me.ClientDCInternalInv;
|
||||||
import appeng.client.me.SlotDisconnected;
|
import appeng.client.me.SlotDisconnected;
|
||||||
import appeng.container.implementations.ContainerInterfaceTerminal;
|
import appeng.container.implementations.ContainerInterfaceTerminal;
|
||||||
|
import appeng.container.implementations.ContainerWirelessInterfaceTerminal;
|
||||||
import appeng.container.slot.AppEngSlot;
|
import appeng.container.slot.AppEngSlot;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.AppEng;
|
||||||
|
import appeng.core.localization.ButtonToolTips;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.core.localization.PlayerMessages;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketConfigureInterface;
|
||||||
import appeng.helpers.DualityInterface;
|
import appeng.helpers.DualityInterface;
|
||||||
|
import appeng.helpers.PatternHelper;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
import appeng.parts.reporting.PartInterfaceTerminal;
|
import appeng.parts.reporting.PartInterfaceTerminal;
|
||||||
import appeng.util.BlockPosUtils;
|
import appeng.util.BlockPosUtils;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
@@ -42,27 +50,20 @@ import com.google.common.collect.HashMultimap;
|
|||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
import net.minecraft.nbt.NBTUtil;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.common.util.Constants;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.*;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.WeakHashMap;
|
|
||||||
|
|
||||||
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
|
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
|
||||||
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
@@ -70,15 +71,13 @@ import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
|||||||
|
|
||||||
public class GuiInterfaceTerminal extends AEBaseGui {
|
public class GuiInterfaceTerminal extends AEBaseGui {
|
||||||
|
|
||||||
private int rows = 6;
|
protected static final int OFFSET_X = 21;
|
||||||
|
protected final GuiText guiTitle;
|
||||||
|
private static final int MAGIC_HEIGHT_NUMBER = 52 + 99;
|
||||||
|
private static final String MOLECULAR_ASSEMBLER = "tile.appliedenergistics2.molecular_assembler";
|
||||||
|
|
||||||
// TODO: copied from GuiMEMonitorable. It looks not changed, maybe unneeded?
|
private final boolean jeiEnabled;
|
||||||
private final int offsetX = 21;
|
private final int jeiButtonPadding;
|
||||||
private int maxRows = Integer.MAX_VALUE;
|
|
||||||
|
|
||||||
protected int jeiOffset = Loader.isModLoaded("jei") ? 24 : 0;
|
|
||||||
|
|
||||||
private int reservedSpace = 0;
|
|
||||||
|
|
||||||
private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<>();
|
private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<>();
|
||||||
private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
|
private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
|
||||||
@@ -88,99 +87,139 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
private final ArrayList<String> names = new ArrayList<>();
|
private final ArrayList<String> names = new ArrayList<>();
|
||||||
private final ArrayList<Object> lines = new ArrayList<>();
|
private final ArrayList<Object> lines = new ArrayList<>();
|
||||||
private final Set<Object> matchedStacks = new HashSet<>();
|
private final Set<Object> matchedStacks = new HashSet<>();
|
||||||
private final Set<ClientDCInternalInv> matchedInterfaces = new HashSet<>();
|
|
||||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||||
|
private final Map<ClientDCInternalInv, Integer> dimHashMap = new HashMap<>();
|
||||||
|
|
||||||
|
private final MEGuiTooltipTextField searchFieldOutputs;
|
||||||
|
private final MEGuiTooltipTextField searchFieldInputs;
|
||||||
|
private final MEGuiTooltipTextField searchFieldNames;
|
||||||
|
|
||||||
|
private final GuiImgButton guiButtonHideFull;
|
||||||
|
private final GuiImgButton guiButtonAssemblersOnly;
|
||||||
|
private final GuiImgButton guiButtonBrokenRecipes;
|
||||||
|
private final GuiImgButton terminalStyleBox;
|
||||||
|
|
||||||
private boolean refreshList = false;
|
private boolean refreshList = false;
|
||||||
private MEGuiTextField searchFieldOutputs;
|
|
||||||
private MEGuiTextField searchFieldInputs;
|
|
||||||
private final PartInterfaceTerminal partInterfaceTerminal;
|
|
||||||
private GuiButton guiButtonHide;
|
|
||||||
private GuiButton guiButtonNextAssembler;
|
|
||||||
private GuiImgButton terminalStyleBox;
|
|
||||||
|
|
||||||
private final HashMap<ClientDCInternalInv, Integer> dimHashMap = new HashMap<>();
|
/* These are worded so that the intended default is false */
|
||||||
private int drawnRows = 0;
|
private boolean onlyShowWithSpace = false;
|
||||||
|
private boolean onlyMolecularAssemblers = false;
|
||||||
|
private boolean onlyBrokenRecipes = false;
|
||||||
|
private int rows = 6;
|
||||||
|
|
||||||
public GuiInterfaceTerminal(final InventoryPlayer inventoryPlayer, final PartInterfaceTerminal te) {
|
public GuiInterfaceTerminal(final InventoryPlayer inventoryPlayer, final PartInterfaceTerminal te) {
|
||||||
super(new ContainerInterfaceTerminal(inventoryPlayer, te));
|
super(new ContainerInterfaceTerminal(inventoryPlayer, te));
|
||||||
|
|
||||||
this.partInterfaceTerminal = te;
|
|
||||||
final GuiScrollbar scrollbar = new GuiScrollbar();
|
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||||
this.setScrollBar(scrollbar);
|
this.setScrollBar(scrollbar);
|
||||||
this.xSize = 208;
|
this.xSize = 208;
|
||||||
this.ySize = 255;
|
this.ySize = 255;
|
||||||
this.setReservedSpace(82);
|
this.jeiEnabled = Platform.isModLoaded("jei");
|
||||||
|
this.jeiButtonPadding = jeiEnabled ? 22 : 0;
|
||||||
|
|
||||||
|
searchFieldInputs = createTextField(86, 12, ButtonToolTips.SearchFieldInputs.getLocal());
|
||||||
|
searchFieldOutputs = createTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal());
|
||||||
|
searchFieldNames = createTextField(71, 12, ButtonToolTips.SearchFieldNames.getLocal());
|
||||||
|
searchFieldNames.setFocused(true);
|
||||||
|
|
||||||
|
guiButtonAssemblersOnly = new GuiImgButton(0, 0, Settings.ACTIONS, null);
|
||||||
|
guiButtonHideFull = new GuiImgButton(0, 0, Settings.ACTIONS, null);
|
||||||
|
guiButtonBrokenRecipes = new GuiImgButton(0, 0, Settings.ACTIONS, null);
|
||||||
|
terminalStyleBox = new GuiImgButton(0, 0, Settings.TERMINAL_STYLE, null);
|
||||||
|
guiTitle = GuiText.InterfaceTerminal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiInterfaceTerminal(final InventoryPlayer inventoryPlayer, final WirelessTerminalGuiObject guiObject) {
|
||||||
|
super(new ContainerWirelessInterfaceTerminal(inventoryPlayer, guiObject));
|
||||||
|
|
||||||
|
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||||
|
this.setScrollBar(scrollbar);
|
||||||
|
this.xSize = 208;
|
||||||
|
this.ySize = 255;
|
||||||
|
this.jeiEnabled = Platform.isModLoaded("jei");
|
||||||
|
this.jeiButtonPadding = jeiEnabled ? 22 : 0;
|
||||||
|
|
||||||
|
searchFieldInputs = createTextField(86, 12, ButtonToolTips.SearchFieldInputs.getLocal());
|
||||||
|
searchFieldOutputs = createTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal());
|
||||||
|
searchFieldNames = createTextField(71, 12, ButtonToolTips.SearchFieldNames.getLocal());
|
||||||
|
searchFieldNames.setFocused(true);
|
||||||
|
|
||||||
|
guiButtonAssemblersOnly = new GuiImgButton(0, 0, Settings.ACTIONS, null);
|
||||||
|
guiButtonHideFull = new GuiImgButton(0, 0, Settings.ACTIONS, null);
|
||||||
|
guiButtonBrokenRecipes = new GuiImgButton(0, 0, Settings.ACTIONS, null);
|
||||||
|
terminalStyleBox = new GuiImgButton(0, 0, Settings.TERMINAL_STYLE, null);
|
||||||
|
guiTitle = GuiText.WirelessTerminal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MEGuiTooltipTextField createTextField(final int width, final int height, final String tooltip) {
|
||||||
|
MEGuiTooltipTextField textField = new MEGuiTooltipTextField(width, height, tooltip) {
|
||||||
|
@Override
|
||||||
|
public void onTextChange(String oldText) {
|
||||||
|
refreshList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
textField.setEnableBackgroundDrawing(false);
|
||||||
|
textField.setMaxStringLength(25);
|
||||||
|
textField.setTextColor(0xFFFFFF);
|
||||||
|
textField.setCursorPositionZero();
|
||||||
|
return textField;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setScrollBar() {
|
||||||
|
this.getScrollBar().setTop(52).setLeft(189).setHeight(this.rows * 18 - 2);
|
||||||
|
this.getScrollBar().setRange(0, this.lines.size() - 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int calculateRowsCount() {
|
||||||
|
final int maxRows = getMaxRows();
|
||||||
|
final int jeiPadding = jeiEnabled ? 22 + 18 : 0;
|
||||||
|
final int extraSpace = this.height - MAGIC_HEIGHT_NUMBER - jeiPadding;
|
||||||
|
|
||||||
|
return Math.max(6, Math.min(maxRows, extraSpace / 18));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
this.maxRows = AEConfig.instance()
|
this.rows = calculateRowsCount();
|
||||||
.getConfigManager()
|
|
||||||
.getSetting(
|
|
||||||
Settings.TERMINAL_STYLE) != TerminalStyle.TALL ? 6 : Integer.MAX_VALUE;
|
|
||||||
|
|
||||||
final int magicNumber = 82 + 14;
|
|
||||||
final int extraSpace = this.height - magicNumber - this.reservedSpace;
|
|
||||||
|
|
||||||
this.rows = (int) Math.floor(extraSpace / 18);
|
|
||||||
if (this.rows > this.maxRows) {
|
|
||||||
this.rows = this.maxRows;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.rows < 6) {
|
|
||||||
this.rows = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ySize = magicNumber + this.rows * 18 + this.reservedSpace;
|
|
||||||
// this.guiTop = top;
|
|
||||||
final int unusedSpace = this.height - this.ySize;
|
|
||||||
this.guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
|
|
||||||
|
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
this.getScrollBar().setLeft(189);
|
this.ySize = MAGIC_HEIGHT_NUMBER + this.rows * 18;
|
||||||
this.getScrollBar().setHeight(106);
|
final int unusedSpace = this.height - this.ySize;
|
||||||
this.getScrollBar().setTop(51);
|
this.guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
|
||||||
|
|
||||||
this.searchFieldInputs = new MEGuiTextField(this.fontRenderer, this.guiLeft + Math.max(32, this.offsetX), this.guiTop + 25, 65, 12);
|
searchFieldInputs.x = guiLeft + 32;
|
||||||
this.searchFieldInputs.setEnableBackgroundDrawing(false);
|
searchFieldInputs.y = guiTop + 25;
|
||||||
this.searchFieldInputs.setMaxStringLength(25);
|
searchFieldOutputs.x = guiLeft + 32;
|
||||||
this.searchFieldInputs.setTextColor(0xFFFFFF);
|
searchFieldOutputs.y = guiTop + 38;
|
||||||
this.searchFieldInputs.setVisible(true);
|
searchFieldNames.x = guiLeft + 32 + 99;
|
||||||
this.searchFieldInputs.setFocused(false);
|
searchFieldNames.y = guiTop + 38;
|
||||||
|
|
||||||
this.searchFieldOutputs = new MEGuiTextField(this.fontRenderer, this.guiLeft + Math.max(32, this.offsetX), this.guiTop + 38, 65, 12);
|
terminalStyleBox.x = guiLeft - 18;
|
||||||
this.searchFieldOutputs.setEnableBackgroundDrawing(false);
|
terminalStyleBox.y = guiTop + 8 + jeiButtonPadding;
|
||||||
this.searchFieldOutputs.setMaxStringLength(25);
|
guiButtonBrokenRecipes.x = guiLeft - 18;
|
||||||
this.searchFieldOutputs.setTextColor(0xFFFFFF);
|
guiButtonBrokenRecipes.y = terminalStyleBox.y + 20;
|
||||||
this.searchFieldOutputs.setVisible(true);
|
guiButtonHideFull.x = guiLeft - 18;
|
||||||
this.searchFieldOutputs.setFocused(true);
|
guiButtonHideFull.y = guiButtonBrokenRecipes.y + 20;
|
||||||
|
guiButtonAssemblersOnly.x = guiLeft - 18;
|
||||||
this.searchFieldInputs.setText(partInterfaceTerminal.in);
|
guiButtonAssemblersOnly.y = guiButtonHideFull.y + 20;
|
||||||
this.searchFieldOutputs.setText(partInterfaceTerminal.out);
|
|
||||||
|
|
||||||
this.fontRenderer.drawString(this.getGuiDisplayName(GuiText.InterfaceTerminal.getLocal()), 8, 6, 4210752);
|
|
||||||
this.fontRenderer.drawString(GuiText.inventory.getLocal(), this.offsetX + 2, this.ySize - 96 + 3, 4210752);
|
|
||||||
|
|
||||||
|
this.setScrollBar();
|
||||||
|
this.repositionSlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void repositionSlot(final AppEngSlot s) {
|
protected void repositionSlots() {
|
||||||
this.ySize = 82 + 14 + this.drawnRows * 18 + this.reservedSpace;
|
for (final Object obj : this.inventorySlots.inventorySlots) {
|
||||||
|
if (obj instanceof AppEngSlot slot) {
|
||||||
s.yPos = s.getY() + this.ySize - 112;
|
slot.yPos = this.ySize + slot.getY() - 78 - 7;
|
||||||
s.xPos = s.getX() + 14;
|
slot.xPos = slot.getX() + 14;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void onGuiClosed() {
|
|
||||||
partInterfaceTerminal.saveSearchStrings(this.searchFieldInputs.getText().toLowerCase(), this.searchFieldOutputs.getText().toLowerCase());
|
|
||||||
super.onGuiClosed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Rectangle> getJEIExclusionArea() {
|
public List<Rectangle> getJEIExclusionArea() {
|
||||||
Rectangle tallButton = new Rectangle(this.guiLeft - 18, this.guiTop + 24 + jeiOffset, 18, 18);
|
Rectangle tallButton = new Rectangle(this.guiLeft - 18, this.guiTop + 24 + 24, 18, 18);
|
||||||
List<Rectangle> area = new ArrayList<>();
|
List<Rectangle> area = new ArrayList<>();
|
||||||
area.add(tallButton);
|
area.add(tallButton);
|
||||||
return area;
|
return area;
|
||||||
@@ -188,154 +227,151 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
this.buttonList.clear();
|
this.fontRenderer.drawString(this.getGuiDisplayName(guiTitle.getLocal()), OFFSET_X + 2, 6, 4210752);
|
||||||
|
this.fontRenderer.drawString(GuiText.inventory.getLocal(), OFFSET_X + 2, this.ySize - 96, 4210752);
|
||||||
|
|
||||||
final int currentScroll = this.getScrollBar().getCurrentScroll();
|
final int currentScroll = this.getScrollBar().getCurrentScroll();
|
||||||
|
|
||||||
this.guiButtonNextAssembler = new GuiImgButton(guiLeft + 123, guiTop + 25, Settings.ACTIONS, ActionItems.FREE_MOLECULAR_SLOT_SHORTCUT);
|
int offset = 51;
|
||||||
this.buttonList.add(guiButtonNextAssembler);
|
|
||||||
|
|
||||||
guiButtonHide = new GuiImgButton(guiLeft + 141, guiTop + 25, Settings.ACTIONS, this.partInterfaceTerminal.onlyInterfacesWithFreeSlots ? ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF : ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON);
|
|
||||||
this.buttonList.add(guiButtonHide);
|
|
||||||
|
|
||||||
this.buttonList.add(this.terminalStyleBox = new GuiImgButton(this.guiLeft - 18, guiTop + 24 + jeiOffset, Settings.TERMINAL_STYLE, AEConfig.instance()
|
|
||||||
.getConfigManager()
|
|
||||||
.getSetting(Settings.TERMINAL_STYLE)));
|
|
||||||
|
|
||||||
this.inventorySlots.inventorySlots.removeIf(slot -> slot instanceof SlotDisconnected);
|
|
||||||
|
|
||||||
for (final Slot s : this.inventorySlots.inventorySlots) {
|
|
||||||
if (s instanceof AppEngSlot) {
|
|
||||||
if (s.xPos < 197) {
|
|
||||||
this.repositionSlot((AppEngSlot) s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int offset = 52;
|
|
||||||
int linesDraw = 0;
|
int linesDraw = 0;
|
||||||
for (int x = 0; x < rows && linesDraw < rows && currentScroll + x < this.lines.size(); x++) {
|
for (int x = 0; x < rows && linesDraw < rows && currentScroll + x < this.lines.size(); x++) {
|
||||||
final Object lineObj = this.lines.get(currentScroll + x);
|
final Object lineObj = this.lines.get(currentScroll + x);
|
||||||
if (lineObj instanceof ClientDCInternalInv) {
|
if (lineObj instanceof ClientDCInternalInv inv) {
|
||||||
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
|
|
||||||
|
|
||||||
GuiButton guiButton = new GuiImgButton(guiLeft + 4, guiTop + offset, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE);
|
|
||||||
guiButtonHashMap.put(guiButton, inv);
|
|
||||||
this.buttonList.add(guiButton);
|
|
||||||
int extraLines = numUpgradesMap.get(inv);
|
|
||||||
|
|
||||||
|
final int extraLines = numUpgradesMap.get(inv);
|
||||||
for (int row = 0; row < 1 + extraLines && linesDraw < rows; ++row) {
|
for (int row = 0; row < 1 + extraLines && linesDraw < rows; ++row) {
|
||||||
for (int z = 0; z < 9; z++) {
|
for (int z = 0; z < 9; z++) {
|
||||||
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
|
||||||
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
||||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
|
drawRect(z * 18 + 22, 1 + offset, z * 18 + 22 + 16, 1 + offset + 16, 0x2A00FF00);
|
||||||
} else if (!matchedInterfaces.contains(inv)) {
|
|
||||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
offset += 18;
|
offset += 18;
|
||||||
}
|
}
|
||||||
} else if (lineObj instanceof String) {
|
} else if (lineObj instanceof String name) {
|
||||||
String name = (String) lineObj;
|
|
||||||
final int rows = this.byName.get(name).size();
|
final int rows = this.byName.get(name).size();
|
||||||
if (rows > 1) {
|
if (rows > 1) {
|
||||||
name = name + " (" + rows + ')';
|
name = name + " (" + rows + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
while (name.length() > 2 && this.fontRenderer.getStringWidth(name) > 155) {
|
while (name.length() > 2 && this.fontRenderer.getStringWidth(name) > 158) {
|
||||||
name = name.substring(0, name.length() - 1);
|
name = name.substring(0, name.length() - 1);
|
||||||
}
|
}
|
||||||
this.fontRenderer.drawString(name, this.offsetX + 2, 5 + offset, 4210752);
|
this.fontRenderer.drawString(name, OFFSET_X + 3, 6 + offset, 4210752);
|
||||||
|
linesDraw++;
|
||||||
|
offset += 18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
buttonList.clear();
|
||||||
|
guiButtonHashMap.clear();
|
||||||
|
inventorySlots.inventorySlots.removeIf(slot -> slot instanceof SlotDisconnected);
|
||||||
|
|
||||||
|
guiButtonAssemblersOnly.set(onlyMolecularAssemblers ? ActionItems.MOLECULAR_ASSEMBLERS_ON : ActionItems.MOLECULAR_ASSEMBLERS_OFF);
|
||||||
|
guiButtonHideFull.set(onlyShowWithSpace ? ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF : ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON);
|
||||||
|
guiButtonBrokenRecipes.set(onlyBrokenRecipes ? ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON : ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF);
|
||||||
|
terminalStyleBox.set(AEConfig.instance().getConfigManager().getSetting(Settings.TERMINAL_STYLE));
|
||||||
|
|
||||||
|
buttonList.add(guiButtonAssemblersOnly);
|
||||||
|
buttonList.add(guiButtonHideFull);
|
||||||
|
buttonList.add(guiButtonBrokenRecipes);
|
||||||
|
buttonList.add(terminalStyleBox);
|
||||||
|
|
||||||
|
int offset = 51;
|
||||||
|
final int currentScroll = this.getScrollBar().getCurrentScroll();
|
||||||
|
int linesDraw = 0;
|
||||||
|
|
||||||
|
for (int x = 0; x < rows && linesDraw < rows && currentScroll + x < this.lines.size(); x++) {
|
||||||
|
final Object lineObj = this.lines.get(currentScroll + x);
|
||||||
|
if (lineObj instanceof ClientDCInternalInv inv) {
|
||||||
|
GuiButton highlightBtn = new GuiImgButton(guiLeft + 4, guiTop + offset + 1, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE);
|
||||||
|
guiButtonHashMap.put(highlightBtn, inv);
|
||||||
|
this.buttonList.add(highlightBtn);
|
||||||
|
|
||||||
|
|
||||||
|
GuiButton configBtn = new GuiImgButton(guiLeft + 4, guiTop + offset + 1 - 16, Settings.ACTIONS, ActionItems.CONFIGURE_INTERFACE);
|
||||||
|
guiButtonHashMap.put(configBtn, inv);
|
||||||
|
this.buttonList.add(configBtn);
|
||||||
|
|
||||||
|
final int extraLines = numUpgradesMap.get(inv);
|
||||||
|
for (int row = 0; row < 1 + extraLines && linesDraw < rows; ++row) {
|
||||||
|
for (int z = 0; z < 9; z++) {
|
||||||
|
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), z * 18 + 22, 1+ offset));
|
||||||
|
}
|
||||||
|
linesDraw++;
|
||||||
|
offset += 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (lineObj instanceof String) {
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
offset += 18;
|
offset += 18;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchFieldInputs.isMouseIn(mouseX, mouseY)) {
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
drawTooltip(Mouse.getEventX() * this.width / this.mc.displayWidth - offsetX, mouseY - guiTop, "Inputs OR names");
|
|
||||||
} else if (searchFieldOutputs.isMouseIn(mouseX, mouseY)) {
|
|
||||||
drawTooltip(Mouse.getEventX() * this.width / this.mc.displayWidth - offsetX, mouseY - guiTop, "Outputs OR names");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
drawTooltip(searchFieldInputs, mouseX, mouseY);
|
||||||
|
drawTooltip(searchFieldOutputs, mouseX, mouseY);
|
||||||
|
drawTooltip(searchFieldNames, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) throws IOException {
|
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) throws IOException {
|
||||||
this.searchFieldInputs.mouseClicked(xCoord, yCoord, btn);
|
this.searchFieldInputs.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
|
||||||
if (btn == 1 && this.searchFieldInputs.isMouseIn(xCoord, yCoord)) {
|
|
||||||
this.searchFieldInputs.setText("");
|
|
||||||
this.refreshList();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.searchFieldOutputs.mouseClicked(xCoord, yCoord, btn);
|
this.searchFieldOutputs.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
this.searchFieldNames.mouseClicked(xCoord, yCoord, btn);
|
||||||
if (btn == 1 && this.searchFieldOutputs.isMouseIn(xCoord, yCoord)) {
|
|
||||||
this.searchFieldOutputs.setText("");
|
|
||||||
this.refreshList();
|
|
||||||
}
|
|
||||||
|
|
||||||
super.mouseClicked(xCoord, yCoord, btn);
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void actionPerformed(final GuiButton btn) throws IOException {
|
protected void actionPerformed(final GuiButton btn) throws IOException {
|
||||||
if (guiButtonHashMap.containsKey(btn)) {
|
if (guiButtonHashMap.containsKey(btn) && btn instanceof GuiImgButton guiImgButton) {
|
||||||
BlockPos blockPos = blockPosHashMap.get(guiButtonHashMap.get(this.selectedButton));
|
ClientDCInternalInv inv = guiButtonHashMap.get(this.selectedButton);
|
||||||
|
BlockPos blockPos = blockPosHashMap.get(inv);
|
||||||
BlockPos blockPos2 = mc.player.getPosition();
|
BlockPos blockPos2 = mc.player.getPosition();
|
||||||
int playerDim = mc.world.provider.getDimension();
|
int playerDim = mc.world.provider.getDimension();
|
||||||
int interfaceDim = dimHashMap.get(guiButtonHashMap.get(this.selectedButton));
|
int interfaceDim = dimHashMap.get(inv);
|
||||||
if (playerDim != interfaceDim) {
|
if (playerDim != interfaceDim) {
|
||||||
try {
|
try {
|
||||||
mc.player.sendStatusMessage(new TextComponentString("Interface located at dimension: " + interfaceDim + " [" + DimensionManager.getWorld(interfaceDim).provider.getDimensionType().getName() + "] and cant be highlighted"), false);
|
mc.player.sendStatusMessage(PlayerMessages.InterfaceInOtherDimParam.get(interfaceDim, DimensionManager.getWorld(interfaceDim).provider.getDimensionType().getName()), false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mc.player.sendStatusMessage(new TextComponentString("Interface is located in another dimension and cannot be highlighted"), false);
|
mc.player.sendStatusMessage(PlayerMessages.InterfaceInOtherDim.get(), false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hilightBlock(blockPos, System.currentTimeMillis() + 500 * BlockPosUtils.getDistance(blockPos, blockPos2), playerDim);
|
if (guiImgButton.getCurrentValue() == ActionItems.HIGHLIGHT_INTERFACE) {
|
||||||
mc.player.sendStatusMessage(new TextComponentString("The interface is now highlighted at " + "X: " + blockPos.getX() + " Y: " + blockPos.getY() + " Z: " + blockPos.getZ()), false);
|
hilightBlock(blockPos, System.currentTimeMillis() + 500 * BlockPosUtils.getDistance(blockPos, blockPos2), playerDim);
|
||||||
|
mc.player.sendStatusMessage(PlayerMessages.InterfaceHighlighted.get(blockPos.getX(), blockPos.getY(), blockPos.getZ()), false);
|
||||||
|
mc.player.closeScreen();
|
||||||
|
} else if (guiImgButton.getCurrentValue() == ActionItems.CONFIGURE_INTERFACE) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketConfigureInterface(inv.getId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mc.player.closeScreen();
|
} else if (btn == guiButtonHideFull) {
|
||||||
}
|
onlyShowWithSpace = !onlyShowWithSpace;
|
||||||
|
this.refreshList();
|
||||||
if (btn instanceof GuiImgButton) {
|
} else if (btn == guiButtonAssemblersOnly) {
|
||||||
final boolean backwards = Mouse.isButtonDown(1);
|
onlyMolecularAssemblers = !onlyMolecularAssemblers;
|
||||||
|
this.refreshList();
|
||||||
final GuiImgButton iBtn = (GuiImgButton) btn;
|
} else if (btn == guiButtonBrokenRecipes) {
|
||||||
|
onlyBrokenRecipes = !onlyBrokenRecipes;
|
||||||
|
this.refreshList();
|
||||||
|
} else if (btn instanceof GuiImgButton iBtn) {
|
||||||
if (iBtn.getSetting() != Settings.ACTIONS) {
|
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||||
final Enum cv = iBtn.getCurrentValue();
|
final Enum<?> cv = iBtn.getCurrentValue();
|
||||||
final Enum next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
final boolean backwards = Mouse.isButtonDown(1);
|
||||||
|
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||||
|
|
||||||
if (btn == this.terminalStyleBox) {
|
if (btn == this.terminalStyleBox) {
|
||||||
AEConfig.instance().getConfigManager().putSetting(iBtn.getSetting(), next);
|
AEConfig.instance().getConfigManager().putSetting(iBtn.getSetting(), next);
|
||||||
}
|
|
||||||
|
|
||||||
iBtn.set(next);
|
|
||||||
|
|
||||||
if (next.getClass() == TerminalStyle.class) {
|
|
||||||
this.reinitalize();
|
this.reinitalize();
|
||||||
}
|
}
|
||||||
|
iBtn.set(next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (btn == guiButtonHide) {
|
|
||||||
partInterfaceTerminal.onlyInterfacesWithFreeSlots = !partInterfaceTerminal.onlyInterfacesWithFreeSlots;
|
|
||||||
this.refreshList();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (btn == guiButtonNextAssembler) {
|
|
||||||
// Set Search to "Molecular Assembler" and set "Only Free Interface"
|
|
||||||
boolean currentOnlyInterfacesWithFreeSlots = this.partInterfaceTerminal.onlyInterfacesWithFreeSlots;
|
|
||||||
String currentSearchText = this.searchFieldOutputs.getText();
|
|
||||||
|
|
||||||
this.partInterfaceTerminal.onlyInterfacesWithFreeSlots = true;
|
|
||||||
this.searchFieldOutputs.setText("Molecular Assembler");
|
|
||||||
|
|
||||||
this.refreshList();
|
|
||||||
|
|
||||||
this.partInterfaceTerminal.onlyInterfacesWithFreeSlots = currentOnlyInterfacesWithFreeSlots;
|
|
||||||
this.searchFieldOutputs.setText(currentSearchText);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reinitalize() {
|
private void reinitalize() {
|
||||||
@@ -346,74 +382,66 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
@Override
|
@Override
|
||||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
this.bindTexture("guis/newinterfaceterminal.png");
|
this.bindTexture("guis/newinterfaceterminal.png");
|
||||||
//split the texture for the top
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, 166);
|
// draw the top portion of the background, above the interface list
|
||||||
|
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, 53);
|
||||||
|
|
||||||
|
for (int x = 0; x < this.rows; x++) {
|
||||||
|
// draw the background of the rows in the interface list
|
||||||
|
this.drawTexturedModalRect(offsetX, offsetY + 53 + x * 18, 0, 52, this.xSize, 18);
|
||||||
|
}
|
||||||
|
|
||||||
int offset = 51;
|
int offset = 51;
|
||||||
final int ex = this.getScrollBar().getCurrentScroll();
|
final int ex = this.getScrollBar().getCurrentScroll();
|
||||||
int linesDraw = 0;
|
int linesDraw = 0;
|
||||||
for (int x = 0; x < rows && linesDraw < rows && ex + x < this.lines.size(); x++) {
|
for (int x = 0; x < this.rows && linesDraw < rows && ex + x < this.lines.size(); x++) {
|
||||||
final Object lineObj = this.lines.get(ex + x);
|
final Object lineObj = this.lines.get(ex + x);
|
||||||
if (lineObj instanceof ClientDCInternalInv) {
|
if (lineObj instanceof ClientDCInternalInv) {
|
||||||
GlStateManager.color(1, 1, 1, 1);
|
GlStateManager.color(1, 1, 1, 1);
|
||||||
|
|
||||||
final int width = 9 * 18;
|
final int width = 9 * 18;
|
||||||
|
final int extraLines = numUpgradesMap.get(lineObj);
|
||||||
|
|
||||||
int extraLines = numUpgradesMap.get(lineObj);
|
// draw the slot backgrounds
|
||||||
|
|
||||||
for (int row = 0; row < 1 + extraLines && linesDraw < rows; ++row) {
|
for (int row = 0; row < 1 + extraLines && linesDraw < rows; ++row) {
|
||||||
if (linesDraw == 6) {
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY + offset + 7, 0, 166, 190, 7);
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY + offset + 14, 0, 166, 190, 4);
|
|
||||||
} else if (linesDraw >= 7) {
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY + offset, 0, 173, 190, 18);
|
|
||||||
}
|
|
||||||
this.drawTexturedModalRect(offsetX + 20, offsetY + offset, 20, 173, width, 18);
|
this.drawTexturedModalRect(offsetX + 20, offsetY + offset, 20, 173, width, 18);
|
||||||
|
|
||||||
offset += 18;
|
offset += 18;
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (linesDraw == 6) {
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY + offset + 7, 0, 166, 190, 7);
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY + offset + 14, 0, 166, 190, 4);
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY + offset, 0, 53, 183, 18);
|
|
||||||
} else if (linesDraw >= 7) {
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY + offset, 0, 53, 183, 18);
|
|
||||||
this.drawTexturedModalRect(offsetX + 183, offsetY + offset, 183, 166, 7, 18);
|
|
||||||
}
|
|
||||||
offset += 18;
|
offset += 18;
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset = 51 + Math.max(6 * 18, linesDraw * 18);
|
|
||||||
if (linesDraw > 6) {
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY + offset, 0, 166, 190, 7);
|
|
||||||
}
|
|
||||||
this.drawTexturedModalRect(offsetX, offsetY + offset + 7, 0, 166, this.xSize, 90);
|
|
||||||
|
|
||||||
this.drawnRows = Math.max(6, linesDraw);
|
// draw the background below the interface list
|
||||||
|
this.drawTexturedModalRect(offsetX, offsetY + 50 + this.rows * 18, 0, 158, this.xSize, 99);
|
||||||
|
|
||||||
if (this.searchFieldInputs != null) {
|
// draw the text boxes
|
||||||
this.searchFieldInputs.drawTextBox();
|
this.searchFieldInputs.drawTextBox();
|
||||||
}
|
this.searchFieldOutputs.drawTextBox();
|
||||||
|
this.searchFieldNames.drawTextBox();
|
||||||
if (this.searchFieldOutputs != null) {
|
|
||||||
this.searchFieldOutputs.drawTextBox();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(final char character, final int key) throws IOException {
|
protected void keyTyped(final char character, final int key) throws IOException {
|
||||||
if (!this.checkHotbarKeys(key)) {
|
if (!this.checkHotbarKeys(key)) {
|
||||||
if (character == ' ' && this.searchFieldInputs.getText().isEmpty() && this.searchFieldInputs.isFocused()) {
|
if (character == ' ') {
|
||||||
return;
|
if ((this.searchFieldInputs.getText().isEmpty() && this.searchFieldInputs.isFocused())
|
||||||
|
|| (this.searchFieldOutputs.getText().isEmpty() && this.searchFieldOutputs.isFocused())
|
||||||
|
|| (this.searchFieldNames.getText().isEmpty() && this.searchFieldNames.isFocused())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (character == '\t') {
|
||||||
|
if (handleTab()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (character == ' ' && this.searchFieldOutputs.getText().isEmpty() && this.searchFieldOutputs.isFocused()) {
|
if (this.searchFieldInputs.textboxKeyTyped(character, key)
|
||||||
return;
|
|| this.searchFieldOutputs.textboxKeyTyped(character, key)
|
||||||
}
|
|| this.searchFieldNames.textboxKeyTyped(character, key)) {
|
||||||
|
|
||||||
if (this.searchFieldInputs.textboxKeyTyped(character, key) || this.searchFieldOutputs.textboxKeyTyped(character, key)) {
|
|
||||||
this.refreshList();
|
this.refreshList();
|
||||||
} else {
|
} else {
|
||||||
super.keyTyped(character, key);
|
super.keyTyped(character, key);
|
||||||
@@ -421,14 +449,34 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Cycle to the next search bar if tab is pressed, going in reverse if shift is held. */
|
||||||
|
private boolean handleTab() {
|
||||||
|
if (searchFieldInputs.isFocused()) {
|
||||||
|
searchFieldInputs.setFocused(false);
|
||||||
|
if (isShiftKeyDown()) searchFieldNames.setFocused(true);
|
||||||
|
else searchFieldOutputs.setFocused(true);
|
||||||
|
return true;
|
||||||
|
} else if (searchFieldOutputs.isFocused()) {
|
||||||
|
searchFieldOutputs.setFocused(false);
|
||||||
|
if (isShiftKeyDown()) searchFieldInputs.setFocused(true);
|
||||||
|
else searchFieldNames.setFocused(true);
|
||||||
|
return true;
|
||||||
|
} else if (searchFieldNames.isFocused()) {
|
||||||
|
searchFieldNames.setFocused(false);
|
||||||
|
if (isShiftKeyDown()) searchFieldOutputs.setFocused(true);
|
||||||
|
else searchFieldInputs.setFocused(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void postUpdate(final NBTTagCompound in) {
|
public void postUpdate(final NBTTagCompound in) {
|
||||||
if (in.getBoolean("clear")) {
|
if (in.getBoolean("clear")) {
|
||||||
this.byId.clear();
|
this.byId.clear();
|
||||||
this.refreshList = true;
|
this.refreshList = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Object oKey : in.getKeySet()) {
|
for (final String key : in.getKeySet()) {
|
||||||
final String key = (String) oKey;
|
|
||||||
if (key.startsWith("=")) {
|
if (key.startsWith("=")) {
|
||||||
try {
|
try {
|
||||||
final long id = Long.parseLong(key.substring(1), Character.MAX_RADIX);
|
final long id = Long.parseLong(key.substring(1), Character.MAX_RADIX);
|
||||||
@@ -466,12 +514,13 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
this.byName.clear();
|
this.byName.clear();
|
||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.matchedStacks.clear();
|
this.matchedStacks.clear();
|
||||||
this.matchedInterfaces.clear();
|
|
||||||
|
|
||||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||||
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
|
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
|
||||||
|
final String searchFieldNames = this.searchFieldNames.getText().toLowerCase();
|
||||||
|
|
||||||
final Set<Object> cachedSearch = this.getCacheForSearchTerm("IN:" + searchFieldInputs + " OUT:" + searchFieldOutputs + partInterfaceTerminal.onlyInterfacesWithFreeSlots);
|
final Set<Object> cachedSearch = this.getCacheForSearchTerm("IN:" + searchFieldInputs + " OUT:" + searchFieldOutputs
|
||||||
|
+ "NAME:" + searchFieldNames + onlyShowWithSpace + onlyMolecularAssemblers + onlyBrokenRecipes);
|
||||||
final boolean rebuild = cachedSearch.isEmpty();
|
final boolean rebuild = cachedSearch.isEmpty();
|
||||||
|
|
||||||
for (final ClientDCInternalInv entry : this.byId.values()) {
|
for (final ClientDCInternalInv entry : this.byId.values()) {
|
||||||
@@ -482,78 +531,101 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
|
|
||||||
// Shortcut to skip any filter if search term is ""/empty
|
// Shortcut to skip any filter if search term is ""/empty
|
||||||
|
|
||||||
boolean found = (searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty() && !partInterfaceTerminal.onlyInterfacesWithFreeSlots);
|
boolean found = searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty();
|
||||||
boolean interfaceHasFreeSlots = false;
|
boolean interfaceHasFreeSlots = false;
|
||||||
|
boolean interfaceHasBrokenRecipes = false;
|
||||||
|
|
||||||
// Search if the current inventory holds a pattern containing the search term.
|
// Search if the current inventory holds a pattern containing the search term.
|
||||||
if (!found) {
|
if (!found || onlyShowWithSpace || onlyBrokenRecipes) {
|
||||||
int slot = 0;
|
int slot = 0;
|
||||||
for (final ItemStack itemStack : entry.getInventory()) {
|
for (final ItemStack itemStack : entry.getInventory()) {
|
||||||
if (slot > 8 + numUpgradesMap.get(entry) * 9) {
|
if (slot > 8 + numUpgradesMap.get(entry) * 9) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!searchFieldInputs.isEmpty() && !searchFieldOutputs.isEmpty()) {
|
|
||||||
if (this.itemStackMatchesSearchTerm(itemStack, searchFieldInputs, 0) || this.itemStackMatchesSearchTerm(itemStack, searchFieldOutputs, 1)) {
|
|
||||||
found = true;
|
|
||||||
matchedStacks.add(itemStack);
|
|
||||||
}
|
|
||||||
} else if (!searchFieldInputs.isEmpty()) {
|
|
||||||
if (this.itemStackMatchesSearchTerm(itemStack, searchFieldInputs, 0)) {
|
|
||||||
found = true;
|
|
||||||
matchedStacks.add(itemStack);
|
|
||||||
}
|
|
||||||
} else if (!searchFieldOutputs.isEmpty()) {
|
|
||||||
if (this.itemStackMatchesSearchTerm(itemStack, searchFieldOutputs, 1)) {
|
|
||||||
found = true;
|
|
||||||
matchedStacks.add(itemStack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If only Interfaces with empty slots should be shown, check that here
|
|
||||||
if (itemStack.isEmpty()) {
|
if (itemStack.isEmpty()) {
|
||||||
interfaceHasFreeSlots = true;
|
interfaceHasFreeSlots = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (onlyBrokenRecipes && recipeIsBroken(itemStack)) {
|
||||||
|
interfaceHasBrokenRecipes = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!searchFieldInputs.isEmpty() && itemStackMatchesSearchTerm(itemStack, searchFieldInputs, 0))
|
||||||
|
|| (!searchFieldOutputs.isEmpty() && itemStackMatchesSearchTerm(itemStack, searchFieldOutputs, 1))) {
|
||||||
|
found = true;
|
||||||
|
matchedStacks.add(itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
slot++;
|
slot++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
|
||||||
if ((searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty()) ||
|
// Exit if not found
|
||||||
!searchFieldInputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldInputs) ||
|
if (!found) {
|
||||||
(!searchFieldOutputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
|
|
||||||
this.matchedInterfaces.add(entry);
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
if (found) {
|
|
||||||
if (!partInterfaceTerminal.onlyInterfacesWithFreeSlots) {
|
|
||||||
this.byName.put(entry.getName(), entry);
|
|
||||||
cachedSearch.add(entry);
|
|
||||||
} else if (interfaceHasFreeSlots) {
|
|
||||||
this.byName.put(entry.getName(), entry);
|
|
||||||
cachedSearch.add(entry);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cachedSearch.remove(entry);
|
cachedSearch.remove(entry);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
// Exit if the interface does not match the name search
|
||||||
|
if (!entry.getName().toLowerCase().contains(searchFieldNames)) {
|
||||||
|
cachedSearch.remove(entry);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Exit if molecular assembler filter is on and this is not a molecular assembler
|
||||||
|
// Forge documantation said unlocalized name shouldn't be use for logic, so we might need a better way......
|
||||||
|
if (onlyMolecularAssemblers && !entry.getUnlocalizedName().equals(MOLECULAR_ASSEMBLER)) {
|
||||||
|
cachedSearch.remove(entry);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Exit if we are only showing interfaces with free slots and there are none free in this interface
|
||||||
|
if (onlyShowWithSpace && !interfaceHasFreeSlots) {
|
||||||
|
cachedSearch.remove(entry);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Exit if we are only showing interfaces with broken patterns and there are no broken patterns in this interface
|
||||||
|
if (onlyBrokenRecipes && !interfaceHasBrokenRecipes) {
|
||||||
|
cachedSearch.remove(entry);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Successful search
|
||||||
|
this.byName.put(entry.getName(), entry);
|
||||||
|
cachedSearch.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.names.clear();
|
this.names.clear();
|
||||||
this.names.addAll(this.byName.keySet());
|
this.names.addAll(this.byName.keySet());
|
||||||
|
|
||||||
Collections.sort(this.names);
|
Collections.sort(this.names);
|
||||||
|
|
||||||
this.lines.clear();
|
this.lines.clear();
|
||||||
this.lines.ensureCapacity(this.getMaxRows());
|
this.lines.ensureCapacity(this.names.size() + this.byId.size());
|
||||||
|
|
||||||
for (final String n : this.names) {
|
for (final String n : this.names) {
|
||||||
this.lines.add(n);
|
this.lines.add(n);
|
||||||
|
final ArrayList<ClientDCInternalInv> clientInventories = new ArrayList<>(this.byName.get(n));
|
||||||
final ArrayList<ClientDCInternalInv> clientInventories = new ArrayList<>();
|
|
||||||
clientInventories.addAll(this.byName.get(n));
|
|
||||||
|
|
||||||
Collections.sort(clientInventories);
|
Collections.sort(clientInventories);
|
||||||
this.lines.addAll(clientInventories);
|
this.lines.addAll(clientInventories);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getScrollBar().setRange(0, this.lines.size() - 1, 1);
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean recipeIsBroken(final ItemStack stack) {
|
||||||
|
if (stack == null) return false;
|
||||||
|
if (stack.isEmpty()) return false;
|
||||||
|
|
||||||
|
final NBTTagCompound encodedValue = stack.getTagCompound();
|
||||||
|
if (encodedValue == null) return true;
|
||||||
|
|
||||||
|
final World w = AppEng.proxy.getWorld();
|
||||||
|
if (w == null) return false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
new PatternHelper(stack, w);
|
||||||
|
return false;
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean itemStackMatchesSearchTerm(final ItemStack itemStack, final String searchTerm, int pass) {
|
private boolean itemStackMatchesSearchTerm(final ItemStack itemStack, final String searchTerm, int pass) {
|
||||||
@@ -567,15 +639,15 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
return searchTerm.matches(GuiText.InvalidPattern.getLocal());
|
return searchTerm.matches(GuiText.InvalidPattern.getLocal());
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagList tag = new NBTTagList();
|
final NBTTagList tag;
|
||||||
|
|
||||||
if (pass == 0) {
|
if (pass == 0) {
|
||||||
tag = encodedValue.getTagList("in", 10);
|
tag = encodedValue.getTagList("in", Constants.NBT.TAG_COMPOUND);
|
||||||
} else {
|
} else {
|
||||||
tag = encodedValue.getTagList("out", 10);
|
tag = encodedValue.getTagList("out", Constants.NBT.TAG_COMPOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean foundMatchingItemStack = false;
|
boolean foundMatchingItemStack = false;
|
||||||
|
final String[] splitTerm = searchTerm.split(" ");
|
||||||
|
|
||||||
for (int i = 0; i < tag.tagCount(); i++) {
|
for (int i = 0; i < tag.tagCount(); i++) {
|
||||||
final ItemStack parsedItemStack = new ItemStack(tag.getCompoundTagAt(i));
|
final ItemStack parsedItemStack = new ItemStack(tag.getCompoundTagAt(i));
|
||||||
@@ -584,7 +656,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
.getItemDisplayName(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack))
|
.getItemDisplayName(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack))
|
||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
|
|
||||||
for (String term : searchTerm.split(" ")) {
|
for (String term : splitTerm) {
|
||||||
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
|
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
|
||||||
term = term.substring(1);
|
term = term.substring(1);
|
||||||
if (displayName.contains(term)) {
|
if (displayName.contains(term)) {
|
||||||
@@ -623,13 +695,8 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The max amount of unique names and each inv row. Not affected by the filtering.
|
|
||||||
*
|
|
||||||
* @return max amount of unique names and each inv row
|
|
||||||
*/
|
|
||||||
private int getMaxRows() {
|
private int getMaxRows() {
|
||||||
return this.names.size() + this.byId.size();
|
return AEConfig.instance().getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.TALL ? 6 : Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClientDCInternalInv getById(final long id, final long sortBy, final String string) {
|
private ClientDCInternalInv getById(final long id, final long sortBy, final String string) {
|
||||||
@@ -642,12 +709,4 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getReservedSpace() {
|
|
||||||
return this.reservedSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setReservedSpace(final int reservedSpace) {
|
|
||||||
this.reservedSpace = reservedSpace;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,7 @@ import appeng.api.util.IConfigManager;
|
|||||||
import appeng.api.util.IConfigurableObject;
|
import appeng.api.util.IConfigurableObject;
|
||||||
import appeng.client.ActionKey;
|
import appeng.client.ActionKey;
|
||||||
import appeng.client.gui.AEBaseMEGui;
|
import appeng.client.gui.AEBaseMEGui;
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
import appeng.client.gui.widgets.*;
|
||||||
import appeng.client.gui.widgets.GuiScrollbar;
|
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
|
||||||
import appeng.client.gui.widgets.ISortSource;
|
|
||||||
import appeng.client.gui.widgets.MEGuiTextField;
|
|
||||||
import appeng.client.me.InternalSlotME;
|
import appeng.client.me.InternalSlotME;
|
||||||
import appeng.client.me.ItemRepo;
|
import appeng.client.me.ItemRepo;
|
||||||
import appeng.client.me.SlotME;
|
import appeng.client.me.SlotME;
|
||||||
@@ -61,7 +57,6 @@ import net.minecraft.client.gui.GuiButton;
|
|||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
@@ -103,7 +98,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
private int currentMouseY = 0;
|
private int currentMouseY = 0;
|
||||||
private boolean delayedUpdate;
|
private boolean delayedUpdate;
|
||||||
|
|
||||||
protected int jeiOffset = Loader.isModLoaded("jei") ? 24 : 0;
|
protected int jeiOffset = Platform.isModLoaded("jei") ? 24 : 0;
|
||||||
|
|
||||||
public GuiMEMonitorable(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
public GuiMEMonitorable(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
this(inventoryPlayer, te, new ContainerMEMonitorable(inventoryPlayer, te));
|
this(inventoryPlayer, te, new ContainerMEMonitorable(inventoryPlayer, te));
|
||||||
@@ -177,10 +172,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
NetworkHandler.instance().sendToServer(new PacketSwitchGuis(GuiBridge.GUI_CRAFTING_STATUS));
|
NetworkHandler.instance().sendToServer(new PacketSwitchGuis(GuiBridge.GUI_CRAFTING_STATUS));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btn instanceof GuiImgButton) {
|
if (btn instanceof GuiImgButton iBtn) {
|
||||||
final boolean backwards = Mouse.isButtonDown(1);
|
final boolean backwards = Mouse.isButtonDown(1);
|
||||||
|
|
||||||
final GuiImgButton iBtn = (GuiImgButton) btn;
|
|
||||||
if (iBtn.getSetting() != Settings.ACTIONS) {
|
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||||
final Enum cv = iBtn.getCurrentValue();
|
final Enum cv = iBtn.getCurrentValue();
|
||||||
final Enum next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
final Enum next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||||
@@ -467,6 +461,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean mouseInGui = this.isPointInRegion(0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY);
|
final boolean mouseInGui = this.isPointInRegion(0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY);
|
||||||
|
final boolean wasSearchFieldFocused = this.searchField.isFocused();
|
||||||
|
|
||||||
if (this.isAutoFocus && !this.searchField.isFocused() && mouseInGui) {
|
if (this.isAutoFocus && !this.searchField.isFocused() && mouseInGui) {
|
||||||
this.searchField.setFocused(true);
|
this.searchField.setFocused(true);
|
||||||
@@ -478,6 +473,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
// tell forge the key event is handled and should not be sent out
|
// tell forge the key event is handled and should not be sent out
|
||||||
this.keyHandled = mouseInGui;
|
this.keyHandled = mouseInGui;
|
||||||
} else {
|
} else {
|
||||||
|
if (!wasSearchFieldFocused) {
|
||||||
|
// prevent unhandled keys (like shift) from focusing the search field
|
||||||
|
searchField.setFocused(false);
|
||||||
|
}
|
||||||
super.keyTyped(character, key);
|
super.keyTyped(character, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,13 +20,14 @@ package appeng.client.gui.implementations;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
|
import appeng.container.implementations.ContainerMEPortableCell;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
|
||||||
public class GuiMEPortableCell extends GuiMEMonitorable {
|
public class GuiMEPortableCell extends GuiMEMonitorable {
|
||||||
|
|
||||||
public GuiMEPortableCell(final InventoryPlayer inventoryPlayer, final IPortableCell te) {
|
public GuiMEPortableCell(final InventoryPlayer inventoryPlayer, final IPortableCell te) {
|
||||||
super(inventoryPlayer, te);
|
super(inventoryPlayer, te, new ContainerMEPortableCell(inventoryPlayer, te));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import appeng.api.config.AccessRestriction;
|
|||||||
import appeng.api.config.ActionItems;
|
import appeng.api.config.ActionItems;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.config.StorageFilter;
|
import appeng.api.config.StorageFilter;
|
||||||
import appeng.client.gui.AEBaseGui;
|
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
import appeng.client.gui.widgets.MEGuiTextField;
|
import appeng.client.gui.widgets.MEGuiTextField;
|
||||||
@@ -27,7 +26,7 @@ import java.io.IOException;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
public class GuiOreDictStorageBus extends AEBaseGui {
|
public class GuiOreDictStorageBus extends GuiUpgradeable {
|
||||||
private final ContainerOreDictStorageBus container;
|
private final ContainerOreDictStorageBus container;
|
||||||
PartOreDicStorageBus part;
|
PartOreDicStorageBus part;
|
||||||
private GuiTabButton priority;
|
private GuiTabButton priority;
|
||||||
@@ -41,13 +40,11 @@ public class GuiOreDictStorageBus extends AEBaseGui {
|
|||||||
super(new ContainerOreDictStorageBus(inventoryPlayer, te));
|
super(new ContainerOreDictStorageBus(inventoryPlayer, te));
|
||||||
this.container = (ContainerOreDictStorageBus) super.inventorySlots;
|
this.container = (ContainerOreDictStorageBus) super.inventorySlots;
|
||||||
part = te;
|
part = te;
|
||||||
this.ySize = 84;
|
this.ySize = 170;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
protected void addButtons() {
|
||||||
super.initGui();
|
|
||||||
|
|
||||||
this.searchFieldInputs = new MEGuiTextField(this.fontRenderer, this.guiLeft + 3, this.guiTop + 22, 170, 12);
|
this.searchFieldInputs = new MEGuiTextField(this.fontRenderer, this.guiLeft + 3, this.guiTop + 22, 170, 12);
|
||||||
this.searchFieldInputs.setEnableBackgroundDrawing(false);
|
this.searchFieldInputs.setEnableBackgroundDrawing(false);
|
||||||
this.searchFieldInputs.setMaxStringLength(512);
|
this.searchFieldInputs.setMaxStringLength(512);
|
||||||
@@ -66,7 +63,6 @@ public class GuiOreDictStorageBus extends AEBaseGui {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillRegex(String regex) {
|
public void fillRegex(String regex) {
|
||||||
@@ -143,10 +139,13 @@ public class GuiOreDictStorageBus extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
protected String getBackground() {
|
||||||
this.bindTexture("guis/oredictstoragebus.png");
|
return "guis/oredictstoragebus.png";
|
||||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, 175, 85);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
if (this.searchFieldInputs != null) {
|
if (this.searchFieldInputs != null) {
|
||||||
this.searchFieldInputs.drawTextBox();
|
this.searchFieldInputs.drawTextBox();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -54,7 +55,7 @@ import java.util.*;
|
|||||||
|
|
||||||
|
|
||||||
public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients {
|
public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients {
|
||||||
private final Map<Target<?>, Object> mapTargetSlot = new HashMap<>();
|
protected final Map<Target<?>, Object> mapTargetSlot = new HashMap<>();
|
||||||
protected final ContainerUpgradeable cvb;
|
protected final ContainerUpgradeable cvb;
|
||||||
protected final IUpgradeableHost bc;
|
protected final IUpgradeableHost bc;
|
||||||
|
|
||||||
@@ -218,24 +219,25 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients {
|
|||||||
List<Target<?>> targets = new ArrayList<>();
|
List<Target<?>> targets = new ArrayList<>();
|
||||||
|
|
||||||
List<IJEITargetSlot> slots = new ArrayList<>();
|
List<IJEITargetSlot> slots = new ArrayList<>();
|
||||||
if (this.inventorySlots.inventorySlots.size() > 0) {
|
if (!this.inventorySlots.inventorySlots.isEmpty()) {
|
||||||
for (Slot slot : this.inventorySlots.inventorySlots) {
|
for (Slot slot : this.inventorySlots.inventorySlots) {
|
||||||
if (slot instanceof SlotFake && (!itemStack.isEmpty() || this instanceof GuiCellWorkbench && fluidStack != null)) {
|
if (slot instanceof SlotFake && (!itemStack.isEmpty() || this instanceof GuiCellWorkbench && fluidStack != null)) {
|
||||||
slots.add((IJEITargetSlot) slot);
|
slots.add((IJEITargetSlot) slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.getGuiSlots().size() > 0) {
|
if (!this.getGuiSlots().isEmpty()) {
|
||||||
for (GuiCustomSlot slot : this.getGuiSlots()) {
|
for (GuiCustomSlot slot : this.getGuiSlots()) {
|
||||||
if (slot instanceof GuiFluidSlot && fluidStack != null) {
|
if (slot instanceof GuiFluidSlot && fluidStack != null) {
|
||||||
slots.add((IJEITargetSlot) slot);
|
slots.add((IJEITargetSlot) slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Object slot : slots) {
|
for (IJEITargetSlot slot : slots) {
|
||||||
ItemStack finalItemStack = itemStack;
|
ItemStack finalItemStack = itemStack;
|
||||||
FluidStack finalFluidStack = fluidStack;
|
FluidStack finalFluidStack = fluidStack;
|
||||||
Target<Object> targetItem = new Target<Object>() {
|
Target<Object> targetItem = new Target<>() {
|
||||||
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Rectangle getArea() {
|
public Rectangle getArea() {
|
||||||
if (slot instanceof SlotFake && ((SlotFake) slot).isSlotEnabled()) {
|
if (slot instanceof SlotFake && ((SlotFake) slot).isSlotEnabled()) {
|
||||||
@@ -247,20 +249,20 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(Object ingredient) {
|
public void accept(@Nonnull Object ingredient) {
|
||||||
PacketInventoryAction p = null;
|
PacketInventoryAction p = null;
|
||||||
try {
|
try {
|
||||||
if (slot instanceof SlotFake && ((SlotFake) slot).isSlotEnabled()) {
|
if (slot instanceof SlotFake && ((SlotFake) slot).isSlotEnabled()) {
|
||||||
if (finalItemStack.isEmpty() && finalFluidStack != null) {
|
if (finalItemStack.isEmpty() && finalFluidStack != null) {
|
||||||
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, (IJEITargetSlot) slot, AEItemStack.fromItemStack(FluidUtil.getFilledBucket(finalFluidStack)));
|
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, slot, AEItemStack.fromItemStack(FluidUtil.getFilledBucket(finalFluidStack)));
|
||||||
} else if (!finalItemStack.isEmpty()) {
|
} else if (!finalItemStack.isEmpty()) {
|
||||||
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, (IJEITargetSlot) slot, AEItemStack.fromItemStack(finalItemStack));
|
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, slot, AEItemStack.fromItemStack(finalItemStack));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (finalFluidStack == null) {
|
if (finalFluidStack == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, (IJEITargetSlot) slot, AEItemStack.fromItemStack(AEFluidStack.fromFluidStack(finalFluidStack).asItemStackRepresentation()));
|
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, slot, AEItemStack.fromItemStack(AEFluidStack.fromFluidStack(finalFluidStack).asItemStackRepresentation()));
|
||||||
}
|
}
|
||||||
NetworkHandler.instance().sendToServer(p);
|
NetworkHandler.instance().sendToServer(p);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
public class GuiWirelessInterfaceTerminal extends GuiInterfaceTerminal {
|
||||||
|
public GuiWirelessInterfaceTerminal(InventoryPlayer inventoryPlayer, final WirelessTerminalGuiObject te) {
|
||||||
|
super(inventoryPlayer, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
this.bindTexture("guis/wirelessupgrades.png");
|
||||||
|
Gui.drawModalRectWithCustomSizedTexture(offsetX + 189, offsetY + 165, 0, 0, 32, 32, 32, 32);
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
package appeng.client.gui.widgets;
|
package appeng.client.gui.widgets;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.container.interfaces.ISpecialSlotIngredient;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public abstract class GuiCustomSlot extends Gui implements ITooltip {
|
public abstract class GuiCustomSlot extends Gui implements ITooltip, ISpecialSlotIngredient {
|
||||||
protected final int x;
|
protected final int x;
|
||||||
protected final int y;
|
protected final int y;
|
||||||
protected final int id;
|
protected final int id;
|
||||||
@@ -68,4 +69,9 @@ public abstract class GuiCustomSlot extends Gui implements ITooltip {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getIngredient() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,10 +116,14 @@ public class GuiImgButton extends GuiButton implements ITooltip {
|
|||||||
this.registerApp(11 + 4 * 16, Settings.ACTIONS, ActionItems.DECREASE_BY_ONE, ButtonToolTips.DecreaseByOne, ButtonToolTips.DecreaseByOneDesc);
|
this.registerApp(11 + 4 * 16, Settings.ACTIONS, ActionItems.DECREASE_BY_ONE, ButtonToolTips.DecreaseByOne, ButtonToolTips.DecreaseByOneDesc);
|
||||||
this.registerApp(12 + 4 * 16, Settings.ACTIONS, ActionItems.MAX_COUNT, ButtonToolTips.MaxCount, ButtonToolTips.MaxCountDesc);
|
this.registerApp(12 + 4 * 16, Settings.ACTIONS, ActionItems.MAX_COUNT, ButtonToolTips.MaxCount, ButtonToolTips.MaxCountDesc);
|
||||||
|
|
||||||
this.registerApp(6 + 5 * 16, Settings.ACTIONS, ActionItems.FREE_MOLECULAR_SLOT_SHORTCUT, ButtonToolTips.FreeMolecularSlotShortcut, ButtonToolTips.FreeMolecularSlotShortcutDesc);
|
this.registerApp(6 + 5 * 16, Settings.ACTIONS, ActionItems.MOLECULAR_ASSEMBLERS_ON, ButtonToolTips.ToggleMolecularAssemblers, ButtonToolTips.ToggleMolecularAssemblersOnDesc);
|
||||||
this.registerApp(7 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON, ButtonToolTips.ToggleShowFullInterfaces, ButtonToolTips.ToggleShowFullInterfacesOnDesc);
|
this.registerApp(7 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON, ButtonToolTips.ToggleShowFullInterfaces, ButtonToolTips.ToggleShowFullInterfacesOnDesc);
|
||||||
this.registerApp(8 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF, ButtonToolTips.ToggleShowFullInterfaces, ButtonToolTips.ToggleShowFullInterfacesOffDesc);
|
this.registerApp(8 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF, ButtonToolTips.ToggleShowFullInterfaces, ButtonToolTips.ToggleShowFullInterfacesOffDesc);
|
||||||
|
this.registerApp(9 + 5 * 16, Settings.ACTIONS, ActionItems.MOLECULAR_ASSEMBLERS_OFF, ButtonToolTips.ToggleMolecularAssemblers, ButtonToolTips.ToggleMolecularAssemblersOffDesc);
|
||||||
this.registerApp(6 + 6 * 16, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE, ButtonToolTips.HighlightInterface, "");
|
this.registerApp(6 + 6 * 16, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE, ButtonToolTips.HighlightInterface, "");
|
||||||
|
this.registerApp(66, Settings.ACTIONS, ActionItems.CONFIGURE_INTERFACE, ButtonToolTips.ConfigureInterface, "");
|
||||||
|
this.registerApp(4 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF, ButtonToolTips.ToggleShowOnlyInvalidInterface, ButtonToolTips.ToggleShowOnlyInvalidInterfaceOffDesc);
|
||||||
|
this.registerApp(5 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON, ButtonToolTips.ToggleShowOnlyInvalidInterface, ButtonToolTips.ToggleShowOnlyInvalidInterfaceOnDesc);
|
||||||
|
|
||||||
this.registerApp(8, Settings.ACTIONS, ActionItems.ENCODE, ButtonToolTips.Encode, ButtonToolTips.EncodeDescription);
|
this.registerApp(8, Settings.ACTIONS, ActionItems.ENCODE, ButtonToolTips.Encode, ButtonToolTips.EncodeDescription);
|
||||||
this.registerApp(4 + 3 * 16, Settings.ACTIONS, ItemSubstitution.ENABLED, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDescEnabled);
|
this.registerApp(4 + 3 * 16, Settings.ACTIONS, ItemSubstitution.ENABLED, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDescEnabled);
|
||||||
@@ -157,6 +161,12 @@ public class GuiImgButton extends GuiButton implements ITooltip {
|
|||||||
this.registerApp(16 * 15, Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT, ButtonToolTips.SchedulingMode, ButtonToolTips.SchedulingModeDefault);
|
this.registerApp(16 * 15, Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT, ButtonToolTips.SchedulingMode, ButtonToolTips.SchedulingModeDefault);
|
||||||
this.registerApp(16 * 15 + 1, Settings.SCHEDULING_MODE, SchedulingMode.ROUNDROBIN, ButtonToolTips.SchedulingMode, ButtonToolTips.SchedulingModeRoundRobin);
|
this.registerApp(16 * 15 + 1, Settings.SCHEDULING_MODE, SchedulingMode.ROUNDROBIN, ButtonToolTips.SchedulingMode, ButtonToolTips.SchedulingModeRoundRobin);
|
||||||
this.registerApp(16 * 15 + 2, Settings.SCHEDULING_MODE, SchedulingMode.RANDOM, ButtonToolTips.SchedulingMode, ButtonToolTips.SchedulingModeRandom);
|
this.registerApp(16 * 15 + 2, Settings.SCHEDULING_MODE, SchedulingMode.RANDOM, ButtonToolTips.SchedulingMode, ButtonToolTips.SchedulingModeRandom);
|
||||||
|
|
||||||
|
this.registerApp(10, Settings.UNLOCK,LockCraftingMode.NONE,ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingModeNone);
|
||||||
|
this.registerApp(7, Settings.UNLOCK,LockCraftingMode.LOCK_UNTIL_RESULT,ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingUntilResultReturned);
|
||||||
|
this.registerApp(0, Settings.UNLOCK, LockCraftingMode.LOCK_WHILE_LOW, ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingWhileRedstoneLow);
|
||||||
|
this.registerApp(1, Settings.UNLOCK, LockCraftingMode.LOCK_WHILE_HIGH, ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingWhileRedstoneHigh);
|
||||||
|
this.registerApp(2, Settings.UNLOCK, LockCraftingMode.LOCK_UNTIL_PULSE, ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingUntilRedstonePulse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +346,7 @@ public class GuiImgButton extends GuiButton implements ITooltip {
|
|||||||
this.fillVar = fillVar;
|
this.fillVar = fillVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class EnumPair {
|
public static final class EnumPair {
|
||||||
|
|
||||||
final Enum setting;
|
final Enum setting;
|
||||||
final Enum value;
|
final Enum value;
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package appeng.client.gui.widgets;
|
||||||
|
|
||||||
|
import appeng.api.config.LockCraftingMode;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiLabel;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.text.translation.I18n;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class GuiImgLabel extends GuiLabel implements ITooltip {
|
||||||
|
public GuiImgLabel(FontRenderer fontRendererObj, final int x, final int y, final Enum idx, final Enum val) {
|
||||||
|
super(fontRendererObj, 0, x, y, 16, 16, 0);
|
||||||
|
this.currentValue = val;
|
||||||
|
this.labelSetting = idx;
|
||||||
|
this.fontRenderer = fontRendererObj;
|
||||||
|
|
||||||
|
if (appearances == null) {
|
||||||
|
appearances = new HashMap<>();
|
||||||
|
registerApp(10, Settings.UNLOCK, LockCraftingMode.NONE, GuiText.NoneLock, null, 0x00FF00);
|
||||||
|
registerApp(9, Settings.UNLOCK, LockCraftingMode.LOCK_WHILE_LOW, GuiText.CraftingLock, GuiText.LowRedstoneLock, 0xFF0000);
|
||||||
|
registerApp(9, Settings.UNLOCK, LockCraftingMode.LOCK_WHILE_HIGH, GuiText.CraftingLock, GuiText.HighRedstoneLock, 0xFF0000);
|
||||||
|
registerApp(9, Settings.UNLOCK, LockCraftingMode.LOCK_UNTIL_PULSE, GuiText.CraftingLock, GuiText.UntilPulseUnlock, 0xFF0000);
|
||||||
|
registerApp(9, Settings.UNLOCK, LockCraftingMode.LOCK_UNTIL_RESULT, GuiText.CraftingLock, GuiText.ResultLock, 0xFF0000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Enum labelSetting;
|
||||||
|
private Enum currentValue;
|
||||||
|
private static Map<GuiImgButton.EnumPair, LabelAppearance> appearances;
|
||||||
|
private final FontRenderer fontRenderer;
|
||||||
|
|
||||||
|
public void setVisibility(final boolean vis) {
|
||||||
|
this.visible = vis;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLabel(Minecraft mc, int mouseX, int mouseY) {
|
||||||
|
if (this.visible) {
|
||||||
|
final int iconIndex = this.getIconIndex();
|
||||||
|
if (iconIndex == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mc.renderEngine.bindTexture(new ResourceLocation("appliedenergistics2", "textures/guis/states.png"));
|
||||||
|
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
final int uv_y = (int) Math.floor(iconIndex / 16);
|
||||||
|
final int uv_x = iconIndex - uv_y * 16;
|
||||||
|
|
||||||
|
|
||||||
|
this.drawTexturedModalRect(this.x, this.y, uv_x * 16, uv_y * 16, 16, 16);
|
||||||
|
|
||||||
|
if (labelSetting != null && currentValue != null) {
|
||||||
|
LabelAppearance labelAppearance = appearances.get(new GuiImgButton.EnumPair(this.labelSetting, this.currentValue));
|
||||||
|
String translated = I18n.translateToLocal(labelAppearance.displayLabel);
|
||||||
|
fontRenderer.drawString(translated, x + 16, y + 5, labelAppearance.color);
|
||||||
|
width = 16 + fontRenderer.getStringWidth(translated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getIconIndex() {
|
||||||
|
if (this.labelSetting != null && this.currentValue != null) {
|
||||||
|
final LabelAppearance app = appearances.get(new GuiImgButton.EnumPair(this.labelSetting, this.currentValue));
|
||||||
|
if (app == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return app.index;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerApp(final int iconIndex, final Settings setting, final Enum val, final GuiText label, final Object hint, int color) {
|
||||||
|
final LabelAppearance a = new LabelAppearance();
|
||||||
|
if (hint != null) {
|
||||||
|
a.hiddenValue = (String) (hint instanceof String ? hint : ((GuiText) hint).getUnlocalized());
|
||||||
|
} else {
|
||||||
|
a.hiddenValue = null;
|
||||||
|
}
|
||||||
|
a.index = iconIndex;
|
||||||
|
a.displayLabel = label.getUnlocalized();
|
||||||
|
a.color = color;
|
||||||
|
appearances.put(new GuiImgButton.EnumPair(setting, val), a);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
if (labelSetting != null && this.currentValue != null) {
|
||||||
|
LabelAppearance labelAppearance = appearances.get(new GuiImgButton.EnumPair(this.labelSetting, this.currentValue));
|
||||||
|
if (labelAppearance == null) {
|
||||||
|
return "No Such Message";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (labelAppearance.hiddenValue != null) {
|
||||||
|
return I18n.translateToLocal(labelAppearance.hiddenValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(final Enum e) {
|
||||||
|
if (this.currentValue != e) {
|
||||||
|
this.currentValue = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int xPos() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int yPos() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
return visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class LabelAppearance {
|
||||||
|
public int index;
|
||||||
|
public String displayLabel;
|
||||||
|
public String hiddenValue;
|
||||||
|
public int color;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,236 @@
|
|||||||
|
package appeng.client.gui.widgets;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Different implementation of a text field that wraps instead of extends
|
||||||
|
* MC's {@link GuiTextField}. This is necessary because of deobfuscated name
|
||||||
|
* collision between {@link ITooltip} and GuiTextField, which would cause
|
||||||
|
* crashes in an obfuscated environment. Additionally, since we are not extending that
|
||||||
|
* class, we can construct this object differently and allow its position to be
|
||||||
|
* mutable like most other widgets.
|
||||||
|
*/
|
||||||
|
public class MEGuiTooltipTextField implements ITooltip {
|
||||||
|
|
||||||
|
protected GuiTextField field;
|
||||||
|
|
||||||
|
private static final int PADDING = 2;
|
||||||
|
private static boolean previousKeyboardRepeatEnabled;
|
||||||
|
private static MEGuiTooltipTextField previousKeyboardRepeatEnabledField;
|
||||||
|
private String tooltip;
|
||||||
|
private int fontPad;
|
||||||
|
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
public int w;
|
||||||
|
public int h;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the values to instantiate a padded version of a text field. Pays attention to the '_' caret.
|
||||||
|
*
|
||||||
|
* @param width absolute width
|
||||||
|
* @param height absolute height
|
||||||
|
* @param tooltip tooltip message
|
||||||
|
*/
|
||||||
|
public MEGuiTooltipTextField(final int width, final int height, final String tooltip) {
|
||||||
|
final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||||
|
field = new GuiTextField(0, fontRenderer, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
w = width;
|
||||||
|
h = height;
|
||||||
|
|
||||||
|
setMessage(tooltip);
|
||||||
|
|
||||||
|
this.fontPad = fontRenderer.getCharWidth('_');
|
||||||
|
|
||||||
|
setDimensionsAndColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MEGuiTooltipTextField(final int width, final int height) {
|
||||||
|
this(width, height, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public MEGuiTooltipTextField() {
|
||||||
|
this(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setDimensionsAndColor() {
|
||||||
|
field.x = this.x + PADDING;
|
||||||
|
field.y = this.y + PADDING;
|
||||||
|
field.width = this.w - PADDING * 2 - this.fontPad;
|
||||||
|
field.height = this.h - PADDING * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTextChange(final String oldText) {}
|
||||||
|
|
||||||
|
public void mouseClicked(final int xPos, final int yPos, final int button) {
|
||||||
|
|
||||||
|
if (!this.isMouseIn(xPos, yPos)) {
|
||||||
|
setFocused(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
field.setCanLoseFocus(false);
|
||||||
|
setFocused(true);
|
||||||
|
|
||||||
|
if (button == 1) {
|
||||||
|
setText("");
|
||||||
|
} else {
|
||||||
|
field.mouseClicked(xPos, yPos, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
field.setCanLoseFocus(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the mouse is within the element
|
||||||
|
*
|
||||||
|
* @param xCoord current x coord of the mouse
|
||||||
|
* @param yCoord current y coord of the mouse
|
||||||
|
* @return true if mouse position is within the getText field area
|
||||||
|
*/
|
||||||
|
public boolean isMouseIn(final int xCoord, final int yCoord) {
|
||||||
|
final boolean withinXRange = this.x <= xCoord && xCoord < this.x + this.w;
|
||||||
|
final boolean withinYRange = this.y <= yCoord && yCoord < this.y + this.h;
|
||||||
|
|
||||||
|
return withinXRange && withinYRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean textboxKeyTyped(final char keyChar, final int keyID) {
|
||||||
|
if (!isFocused()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String oldText = getText();
|
||||||
|
boolean handled = field.textboxKeyTyped(keyChar, keyID);
|
||||||
|
|
||||||
|
if (!handled && (keyID == Keyboard.KEY_RETURN || keyID == Keyboard.KEY_NUMPADENTER
|
||||||
|
|| keyID == Keyboard.KEY_ESCAPE)) {
|
||||||
|
setFocused(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (handled) {
|
||||||
|
onTextChange(oldText);
|
||||||
|
}
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawTextBox() {
|
||||||
|
if (field.getVisible()) {
|
||||||
|
setDimensionsAndColor();
|
||||||
|
GuiTextField.drawRect(
|
||||||
|
this.x + 1,
|
||||||
|
this.y + 1,
|
||||||
|
this.x + this.w - 1,
|
||||||
|
this.y + this.h - 1,
|
||||||
|
isFocused() ? 0xFF606060 : 0xFFA8A8A8);
|
||||||
|
field.drawTextBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text, boolean ignoreTrigger) {
|
||||||
|
final String oldText = getText();
|
||||||
|
|
||||||
|
int currentCursorPos = field.getCursorPosition();
|
||||||
|
field.setText(text);
|
||||||
|
field.setCursorPosition(currentCursorPos);
|
||||||
|
|
||||||
|
if (!ignoreTrigger) {
|
||||||
|
onTextChange(oldText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
setText(text, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCursorPositionEnd() {
|
||||||
|
field.setCursorPositionEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFocused(boolean focus) {
|
||||||
|
if (field.isFocused() == focus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
field.setFocused(focus);
|
||||||
|
|
||||||
|
if (focus) {
|
||||||
|
|
||||||
|
if (previousKeyboardRepeatEnabledField == null) {
|
||||||
|
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
previousKeyboardRepeatEnabledField = this;
|
||||||
|
Keyboard.enableRepeatEvents(true);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (previousKeyboardRepeatEnabledField == this) {
|
||||||
|
previousKeyboardRepeatEnabledField = null;
|
||||||
|
Keyboard.enableRepeatEvents(previousKeyboardRepeatEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxStringLength(final int size) {
|
||||||
|
field.setMaxStringLength(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnableBackgroundDrawing(final boolean b) {
|
||||||
|
field.setEnableBackgroundDrawing(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextColor(final int color) {
|
||||||
|
field.setTextColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCursorPositionZero() {
|
||||||
|
field.setCursorPositionZero();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFocused() {
|
||||||
|
return field.isFocused();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return field.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String t) {
|
||||||
|
tooltip = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
return field.getVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int xPos() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int yPos() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWidth() {
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeight() {
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -55,6 +55,10 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv> {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUnlocalizedName() {
|
||||||
|
return this.unlocalizedName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(@Nonnull final ClientDCInternalInv o) {
|
public int compareTo(@Nonnull final ClientDCInternalInv o) {
|
||||||
return Long.compare(this.sortBy, o.sortBy);
|
return Long.compare(this.sortBy, o.sortBy);
|
||||||
|
|||||||
@@ -20,11 +20,13 @@ package appeng.client.me;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.container.interfaces.ISpecialSlotIngredient;
|
||||||
import appeng.fluids.container.slots.IMEFluidSlot;
|
import appeng.fluids.container.slots.IMEFluidSlot;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
import net.minecraftforge.items.SlotItemHandler;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ import javax.annotation.Nonnull;
|
|||||||
* @version rv6 - 22/05/2018
|
* @version rv6 - 22/05/2018
|
||||||
* @since rv6 22/05/2018
|
* @since rv6 22/05/2018
|
||||||
*/
|
*/
|
||||||
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
|
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot, ISpecialSlotIngredient {
|
||||||
|
|
||||||
private final InternalFluidSlotME slot;
|
private final InternalFluidSlotME slot;
|
||||||
|
|
||||||
@@ -95,4 +97,11 @@ public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
|
|||||||
public boolean canTakeStack(final EntityPlayer par1EntityPlayer) {
|
public boolean canTakeStack(final EntityPlayer par1EntityPlayer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Object getIngredient() {
|
||||||
|
return this.getAEFluidStack() == null ? null : this.getAEFluidStack().getFluidStack();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class TesrRenderHelper {
|
|||||||
* at the center of a block.
|
* at the center of a block.
|
||||||
*/
|
*/
|
||||||
public static void moveToFace(EnumFacing face) {
|
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 oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((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
|
// For to-machine connections, use a thicker end-cap for the connection
|
||||||
if (connectionType != AECableType.GLASS && !cableBusAdjacent) {
|
if (connectionType != AECableType.GLASS && !cableBusAdjacent) {
|
||||||
this.addBigCoveredCableSizedCube(facing, cubeBuilder);
|
this.addBigCoveredCableSizedCube(facing, cubeBuilder);
|
||||||
@@ -351,7 +355,6 @@ class CableBuilder {
|
|||||||
cubeBuilder.setTexture(texture);
|
cubeBuilder.setTexture(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
addCoveredCableSizedCube(facing, cubeBuilder);
|
|
||||||
|
|
||||||
// Render the channel indicators brightly lit at night
|
// Render the channel indicators brightly lit at night
|
||||||
cubeBuilder.setRenderFullBright(true);
|
cubeBuilder.setRenderFullBright(true);
|
||||||
@@ -467,8 +470,8 @@ class CableBuilder {
|
|||||||
// Dense cables show used channels in groups of 4, rounded up
|
// Dense cables show used channels in groups of 4, rounded up
|
||||||
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
|
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
|
||||||
|
|
||||||
// Render the channel indicators brightly lit at night
|
// Render the channel indicators brightly lit at night
|
||||||
cubeBuilder.setRenderFullBright(true);
|
cubeBuilder.setRenderFullBright(true);
|
||||||
@@ -493,7 +496,7 @@ class CableBuilder {
|
|||||||
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_COVERED).get(cableColor);
|
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_COVERED).get(cableColor);
|
||||||
cubeBuilder.setTexture(texture);
|
cubeBuilder.setTexture(texture);
|
||||||
|
|
||||||
setStraightCableUVs(cubeBuilder, facing, 5, 11);
|
setStraightCableUVs(cubeBuilder, facing, 3, 13);
|
||||||
|
|
||||||
addStraightDenseCableSizedCube(facing, cubeBuilder);
|
addStraightDenseCableSizedCube(facing, cubeBuilder);
|
||||||
}
|
}
|
||||||
@@ -504,15 +507,15 @@ class CableBuilder {
|
|||||||
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_SMART).get(cableColor);
|
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_SMART).get(cableColor);
|
||||||
cubeBuilder.setTexture(texture);
|
cubeBuilder.setTexture(texture);
|
||||||
|
|
||||||
setStraightCableUVs(cubeBuilder, facing, 5, 11);
|
setStraightCableUVs(cubeBuilder, facing, 3, 13);
|
||||||
|
|
||||||
addStraightDenseCableSizedCube(facing, cubeBuilder);
|
addStraightDenseCableSizedCube(facing, cubeBuilder);
|
||||||
|
|
||||||
// Dense cables show used channels in groups of 4, rounded up
|
// Dense cables show used channels in groups of 4, rounded up
|
||||||
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
|
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
|
||||||
|
|
||||||
// Render the channel indicators brightly lit at night
|
// Render the channel indicators brightly lit at night
|
||||||
cubeBuilder.setRenderFullBright(true);
|
cubeBuilder.setRenderFullBright(true);
|
||||||
@@ -556,14 +559,14 @@ class CableBuilder {
|
|||||||
case DOWN:
|
case DOWN:
|
||||||
case UP:
|
case UP:
|
||||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
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);
|
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
case WEST:
|
case WEST:
|
||||||
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
|
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
|
||||||
cubeBuilder.setUvRotation(EnumFacing.NORTH, 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.SOUTH, 0);
|
||||||
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
|
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
|
||||||
break;
|
break;
|
||||||
@@ -571,7 +574,7 @@ class CableBuilder {
|
|||||||
case SOUTH:
|
case SOUTH:
|
||||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
||||||
cubeBuilder.setUvRotation(EnumFacing.WEST, 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.EAST, 0);
|
||||||
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
|
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
|
||||||
break;
|
break;
|
||||||
@@ -611,14 +614,14 @@ class CableBuilder {
|
|||||||
case DOWN:
|
case DOWN:
|
||||||
case UP:
|
case UP:
|
||||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
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);
|
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
case WEST:
|
case WEST:
|
||||||
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
|
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
|
||||||
cubeBuilder.setUvRotation(EnumFacing.NORTH, 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.SOUTH, 0);
|
||||||
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
|
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
|
||||||
break;
|
break;
|
||||||
@@ -626,7 +629,7 @@ class CableBuilder {
|
|||||||
case SOUTH:
|
case SOUTH:
|
||||||
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
|
||||||
cubeBuilder.setUvRotation(EnumFacing.WEST, 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.EAST, 0);
|
||||||
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
|
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
|
||||||
break;
|
break;
|
||||||
@@ -702,6 +705,7 @@ class CableBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Collections.addAll(locations, SmartCableTextures.SMART_CHANNELS_TEXTURES);
|
Collections.addAll(locations, SmartCableTextures.SMART_CHANNELS_TEXTURES);
|
||||||
|
Collections.addAll(locations, SmartCableTextures.DENSE_SMART_CHANNELS_TEXTURES);
|
||||||
|
|
||||||
return locations;
|
return locations;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ import appeng.api.parts.IPartModel;
|
|||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.block.networking.BlockCableBus;
|
import appeng.block.networking.BlockCableBus;
|
||||||
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import com.google.common.cache.CacheLoader;
|
||||||
|
import com.google.common.cache.LoadingCache;
|
||||||
|
import com.google.common.cache.Weigher;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
@@ -38,6 +42,7 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.minecraftforge.client.MinecraftForgeClient;
|
import net.minecraftforge.client.MinecraftForgeClient;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -45,8 +50,6 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
public class CableBusBakedModel implements IBakedModel {
|
public class CableBusBakedModel implements IBakedModel {
|
||||||
|
|
||||||
static final Map<CableBusRenderState, List<BakedQuad>> CABLE_MODEL_CACHE = new HashMap<>();
|
|
||||||
|
|
||||||
private final CableBuilder cableBuilder;
|
private final CableBuilder cableBuilder;
|
||||||
|
|
||||||
private final FacadeBuilder facadeBuilder;
|
private final FacadeBuilder facadeBuilder;
|
||||||
@@ -57,11 +60,24 @@ public class CableBusBakedModel implements IBakedModel {
|
|||||||
|
|
||||||
private final TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
|
private final TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
|
||||||
|
|
||||||
|
private final LoadingCache<CableBusRenderState, List<BakedQuad>> cableModelCache;
|
||||||
|
|
||||||
CableBusBakedModel(CableBuilder cableBuilder, FacadeBuilder facadeBuilder, Map<ResourceLocation, IBakedModel> partModels, TextureAtlasSprite particleTexture) {
|
CableBusBakedModel(CableBuilder cableBuilder, FacadeBuilder facadeBuilder, Map<ResourceLocation, IBakedModel> partModels, TextureAtlasSprite particleTexture) {
|
||||||
this.cableBuilder = cableBuilder;
|
this.cableBuilder = cableBuilder;
|
||||||
this.facadeBuilder = facadeBuilder;
|
this.facadeBuilder = facadeBuilder;
|
||||||
this.partModels = partModels;
|
this.partModels = partModels;
|
||||||
this.particleTexture = particleTexture;
|
this.particleTexture = particleTexture;
|
||||||
|
this.cableModelCache = CacheBuilder.newBuilder()
|
||||||
|
.maximumWeight(5000)
|
||||||
|
.weigher((Weigher<CableBusRenderState, List<BakedQuad>>) (k, v) -> v.size())
|
||||||
|
.build(new CacheLoader<>() {
|
||||||
|
@Override
|
||||||
|
public List<BakedQuad> load(@Nonnull CableBusRenderState rs) {
|
||||||
|
final List<BakedQuad> model = new ArrayList<>();
|
||||||
|
addCableQuads(rs, model);
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -82,12 +98,7 @@ public class CableBusBakedModel implements IBakedModel {
|
|||||||
if (layer == BlockRenderLayer.CUTOUT) {
|
if (layer == BlockRenderLayer.CUTOUT) {
|
||||||
|
|
||||||
// First, handle the cable at the center of the cable bus
|
// First, handle the cable at the center of the cable bus
|
||||||
final List<BakedQuad> cableModel = CABLE_MODEL_CACHE.computeIfAbsent(renderState, k ->
|
final List<BakedQuad> cableModel = cableModelCache.getUnchecked(renderState);
|
||||||
{
|
|
||||||
final List<BakedQuad> model = new ArrayList<>();
|
|
||||||
this.addCableQuads(renderState, model);
|
|
||||||
return model;
|
|
||||||
});
|
|
||||||
quads.addAll(cableModel);
|
quads.addAll(cableModel);
|
||||||
|
|
||||||
// Then handle attachments
|
// Then handle attachments
|
||||||
|
|||||||
@@ -27,26 +27,21 @@ import com.google.common.collect.ImmutableMap;
|
|||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.model.IModel;
|
import net.minecraftforge.client.model.IModel;
|
||||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
import net.minecraftforge.client.resource.IResourceType;
|
|
||||||
import net.minecraftforge.client.resource.ISelectiveResourceReloadListener;
|
|
||||||
import net.minecraftforge.client.resource.VanillaResourceType;
|
|
||||||
import net.minecraftforge.common.model.IModelState;
|
import net.minecraftforge.common.model.IModelState;
|
||||||
import net.minecraftforge.common.model.TRSRTransformation;
|
import net.minecraftforge.common.model.TRSRTransformation;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The built-in model for the cable bus block.
|
* The built-in model for the cable bus block.
|
||||||
*/
|
*/
|
||||||
public class CableBusModel implements IModel, ISelectiveResourceReloadListener {
|
public class CableBusModel implements IModel {
|
||||||
|
|
||||||
private final PartModels partModels;
|
private final PartModels partModels;
|
||||||
|
|
||||||
@@ -106,12 +101,4 @@ public class CableBusModel implements IModel, ISelectiveResourceReloadListener {
|
|||||||
public IModelState getDefaultState() {
|
public IModelState getDefaultState() {
|
||||||
return TRSRTransformation.identity();
|
return TRSRTransformation.identity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResourceManagerReload(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate) {
|
|
||||||
if (resourcePredicate.test(VanillaResourceType.MODELS)) {
|
|
||||||
CableBusBakedModel.CABLE_MODEL_CACHE.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ public class CubeBuilder {
|
|||||||
builder.put(i, x, y, z);
|
builder.put(i, x, y, z);
|
||||||
break;
|
break;
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
builder.put(i, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ());
|
builder.put(i, face.getXOffset(), face.getYOffset(), face.getZOffset());
|
||||||
break;
|
break;
|
||||||
case COLOR:
|
case COLOR:
|
||||||
// Color format is RGBA
|
// Color format is RGBA
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class QuadRotator {
|
|||||||
// Figure out where the position is in the array
|
// Figure out where the position is in the array
|
||||||
VertexFormat format = quad.getFormat();
|
VertexFormat format = quad.getFormat();
|
||||||
int posIdx = this.findPositionOffset(format) / 4;
|
int posIdx = this.findPositionOffset(format) / 4;
|
||||||
int stride = format.getNextOffset() / 4;
|
int stride = format.getSize() / 4;
|
||||||
int normalIdx = format.getNormalOffset();
|
int normalIdx = format.getNormalOffset();
|
||||||
VertexFormatElement.EnumType normalType = null;
|
VertexFormatElement.EnumType normalType = null;
|
||||||
// Figure out the type of the normals
|
// Figure out the type of the normals
|
||||||
|
|||||||
@@ -32,20 +32,43 @@ import java.util.function.Function;
|
|||||||
*/
|
*/
|
||||||
public class SmartCableTextures {
|
public class SmartCableTextures {
|
||||||
|
|
||||||
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"),
|
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {
|
||||||
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_00"),
|
||||||
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_01"),
|
||||||
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_02"),
|
||||||
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_03"),
|
||||||
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14")
|
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
|
// 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
|
// one of each set are composed together to get even/odd colored channels
|
||||||
private final TextureAtlasSprite[] textures;
|
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) {
|
public SmartCableTextures(Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||||
this.textures = Arrays.stream(SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new);
|
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) {
|
public TextureAtlasSprite getEvenTextureForChannels(int channels) {
|
||||||
if (channels < 5) {
|
if (channels < 5) {
|
||||||
@@ -73,4 +106,14 @@ public class SmartCableTextures {
|
|||||||
return this.textures[9];
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package appeng.client.render.model;
|
|||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
import appeng.block.AEBaseTileBlock;
|
||||||
import appeng.client.render.FacingToRotation;
|
import appeng.client.render.FacingToRotation;
|
||||||
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
@@ -30,19 +31,22 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
|||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.Vec3i;
|
||||||
|
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||||
|
import net.minecraftforge.client.model.pipeline.QuadGatheringTransformer;
|
||||||
|
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
import javax.vecmath.Matrix4f;
|
import javax.vecmath.Vector3f;
|
||||||
import javax.vecmath.Tuple4f;
|
|
||||||
import javax.vecmath.Vector4f;
|
import javax.vecmath.Vector4f;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.minecraft.util.EnumFacing.DOWN;
|
|
||||||
|
|
||||||
|
|
||||||
public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadListener {
|
public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadListener {
|
||||||
|
|
||||||
@@ -64,171 +68,34 @@ public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadLis
|
|||||||
FacingToRotation f2r = FacingToRotation.get(forward, up);
|
FacingToRotation f2r = FacingToRotation.get(forward, up);
|
||||||
List<BakedQuad> original = AutoRotatingModel.this.parent.getQuads(state, f2r.resultingRotate(side), 0);
|
List<BakedQuad> original = AutoRotatingModel.this.parent.getQuads(state, f2r.resultingRotate(side), 0);
|
||||||
List<BakedQuad> rotated = new ArrayList<>(original.size());
|
List<BakedQuad> rotated = new ArrayList<>(original.size());
|
||||||
|
for (BakedQuad quad : original) {
|
||||||
|
VertexFormat format = quad.getFormat();
|
||||||
|
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||||
|
VertexRotator rot = new VertexRotator(f2r, quad.getFace());
|
||||||
|
rot.setParent(builder);
|
||||||
|
quad.pipe(rot);
|
||||||
|
if (quad.getFace() != null) {
|
||||||
|
builder.setQuadOrientation(f2r.rotate(quad.getFace()));
|
||||||
|
} else {
|
||||||
|
builder.setQuadOrientation(null);
|
||||||
|
|
||||||
final Matrix4f transformMatrix = new Matrix4f();
|
}
|
||||||
final Tuple4f vertexTransformingVec = new Vector4f();
|
BakedQuad unpackedQuad = builder.build();
|
||||||
|
|
||||||
// Transform the matrix so the top and front facings of the model matches the block in-world
|
// Make a copy of it to resolve the vertex data and throw away the unpacked stuff
|
||||||
transformMatrixByFacings(transformMatrix, up, forward);
|
// This also fixes a bug in Forge's UnpackedBakedQuad, which unpacks a byte-based normal like 0,0,-1
|
||||||
|
// to 0,0,-0.99607843. We replace these normals with the proper 0,0,-1 when rotation, which
|
||||||
for (BakedQuad b : original) {
|
// causes a bug in the AO lighter, if an unpacked quad pipes this value back to it.
|
||||||
EnumFacing newFace = f2r.rotate(b.getFace());
|
// Packing it back to the vanilla vertex format will fix this inconsistency because it converts
|
||||||
rotated.add(rebakeQuad(b, newFace, transformMatrix, vertexTransformingVec));
|
// the normal back to a byte-based format, which then re-applies Forge's own bug when piping it
|
||||||
|
// to the AO lighter, thus fixing our problem.
|
||||||
|
BakedQuad packedQuad = new BakedQuad(unpackedQuad.getVertexData(), quad.getTintIndex(), unpackedQuad.getFace(), quad.getSprite(), quad
|
||||||
|
.shouldApplyDiffuseLighting(), quad.getFormat());
|
||||||
|
rotated.add(packedQuad);
|
||||||
}
|
}
|
||||||
return rotated;
|
return rotated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void transformMatrixByFacings(Matrix4f transformMatrix, EnumFacing topFacing, EnumFacing frontFacing) {
|
|
||||||
Matrix4f intermediaryMatrix = new Matrix4f();
|
|
||||||
transformMatrix.setIdentity();
|
|
||||||
moveToPivot(transformMatrix, intermediaryMatrix, true);
|
|
||||||
if (topFacing.getAxis() == EnumFacing.Axis.Y) {
|
|
||||||
switch (frontFacing) {
|
|
||||||
case NORTH:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (0));
|
|
||||||
break;
|
|
||||||
case SOUTH:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI));
|
|
||||||
break;
|
|
||||||
case EAST:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
|
|
||||||
break;
|
|
||||||
case WEST:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (topFacing == DOWN) {
|
|
||||||
rotateX(transformMatrix, intermediaryMatrix, (float) (Math.PI));
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (topFacing) {
|
|
||||||
case WEST:
|
|
||||||
rotateZ(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
|
|
||||||
switch (frontFacing) {
|
|
||||||
case DOWN:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
|
|
||||||
break;
|
|
||||||
case UP:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (+Math.PI / 2));
|
|
||||||
break;
|
|
||||||
case SOUTH:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EAST:
|
|
||||||
rotateZ(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
|
|
||||||
switch (frontFacing) {
|
|
||||||
case DOWN:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
|
|
||||||
break;
|
|
||||||
case UP:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
|
|
||||||
break;
|
|
||||||
case SOUTH:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case NORTH:
|
|
||||||
rotateX(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
|
|
||||||
switch (frontFacing) {
|
|
||||||
case DOWN:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
|
|
||||||
break;
|
|
||||||
case EAST:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
|
|
||||||
break;
|
|
||||||
case WEST:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
rotateX(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
|
|
||||||
switch (frontFacing) {
|
|
||||||
case UP:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
|
|
||||||
break;
|
|
||||||
case EAST:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
|
|
||||||
break;
|
|
||||||
case SOUTH:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
|
|
||||||
break;
|
|
||||||
case WEST:
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (frontFacing.getAxis() == EnumFacing.Axis.Y) {
|
|
||||||
//rotateX(transformMatrix, intermediaryMatrix, (float) (Math.PI));
|
|
||||||
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
moveToPivot(transformMatrix, intermediaryMatrix, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void moveToPivot(Matrix4f matrix, Matrix4f intermediary, boolean positive) {
|
|
||||||
intermediary.setIdentity();
|
|
||||||
float pivot = positive ? .5F : -.5F;
|
|
||||||
intermediary.m03 = pivot;
|
|
||||||
intermediary.m13 = pivot;
|
|
||||||
intermediary.m23 = pivot;
|
|
||||||
matrix.mul(intermediary);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rotateX(Matrix4f matrix, Matrix4f intermediary, float angle) {
|
|
||||||
intermediary.setIdentity();
|
|
||||||
intermediary.rotX(angle);
|
|
||||||
matrix.mul(intermediary);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rotateY(Matrix4f matrix, Matrix4f intermediary, float angle) {
|
|
||||||
intermediary.setIdentity();
|
|
||||||
intermediary.rotY(angle);
|
|
||||||
matrix.mul(intermediary);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rotateZ(Matrix4f matrix, Matrix4f intermediary, float angle) {
|
|
||||||
intermediary.setIdentity();
|
|
||||||
intermediary.rotZ(angle);
|
|
||||||
matrix.mul(intermediary);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BakedQuad rebakeQuad(BakedQuad b, EnumFacing newFacing, Matrix4f transformMatrix, Tuple4f vertexTransformingVec) {
|
|
||||||
int[] newQuad = new int[28];
|
|
||||||
int[] quadData = b.getVertexData();
|
|
||||||
for (int k = 0; k < 4; ++k) {
|
|
||||||
// Getting the offset for the current vertex.
|
|
||||||
int vertexIndex = k * 7;
|
|
||||||
vertexTransformingVec.x = Float.intBitsToFloat(quadData[vertexIndex]);
|
|
||||||
vertexTransformingVec.y = Float.intBitsToFloat(quadData[vertexIndex + 1]);
|
|
||||||
vertexTransformingVec.z = Float.intBitsToFloat(quadData[vertexIndex + 2]);
|
|
||||||
vertexTransformingVec.w = 1;
|
|
||||||
|
|
||||||
// Transforming it by the model matrix.
|
|
||||||
transformMatrix.transform(vertexTransformingVec);
|
|
||||||
|
|
||||||
// Converting the new data to ints.
|
|
||||||
int x = Float.floatToRawIntBits(vertexTransformingVec.x);
|
|
||||||
int y = Float.floatToRawIntBits(vertexTransformingVec.y);
|
|
||||||
int z = Float.floatToRawIntBits(vertexTransformingVec.z);
|
|
||||||
|
|
||||||
// Vertex position data
|
|
||||||
newQuad[vertexIndex] = x;
|
|
||||||
newQuad[vertexIndex + 1] = y;
|
|
||||||
newQuad[vertexIndex + 2] = z;
|
|
||||||
|
|
||||||
newQuad[vertexIndex + 3] = quadData[vertexIndex + 3];
|
|
||||||
|
|
||||||
newQuad[vertexIndex + 4] = quadData[vertexIndex + 4]; //texture
|
|
||||||
newQuad[vertexIndex + 5] = quadData[vertexIndex + 5];
|
|
||||||
|
|
||||||
// Vertex brightness
|
|
||||||
newQuad[vertexIndex + 6] = 0x81818181;
|
|
||||||
}
|
|
||||||
return new BakedQuad(newQuad, b.getTintIndex(), newFacing, b.getSprite(), b.shouldApplyDiffuseLighting(), b.getFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAmbientOcclusion() {
|
public boolean isAmbientOcclusion() {
|
||||||
return this.parent.isAmbientOcclusion();
|
return this.parent.isAmbientOcclusion();
|
||||||
@@ -292,4 +159,140 @@ public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadLis
|
|||||||
this.quadCache.invalidateAll();
|
this.quadCache.invalidateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class VertexRotator extends QuadGatheringTransformer {
|
||||||
|
private final FacingToRotation f2r;
|
||||||
|
private final EnumFacing face;
|
||||||
|
|
||||||
|
public VertexRotator(FacingToRotation f2r, EnumFacing face) {
|
||||||
|
this.f2r = f2r;
|
||||||
|
this.face = face;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setParent(IVertexConsumer parent) {
|
||||||
|
super.setParent(parent);
|
||||||
|
if (Objects.equal(this.getVertexFormat(), parent.getVertexFormat())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setVertexFormat(parent.getVertexFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void processQuad() {
|
||||||
|
VertexFormat format = this.parent.getVertexFormat();
|
||||||
|
int count = format.getElementCount();
|
||||||
|
|
||||||
|
for (int v = 0; v < 4; v++) {
|
||||||
|
for (int e = 0; e < count; e++) {
|
||||||
|
VertexFormatElement element = format.getElement(e);
|
||||||
|
if (element.getUsage() == VertexFormatElement.EnumUsage.POSITION) {
|
||||||
|
this.parent.put(e, this.transform(this.quadData[e][v]));
|
||||||
|
} else if (element.getUsage() == VertexFormatElement.EnumUsage.NORMAL) {
|
||||||
|
this.parent.put(e, this.transformNormal(this.quadData[e][v]));
|
||||||
|
} else {
|
||||||
|
this.parent.put(e, this.quadData[e][v]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float[] transform(float[] fs) {
|
||||||
|
switch (fs.length) {
|
||||||
|
case 3:
|
||||||
|
Vector3f vec = new Vector3f(fs[0], fs[1], fs[2]);
|
||||||
|
vec.x -= 0.5f;
|
||||||
|
vec.y -= 0.5f;
|
||||||
|
vec.z -= 0.5f;
|
||||||
|
this.f2r.getMat().transform(vec);
|
||||||
|
vec.x += 0.5f;
|
||||||
|
vec.y += 0.5f;
|
||||||
|
vec.z += 0.5f;
|
||||||
|
return new float[]{vec.x, vec.y, vec.z
|
||||||
|
};
|
||||||
|
case 4:
|
||||||
|
Vector4f vecc = new Vector4f(fs[0], fs[1], fs[2], fs[3]);
|
||||||
|
vecc.x -= 0.5f;
|
||||||
|
vecc.y -= 0.5f;
|
||||||
|
vecc.z -= 0.5f;
|
||||||
|
this.f2r.getMat().transform(vecc);
|
||||||
|
vecc.x += 0.5f;
|
||||||
|
vecc.y += 0.5f;
|
||||||
|
vecc.z += 0.5f;
|
||||||
|
return new float[]{vecc.x, vecc.y, vecc.z, vecc.w
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float[] transformNormal(float[] fs) {
|
||||||
|
if (this.face == null) {
|
||||||
|
switch (fs.length) {
|
||||||
|
case 3:
|
||||||
|
Vector3f vec = new Vector3f(fs);
|
||||||
|
this.f2r.getMat().transform(vec);
|
||||||
|
return new float[]{
|
||||||
|
vec.getX(),
|
||||||
|
vec.getY(),
|
||||||
|
vec.getZ()
|
||||||
|
};
|
||||||
|
case 4:
|
||||||
|
Vector4f vec4 = new Vector4f(fs);
|
||||||
|
this.f2r.getMat().transform(vec4);
|
||||||
|
return new float[]{
|
||||||
|
vec4.getX(),
|
||||||
|
vec4.getY(),
|
||||||
|
vec4.getZ(),
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (fs.length) {
|
||||||
|
case 3:
|
||||||
|
Vec3i vec = this.f2r.rotate(this.face).getDirectionVec();
|
||||||
|
return new float[]{
|
||||||
|
vec.getX(),
|
||||||
|
vec.getY(),
|
||||||
|
vec.getZ()
|
||||||
|
};
|
||||||
|
case 4:
|
||||||
|
Vector4f veccc = new Vector4f(fs[0], fs[1], fs[2], fs[3]);
|
||||||
|
Vec3i vecc = this.f2r.rotate(this.face).getDirectionVec();
|
||||||
|
return new float[]{
|
||||||
|
vecc.getX(),
|
||||||
|
vecc.getY(),
|
||||||
|
vecc.getZ(),
|
||||||
|
veccc.w
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setQuadTint(int tint) {
|
||||||
|
this.parent.setQuadTint(tint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setQuadOrientation(EnumFacing orientation) {
|
||||||
|
this.parent.setQuadOrientation(orientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplyDiffuseLighting(boolean diffuse) {
|
||||||
|
this.parent.setApplyDiffuseLighting(diffuse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTexture(TextureAtlasSprite texture) {
|
||||||
|
this.parent.setTexture(texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,16 +43,16 @@ public class BuiltInModelLoader implements ICustomModelLoader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accepts(ResourceLocation modelLocation) {
|
public boolean accepts(ResourceLocation modelLocation) {
|
||||||
if (!modelLocation.getResourceDomain().equals(AppEng.MOD_ID)) {
|
if (!modelLocation.getNamespace().equals(AppEng.MOD_ID)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.builtInModels.containsKey(modelLocation.getResourcePath());
|
return this.builtInModels.containsKey(modelLocation.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IModel loadModel(ResourceLocation modelLocation) throws Exception {
|
public IModel loadModel(ResourceLocation modelLocation) throws Exception {
|
||||||
return this.builtInModels.get(modelLocation.getResourcePath());
|
return this.builtInModels.get(modelLocation.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package appeng.client.render.model;
|
package appeng.client.render.model;
|
||||||
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
@@ -9,9 +8,8 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
|||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.client.model.PerspectiveMapWrapper;
|
|
||||||
import net.minecraftforge.common.model.TRSRTransformation;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.vecmath.Matrix4f;
|
import javax.vecmath.Matrix4f;
|
||||||
@@ -24,15 +22,12 @@ class ColorApplicatorBakedModel implements IBakedModel {
|
|||||||
|
|
||||||
private final IBakedModel baseModel;
|
private final IBakedModel baseModel;
|
||||||
|
|
||||||
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
|
||||||
|
|
||||||
private final EnumMap<EnumFacing, List<BakedQuad>> quadsBySide;
|
private final EnumMap<EnumFacing, List<BakedQuad>> quadsBySide;
|
||||||
|
|
||||||
private final List<BakedQuad> generalQuads;
|
private final List<BakedQuad> generalQuads;
|
||||||
|
|
||||||
ColorApplicatorBakedModel(IBakedModel baseModel, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map, TextureAtlasSprite texDark, TextureAtlasSprite texMedium, TextureAtlasSprite texBright) {
|
ColorApplicatorBakedModel(IBakedModel baseModel, TextureAtlasSprite texDark, TextureAtlasSprite texMedium, TextureAtlasSprite texBright) {
|
||||||
this.baseModel = baseModel;
|
this.baseModel = baseModel;
|
||||||
this.transforms = map;
|
|
||||||
|
|
||||||
// Put the tint indices in... Since this is an item model, we are ignoring rand
|
// Put the tint indices in... Since this is an item model, we are ignoring rand
|
||||||
this.generalQuads = this.fixQuadTint(null, texDark, texMedium, texBright);
|
this.generalQuads = this.fixQuadTint(null, texDark, texMedium, texBright);
|
||||||
@@ -68,7 +63,7 @@ class ColorApplicatorBakedModel implements IBakedModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
public @NotNull List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
||||||
if (side == null) {
|
if (side == null) {
|
||||||
return this.generalQuads;
|
return this.generalQuads;
|
||||||
}
|
}
|
||||||
@@ -91,22 +86,22 @@ class ColorApplicatorBakedModel implements IBakedModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureAtlasSprite getParticleTexture() {
|
public @NotNull TextureAtlasSprite getParticleTexture() {
|
||||||
return this.baseModel.getParticleTexture();
|
return this.baseModel.getParticleTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemCameraTransforms getItemCameraTransforms() {
|
public @NotNull ItemCameraTransforms getItemCameraTransforms() {
|
||||||
return this.baseModel.getItemCameraTransforms();
|
return this.baseModel.getItemCameraTransforms();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemOverrideList getOverrides() {
|
public @NotNull ItemOverrideList getOverrides() {
|
||||||
return this.baseModel.getOverrides();
|
return this.baseModel.getOverrides();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType type) {
|
public @NotNull Pair<? extends IBakedModel, Matrix4f> handlePerspective(@NotNull ItemCameraTransforms.TransformType type) {
|
||||||
return PerspectiveMapWrapper.handlePerspective(this, this.transforms, type);
|
return this.baseModel.handlePerspective(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user