Compare commits
202 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ebe3341bfe | |||
| 7566b3e2fc | |||
| 30c074021b | |||
| e6586ac360 | |||
| 0429fe5f21 | |||
| e16d90333b | |||
| 59c7dd1285 | |||
| 13ba399418 | |||
| 8d152afcd3 | |||
| 9fdfbbea54 | |||
| f4303fc1ec | |||
| 3c62ac79c3 | |||
| e42863643d | |||
| ace7c7d660 | |||
| 35f2aa7d51 | |||
| 926a4a87c6 | |||
| d1d2c415bf | |||
| f631858be6 | |||
| d407ec4922 | |||
| 3587fce218 | |||
| 7464647bb8 | |||
| 0848f5db70 | |||
| 822e394966 | |||
| 68ed4c9c0f | |||
| f13d7f351d | |||
| 086ddd5a67 | |||
| acb1d00197 | |||
| 4aaa3f8929 | |||
| 793b8d6655 | |||
| cba89b0323 | |||
| 1f2cdfd843 | |||
| da39d81d5f | |||
| 1442248ec3 | |||
| 1500661e43 | |||
| a7c2824624 | |||
| 9d2549bdd8 | |||
| a37a2b4e89 | |||
| aa6bad7a72 | |||
| e2e5eed351 | |||
| b6de4ebf18 | |||
| 4545d78a51 | |||
| 6dc75fe26e | |||
| 0552282d9d | |||
| 8be01dfb87 | |||
| 4c5803b986 | |||
| 3b4b9a1bd5 | |||
| 2c7959e399 | |||
| 4649841341 | |||
| 3d4cfb2ee8 | |||
| 8092d0d354 | |||
| ceee1f181f | |||
| eefb11544e | |||
| af5921f9e8 | |||
| 75be2ff039 | |||
| b6f4bdb64d | |||
| b76c9f1371 | |||
| 50bf591418 | |||
| b077aff1f8 | |||
| 8debd6c499 | |||
| 53ad6c776b | |||
| e37f8ef65d | |||
| d8b20f53a9 | |||
| bf1a3b7751 | |||
| c8a6d50ce3 | |||
| 13af30f657 | |||
| 5d7f552643 | |||
| 82be548fc7 | |||
| 38249608e4 | |||
| 8f66765696 | |||
| fd5f9263d8 | |||
| 36d94a17aa | |||
| ede2b4ce25 | |||
| e09ec8c420 | |||
| 3d4c03e184 | |||
| 17119fd990 | |||
| 9a00185b6d | |||
| 2c7b239914 | |||
| 4039188712 | |||
| ecb697ab11 | |||
| ab1f519401 | |||
| d06a70ee22 | |||
| 422f9faf76 | |||
| 96ab73001b | |||
| 854676a33c | |||
| 7f76723da5 | |||
| 3fc7cf0247 | |||
| b377dfdd69 | |||
| 51522019ca | |||
| ff1091d252 | |||
| 15dff5d53d | |||
| 7ab89a0657 | |||
| dcd36b3b2f | |||
| 7b985c72bd | |||
| 269d3766db | |||
| d7e7ef0cb4 | |||
| 472f1e65a2 | |||
| 56268aba79 | |||
| 9d7dacdc29 | |||
| fb2aa21337 | |||
| 8bad14f982 | |||
| 0e797b2120 | |||
| 17c38a6418 | |||
| 58a6dabb20 | |||
| 329e613c99 | |||
| 11a4783881 | |||
| e230440cba | |||
| 149e7d251a | |||
| 405f14bd13 | |||
| acd77ff3f2 | |||
| a0ec9ceb51 | |||
| d6f2ed30e5 | |||
| 9785e38e3f | |||
| 1759bd898e | |||
| ae0d02e7d5 | |||
| d76eec2145 | |||
| d7e1554e41 | |||
| 9dee7f6c0e | |||
| 13c3067068 | |||
| 7c4e5679a3 | |||
| 03ed421331 | |||
| 36197a5dc6 | |||
| f407a26a8f | |||
| cb1011295c | |||
| 55a56ad79d | |||
| dd2f1c6dc7 | |||
| f14407b87a | |||
| 04f006695e | |||
| 4f36ccf64d | |||
| d9b4410c94 | |||
| 9bbd0ad61b | |||
| 662a7805dd | |||
| c46eadec08 | |||
| 148207f5c3 | |||
| 3ae251f098 | |||
| 82a906886f | |||
| 5b2c6658c0 | |||
| 653557bc65 | |||
| dde87448a9 | |||
| 8c29eeecdc | |||
| d852d0c216 | |||
| f9bb00a7e7 | |||
| 9f7e42ca7d | |||
| b76c18fedf | |||
| 98ce8235bb | |||
| e1ea4ae22f | |||
| 20ba83c529 | |||
| 225a4d5ab6 | |||
| bd4f03652e | |||
| d6650f9617 | |||
| c5607bda4e | |||
| 11af1f2111 | |||
| 7748f7c92d | |||
| 801fec3eaa | |||
| de324aad91 | |||
| 16ccb2ee46 | |||
| bd0d2a1f28 | |||
| 9abd53a8e8 | |||
| 1f12fc5e91 | |||
| 87fcc6c267 | |||
| e301459dfa | |||
| bf802f1c6f | |||
| 7ba4ca6923 | |||
| 53ed861e23 | |||
| 833f8aca2a | |||
| 9bcf45b7e2 | |||
| b2847677ed | |||
| 95845d5a6c | |||
| 286a3631be | |||
| 6506301049 | |||
| 422543f205 | |||
| 1eec160b74 | |||
| de23b62493 | |||
| 2b6299f2b0 | |||
| b495c972c4 | |||
| 7722dcc720 | |||
| c4d5add5f1 | |||
| 348e6436b8 | |||
| 92457ac680 | |||
| 9e53737635 | |||
| 0e0729166f | |||
| 15a1e8f150 | |||
| b443f1ce57 | |||
| 486a68d06b | |||
| 9b263c5501 | |||
| daf4910548 | |||
| 4f5bdfefe8 | |||
| c9f1387098 | |||
| 1f1d6d041a | |||
| 403a6e8b4a | |||
| 0a0c23c190 | |||
| d28cd798e9 | |||
| 3dedb7eefb | |||
| ae3295d3c9 | |||
| 4bac5f43db | |||
| 2e9a5dc8ea | |||
| 9ac4ea4e6e | |||
| 601faf5087 | |||
| 88e3df897e | |||
| f57a8cefda | |||
| d3fdac2b81 | |||
| f7be92adcf | |||
| 53f18f8e80 |
@@ -0,0 +1,25 @@
|
|||||||
|
name: Build mod
|
||||||
|
|
||||||
|
on: [ push, pull_request, workflow_dispatch ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build mod
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
distribution: 'adopt'
|
||||||
|
java-version: '8'
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew -Pnet.minecraftforge.gradle.disableUpdateChecker=true build
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: appliedenergistics2
|
||||||
|
path: build/libs
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
name: 'Lock threads'
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 0 * * *'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lock:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: dessant/lock-threads@v2
|
|
||||||
with:
|
|
||||||
github-token: ${{ github.token }}
|
|
||||||
issue-lock-inactive-days: '180'
|
|
||||||
pr-lock-inactive-days: '180'
|
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
!gradlew.bat
|
!gradlew.bat
|
||||||
!build.gradle
|
!build.gradle
|
||||||
!gradle.properties
|
!gradle.properties
|
||||||
|
!settings.gradle
|
||||||
!.travis.yml
|
!.travis.yml
|
||||||
|
|
||||||
# include markdowns
|
# include markdowns
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack.
|
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack.
|
||||||
|
|
||||||
See https://github.com/PrototypeTrousers/Applied-Energistics-2/tree/AE2-Omnifactory branch for commits
|
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.
|
||||||
and
|
|
||||||
https://github.com/PrototypeTrousers/Applied-Energistics-2/releases for the compiled jars.
|
|
||||||
|
|
||||||
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory)
|
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory)
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
A Mod about Matter, Energy and using them to conquer the world.
|
||||||
|
|
||||||
A Mod about Matter, Energy and using them to conquer the world..
|
## RecipeStages
|
||||||
|
You need to add the following into a CraftTweaker script:
|
||||||
|
```
|
||||||
|
mods.recipestages.Recipes.setPackageStage("appeng", allStages);
|
||||||
|
```
|
||||||
|
|
||||||
|
The second argument allows you to customize which stages exactly you want to be craftable with AE2. Idk why would you like to restrict any, but you can.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
* Applied Energistics 2 API
|
* Applied Energistics 2 API
|
||||||
- (c) 2013 - 2018 AlgorithmX2 et al
|
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||||
- [](http://opensource.org/licenses/MIT)
|
- [](http://opensource.org/licenses/MIT)
|
||||||
@@ -25,7 +29,6 @@ A Mod about Matter, Energy and using them to conquer the world..
|
|||||||
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
Thanks to
|
Thanks to
|
||||||
|
|
||||||
* Notch et al for Minecraft
|
* Notch et al for Minecraft
|
||||||
|
|||||||
+993
-87
File diff suppressed because it is too large
Load Diff
+119
-6
@@ -3,8 +3,6 @@ aechannel=stable
|
|||||||
aebuild=7
|
aebuild=7
|
||||||
aegroup=appeng
|
aegroup=appeng
|
||||||
aebasename=appliedenergistics2
|
aebasename=appliedenergistics2
|
||||||
extended=extended_life
|
|
||||||
extendedversion=v0.53.8
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Versions #
|
# Versions #
|
||||||
#########################################################
|
#########################################################
|
||||||
@@ -22,10 +20,7 @@ jei_version=4.16.1.302
|
|||||||
tesla_version=1.0.63
|
tesla_version=1.0.63
|
||||||
ic2_version=2.8.73-ex112
|
ic2_version=2.8.73-ex112
|
||||||
top_version=1.12-1.4.23-16
|
top_version=1.12-1.4.23-16
|
||||||
cofhcore_version=1.12.2-4.5.2.19
|
crafttweaker_version=4.1.20.684
|
||||||
crafttweaker_version=4.1.8.9
|
|
||||||
inventorytweaks_version=1.63
|
|
||||||
bogosorter_version=1.1.0
|
|
||||||
ctm_version=MC1.12.2-0.3.1.16
|
ctm_version=MC1.12.2-0.3.1.16
|
||||||
forestry_version=5.8.2.387
|
forestry_version=5.8.2.387
|
||||||
#########################################################
|
#########################################################
|
||||||
@@ -33,3 +28,121 @@ forestry_version=5.8.2.387
|
|||||||
#########################################################
|
#########################################################
|
||||||
website_version=1.12.2
|
website_version=1.12.2
|
||||||
curse_versions=1.12.2
|
curse_versions=1.12.2
|
||||||
|
mapping_channel=snapshot
|
||||||
|
mapping_version=20171003
|
||||||
|
# Run Configurations
|
||||||
|
minecraft_username=Developer
|
||||||
|
extra_jvm_args=
|
||||||
|
modName=Applied Energistics 2
|
||||||
|
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||||
|
modId=appliedenergistics2
|
||||||
|
modGroup=appeng
|
||||||
|
# Version of your mod.
|
||||||
|
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
|
||||||
|
modVersion=rv6-stable-7-extended_life-v0.55.21
|
||||||
|
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
|
||||||
|
includeMCVersionJar=false
|
||||||
|
# The name of your jar when you produce builds, not including any versioning info
|
||||||
|
modArchivesBaseName=appliedenergistics2
|
||||||
|
# Will update your build.gradle automatically whenever an update is available
|
||||||
|
autoUpdateBuildScript=false
|
||||||
|
minecraftVersion=1.12.2
|
||||||
|
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
||||||
|
# restart Minecraft in development. Choose this dependent on your mod:
|
||||||
|
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||||
|
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||||
|
# Alternatively this can be set with the 'DEV_USERNAME' environment variable.
|
||||||
|
developmentEnvironmentUserName=Developer
|
||||||
|
# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||||
|
# See https://github.com/bsideup/jabel for details on how this works.
|
||||||
|
# Using this requires that you use a Java 17 JDK for development.
|
||||||
|
enableModernJavaSyntax=true
|
||||||
|
# Generate a class with String fields for the mod id, name and version named with the fields below
|
||||||
|
generateGradleTokenClass=appeng.Tags
|
||||||
|
gradleTokenModId=
|
||||||
|
gradleTokenModName=
|
||||||
|
gradleTokenVersion=VERSION
|
||||||
|
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||||
|
# leave this property empty.
|
||||||
|
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||||
|
apiPackage=api
|
||||||
|
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/
|
||||||
|
# There can be multiple files in a comma-separated list.
|
||||||
|
# Example value: mymodid_at.cfg,jei_at.cfg
|
||||||
|
accessTransformersFile=appliedenergistics2_at.cfg
|
||||||
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
|
usesMixins=false
|
||||||
|
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||||
|
mixinsPackage=
|
||||||
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
|
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||||
|
coreModClass=core.AE2ELCore
|
||||||
|
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that
|
||||||
|
# there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
|
containsMixinsAndOrCoreModOnly=false
|
||||||
|
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||||
|
forceEnableMixins=false
|
||||||
|
# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
|
||||||
|
includeWellKnownRepositories=true
|
||||||
|
# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will
|
||||||
|
# be available at compiletime and runtime for your mod (in-game and in-code).
|
||||||
|
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
|
||||||
|
includeCommonDevEnvMods=true
|
||||||
|
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
|
||||||
|
# responsibility check the licence and request permission for distribution, if required.
|
||||||
|
usesShadowedDependencies=false
|
||||||
|
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
|
||||||
|
# their own classes, making the minimization unreliable.
|
||||||
|
minimizeShadowedDependencies=true
|
||||||
|
# If disabled, won't rename the shadowed classes.
|
||||||
|
relocateShadowedDependencies=true
|
||||||
|
# Publishing to modrinth requires you to set the MODRINTH_API_KEY environment variable to your current modrinth API token.
|
||||||
|
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||||
|
# Leave this empty if you don't want to publish on Modrinth.
|
||||||
|
# Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable.
|
||||||
|
modrinthProjectId=
|
||||||
|
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||||
|
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||||
|
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||||
|
# type can be one of [project, version],
|
||||||
|
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||||
|
# Example: required-project:jei;optional-project:top;incompatible-project:gregtech
|
||||||
|
modrinthRelations=
|
||||||
|
# Publishing to CurseForge requires you to set the CURSEFORGE_API_KEY environment variable to one of your CurseForge API tokens.
|
||||||
|
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||||
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
|
# Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable.
|
||||||
|
curseForgeProjectId=
|
||||||
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
|
# Syntax: type1:name1;type2:name2;...
|
||||||
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
|
# and the name is the CurseForge project slug of the other mod.
|
||||||
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
|
curseForgeRelations=
|
||||||
|
# This project's release type on CurseForge and/or Modrinth
|
||||||
|
# Allowed types: release, beta, alpha
|
||||||
|
releaseType=beta
|
||||||
|
# Generate a default changelog for releases. Requires git to be installed, as it uses it to generate a changelog of
|
||||||
|
# commits since the last tagged release.
|
||||||
|
generateDefaultChangelog=false
|
||||||
|
# Prevent the source code from being published
|
||||||
|
noPublishedSources=false
|
||||||
|
# Enable spotless checks
|
||||||
|
# Enforces code formatting on your source code
|
||||||
|
# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless
|
||||||
|
# to format your code. However, you can create your own version of these files and place them in your project's
|
||||||
|
# root directory to apply your own formatting options instead.
|
||||||
|
enableSpotless=false
|
||||||
|
# Enable JUnit testing platform used for testing your code.
|
||||||
|
# Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/
|
||||||
|
enableJUnit=true
|
||||||
|
# Deployment debug setting
|
||||||
|
# Uncomment this to test deployments to CurseForge and Modrinth
|
||||||
|
# Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable.
|
||||||
|
deploymentDebug=false
|
||||||
|
# Gradle Settings
|
||||||
|
# Effectively applies the '--stacktrace' flag by default
|
||||||
|
org.gradle.logging.stacktrace=all
|
||||||
|
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||||
|
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||||
|
org.gradle.jvmargs=-Xmx3G
|
||||||
@@ -1,67 +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>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Suppresses warnings/errors when building javadocs
|
|
||||||
allprojects {
|
|
||||||
tasks.withType(Javadoc) {
|
|
||||||
options.addStringOption('Xdoclint:none', '-quiet')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
javadoc {
|
|
||||||
options.encoding = 'UTF-8'
|
|
||||||
options.charSet = 'UTF-8'
|
|
||||||
}
|
|
||||||
|
|
||||||
task javadocs(type: Javadoc) {
|
|
||||||
source = sourceSets.api.java
|
|
||||||
include "appeng/api/**"
|
|
||||||
|
|
||||||
// Due to ForgeGradle having to be a special snowflake,
|
|
||||||
// we have to add some custom configurations to the normal compile configuration and hope it does not break.
|
|
||||||
classpath = configurations.compile + configurations.forgeGradleMc + configurations.forgeGradleMcDeps
|
|
||||||
}
|
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadocs) {
|
|
||||||
from javadoc.destinationDir
|
|
||||||
|
|
||||||
classifier = 'javadoc'
|
|
||||||
}
|
|
||||||
|
|
||||||
task apiJar(type: Jar) {
|
|
||||||
from sourceSets.api.java
|
|
||||||
include "appeng/api/**"
|
|
||||||
|
|
||||||
from sourceSets.api.output
|
|
||||||
include "appeng/api/**"
|
|
||||||
|
|
||||||
classifier = 'api'
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourceJar(type: Jar, overwrite: true) {
|
|
||||||
from sourceSets.api.allSource
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
|
|
||||||
classifier = 'sources'
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives apiJar
|
|
||||||
archives javadocJar
|
|
||||||
archives sourceJar
|
|
||||||
}
|
|
||||||
@@ -19,6 +19,15 @@
|
|||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url "https://cursemaven.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name = "CurseForge"
|
||||||
|
url = "https://minecraft.curseforge.com/api/maven/"
|
||||||
|
}
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
name "Mobius"
|
name "Mobius"
|
||||||
url "http://mobiusstrip.eu/maven"
|
url "http://mobiusstrip.eu/maven"
|
||||||
@@ -29,11 +38,6 @@ repositories {
|
|||||||
url "http://dvs1.progwml6.com/files/maven"
|
url "http://dvs1.progwml6.com/files/maven"
|
||||||
}
|
}
|
||||||
|
|
||||||
maven {
|
|
||||||
name = "Tesla repo"
|
|
||||||
url "https://maven.mcmoddev.com"
|
|
||||||
}
|
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
name "Ellpeck"
|
name "Ellpeck"
|
||||||
url "https://maven.ellpeck.de"
|
url "https://maven.ellpeck.de"
|
||||||
@@ -68,11 +72,6 @@ repositories {
|
|||||||
// name 'modmaven'
|
// name 'modmaven'
|
||||||
// url "https://modmaven.k-4u.nl/"
|
// url "https://modmaven.k-4u.nl/"
|
||||||
//}
|
//}
|
||||||
|
|
||||||
maven {
|
|
||||||
name = "CurseForge"
|
|
||||||
url = "https://minecraft.curseforge.com/api/maven/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -80,30 +79,42 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
||||||
// installable runtime dependencies
|
// installable runtime dependencies
|
||||||
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
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 "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||||
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
||||||
|
|
||||||
// compile against provided APIs
|
// compile against provided APIs
|
||||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||||
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
//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.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
||||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||||
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
compileOnly "curse.maven:CoFHCore-69162:2920433"
|
||||||
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||||
compileOnly "inventory-tweaks:InventoryTweaks:${inventorytweaks_version}:api"
|
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
|
||||||
compileOnly "inventory-bogo-sorter:bogosorter:${bogosorter_version}"
|
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
|
||||||
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
|
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
|
||||||
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
|
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
|
||||||
deobfCompile "net.sengir.forestry:forestry_${minecraft_version}:$forestry_version"
|
implementation rfg.deobf("net.sengir.forestry:forestry_${minecraft_version}:$forestry_version")
|
||||||
|
|
||||||
|
|
||||||
// at runtime, use the full JEI jar
|
// at runtime, use the full JEI jar
|
||||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
runtimeOnly "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||||
|
|
||||||
// unit test dependencies
|
// unit test dependencies
|
||||||
testCompile "junit:junit:4.12"
|
testImplementation "junit:junit:4.12"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,40 +16,39 @@
|
|||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
|
||||||
gradleVersion = "2.14"
|
|
||||||
}
|
|
||||||
|
|
||||||
// HWYLA
|
// HWYLA
|
||||||
task installHwyla(type: Copy, dependsOn: "deinstallHwyla") {
|
tasks.register('installHwyla', Copy) {
|
||||||
|
dependsOn "deinstallHwyla"
|
||||||
from { configurations.mods }
|
from { configurations.mods }
|
||||||
include "**/*Hwyla*.jar"
|
include "**/*Hwyla*.jar"
|
||||||
into file(minecraft.runDir + "/mods")
|
into file("/run/mods")
|
||||||
}
|
}
|
||||||
|
|
||||||
task deinstallHwyla(type: Delete) {
|
tasks.register('deinstallHwyla', Delete) {
|
||||||
delete fileTree(dir: minecraft.runDir + "/mods", include: "*Hwyla*.jar")
|
delete fileTree(dir: "/run/mods", include: "*Hwyla*.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
// IC2
|
// IC2
|
||||||
task installIC2(type: Copy, dependsOn: "deinstallIC2") {
|
tasks.register('installIC2', Copy) {
|
||||||
|
dependsOn "deinstallIC2"
|
||||||
from { configurations.mods }
|
from { configurations.mods }
|
||||||
include "**/*industrialcraft-2*.jar"
|
include "**/*industrialcraft-2*.jar"
|
||||||
into file(minecraft.runDir + "/mods")
|
into file("/run/mods")
|
||||||
}
|
}
|
||||||
|
|
||||||
task deinstallIC2(type: Delete) {
|
tasks.register('deinstallIC2', Delete) {
|
||||||
delete fileTree(dir: minecraft.runDir + "/mods", include: "*industrialcraft-2*.jar")
|
delete fileTree(dir: "/run/mods", include: "*industrialcraft-2*.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TOP
|
// TOP
|
||||||
task installTop(type: Copy, dependsOn: ["deinstallTop"]) {
|
tasks.register('installTop', Copy) {
|
||||||
|
dependsOn["deinstallTop"]
|
||||||
from { configurations.mods }
|
from { configurations.mods }
|
||||||
include "**/*TheOneProbe*.jar"
|
include "**/*TheOneProbe*.jar"
|
||||||
into file(minecraft.runDir + "/mods")
|
into file("/run/mods")
|
||||||
}
|
}
|
||||||
|
|
||||||
task deinstallTop(type: Delete) {
|
tasks.register('deinstallTop', Delete) {
|
||||||
delete fileTree(dir: minecraft.runDir + "/mods", include: "*TheOneProbe*.jar")
|
delete fileTree(dir: "/run/mods", include: "*TheOneProbe*.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
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
|
||||||
|
networkTimeout=10000
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
|
|
||||||
|
|||||||
@@ -1,78 +1,129 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# Resolve links: $0 may be a link
|
||||||
APP_BASE_NAME=`basename "$0"`
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
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
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
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.
|
which java >/dev/null 2>&1 || 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
|
||||||
@@ -89,84 +140,105 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
(0) set -- ;;
|
|
||||||
(1) set -- "$args0" ;;
|
|
||||||
(2) set -- "$args0" "$args1" ;;
|
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=$(save "$@")
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
// RetroFuturaGradle
|
||||||
|
name 'GTNH Maven'
|
||||||
|
//noinspection HttpUrlsUsage
|
||||||
|
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
|
||||||
|
allowInsecureProtocol = true
|
||||||
|
//noinspection GroovyAssignabilityCheck
|
||||||
|
mavenContent {
|
||||||
|
includeGroup 'com.gtnewhorizons'
|
||||||
|
includeGroup 'com.gtnewhorizons.retrofuturagradle'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
// Automatic toolchain provisioning
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = rootProject.projectDir.getName()
|
||||||
@@ -32,66 +32,61 @@ import net.minecraft.item.ItemStack;
|
|||||||
import appeng.api.definitions.IItemDefinition;
|
import appeng.api.definitions.IItemDefinition;
|
||||||
|
|
||||||
|
|
||||||
public enum Upgrades
|
public enum Upgrades {
|
||||||
{
|
/**
|
||||||
/**
|
* Gold Tier Upgrades.
|
||||||
* Gold Tier Upgrades.
|
*/
|
||||||
*/
|
CAPACITY(0),
|
||||||
CAPACITY( 0 ),
|
REDSTONE(0),
|
||||||
REDSTONE( 0 ),
|
CRAFTING(0),
|
||||||
CRAFTING( 0 ),
|
MAGNET(0),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Diamond Tier Upgrades.
|
* Diamond Tier Upgrades.
|
||||||
*/
|
*/
|
||||||
FUZZY( 1 ),
|
FUZZY(1),
|
||||||
SPEED( 1 ),
|
SPEED(1),
|
||||||
INVERTER( 1 ),
|
INVERTER(1),
|
||||||
PATTERN_EXPANSION(1);
|
PATTERN_EXPANSION(1),
|
||||||
|
QUANTUM_LINK(1);
|
||||||
|
|
||||||
private final int tier;
|
private final int tier;
|
||||||
private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
|
private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
|
||||||
|
|
||||||
Upgrades( final int tier )
|
Upgrades(final int tier) {
|
||||||
{
|
this.tier = tier;
|
||||||
this.tier = tier;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return list of Items/Blocks that support this upgrade, and how many it supports.
|
* @return list of Items/Blocks that support this upgrade, and how many it supports.
|
||||||
*/
|
*/
|
||||||
public Map<ItemStack, Integer> getSupported()
|
public Map<ItemStack, Integer> getSupported() {
|
||||||
{
|
return this.supportedMax;
|
||||||
return this.supportedMax;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a specific amount of this upgrade into a specific machine
|
* Registers a specific amount of this upgrade into a specific machine
|
||||||
*
|
*
|
||||||
* @param item machine in which this upgrade can be installed
|
* @param item machine in which this upgrade can be installed
|
||||||
* @param maxSupported amount how many upgrades can be installed
|
* @param maxSupported amount how many upgrades can be installed
|
||||||
*/
|
*/
|
||||||
public void registerItem( final IItemDefinition item, final int maxSupported )
|
public void registerItem(final IItemDefinition item, final int maxSupported) {
|
||||||
{
|
item.maybeStack(1).ifPresent(is -> this.registerItem(is, maxSupported));
|
||||||
item.maybeStack( 1 ).ifPresent( is -> this.registerItem( is, maxSupported ) );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a specific amount of this upgrade into a specific machine
|
* Registers a specific amount of this upgrade into a specific machine
|
||||||
*
|
*
|
||||||
* @param stack machine in which this upgrade can be installed
|
* @param stack machine in which this upgrade can be installed
|
||||||
* @param maxSupported amount how many upgrades can be installed
|
* @param maxSupported amount how many upgrades can be installed
|
||||||
*/
|
*/
|
||||||
public void registerItem( final ItemStack stack, final int maxSupported )
|
public void registerItem(final ItemStack stack, final int maxSupported) {
|
||||||
{
|
if (stack != null) {
|
||||||
if( stack != null )
|
this.supportedMax.put(stack, maxSupported);
|
||||||
{
|
}
|
||||||
this.supportedMax.put( stack, maxSupported );
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTier()
|
public int getTier() {
|
||||||
{
|
return this.tier;
|
||||||
return this.tier;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ import appeng.api.util.AEColoredItemDefinition;
|
|||||||
/**
|
/**
|
||||||
* A list of all items in AE
|
* A list of all items in AE
|
||||||
*/
|
*/
|
||||||
public interface IItems
|
public interface IItems {
|
||||||
{
|
|
||||||
IItemDefinition certusQuartzAxe();
|
IItemDefinition certusQuartzAxe();
|
||||||
|
|
||||||
IItemDefinition certusQuartzHoe();
|
IItemDefinition certusQuartzHoe();
|
||||||
@@ -64,6 +63,12 @@ public interface IItems
|
|||||||
|
|
||||||
IItemDefinition wirelessTerminal();
|
IItemDefinition wirelessTerminal();
|
||||||
|
|
||||||
|
IItemDefinition wirelessCraftingTerminal();
|
||||||
|
|
||||||
|
IItemDefinition wirelessPatternTerminal();
|
||||||
|
|
||||||
|
IItemDefinition wirelessFluidTerminal();
|
||||||
|
|
||||||
IItemDefinition biometricCard();
|
IItemDefinition biometricCard();
|
||||||
|
|
||||||
IItemDefinition chargedStaff();
|
IItemDefinition chargedStaff();
|
||||||
|
|||||||
@@ -27,121 +27,124 @@ package appeng.api.definitions;
|
|||||||
/**
|
/**
|
||||||
* A list of all materials in AE
|
* A list of all materials in AE
|
||||||
*/
|
*/
|
||||||
public interface IMaterials
|
public interface IMaterials {
|
||||||
{
|
IItemDefinition cell2SpatialPart();
|
||||||
IItemDefinition cell2SpatialPart();
|
|
||||||
|
|
||||||
IItemDefinition cell16SpatialPart();
|
IItemDefinition cell16SpatialPart();
|
||||||
|
|
||||||
IItemDefinition cell128SpatialPart();
|
IItemDefinition cell128SpatialPart();
|
||||||
|
|
||||||
IItemDefinition silicon();
|
IItemDefinition silicon();
|
||||||
|
|
||||||
IItemDefinition skyDust();
|
IItemDefinition skyDust();
|
||||||
|
|
||||||
IItemDefinition calcProcessorPress();
|
IItemDefinition calcProcessorPress();
|
||||||
|
|
||||||
IItemDefinition engProcessorPress();
|
IItemDefinition engProcessorPress();
|
||||||
|
|
||||||
IItemDefinition logicProcessorPress();
|
IItemDefinition logicProcessorPress();
|
||||||
|
|
||||||
IItemDefinition calcProcessorPrint();
|
IItemDefinition calcProcessorPrint();
|
||||||
|
|
||||||
IItemDefinition engProcessorPrint();
|
IItemDefinition engProcessorPrint();
|
||||||
|
|
||||||
IItemDefinition logicProcessorPrint();
|
IItemDefinition logicProcessorPrint();
|
||||||
|
|
||||||
IItemDefinition siliconPress();
|
IItemDefinition siliconPress();
|
||||||
|
|
||||||
IItemDefinition siliconPrint();
|
IItemDefinition siliconPrint();
|
||||||
|
|
||||||
IItemDefinition namePress();
|
IItemDefinition namePress();
|
||||||
|
|
||||||
IItemDefinition logicProcessor();
|
IItemDefinition logicProcessor();
|
||||||
|
|
||||||
IItemDefinition calcProcessor();
|
IItemDefinition calcProcessor();
|
||||||
|
|
||||||
IItemDefinition engProcessor();
|
IItemDefinition engProcessor();
|
||||||
|
|
||||||
IItemDefinition basicCard();
|
IItemDefinition basicCard();
|
||||||
|
|
||||||
IItemDefinition advCard();
|
IItemDefinition advCard();
|
||||||
|
|
||||||
IItemDefinition purifiedCertusQuartzCrystal();
|
IItemDefinition purifiedCertusQuartzCrystal();
|
||||||
|
|
||||||
IItemDefinition purifiedNetherQuartzCrystal();
|
IItemDefinition purifiedNetherQuartzCrystal();
|
||||||
|
|
||||||
IItemDefinition purifiedFluixCrystal();
|
IItemDefinition purifiedFluixCrystal();
|
||||||
|
|
||||||
IItemDefinition cell1kPart();
|
IItemDefinition cell1kPart();
|
||||||
|
|
||||||
IItemDefinition cell4kPart();
|
IItemDefinition cell4kPart();
|
||||||
|
|
||||||
IItemDefinition cell16kPart();
|
IItemDefinition cell16kPart();
|
||||||
|
|
||||||
IItemDefinition cell64kPart();
|
IItemDefinition cell64kPart();
|
||||||
|
|
||||||
IItemDefinition emptyStorageCell();
|
IItemDefinition emptyStorageCell();
|
||||||
|
|
||||||
IItemDefinition cardRedstone();
|
IItemDefinition cardRedstone();
|
||||||
|
|
||||||
IItemDefinition cardSpeed();
|
IItemDefinition cardSpeed();
|
||||||
|
|
||||||
IItemDefinition cardCapacity();
|
IItemDefinition cardCapacity();
|
||||||
|
|
||||||
IItemDefinition cardPatternExpansion();
|
IItemDefinition cardPatternExpansion();
|
||||||
|
|
||||||
IItemDefinition cardFuzzy();
|
IItemDefinition cardQuantumLink();
|
||||||
|
|
||||||
IItemDefinition cardInverter();
|
IItemDefinition cardMagnet();
|
||||||
|
|
||||||
IItemDefinition cardCrafting();
|
IItemDefinition cardFuzzy();
|
||||||
|
|
||||||
IItemDefinition enderDust();
|
IItemDefinition cardInverter();
|
||||||
|
|
||||||
IItemDefinition flour();
|
IItemDefinition cardCrafting();
|
||||||
|
|
||||||
IItemDefinition goldDust();
|
IItemDefinition enderDust();
|
||||||
|
|
||||||
IItemDefinition ironDust();
|
IItemDefinition flour();
|
||||||
|
|
||||||
IItemDefinition fluixDust();
|
IItemDefinition goldDust();
|
||||||
|
|
||||||
IItemDefinition certusQuartzDust();
|
IItemDefinition ironDust();
|
||||||
|
|
||||||
IItemDefinition netherQuartzDust();
|
IItemDefinition fluixDust();
|
||||||
|
|
||||||
IItemDefinition matterBall();
|
IItemDefinition certusQuartzDust();
|
||||||
|
|
||||||
IItemDefinition certusQuartzCrystal();
|
IItemDefinition netherQuartzDust();
|
||||||
|
|
||||||
IItemDefinition certusQuartzCrystalCharged();
|
IItemDefinition matterBall();
|
||||||
|
|
||||||
IItemDefinition fluixCrystal();
|
IItemDefinition certusQuartzCrystal();
|
||||||
|
|
||||||
IItemDefinition fluixPearl();
|
IItemDefinition certusQuartzCrystalCharged();
|
||||||
|
|
||||||
IItemDefinition woodenGear();
|
IItemDefinition fluixCrystal();
|
||||||
|
|
||||||
IItemDefinition wirelessReceiver();
|
IItemDefinition fluixPearl();
|
||||||
|
|
||||||
IItemDefinition wirelessBooster();
|
IItemDefinition woodenGear();
|
||||||
|
|
||||||
IItemDefinition annihilationCore();
|
IItemDefinition wirelessReceiver();
|
||||||
|
|
||||||
IItemDefinition formationCore();
|
IItemDefinition wirelessBooster();
|
||||||
|
|
||||||
IItemDefinition singularity();
|
IItemDefinition annihilationCore();
|
||||||
|
|
||||||
IItemDefinition qESingularity();
|
IItemDefinition formationCore();
|
||||||
|
|
||||||
IItemDefinition blankPattern();
|
IItemDefinition singularity();
|
||||||
|
|
||||||
IItemDefinition fluidCell1kPart();
|
IItemDefinition qESingularity();
|
||||||
|
|
||||||
IItemDefinition fluidCell4kPart();
|
IItemDefinition blankPattern();
|
||||||
|
|
||||||
IItemDefinition fluidCell16kPart();
|
IItemDefinition fluidCell1kPart();
|
||||||
|
|
||||||
IItemDefinition fluidCell64kPart();
|
IItemDefinition fluidCell4kPart();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell16kPart();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell64kPart();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,47 +28,45 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
|
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A handler for a wireless terminal.
|
* A handler for a wireless terminal.
|
||||||
*/
|
*/
|
||||||
public interface IWirelessTermHandler extends INetworkEncodable
|
public interface IWirelessTermHandler extends INetworkEncodable {
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param is wireless terminal
|
* @param is wireless terminal
|
||||||
*
|
* @return true, if usePower, hasPower, etc... can be called for the provided item
|
||||||
* @return true, if usePower, hasPower, etc... can be called for the provided item
|
*/
|
||||||
*/
|
boolean canHandle(ItemStack is);
|
||||||
boolean canHandle( ItemStack is );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use an amount of power, in AE units
|
* use an amount of power, in AE units
|
||||||
*
|
*
|
||||||
* @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for
|
* @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for
|
||||||
* hasPower
|
* hasPower
|
||||||
* @param is wireless terminal
|
* @param is wireless terminal
|
||||||
*
|
* @return true if wireless terminal uses power
|
||||||
* @return true if wireless terminal uses power
|
*/
|
||||||
*/
|
boolean usePower(EntityPlayer player, double amount, ItemStack is);
|
||||||
boolean usePower( EntityPlayer player, double amount, ItemStack is );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the power status of the item.
|
* gets the power status of the item.
|
||||||
*
|
*
|
||||||
* @param is wireless terminal
|
* @param is wireless terminal
|
||||||
*
|
* @return returns true if there is any power left.
|
||||||
* @return returns true if there is any power left.
|
*/
|
||||||
*/
|
boolean hasPower(EntityPlayer player, double amount, ItemStack is);
|
||||||
boolean hasPower( EntityPlayer player, double amount, ItemStack is );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the config manager for the wireless terminal.
|
* Return the config manager for the wireless terminal.
|
||||||
*
|
*
|
||||||
* @param is wireless terminal
|
* @param is wireless terminal
|
||||||
*
|
* @return config manager of wireless terminal
|
||||||
* @return config manager of wireless terminal
|
*/
|
||||||
*/
|
IConfigManager getConfigManager(ItemStack is);
|
||||||
IConfigManager getConfigManager( ItemStack is );
|
|
||||||
|
IGuiHandler getGuiHandler(ItemStack is);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package appeng.api.implementations;
|
||||||
|
|
||||||
|
public interface IUpgradeableCellContainer {
|
||||||
|
int availableUpgrades();
|
||||||
|
|
||||||
|
void setupUpgrades();
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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.implementations;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.api.config.Upgrades;
|
||||||
|
import appeng.api.implementations.tiles.ISegmentedInventory;
|
||||||
|
import appeng.api.util.IConfigurableObject;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IUpgradeableCellHost extends IConfigurableObject, ISegmentedInventory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* determine how many of an upgrade are installed.
|
||||||
|
*/
|
||||||
|
default int getInstalledUpgrades(Upgrades u) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@API( apiVersion = "@aeversion@", owner = "appliedenergistics2", provides = "appliedenergistics2|API" )
|
@API(apiVersion = "rv6", owner = "appliedenergistics2", provides = "appliedenergistics2|API")
|
||||||
package appeng.api;
|
package appeng.api;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import appeng.api.storage.IStorageChannel;
|
|||||||
* - For fluids: AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createList()
|
* - For fluids: AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createList()
|
||||||
* - Replace with the corresponding {@link IStorageChannel} type for non native channels
|
* - Replace with the corresponding {@link IStorageChannel} type for non native channels
|
||||||
*/
|
*/
|
||||||
public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Iterable<T>, Cloneable
|
public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Iterable<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,9 +85,4 @@ public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Ite
|
|||||||
* resets stack sizes to 0.
|
* resets stack sizes to 0.
|
||||||
*/
|
*/
|
||||||
void resetStatus();
|
void resetStatus();
|
||||||
|
|
||||||
/**
|
|
||||||
* create a copy of this list.
|
|
||||||
*/
|
|
||||||
IItemList<T> clone();
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.enderio.core.common.interfaces;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public interface IOverlayRenderAware {
|
||||||
|
|
||||||
|
public void renderItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,6 +22,12 @@ package appeng.block;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockStairs;
|
import net.minecraft.block.BlockStairs;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AEBaseStairBlock extends BlockStairs {
|
public abstract class AEBaseStairBlock extends BlockStairs {
|
||||||
@@ -43,4 +49,9 @@ public abstract class AEBaseStairBlock extends BlockStairs {
|
|||||||
return this.getClass().getSimpleName() + "[" + regName + "]";
|
return this.getClass().getSimpleName() + "[" + regName + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
|||||||
final NBTTagCompound data = memoryCard.getData(heldItem);
|
final NBTTagCompound data = memoryCard.getData(heldItem);
|
||||||
|
|
||||||
if (this.getUnlocalizedName().equals(savedName)) {
|
if (this.getUnlocalizedName().equals(savedName)) {
|
||||||
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data);
|
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
||||||
} else {
|
} else {
|
||||||
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE);
|
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import appeng.tile.networking.TileCableBusTESR;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.state.BlockFaceShape;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -413,6 +414,30 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
|
|||||||
return world.getBlockState(pos);
|
return world.getBlockState(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
|
||||||
|
IFacadeContainer container = this.fc(world, pos);
|
||||||
|
if (container != null) {
|
||||||
|
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(side));
|
||||||
|
if (facade != null) {
|
||||||
|
return BlockFaceShape.SOLID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BlockFaceShape.UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEntityWalk(World world, BlockPos pos, Entity entityIn) {
|
||||||
|
IFacadeContainer container = this.fc(world, pos);
|
||||||
|
if (container != null) {
|
||||||
|
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(EnumFacing.UP));
|
||||||
|
if (facade != null) {
|
||||||
|
facade.getBlockState().getBlock().onEntityWalk(world, pos, entityIn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onEntityWalk(world, pos, entityIn);
|
||||||
|
}
|
||||||
|
|
||||||
public static Class<? extends AEBaseTile> getNoTesrTile() {
|
public static Class<? extends AEBaseTile> getNoTesrTile() {
|
||||||
return noTesrTile;
|
return noTesrTile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,21 +25,31 @@ import appeng.bootstrap.components.StateMapperComponent;
|
|||||||
import appeng.bootstrap.components.TesrComponent;
|
import appeng.bootstrap.components.TesrComponent;
|
||||||
import appeng.client.render.model.AutoRotatingModel;
|
import appeng.client.render.model.AutoRotatingModel;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||||
import net.minecraft.client.renderer.color.IBlockColor;
|
import net.minecraft.client.renderer.color.IBlockColor;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||||
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
|
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||||
import net.minecraftforge.client.model.IModel;
|
import net.minecraftforge.client.model.IModel;
|
||||||
|
import net.minecraftforge.client.resource.IResourceType;
|
||||||
|
import net.minecraftforge.client.resource.ISelectiveResourceReloadListener;
|
||||||
|
import net.minecraftforge.client.resource.VanillaResourceType;
|
||||||
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.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
|
||||||
class BlockRendering implements IBlockRendering {
|
class BlockRendering implements IBlockRendering, ISelectiveResourceReloadListener {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> modelCustomizer;
|
private BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> modelCustomizer;
|
||||||
@@ -56,6 +66,13 @@ class BlockRendering implements IBlockRendering {
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private final Map<String, IModel> builtInModels = new HashMap<>();
|
private final Map<String, IModel> builtInModels = new HashMap<>();
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private final List<IResourceManagerReloadListener> reloads = new ArrayList<>();
|
||||||
|
|
||||||
|
BlockRendering() {
|
||||||
|
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IBlockRendering modelCustomizer(BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer) {
|
public IBlockRendering modelCustomizer(BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer) {
|
||||||
@@ -103,7 +120,11 @@ class BlockRendering implements IBlockRendering {
|
|||||||
} 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) -> new AutoRotatingModel(m));
|
factory.addModelOverride(block.getRegistryName().getResourcePath(), (l, m) -> {
|
||||||
|
AutoRotatingModel model = new AutoRotatingModel(m);
|
||||||
|
BlockRendering.this.reloads.add(model);
|
||||||
|
return model;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : 1.12
|
// TODO : 1.12
|
||||||
@@ -117,4 +138,13 @@ class BlockRendering implements IBlockRendering {
|
|||||||
factory.addBootstrapComponent(new StateMapperComponent(block, this.stateMapper));
|
factory.addBootstrapComponent(new StateMapperComponent(block, this.stateMapper));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void onResourceManagerReload(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate) {
|
||||||
|
if (resourcePredicate.test(VanillaResourceType.MODELS)) {
|
||||||
|
this.reloads.forEach(listener -> listener.onResourceManagerReload(resourceManager));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import appeng.api.parts.CableRenderMode;
|
|||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.client.render.crafting.ItemEncodedPatternBakedModel;
|
||||||
import appeng.client.render.effects.*;
|
import appeng.client.render.effects.*;
|
||||||
import appeng.client.render.model.UVLModelLoader;
|
import appeng.client.render.model.UVLModelLoader;
|
||||||
import appeng.client.render.tesr.InscriberTESR;
|
import appeng.client.render.tesr.InscriberTESR;
|
||||||
@@ -30,9 +31,11 @@ import appeng.client.render.textures.ParticleTextures;
|
|||||||
import appeng.container.interfaces.IJEIGhostIngredients;
|
import appeng.container.interfaces.IJEIGhostIngredients;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.Api;
|
||||||
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.PacketAssemblerAnimation;
|
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
||||||
|
import appeng.core.sync.packets.PacketTerminalUse;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.entity.EntityFloatingItem;
|
import appeng.entity.EntityFloatingItem;
|
||||||
import appeng.entity.EntityTinyTNTPrimed;
|
import appeng.entity.EntityTinyTNTPrimed;
|
||||||
@@ -42,6 +45,8 @@ import appeng.helpers.HighlighterHandler;
|
|||||||
import appeng.helpers.IMouseWheelItem;
|
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.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;
|
||||||
@@ -57,12 +62,19 @@ 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;
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||||
|
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.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;
|
||||||
@@ -71,11 +83,17 @@ import java.util.EnumMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import static appeng.client.KeyBindings.WCT;
|
||||||
|
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 {
|
||||||
private final static String KEY_CATEGORY = "key.appliedenergistics2.category";
|
public final static String KEY_CATEGORY = "key.appliedenergistics2.category";
|
||||||
|
|
||||||
private final EnumMap<ActionKey, KeyBinding> bindings = new EnumMap<>(ActionKey.class);
|
private final EnumMap<ActionKey, KeyBinding> bindings = new EnumMap<>(ActionKey.class);
|
||||||
|
private final List<KeyBinding> keyBindings = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preinit() {
|
public void preinit() {
|
||||||
@@ -96,6 +114,14 @@ public class ClientHelper extends ServerHelper {
|
|||||||
ClientRegistry.registerKeyBinding(binding);
|
ClientRegistry.registerKeyBinding(binding);
|
||||||
this.bindings.put(key, binding);
|
this.bindings.put(key, binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (KeyBindings k : KeyBindings.values()) {
|
||||||
|
ClientRegistry.registerKeyBinding(k.getKeyBinding());
|
||||||
|
this.keyBindings.add(k.getKeyBinding());
|
||||||
|
}
|
||||||
|
|
||||||
|
Api.INSTANCE.definitions().items().encodedPattern().maybeItem().ifPresent(pattern ->
|
||||||
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(ItemEncodedPatternBakedModel.PATTERN_ITEM_COLOR_HANDLER, pattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -314,6 +340,23 @@ public class ClientHelper extends ServerHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
|
public void onInputEvent(final InputEvent.KeyInputEvent event) {
|
||||||
|
for (KeyBinding k : keyBindings) {
|
||||||
|
if (k.isPressed()) {
|
||||||
|
if (k == WT.getKeyBinding()) {
|
||||||
|
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_TERMINAL));
|
||||||
|
} else if (k == WCT.getKeyBinding()) {
|
||||||
|
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_CRAFTING_TERMINAL));
|
||||||
|
} else if (k == WPT.getKeyBinding()) {
|
||||||
|
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_PATTERN_TERMINAL));
|
||||||
|
} else if (k == WFT.getKeyBinding()) {
|
||||||
|
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_FLUID_TERMINAL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTextureStitch(final TextureStitchEvent.Pre event) {
|
public void onTextureStitch(final TextureStitchEvent.Pre event) {
|
||||||
ParticleTextures.registerSprite(event);
|
ParticleTextures.registerSprite(event);
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package appeng.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
|
import net.minecraftforge.client.settings.KeyConflictContext;
|
||||||
|
import net.minecraftforge.client.settings.KeyModifier;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
|
import static appeng.client.ClientHelper.KEY_CATEGORY;
|
||||||
|
|
||||||
|
|
||||||
|
public enum KeyBindings {
|
||||||
|
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)),
|
||||||
|
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));
|
||||||
|
|
||||||
|
private KeyBinding keyBinding;
|
||||||
|
|
||||||
|
KeyBindings(KeyBinding keyBinding) {
|
||||||
|
this.keyBinding = keyBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
public KeyBinding getKeyBinding() {
|
||||||
|
return keyBinding;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,7 +39,9 @@ import appeng.core.sync.packets.PacketSwapSlots;
|
|||||||
import appeng.fluids.client.render.FluidStackSizeRenderer;
|
import appeng.fluids.client.render.FluidStackSizeRenderer;
|
||||||
import appeng.fluids.container.slots.IMEFluidSlot;
|
import appeng.fluids.container.slots.IMEFluidSlot;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.items.misc.ItemEncodedPattern;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@@ -47,6 +49,7 @@ import mezz.jei.api.gui.IGhostIngredientHandler;
|
|||||||
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.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
@@ -66,11 +69,13 @@ 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;
|
||||||
@@ -564,7 +569,10 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
action = (mouseButton == 1) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
action = (mouseButton == 1) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||||
stack = ((SlotME) slot).getAEStack();
|
stack = ((SlotME) slot).getAEStack();
|
||||||
|
|
||||||
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack().isEmpty()) {
|
if (stack != null
|
||||||
|
&& action == InventoryAction.PICKUP_OR_SET_DOWN
|
||||||
|
&& (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown())
|
||||||
|
&& player.inventory.getItemStack().isEmpty()) {
|
||||||
action = InventoryAction.AUTO_CRAFT;
|
action = InventoryAction.AUTO_CRAFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -720,8 +728,14 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
if (slot instanceof SlotFake) {
|
if (slot instanceof SlotFake) {
|
||||||
final ItemStack stack = slot.getStack();
|
final ItemStack stack = slot.getStack();
|
||||||
if (stack != ItemStack.EMPTY) {
|
if (stack != ItemStack.EMPTY) {
|
||||||
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
final PacketInventoryAction p;
|
||||||
final PacketInventoryAction p = new PacketInventoryAction(direction, slot.slotNumber, 0);
|
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) {
|
||||||
|
InventoryAction direction = wheel > 0 ? InventoryAction.DOUBLE : InventoryAction.HALVE;
|
||||||
|
p = new PacketInventoryAction(direction, slot.slotNumber, 0);
|
||||||
|
} else {
|
||||||
|
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
||||||
|
p = new PacketInventoryAction(direction, slot.slotNumber, 0);
|
||||||
|
}
|
||||||
NetworkHandler.instance().sendToServer(p);
|
NetworkHandler.instance().sendToServer(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -887,10 +901,58 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
this.itemRender.zLevel = 0.0F;
|
this.itemRender.zLevel = 0.0F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (s instanceof SlotPlayerInv || s instanceof SlotPlayerHotBar) {
|
||||||
|
if (!is.isEmpty() && is.getItem() instanceof ItemEncodedPattern) {
|
||||||
|
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||||
|
final ItemStack out = iep.getOutput(is);
|
||||||
|
if (!out.isEmpty()) {
|
||||||
|
AppEngSlot appEngSlot = ((AppEngSlot) s);
|
||||||
|
appEngSlot.setDisplay(true);
|
||||||
|
appEngSlot.setReturnAsSingleStack(true);
|
||||||
|
|
||||||
if (s instanceof AppEngSlot) {
|
this.zLevel = 100.0F;
|
||||||
((AppEngSlot) s).setDisplay(true);
|
this.itemRender.zLevel = 100.0F;
|
||||||
|
|
||||||
|
if (!this.isPowered()) {
|
||||||
|
drawRect(s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.zLevel = 0.0F;
|
||||||
|
this.itemRender.zLevel = 0.0F;
|
||||||
|
|
||||||
|
// Annoying but easier than trying to splice into render item
|
||||||
|
super.drawSlot(s);
|
||||||
|
|
||||||
|
if (isShiftKeyDown()) {
|
||||||
|
this.stackSizeRenderer.renderStackSize(this.fontRenderer, AEItemStack.fromItemStack(out), s.xPos, s.yPos);
|
||||||
|
} else {
|
||||||
|
super.drawSlot(s);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.drawSlot(s);
|
||||||
|
}
|
||||||
|
} else if (s instanceof AppEngSlot) {
|
||||||
|
AppEngSlot appEngSlot = ((AppEngSlot) s);
|
||||||
|
appEngSlot.setDisplay(true);
|
||||||
|
appEngSlot.setReturnAsSingleStack(true);
|
||||||
|
|
||||||
|
this.zLevel = 100.0F;
|
||||||
|
this.itemRender.zLevel = 100.0F;
|
||||||
|
|
||||||
|
if (!this.isPowered()) {
|
||||||
|
drawRect(s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.zLevel = 0.0F;
|
||||||
|
this.itemRender.zLevel = 0.0F;
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
super.drawSlot(s);
|
super.drawSlot(s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ package appeng.client.gui;
|
|||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.client.me.SlotME;
|
import appeng.client.me.SlotME;
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.SlotPlayerHotBar;
|
||||||
|
import appeng.container.slot.SlotPlayerInv;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.localization.ButtonToolTips;
|
import appeng.core.localization.ButtonToolTips;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@@ -43,11 +46,12 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
|||||||
protected void renderToolTip(final ItemStack stack, final int x, final int y) {
|
protected void renderToolTip(final ItemStack stack, final int x, final int y) {
|
||||||
final Slot s = this.getSlot(x, y);
|
final Slot s = this.getSlot(x, y);
|
||||||
|
|
||||||
|
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
||||||
|
final List<String> currentToolTip = this.getItemToolTip(stack);
|
||||||
|
|
||||||
if (s instanceof SlotME && !stack.isEmpty()) {
|
if (s instanceof SlotME && !stack.isEmpty()) {
|
||||||
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
|
||||||
|
|
||||||
IAEItemStack myStack = null;
|
IAEItemStack myStack = null;
|
||||||
final List<String> currentToolTip = this.getItemToolTip(stack);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final SlotME theSlotField = (SlotME) s;
|
final SlotME theSlotField = (SlotME) s;
|
||||||
@@ -56,7 +60,7 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (myStack != null) {
|
if (myStack != null) {
|
||||||
if (myStack.getStackSize() > bigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
|
if (myStack.getStackSize() > 1) {
|
||||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize());
|
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize());
|
||||||
final String format = String.format(local, formattedAmount);
|
final String format = String.format(local, formattedAmount);
|
||||||
@@ -72,6 +76,11 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
|||||||
currentToolTip.add(format);
|
currentToolTip.add(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (myStack.isCraftable() && AEConfig.instance().isShowCraftableTooltip()) {
|
||||||
|
final String local = ButtonToolTips.ItemsCraftable.getLocal();
|
||||||
|
currentToolTip.add(TextFormatting.GRAY + local);
|
||||||
|
}
|
||||||
|
|
||||||
this.drawHoveringText(currentToolTip, x, y, this.fontRenderer);
|
this.drawHoveringText(currentToolTip, x, y, this.fontRenderer);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -86,6 +95,15 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (s instanceof AppEngSlot) {
|
||||||
|
if (!(s instanceof SlotPlayerInv) && !(s instanceof SlotPlayerHotBar)) {
|
||||||
|
if (!s.getStack().isEmpty()) {
|
||||||
|
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(s.getStack().getCount());
|
||||||
|
currentToolTip.add(TextFormatting.GRAY + formattedAmount);
|
||||||
|
this.drawHoveringText(currentToolTip, x, y, this.fontRenderer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.renderToolTip(stack, x, y);
|
super.renderToolTip(stack, x, y);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ 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.widgets.GuiNumberBox;
|
||||||
@@ -97,9 +98,8 @@ public class GuiCraftAmount extends AEBaseGui {
|
|||||||
final IParts parts = definitions.parts();
|
final IParts parts = definitions.parts();
|
||||||
|
|
||||||
if (target instanceof WirelessTerminalGuiObject) {
|
if (target instanceof WirelessTerminalGuiObject) {
|
||||||
myIcon = definitions.items().wirelessTerminal().maybeStack(1).orElse(myIcon);
|
myIcon = ((WirelessTerminalGuiObject) target).getItemStack();
|
||||||
|
this.originalGui = (GuiBridge) AEApi.instance().registries().wireless().getWirelessTerminalHandler(myIcon).getGuiHandler(myIcon);
|
||||||
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target instanceof PartTerminal) {
|
if (target instanceof PartTerminal) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package appeng.client.gui.implementations;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
@@ -81,9 +82,11 @@ public class GuiCraftConfirm extends AEBaseGui {
|
|||||||
this.setScrollBar(scrollbar);
|
this.setScrollBar(scrollbar);
|
||||||
|
|
||||||
this.ccc = (ContainerCraftConfirm) this.inventorySlots;
|
this.ccc = (ContainerCraftConfirm) this.inventorySlots;
|
||||||
|
this.ccc.setGui(this);
|
||||||
|
|
||||||
if (te instanceof WirelessTerminalGuiObject) {
|
if (te instanceof WirelessTerminalGuiObject) {
|
||||||
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
ItemStack itemStack = ((WirelessTerminalGuiObject) te).getItemStack();
|
||||||
|
this.OriginalGui = (GuiBridge) AEApi.instance().registries().wireless().getWirelessTerminalHandler(itemStack).getGuiHandler(itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (te instanceof PartTerminal) {
|
if (te instanceof PartTerminal) {
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource {
|
|||||||
protected GuiCraftingCPU(final ContainerCraftingCPU container) {
|
protected GuiCraftingCPU(final ContainerCraftingCPU container) {
|
||||||
super(container);
|
super(container);
|
||||||
this.craftingCpu = container;
|
this.craftingCpu = container;
|
||||||
|
this.craftingCpu.setGui(this);
|
||||||
this.ySize = GUI_HEIGHT;
|
this.ySize = GUI_HEIGHT;
|
||||||
this.xSize = GUI_WIDTH;
|
this.xSize = GUI_WIDTH;
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ 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.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.client.gui.widgets.GuiScrollbar;
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
@@ -33,6 +34,7 @@ import appeng.client.gui.widgets.GuiTabButton;
|
|||||||
import appeng.container.implementations.ContainerCraftingStatus;
|
import appeng.container.implementations.ContainerCraftingStatus;
|
||||||
import appeng.container.implementations.CraftingCPUStatus;
|
import appeng.container.implementations.CraftingCPUStatus;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.features.registries.WirelessRegistry;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
@@ -84,9 +86,8 @@ public class GuiCraftingStatus extends GuiCraftingCPU {
|
|||||||
final IParts parts = definitions.parts();
|
final IParts parts = definitions.parts();
|
||||||
|
|
||||||
if (target instanceof WirelessTerminalGuiObject) {
|
if (target instanceof WirelessTerminalGuiObject) {
|
||||||
this.myIcon = definitions.items().wirelessTerminal().maybeStack(1).orElse(ItemStack.EMPTY);
|
myIcon = ((WirelessTerminalGuiObject) target).getItemStack();
|
||||||
|
this.originalGui = (GuiBridge) AEApi.instance().registries().wireless().getWirelessTerminalHandler(myIcon).getGuiHandler(myIcon);
|
||||||
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target instanceof PartTerminal) {
|
if (target instanceof PartTerminal) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import appeng.api.config.ActionItems;
|
|||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.me.ItemRepo;
|
||||||
import appeng.container.implementations.ContainerCraftingTerm;
|
import appeng.container.implementations.ContainerCraftingTerm;
|
||||||
import appeng.container.slot.SlotCraftingMatrix;
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
|||||||
+17
-10
@@ -19,10 +19,8 @@
|
|||||||
package appeng.client.gui.implementations;
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.ActionItems;
|
import appeng.api.config.ActionItems;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
import appeng.client.gui.widgets.GuiCustomSlot;
|
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||||
@@ -37,6 +35,7 @@ import appeng.core.localization.GuiText;
|
|||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketInventoryAction;
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
import appeng.fluids.client.gui.widgets.GuiFluidTank;
|
import appeng.fluids.client.gui.widgets.GuiFluidTank;
|
||||||
|
import appeng.fluids.helper.DualityFluidInterface;
|
||||||
import appeng.fluids.util.AEFluidStack;
|
import appeng.fluids.util.AEFluidStack;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
import appeng.parts.reporting.PartFluidInterfaceConfigurationTerminal;
|
import appeng.parts.reporting.PartFluidInterfaceConfigurationTerminal;
|
||||||
@@ -89,6 +88,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
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<ClientDCInternalFluidInv> matchedInterfaces = new HashSet<ClientDCInternalFluidInv>();
|
||||||
|
|
||||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||||
|
|
||||||
@@ -156,13 +156,15 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
int extraLines = numUpgradesMap.get(inv);
|
int extraLines = numUpgradesMap.get(inv);
|
||||||
|
|
||||||
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row) {
|
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row) {
|
||||||
for (int z = 0; z < 5; z++) {
|
for (int z = 0; z < DualityFluidInterface.NUMBER_OF_TANKS; z++) {
|
||||||
GuiFluidTank tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16);
|
GuiFluidTank tankSlot;
|
||||||
|
if (!matchedInterfaces.contains(inv) && !this.matchedStacks.contains(inv.getInventory().getFluidInSlot(z + (row * 5)))) {
|
||||||
|
tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16, true);
|
||||||
|
} else {
|
||||||
|
tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16);
|
||||||
|
}
|
||||||
this.guiSlots.add(tankSlot);
|
this.guiSlots.add(tankSlot);
|
||||||
guiFluidTankClientDCInternalFluidInvMap.put(tankSlot, inv);
|
guiFluidTankClientDCInternalFluidInvMap.put(tankSlot, inv);
|
||||||
if (this.matchedStacks.contains(inv.getInventory().getFluidInSlot(z + (row * 5)))) {
|
|
||||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
offset += 18;
|
offset += 18;
|
||||||
@@ -242,7 +244,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
final Object lineObj = this.lines.get(ex + x);
|
final Object lineObj = this.lines.get(ex + x);
|
||||||
if (lineObj instanceof ClientDCInternalFluidInv) {
|
if (lineObj instanceof ClientDCInternalFluidInv) {
|
||||||
GlStateManager.color(1, 1, 1, 1);
|
GlStateManager.color(1, 1, 1, 1);
|
||||||
final int width = 5 * 18;
|
final int width = DualityFluidInterface.NUMBER_OF_TANKS * 18;
|
||||||
|
|
||||||
int extraLines = numUpgradesMap.get(lineObj);
|
int extraLines = numUpgradesMap.get(lineObj);
|
||||||
|
|
||||||
@@ -321,6 +323,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
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();
|
||||||
|
|
||||||
@@ -352,8 +355,12 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
slot++;
|
slot++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (searchFieldInputs.isEmpty() || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||||
|
this.matchedInterfaces.add(entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
// if found, filter skipped or machine name matching the search term, add it
|
||||||
if (found || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
if (found) {
|
||||||
this.byName.put(entry.getName(), entry);
|
this.byName.put(entry.getName(), entry);
|
||||||
cachedSearch.add(entry);
|
cachedSearch.add(entry);
|
||||||
} else {
|
} else {
|
||||||
@@ -441,7 +448,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
ClientDCInternalFluidInv o = this.byId.get(id);
|
ClientDCInternalFluidInv o = this.byId.get(id);
|
||||||
|
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
this.byId.put(id, o = new ClientDCInternalFluidInv(5, id, sortBy, string, 64));
|
this.byId.put(id, o = new ClientDCInternalFluidInv(DualityFluidInterface.NUMBER_OF_TANKS, id, sortBy, string, 1000));
|
||||||
this.refreshList = true;
|
this.refreshList = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+22
-6
@@ -52,6 +52,7 @@ 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.util.text.TextComponentString;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -60,6 +61,7 @@ import java.util.List;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
|
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackFromNBT;
|
||||||
|
|
||||||
|
|
||||||
public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEIGhostIngredients {
|
public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEIGhostIngredients {
|
||||||
@@ -77,6 +79,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
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<>();
|
||||||
|
|
||||||
@@ -147,7 +150,9 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
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));
|
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, 0x2A00FF00);
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
|
||||||
|
} else if (!matchedInterfaces.contains(inv)) {
|
||||||
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
@@ -213,8 +218,14 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
if (slot instanceof SlotDisconnected) {
|
if (slot instanceof SlotDisconnected) {
|
||||||
final ItemStack stack = slot.getStack();
|
final ItemStack stack = slot.getStack();
|
||||||
if (stack != ItemStack.EMPTY) {
|
if (stack != ItemStack.EMPTY) {
|
||||||
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
final PacketInventoryAction p;
|
||||||
final PacketInventoryAction p = new PacketInventoryAction(direction, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) {
|
||||||
|
InventoryAction direction = wheel > 0 ? InventoryAction.DOUBLE : InventoryAction.HALVE;
|
||||||
|
p = new PacketInventoryAction(direction, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
||||||
|
} else {
|
||||||
|
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
||||||
|
p = new PacketInventoryAction(direction, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
||||||
|
}
|
||||||
NetworkHandler.instance().sendToServer(p);
|
NetworkHandler.instance().sendToServer(p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -289,7 +300,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
||||||
final String which = Integer.toString(x);
|
final String which = Integer.toString(x);
|
||||||
if (invData.hasKey(which)) {
|
if (invData.hasKey(which)) {
|
||||||
current.getInventory().setStackInSlot(x, new ItemStack(invData.getCompoundTag(which)));
|
current.getInventory().setStackInSlot(x, stackFromNBT(invData.getCompoundTag(which)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final NumberFormatException ignored) {
|
} catch (final NumberFormatException ignored) {
|
||||||
@@ -314,6 +325,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
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();
|
||||||
|
|
||||||
@@ -345,7 +357,11 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
// if found, filter skipped or machine name matching the search term, add it
|
||||||
if (found || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
if (searchFieldInputs.isEmpty() || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||||
|
this.matchedInterfaces.add(entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
this.byName.put(entry.getName(), entry);
|
this.byName.put(entry.getName(), entry);
|
||||||
cachedSearch.add(entry);
|
cachedSearch.add(entry);
|
||||||
} else {
|
} else {
|
||||||
@@ -435,7 +451,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
ClientDCInternalInv o = this.byId.get(id);
|
ClientDCInternalInv o = this.byId.get(id);
|
||||||
|
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
this.byId.put(id, o = new ClientDCInternalInv(DualityInterface.NUMBER_OF_CONFIG_SLOTS, id, sortBy, string, 64));
|
this.byId.put(id, o = new ClientDCInternalInv(DualityInterface.NUMBER_OF_CONFIG_SLOTS, id, sortBy, string, 512));
|
||||||
this.refreshList = true;
|
this.refreshList = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package appeng.client.gui.implementations;
|
|||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.ActionItems;
|
import appeng.api.config.ActionItems;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.TerminalStyle;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
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;
|
||||||
@@ -30,6 +31,8 @@ import appeng.client.gui.widgets.MEGuiTextField;
|
|||||||
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.slot.AppEngSlot;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
import appeng.helpers.DualityInterface;
|
import appeng.helpers.DualityInterface;
|
||||||
import appeng.parts.reporting.PartInterfaceTerminal;
|
import appeng.parts.reporting.PartInterfaceTerminal;
|
||||||
@@ -39,6 +42,7 @@ 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;
|
||||||
@@ -46,20 +50,35 @@ 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.util.text.TextComponentString;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import net.minecraftforge.fml.common.Loader;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
public class GuiInterfaceTerminal extends AEBaseGui {
|
public class GuiInterfaceTerminal extends AEBaseGui {
|
||||||
|
|
||||||
private static final int LINES_ON_PAGE = 6;
|
private int rows = 6;
|
||||||
|
|
||||||
// TODO: copied from GuiMEMonitorable. It looks not changed, maybe unneeded?
|
// TODO: copied from GuiMEMonitorable. It looks not changed, maybe unneeded?
|
||||||
private final int offsetX = 21;
|
private final int offsetX = 21;
|
||||||
|
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();
|
||||||
@@ -69,7 +88,7 @@ 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 boolean refreshList = false;
|
private boolean refreshList = false;
|
||||||
@@ -78,7 +97,10 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
private final PartInterfaceTerminal partInterfaceTerminal;
|
private final PartInterfaceTerminal partInterfaceTerminal;
|
||||||
private GuiButton guiButtonHide;
|
private GuiButton guiButtonHide;
|
||||||
private GuiButton guiButtonNextAssembler;
|
private GuiButton guiButtonNextAssembler;
|
||||||
|
private GuiImgButton terminalStyleBox;
|
||||||
|
|
||||||
private final HashMap<ClientDCInternalInv, Integer> dimHashMap = new HashMap<>();
|
private final HashMap<ClientDCInternalInv, Integer> dimHashMap = new HashMap<>();
|
||||||
|
private int drawnRows = 0;
|
||||||
|
|
||||||
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));
|
||||||
@@ -88,10 +110,33 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
this.setScrollBar(scrollbar);
|
this.setScrollBar(scrollbar);
|
||||||
this.xSize = 208;
|
this.xSize = 208;
|
||||||
this.ySize = 255;
|
this.ySize = 255;
|
||||||
|
this.setReservedSpace(82);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
|
this.maxRows = AEConfig.instance()
|
||||||
|
.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.getScrollBar().setLeft(189);
|
||||||
@@ -114,6 +159,17 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
|
|
||||||
this.searchFieldInputs.setText(partInterfaceTerminal.in);
|
this.searchFieldInputs.setText(partInterfaceTerminal.in);
|
||||||
this.searchFieldOutputs.setText(partInterfaceTerminal.out);
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void repositionSlot(final AppEngSlot s) {
|
||||||
|
this.ySize = 82 + 14 + this.drawnRows * 18 + this.reservedSpace;
|
||||||
|
|
||||||
|
s.yPos = s.getY() + this.ySize - 112;
|
||||||
|
s.xPos = s.getX() + 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -122,13 +178,18 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
super.onGuiClosed();
|
super.onGuiClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Rectangle> getJEIExclusionArea() {
|
||||||
|
Rectangle tallButton = new Rectangle(this.guiLeft - 18, this.guiTop + 24 + jeiOffset, 18, 18);
|
||||||
|
List<Rectangle> area = new ArrayList<>();
|
||||||
|
area.add(tallButton);
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
@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.buttonList.clear();
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
this.guiButtonNextAssembler = new GuiImgButton(guiLeft + 123, guiTop + 25, Settings.ACTIONS, ActionItems.FREE_MOLECULAR_SLOT_SHORTCUT);
|
||||||
@@ -137,11 +198,23 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
guiButtonHide = new GuiImgButton(guiLeft + 141, guiTop + 25, Settings.ACTIONS, this.partInterfaceTerminal.onlyInterfacesWithFreeSlots ? ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF : ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON);
|
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(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);
|
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 offset = 52;
|
||||||
int linesDraw = 0;
|
int linesDraw = 0;
|
||||||
for (int x = 0; x < LINES_ON_PAGE && linesDraw < LINES_ON_PAGE && 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) {
|
||||||
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
|
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
|
||||||
@@ -151,11 +224,13 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
this.buttonList.add(guiButton);
|
this.buttonList.add(guiButton);
|
||||||
int extraLines = numUpgradesMap.get(inv);
|
int extraLines = numUpgradesMap.get(inv);
|
||||||
|
|
||||||
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++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));
|
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, 0x2A00FF00);
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
|
||||||
|
} else if (!matchedInterfaces.contains(inv)) {
|
||||||
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
@@ -224,6 +299,25 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
mc.player.closeScreen();
|
mc.player.closeScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (btn instanceof GuiImgButton) {
|
||||||
|
final boolean backwards = Mouse.isButtonDown(1);
|
||||||
|
|
||||||
|
final GuiImgButton iBtn = (GuiImgButton) btn;
|
||||||
|
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||||
|
final Enum cv = iBtn.getCurrentValue();
|
||||||
|
final Enum next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||||
|
|
||||||
|
if (btn == this.terminalStyleBox) {
|
||||||
|
AEConfig.instance().getConfigManager().putSetting(iBtn.getSetting(), next);
|
||||||
|
}
|
||||||
|
|
||||||
|
iBtn.set(next);
|
||||||
|
|
||||||
|
if (next.getClass() == TerminalStyle.class) {
|
||||||
|
this.reinitalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (btn == guiButtonHide) {
|
if (btn == guiButtonHide) {
|
||||||
partInterfaceTerminal.onlyInterfacesWithFreeSlots = !partInterfaceTerminal.onlyInterfacesWithFreeSlots;
|
partInterfaceTerminal.onlyInterfacesWithFreeSlots = !partInterfaceTerminal.onlyInterfacesWithFreeSlots;
|
||||||
this.refreshList();
|
this.refreshList();
|
||||||
@@ -244,15 +338,21 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void reinitalize() {
|
||||||
|
this.buttonList.clear();
|
||||||
|
this.initGui();
|
||||||
|
}
|
||||||
|
|
||||||
@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");
|
||||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
//split the texture for the top
|
||||||
|
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, 166);
|
||||||
|
|
||||||
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 < LINES_ON_PAGE && linesDraw < LINES_ON_PAGE && ex + x < this.lines.size(); x++) {
|
for (int x = 0; x < 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);
|
||||||
@@ -260,16 +360,38 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
|
|
||||||
int extraLines = numUpgradesMap.get(lineObj);
|
int extraLines = numUpgradesMap.get(lineObj);
|
||||||
|
|
||||||
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++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);
|
||||||
|
|
||||||
if (this.searchFieldInputs != null) {
|
if (this.searchFieldInputs != null) {
|
||||||
this.searchFieldInputs.drawTextBox();
|
this.searchFieldInputs.drawTextBox();
|
||||||
@@ -319,7 +441,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
||||||
final String which = Integer.toString(x);
|
final String which = Integer.toString(x);
|
||||||
if (invData.hasKey(which)) {
|
if (invData.hasKey(which)) {
|
||||||
current.getInventory().setStackInSlot(x, new ItemStack(invData.getCompoundTag(which)));
|
current.getInventory().setStackInSlot(x, stackFromNBT(invData.getCompoundTag(which)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final NumberFormatException ignored) {
|
} catch (final NumberFormatException ignored) {
|
||||||
@@ -344,6 +466,7 @@ 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();
|
||||||
@@ -393,7 +516,13 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
// if found, filter skipped or machine name matching the search term, add it
|
||||||
if (found || (entry.getName().toLowerCase().contains(searchFieldInputs) && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
|
if ((searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty()) ||
|
||||||
|
!searchFieldInputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldInputs) ||
|
||||||
|
(!searchFieldOutputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
|
||||||
|
this.matchedInterfaces.add(entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
if (!partInterfaceTerminal.onlyInterfacesWithFreeSlots) {
|
if (!partInterfaceTerminal.onlyInterfacesWithFreeSlots) {
|
||||||
this.byName.put(entry.getName(), entry);
|
this.byName.put(entry.getName(), entry);
|
||||||
cachedSearch.add(entry);
|
cachedSearch.add(entry);
|
||||||
@@ -435,7 +564,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
final NBTTagCompound encodedValue = itemStack.getTagCompound();
|
final NBTTagCompound encodedValue = itemStack.getTagCompound();
|
||||||
|
|
||||||
if (encodedValue == null) {
|
if (encodedValue == null) {
|
||||||
return false;
|
return searchTerm.matches(GuiText.InvalidPattern.getLocal());
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagList tag = new NBTTagList();
|
NBTTagList tag = new NBTTagList();
|
||||||
@@ -513,4 +642,12 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getReservedSpace() {
|
||||||
|
return this.reservedSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setReservedSpace(final int reservedSpace) {
|
||||||
|
this.reservedSpace = reservedSpace;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ 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.*;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
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;
|
||||||
@@ -73,7 +77,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
private static int craftingGridOffsetY;
|
private static int craftingGridOffsetY;
|
||||||
|
|
||||||
private static String memoryText = "";
|
private static String memoryText = "";
|
||||||
private final ItemRepo repo;
|
protected final ItemRepo repo;
|
||||||
private final int offsetX = 9;
|
private final int offsetX = 9;
|
||||||
private final int lowerTextureOffset = 0;
|
private final int lowerTextureOffset = 0;
|
||||||
private final IConfigManager configSrc;
|
private final IConfigManager configSrc;
|
||||||
@@ -99,7 +103,6 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
private int currentMouseY = 0;
|
private int currentMouseY = 0;
|
||||||
private boolean delayedUpdate;
|
private boolean delayedUpdate;
|
||||||
|
|
||||||
private boolean updateView = true;
|
|
||||||
protected int jeiOffset = Loader.isModLoaded("jei") ? 24 : 0;
|
protected int jeiOffset = Loader.isModLoaded("jei") ? 24 : 0;
|
||||||
|
|
||||||
public GuiMEMonitorable(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
public GuiMEMonitorable(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
@@ -158,7 +161,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.delayedUpdate) {
|
if (!this.delayedUpdate) {
|
||||||
this.updateView = true;
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +319,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
this.searchField.setText(memoryText);
|
this.searchField.setText(memoryText);
|
||||||
this.searchField.selectAll();
|
this.searchField.selectAll();
|
||||||
this.repo.setSearchString(memoryText);
|
this.repo.setSearchString(memoryText);
|
||||||
this.updateView = true;
|
this.setScrollBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
craftingGridOffsetX = Integer.MAX_VALUE;
|
craftingGridOffsetX = Integer.MAX_VALUE;
|
||||||
@@ -376,7 +380,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
|
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
|
||||||
this.searchField.setText("");
|
this.searchField.setText("");
|
||||||
this.repo.setSearchString("");
|
this.repo.setSearchString("");
|
||||||
this.updateView = true;
|
this.setScrollBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.mouseClicked(xCoord, yCoord, btn);
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
@@ -436,7 +440,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
return this.repo.hasPower();
|
return this.repo.hasPower();
|
||||||
}
|
}
|
||||||
|
|
||||||
int getMaxRows() {
|
protected int getMaxRows() {
|
||||||
return AEConfig.instance().getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
|
return AEConfig.instance().getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +474,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
|
|
||||||
if (this.searchField.textboxKeyTyped(character, key)) {
|
if (this.searchField.textboxKeyTyped(character, key)) {
|
||||||
this.repo.setSearchString(this.searchField.getText());
|
this.repo.setSearchString(this.searchField.getText());
|
||||||
this.updateView = true;
|
this.setScrollBar();
|
||||||
// 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 {
|
||||||
@@ -497,7 +501,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
this.delayedUpdate = false;
|
this.delayedUpdate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.delayedUpdate && updateView) {
|
if (!this.delayedUpdate) {
|
||||||
this.repo.updateView();
|
this.repo.updateView();
|
||||||
this.setScrollBar();
|
this.setScrollBar();
|
||||||
}
|
}
|
||||||
@@ -533,7 +537,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateView = true;
|
this.repo.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
int getReservedSpace() {
|
int getReservedSpace() {
|
||||||
|
|||||||
@@ -20,22 +20,17 @@ 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, new ContainerMEPortableCell(inventoryPlayer, te));
|
super(inventoryPlayer, te);
|
||||||
}
|
|
||||||
|
|
||||||
int defaultGetMaxRows() {
|
|
||||||
return super.getMaxRows();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
int getMaxRows() {
|
protected int getMaxRows() {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,11 +51,10 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
|||||||
|
|
||||||
private final ItemRepo repo;
|
private final ItemRepo repo;
|
||||||
private final int rows = 4;
|
private final int rows = 4;
|
||||||
|
private final ContainerNetworkStatus cns;
|
||||||
private GuiImgButton units;
|
private GuiImgButton units;
|
||||||
private int tooltip = -1;
|
private int tooltip = -1;
|
||||||
|
|
||||||
private boolean updateView = true;
|
|
||||||
|
|
||||||
public GuiNetworkStatus(final InventoryPlayer inventoryPlayer, final INetworkTool te) {
|
public GuiNetworkStatus(final InventoryPlayer inventoryPlayer, final INetworkTool te) {
|
||||||
super(new ContainerNetworkStatus(inventoryPlayer, te));
|
super(new ContainerNetworkStatus(inventoryPlayer, te));
|
||||||
final GuiScrollbar scrollbar = new GuiScrollbar();
|
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||||
@@ -65,6 +64,9 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
|||||||
this.ySize = 153;
|
this.ySize = 153;
|
||||||
this.xSize = 195;
|
this.xSize = 195;
|
||||||
this.repo.setRowSize(5);
|
this.repo.setRowSize(5);
|
||||||
|
|
||||||
|
this.cns = (ContainerNetworkStatus) this.inventorySlots;
|
||||||
|
this.cns.setGui(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -204,17 +206,9 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
|||||||
for (final IAEItemStack is : list) {
|
for (final IAEItemStack is : list) {
|
||||||
this.repo.postUpdate(is);
|
this.repo.postUpdate(is);
|
||||||
}
|
}
|
||||||
this.updateView = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
this.repo.updateView();
|
||||||
public void updateScreen() {
|
this.setScrollBar();
|
||||||
if (updateView) {
|
|
||||||
this.repo.updateView();
|
|
||||||
this.setScrollBar();
|
|
||||||
updateView = false;
|
|
||||||
}
|
|
||||||
super.updateScreen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setScrollBar() {
|
private void setScrollBar() {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class GuiOreDictStorageBus extends AEBaseGui {
|
|||||||
private GuiImgButton partition;
|
private GuiImgButton partition;
|
||||||
private GuiImgButton storageFilter;
|
private GuiImgButton storageFilter;
|
||||||
private GuiImgButton rwMode;
|
private GuiImgButton rwMode;
|
||||||
private static final Pattern ORE_DICTIONARY_FILTER = Pattern.compile("[(!]* *[0-9a-zA-Z*]* *\\)*( *[&|^]? *[(!]* *[0-9a-zA-Z*]* *\\)*)*");
|
private static final Pattern ORE_DICTIONARY_FILTER = Pattern.compile("[0-9a-zA-Z* &|^!()]*");
|
||||||
private MEGuiTextField searchFieldInputs;
|
private MEGuiTextField searchFieldInputs;
|
||||||
|
|
||||||
public GuiOreDictStorageBus(final InventoryPlayer inventoryPlayer, final PartOreDicStorageBus te) {
|
public GuiOreDictStorageBus(final InventoryPlayer inventoryPlayer, final PartOreDicStorageBus te) {
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ import appeng.api.config.Settings;
|
|||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
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.container.implementations.ContainerPatternEncoder;
|
||||||
import appeng.container.implementations.ContainerPatternTerm;
|
import appeng.container.implementations.ContainerPatternTerm;
|
||||||
|
import appeng.container.implementations.ContainerWirelessPatternTerminal;
|
||||||
import appeng.container.interfaces.IJEIGhostIngredients;
|
import appeng.container.interfaces.IJEIGhostIngredients;
|
||||||
import appeng.container.slot.AppEngSlot;
|
import appeng.container.slot.AppEngSlot;
|
||||||
import appeng.container.slot.SlotFake;
|
import appeng.container.slot.SlotFake;
|
||||||
@@ -35,6 +37,7 @@ import appeng.core.sync.network.NetworkHandler;
|
|||||||
import appeng.core.sync.packets.PacketInventoryAction;
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
import mezz.jei.api.gui.IGhostIngredientHandler.Target;
|
import mezz.jei.api.gui.IGhostIngredientHandler.Target;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
@@ -60,7 +63,7 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
|
|||||||
private static final String CRAFTMODE_CRFTING = "1";
|
private static final String CRAFTMODE_CRFTING = "1";
|
||||||
private static final String CRAFTMODE_PROCESSING = "0";
|
private static final String CRAFTMODE_PROCESSING = "0";
|
||||||
|
|
||||||
private final ContainerPatternTerm container;
|
private final ContainerPatternEncoder container;
|
||||||
|
|
||||||
private GuiTabButton tabCraftButton;
|
private GuiTabButton tabCraftButton;
|
||||||
private GuiTabButton tabProcessButton;
|
private GuiTabButton tabProcessButton;
|
||||||
@@ -83,6 +86,12 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
|
|||||||
this.setReservedSpace(81);
|
this.setReservedSpace(81);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GuiPatternTerm(final InventoryPlayer inventoryPlayer, WirelessTerminalGuiObject te, final ContainerWirelessPatternTerminal wpt) {
|
||||||
|
super(inventoryPlayer, te, wpt);
|
||||||
|
this.container = (ContainerWirelessPatternTerminal) this.inventorySlots;
|
||||||
|
this.setReservedSpace(81);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void actionPerformed(final GuiButton btn) {
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
super.actionPerformed(btn);
|
super.actionPerformed(btn);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class GuiQNB 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/chest.png");
|
this.bindTexture("guis/qbgui.png");
|
||||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* 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>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.api.config.ActionItems;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.me.ItemRepo;
|
||||||
|
import appeng.container.implementations.ContainerWirelessCraftingTerminal;
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
|
||||||
|
|
||||||
|
public class GuiWirelessCraftingTerminal extends GuiMEMonitorable {
|
||||||
|
|
||||||
|
private GuiImgButton clearBtn;
|
||||||
|
|
||||||
|
public GuiWirelessCraftingTerminal(final InventoryPlayer inventoryPlayer, final WirelessTerminalGuiObject te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerWirelessCraftingTerminal(inventoryPlayer, te));
|
||||||
|
this.setReservedSpace(73);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
|
||||||
|
if (this.clearBtn == btn) {
|
||||||
|
Slot s = null;
|
||||||
|
final Container c = this.inventorySlots;
|
||||||
|
for (final Object j : c.inventorySlots) {
|
||||||
|
if (j instanceof SlotCraftingMatrix) {
|
||||||
|
s = (Slot) j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s != null) {
|
||||||
|
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.MOVE_REGION, s.slotNumber, 0);
|
||||||
|
NetworkHandler.instance().sendToServer(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.buttonList.add(this.clearBtn = new GuiImgButton(this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH));
|
||||||
|
this.clearBtn.setHalfSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
this.fontRenderer.drawString(GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(), 4210752);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
this.bindTexture("guis/wirelessupgrades.png");
|
||||||
|
Gui.drawModalRectWithCustomSizedTexture(offsetX + 198, offsetY + 127, 0, 0, 32, 32, 32, 32);
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
return "guis/crafting.png";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.container.implementations.ContainerWirelessPatternTerminal;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
|
||||||
|
public class GuiWirelessPatternTerminal extends GuiPatternTerm {
|
||||||
|
|
||||||
|
public GuiWirelessPatternTerminal(final InventoryPlayer inventoryPlayer, final WirelessTerminalGuiObject te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerWirelessPatternTerminal(inventoryPlayer, te));
|
||||||
|
this.setReservedSpace(81);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
this.bindTexture("guis/wirelessupgrades.png");
|
||||||
|
Gui.drawModalRectWithCustomSizedTexture(offsetX + 198, offsetY + 127, 0, 0, 32, 32, 32, 32);
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,17 +20,22 @@ package appeng.client.gui.implementations;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
|
import appeng.container.implementations.ContainerWirelessTerm;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
|
||||||
public class GuiWirelessTerm extends GuiMEPortableCell {
|
public class GuiWirelessTerm extends GuiMEMonitorable {
|
||||||
|
|
||||||
public GuiWirelessTerm(final InventoryPlayer inventoryPlayer, final IPortableCell te) {
|
public GuiWirelessTerm(final InventoryPlayer inventoryPlayer, final WirelessTerminalGuiObject te) {
|
||||||
super(inventoryPlayer, te);
|
super(inventoryPlayer, te, new ContainerWirelessTerm(inventoryPlayer, te));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
int getMaxRows() {
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
return this.defaultGetMaxRows();
|
this.bindTexture("guis/wirelessupgrades.png");
|
||||||
|
Gui.drawModalRectWithCustomSizedTexture(offsetX + 198, offsetY + 127, 0, 0, 32, 32, 32, 32);
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ public class GuiNumberBox extends GuiTextField {
|
|||||||
final String original = this.getText();
|
final String original = this.getText();
|
||||||
super.writeText(selectedText);
|
super.writeText(selectedText);
|
||||||
|
|
||||||
|
if (this.getText().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (this.type == int.class || this.type == Integer.class) {
|
if (this.type == int.class || this.type == Integer.class) {
|
||||||
Integer.parseInt(this.getText());
|
Integer.parseInt(this.getText());
|
||||||
|
|||||||
@@ -37,32 +37,38 @@ import net.minecraft.item.ItemStack;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
public class ItemRepo {
|
public class ItemRepo {
|
||||||
|
|
||||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||||
private final List<IAEItemStack> view;
|
private List<IAEItemStack> view = new ArrayList<>();
|
||||||
private final IScrollSource src;
|
private final IScrollSource src;
|
||||||
private final ISortSource sortSrc;
|
private final ISortSource sortSrc;
|
||||||
|
|
||||||
private int rowSize = 9;
|
private int rowSize = 9;
|
||||||
|
|
||||||
private volatile String searchString = "";
|
private String searchString = "";
|
||||||
private IPartitionList<IAEItemStack> myPartitionList;
|
private IPartitionList<IAEItemStack> myPartitionList;
|
||||||
private String innerSearch = "";
|
private String innerSearch = "";
|
||||||
private boolean hasPower;
|
private boolean hasPower;
|
||||||
|
|
||||||
|
private Enum lastView;
|
||||||
|
private Enum lastSearchMode;
|
||||||
|
private Enum lastSortBy;
|
||||||
|
private Enum lastSortDir;
|
||||||
|
private String lastSearch = "";
|
||||||
|
|
||||||
|
private boolean resort = true;
|
||||||
|
private boolean changed = false;
|
||||||
|
|
||||||
|
|
||||||
public ItemRepo(final IScrollSource src, final ISortSource sortSrc) {
|
public ItemRepo(final IScrollSource src, final ISortSource sortSrc) {
|
||||||
this.src = src;
|
this.src = src;
|
||||||
this.sortSrc = sortSrc;
|
this.sortSrc = sortSrc;
|
||||||
|
|
||||||
this.view = Collections.synchronizedList(new ArrayList<>());
|
|
||||||
list.forEach(this.view::add);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAEItemStack getReferenceItem(int idx) {
|
public IAEItemStack getReferenceItem(int idx) {
|
||||||
@@ -87,6 +93,8 @@ public class ItemRepo {
|
|||||||
} else {
|
} else {
|
||||||
this.list.add(is);
|
this.list.add(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getItemCount(final IAEItemStack is) {
|
public long getItemCount(final IAEItemStack is) {
|
||||||
@@ -96,126 +104,156 @@ public class ItemRepo {
|
|||||||
|
|
||||||
public void setViewCell(final ItemStack[] list) {
|
public void setViewCell(final ItemStack[] list) {
|
||||||
this.myPartitionList = ItemViewCell.createFilter(list);
|
this.myPartitionList = ItemViewCell.createFilter(list);
|
||||||
this.updateView();
|
this.changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompletableFuture<Void> searchTask = null;
|
|
||||||
|
|
||||||
public void updateView() {
|
public void updateView() {
|
||||||
if (searchTask != null) {
|
|
||||||
|
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||||
|
|
||||||
|
if (lastView != viewMode) {
|
||||||
|
resort = true;
|
||||||
|
lastView = viewMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_MODE);
|
||||||
|
if (lastSearchMode != searchMode) {
|
||||||
|
resort = true;
|
||||||
|
lastSearchMode = searchMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH || searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP) {
|
||||||
|
this.updateJEI(this.searchString);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lastSearch.equals(searchString)) {
|
||||||
|
resort = true;
|
||||||
|
lastSearch = searchString;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Enum sortBy = this.sortSrc.getSortBy();
|
||||||
|
final Enum sortDir = this.sortSrc.getSortDir();
|
||||||
|
|
||||||
|
if (lastSortBy != sortBy) {
|
||||||
|
resort = true;
|
||||||
|
lastSortBy = sortBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastSortDir != sortDir) {
|
||||||
|
resort = true;
|
||||||
|
lastSortDir = sortDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed || resort) {
|
||||||
|
changed = false;
|
||||||
|
resort = false;
|
||||||
|
|
||||||
|
view = new ArrayList<>();
|
||||||
|
|
||||||
|
ItemSorters.setDirection((appeng.api.config.SortDir) sortDir);
|
||||||
|
ItemSorters.init();
|
||||||
|
|
||||||
|
Comparator<IAEItemStack> c = getComparator(sortBy);
|
||||||
|
|
||||||
|
for (IAEItemStack is : this.list) {
|
||||||
|
addIAE(is, viewMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
view.sort(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Comparator<IAEItemStack> getComparator(Enum sortBy) {
|
||||||
|
Comparator<IAEItemStack> c;
|
||||||
|
|
||||||
|
if (sortBy == SortOrder.MOD) {
|
||||||
|
c = ItemSorters.CONFIG_BASED_SORT_BY_MOD;
|
||||||
|
} else if (sortBy == SortOrder.AMOUNT) {
|
||||||
|
c = ItemSorters.CONFIG_BASED_SORT_BY_SIZE;
|
||||||
|
} else if (sortBy == SortOrder.INVTWEAKS) {
|
||||||
|
if (InventoryBogoSortModule.isLoaded()) {
|
||||||
|
c = InventoryBogoSortModule.COMPARATOR;
|
||||||
|
} else {
|
||||||
|
c = ItemSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
c = ItemSorters.CONFIG_BASED_SORT_BY_NAME;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addIAE(IAEItemStack is, Enum viewMode) {
|
||||||
|
|
||||||
|
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
|
||||||
|
|
||||||
|
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
|
||||||
|
|
||||||
|
boolean searchMod = false;
|
||||||
|
|
||||||
|
this.innerSearch = searchString.toLowerCase();
|
||||||
|
if (this.innerSearch.startsWith("@")) {
|
||||||
|
searchMod = true;
|
||||||
|
this.innerSearch = this.innerSearch.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Pattern m = null;
|
||||||
|
try {
|
||||||
|
m = Pattern.compile(this.innerSearch, Pattern.CASE_INSENSITIVE);
|
||||||
|
} catch (final Throwable ignore) {
|
||||||
|
try {
|
||||||
|
m = Pattern.compile(Pattern.quote(this.innerSearch), Pattern.CASE_INSENSITIVE);
|
||||||
|
} catch (final Throwable __) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.myPartitionList != null) {
|
||||||
|
if (!this.myPartitionList.isListed(is)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since sortSrc is final, so we can safely call it inside lambda
|
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
|
||||||
searchTask = CompletableFuture.supplyAsync(() -> {
|
return;
|
||||||
IItemList<IAEItemStack> list = this.list.clone();
|
}
|
||||||
List<IAEItemStack> view = new ArrayList<>(list.size());
|
|
||||||
Enum viewMode = this.sortSrc.getSortDisplay();
|
|
||||||
|
|
||||||
boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
|
final String dspName = (searchMod ? Platform.getModId(is) : Platform.getItemDisplayName(is)).toLowerCase();
|
||||||
|
boolean foundMatchingItemStack = true;
|
||||||
|
|
||||||
boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
|
for (String term : innerSearch.split(" ")) {
|
||||||
|
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
|
||||||
boolean searchMod = false;
|
term = term.substring(1);
|
||||||
|
if (dspName.contains(term)) {
|
||||||
String innerSearch = searchString.toLowerCase();
|
foundMatchingItemStack = false;
|
||||||
if (innerSearch.startsWith("@")) {
|
break;
|
||||||
searchMod = true;
|
}
|
||||||
innerSearch = innerSearch.substring(1);
|
} else if (!dspName.contains(term)) {
|
||||||
|
foundMatchingItemStack = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Pattern m = null;
|
if (terminalSearchToolTips && !foundMatchingItemStack) {
|
||||||
try {
|
final List<String> tooltip = Platform.getTooltip(is);
|
||||||
m = Pattern.compile(innerSearch, Pattern.CASE_INSENSITIVE);
|
for (final String line : tooltip) {
|
||||||
} catch (final Throwable ignore) {
|
if (m.matcher(line).find()) {
|
||||||
try {
|
foundMatchingItemStack = true;
|
||||||
m = Pattern.compile(Pattern.quote(innerSearch), Pattern.CASE_INSENSITIVE);
|
break;
|
||||||
} catch (final Throwable __) {
|
|
||||||
return Collections.<IAEItemStack>emptyList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundMatchingItemStack) {
|
||||||
for (IAEItemStack is : list) {
|
if (needsZeroCopy) {
|
||||||
if (this.myPartitionList != null) {
|
is = is.copy();
|
||||||
if (!this.myPartitionList.isListed(is)) {
|
is.setStackSize(0);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String dspName = (searchMod ? Platform.getModId(is) : Platform.getItemDisplayName(is)).toLowerCase();
|
|
||||||
boolean foundMatchingItemStack = true;
|
|
||||||
|
|
||||||
for (String term : innerSearch.split(" ")) {
|
|
||||||
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
|
|
||||||
term = term.substring(1);
|
|
||||||
if (dspName.contains(term)) {
|
|
||||||
foundMatchingItemStack = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (!dspName.contains(term)) {
|
|
||||||
foundMatchingItemStack = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (terminalSearchToolTips && !foundMatchingItemStack) {
|
|
||||||
final List<String> tooltip = Platform.getTooltip(is);
|
|
||||||
for (final String line : tooltip) {
|
|
||||||
if (m.matcher(line).find()) {
|
|
||||||
foundMatchingItemStack = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundMatchingItemStack) {
|
|
||||||
if (needsZeroCopy) {
|
|
||||||
is = is.copy();
|
|
||||||
is.setStackSize(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
view.add(is);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this.view.add(is);
|
||||||
final Enum SortBy = this.sortSrc.getSortBy();
|
}
|
||||||
final Enum SortDir = this.sortSrc.getSortDir();
|
|
||||||
|
|
||||||
ItemSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
|
||||||
ItemSorters.init();
|
|
||||||
|
|
||||||
if (SortBy == SortOrder.MOD) {
|
|
||||||
view.sort(ItemSorters.CONFIG_BASED_SORT_BY_MOD);
|
|
||||||
} else if (SortBy == SortOrder.AMOUNT) {
|
|
||||||
view.sort(ItemSorters.CONFIG_BASED_SORT_BY_SIZE);
|
|
||||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
|
||||||
if (InventoryBogoSortModule.isLoaded()) {
|
|
||||||
Collections.sort(this.view, InventoryBogoSortModule.COMPARATOR);
|
|
||||||
} else {
|
|
||||||
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
view.sort(ItemSorters.CONFIG_BASED_SORT_BY_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}).thenAcceptAsync(view -> {
|
|
||||||
this.view.clear();
|
|
||||||
this.view.addAll(view);
|
|
||||||
}).thenRunAsync(() -> {
|
|
||||||
this.searchTask = null; // Prevent redundant cancellation
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateJEI(String filter) {
|
private void updateJEI(String filter) {
|
||||||
@@ -227,8 +265,6 @@ public class ItemRepo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
searchTask.cancel(true);
|
|
||||||
searchTask = null;
|
|
||||||
this.list.resetStatus();
|
this.list.resetStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,16 +290,9 @@ public class ItemRepo {
|
|||||||
|
|
||||||
public void setSearchString(@Nonnull final String searchString) {
|
public void setSearchString(@Nonnull final String searchString) {
|
||||||
this.searchString = searchString;
|
this.searchString = searchString;
|
||||||
|
}
|
||||||
|
|
||||||
if (searchTask != null) {
|
public IItemList<IAEItemStack> getList() {
|
||||||
searchTask.cancel(true);
|
return list;
|
||||||
searchTask = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Passive JEI auto search
|
|
||||||
final Enum<?> searchMode = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_MODE);
|
|
||||||
if (searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH || searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP) {
|
|
||||||
this.updateJEI(this.searchString);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import appeng.util.ISlimReadableNumberConverter;
|
|||||||
import appeng.util.IWideReadableNumberConverter;
|
import appeng.util.IWideReadableNumberConverter;
|
||||||
import appeng.util.ReadableNumberConverter;
|
import appeng.util.ReadableNumberConverter;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ public class StackSizeRenderer {
|
|||||||
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
|
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
|
||||||
fontRenderer.setUnicodeFlag(false);
|
fontRenderer.setUnicodeFlag(false);
|
||||||
|
|
||||||
if (aeStack.getStackSize() == 0 && aeStack.isCraftable()) {
|
if ((aeStack.getStackSize() == 0 || GuiScreen.isAltKeyDown()) && aeStack.isCraftable()) {
|
||||||
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
|
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
|
||||||
.getLocal();
|
.getLocal();
|
||||||
GlStateManager.disableLighting();
|
GlStateManager.disableLighting();
|
||||||
@@ -64,8 +65,7 @@ public class StackSizeRenderer {
|
|||||||
GlStateManager.enableDepth();
|
GlStateManager.enableDepth();
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
}
|
}
|
||||||
|
else if (aeStack.getStackSize() > 0) {
|
||||||
if (aeStack.getStackSize() > 0) {
|
|
||||||
final String stackSize = this.getToBeRenderedStackSize(aeStack.getStackSize());
|
final String stackSize = this.getToBeRenderedStackSize(aeStack.getStackSize());
|
||||||
|
|
||||||
GlStateManager.disableLighting();
|
GlStateManager.disableLighting();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package appeng.client.render.cablebus;
|
|||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
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;
|
||||||
@@ -327,8 +328,8 @@ class CableBuilder {
|
|||||||
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.SMART).get(cableColor);
|
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.SMART).get(cableColor);
|
||||||
cubeBuilder.setTexture(texture);
|
cubeBuilder.setTexture(texture);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
|
|
||||||
// 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) {
|
||||||
@@ -374,8 +375,8 @@ class CableBuilder {
|
|||||||
|
|
||||||
addStraightCoveredCableSizedCube(facing, cubeBuilder);
|
addStraightCoveredCableSizedCube(facing, cubeBuilder);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
|
|
||||||
// Render the channel indicators brightly lit at night
|
// Render the channel indicators brightly lit at night
|
||||||
cubeBuilder.setRenderFullBright(true);
|
cubeBuilder.setRenderFullBright(true);
|
||||||
@@ -403,8 +404,8 @@ class CableBuilder {
|
|||||||
|
|
||||||
addCoveredCableSizedCube(facing, distanceFromEdge, cubeBuilder);
|
addCoveredCableSizedCube(facing, distanceFromEdge, cubeBuilder);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
|
|
||||||
// Render the channel indicators brightly lit at night
|
// Render the channel indicators brightly lit at night
|
||||||
cubeBuilder.setRenderFullBright(true);
|
cubeBuilder.setRenderFullBright(true);
|
||||||
@@ -464,7 +465,7 @@ class CableBuilder {
|
|||||||
addDenseCableSizedCube(facing, cubeBuilder);
|
addDenseCableSizedCube(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 = (channels + 3) / 4;
|
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
||||||
@@ -508,7 +509,7 @@ class CableBuilder {
|
|||||||
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 = (channels + 3) / 4;
|
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
public class CableBusBakedModel implements IBakedModel {
|
public class CableBusBakedModel implements IBakedModel {
|
||||||
|
|
||||||
private static final Map<CableBusRenderState, List<BakedQuad>> CABLE_MODEL_CACHE = new HashMap<>();
|
static final Map<CableBusRenderState, List<BakedQuad>> CABLE_MODEL_CACHE = new HashMap<>();
|
||||||
|
|
||||||
private final CableBuilder cableBuilder;
|
private final CableBuilder cableBuilder;
|
||||||
|
|
||||||
|
|||||||
@@ -27,21 +27,26 @@ 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 {
|
public class CableBusModel implements IModel, ISelectiveResourceReloadListener {
|
||||||
|
|
||||||
private final PartModels partModels;
|
private final PartModels partModels;
|
||||||
|
|
||||||
@@ -101,4 +106,12 @@ public class CableBusModel implements IModel {
|
|||||||
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import appeng.items.misc.ItemEncodedPattern;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
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.GlStateManager;
|
|
||||||
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;
|
||||||
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.color.IItemColor;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -32,13 +32,22 @@ import java.util.List;
|
|||||||
* the pattern is being
|
* the pattern is being
|
||||||
* rendered in the GUI, and not anywhere else.
|
* rendered in the GUI, and not anywhere else.
|
||||||
*/
|
*/
|
||||||
class ItemEncodedPatternBakedModel implements IBakedModel {
|
public class ItemEncodedPatternBakedModel implements IBakedModel {
|
||||||
private final IBakedModel baseModel;
|
private final IBakedModel baseModel;
|
||||||
|
|
||||||
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
||||||
|
|
||||||
private final CustomOverrideList overrides;
|
private final CustomOverrideList overrides;
|
||||||
|
|
||||||
|
public static final IItemColor PATTERN_ITEM_COLOR_HANDLER = (stack, tintIndex) -> {
|
||||||
|
ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
|
||||||
|
ItemStack output = iep.getOutput(stack);
|
||||||
|
if (!output.isEmpty() && isShiftKeyDown()) {
|
||||||
|
return Minecraft.getMinecraft().getItemColors().colorMultiplier(output, tintIndex);
|
||||||
|
}
|
||||||
|
return 0xFFFFFF;
|
||||||
|
};
|
||||||
|
|
||||||
ItemEncodedPatternBakedModel(IBakedModel baseModel, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms) {
|
ItemEncodedPatternBakedModel(IBakedModel baseModel, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms) {
|
||||||
this.baseModel = baseModel;
|
this.baseModel = baseModel;
|
||||||
this.transforms = transforms;
|
this.transforms = transforms;
|
||||||
@@ -90,88 +99,8 @@ class ItemEncodedPatternBakedModel implements IBakedModel {
|
|||||||
return PerspectiveMapWrapper.handlePerspective(this, this.transforms, cameraTransformType);
|
return PerspectiveMapWrapper.handlePerspective(this, this.transforms, cameraTransformType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static boolean isShiftKeyDown() {
|
||||||
* Since the ItemOverrideList handling comes before handling the perspective awareness (which is the first place
|
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||||
* where we
|
|
||||||
* know how we are being rendered) we need to remember the model of the crafting output, and make the decision on
|
|
||||||
* which to render later on.
|
|
||||||
* Sadly, Forge is pretty inconsistent when it will call the handlePerspective method, so some methods are called
|
|
||||||
* even on this interim-model.
|
|
||||||
* Usually those methods only matter for rendering on the ground and other cases, where we wouldn't render the
|
|
||||||
* crafting output model anyway,
|
|
||||||
* so in those cases we delegate to the model of the encoded pattern.
|
|
||||||
*/
|
|
||||||
private class ShiftHoldingModelWrapper implements IBakedModel {
|
|
||||||
|
|
||||||
private final IBakedModel outputModel;
|
|
||||||
|
|
||||||
private ShiftHoldingModelWrapper(IBakedModel outputModel) {
|
|
||||||
this.outputModel = outputModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
|
||||||
final IBakedModel selectedModel;
|
|
||||||
|
|
||||||
// No need to re-check for shift being held since this model is only handed out in that case
|
|
||||||
if (cameraTransformType == ItemCameraTransforms.TransformType.GUI) {
|
|
||||||
selectedModel = this.outputModel;
|
|
||||||
} else {
|
|
||||||
selectedModel = ItemEncodedPatternBakedModel.this.baseModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now retroactively handle the isGui3d call, for which we always return false below
|
|
||||||
if (selectedModel.isGui3d() != ItemEncodedPatternBakedModel.this.baseModel.isGui3d()) {
|
|
||||||
GlStateManager.enableLighting();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedModel instanceof IBakedModel) {
|
|
||||||
return selectedModel.handlePerspective(cameraTransformType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return PerspectiveMapWrapper.handlePerspective(this, ItemEncodedPatternBakedModel.this.transforms, cameraTransformType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.getQuads(state, side, rand);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAmbientOcclusion() {
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.isAmbientOcclusion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isGui3d() {
|
|
||||||
// NOTE: Sadly, Forge will let Minecraft call this method before handling the perspective awareness
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.isGui3d();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isBuiltInRenderer() {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.isBuiltInRenderer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextureAtlasSprite getParticleTexture() {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.getParticleTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemCameraTransforms getItemCameraTransforms() {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.getItemCameraTransforms();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemOverrideList getOverrides() {
|
|
||||||
// This may be called for items on the ground, in which case we will always fall back to the pattern
|
|
||||||
return ItemEncodedPatternBakedModel.this.baseModel.getOverrides();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,15 +117,11 @@ class ItemEncodedPatternBakedModel implements IBakedModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) {
|
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) {
|
||||||
boolean shiftHeld = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
if (isShiftKeyDown()) {
|
||||||
if (shiftHeld) {
|
|
||||||
ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
|
ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
|
||||||
ItemStack output = iep.getOutput(stack);
|
ItemStack output = iep.getOutput(stack);
|
||||||
if (!output.isEmpty()) {
|
if (!output.isEmpty()) {
|
||||||
IBakedModel realModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(output);
|
return Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(output, world, entity);
|
||||||
// Give the item model a chance to handle the overrides as well
|
|
||||||
realModel = realModel.getOverrides().handleItemState(realModel, output, world, entity);
|
|
||||||
return new ShiftHoldingModelWrapper(realModel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ 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;
|
||||||
@@ -31,22 +30,21 @@ 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.resources.IResourceManager;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
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.Vector3f;
|
import javax.vecmath.Matrix4f;
|
||||||
|
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 {
|
|
||||||
|
public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadListener {
|
||||||
|
|
||||||
private final IBakedModel parent;
|
private final IBakedModel parent;
|
||||||
private final LoadingCache<AutoRotatingCacheKey, List<BakedQuad>> quadCache;
|
private final LoadingCache<AutoRotatingCacheKey, List<BakedQuad>> quadCache;
|
||||||
@@ -66,34 +64,171 @@ public class AutoRotatingModel implements IBakedModel {
|
|||||||
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();
|
||||||
BakedQuad unpackedQuad = builder.build();
|
final Tuple4f vertexTransformingVec = new Vector4f();
|
||||||
|
|
||||||
// Make a copy of it to resolve the vertex data and throw away the unpacked stuff
|
// Transform the matrix so the top and front facings of the model matches the block in-world
|
||||||
// This also fixes a bug in Forge's UnpackedBakedQuad, which unpacks a byte-based normal like 0,0,-1
|
transformMatrixByFacings(transformMatrix, up, forward);
|
||||||
// to 0,0,-0.99607843. We replace these normals with the proper 0,0,-1 when rotation, which
|
|
||||||
// causes a bug in the AO lighter, if an unpacked quad pipes this value back to it.
|
for (BakedQuad b : original) {
|
||||||
// Packing it back to the vanilla vertex format will fix this inconsistency because it converts
|
EnumFacing newFace = f2r.rotate(b.getFace());
|
||||||
// the normal back to a byte-based format, which then re-applies Forge's own bug when piping it
|
rotated.add(rebakeQuad(b, newFace, transformMatrix, vertexTransformingVec));
|
||||||
// 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();
|
||||||
@@ -152,140 +287,9 @@ public class AutoRotatingModel implements IBakedModel {
|
|||||||
return this.quadCache.getUnchecked(key);
|
return this.quadCache.getUnchecked(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class VertexRotator extends QuadGatheringTransformer {
|
@Override
|
||||||
private final FacingToRotation f2r;
|
public void onResourceManagerReload(IResourceManager resourceManager) {
|
||||||
private final EnumFacing face;
|
this.quadCache.invalidateAll();
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,31 +18,36 @@
|
|||||||
|
|
||||||
package appeng.client.render.model;
|
package appeng.client.render.model;
|
||||||
|
|
||||||
|
|
||||||
import appeng.block.storage.BlockDrive;
|
import appeng.block.storage.BlockDrive;
|
||||||
import appeng.block.storage.DriveSlotState;
|
import appeng.block.storage.DriveSlotState;
|
||||||
import appeng.block.storage.DriveSlotsState;
|
import appeng.block.storage.DriveSlotsState;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||||
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;
|
||||||
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.resources.IResourceManager;
|
||||||
|
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.vecmath.Matrix4f;
|
import javax.vecmath.Matrix4f;
|
||||||
|
import javax.vecmath.Tuple4f;
|
||||||
import javax.vecmath.Vector3f;
|
import javax.vecmath.Vector3f;
|
||||||
|
import javax.vecmath.Vector4f;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class DriveBakedModel implements IBakedModel, IResourceManagerReloadListener {
|
||||||
public class DriveBakedModel implements IBakedModel {
|
|
||||||
private final IBakedModel bakedBase;
|
private final IBakedModel bakedBase;
|
||||||
private final Map<DriveSlotState, IBakedModel> bakedCells;
|
private final Map<DriveSlotState, IBakedModel> bakedCells;
|
||||||
|
private final Int2ObjectMap<Map<DriveSlotState, List<BakedQuad>>> slot2DSMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
public DriveBakedModel(IBakedModel bakedBase, Map<DriveSlotState, IBakedModel> bakedCells) {
|
public DriveBakedModel(IBakedModel bakedBase, Map<DriveSlotState, IBakedModel> bakedCells) {
|
||||||
this.bakedBase = bakedBase;
|
this.bakedBase = bakedBase;
|
||||||
@@ -54,8 +59,7 @@ public class DriveBakedModel implements IBakedModel {
|
|||||||
|
|
||||||
List<BakedQuad> result = new ArrayList<>(this.bakedBase.getQuads(state, side, rand));
|
List<BakedQuad> result = new ArrayList<>(this.bakedBase.getQuads(state, side, rand));
|
||||||
|
|
||||||
if (side == null && state instanceof IExtendedBlockState) {
|
if (side == null && state instanceof IExtendedBlockState extState) {
|
||||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
|
||||||
|
|
||||||
if (!extState.getUnlistedNames().contains(BlockDrive.SLOTS_STATE)) {
|
if (!extState.getUnlistedNames().contains(BlockDrive.SLOTS_STATE)) {
|
||||||
return result;
|
return result;
|
||||||
@@ -63,30 +67,38 @@ public class DriveBakedModel implements IBakedModel {
|
|||||||
|
|
||||||
DriveSlotsState slotsState = extState.getValue(BlockDrive.SLOTS_STATE);
|
DriveSlotsState slotsState = extState.getValue(BlockDrive.SLOTS_STATE);
|
||||||
|
|
||||||
|
|
||||||
for (int row = 0; row < 5; row++) {
|
for (int row = 0; row < 5; row++) {
|
||||||
for (int col = 0; col < 2; col++) {
|
for (int col = 0; col < 2; col++) {
|
||||||
DriveSlotState slotState = slotsState.getState(row * 2 + col);
|
int slot = row * 2 + col;
|
||||||
|
|
||||||
IBakedModel bakedCell = this.bakedCells.get(slotState);
|
DriveSlotState slotState = slotsState.getState(slot);
|
||||||
|
|
||||||
Matrix4f transform = new Matrix4f();
|
slot2DSMap.putIfAbsent(slot, new Object2ObjectOpenHashMap<>());
|
||||||
transform.setIdentity();
|
int finalCol = col;
|
||||||
|
int finalRow = row;
|
||||||
|
List<BakedQuad> lbq = slot2DSMap.get(slot).computeIfAbsent(slotState, q -> {
|
||||||
|
List<BakedQuad> res = new ArrayList<>();
|
||||||
|
IBakedModel bakedCell = this.bakedCells.get(slotState);
|
||||||
|
|
||||||
// Position this drive model copy at the correct slot. The transform is based on the
|
final Matrix4f transformMatrix = new Matrix4f();
|
||||||
// cell-model being in slot 0,0 at the top left of the drive.
|
transformMatrix.setIdentity();
|
||||||
float xOffset = -col * 7 / 16.0f;
|
final Tuple4f transform = new Vector4f();
|
||||||
float yOffset = -row * 3 / 16.0f;
|
|
||||||
|
|
||||||
transform.setTranslation(new Vector3f(xOffset, yOffset, 0));
|
// Position this drive model copy at the correct slot. The transform is based on
|
||||||
|
// the
|
||||||
|
// cell-model being in slot 0,0 at the top left of the drive.
|
||||||
|
float xOffset = -finalCol * 8 / 16.0f;
|
||||||
|
float yOffset = -finalRow * 3 / 16.0f;
|
||||||
|
|
||||||
MatrixVertexTransformer transformer = new MatrixVertexTransformer(transform);
|
transformMatrix.setTranslation(new Vector3f(xOffset, yOffset, 0));
|
||||||
for (BakedQuad bakedQuad : bakedCell.getQuads(state, null, rand)) {
|
|
||||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(bakedQuad.getFormat());
|
for (BakedQuad bakedQuad : bakedCell.getQuads(state, null, rand)) {
|
||||||
transformer.setParent(builder);
|
res.add(rebakeQuad(bakedQuad, transformMatrix, transform));
|
||||||
transformer.setVertexFormat(builder.getVertexFormat());
|
}
|
||||||
bakedQuad.pipe(transformer);
|
return res;
|
||||||
result.add(builder.build());
|
});
|
||||||
}
|
result.addAll(lbq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,6 +106,41 @@ public class DriveBakedModel implements IBakedModel {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BakedQuad rebakeQuad(BakedQuad b, 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(), b.getFace(), b.getSprite(), b.shouldApplyDiffuseLighting(), b.getFormat());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAmbientOcclusion() {
|
public boolean isAmbientOcclusion() {
|
||||||
return this.bakedBase.isAmbientOcclusion();
|
return this.bakedBase.isAmbientOcclusion();
|
||||||
@@ -123,4 +170,9 @@ public class DriveBakedModel implements IBakedModel {
|
|||||||
public ItemOverrideList getOverrides() {
|
public ItemOverrideList getOverrides() {
|
||||||
return this.bakedBase.getOverrides();
|
return this.bakedBase.getOverrides();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResourceManagerReload(IResourceManager resourceManager) {
|
||||||
|
slot2DSMap.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import net.minecraft.client.resources.IResourceManager;
|
|||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.JsonUtils;
|
import net.minecraft.util.JsonUtils;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.EnumHelperClient;
|
||||||
import net.minecraftforge.client.model.ICustomModelLoader;
|
import net.minecraftforge.client.model.ICustomModelLoader;
|
||||||
import net.minecraftforge.client.model.IModel;
|
import net.minecraftforge.client.model.IModel;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
@@ -54,7 +55,6 @@ import java.lang.invoke.MethodHandle;
|
|||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -74,11 +74,7 @@ public enum UVLModelLoader implements ICustomModelLoader {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
Field modifiers = Field.class.getDeclaredField("modifiers");
|
|
||||||
modifiers.setAccessible(true);
|
|
||||||
|
|
||||||
faceBakery = ReflectionHelper.findField(ModelBakery.class, "faceBakery", "field_177607_l");
|
faceBakery = ReflectionHelper.findField(ModelBakery.class, "faceBakery", "field_177607_l");
|
||||||
modifiers.set(faceBakery, faceBakery.getModifiers() & (~Modifier.FINAL));
|
|
||||||
|
|
||||||
Class clas = Class.forName(ModelLoader.class.getName() + "$VanillaModelWrapper");
|
Class clas = Class.forName(ModelLoader.class.getName() + "$VanillaModelWrapper");
|
||||||
vanillaModelWrapper = clas.getDeclaredConstructor(ModelLoader.class, ResourceLocation.class, ModelBlock.class, boolean.class,
|
vanillaModelWrapper = clas.getDeclaredConstructor(ModelLoader.class, ResourceLocation.class, ModelBlock.class, boolean.class,
|
||||||
@@ -118,7 +114,7 @@ public enum UVLModelLoader implements ICustomModelLoader {
|
|||||||
|
|
||||||
private static void setFaceBakery(ModelBakery modelBakery, FaceBakery faceBakery) {
|
private static void setFaceBakery(ModelBakery modelBakery, FaceBakery faceBakery) {
|
||||||
try {
|
try {
|
||||||
UVLModelLoader.faceBakery.set(modelBakery, faceBakery);
|
EnumHelperClient.setFailsafeFieldValue(UVLModelLoader.faceBakery, modelBakery, faceBakery);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw Throwables.propagate(e);
|
throw Throwables.propagate(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package appeng.container;
|
|||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
import appeng.api.definitions.IItemDefinition;
|
||||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||||
import appeng.api.networking.IGrid;
|
import appeng.api.networking.IGrid;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
@@ -37,7 +38,17 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
import appeng.client.me.SlotME;
|
import appeng.client.me.SlotME;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.container.guisync.SyncData;
|
import appeng.container.guisync.SyncData;
|
||||||
import appeng.container.slot.*;
|
import appeng.container.implementations.ContainerInterface;
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotCraftingTerm;
|
||||||
|
import appeng.container.slot.SlotDisabled;
|
||||||
|
import appeng.container.slot.SlotFake;
|
||||||
|
import appeng.container.slot.SlotInaccessible;
|
||||||
|
import appeng.container.slot.SlotPlayerHotBar;
|
||||||
|
import appeng.container.slot.SlotPlayerInv;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput.PlacableItemType;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketInventoryAction;
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
@@ -77,7 +88,7 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
private final HashSet<Integer> locked = new HashSet<>();
|
private final HashSet<Integer> locked = new HashSet<>();
|
||||||
private final TileEntity tileEntity;
|
private final TileEntity tileEntity;
|
||||||
private final IPart part;
|
private final IPart part;
|
||||||
private final IGuiItemObject obj;
|
protected final IGuiItemObject obj;
|
||||||
private final HashMap<Integer, SyncData> syncData = new HashMap<>();
|
private final HashMap<Integer, SyncData> syncData = new HashMap<>();
|
||||||
private boolean isContainerValid = true;
|
private boolean isContainerValid = true;
|
||||||
private String customName;
|
private String customName;
|
||||||
@@ -316,6 +327,9 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IItemDefinition expansionCard = AEApi.instance().definitions().materials().cardPatternExpansion();
|
||||||
|
ContainerInterface casted;
|
||||||
|
|
||||||
final List<Slot> selectedSlots = new ArrayList<>();
|
final List<Slot> selectedSlots = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -325,6 +339,10 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
tis = this.transferStackToContainer(tis);
|
tis = this.transferStackToContainer(tis);
|
||||||
|
|
||||||
if (!tis.isEmpty()) {
|
if (!tis.isEmpty()) {
|
||||||
|
if (this instanceof ContainerInterface && expansionCard.isSameAs(tis) && (casted = (ContainerInterface) this).getPatternUpgrades() == casted.availableUpgrades() - 1) {
|
||||||
|
return ItemStack.EMPTY; // Don't insert more pattern expansions than maximum useful
|
||||||
|
}
|
||||||
|
|
||||||
// target slots in the container...
|
// target slots in the container...
|
||||||
for (final Object inventorySlot : this.inventorySlots) {
|
for (final Object inventorySlot : this.inventorySlots) {
|
||||||
final AppEngSlot cs = (AppEngSlot) inventorySlot;
|
final AppEngSlot cs = (AppEngSlot) inventorySlot;
|
||||||
@@ -387,6 +405,10 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
|
|
||||||
if (Platform.itemComparisons().isSameItem(tis, t)) // t.isItemEqual(tis))
|
if (Platform.itemComparisons().isSameItem(tis, t)) // t.isItemEqual(tis))
|
||||||
{
|
{
|
||||||
|
if (d instanceof SlotRestrictedInput && ((SlotRestrictedInput) d).getPlaceableItemType() == PlacableItemType.ENCODED_PATTERN) {
|
||||||
|
return ItemStack.EMPTY; // don't insert duplicate encoded patterns to interfaces
|
||||||
|
}
|
||||||
|
|
||||||
int maxSize = t.getMaxStackSize();
|
int maxSize = t.getMaxStackSize();
|
||||||
if (maxSize > d.getSlotStackLimit()) {
|
if (maxSize > d.getSlotStackLimit()) {
|
||||||
maxSize = d.getSlotStackLimit();
|
maxSize = d.getSlotStackLimit();
|
||||||
@@ -407,8 +429,6 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
clickSlot.putStack(ItemStack.EMPTY);
|
clickSlot.putStack(ItemStack.EMPTY);
|
||||||
d.onSlotChanged();
|
d.onSlotChanged();
|
||||||
|
|
||||||
// if ( hasMETiles ) updateClient();
|
|
||||||
|
|
||||||
this.updateSlot(clickSlot);
|
this.updateSlot(clickSlot);
|
||||||
this.updateSlot(d);
|
this.updateSlot(d);
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
@@ -427,42 +447,7 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d.isItemValid(tis)) {
|
if (d.isItemValid(tis)) {
|
||||||
if (d.getHasStack()) {
|
if (!d.getHasStack()) {
|
||||||
final ItemStack t = d.getStack().copy();
|
|
||||||
|
|
||||||
if (Platform.itemComparisons().isSameItem(t, tis)) {
|
|
||||||
int maxSize = t.getMaxStackSize();
|
|
||||||
if (d.getSlotStackLimit() < maxSize) {
|
|
||||||
maxSize = d.getSlotStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
int placeAble = maxSize - t.getCount();
|
|
||||||
|
|
||||||
if (tis.getCount() < placeAble) {
|
|
||||||
placeAble = tis.getCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
t.setCount(t.getCount() + placeAble);
|
|
||||||
tis.setCount(tis.getCount() - placeAble);
|
|
||||||
|
|
||||||
d.putStack(t);
|
|
||||||
|
|
||||||
if (tis.getCount() <= 0) {
|
|
||||||
clickSlot.putStack(ItemStack.EMPTY);
|
|
||||||
d.onSlotChanged();
|
|
||||||
|
|
||||||
// if ( worldEntity != null )
|
|
||||||
// worldEntity.markDirty();
|
|
||||||
// if ( hasMETiles ) updateClient();
|
|
||||||
|
|
||||||
this.updateSlot(clickSlot);
|
|
||||||
this.updateSlot(d);
|
|
||||||
return ItemStack.EMPTY;
|
|
||||||
} else {
|
|
||||||
this.updateSlot(d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
int maxSize = tis.getMaxStackSize();
|
int maxSize = tis.getMaxStackSize();
|
||||||
if (maxSize > d.getSlotStackLimit()) {
|
if (maxSize > d.getSlotStackLimit()) {
|
||||||
maxSize = d.getSlotStackLimit();
|
maxSize = d.getSlotStackLimit();
|
||||||
@@ -480,15 +465,18 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
clickSlot.putStack(ItemStack.EMPTY);
|
clickSlot.putStack(ItemStack.EMPTY);
|
||||||
d.onSlotChanged();
|
d.onSlotChanged();
|
||||||
|
|
||||||
// if ( worldEntity != null )
|
|
||||||
// worldEntity.markDirty();
|
|
||||||
// if ( hasMETiles ) updateClient();
|
|
||||||
|
|
||||||
this.updateSlot(clickSlot);
|
this.updateSlot(clickSlot);
|
||||||
this.updateSlot(d);
|
this.updateSlot(d);
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
} else {
|
} else {
|
||||||
this.updateSlot(d);
|
this.updateSlot(d);
|
||||||
|
|
||||||
|
if (
|
||||||
|
(d instanceof SlotRestrictedInput && ((SlotRestrictedInput) d).getPlaceableItemType() == PlacableItemType.ENCODED_PATTERN) ||
|
||||||
|
(this instanceof ContainerInterface && expansionCard.isSameAs(tis) && (casted = (ContainerInterface) this).getPatternUpgrades() == casted.availableUpgrades() - 1)
|
||||||
|
) {
|
||||||
|
break; // Only insert one pattern when shift-clicking into interfaces, and don't insert more pattern expansions than maximum useful
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -545,23 +533,20 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PICKUP_OR_SET_DOWN:
|
case PICKUP_OR_SET_DOWN:
|
||||||
|
|
||||||
if (hand.isEmpty()) {
|
if (hand.isEmpty()) {
|
||||||
s.putStack(ItemStack.EMPTY);
|
s.putStack(ItemStack.EMPTY);
|
||||||
} else {
|
} else {
|
||||||
s.putStack(hand.copy());
|
s.putStack(hand.copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PLACE_SINGLE:
|
case PLACE_SINGLE:
|
||||||
|
|
||||||
if (!hand.isEmpty()) {
|
if (!hand.isEmpty()) {
|
||||||
final ItemStack is = hand.copy();
|
final ItemStack is = hand.copy();
|
||||||
is.setCount(1);
|
is.setCount(1);
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
} else {
|
} else {
|
||||||
final ItemStack is = s.getStack().copy();
|
final ItemStack is = s.getStack().copy();
|
||||||
if (is.getCount() < is.getMaxStackSize())
|
if (is.getCount() < is.getMaxStackSize() * 8)
|
||||||
is.grow(1);
|
is.grow(1);
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
}
|
}
|
||||||
@@ -575,7 +560,6 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SPLIT_OR_PLACE_SINGLE:
|
case SPLIT_OR_PLACE_SINGLE:
|
||||||
|
|
||||||
ItemStack is = s.getStack();
|
ItemStack is = s.getStack();
|
||||||
if (!is.isEmpty()) {
|
if (!is.isEmpty()) {
|
||||||
if (hand.isEmpty()) {
|
if (hand.isEmpty()) {
|
||||||
@@ -586,14 +570,26 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
is = hand.copy();
|
is = hand.copy();
|
||||||
is.setCount(1);
|
is.setCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
} else if (!hand.isEmpty()) {
|
} else if (!hand.isEmpty()) {
|
||||||
is = hand.copy();
|
is = hand.copy();
|
||||||
is.setCount(1);
|
is.setCount(1);
|
||||||
s.putStack(is);
|
s.putStack(is);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case HALVE:
|
||||||
|
if (s.getStack().getCount() > 1) {
|
||||||
|
ItemStack halved = s.getStack().copy();
|
||||||
|
halved.setCount(s.getStack().getCount() / 2);
|
||||||
|
s.putStack(halved);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DOUBLE:
|
||||||
|
ItemStack doubled = s.getStack().copy();
|
||||||
|
if (s.getStack().getCount() * 2 > 0) {
|
||||||
|
doubled.setCount(Math.min(s.getSlotStackLimit(), s.getStack().getCount() * 2));
|
||||||
|
s.putStack(doubled);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CREATIVE_DUPLICATE:
|
case CREATIVE_DUPLICATE:
|
||||||
case MOVE_REGION:
|
case MOVE_REGION:
|
||||||
@@ -606,9 +602,9 @@ public abstract class AEBaseContainer extends Container {
|
|||||||
if (action == InventoryAction.MOVE_REGION) {
|
if (action == InventoryAction.MOVE_REGION) {
|
||||||
final List<Slot> from = new ArrayList<>();
|
final List<Slot> from = new ArrayList<>();
|
||||||
|
|
||||||
for (final Object j : this.inventorySlots) {
|
for (final Slot j : this.inventorySlots) {
|
||||||
if (j instanceof Slot && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
if (j != null && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
||||||
from.add((Slot) j);
|
from.add(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import appeng.api.AEApi;
|
|||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.networking.IGrid;
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.crafting.ICraftingCPU;
|
import appeng.api.networking.crafting.ICraftingCPU;
|
||||||
import appeng.api.networking.crafting.ICraftingGrid;
|
import appeng.api.networking.crafting.ICraftingGrid;
|
||||||
import appeng.api.networking.crafting.ICraftingJob;
|
import appeng.api.networking.crafting.ICraftingJob;
|
||||||
@@ -35,8 +36,10 @@ import appeng.api.storage.ITerminalHost;
|
|||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.container.interfaces.IInventorySlotAware;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
@@ -53,6 +56,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.IContainerListener;
|
import net.minecraft.inventory.IContainerListener;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -61,6 +65,7 @@ import javax.annotation.Nonnull;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
|
||||||
@@ -85,6 +90,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
public boolean noCPU = true;
|
public boolean noCPU = true;
|
||||||
@GuiSync(7)
|
@GuiSync(7)
|
||||||
public String myName = "";
|
public String myName = "";
|
||||||
|
private GuiCraftConfirm guiCraftConfirm;
|
||||||
|
|
||||||
public ContainerCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
|
public ContainerCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
|
||||||
super(ip, te);
|
super(ip, te);
|
||||||
@@ -120,7 +126,19 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ICraftingGrid cc = this.getGrid().getCache(ICraftingGrid.class);
|
final IActionHost h = ((IActionHost) this.getTarget());
|
||||||
|
if (h == null) {
|
||||||
|
this.setValidContainer(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IGridNode node = h.getActionableNode();
|
||||||
|
if (node == null) {
|
||||||
|
this.setValidContainer(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IGrid grid = node.getGrid();
|
||||||
|
|
||||||
|
final ICraftingGrid cc = grid.getCache(ICraftingGrid.class);
|
||||||
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
|
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
|
||||||
|
|
||||||
int matches = 0;
|
int matches = 0;
|
||||||
@@ -194,7 +212,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
p.reset();
|
p.reset();
|
||||||
p.setStackSize(out.getCountRequestable());
|
p.setStackSize(out.getCountRequestable());
|
||||||
|
|
||||||
final IStorageGrid sg = this.getGrid().getCache(IStorageGrid.class);
|
final IStorageGrid sg = grid.getCache(IStorageGrid.class);
|
||||||
final IMEInventory<IAEItemStack> items = sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
final IMEInventory<IAEItemStack> items = sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||||
|
|
||||||
IAEItemStack m = null;
|
IAEItemStack m = null;
|
||||||
@@ -247,11 +265,6 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IGrid getGrid() {
|
|
||||||
final IActionHost h = ((IActionHost) this.getTarget());
|
|
||||||
return h.getActionableNode().getGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean cpuMatches(final ICraftingCPU c) {
|
private boolean cpuMatches(final ICraftingCPU c) {
|
||||||
return c.getAvailableStorage() >= this.getUsedBytes() && !c.isBusy();
|
return c.getAvailableStorage() >= this.getUsedBytes() && !c.isBusy();
|
||||||
}
|
}
|
||||||
@@ -276,7 +289,8 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
|
|
||||||
final IActionHost ah = this.getActionHost();
|
final IActionHost ah = this.getActionHost();
|
||||||
if (ah instanceof WirelessTerminalGuiObject) {
|
if (ah instanceof WirelessTerminalGuiObject) {
|
||||||
originalGui = GuiBridge.GUI_WIRELESS_TERM;
|
ItemStack myIcon = ((WirelessTerminalGuiObject) ah).getItemStack();
|
||||||
|
originalGui = (GuiBridge) AEApi.instance().registries().wireless().getWirelessTerminalHandler(myIcon).getGuiHandler(myIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ah instanceof PartTerminal) {
|
if (ah instanceof PartTerminal) {
|
||||||
@@ -295,13 +309,32 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
originalGui = GuiBridge.GUI_EXPANDED_PROCESSING_PATTERN_TERMINAL;
|
originalGui = GuiBridge.GUI_EXPANDED_PROCESSING_PATTERN_TERMINAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final IActionHost h = ((IActionHost) this.getTarget());
|
||||||
|
if (h == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IGridNode node = h.getActionableNode();
|
||||||
|
if (node == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IGrid grid = node.getGrid();
|
||||||
|
|
||||||
if (this.result != null && !this.isSimulation()) {
|
if (this.result != null && !this.isSimulation()) {
|
||||||
final ICraftingGrid cc = this.getGrid().getCache(ICraftingGrid.class);
|
final ICraftingGrid cc = grid.getCache(ICraftingGrid.class);
|
||||||
final ICraftingLink g = cc.submitJob(this.result, null, this.getSelectedCpu() == -1 ? null : this.cpus.get(this.getSelectedCpu()).getCpu(), true, this.getActionSrc());
|
final ICraftingLink g = cc.submitJob(this.result, null, this.getSelectedCpu() == -1 ? null : this.cpus.get(this.getSelectedCpu()).getCpu(), true, this.getActionSrc());
|
||||||
this.setAutoStart(false);
|
this.setAutoStart(false);
|
||||||
if (g != null && originalGui != null && this.getOpenContext() != null) {
|
if (g == null) {
|
||||||
|
this.setJob(cc.beginCraftingJob(this.getWorld(), grid, this.getActionSrc(), this.result.getOutput(), null));
|
||||||
|
} else if (originalGui != null && this.getOpenContext() != null) {
|
||||||
final TileEntity te = this.getOpenContext().getTile();
|
final TileEntity te = this.getOpenContext().getTile();
|
||||||
Platform.openGUI(this.getInventoryPlayer().player, te, this.getOpenContext().getSide(), originalGui);
|
if (te != null) {
|
||||||
|
Platform.openGUI(this.getInventoryPlayer().player, te, this.getOpenContext().getSide(), originalGui);
|
||||||
|
} else {
|
||||||
|
if (ah instanceof IInventorySlotAware) {
|
||||||
|
IInventorySlotAware i = ((IInventorySlotAware) ah);
|
||||||
|
Platform.openGUI(this.getInventoryPlayer().player, i.getInventorySlot(), originalGui, i.isBaubleSlot());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -403,4 +436,12 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
public void setJob(final Future<ICraftingJob> job) {
|
public void setJob(final Future<ICraftingJob> job) {
|
||||||
this.job = job;
|
this.job = job;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
|
||||||
|
this.guiCraftConfirm.postUpdate(list, ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGui(GuiCraftConfirm guiCraftConfirm) {
|
||||||
|
this.guiCraftConfirm = guiCraftConfirm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
|
|||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
@@ -47,6 +49,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
|||||||
import net.minecraft.inventory.IContainerListener;
|
import net.minecraft.inventory.IContainerListener;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject {
|
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject {
|
||||||
@@ -58,6 +61,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||||||
|
|
||||||
@GuiSync(0)
|
@GuiSync(0)
|
||||||
public long eta = -1;
|
public long eta = -1;
|
||||||
|
private GuiCraftingCPU guiCraftingCPU;
|
||||||
|
|
||||||
public ContainerCraftingCPU(final InventoryPlayer ip, final Object te) {
|
public ContainerCraftingCPU(final InventoryPlayer ip, final Object te) {
|
||||||
super(ip, te);
|
super(ip, te);
|
||||||
@@ -232,4 +236,12 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
|||||||
private void setNetwork(final IGrid network) {
|
private void setNetwork(final IGrid network) {
|
||||||
this.network = network;
|
this.network = network;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
|
||||||
|
this.guiCraftingCPU.postUpdate(list, ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGui(GuiCraftingCPU guiCraftingCPU) {
|
||||||
|
this.guiCraftingCPU = guiCraftingCPU;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,10 @@ import appeng.container.ContainerNull;
|
|||||||
import appeng.container.slot.SlotCraftingMatrix;
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
import appeng.container.slot.SlotCraftingTerm;
|
import appeng.container.slot.SlotCraftingTerm;
|
||||||
import appeng.helpers.IContainerCraftingPacket;
|
import appeng.helpers.IContainerCraftingPacket;
|
||||||
|
import appeng.parts.reporting.AbstractPartTerminal;
|
||||||
import appeng.parts.reporting.PartCraftingTerminal;
|
import appeng.parts.reporting.PartCraftingTerminal;
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
import appeng.util.inv.IAEAppEngInventory;
|
import appeng.util.inv.IAEAppEngInventory;
|
||||||
import appeng.util.inv.InvOperation;
|
import appeng.util.inv.InvOperation;
|
||||||
import appeng.util.inv.WrapperInvItemHandler;
|
import appeng.util.inv.WrapperInvItemHandler;
|
||||||
|
|||||||
+12
-404
@@ -1,55 +1,33 @@
|
|||||||
package appeng.container.implementations;
|
package appeng.container.implementations;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.definitions.IDefinitions;
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.container.slot.*;
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
import appeng.helpers.IContainerCraftingPacket;
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
import appeng.parts.reporting.PartExpandedProcessingPatternTerminal;
|
import appeng.container.slot.SlotPatternOutputs;
|
||||||
import appeng.util.Platform;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.util.inv.IAEAppEngInventory;
|
|
||||||
import appeng.util.inv.InvOperation;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.IContainerListener;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import static appeng.helpers.PatternHelper.PROCESSING_INPUT_LIMIT;
|
import static appeng.helpers.PatternHelper.PROCESSING_INPUT_LIMIT;
|
||||||
import static appeng.helpers.PatternHelper.PROCESSING_OUTPUT_LIMIT;
|
import static appeng.helpers.PatternHelper.PROCESSING_OUTPUT_LIMIT;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerExpandedProcessingPatternTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
public class ContainerExpandedProcessingPatternTerm extends ContainerPatternEncoder {
|
||||||
private final IItemHandler crafting;
|
|
||||||
private final SlotFakeCraftingMatrix[] gridSlots = new SlotFakeCraftingMatrix[PROCESSING_INPUT_LIMIT];
|
|
||||||
private final OptionalSlotFake[] outputSlots = new OptionalSlotFake[PROCESSING_OUTPUT_LIMIT];
|
|
||||||
private final SlotRestrictedInput patternSlotIN;
|
|
||||||
private final SlotRestrictedInput patternSlotOUT;
|
|
||||||
private final PartExpandedProcessingPatternTerminal expandedProcessingPatternTerminal;
|
|
||||||
|
|
||||||
public ContainerExpandedProcessingPatternTerm(InventoryPlayer ip, ITerminalHost monitorable) {
|
public ContainerExpandedProcessingPatternTerm(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||||
super(ip, monitorable, false);
|
super(ip, monitorable, false);
|
||||||
|
|
||||||
this.expandedProcessingPatternTerminal = (PartExpandedProcessingPatternTerminal) monitorable;
|
this.craftingSlots = new SlotFakeCraftingMatrix[PROCESSING_INPUT_LIMIT];
|
||||||
|
this.outputSlots = new OptionalSlotFake[PROCESSING_OUTPUT_LIMIT];
|
||||||
|
|
||||||
final IItemHandler patternInv = this.getExpandedPatternTerminal().getInventoryByName("pattern");
|
final IItemHandler patternInv = this.getPart().getInventoryByName("pattern");
|
||||||
final IItemHandler output = this.getExpandedPatternTerminal().getInventoryByName("output");
|
final IItemHandler output = this.getPart().getInventoryByName("output");
|
||||||
|
|
||||||
this.crafting = this.getExpandedPatternTerminal().getInventoryByName("crafting");
|
this.crafting = this.getPart().getInventoryByName("crafting");
|
||||||
|
|
||||||
for (int y = 0; y < 4; y++) {
|
for (int y = 0; y < 4; y++) {
|
||||||
for (int x = 0; x < 4; x++) {
|
for (int x = 0; x < 4; x++) {
|
||||||
this.addSlotToContainer(this.gridSlots[x + y * 4] = new SlotFakeCraftingMatrix(this.crafting, x + y * 4, 4 + x * 18, -85 + y * 18));
|
this.addSlotToContainer(this.craftingSlots[x + y * 4] = new SlotFakeCraftingMatrix(this.crafting, x + y * 4, 4 + x * 18, -85 + y * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,124 +45,7 @@ public class ContainerExpandedProcessingPatternTerm extends ContainerMEMonitorab
|
|||||||
this.patternSlotOUT.setStackLimit(1);
|
this.patternSlotOUT.setStackLimit(1);
|
||||||
|
|
||||||
this.bindPlayerInventory(ip, 0, 0);
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
|
||||||
if (Platform.isClient()) {
|
|
||||||
return ItemStack.EMPTY;
|
|
||||||
}
|
|
||||||
if (this.inventorySlots.get(idx) instanceof SlotPlayerInv || this.inventorySlots.get(idx) instanceof SlotPlayerHotBar) {
|
|
||||||
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx); // require AE SLots!
|
|
||||||
ItemStack itemStack = clickSlot.getStack();
|
|
||||||
if (AEApi.instance().definitions().materials().blankPattern().isSameAs(itemStack)) {
|
|
||||||
IItemHandler patternInv = this.getExpandedPatternTerminal().getInventoryByName("pattern");
|
|
||||||
ItemStack remainder = patternInv.insertItem(0, itemStack, false);
|
|
||||||
clickSlot.putStack(remainder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.transferStackInSlot(p, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveChanges() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void encodeAndMoveToInventory() {
|
|
||||||
encode();
|
|
||||||
ItemStack output = this.patternSlotOUT.getStack();
|
|
||||||
if (!output.isEmpty()) {
|
|
||||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
|
||||||
getPlayerInv().player.dropItem(output, false);
|
|
||||||
}
|
|
||||||
this.patternSlotOUT.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void encode() {
|
|
||||||
ItemStack output = this.patternSlotOUT.getStack();
|
|
||||||
|
|
||||||
final ItemStack[] in = this.getInputs();
|
|
||||||
final ItemStack[] out = this.getOutputs();
|
|
||||||
|
|
||||||
// if there is no input, this would be silly.
|
|
||||||
if (in == null || out == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// first check the output slots, should either be null, or a pattern
|
|
||||||
if (!output.isEmpty() && !this.isPattern(output)) {
|
|
||||||
return;
|
|
||||||
} // if nothing is there we should snag a new pattern.
|
|
||||||
else if (output.isEmpty()) {
|
|
||||||
output = this.patternSlotIN.getStack();
|
|
||||||
if (output.isEmpty() || !this.isPattern(output)) {
|
|
||||||
return; // no blanks.
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove one, and clear the input slot.
|
|
||||||
output.setCount(output.getCount() - 1);
|
|
||||||
if (output.getCount() == 0) {
|
|
||||||
this.patternSlotIN.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add a new encoded pattern.
|
|
||||||
Optional<ItemStack> maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack(1);
|
|
||||||
if (maybePattern.isPresent()) {
|
|
||||||
output = maybePattern.get();
|
|
||||||
this.patternSlotOUT.putStack(output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// encode the slot.
|
|
||||||
final NBTTagCompound encodedValue = new NBTTagCompound();
|
|
||||||
|
|
||||||
final NBTTagList tagIn = new NBTTagList();
|
|
||||||
final NBTTagList tagOut = new NBTTagList();
|
|
||||||
|
|
||||||
for (final ItemStack i : in) {
|
|
||||||
tagIn.appendTag(this.createItemTag(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final ItemStack i : out) {
|
|
||||||
tagOut.appendTag(this.createItemTag(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
encodedValue.setTag("in", tagIn);
|
|
||||||
encodedValue.setTag("out", tagOut);
|
|
||||||
encodedValue.setBoolean("crafting", false);
|
|
||||||
encodedValue.setBoolean("substitute", false);
|
|
||||||
|
|
||||||
output.setTagCompound(encodedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isPattern(final ItemStack output) {
|
|
||||||
if (output.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final IDefinitions definitions = AEApi.instance().definitions();
|
|
||||||
|
|
||||||
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
|
||||||
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
|
||||||
|
|
||||||
return isPattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
NBTBase createItemTag(final ItemStack i) {
|
|
||||||
final NBTTagCompound c = new NBTTagCompound();
|
|
||||||
|
|
||||||
if (!i.isEmpty()) {
|
|
||||||
i.writeToNBT(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -192,261 +53,8 @@ public class ContainerExpandedProcessingPatternTerm extends ContainerMEMonitorab
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemStack[] getInputs() {
|
|
||||||
final ItemStack[] input = new ItemStack[16];
|
|
||||||
boolean hasValue = false;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty()) {
|
|
||||||
hasValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasValue) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemStack[] getOutputs() {
|
|
||||||
final List<ItemStack> list = new ArrayList<>(3);
|
|
||||||
boolean hasValue = false;
|
|
||||||
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
|
|
||||||
if (!out.isEmpty() && out.getCount() > 0) {
|
|
||||||
list.add(out);
|
|
||||||
hasValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasValue) {
|
|
||||||
return list.toArray(new ItemStack[0]);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
for (final Slot s : this.gridSlots) {
|
|
||||||
s.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Slot s : this.outputSlots) {
|
|
||||||
s.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemHandler getInventoryByName(final String name) {
|
public boolean isCraftingMode() {
|
||||||
if (name.equals("player")) {
|
|
||||||
return new PlayerInvWrapper(this.getInventoryPlayer());
|
|
||||||
}
|
|
||||||
return this.getExpandedPatternTerminal().getInventoryByName(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean useRealItems() {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartExpandedProcessingPatternTerminal getExpandedPatternTerminal() {
|
|
||||||
return this.expandedProcessingPatternTerminal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void multiply(int multiple) {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canMultiplyInputs = true;
|
|
||||||
boolean canMultiplyOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() * multiple > input[x].getMaxStackSize()) {
|
|
||||||
canMultiplyInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() * multiple > out.getMaxStackSize()) {
|
|
||||||
canMultiplyOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canMultiplyInputs && canMultiplyOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void divide(int divide) {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canDivideInputs = true;
|
|
||||||
boolean canDivideOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() % divide != 0) {
|
|
||||||
canDivideInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() % divide != 0) {
|
|
||||||
canDivideOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canDivideInputs && canDivideOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void increase(int increase) {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canIncreaseInputs = true;
|
|
||||||
boolean canIncreaseOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() + increase > input[x].getMaxStackSize()) {
|
|
||||||
canIncreaseInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() + increase > out.getMaxStackSize()) {
|
|
||||||
canIncreaseOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canIncreaseInputs && canIncreaseOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void decrease(int decrease) {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canDecreaseInputs = true;
|
|
||||||
boolean canDecreaseOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() - decrease < 1) {
|
|
||||||
canDecreaseInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() - decrease < 1) {
|
|
||||||
canDecreaseOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canDecreaseInputs && canDecreaseOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void maximizeCount() {
|
|
||||||
ItemStack[] input = new ItemStack[gridSlots.length];
|
|
||||||
boolean canGrowInputs = true;
|
|
||||||
boolean canGrowOutputs = true;
|
|
||||||
int maxInputStackGrowth = 0;
|
|
||||||
int maxOutputStackGrowth = 0;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.gridSlots.length; x++) {
|
|
||||||
input[x] = this.gridSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getMaxStackSize() - input[x].getCount() > maxInputStackGrowth) {
|
|
||||||
maxInputStackGrowth = input[x].getMaxStackSize() - input[x].getCount();
|
|
||||||
}
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() + maxInputStackGrowth > input[x].getMaxStackSize()) {
|
|
||||||
canGrowInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
{
|
|
||||||
maxOutputStackGrowth = out.getMaxStackSize() - out.getCount();
|
|
||||||
}
|
|
||||||
if (!out.isEmpty() && out.getCount() + maxOutputStackGrowth > out.getMaxStackSize()) {
|
|
||||||
canGrowOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canGrowInputs && canGrowOutputs) {
|
|
||||||
int maxStackGrowth = Math.min(maxInputStackGrowth, maxOutputStackGrowth);
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.gridSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty()) {
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSlotChange(final Slot s) {
|
|
||||||
if (s == this.patternSlotOUT && Platform.isServer()) {
|
|
||||||
for (final IContainerListener listener : this.listeners) {
|
|
||||||
for (final Slot slot : this.inventorySlots) {
|
|
||||||
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
|
||||||
listener.sendSlotContents(this, slot.slotNumber, slot.getStack());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (listener instanceof EntityPlayerMP) {
|
|
||||||
((EntityPlayerMP) listener).isChangingQuantityOnly = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,13 @@ import appeng.container.guisync.GuiSync;
|
|||||||
import appeng.container.slot.*;
|
import appeng.container.slot.*;
|
||||||
import appeng.helpers.DualityInterface;
|
import appeng.helpers.DualityInterface;
|
||||||
import appeng.helpers.IInterfaceHost;
|
import appeng.helpers.IInterfaceHost;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.tile.inventory.AppEngInternalOversizedInventory;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.ClickType;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost {
|
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost {
|
||||||
@@ -62,10 +67,23 @@ public class ContainerInterface extends ContainerUpgradeable implements IOptiona
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < DualityInterface.NUMBER_OF_STORAGE_SLOTS; x++) {
|
for (int x = 0; x < DualityInterface.NUMBER_OF_STORAGE_SLOTS; x++) {
|
||||||
this.addSlotToContainer(new SlotNormal(this.myDuality.getStorage(), x, 8 + 18 * x, 35 + 18));
|
this.addSlotToContainer(new SlotOversized(this.myDuality.getStorage(), x, 8 + 18 * x, 35 + 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
|
||||||
|
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
|
||||||
|
if (this.inventorySlots.get(slotId) instanceof SlotOversized) {
|
||||||
|
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(true);
|
||||||
|
ItemStack ret = super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||||
|
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(false);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getHeight() {
|
protected int getHeight() {
|
||||||
return 256;
|
return 256;
|
||||||
|
|||||||
+16
-2
@@ -50,6 +50,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackWriteToNBT;
|
||||||
|
|
||||||
|
|
||||||
public final class ContainerInterfaceConfigurationTerminal extends AEBaseContainer {
|
public final class ContainerInterfaceConfigurationTerminal extends AEBaseContainer {
|
||||||
|
|
||||||
@@ -184,7 +186,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PLACE_SINGLE:
|
case PLACE_SINGLE:
|
||||||
if (inSlot.getMaxStackSize() > inSlot.getCount()) {
|
if (inSlot.getCount() < inSlot.getMaxStackSize() * 8) {
|
||||||
inSlot.grow(1);
|
inSlot.grow(1);
|
||||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, inSlot);
|
ItemHandlerUtil.setStackInSlot(theSlot, 0, inSlot);
|
||||||
}
|
}
|
||||||
@@ -222,6 +224,18 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
|||||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, player.inventory.getItemStack().copy());
|
ItemHandlerUtil.setStackInSlot(theSlot, 0, player.inventory.getItemStack().copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case HALVE:
|
||||||
|
if (inSlot.getCount() > 1) {
|
||||||
|
ItemStack halved = inSlot.copy();
|
||||||
|
halved.setCount(inSlot.getCount() / 2);
|
||||||
|
ItemHandlerUtil.setStackInSlot(theSlot, 0, halved);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DOUBLE:
|
||||||
|
ItemStack doubled = inSlot.copy();
|
||||||
|
doubled.setCount(Math.min(512, inSlot.getCount() * 2));
|
||||||
|
ItemHandlerUtil.setStackInSlot(theSlot, 0, doubled);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@@ -298,7 +312,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
|||||||
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
|
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
|
||||||
|
|
||||||
if (!is.isEmpty()) {
|
if (!is.isEmpty()) {
|
||||||
is.writeToNBT(itemNBT);
|
stackWriteToNBT(is, itemNBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag(Integer.toString(x + offset), itemNBT);
|
tag.setTag(Integer.toString(x + offset), itemNBT);
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackWriteToNBT;
|
||||||
|
|
||||||
|
|
||||||
public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
||||||
|
|
||||||
@@ -77,7 +79,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
|||||||
this.grid = anchor.getActionableNode().getGrid();
|
this.grid = anchor.getActionableNode().getGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bindPlayerInventory(ip, 14, 256 - /* height of player inventory */82);
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -345,7 +347,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
|
|||||||
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
|
ItemHandlerUtil.setStackInSlot(inv.client, x + offset, is.isEmpty() ? ItemStack.EMPTY : is.copy());
|
||||||
|
|
||||||
if (!is.isEmpty()) {
|
if (!is.isEmpty()) {
|
||||||
is.writeToNBT(itemNBT);
|
stackWriteToNBT(is, itemNBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag(Integer.toString(x + offset), itemNBT);
|
tag.setTag(Integer.toString(x + offset), itemNBT);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package appeng.container.implementations;
|
|||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.*;
|
import appeng.api.config.*;
|
||||||
|
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
import appeng.api.implementations.tiles.IMEChest;
|
import appeng.api.implementations.tiles.IMEChest;
|
||||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||||
@@ -42,6 +43,7 @@ import appeng.api.storage.data.IItemList;
|
|||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.api.util.IConfigurableObject;
|
import appeng.api.util.IConfigurableObject;
|
||||||
|
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
@@ -49,6 +51,7 @@ import appeng.core.AELog;
|
|||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
import appeng.me.helpers.ChannelPowerSrc;
|
import appeng.me.helpers.ChannelPowerSrc;
|
||||||
import appeng.util.ConfigManager;
|
import appeng.util.ConfigManager;
|
||||||
import appeng.util.IConfigManagerHost;
|
import appeng.util.IConfigManagerHost;
|
||||||
@@ -64,13 +67,14 @@ import net.minecraftforge.fml.common.Loader;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.BufferOverflowException;
|
import java.nio.BufferOverflowException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack> {
|
public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack> {
|
||||||
|
|
||||||
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
protected final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
||||||
private final IMEMonitor<IAEItemStack> monitor;
|
private final IMEMonitor<IAEItemStack> monitor;
|
||||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
public final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||||
private final IConfigManager clientCM;
|
private final IConfigManager clientCM;
|
||||||
private final ITerminalHost host;
|
private final ITerminalHost host;
|
||||||
@GuiSync(99)
|
@GuiSync(99)
|
||||||
@@ -88,7 +92,11 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected ContainerMEMonitorable(final InventoryPlayer ip, final ITerminalHost monitorable, final boolean bindInventory) {
|
protected ContainerMEMonitorable(final InventoryPlayer ip, final ITerminalHost monitorable, final boolean bindInventory) {
|
||||||
super(ip, monitorable instanceof TileEntity ? (TileEntity) monitorable : null, monitorable instanceof IPart ? (IPart) monitorable : null);
|
this(ip, monitorable, null, bindInventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ContainerMEMonitorable(final InventoryPlayer ip, final ITerminalHost monitorable, final IGuiItemObject iGuiItemObject, final boolean bindInventory) {
|
||||||
|
super(ip, monitorable instanceof TileEntity ? (TileEntity) monitorable : null, monitorable instanceof IPart ? (IPart) monitorable : null, iGuiItemObject);
|
||||||
|
|
||||||
this.host = monitorable;
|
this.host = monitorable;
|
||||||
this.clientCM = new ConfigManager(this);
|
this.clientCM = new ConfigManager(this);
|
||||||
@@ -108,6 +116,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||||||
|
|
||||||
if (monitorable instanceof IPortableCell) {
|
if (monitorable instanceof IPortableCell) {
|
||||||
this.setPowerSource((IEnergySource) monitorable);
|
this.setPowerSource((IEnergySource) monitorable);
|
||||||
|
if (monitorable instanceof WirelessTerminalGuiObject) {
|
||||||
|
this.networkNode = ((WirelessTerminalGuiObject) monitorable).getActionableNode();
|
||||||
|
}
|
||||||
} else if (monitorable instanceof IMEChest) {
|
} else if (monitorable instanceof IMEChest) {
|
||||||
this.setPowerSource((IEnergySource) monitorable);
|
this.setPowerSource((IEnergySource) monitorable);
|
||||||
} else if (monitorable instanceof IGridHost || monitorable instanceof IActionHost) {
|
} else if (monitorable instanceof IGridHost || monitorable instanceof IActionHost) {
|
||||||
@@ -357,11 +368,22 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||||||
this.hasPower = isPowered;
|
this.hasPower = isPowered;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IConfigManagerHost getGui() {
|
public IConfigManagerHost getGui() {
|
||||||
return this.gui;
|
return this.gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IItemList<IAEItemStack> getItems() {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postUpdate(final List<IAEItemStack> list) {
|
||||||
|
for (final IAEItemStack is : list) {
|
||||||
|
this.items.add(is);
|
||||||
|
}
|
||||||
|
((GuiMEMonitorable) this.gui).postUpdate(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,42 +23,44 @@ import appeng.api.config.Actionable;
|
|||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
import appeng.container.interfaces.IInventorySlotAware;
|
import appeng.container.interfaces.IInventorySlotAware;
|
||||||
|
import appeng.util.inv.IAEAppEngInventory;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerMEPortableCell extends ContainerMEMonitorable {
|
public class ContainerMEPortableCell extends ContainerMEMonitorable implements IInventorySlotAware {
|
||||||
|
|
||||||
private double powerMultiplier = 0.5;
|
protected final IPortableCell portableCell;
|
||||||
|
|
||||||
private final IPortableCell civ;
|
|
||||||
private int ticks = 0;
|
|
||||||
private final int slot;
|
private final int slot;
|
||||||
|
private double powerMultiplier = 0.5;
|
||||||
|
private int ticks = 0;
|
||||||
|
|
||||||
public ContainerMEPortableCell(final InventoryPlayer ip, final IPortableCell monitorable) {
|
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell guiObject) {
|
||||||
super(ip, monitorable, false);
|
super(ip, guiObject, guiObject, false);
|
||||||
if (monitorable instanceof IInventorySlotAware) {
|
if (guiObject != null) {
|
||||||
final int slotIndex = ((IInventorySlotAware) monitorable).getInventorySlot();
|
final int slotIndex = ((IInventorySlotAware) guiObject).getInventorySlot();
|
||||||
this.lockPlayerInventorySlot(slotIndex);
|
if (!((IInventorySlotAware) guiObject).isBaubleSlot()) {
|
||||||
|
this.lockPlayerInventorySlot(slotIndex);
|
||||||
|
}
|
||||||
this.slot = slotIndex;
|
this.slot = slotIndex;
|
||||||
} else {
|
} else {
|
||||||
this.slot = -1;
|
this.slot = -1;
|
||||||
this.lockPlayerInventorySlot(ip.currentItem);
|
this.lockPlayerInventorySlot(ip.currentItem);
|
||||||
}
|
}
|
||||||
this.civ = monitorable;
|
|
||||||
this.bindPlayerInventory(ip, 0, 0);
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
|
||||||
|
this.portableCell = guiObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detectAndSendChanges() {
|
public void detectAndSendChanges() {
|
||||||
final ItemStack currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot(this.slot);
|
final ItemStack currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot(this.slot);
|
||||||
|
|
||||||
if (this.civ == null || currentItem.isEmpty()) {
|
if (this.portableCell == null || currentItem.isEmpty()) {
|
||||||
this.setValidContainer(false);
|
this.setValidContainer(false);
|
||||||
} else if (this.civ != null && !this.civ.getItemStack().isEmpty() && currentItem != this.civ.getItemStack()) {
|
} else if (!this.portableCell.getItemStack().isEmpty() && currentItem != this.portableCell.getItemStack()) {
|
||||||
if (ItemStack.areItemsEqual(this.civ.getItemStack(), currentItem)) {
|
if (!ItemStack.areItemsEqual(this.portableCell.getItemStack(), currentItem)) {
|
||||||
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.civ.getItemStack());
|
|
||||||
} else {
|
|
||||||
this.setValidContainer(false);
|
this.setValidContainer(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,7 +68,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable {
|
|||||||
// drain 1 ae t
|
// drain 1 ae t
|
||||||
this.ticks++;
|
this.ticks++;
|
||||||
if (this.ticks > 10) {
|
if (this.ticks > 10) {
|
||||||
this.civ.extractAEPower(this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG);
|
this.portableCell.extractAEPower(this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG);
|
||||||
this.ticks = 0;
|
this.ticks = 0;
|
||||||
}
|
}
|
||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
@@ -79,4 +81,9 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable {
|
|||||||
void setPowerMultiplier(final double powerMultiplier) {
|
void setPowerMultiplier(final double powerMultiplier) {
|
||||||
this.powerMultiplier = powerMultiplier;
|
this.powerMultiplier = powerMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventorySlot() {
|
||||||
|
return this.slot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2015, 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>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.container.implementations;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.PowerMultiplier;
|
||||||
|
import appeng.api.implementations.IUpgradeableCellContainer;
|
||||||
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
|
import appeng.api.networking.security.IActionHost;
|
||||||
|
import appeng.container.interfaces.IInventorySlotAware;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.localization.PlayerMessages;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
|
import appeng.parts.automation.StackUpgradeInventory;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.inv.IAEAppEngInventory;
|
||||||
|
import appeng.util.inv.InvOperation;
|
||||||
|
import baubles.api.BaublesApi;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.ClickType;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
|
||||||
|
public class ContainerMEPortableTerminal extends ContainerMEMonitorable implements IUpgradeableCellContainer, IAEAppEngInventory, IInventorySlotAware {
|
||||||
|
|
||||||
|
protected final WirelessTerminalGuiObject wirelessTerminalGUIObject;
|
||||||
|
private final int slot;
|
||||||
|
private double powerMultiplier = 0.5;
|
||||||
|
private int ticks = 0;
|
||||||
|
|
||||||
|
protected AppEngInternalInventory upgrades;
|
||||||
|
protected SlotRestrictedInput magnetSlot;
|
||||||
|
|
||||||
|
public ContainerMEPortableTerminal(InventoryPlayer ip, WirelessTerminalGuiObject guiObject, boolean bindInventory) {
|
||||||
|
super(ip, guiObject, guiObject, bindInventory);
|
||||||
|
if (guiObject != null) {
|
||||||
|
final int slotIndex = ((IInventorySlotAware) guiObject).getInventorySlot();
|
||||||
|
if (!((IInventorySlotAware) guiObject).isBaubleSlot()) {
|
||||||
|
this.lockPlayerInventorySlot(slotIndex);
|
||||||
|
}
|
||||||
|
this.slot = slotIndex;
|
||||||
|
} else {
|
||||||
|
this.slot = -1;
|
||||||
|
this.lockPlayerInventorySlot(ip.currentItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
|
||||||
|
this.wirelessTerminalGUIObject = guiObject;
|
||||||
|
this.upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2);
|
||||||
|
this.loadFromNBT();
|
||||||
|
this.setupUpgrades();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContainerMEPortableTerminal(InventoryPlayer ip, IPortableCell guiObject) {
|
||||||
|
super(ip, guiObject, guiObject, true);
|
||||||
|
if (guiObject != null) {
|
||||||
|
final int slotIndex = ((IInventorySlotAware) guiObject).getInventorySlot();
|
||||||
|
if (!((IInventorySlotAware) guiObject).isBaubleSlot()) {
|
||||||
|
this.lockPlayerInventorySlot(slotIndex);
|
||||||
|
}
|
||||||
|
this.slot = slotIndex;
|
||||||
|
} else {
|
||||||
|
this.slot = -1;
|
||||||
|
this.lockPlayerInventorySlot(ip.currentItem);
|
||||||
|
}
|
||||||
|
this.wirelessTerminalGUIObject = (WirelessTerminalGuiObject) guiObject;
|
||||||
|
this.upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2);
|
||||||
|
this.loadFromNBT();
|
||||||
|
this.setupUpgrades();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
|
||||||
|
final ItemStack currentItem;
|
||||||
|
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
||||||
|
currentItem = BaublesApi.getBaublesHandler(this.getPlayerInv().player).getStackInSlot(this.slot);
|
||||||
|
} else {
|
||||||
|
currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot(this.slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentItem.isEmpty()) {
|
||||||
|
this.setValidContainer(false);
|
||||||
|
} else if (!this.wirelessTerminalGUIObject.getItemStack().isEmpty() && currentItem != this.wirelessTerminalGUIObject.getItemStack()) {
|
||||||
|
if (ItemStack.areItemsEqual(this.wirelessTerminalGUIObject.getItemStack(), currentItem)) {
|
||||||
|
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
||||||
|
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
|
} else {
|
||||||
|
this.getPlayerInv().setInventorySlotContents(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.setValidContainer(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// drain 1 ae t
|
||||||
|
this.ticks++;
|
||||||
|
if (this.ticks > 10) {
|
||||||
|
double ext = this.wirelessTerminalGUIObject.extractAEPower(this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG);
|
||||||
|
if (ext < this.getPowerMultiplier() * this.ticks) {
|
||||||
|
if (Platform.isServer() && this.isValidContainer()) {
|
||||||
|
this.getPlayerInv().player.sendMessage(PlayerMessages.DeviceNotPowered.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setValidContainer(false);
|
||||||
|
}
|
||||||
|
this.ticks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.wirelessTerminalGUIObject.rangeCheck()) {
|
||||||
|
if (Platform.isServer() && this.isValidContainer()) {
|
||||||
|
this.getPlayerInv().player.sendMessage(PlayerMessages.OutOfRange.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setValidContainer(false);
|
||||||
|
} else {
|
||||||
|
this.setPowerMultiplier(AEConfig.instance().wireless_getDrainRate(this.wirelessTerminalGUIObject.getRange()));
|
||||||
|
}
|
||||||
|
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
|
||||||
|
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
|
||||||
|
if (clickTypeIn == ClickType.PICKUP && dragType == 1) {
|
||||||
|
if (this.inventorySlots.get(slotId) == magnetSlot) {
|
||||||
|
ItemStack itemStack = magnetSlot.getStack();
|
||||||
|
if (!magnetSlot.getStack().isEmpty()) {
|
||||||
|
NBTTagCompound tag = itemStack.getTagCompound();
|
||||||
|
if (tag == null) {
|
||||||
|
tag = new NBTTagCompound();
|
||||||
|
}
|
||||||
|
if (tag.hasKey("enabled")) {
|
||||||
|
boolean e = tag.getBoolean("enabled");
|
||||||
|
tag.setBoolean("enabled", !e);
|
||||||
|
} else {
|
||||||
|
tag.setBoolean("enabled", false);
|
||||||
|
}
|
||||||
|
magnetSlot.getStack().setTagCompound(tag);
|
||||||
|
magnetSlot.onSlotChanged();
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IActionHost getActionHost() {
|
||||||
|
return this.wirelessTerminalGUIObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getPowerMultiplier() {
|
||||||
|
return this.powerMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPowerMultiplier(final double powerMultiplier) {
|
||||||
|
this.powerMultiplier = powerMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int availableUpgrades() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setupUpgrades() {
|
||||||
|
if (wirelessTerminalGUIObject != null) {
|
||||||
|
for (int upgradeSlot = 0; upgradeSlot < availableUpgrades(); upgradeSlot++) {
|
||||||
|
this.magnetSlot = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, upgradeSlot, 206, 135 + upgradeSlot * 18, this.getInventoryPlayer());
|
||||||
|
this.magnetSlot.setNotDraggable();
|
||||||
|
this.addSlotToContainer(magnetSlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveChanges() {
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
this.upgrades.writeToNBT(tag, "upgrades");
|
||||||
|
|
||||||
|
this.wirelessTerminalGUIObject.saveChanges(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loadFromNBT() {
|
||||||
|
NBTTagCompound data = wirelessTerminalGUIObject.getItemStack().getTagCompound();
|
||||||
|
if (data != null) {
|
||||||
|
upgrades.readFromNBT(wirelessTerminalGUIObject.getItemStack().getTagCompound().getCompoundTag("upgrades"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventorySlot() {
|
||||||
|
return wirelessTerminalGUIObject.getInventorySlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBaubleSlot() {
|
||||||
|
return wirelessTerminalGUIObject.isBaubleSlot();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
|||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.client.gui.implementations.GuiNetworkStatus;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
@@ -42,6 +43,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerNetworkStatus extends AEBaseContainer {
|
public class ContainerNetworkStatus extends AEBaseContainer {
|
||||||
@@ -56,6 +58,7 @@ public class ContainerNetworkStatus extends AEBaseContainer {
|
|||||||
public long maxPower;
|
public long maxPower;
|
||||||
private IGrid network;
|
private IGrid network;
|
||||||
private int delay = 40;
|
private int delay = 40;
|
||||||
|
private GuiNetworkStatus guiNetworkStatus;
|
||||||
|
|
||||||
public ContainerNetworkStatus(final InventoryPlayer ip, final INetworkTool te) {
|
public ContainerNetworkStatus(final InventoryPlayer ip, final INetworkTool te) {
|
||||||
super(ip, null, null);
|
super(ip, null, null);
|
||||||
@@ -160,4 +163,12 @@ public class ContainerNetworkStatus extends AEBaseContainer {
|
|||||||
private void setPowerUsage(final long powerUsage) {
|
private void setPowerUsage(final long powerUsage) {
|
||||||
this.powerUsage = powerUsage;
|
this.powerUsage = powerUsage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postUpdate(final List<IAEItemStack> list) {
|
||||||
|
this.guiNetworkStatus.postUpdate(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGui(GuiNetworkStatus guiNetworkStatus) {
|
||||||
|
this.guiNetworkStatus = guiNetworkStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,734 @@
|
|||||||
|
package appeng.container.implementations;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.definitions.IDefinitions;
|
||||||
|
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||||
|
import appeng.api.networking.security.IActionHost;
|
||||||
|
import appeng.api.storage.IMEMonitor;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.container.ContainerNull;
|
||||||
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.IOptionalSlotHost;
|
||||||
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
|
import appeng.container.slot.SlotPlayerHotBar;
|
||||||
|
import appeng.container.slot.SlotPlayerInv;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
import appeng.core.sync.packets.PacketPatternSlot;
|
||||||
|
import appeng.helpers.IContainerCraftingPacket;
|
||||||
|
import appeng.items.storage.ItemViewCell;
|
||||||
|
import appeng.me.helpers.MachineSource;
|
||||||
|
import appeng.parts.reporting.AbstractPartEncoder;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.util.InventoryAdaptor;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.inv.AdaptorItemHandler;
|
||||||
|
import appeng.util.inv.IAEAppEngInventory;
|
||||||
|
import appeng.util.inv.InvOperation;
|
||||||
|
import appeng.util.inv.WrapperCursorItemHandler;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.*;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.nbt.NBTBase;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static appeng.helpers.ItemStackHelper.stackWriteToNBT;
|
||||||
|
|
||||||
|
public abstract class ContainerPatternEncoder extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
||||||
|
|
||||||
|
protected AbstractPartEncoder patternTerminal = null;
|
||||||
|
|
||||||
|
protected IGuiItemObject iGuiItemObject = null;
|
||||||
|
|
||||||
|
final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
|
||||||
|
|
||||||
|
protected IItemHandler crafting;
|
||||||
|
protected SlotPatternTerm craftSlot;
|
||||||
|
protected SlotRestrictedInput patternSlotIN;
|
||||||
|
protected SlotRestrictedInput patternSlotOUT;
|
||||||
|
protected IRecipe currentRecipe;
|
||||||
|
|
||||||
|
protected SlotFakeCraftingMatrix[] craftingSlots;
|
||||||
|
protected OptionalSlotFake[] outputSlots;
|
||||||
|
|
||||||
|
@GuiSync(97)
|
||||||
|
public boolean craftingMode = true;
|
||||||
|
@GuiSync(96)
|
||||||
|
public boolean substitute = false;
|
||||||
|
|
||||||
|
protected ContainerPatternEncoder(InventoryPlayer ip, ITerminalHost monitorable, boolean bindInventory) {
|
||||||
|
super(ip, monitorable, bindInventory);
|
||||||
|
patternTerminal = (AbstractPartEncoder) monitorable;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ContainerPatternEncoder(InventoryPlayer ip, ITerminalHost monitorable, IGuiItemObject iGuiItemObject, boolean bindInventory) {
|
||||||
|
super(ip, monitorable, iGuiItemObject, bindInventory);
|
||||||
|
if (monitorable instanceof AbstractPartEncoder) {
|
||||||
|
patternTerminal = (AbstractPartEncoder) monitorable;
|
||||||
|
}
|
||||||
|
this.iGuiItemObject = iGuiItemObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
||||||
|
if (Platform.isClient()) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
if (this.inventorySlots.get(idx) instanceof SlotPlayerInv || this.inventorySlots.get(idx) instanceof SlotPlayerHotBar) {
|
||||||
|
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx); // require AE SLots!
|
||||||
|
ItemStack itemStack = clickSlot.getStack();
|
||||||
|
if (AEApi.instance().definitions().materials().blankPattern().isSameAs(itemStack)) {
|
||||||
|
IItemHandler patternInv = this.getPart().getInventoryByName("pattern");
|
||||||
|
ItemStack remainder = patternInv.insertItem(0, itemStack, false);
|
||||||
|
clickSlot.putStack(remainder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.transferStackInSlot(p, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractPartEncoder getPart() {
|
||||||
|
return this.patternTerminal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract boolean isSlotEnabled(int idx);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemHandler getInventoryByName(String name) {
|
||||||
|
if (name.equals("player")) {
|
||||||
|
return new PlayerInvWrapper(this.getInventoryPlayer());
|
||||||
|
}
|
||||||
|
if (this.getPart() != null) {
|
||||||
|
return this.getPart().getInventoryByName(name);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean useRealItems() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveChanges() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||||
|
if (inv == this.crafting) {
|
||||||
|
this.fixCraftingRecipes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fixCraftingRecipes() {
|
||||||
|
if (this.isCraftingMode()) {
|
||||||
|
for (int x = 0; x < this.crafting.getSlots(); x++) {
|
||||||
|
final ItemStack is = this.crafting.getStackInSlot(x);
|
||||||
|
if (!is.isEmpty()) {
|
||||||
|
is.setCount(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void putStackInSlot(int slotID, ItemStack stack) {
|
||||||
|
super.putStackInSlot(slotID, stack);
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateOrderOfOutputSlots() {
|
||||||
|
if (!this.isCraftingMode()) {
|
||||||
|
if (craftSlot != null) {
|
||||||
|
this.craftSlot.xPos = -9000;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
this.outputSlots[y].xPos = this.outputSlots[y].getX();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (craftSlot != null) {
|
||||||
|
this.craftSlot.xPos = this.craftSlot.getX();
|
||||||
|
}
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
this.outputSlots[y].xPos = -9000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSlotChange(final Slot s) {
|
||||||
|
if (s == this.patternSlotOUT && Platform.isServer()) {
|
||||||
|
for (final IContainerListener listener : this.listeners) {
|
||||||
|
for (final Slot slot : this.inventorySlots) {
|
||||||
|
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
||||||
|
listener.sendSlotContents(this, slot.slotNumber, slot.getStack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (listener instanceof EntityPlayerMP) {
|
||||||
|
((EntityPlayerMP) listener).isChangingQuantityOnly = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
if (s == this.craftSlot && Platform.isClient()) {
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encodeAndMoveToInventory() {
|
||||||
|
encode();
|
||||||
|
ItemStack output = this.patternSlotOUT.getStack();
|
||||||
|
if (!output.isEmpty()) {
|
||||||
|
if (!getPlayerInv().addItemStackToInventory(output)) {
|
||||||
|
getPlayerInv().player.dropItem(output, false);
|
||||||
|
}
|
||||||
|
this.patternSlotOUT.putStack(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void encode() {
|
||||||
|
ItemStack output = this.patternSlotOUT.getStack();
|
||||||
|
|
||||||
|
final ItemStack[] in = this.getInputs();
|
||||||
|
final ItemStack[] out = this.getOutputs();
|
||||||
|
|
||||||
|
// if there is no input, this would be silly.
|
||||||
|
if (in == null || out == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// first check the output slots, should either be null, or a pattern
|
||||||
|
if (!output.isEmpty() && !this.isPattern(output)) {
|
||||||
|
return;
|
||||||
|
} // if nothing is there we should snag a new pattern.
|
||||||
|
else if (output.isEmpty()) {
|
||||||
|
output = this.patternSlotIN.getStack();
|
||||||
|
if (output.isEmpty() || !this.isPattern(output)) {
|
||||||
|
return; // no blanks.
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove one, and clear the input slot.
|
||||||
|
output.setCount(output.getCount() - 1);
|
||||||
|
if (output.getCount() == 0) {
|
||||||
|
this.patternSlotIN.putStack(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add a new encoded pattern.
|
||||||
|
Optional<ItemStack> maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack(1);
|
||||||
|
if (maybePattern.isPresent()) {
|
||||||
|
output = maybePattern.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// encode the slot.
|
||||||
|
final NBTTagCompound encodedValue = new NBTTagCompound();
|
||||||
|
|
||||||
|
final NBTTagList tagIn = new NBTTagList();
|
||||||
|
final NBTTagList tagOut = new NBTTagList();
|
||||||
|
|
||||||
|
for (final ItemStack i : in) {
|
||||||
|
tagIn.appendTag(this.createItemTag(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final ItemStack i : out) {
|
||||||
|
tagOut.appendTag(this.createItemTag(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
encodedValue.setTag("in", tagIn);
|
||||||
|
encodedValue.setTag("out", tagOut);
|
||||||
|
encodedValue.setBoolean("crafting", this.isCraftingMode());
|
||||||
|
encodedValue.setBoolean("substitute", this.isSubstitute());
|
||||||
|
|
||||||
|
output.setTagCompound(encodedValue);
|
||||||
|
|
||||||
|
patternSlotOUT.putStack(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void multiply(int multiple) {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canMultiplyInputs = true;
|
||||||
|
boolean canMultiplyOutputs = true;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() * multiple < 1) {
|
||||||
|
canMultiplyInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
if (!out.isEmpty() && out.getCount() * multiple < 1) {
|
||||||
|
canMultiplyOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canMultiplyInputs && canMultiplyOutputs) {
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() * multiple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() * multiple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void divide(int divide) {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canDivideInputs = true;
|
||||||
|
boolean canDivideOutputs = true;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() % divide != 0) {
|
||||||
|
canDivideInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
if (!out.isEmpty() && out.getCount() % divide != 0) {
|
||||||
|
canDivideOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canDivideInputs && canDivideOutputs) {
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() / divide);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() / divide);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void increase(int increase) {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canIncreaseInputs = true;
|
||||||
|
boolean canIncreaseOutputs = true;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() + increase < 1) {
|
||||||
|
canIncreaseInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
if (!out.isEmpty() && out.getCount() + increase < 1) {
|
||||||
|
canIncreaseOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canIncreaseInputs && canIncreaseOutputs) {
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() + increase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() + increase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrease(int decrease) {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canDecreaseInputs = true;
|
||||||
|
boolean canDecreaseOutputs = true;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() - decrease < 1) {
|
||||||
|
canDecreaseInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
if (!out.isEmpty() && out.getCount() - decrease < 1) {
|
||||||
|
canDecreaseOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canDecreaseInputs && canDecreaseOutputs) {
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() - decrease);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() - decrease);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void maximizeCount() {
|
||||||
|
ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean canGrowInputs = true;
|
||||||
|
boolean canGrowOutputs = true;
|
||||||
|
int maxInputStackGrowth = 0;
|
||||||
|
int maxOutputStackGrowth = 0;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty() && input[x].getMaxStackSize() - input[x].getCount() > maxInputStackGrowth) {
|
||||||
|
maxInputStackGrowth = input[x].getMaxStackSize() - input[x].getCount();
|
||||||
|
}
|
||||||
|
if (!input[x].isEmpty() && input[x].getCount() + maxInputStackGrowth > input[x].getMaxStackSize()) {
|
||||||
|
canGrowInputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
{
|
||||||
|
maxOutputStackGrowth = out.getMaxStackSize() - out.getCount();
|
||||||
|
}
|
||||||
|
if (!out.isEmpty() && out.getCount() + maxOutputStackGrowth > out.getMaxStackSize()) {
|
||||||
|
canGrowOutputs = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canGrowInputs && canGrowOutputs) {
|
||||||
|
int maxStackGrowth = Math.min(maxInputStackGrowth, maxOutputStackGrowth);
|
||||||
|
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
||||||
|
ItemStack stack = craftingSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
craftingSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
ItemStack stack = outputSlot.getStack();
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
outputSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ItemStack[] getInputs() {
|
||||||
|
final ItemStack[] input = new ItemStack[craftingSlots.length];
|
||||||
|
boolean hasValue = false;
|
||||||
|
|
||||||
|
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||||
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
|
if (!input[x].isEmpty()) {
|
||||||
|
hasValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasValue) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ItemStack[] getOutputs() {
|
||||||
|
if (this.isCraftingMode()) {
|
||||||
|
final ItemStack out = this.getAndUpdateOutput();
|
||||||
|
|
||||||
|
if (!out.isEmpty() && out.getCount() > 0) {
|
||||||
|
return new ItemStack[]{out};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final List<ItemStack> list = new ArrayList<>(outputSlots.length);
|
||||||
|
boolean hasValue = false;
|
||||||
|
|
||||||
|
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||||
|
final ItemStack out = outputSlot.getStack();
|
||||||
|
|
||||||
|
if (!out.isEmpty() && out.getCount() > 0) {
|
||||||
|
list.add(out);
|
||||||
|
hasValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasValue) {
|
||||||
|
return list.toArray(new ItemStack[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ItemStack getAndUpdateOutput() {
|
||||||
|
final World world = this.getPlayerInv().player.world;
|
||||||
|
final InventoryCrafting ic = new InventoryCrafting(this, 3, 3);
|
||||||
|
|
||||||
|
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||||
|
ic.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.currentRecipe == null || !this.currentRecipe.matches(ic, world)) {
|
||||||
|
this.currentRecipe = CraftingManager.findMatchingRecipe(ic, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
final ItemStack is;
|
||||||
|
|
||||||
|
if (this.currentRecipe == null) {
|
||||||
|
is = ItemStack.EMPTY;
|
||||||
|
} else {
|
||||||
|
is = this.currentRecipe.getCraftingResult(ic);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cOut.setStackInSlot(0, is);
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCraftingMode() {
|
||||||
|
return this.craftingMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCraftingMode(final boolean craftingMode) {
|
||||||
|
this.craftingMode = craftingMode;
|
||||||
|
if (getPart() != null) {
|
||||||
|
getPart().setCraftingRecipe(craftingMode);
|
||||||
|
} else if (iGuiItemObject != null) {
|
||||||
|
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
|
||||||
|
if (nbtTagCompound != null) {
|
||||||
|
nbtTagCompound.setBoolean("isCraftingMode", craftingMode);
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (craftingMode) {
|
||||||
|
this.fixCraftingRecipes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boolean isSubstitute() {
|
||||||
|
return this.substitute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubstitute(final boolean substitute) {
|
||||||
|
this.substitute = substitute;
|
||||||
|
if (getPart() != null) {
|
||||||
|
getPart().setSubstitution(substitute);
|
||||||
|
} else if (iGuiItemObject != null) {
|
||||||
|
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
|
||||||
|
if (nbtTagCompound != null) {
|
||||||
|
nbtTagCompound.setBoolean("isSubstitute", substitute);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
if (getPart() != null) {
|
||||||
|
if (this.isCraftingMode() != this.getPart().isCraftingRecipe()) {
|
||||||
|
this.setCraftingMode(this.getPart().isCraftingRecipe());
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
}
|
||||||
|
this.substitute = this.getPart().isSubstitution();
|
||||||
|
} else if (iGuiItemObject != null) {
|
||||||
|
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
|
||||||
|
if (nbtTagCompound != null) {
|
||||||
|
if (nbtTagCompound.hasKey("isCraftingMode")) {
|
||||||
|
boolean crafting = nbtTagCompound.getBoolean("isCraftingMode");
|
||||||
|
if (this.isCraftingMode() != crafting) {
|
||||||
|
this.setCraftingMode(crafting);
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nbtTagCompound.setBoolean("isCraftingMode", false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nbtTagCompound = new NBTTagCompound();
|
||||||
|
nbtTagCompound.setBoolean("isCraftingMode", false);
|
||||||
|
iGuiItemObject.getItemStack().setTagCompound(nbtTagCompound);
|
||||||
|
}
|
||||||
|
nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
|
||||||
|
if (nbtTagCompound != null) {
|
||||||
|
if (nbtTagCompound.hasKey("isSubstitute")) {
|
||||||
|
boolean substitute = nbtTagCompound.getBoolean("isSubstitute");
|
||||||
|
if (this.isSubstitute() != substitute) {
|
||||||
|
this.setSubstitute(substitute);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nbtTagCompound.setBoolean("isSubstitute", false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nbtTagCompound = new NBTTagCompound();
|
||||||
|
nbtTagCompound.setBoolean("isSubstitute", false);
|
||||||
|
iGuiItemObject.getItemStack().setTagCompound(nbtTagCompound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||||
|
super.onUpdate(field, oldValue, newValue);
|
||||||
|
|
||||||
|
if (field.equals("craftingMode")) {
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isPattern(final ItemStack output) {
|
||||||
|
if (output.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final IDefinitions definitions = AEApi.instance().definitions();
|
||||||
|
|
||||||
|
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
||||||
|
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
||||||
|
|
||||||
|
return isPattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTBase createItemTag(final ItemStack i) {
|
||||||
|
final NBTTagCompound c = new NBTTagCompound();
|
||||||
|
|
||||||
|
if (!i.isEmpty()) {
|
||||||
|
stackWriteToNBT(i, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
for (final Slot s : this.craftingSlots) {
|
||||||
|
s.putStack(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final Slot s : this.outputSlots) {
|
||||||
|
s.putStack(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void craftOrGetItem(final PacketPatternSlot packetPatternSlot) {
|
||||||
|
if (packetPatternSlot.slotItem != null && this.getCellInventory() != null) {
|
||||||
|
final IAEItemStack out = packetPatternSlot.slotItem.copy();
|
||||||
|
InventoryAdaptor inv = new AdaptorItemHandler(new WrapperCursorItemHandler(this.getPlayerInv().player.inventory));
|
||||||
|
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(this.getPlayerInv().player);
|
||||||
|
|
||||||
|
if (packetPatternSlot.shift) {
|
||||||
|
inv = playerInv;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inv.simulateAdd(out.createItemStack()).isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final IAEItemStack extracted = Platform.poweredExtraction(this.getPowerSource(), this.getCellInventory(), out, this.getActionSource());
|
||||||
|
final EntityPlayer p = this.getPlayerInv().player;
|
||||||
|
|
||||||
|
if (extracted != null) {
|
||||||
|
inv.addItems(extracted.createItemStack());
|
||||||
|
if (p instanceof EntityPlayerMP) {
|
||||||
|
this.updateHeld((EntityPlayerMP) p);
|
||||||
|
}
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final InventoryCrafting ic = new InventoryCrafting(new ContainerNull(), 3, 3);
|
||||||
|
final InventoryCrafting real = new InventoryCrafting(new ContainerNull(), 3, 3);
|
||||||
|
|
||||||
|
for (int x = 0; x < 9; x++) {
|
||||||
|
ic.setInventorySlotContents(x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY : packetPatternSlot.pattern[x].createItemStack());
|
||||||
|
}
|
||||||
|
|
||||||
|
final IRecipe r = CraftingManager.findMatchingRecipe(ic, p.world);
|
||||||
|
|
||||||
|
if (r == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMEMonitor<IAEItemStack> storage = null;
|
||||||
|
if (getPart() != null) {
|
||||||
|
storage = this.getPart()
|
||||||
|
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||||
|
} else if (iGuiItemObject != null) {
|
||||||
|
storage = ((ITerminalHost) iGuiItemObject).getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
final IItemList<IAEItemStack> all = storage.getStorageList();
|
||||||
|
|
||||||
|
final ItemStack is = r.getCraftingResult(ic);
|
||||||
|
|
||||||
|
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||||
|
if (!ic.getStackInSlot(x).isEmpty()) {
|
||||||
|
final ItemStack pulled = Platform.extractItemsByRecipe(this.getPowerSource(), this.getActionSource(), storage, p.world, r, is, ic,
|
||||||
|
ic.getStackInSlot(x), x, all, Actionable.MODULATE, ItemViewCell.createFilter(this.getViewCells()));
|
||||||
|
real.setInventorySlotContents(x, pulled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final IRecipe rr = CraftingManager.findMatchingRecipe(real, p.world);
|
||||||
|
|
||||||
|
if (rr == r && Platform.itemComparisons().isSameItem(rr.getCraftingResult(real), is)) {
|
||||||
|
final InventoryCraftResult craftingResult = new InventoryCraftResult();
|
||||||
|
craftingResult.setRecipeUsed(rr);
|
||||||
|
|
||||||
|
final SlotCrafting sc = new SlotCrafting(p, real, craftingResult, 0, 0, 0);
|
||||||
|
sc.onTake(p, is);
|
||||||
|
|
||||||
|
for (int x = 0; x < real.getSizeInventory(); x++) {
|
||||||
|
final ItemStack failed = playerInv.addItems(real.getStackInSlot(x));
|
||||||
|
|
||||||
|
if (!failed.isEmpty()) {
|
||||||
|
p.dropItem(failed, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inv.addItems(is);
|
||||||
|
if (p instanceof EntityPlayerMP) {
|
||||||
|
this.updateHeld((EntityPlayerMP) p);
|
||||||
|
}
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
} else {
|
||||||
|
for (int x = 0; x < real.getSizeInventory(); x++) {
|
||||||
|
final ItemStack failed = real.getStackInSlot(x);
|
||||||
|
if (!failed.isEmpty()) {
|
||||||
|
this.getCellInventory()
|
||||||
|
.injectItems(AEItemStack.fromItemStack(failed), Actionable.MODULATE,
|
||||||
|
new MachineSource(this.getPart() != null ? this.getPart() : (IActionHost) iGuiItemObject));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,74 +19,30 @@
|
|||||||
package appeng.container.implementations;
|
package appeng.container.implementations;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.Actionable;
|
|
||||||
import appeng.api.definitions.IDefinitions;
|
|
||||||
import appeng.api.storage.IMEMonitor;
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.container.slot.SlotPatternOutputs;
|
||||||
import appeng.container.ContainerNull;
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.container.slot.*;
|
|
||||||
import appeng.core.sync.packets.PacketPatternSlot;
|
|
||||||
import appeng.helpers.IContainerCraftingPacket;
|
|
||||||
import appeng.items.storage.ItemViewCell;
|
|
||||||
import appeng.me.helpers.MachineSource;
|
|
||||||
import appeng.parts.reporting.PartPatternTerminal;
|
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
|
||||||
import appeng.util.InventoryAdaptor;
|
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.inv.AdaptorItemHandler;
|
|
||||||
import appeng.util.inv.IAEAppEngInventory;
|
|
||||||
import appeng.util.inv.InvOperation;
|
|
||||||
import appeng.util.inv.WrapperCursorItemHandler;
|
|
||||||
import appeng.util.item.AEItemStack;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.*;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
|
|
||||||
public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
public class ContainerPatternTerm extends ContainerPatternEncoder {
|
||||||
|
|
||||||
private final PartPatternTerminal patternTerminal;
|
|
||||||
private final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
|
|
||||||
private final IItemHandler crafting;
|
|
||||||
private final SlotFakeCraftingMatrix[] craftingSlots = new SlotFakeCraftingMatrix[9];
|
|
||||||
private final OptionalSlotFake[] outputSlots = new OptionalSlotFake[3];
|
|
||||||
private final SlotPatternTerm craftSlot;
|
|
||||||
private final SlotRestrictedInput patternSlotIN;
|
|
||||||
private final SlotRestrictedInput patternSlotOUT;
|
|
||||||
|
|
||||||
private IRecipe currentRecipe;
|
|
||||||
@GuiSync(97)
|
|
||||||
public boolean craftingMode = true;
|
|
||||||
@GuiSync(96)
|
|
||||||
public boolean substitute = false;
|
|
||||||
|
|
||||||
public ContainerPatternTerm(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
public ContainerPatternTerm(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||||
super(ip, monitorable, false);
|
super(ip, monitorable, false);
|
||||||
this.patternTerminal = (PartPatternTerminal) monitorable;
|
|
||||||
|
|
||||||
final IItemHandler patternInv = this.getPatternTerminal().getInventoryByName("pattern");
|
this.craftingSlots = new SlotFakeCraftingMatrix[9];
|
||||||
final IItemHandler output = this.getPatternTerminal().getInventoryByName("output");
|
this.outputSlots = new OptionalSlotFake[3];
|
||||||
|
|
||||||
this.crafting = this.getPatternTerminal().getInventoryByName("crafting");
|
final IItemHandler patternInv = this.getPart().getInventoryByName("pattern");
|
||||||
|
final IItemHandler output = this.getPart().getInventoryByName("output");
|
||||||
|
|
||||||
|
this.crafting = this.getPart().getInventoryByName("crafting");
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
for (int y = 0; y < 3; y++) {
|
||||||
for (int x = 0; x < 3; x++) {
|
for (int x = 0; x < 3; x++) {
|
||||||
@@ -98,7 +54,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
.getPowerSource(), monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this));
|
.getPowerSource(), monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this));
|
||||||
this.craftSlot.setIIcon(-1);
|
this.craftSlot.setIIcon(-1);
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
for (int y = 0; y < this.outputSlots.length; y++) {
|
||||||
this.addSlotToContainer(this.outputSlots[y] = new SlotPatternOutputs(output, this, y, 110, -76 + y * 18, 0, 0, 1));
|
this.addSlotToContainer(this.outputSlots[y] = new SlotPatternOutputs(output, this, y, 110, -76 + y * 18, 0, 0, 1));
|
||||||
this.outputSlots[y].setRenderDisabled(false);
|
this.outputSlots[y].setRenderDisabled(false);
|
||||||
this.outputSlots[y].setIIcon(-1);
|
this.outputSlots[y].setIIcon(-1);
|
||||||
@@ -117,575 +73,16 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
this.updateOrderOfOutputSlots();
|
this.updateOrderOfOutputSlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
|
||||||
if (Platform.isClient()) {
|
|
||||||
return ItemStack.EMPTY;
|
|
||||||
}
|
|
||||||
if (this.inventorySlots.get(idx) instanceof SlotPlayerInv || this.inventorySlots.get(idx) instanceof SlotPlayerHotBar) {
|
|
||||||
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx); // require AE SLots!
|
|
||||||
ItemStack itemStack = clickSlot.getStack();
|
|
||||||
if (AEApi.instance().definitions().materials().blankPattern().isSameAs(itemStack)) {
|
|
||||||
IItemHandler patternInv = this.getPatternTerminal().getInventoryByName("pattern");
|
|
||||||
ItemStack remainder = patternInv.insertItem(0, itemStack, false);
|
|
||||||
clickSlot.putStack(remainder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.transferStackInSlot(p, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void updateOrderOfOutputSlots() {
|
|
||||||
if (!this.isCraftingMode()) {
|
|
||||||
this.craftSlot.xPos = -9000;
|
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
|
||||||
this.outputSlots[y].xPos = this.outputSlots[y].getX();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.craftSlot.xPos = this.craftSlot.getX();
|
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
|
||||||
this.outputSlots[y].xPos = -9000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putStackInSlot(int slotID, ItemStack stack) {
|
|
||||||
super.putStackInSlot(slotID, stack);
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemStack getAndUpdateOutput() {
|
|
||||||
final World world = this.getPlayerInv().player.world;
|
|
||||||
final InventoryCrafting ic = new InventoryCrafting(this, 3, 3);
|
|
||||||
|
|
||||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
|
||||||
ic.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.currentRecipe == null || !this.currentRecipe.matches(ic, world)) {
|
|
||||||
this.currentRecipe = CraftingManager.findMatchingRecipe(ic, world);
|
|
||||||
}
|
|
||||||
|
|
||||||
final ItemStack is;
|
|
||||||
|
|
||||||
if (this.currentRecipe == null) {
|
|
||||||
is = ItemStack.EMPTY;
|
|
||||||
} else {
|
|
||||||
is = this.currentRecipe.getCraftingResult(ic);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.cOut.setStackInSlot(0, is);
|
|
||||||
return is;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveChanges() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void encodeAndMoveToInventory() {
|
|
||||||
encode();
|
|
||||||
ItemStack output = this.patternSlotOUT.getStack();
|
|
||||||
if (!output.isEmpty()) {
|
|
||||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
|
||||||
getPlayerInv().player.dropItem(output, false);
|
|
||||||
}
|
|
||||||
this.patternSlotOUT.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void encode() {
|
|
||||||
ItemStack output = this.patternSlotOUT.getStack();
|
|
||||||
|
|
||||||
final ItemStack[] in = this.getInputs();
|
|
||||||
final ItemStack[] out = this.getOutputs();
|
|
||||||
|
|
||||||
// if there is no input, this would be silly.
|
|
||||||
if (in == null || out == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// first check the output slots, should either be null, or a pattern
|
|
||||||
if (!output.isEmpty() && !this.isPattern(output)) {
|
|
||||||
return;
|
|
||||||
} // if nothing is there we should snag a new pattern.
|
|
||||||
else if (output.isEmpty()) {
|
|
||||||
output = this.patternSlotIN.getStack();
|
|
||||||
if (output.isEmpty() || !this.isPattern(output)) {
|
|
||||||
return; // no blanks.
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove one, and clear the input slot.
|
|
||||||
output.setCount(output.getCount() - 1);
|
|
||||||
if (output.getCount() == 0) {
|
|
||||||
this.patternSlotIN.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add a new encoded pattern.
|
|
||||||
Optional<ItemStack> maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack(1);
|
|
||||||
if (maybePattern.isPresent()) {
|
|
||||||
output = maybePattern.get();
|
|
||||||
this.patternSlotOUT.putStack(output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// encode the slot.
|
|
||||||
final NBTTagCompound encodedValue = new NBTTagCompound();
|
|
||||||
|
|
||||||
final NBTTagList tagIn = new NBTTagList();
|
|
||||||
final NBTTagList tagOut = new NBTTagList();
|
|
||||||
|
|
||||||
for (final ItemStack i : in) {
|
|
||||||
tagIn.appendTag(this.createItemTag(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final ItemStack i : out) {
|
|
||||||
tagOut.appendTag(this.createItemTag(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
encodedValue.setTag("in", tagIn);
|
|
||||||
encodedValue.setTag("out", tagOut);
|
|
||||||
encodedValue.setBoolean("crafting", this.isCraftingMode());
|
|
||||||
encodedValue.setBoolean("substitute", this.isSubstitute());
|
|
||||||
|
|
||||||
output.setTagCompound(encodedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void multiply(int multiple) {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canMultiplyInputs = true;
|
|
||||||
boolean canMultiplyOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() * multiple > input[x].getMaxStackSize()) {
|
|
||||||
canMultiplyInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() * multiple > out.getMaxStackSize()) {
|
|
||||||
canMultiplyOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canMultiplyInputs && canMultiplyOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void divide(int divide) {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canDivideInputs = true;
|
|
||||||
boolean canDivideOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() % divide != 0) {
|
|
||||||
canDivideInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() % divide != 0) {
|
|
||||||
canDivideOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canDivideInputs && canDivideOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void increase(int increase) {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canIncreaseInputs = true;
|
|
||||||
boolean canIncreaseOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() + increase > input[x].getMaxStackSize()) {
|
|
||||||
canIncreaseInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() + increase > out.getMaxStackSize()) {
|
|
||||||
canIncreaseOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canIncreaseInputs && canIncreaseOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void decrease(int decrease) {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canDecreaseInputs = true;
|
|
||||||
boolean canDecreaseOutputs = true;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() - decrease < 1) {
|
|
||||||
canDecreaseInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (!out.isEmpty() && out.getCount() - decrease < 1) {
|
|
||||||
canDecreaseOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canDecreaseInputs && canDecreaseOutputs) {
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void maximizeCount() {
|
|
||||||
ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean canGrowInputs = true;
|
|
||||||
boolean canGrowOutputs = true;
|
|
||||||
int maxInputStackGrowth = 0;
|
|
||||||
int maxOutputStackGrowth = 0;
|
|
||||||
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty() && input[x].getMaxStackSize() - input[x].getCount() > maxInputStackGrowth) {
|
|
||||||
maxInputStackGrowth = input[x].getMaxStackSize() - input[x].getCount();
|
|
||||||
}
|
|
||||||
if (!input[x].isEmpty() && input[x].getCount() + maxInputStackGrowth > input[x].getMaxStackSize()) {
|
|
||||||
canGrowInputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
{
|
|
||||||
maxOutputStackGrowth = out.getMaxStackSize() - out.getCount();
|
|
||||||
}
|
|
||||||
if (!out.isEmpty() && out.getCount() + maxOutputStackGrowth > out.getMaxStackSize()) {
|
|
||||||
canGrowOutputs = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canGrowInputs && canGrowOutputs) {
|
|
||||||
int maxStackGrowth = Math.min(maxInputStackGrowth, maxOutputStackGrowth);
|
|
||||||
for (SlotFakeCraftingMatrix craftingSlot : this.craftingSlots) {
|
|
||||||
ItemStack stack = craftingSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
craftingSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
|
||||||
}
|
|
||||||
for (OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
ItemStack stack = outputSlot.getStack();
|
|
||||||
if (!stack.isEmpty())
|
|
||||||
outputSlot.getStack().setCount(stack.getCount() + maxStackGrowth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemStack[] getInputs() {
|
|
||||||
final ItemStack[] input = new ItemStack[9];
|
|
||||||
boolean hasValue = false;
|
|
||||||
|
|
||||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
|
||||||
if (!input[x].isEmpty()) {
|
|
||||||
hasValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasValue) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ItemStack[] getOutputs() {
|
|
||||||
if (this.isCraftingMode()) {
|
|
||||||
final ItemStack out = this.getAndUpdateOutput();
|
|
||||||
|
|
||||||
if (!out.isEmpty() && out.getCount() > 0) {
|
|
||||||
return new ItemStack[]{out};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final List<ItemStack> list = new ArrayList<>(3);
|
|
||||||
boolean hasValue = false;
|
|
||||||
|
|
||||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
|
|
||||||
if (!out.isEmpty() && out.getCount() > 0) {
|
|
||||||
list.add(out);
|
|
||||||
hasValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasValue) {
|
|
||||||
return list.toArray(new ItemStack[list.size()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isPattern(final ItemStack output) {
|
|
||||||
if (output.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final IDefinitions definitions = AEApi.instance().definitions();
|
|
||||||
|
|
||||||
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
|
||||||
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
|
||||||
|
|
||||||
return isPattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
NBTBase createItemTag(final ItemStack i) {
|
|
||||||
final NBTTagCompound c = new NBTTagCompound();
|
|
||||||
|
|
||||||
if (!i.isEmpty()) {
|
|
||||||
i.writeToNBT(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSlotEnabled(final int idx) {
|
public boolean isSlotEnabled(final int idx) {
|
||||||
if (idx == 1) {
|
if (idx == 1) {
|
||||||
return Platform.isServer() ? !this.getPatternTerminal().isCraftingRecipe() : !this.isCraftingMode();
|
return Platform.isServer() ? !this.getPart().isCraftingRecipe() : !this.isCraftingMode();
|
||||||
} else if (idx == 2) {
|
} else if (idx == 2) {
|
||||||
return Platform.isServer() ? this.getPatternTerminal().isCraftingRecipe() : this.isCraftingMode();
|
return Platform.isServer() ? this.getPart().isCraftingRecipe() : this.isCraftingMode();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void craftOrGetItem(final PacketPatternSlot packetPatternSlot) {
|
|
||||||
if (packetPatternSlot.slotItem != null && this.getCellInventory() != null) {
|
|
||||||
final IAEItemStack out = packetPatternSlot.slotItem.copy();
|
|
||||||
InventoryAdaptor inv = new AdaptorItemHandler(new WrapperCursorItemHandler(this.getPlayerInv().player.inventory));
|
|
||||||
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(this.getPlayerInv().player);
|
|
||||||
|
|
||||||
if (packetPatternSlot.shift) {
|
|
||||||
inv = playerInv;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inv.simulateAdd(out.createItemStack()).isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final IAEItemStack extracted = Platform.poweredExtraction(this.getPowerSource(), this.getCellInventory(), out, this.getActionSource());
|
|
||||||
final EntityPlayer p = this.getPlayerInv().player;
|
|
||||||
|
|
||||||
if (extracted != null) {
|
|
||||||
inv.addItems(extracted.createItemStack());
|
|
||||||
if (p instanceof EntityPlayerMP) {
|
|
||||||
this.updateHeld((EntityPlayerMP) p);
|
|
||||||
}
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final InventoryCrafting ic = new InventoryCrafting(new ContainerNull(), 3, 3);
|
|
||||||
final InventoryCrafting real = new InventoryCrafting(new ContainerNull(), 3, 3);
|
|
||||||
|
|
||||||
for (int x = 0; x < 9; x++) {
|
|
||||||
ic.setInventorySlotContents(x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY : packetPatternSlot.pattern[x].createItemStack());
|
|
||||||
}
|
|
||||||
|
|
||||||
final IRecipe r = CraftingManager.findMatchingRecipe(ic, p.world);
|
|
||||||
|
|
||||||
if (r == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal()
|
|
||||||
.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
|
||||||
final IItemList<IAEItemStack> all = storage.getStorageList();
|
|
||||||
|
|
||||||
final ItemStack is = r.getCraftingResult(ic);
|
|
||||||
|
|
||||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
|
||||||
if (!ic.getStackInSlot(x).isEmpty()) {
|
|
||||||
final ItemStack pulled = Platform.extractItemsByRecipe(this.getPowerSource(), this.getActionSource(), storage, p.world, r, is, ic,
|
|
||||||
ic.getStackInSlot(x), x, all, Actionable.MODULATE, ItemViewCell.createFilter(this.getViewCells()));
|
|
||||||
real.setInventorySlotContents(x, pulled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final IRecipe rr = CraftingManager.findMatchingRecipe(real, p.world);
|
|
||||||
|
|
||||||
if (rr == r && Platform.itemComparisons().isSameItem(rr.getCraftingResult(real), is)) {
|
|
||||||
final InventoryCraftResult craftingResult = new InventoryCraftResult();
|
|
||||||
craftingResult.setRecipeUsed(rr);
|
|
||||||
|
|
||||||
final SlotCrafting sc = new SlotCrafting(p, real, craftingResult, 0, 0, 0);
|
|
||||||
sc.onTake(p, is);
|
|
||||||
|
|
||||||
for (int x = 0; x < real.getSizeInventory(); x++) {
|
|
||||||
final ItemStack failed = playerInv.addItems(real.getStackInSlot(x));
|
|
||||||
|
|
||||||
if (!failed.isEmpty()) {
|
|
||||||
p.dropItem(failed, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inv.addItems(is);
|
|
||||||
if (p instanceof EntityPlayerMP) {
|
|
||||||
this.updateHeld((EntityPlayerMP) p);
|
|
||||||
}
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
} else {
|
|
||||||
for (int x = 0; x < real.getSizeInventory(); x++) {
|
|
||||||
final ItemStack failed = real.getStackInSlot(x);
|
|
||||||
if (!failed.isEmpty()) {
|
|
||||||
this.getCellInventory()
|
|
||||||
.injectItems(AEItemStack.fromItemStack(failed), Actionable.MODULATE,
|
|
||||||
new MachineSource(this.getPatternTerminal()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void detectAndSendChanges() {
|
|
||||||
super.detectAndSendChanges();
|
|
||||||
if (Platform.isServer()) {
|
|
||||||
if (this.isCraftingMode() != this.getPatternTerminal().isCraftingRecipe()) {
|
|
||||||
this.setCraftingMode(this.getPatternTerminal().isCraftingRecipe());
|
|
||||||
this.updateOrderOfOutputSlots();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.substitute = this.patternTerminal.isSubstitution();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
|
||||||
super.onUpdate(field, oldValue, newValue);
|
|
||||||
|
|
||||||
if (field.equals("craftingMode")) {
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
this.updateOrderOfOutputSlots();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSlotChange(final Slot s) {
|
|
||||||
if (s == this.patternSlotOUT && Platform.isServer()) {
|
|
||||||
for (final IContainerListener listener : this.listeners) {
|
|
||||||
for (final Slot slot : this.inventorySlots) {
|
|
||||||
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
|
||||||
listener.sendSlotContents(this, slot.slotNumber, slot.getStack());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (listener instanceof EntityPlayerMP) {
|
|
||||||
((EntityPlayerMP) listener).isChangingQuantityOnly = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s == this.craftSlot && Platform.isClient()) {
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
for (final Slot s : this.craftingSlots) {
|
|
||||||
s.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Slot s : this.outputSlots) {
|
|
||||||
s.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IItemHandler getInventoryByName(final String name) {
|
|
||||||
if (name.equals("player")) {
|
|
||||||
return new PlayerInvWrapper(this.getInventoryPlayer());
|
|
||||||
}
|
|
||||||
return this.getPatternTerminal().getInventoryByName(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean useRealItems() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleSubstitute() {
|
|
||||||
this.substitute = !this.substitute;
|
|
||||||
|
|
||||||
this.detectAndSendChanges();
|
|
||||||
this.getAndUpdateOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCraftingMode() {
|
|
||||||
return this.craftingMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setCraftingMode(final boolean craftingMode) {
|
|
||||||
this.craftingMode = craftingMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PartPatternTerminal getPatternTerminal() {
|
|
||||||
return this.patternTerminal;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isSubstitute() {
|
|
||||||
return this.substitute;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubstitute(final boolean substitute) {
|
|
||||||
this.substitute = substitute;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,19 +20,43 @@ package appeng.container.implementations;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.slot.IOptionalSlotHost;
|
||||||
|
import appeng.container.slot.OptionalSlotRestrictedInput;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.tile.qnb.TileQuantumBridge;
|
import appeng.tile.qnb.TileQuantumBridge;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerQNB extends AEBaseContainer {
|
public class ContainerQNB extends AEBaseContainer implements IOptionalSlotHost {
|
||||||
|
|
||||||
|
OptionalSlotRestrictedInput SINGULARITY;
|
||||||
|
OptionalSlotRestrictedInput QUANTUM_CARD;
|
||||||
|
|
||||||
public ContainerQNB(final InventoryPlayer ip, final TileQuantumBridge quantumBridge) {
|
public ContainerQNB(final InventoryPlayer ip, final TileQuantumBridge quantumBridge) {
|
||||||
super(ip, quantumBridge, null);
|
super(ip, quantumBridge, null);
|
||||||
|
|
||||||
this.addSlotToContainer((new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge
|
SINGULARITY = new OptionalSlotRestrictedInput(SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge
|
||||||
.getInternalInventory(), 0, 80, 37, this.getInventoryPlayer())).setStackLimit(1));
|
.getInternalInventory(), this, 0, 80, 37, 0, this.getInventoryPlayer());
|
||||||
|
this.addSlotToContainer(SINGULARITY.setStackLimit(1));
|
||||||
|
|
||||||
|
QUANTUM_CARD = new OptionalSlotRestrictedInput(SlotRestrictedInput.PlacableItemType.CARD_QUANTUM, quantumBridge
|
||||||
|
.getInternalInventory(), this, 1, 80, 55, 1, this.getInventoryPlayer());
|
||||||
|
this.addSlotToContainer((QUANTUM_CARD).setStackLimit(1));
|
||||||
|
|
||||||
this.bindPlayerInventory(ip, 0, 166 - /* height of player inventory */82);
|
this.bindPlayerInventory(ip, 0, 166 - /* height of player inventory */82);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSlotEnabled(int idx) {
|
||||||
|
if (QUANTUM_CARD.getItemHandler().getStackInSlot(QUANTUM_CARD.slotNumber).isEmpty() &&
|
||||||
|
SINGULARITY.getItemHandler().getStackInSlot(SINGULARITY.slotNumber).isEmpty()) {
|
||||||
|
return true;
|
||||||
|
} else if (idx == 0) {
|
||||||
|
return QUANTUM_CARD.getItemHandler().getStackInSlot(QUANTUM_CARD.slotNumber).isEmpty();
|
||||||
|
} else if (idx == 1) {
|
||||||
|
return SINGULARITY.getItemHandler().getStackInSlot(SINGULARITY.slotNumber).isEmpty();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
|
|||||||
this.securityBox = (TileSecurityStation) monitorable;
|
this.securityBox = (TileSecurityStation) monitorable;
|
||||||
|
|
||||||
this.addSlotToContainer(this.configSlot = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, this.securityBox
|
this.addSlotToContainer(this.configSlot = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, this.securityBox
|
||||||
.getConfigSlot(), 0, 37, -33 + jeiOffset, ip));
|
.getConfigSlot(), 0, 37, -33, ip));
|
||||||
|
|
||||||
this.addSlotToContainer(
|
this.addSlotToContainer(
|
||||||
this.wirelessIn = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.ENCODABLE_ITEM, this.wirelessEncoder, 0, 212, 10 + jeiOffset, ip));
|
this.wirelessIn = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.ENCODABLE_ITEM, this.wirelessEncoder, 0, 212, 10 + jeiOffset, ip));
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* 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>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.container.implementations;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.container.ContainerNull;
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotCraftingTerm;
|
||||||
|
import appeng.helpers.IContainerCraftingPacket;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.inv.InvOperation;
|
||||||
|
import appeng.util.inv.WrapperInvItemHandler;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||||
|
|
||||||
|
|
||||||
|
public class ContainerWirelessCraftingTerminal extends ContainerMEPortableTerminal implements IContainerCraftingPacket {
|
||||||
|
|
||||||
|
private final AppEngInternalInventory output = new AppEngInternalInventory(this, 1);
|
||||||
|
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
|
||||||
|
private final SlotCraftingTerm outputSlot;
|
||||||
|
|
||||||
|
private AppEngInternalInventory craftingGrid;
|
||||||
|
|
||||||
|
private IRecipe currentRecipe;
|
||||||
|
|
||||||
|
public ContainerWirelessCraftingTerminal(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
|
||||||
|
super(ip, gui, false);
|
||||||
|
|
||||||
|
final IItemHandler crafting = this.craftingGrid;
|
||||||
|
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
for (int x = 0; x < 3; x++) {
|
||||||
|
this.addSlotToContainer(this.craftingSlots[x + y * 3] = new SlotCraftingMatrix(this, crafting, x + y * 3, 37 + x * 18, -72 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addSlotToContainer(this.outputSlot = new SlotCraftingTerm(this.getPlayerInv().player, this.getActionSource(), this
|
||||||
|
.getPowerSource(), this.wirelessTerminalGUIObject, crafting, crafting, this.output, 131, -72 + 18, this));
|
||||||
|
|
||||||
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
|
||||||
|
this.onCraftMatrixChanged(new WrapperInvItemHandler(crafting));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCraftMatrixChanged(IInventory inventory) {
|
||||||
|
final ContainerNull cn = new ContainerNull();
|
||||||
|
final InventoryCrafting ic = new InventoryCrafting(cn, 3, 3);
|
||||||
|
|
||||||
|
for (int x = 0; x < 9; x++) {
|
||||||
|
ic.setInventorySlotContents(x, this.craftingSlots[x].getStack());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.currentRecipe == null || !this.currentRecipe.matches(ic, this.getPlayerInv().player.world)) {
|
||||||
|
this.currentRecipe = CraftingManager.findMatchingRecipe(ic, this.getPlayerInv().player.world);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.currentRecipe == null) {
|
||||||
|
this.outputSlot.putStack(ItemStack.EMPTY);
|
||||||
|
} else {
|
||||||
|
final ItemStack craftingResult = this.currentRecipe.getCraftingResult(ic);
|
||||||
|
|
||||||
|
this.outputSlot.putStack(craftingResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.saveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveChanges() {
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
this.craftingGrid.writeToNBT(tag, "craftingGrid");
|
||||||
|
this.upgrades.writeToNBT(tag, "upgrades");
|
||||||
|
this.wirelessTerminalGUIObject.saveChanges(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadFromNBT() {
|
||||||
|
super.loadFromNBT();
|
||||||
|
this.craftingGrid = new AppEngInternalInventory(this, 9);
|
||||||
|
NBTTagCompound data = wirelessTerminalGUIObject.getItemStack().getTagCompound();
|
||||||
|
if (data != null) {
|
||||||
|
this.craftingGrid.readFromNBT(data, "craftingGrid");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack) {
|
||||||
|
if (inv == craftingGrid) {
|
||||||
|
saveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemHandler getInventoryByName(final String name) {
|
||||||
|
if (name.equals("player")) {
|
||||||
|
return new PlayerInvWrapper(this.getInventoryPlayer());
|
||||||
|
} else if (name.equals("crafting")) {
|
||||||
|
return this.craftingGrid;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean useRealItems() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,326 @@
|
|||||||
|
/*
|
||||||
|
* 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>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.container.implementations;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.PowerMultiplier;
|
||||||
|
import appeng.api.implementations.ICraftingPatternItem;
|
||||||
|
import appeng.api.implementations.IUpgradeableCellContainer;
|
||||||
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.container.interfaces.IInventorySlotAware;
|
||||||
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotPatternOutputs;
|
||||||
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.localization.PlayerMessages;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
|
import appeng.parts.automation.StackUpgradeInventory;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.helpers.ItemHandlerUtil;
|
||||||
|
import appeng.util.inv.InvOperation;
|
||||||
|
import baubles.api.BaublesApi;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.ClickType;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
import static appeng.helpers.PatternHelper.CRAFTING_GRID_DIMENSION;
|
||||||
|
|
||||||
|
|
||||||
|
public class ContainerWirelessPatternTerminal extends ContainerPatternEncoder implements IUpgradeableCellContainer, IInventorySlotAware {
|
||||||
|
|
||||||
|
private final WirelessTerminalGuiObject wirelessTerminalGUIObject;
|
||||||
|
private final int slot;
|
||||||
|
protected AppEngInternalInventory output;
|
||||||
|
protected AppEngInternalInventory pattern;
|
||||||
|
protected AppEngInternalInventory upgrades;
|
||||||
|
|
||||||
|
protected SlotRestrictedInput magnetSlot;
|
||||||
|
|
||||||
|
private double powerMultiplier = 0.5;
|
||||||
|
private int ticks = 0;
|
||||||
|
|
||||||
|
public ContainerWirelessPatternTerminal(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
|
||||||
|
super(ip, gui, gui, false);
|
||||||
|
|
||||||
|
this.crafting = new AppEngInternalInventory(this, CRAFTING_GRID_DIMENSION * CRAFTING_GRID_DIMENSION);
|
||||||
|
this.output = new AppEngInternalInventory(this, 3);
|
||||||
|
this.pattern = new AppEngInternalInventory(this, 2);
|
||||||
|
|
||||||
|
this.craftingSlots = new SlotFakeCraftingMatrix[9];
|
||||||
|
this.outputSlots = new OptionalSlotFake[3];
|
||||||
|
|
||||||
|
if (gui != null) {
|
||||||
|
final int slotIndex = gui.getInventorySlot();
|
||||||
|
if (!((IInventorySlotAware) gui).isBaubleSlot()) {
|
||||||
|
this.lockPlayerInventorySlot(slotIndex);
|
||||||
|
}
|
||||||
|
this.slot = slotIndex;
|
||||||
|
} else {
|
||||||
|
this.slot = -1;
|
||||||
|
this.lockPlayerInventorySlot(ip.currentItem);
|
||||||
|
}
|
||||||
|
this.wirelessTerminalGUIObject = gui;
|
||||||
|
upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2);
|
||||||
|
|
||||||
|
this.loadFromNBT();
|
||||||
|
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
for (int x = 0; x < 3; x++) {
|
||||||
|
this.addSlotToContainer(this.craftingSlots[x + y * 3] = new SlotFakeCraftingMatrix(this.crafting, x + y * 3, 18 + x * 18, -76 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addSlotToContainer(this.craftSlot = new SlotPatternTerm(ip.player, this.getActionSource(), this
|
||||||
|
.getPowerSource(), gui, this.crafting, pattern, this.cOut, 110, -76 + 18, this, 2, this));
|
||||||
|
this.craftSlot.setIIcon(-1);
|
||||||
|
|
||||||
|
for (int y = 0; y < this.outputSlots.length; y++) {
|
||||||
|
this.addSlotToContainer(this.outputSlots[y] = new SlotPatternOutputs(output, this, y, 110, -76 + y * 18, 0, 0, 1));
|
||||||
|
this.outputSlots[y].setRenderDisabled(false);
|
||||||
|
this.outputSlots[y].setIIcon(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addSlotToContainer(
|
||||||
|
this.patternSlotIN = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, pattern, 0, 147, -72 - 9, this
|
||||||
|
.getInventoryPlayer()));
|
||||||
|
this.addSlotToContainer(
|
||||||
|
this.patternSlotOUT = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, pattern, 1, 147, -72 + 34, this
|
||||||
|
.getInventoryPlayer()));
|
||||||
|
|
||||||
|
this.patternSlotOUT.setStackLimit(1);
|
||||||
|
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
|
||||||
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
|
||||||
|
this.setupUpgrades();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
|
||||||
|
final ItemStack currentItem;
|
||||||
|
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
||||||
|
currentItem = BaublesApi.getBaublesHandler(this.getPlayerInv().player).getStackInSlot(this.slot);
|
||||||
|
} else {
|
||||||
|
currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot(this.slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentItem.isEmpty()) {
|
||||||
|
this.setValidContainer(false);
|
||||||
|
} else if (!this.wirelessTerminalGUIObject.getItemStack().isEmpty() && currentItem != this.wirelessTerminalGUIObject.getItemStack()) {
|
||||||
|
if (ItemStack.areItemsEqual(this.wirelessTerminalGUIObject.getItemStack(), currentItem)) {
|
||||||
|
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
||||||
|
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
|
} else {
|
||||||
|
this.getPlayerInv().setInventorySlotContents(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.setValidContainer(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// drain 1 ae t
|
||||||
|
this.ticks++;
|
||||||
|
if (this.ticks > 10) {
|
||||||
|
double ext = this.wirelessTerminalGUIObject.extractAEPower(this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG);
|
||||||
|
if (ext < this.getPowerMultiplier() * this.ticks) {
|
||||||
|
if (Platform.isServer() && this.isValidContainer()) {
|
||||||
|
this.getPlayerInv().player.sendMessage(PlayerMessages.DeviceNotPowered.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setValidContainer(false);
|
||||||
|
}
|
||||||
|
this.ticks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.wirelessTerminalGUIObject.rangeCheck()) {
|
||||||
|
if (Platform.isServer() && this.isValidContainer()) {
|
||||||
|
this.getPlayerInv().player.sendMessage(PlayerMessages.OutOfRange.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setValidContainer(false);
|
||||||
|
} else {
|
||||||
|
this.setPowerMultiplier(AEConfig.instance().wireless_getDrainRate(this.wirelessTerminalGUIObject.getRange()));
|
||||||
|
}
|
||||||
|
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
|
||||||
|
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
|
||||||
|
if (clickTypeIn == ClickType.PICKUP && dragType == 1) {
|
||||||
|
if (this.inventorySlots.get(slotId) == magnetSlot) {
|
||||||
|
ItemStack itemStack = magnetSlot.getStack();
|
||||||
|
if (!magnetSlot.getStack().isEmpty()) {
|
||||||
|
NBTTagCompound tag = itemStack.getTagCompound();
|
||||||
|
if (tag == null) {
|
||||||
|
tag = new NBTTagCompound();
|
||||||
|
}
|
||||||
|
if (tag.hasKey("enabled")) {
|
||||||
|
boolean e = tag.getBoolean("enabled");
|
||||||
|
tag.setBoolean("enabled", !e);
|
||||||
|
} else {
|
||||||
|
tag.setBoolean("enabled", false);
|
||||||
|
}
|
||||||
|
magnetSlot.getStack().setTagCompound(tag);
|
||||||
|
magnetSlot.onSlotChanged();
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getPowerMultiplier() {
|
||||||
|
return this.powerMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPowerMultiplier(final double powerMultiplier) {
|
||||||
|
this.powerMultiplier = powerMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSlotEnabled(final int idx) {
|
||||||
|
boolean crafting = false;
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
|
||||||
|
if (nbtTagCompound != null) {
|
||||||
|
if (nbtTagCompound.hasKey("isCraftingMode")) {
|
||||||
|
crafting = nbtTagCompound.getBoolean("isCraftingMode");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (idx == 1) {
|
||||||
|
return Platform.isServer() ? !crafting : !this.isCraftingMode();
|
||||||
|
} else if (idx == 2) {
|
||||||
|
return Platform.isServer() ? crafting : this.isCraftingMode();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveChanges() {
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
((AppEngInternalInventory) crafting).writeToNBT(tag, "craftingGrid");
|
||||||
|
|
||||||
|
this.output.writeToNBT(tag, "output");
|
||||||
|
this.pattern.writeToNBT(tag, "patterns");
|
||||||
|
this.upgrades.writeToNBT(tag, "upgrades");
|
||||||
|
|
||||||
|
this.wirelessTerminalGUIObject.saveChanges(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFromNBT() {
|
||||||
|
NBTTagCompound data = wirelessTerminalGUIObject.getItemStack().getTagCompound();
|
||||||
|
if (data != null) {
|
||||||
|
((AppEngInternalInventory) crafting).readFromNBT(data, "craftingGrid");
|
||||||
|
this.output.readFromNBT(data, "output");
|
||||||
|
this.pattern.readFromNBT(data, "patterns");
|
||||||
|
upgrades.readFromNBT(wirelessTerminalGUIObject.getItemStack().getTagCompound().getCompoundTag("upgrades"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack) {
|
||||||
|
if (inv == this.pattern && slot == 1) {
|
||||||
|
final ItemStack is = this.pattern.getStackInSlot(1);
|
||||||
|
if (!is.isEmpty() && is.getItem() instanceof ICraftingPatternItem) {
|
||||||
|
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||||
|
final ICraftingPatternDetails details = pattern.getPatternForItem(is, this.getPlayerInv().player.world);
|
||||||
|
if (details != null) {
|
||||||
|
this.setCraftingMode(details.isCraftable());
|
||||||
|
this.setSubstitute(details.canSubstitute());
|
||||||
|
|
||||||
|
for (int x = 0; x < this.crafting.getSlots() && x < details.getInputs().length; x++) {
|
||||||
|
final IAEItemStack item = details.getInputs()[x];
|
||||||
|
ItemHandlerUtil.setStackInSlot(this.crafting, x, item == null ? ItemStack.EMPTY : item.createItemStack());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int x = 0; x < this.output.getSlots(); x++) {
|
||||||
|
final IAEItemStack item;
|
||||||
|
if (x < details.getOutputs().length) {
|
||||||
|
item = details.getOutputs()[x];
|
||||||
|
} else {
|
||||||
|
item = null;
|
||||||
|
}
|
||||||
|
this.output.setStackInSlot(x, item == null ? ItemStack.EMPTY : item.createItemStack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onChangeInventory(inv, slot, mc, removedStack, newStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemHandler getInventoryByName(String name) {
|
||||||
|
if (name.equals("crafting")) {
|
||||||
|
return this.crafting;
|
||||||
|
} else if (name.equals("output")) {
|
||||||
|
return this.output;
|
||||||
|
}
|
||||||
|
return super.getInventoryByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean useRealItems() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int availableUpgrades() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setupUpgrades() {
|
||||||
|
if (wirelessTerminalGUIObject != null) {
|
||||||
|
for (int upgradeSlot = 0; upgradeSlot < availableUpgrades(); upgradeSlot++) {
|
||||||
|
this.magnetSlot = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, upgradeSlot, 206, 135 + upgradeSlot * 18, this.getInventoryPlayer());
|
||||||
|
this.magnetSlot.setNotDraggable();
|
||||||
|
this.addSlotToContainer(magnetSlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventorySlot() {
|
||||||
|
return wirelessTerminalGUIObject.getInventorySlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBaubleSlot() {
|
||||||
|
return wirelessTerminalGUIObject.isBaubleSlot();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,34 +19,13 @@
|
|||||||
package appeng.container.implementations;
|
package appeng.container.implementations;
|
||||||
|
|
||||||
|
|
||||||
import appeng.core.AEConfig;
|
|
||||||
import appeng.core.localization.PlayerMessages;
|
|
||||||
import appeng.helpers.WirelessTerminalGuiObject;
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
import appeng.util.Platform;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerWirelessTerm extends ContainerMEPortableCell {
|
public class ContainerWirelessTerm extends ContainerMEPortableTerminal {
|
||||||
|
|
||||||
private final WirelessTerminalGuiObject wirelessTerminalGUIObject;
|
|
||||||
|
|
||||||
public ContainerWirelessTerm(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
|
public ContainerWirelessTerm(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
|
||||||
super(ip, gui);
|
super(ip, gui, false);
|
||||||
this.wirelessTerminalGUIObject = gui;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void detectAndSendChanges() {
|
|
||||||
super.detectAndSendChanges();
|
|
||||||
|
|
||||||
if (!this.wirelessTerminalGUIObject.rangeCheck()) {
|
|
||||||
if (Platform.isServer() && this.isValidContainer()) {
|
|
||||||
this.getPlayerInv().player.sendMessage(PlayerMessages.OutOfRange.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setValidContainer(false);
|
|
||||||
} else {
|
|
||||||
this.setPowerMultiplier(AEConfig.instance().wireless_getDrainRate(this.wirelessTerminalGUIObject.getRange()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,4 +32,8 @@ public interface IInventorySlotAware {
|
|||||||
* @return the inventory index of this portable cell.
|
* @return the inventory index of this portable cell.
|
||||||
*/
|
*/
|
||||||
int getInventorySlot();
|
int getInventorySlot();
|
||||||
|
|
||||||
|
default boolean isBaubleSlot() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public class AppEngSlot extends Slot {
|
|||||||
private int IIcon = -1;
|
private int IIcon = -1;
|
||||||
private hasCalculatedValidness isValid;
|
private hasCalculatedValidness isValid;
|
||||||
private boolean isDisplay = false;
|
private boolean isDisplay = false;
|
||||||
|
private boolean returnAsSingleStack;
|
||||||
|
|
||||||
public AppEngSlot(final IItemHandler inv, final int idx, final int x, final int y) {
|
public AppEngSlot(final IItemHandler inv, final int idx, final int x, final int y) {
|
||||||
super(emptyInventory, idx, x, y);
|
super(emptyInventory, idx, x, y);
|
||||||
@@ -94,14 +95,29 @@ public class AppEngSlot extends Slot {
|
|||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.isDisplay()) {
|
if (this.isDisplay()) {
|
||||||
this.setDisplay(false);
|
this.setDisplay(false);
|
||||||
|
if (this.returnAsSingleStack()) {
|
||||||
|
setReturnAsSingleStack(false);
|
||||||
|
ItemStack ret = this.getDisplayStack().copy();
|
||||||
|
ret.setCount(1);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
return this.getDisplayStack();
|
return this.getDisplayStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.itemHandler.getStackInSlot(this.index);
|
return this.itemHandler.getStackInSlot(this.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean returnAsSingleStack() {
|
||||||
|
return this.returnAsSingleStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReturnAsSingleStack(boolean returnAsSingleStack) {
|
||||||
|
this.returnAsSingleStack = returnAsSingleStack;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStack(final ItemStack stack) {
|
public void putStack(final ItemStack stack) {
|
||||||
if (this.isSlotEnabled()) {
|
if (this.isSlotEnabled()) {
|
||||||
@@ -120,7 +136,7 @@ public class AppEngSlot extends Slot {
|
|||||||
@Override
|
@Override
|
||||||
public void onSlotChanged() {
|
public void onSlotChanged() {
|
||||||
this.setIsValid(hasCalculatedValidness.NotAvailable);
|
this.setIsValid(hasCalculatedValidness.NotAvailable);
|
||||||
if (this.isSlotEnabled()) {
|
if (this.isSlotEnabled() && this.itemHandler != null) {
|
||||||
ItemHandlerUtil.setStackInSlot(this.itemHandler, this.index, this.getStack().copy());
|
ItemHandlerUtil.setStackInSlot(this.itemHandler, this.index, this.getStack().copy());
|
||||||
|
|
||||||
if (this.getContainer() != null) {
|
if (this.getContainer() != null) {
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ public class OptionalSlotFake extends SlotFake implements IOptionalSlot {
|
|||||||
return this.host.isSlotEnabled(this.groupNum);
|
return this.host.isSlotEnabled(this.groupNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSlotStackLimit() {
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRenderDisabled() {
|
public boolean isRenderDisabled() {
|
||||||
return this.renderDisabled;
|
return this.renderDisabled;
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ import appeng.util.inv.AdaptorItemHandler;
|
|||||||
import appeng.util.inv.WrapperCursorItemHandler;
|
import appeng.util.inv.WrapperCursorItemHandler;
|
||||||
import appeng.util.inv.WrapperInvItemHandler;
|
import appeng.util.inv.WrapperInvItemHandler;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
import com.blamejared.recipestages.recipes.RecipeStage;
|
||||||
|
import net.darkhax.gamestages.GameStageHelper;
|
||||||
|
import net.darkhax.itemstages.ItemStages;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
@@ -49,6 +53,9 @@ import net.minecraft.item.crafting.IRecipe;
|
|||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -90,6 +97,28 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
|||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't render the item client-side if the item stage for it is not unlocked yet
|
||||||
|
@Override
|
||||||
|
public ItemStack getStack() {
|
||||||
|
if (Platform.isClient() && Loader.isModLoaded("itemstages")) {
|
||||||
|
return itemstageStack();
|
||||||
|
}
|
||||||
|
return super.getStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
ItemStack itemstageStack() {
|
||||||
|
final ItemStack item = super.getStack();
|
||||||
|
final String itemsStage = ItemStages.getStage(item);
|
||||||
|
final String enchantStage = ItemStages.getEnchantStage(item);
|
||||||
|
final EntityPlayer player = Minecraft.getMinecraft().player;
|
||||||
|
|
||||||
|
if ((itemsStage != null && !GameStageHelper.hasStage(player, itemsStage))
|
||||||
|
|| (enchantStage != null && !GameStageHelper.hasStage(player, enchantStage)))
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
return super.getStack();
|
||||||
|
}
|
||||||
|
|
||||||
public void doClick(final InventoryAction action, final EntityPlayer who) {
|
public void doClick(final InventoryAction action, final EntityPlayer who) {
|
||||||
if (this.getStack().isEmpty()) {
|
if (this.getStack().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -144,17 +173,39 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||||
protected IRecipe findRecipe(InventoryCrafting ic, World world) {
|
protected IRecipe findRecipe(InventoryCrafting ic, World world, EntityPlayer player) {
|
||||||
if (this.container instanceof ContainerCraftingTerm) {
|
if (this.container instanceof ContainerCraftingTerm) {
|
||||||
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
final ContainerCraftingTerm containerTerminal = (ContainerCraftingTerm) this.container;
|
||||||
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
final IRecipe recipe = containerTerminal.getCurrentRecipe();
|
||||||
|
|
||||||
if (recipe != null && recipe.matches(ic, world)) {
|
if (recipe != null && recipe.matches(ic, world)) {
|
||||||
return containerTerminal.getCurrentRecipe();
|
return handleRecipe(ic, containerTerminal.getCurrentRecipe(), player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CraftingManager.findMatchingRecipe(ic, world);
|
return handleRecipe(ic, CraftingManager.findMatchingRecipe(ic, world), player);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns null in case this recipe is not yet unlocked
|
||||||
|
private IRecipe handleRecipe(InventoryCrafting ic, IRecipe recipe, EntityPlayer player) {
|
||||||
|
if (Loader.isModLoaded("recipestages")) {
|
||||||
|
if (recipe instanceof RecipeStage) {
|
||||||
|
final RecipeStage staged = (RecipeStage) recipe;
|
||||||
|
if (!staged.isGoodForCrafting(ic))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Loader.isModLoaded("itemstages")) {
|
||||||
|
final String itemsStage = ItemStages.getStage(recipe.getRecipeOutput());
|
||||||
|
final String enchantStage = ItemStages.getEnchantStage(recipe.getRecipeOutput());
|
||||||
|
|
||||||
|
if ((itemsStage != null && !GameStageHelper.hasStage(player, itemsStage))
|
||||||
|
|| (enchantStage != null && !GameStageHelper.hasStage(player, enchantStage)))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
// TODO: This is really hacky and NEEDS to be solved with a full container/gui refactoring.
|
||||||
@@ -192,7 +243,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
|
|||||||
ic.setInventorySlotContents(x, this.getPattern().getStackInSlot(x));
|
ic.setInventorySlotContents(x, this.getPattern().getStackInSlot(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
final IRecipe r = this.findRecipe(ic, p.world);
|
final IRecipe r = this.findRecipe(ic, p.world, p);
|
||||||
|
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
final Item target = request.getItem();
|
final Item target = request.getItem();
|
||||||
|
|||||||
@@ -27,4 +27,9 @@ public class SlotFakeCraftingMatrix extends SlotFake {
|
|||||||
public SlotFakeCraftingMatrix(final IItemHandler inv, final int idx, final int x, final int y) {
|
public SlotFakeCraftingMatrix(final IItemHandler inv, final int idx, final int x, final int y) {
|
||||||
super(inv, idx, x, y);
|
super(inv, idx, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSlotStackLimit() {
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package appeng.container.slot;
|
||||||
|
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
public class SlotOversized extends SlotNormal {
|
||||||
|
public SlotOversized(IItemHandler inv, int slot, int xPos, int yPos) {
|
||||||
|
super(inv, slot, xPos, yPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ package appeng.container.slot;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Upgrades;
|
||||||
import appeng.api.definitions.IDefinitions;
|
import appeng.api.definitions.IDefinitions;
|
||||||
import appeng.api.definitions.IItems;
|
import appeng.api.definitions.IItems;
|
||||||
import appeng.api.definitions.IMaterials;
|
import appeng.api.definitions.IMaterials;
|
||||||
@@ -64,6 +65,10 @@ public class SlotRestrictedInput extends AppEngSlot {
|
|||||||
this.p = p;
|
this.p = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlacableItemType getPlaceableItemType() {
|
||||||
|
return which;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSlotStackLimit() {
|
public int getSlotStackLimit() {
|
||||||
if (this.stackLimit != -1) {
|
if (this.stackLimit != -1) {
|
||||||
@@ -200,6 +205,11 @@ public class SlotRestrictedInput extends AppEngSlot {
|
|||||||
return i.getItem() instanceof IBiometricCard;
|
return i.getItem() instanceof IBiometricCard;
|
||||||
case UPGRADES:
|
case UPGRADES:
|
||||||
return i.getItem() instanceof IUpgradeModule && ((IUpgradeModule) i.getItem()).getType(i) != null;
|
return i.getItem() instanceof IUpgradeModule && ((IUpgradeModule) i.getItem()).getType(i) != null;
|
||||||
|
case CARD_QUANTUM:
|
||||||
|
if (AEApi.instance().definitions().materials().cardQuantumLink().maybeItem().isPresent()) {
|
||||||
|
return AEApi.instance().definitions().materials().cardQuantumLink().maybeItem().get() == i.getItem();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -269,6 +279,8 @@ public class SlotRestrictedInput extends AppEngSlot {
|
|||||||
|
|
||||||
RANGE_BOOSTER(6 * 16 + 15),
|
RANGE_BOOSTER(6 * 16 + 15),
|
||||||
QE_SINGULARITY(10 * 16 + 15),
|
QE_SINGULARITY(10 * 16 + 15),
|
||||||
|
|
||||||
|
CARD_QUANTUM(13 * 16 + 15),
|
||||||
SPATIAL_STORAGE_CELLS(11 * 16 + 15),
|
SPATIAL_STORAGE_CELLS(11 * 16 + 15),
|
||||||
|
|
||||||
FUEL(12 * 16 + 15),
|
FUEL(12 * 16 + 15),
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, 2020 Adrian Siekierka
|
||||||
|
*
|
||||||
|
* This file is part of StackUp.
|
||||||
|
*
|
||||||
|
* StackUp 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.
|
||||||
|
*
|
||||||
|
* StackUp 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 StackUp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.core;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@IFMLLoadingPlugin.Name("AE2ELCore")
|
||||||
|
@IFMLLoadingPlugin.MCVersion("1.12.2")
|
||||||
|
@IFMLLoadingPlugin.SortingIndex(1001)
|
||||||
|
@IFMLLoadingPlugin.TransformerExclusions("appeng.core.transformer")
|
||||||
|
public class AE2ELCore implements IFMLLoadingPlugin {
|
||||||
|
@Override
|
||||||
|
public String[] getASMTransformerClass() {
|
||||||
|
return new String[]{
|
||||||
|
"appeng.core.transformer.AE2ELTransformer"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getModContainerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public String getSetupClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void injectData(Map<String, Object> data) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAccessTransformerClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,8 +43,8 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
public final class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost {
|
public final class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost {
|
||||||
|
|
||||||
public static final String VERSION = "@version@";
|
public static final String VERSION = appeng.Tags.VERSION;
|
||||||
public static final String CHANNEL = "@aechannel@";
|
public static final String CHANNEL = appeng.Tags.AECHANNEL;
|
||||||
public static final String PACKET_CHANNEL = "AE";
|
public static final String PACKET_CHANNEL = "AE";
|
||||||
// Tunnels
|
// Tunnels
|
||||||
public static final double TUNNEL_POWER_LOSS = 0.05;
|
public static final double TUNNEL_POWER_LOSS = 0.05;
|
||||||
@@ -82,6 +82,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
private boolean disableColoredCableRecipesInJEI = true;
|
private boolean disableColoredCableRecipesInJEI = true;
|
||||||
private int craftingCalculationTimePerTick = 5;
|
private int craftingCalculationTimePerTick = 5;
|
||||||
private PowerUnits selectedPowerUnit = PowerUnits.AE;
|
private PowerUnits selectedPowerUnit = PowerUnits.AE;
|
||||||
|
private boolean showCraftableTooltip = true;
|
||||||
|
|
||||||
// Spatial IO/Dimension
|
// Spatial IO/Dimension
|
||||||
private int storageProviderID = -1;
|
private int storageProviderID = -1;
|
||||||
private int storageDimensionID = -1;
|
private int storageDimensionID = -1;
|
||||||
@@ -121,6 +123,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
private int maxControllerSizeY = 7;
|
private int maxControllerSizeY = 7;
|
||||||
private int maxControllerSizeZ = 7;
|
private int maxControllerSizeZ = 7;
|
||||||
|
|
||||||
|
private int normalChannelCapacity = 8;
|
||||||
|
private int denseChannelCapacity = 32;
|
||||||
|
|
||||||
private AEConfig(final File configFile) {
|
private AEConfig(final File configFile) {
|
||||||
super(configFile);
|
super(configFile);
|
||||||
this.configFile = configFile;
|
this.configFile = configFile;
|
||||||
@@ -138,6 +143,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
CondenserOutput.SINGULARITY.requiredPower = this.get("Condenser", "Singularity", 256000).getInt(256000);
|
CondenserOutput.SINGULARITY.requiredPower = this.get("Condenser", "Singularity", 256000).getInt(256000);
|
||||||
|
|
||||||
this.removeCrashingItemsOnLoad = this.get("general", "removeCrashingItemsOnLoad", false, "Will auto-remove items that crash when being loaded from storage. This will destroy those items instead of crashing the game!").getBoolean();
|
this.removeCrashingItemsOnLoad = this.get("general", "removeCrashingItemsOnLoad", false, "Will auto-remove items that crash when being loaded from storage. This will destroy those items instead of crashing the game!").getBoolean();
|
||||||
|
this.normalChannelCapacity = Math.min(this.get("general", "normalChannelCapacity", this.normalChannelCapacity, "Max channel number may not exceed 256").getInt(this.normalChannelCapacity), 256);
|
||||||
|
this.denseChannelCapacity = Math.min(this.get("general", "denseChannelCapacity", this.denseChannelCapacity, "Max channel number may not exceed 256").getInt(this.denseChannelCapacity), 256);
|
||||||
|
|
||||||
this.setCategoryComment("BlockingMode", "Map of items to not block when blockingmode is enabled.\n[modid]\nmodid:item:metadata(optional,default:0)\nSupports more than one modid, so you can block different things between, for example, gregtech or enderio");
|
this.setCategoryComment("BlockingMode", "Map of items to not block when blockingmode is enabled.\n[modid]\nmodid:item:metadata(optional,default:0)\nSupports more than one modid, so you can block different things between, for example, gregtech or enderio");
|
||||||
this.nonBlockingItems = this.get("BlockingMode", "nonBlockingItems", nonBlockingItems, "NonBlockingItems").getStringList();
|
this.nonBlockingItems = this.get("BlockingMode", "nonBlockingItems", nonBlockingItems, "NonBlockingItems").getStringList();
|
||||||
@@ -188,6 +195,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
this.maxControllerSizeY = Math.min(Math.max(this.get("ControllerSize", "maxControllerSizeY", this.maxControllerSizeY).getInt(this.maxControllerSizeY), 1), 63);
|
this.maxControllerSizeY = Math.min(Math.max(this.get("ControllerSize", "maxControllerSizeY", this.maxControllerSizeY).getInt(this.maxControllerSizeY), 1), 63);
|
||||||
this.maxControllerSizeZ = Math.min(Math.max(this.get("ControllerSize", "maxControllerSizeZ", this.maxControllerSizeZ).getInt(this.maxControllerSizeZ), 1), 63);
|
this.maxControllerSizeZ = Math.min(Math.max(this.get("ControllerSize", "maxControllerSizeZ", this.maxControllerSizeZ).getInt(this.maxControllerSizeZ), 1), 63);
|
||||||
|
|
||||||
|
|
||||||
this.clientSync();
|
this.clientSync();
|
||||||
|
|
||||||
this.addCustomCategoryComment("features", "Warning: Disabling a feature may disable other features depending on it.");
|
this.addCustomCategoryComment("features", "Warning: Disabling a feature may disable other features depending on it.");
|
||||||
@@ -248,6 +256,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
this.enableEffects = this.get("Client", "enableEffects", true).getBoolean(true);
|
this.enableEffects = this.get("Client", "enableEffects", true).getBoolean(true);
|
||||||
this.useLargeFonts = this.get("Client", "useTerminalUseLargeFont", false).getBoolean(false);
|
this.useLargeFonts = this.get("Client", "useTerminalUseLargeFont", false).getBoolean(false);
|
||||||
this.useColoredCraftingStatus = this.get("Client", "useColoredCraftingStatus", true).getBoolean(true);
|
this.useColoredCraftingStatus = this.get("Client", "useColoredCraftingStatus", true).getBoolean(true);
|
||||||
|
this.showCraftableTooltip = this.get("Client", "showCraftableTooltip", true, "Whether to add \"Craftable\" to item tooltips when they can be crafted automatically.").getBoolean(true);
|
||||||
|
|
||||||
// load buttons..
|
// load buttons..
|
||||||
for (int btnNum = 0; btnNum < 4; btnNum++) {
|
for (int btnNum = 0; btnNum < 4; btnNum++) {
|
||||||
@@ -501,6 +510,10 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
return this.useColoredCraftingStatus;
|
return this.useColoredCraftingStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowCraftableTooltip() {
|
||||||
|
return this.showCraftableTooltip;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isDisableColoredCableRecipesInJEI() {
|
public boolean isDisableColoredCableRecipesInJEI() {
|
||||||
return this.disableColoredCableRecipesInJEI;
|
return this.disableColoredCableRecipesInJEI;
|
||||||
}
|
}
|
||||||
@@ -670,4 +683,12 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
public int getMaxControllerSizeZ() {
|
public int getMaxControllerSizeZ() {
|
||||||
return this.maxControllerSizeZ;
|
return this.maxControllerSizeZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNormalChannelCapacity() {
|
||||||
|
return this.normalChannelCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDenseChannelCapacity() {
|
||||||
|
return this.denseChannelCapacity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,11 @@ public final class AppEng {
|
|||||||
|
|
||||||
private static final String FORGE_CURRENT_VERSION = ForgeVersion.majorVersion + "." + ForgeVersion.minorVersion + "." + ForgeVersion.revisionVersion + "." + ForgeVersion.buildVersion;
|
private static final String FORGE_CURRENT_VERSION = ForgeVersion.majorVersion + "." + ForgeVersion.minorVersion + "." + ForgeVersion.revisionVersion + "." + ForgeVersion.buildVersion;
|
||||||
private static final String FORGE_MAX_VERSION = (ForgeVersion.majorVersion + 1) + ".0.0.0";
|
private static final String FORGE_MAX_VERSION = (ForgeVersion.majorVersion + 1) + ".0.0.0";
|
||||||
public static final String MOD_DEPENDENCIES = "required-after:forge@[" + FORGE_CURRENT_VERSION + "," + FORGE_MAX_VERSION + ");after:ctm@[" + CTM.VERSION + ",);";
|
public static final String MOD_DEPENDENCIES = "required-after:forge@[" + FORGE_CURRENT_VERSION + "," + FORGE_MAX_VERSION + ");" +
|
||||||
|
"after:ctm@[" + CTM.VERSION + ",);" +
|
||||||
|
"after:itemstages;" +
|
||||||
|
"after:recipestages;" +
|
||||||
|
"before:bogosorter@[1.2.2,);";
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private static final AppEng INSTANCE = new AppEng();
|
private static final AppEng INSTANCE = new AppEng();
|
||||||
|
|||||||
@@ -19,8 +19,10 @@
|
|||||||
package appeng.core;
|
package appeng.core;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
import appeng.api.definitions.IBlocks;
|
import appeng.api.definitions.IBlocks;
|
||||||
|
import appeng.api.definitions.IItemDefinition;
|
||||||
import appeng.api.definitions.IItems;
|
import appeng.api.definitions.IItems;
|
||||||
import appeng.api.definitions.IParts;
|
import appeng.api.definitions.IParts;
|
||||||
import appeng.api.features.IRecipeHandlerRegistry;
|
import appeng.api.features.IRecipeHandlerRegistry;
|
||||||
@@ -105,7 +107,9 @@ import javax.annotation.Nonnull;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
@@ -323,6 +327,10 @@ final class Registration {
|
|||||||
Upgrades.PATTERN_EXPANSION.registerItem(parts.iface(), 3);
|
Upgrades.PATTERN_EXPANSION.registerItem(parts.iface(), 3);
|
||||||
Upgrades.PATTERN_EXPANSION.registerItem(blocks.iface(), 3);
|
Upgrades.PATTERN_EXPANSION.registerItem(blocks.iface(), 3);
|
||||||
|
|
||||||
|
// Fluid Interface
|
||||||
|
Upgrades.CAPACITY.registerItem(parts.fluidIface(), 2);
|
||||||
|
Upgrades.CAPACITY.registerItem(blocks.fluidIface(), 2);
|
||||||
|
|
||||||
// IO Port!
|
// IO Port!
|
||||||
Upgrades.SPEED.registerItem(blocks.iOPort(), 3);
|
Upgrades.SPEED.registerItem(blocks.iOPort(), 3);
|
||||||
Upgrades.REDSTONE.registerItem(blocks.iOPort(), 1);
|
Upgrades.REDSTONE.registerItem(blocks.iOPort(), 1);
|
||||||
@@ -373,6 +381,9 @@ final class Registration {
|
|||||||
Upgrades.FUZZY.registerItem(items.viewCell(), 1);
|
Upgrades.FUZZY.registerItem(items.viewCell(), 1);
|
||||||
Upgrades.INVERTER.registerItem(items.viewCell(), 1);
|
Upgrades.INVERTER.registerItem(items.viewCell(), 1);
|
||||||
|
|
||||||
|
Upgrades.FUZZY.registerItem(AEApi.instance().definitions().materials().cardMagnet(), 1);
|
||||||
|
Upgrades.INVERTER.registerItem(AEApi.instance().definitions().materials().cardMagnet(), 1);
|
||||||
|
|
||||||
// Storage Bus
|
// Storage Bus
|
||||||
Upgrades.FUZZY.registerItem(parts.storageBus(), 1);
|
Upgrades.FUZZY.registerItem(parts.storageBus(), 1);
|
||||||
Upgrades.INVERTER.registerItem(parts.storageBus(), 1);
|
Upgrades.INVERTER.registerItem(parts.storageBus(), 1);
|
||||||
@@ -398,8 +409,21 @@ final class Registration {
|
|||||||
// Inscriber
|
// Inscriber
|
||||||
Upgrades.SPEED.registerItem(blocks.inscriber(), 3);
|
Upgrades.SPEED.registerItem(blocks.inscriber(), 3);
|
||||||
|
|
||||||
|
Upgrades.QUANTUM_LINK.registerItem(blocks.quantumLink(), 1);
|
||||||
|
|
||||||
// Wireless Terminal Handler
|
// Wireless Terminal Handler
|
||||||
items.wirelessTerminal().maybeItem().ifPresent(terminal -> registries.wireless().registerWirelessHandler((IWirelessTermHandler) terminal));
|
ArrayList<IItemDefinition> iids = new ArrayList<>();
|
||||||
|
iids.add(items.wirelessTerminal());
|
||||||
|
iids.add(items.wirelessCraftingTerminal());
|
||||||
|
iids.add(items.wirelessPatternTerminal());
|
||||||
|
|
||||||
|
for (IItemDefinition id : iids) {
|
||||||
|
id.maybeItem().ifPresent(terminal -> {
|
||||||
|
registries.wireless().registerWirelessHandler((IWirelessTermHandler) terminal);
|
||||||
|
Upgrades.MAGNET.registerItem(id, 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
items.wirelessFluidTerminal().maybeItem().ifPresent(terminal -> registries.wireless().registerWirelessHandler((IWirelessTermHandler) terminal));
|
||||||
|
|
||||||
// Charge Rates
|
// Charge Rates
|
||||||
items.chargedStaff().maybeItem().ifPresent(chargedStaff -> registries.charger().addChargeRate(chargedStaff, 320d));
|
items.chargedStaff().maybeItem().ifPresent(chargedStaff -> registries.charger().addChargeRate(chargedStaff, 320d));
|
||||||
|
|||||||
@@ -4,14 +4,36 @@ package appeng.core.api;
|
|||||||
import appeng.api.config.IncludeExclude;
|
import appeng.api.config.IncludeExclude;
|
||||||
import appeng.api.storage.ICellInventory;
|
import appeng.api.storage.ICellInventory;
|
||||||
import appeng.api.storage.ICellInventoryHandler;
|
import appeng.api.storage.ICellInventoryHandler;
|
||||||
|
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||||
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.api.util.IClientHelper;
|
import appeng.api.util.IClientHelper;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.fluids.items.FluidDummyItem;
|
||||||
|
import appeng.fluids.util.AEFluidStack;
|
||||||
|
import appeng.util.ReadableNumberConverter;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.DecimalFormatSymbols;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ApiClientHelper implements IClientHelper {
|
public class ApiClientHelper implements IClientHelper {
|
||||||
|
|
||||||
|
private static final String[] NUMBER_FORMATS = new String[]{"#.000", "#.00", "#.0", "#"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends IAEStack<T>> void addCellInformation(ICellInventoryHandler<T> handler, List<String> lines) {
|
public <T extends IAEStack<T>> void addCellInformation(ICellInventoryHandler<T> handler, List<String> lines) {
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
@@ -27,16 +49,95 @@ public class ApiClientHelper implements IClientHelper {
|
|||||||
.getLocal());
|
.getLocal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IItemList<?> itemList = cellInventory.getChannel().createList();
|
||||||
|
|
||||||
if (handler.isPreformatted()) {
|
if (handler.isPreformatted()) {
|
||||||
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded).getLocal();
|
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded).getLocal();
|
||||||
|
|
||||||
if (handler.isFuzzy()) {
|
if (handler.isFuzzy()) {
|
||||||
lines.add(GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Fuzzy.getLocal());
|
lines.add("[" + GuiText.Partitioned.getLocal() + "]" + " - " + list + ' ' + GuiText.Fuzzy.getLocal());
|
||||||
} else {
|
} else {
|
||||||
lines.add(GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal());
|
lines.add("[" + GuiText.Partitioned.getLocal() + "]" + " - " + list + ' ' + GuiText.Precise.getLocal());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||||
|
IItemHandler inv = cellInventory.getConfigInventory();
|
||||||
|
cellInventory.getAvailableItems((IItemList) itemList);
|
||||||
|
for (int i = 0; i < inv.getSlots(); i++) {
|
||||||
|
final ItemStack is = inv.getStackInSlot(i);
|
||||||
|
if (!is.isEmpty()) {
|
||||||
|
if (cellInventory.getChannel() instanceof IItemStorageChannel) {
|
||||||
|
if (!handler.isFuzzy()) {
|
||||||
|
final IAEItemStack ais = AEItemStack.fromItemStack(is);
|
||||||
|
IAEItemStack stocked = ((IItemList<IAEItemStack>) itemList).findPrecise(ais);
|
||||||
|
lines.add("[" + is.getDisplayName() + "]" + ": " + (stocked == null ? "0" : ReadableNumberConverter.INSTANCE.toWideReadableForm(stocked.getStackSize())));
|
||||||
|
} else {
|
||||||
|
final IAEItemStack ais = AEItemStack.fromItemStack(is);
|
||||||
|
Collection<IAEItemStack> stocked = ((IItemList<IAEItemStack>) itemList).findFuzzy(ais, handler.getCellInv().getFuzzyMode());
|
||||||
|
|
||||||
|
int[] ids = OreDictionary.getOreIDs(is);
|
||||||
|
long size = 0;
|
||||||
|
for (IAEItemStack ist : stocked) {
|
||||||
|
size += ist.getStackSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is.getItem().isDamageable()) {
|
||||||
|
lines.add("[" + is.getDisplayName() + "]" + ": " + size);
|
||||||
|
} else if (ids.length > 0) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int j : ids) {
|
||||||
|
sb.append(OreDictionary.getOreName(j)).append(", ");
|
||||||
|
}
|
||||||
|
lines.add("[{" + sb.substring(0, sb.length() - 2) + "}]" + ": " + ReadableNumberConverter.INSTANCE.toWideReadableForm(size));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (cellInventory.getChannel() instanceof IFluidStorageChannel) {
|
||||||
|
final AEFluidStack ais;
|
||||||
|
if (is.getItem() instanceof FluidDummyItem) {
|
||||||
|
ais = AEFluidStack.fromFluidStack(((FluidDummyItem) is.getItem()).getFluidStack(is));
|
||||||
|
} else {
|
||||||
|
ais = AEFluidStack.fromFluidStack(FluidUtil.getFluidContained(is));
|
||||||
|
}
|
||||||
|
IAEFluidStack stocked = ((IItemList<IAEFluidStack>) itemList).findPrecise(ais);
|
||||||
|
lines.add("[" + is.getDisplayName() + "]" + ": " + (stocked == null ? "0" : fluidStackSize(stocked.getStackSize())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||||
|
cellInventory.getAvailableItems((IItemList) itemList);
|
||||||
|
for (IAEStack<?> s : itemList) {
|
||||||
|
if (s instanceof IAEItemStack) {
|
||||||
|
lines.add(((IAEItemStack) s).getDefinition().getDisplayName() + ": " + ReadableNumberConverter.INSTANCE.toWideReadableForm(s.getStackSize()));
|
||||||
|
} else if (s instanceof IAEFluidStack) {
|
||||||
|
lines.add(((IAEFluidStack) s).getFluidStack().getLocalizedName() + ": " + fluidStackSize(s.getStackSize()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String fluidStackSize(long size) {
|
||||||
|
String unit;
|
||||||
|
if (size >= 1000) {
|
||||||
|
unit = "B";
|
||||||
|
} else {
|
||||||
|
unit = "mB";
|
||||||
|
}
|
||||||
|
|
||||||
|
final int log = (int) Math.floor(Math.log10(size)) / 2;
|
||||||
|
|
||||||
|
final int index = Math.max(0, Math.min(3, log));
|
||||||
|
|
||||||
|
final DecimalFormatSymbols symbols = new DecimalFormatSymbols();
|
||||||
|
symbols.setDecimalSeparator('.');
|
||||||
|
final DecimalFormat format = new DecimalFormat(NUMBER_FORMATS[index]);
|
||||||
|
format.setDecimalFormatSymbols(symbols);
|
||||||
|
format.setRoundingMode(RoundingMode.DOWN);
|
||||||
|
|
||||||
|
String formatted = format.format(size / 1000d);
|
||||||
|
|
||||||
|
return formatted.concat(unit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
import org.objectweb.asm.commons.ClassRemapper;
|
||||||
import org.objectweb.asm.commons.Remapper;
|
import org.objectweb.asm.commons.Remapper;
|
||||||
import org.objectweb.asm.commons.RemappingClassAdapter;
|
|
||||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.MethodInsnNode;
|
import org.objectweb.asm.tree.MethodInsnNode;
|
||||||
@@ -150,7 +150,7 @@ public class ApiPart implements IPartHelper {
|
|||||||
final DefaultPackageClassNameRemapper remapper = new DefaultPackageClassNameRemapper();
|
final DefaultPackageClassNameRemapper remapper = new DefaultPackageClassNameRemapper();
|
||||||
remapper.inputOutput.put("appeng/api/parts/LayerBase", n.superName);
|
remapper.inputOutput.put("appeng/api/parts/LayerBase", n.superName);
|
||||||
remapper.inputOutput.put(originalName, n.name);
|
remapper.inputOutput.put(originalName, n.name);
|
||||||
n.accept(new RemappingClassAdapter(cw, remapper));
|
n.accept(new ClassRemapper(cw, remapper));
|
||||||
// n.accept( cw );
|
// n.accept( cw );
|
||||||
|
|
||||||
// n.accept( new TraceClassVisitor( new PrintWriter( System.out ) ) );
|
// n.accept( new TraceClassVisitor( new PrintWriter( System.out ) ) );
|
||||||
|
|||||||
@@ -521,6 +521,10 @@ public final class ApiBlocks implements IBlocks {
|
|||||||
.disableItem()
|
.disableItem()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
if (!doubleSlabDef.maybeBlock().isPresent()) {
|
||||||
|
return new BlockDefinition(slabId, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
Verify.verify(doubleSlabDef.maybeBlock().isPresent());
|
Verify.verify(doubleSlabDef.maybeBlock().isPresent());
|
||||||
|
|
||||||
BlockSlab doubleSlabBlock = (BlockSlab) doubleSlabDef.maybeBlock().get();
|
BlockSlab doubleSlabBlock = (BlockSlab) doubleSlabDef.maybeBlock().get();
|
||||||
@@ -530,6 +534,10 @@ public final class ApiBlocks implements IBlocks {
|
|||||||
.features(AEFeature.DECORATIVE_BLOCKS)
|
.features(AEFeature.DECORATIVE_BLOCKS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
if (!itemDef.maybeItem().isPresent()) {
|
||||||
|
return new BlockDefinition(slabId, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
Verify.verify(itemDef.maybeItem().isPresent());
|
Verify.verify(itemDef.maybeItem().isPresent());
|
||||||
|
|
||||||
// Return a new composite block definition that combines the single slab block with the slab item
|
// Return a new composite block definition that combines the single slab block with the slab item
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ public final class ApiItems implements IItems {
|
|||||||
|
|
||||||
private final IItemDefinition entropyManipulator;
|
private final IItemDefinition entropyManipulator;
|
||||||
private final IItemDefinition wirelessTerminal;
|
private final IItemDefinition wirelessTerminal;
|
||||||
|
private final IItemDefinition wirelessCraftingTerminal;
|
||||||
|
private final IItemDefinition wirelessPatternTerminal;
|
||||||
|
private final IItemDefinition wirelessFluidTerminal;
|
||||||
private final IItemDefinition biometricCard;
|
private final IItemDefinition biometricCard;
|
||||||
private final IItemDefinition chargedStaff;
|
private final IItemDefinition chargedStaff;
|
||||||
private final IItemDefinition massCannon;
|
private final IItemDefinition massCannon;
|
||||||
@@ -178,6 +181,10 @@ public final class ApiItems implements IItems {
|
|||||||
.dispenserBehavior(DispenserBlockTool::new)
|
.dispenserBehavior(DispenserBlockTool::new)
|
||||||
.build();
|
.build();
|
||||||
this.wirelessTerminal = powerTools.item("wireless_terminal", ToolWirelessTerminal::new).addFeatures(AEFeature.WIRELESS_ACCESS_TERMINAL).build();
|
this.wirelessTerminal = powerTools.item("wireless_terminal", ToolWirelessTerminal::new).addFeatures(AEFeature.WIRELESS_ACCESS_TERMINAL).build();
|
||||||
|
this.wirelessCraftingTerminal = powerTools.item("wireless_crafting_terminal", ToolWirelessCraftingTerminal::new).addFeatures(AEFeature.WIRELESS_CRAFTING_TERMINAL).build();
|
||||||
|
this.wirelessPatternTerminal = powerTools.item("wireless_pattern_terminal", ToolWirelessPatternTerminal::new).addFeatures(AEFeature.WIRELESS_PATTERN_TERMINAL).build();
|
||||||
|
this.wirelessFluidTerminal = powerTools.item("wireless_fluid_terminal", ToolWirelessFluidTerminal::new).addFeatures(AEFeature.WIRELESS_FLUID_TERMINAL).build();
|
||||||
|
|
||||||
this.chargedStaff = powerTools.item("charged_staff", ToolChargedStaff::new).addFeatures(AEFeature.CHARGED_STAFF).build();
|
this.chargedStaff = powerTools.item("charged_staff", ToolChargedStaff::new).addFeatures(AEFeature.CHARGED_STAFF).build();
|
||||||
this.massCannon = powerTools.item("matter_cannon", ToolMatterCannon::new)
|
this.massCannon = powerTools.item("matter_cannon", ToolMatterCannon::new)
|
||||||
.addFeatures(AEFeature.MATTER_CANNON)
|
.addFeatures(AEFeature.MATTER_CANNON)
|
||||||
@@ -343,6 +350,21 @@ public final class ApiItems implements IItems {
|
|||||||
return this.wirelessTerminal;
|
return this.wirelessTerminal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemDefinition wirelessCraftingTerminal() {
|
||||||
|
return wirelessCraftingTerminal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemDefinition wirelessFluidTerminal() {
|
||||||
|
return wirelessFluidTerminal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemDefinition wirelessPatternTerminal() {
|
||||||
|
return wirelessPatternTerminal;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemDefinition biometricCard() {
|
public IItemDefinition biometricCard() {
|
||||||
return this.biometricCard;
|
return this.biometricCard;
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ public final class ApiMaterials implements IMaterials {
|
|||||||
private final IItemDefinition cardSpeed;
|
private final IItemDefinition cardSpeed;
|
||||||
private final IItemDefinition cardCapacity;
|
private final IItemDefinition cardCapacity;
|
||||||
private final IItemDefinition cardPatternExpansion;
|
private final IItemDefinition cardPatternExpansion;
|
||||||
|
private final IItemDefinition cardQuantumLink;
|
||||||
|
private final IItemDefinition cardMagnet;
|
||||||
private final IItemDefinition cardFuzzy;
|
private final IItemDefinition cardFuzzy;
|
||||||
private final IItemDefinition cardInverter;
|
private final IItemDefinition cardInverter;
|
||||||
private final IItemDefinition cardCrafting;
|
private final IItemDefinition cardCrafting;
|
||||||
@@ -201,6 +203,8 @@ public final class ApiMaterials implements IMaterials {
|
|||||||
this.cardSpeed = new DamagedItemDefinition("material.card.acceleration", materials.createMaterial(MaterialType.CARD_SPEED));
|
this.cardSpeed = new DamagedItemDefinition("material.card.acceleration", materials.createMaterial(MaterialType.CARD_SPEED));
|
||||||
this.cardCapacity = new DamagedItemDefinition("material.card.capacity", materials.createMaterial(MaterialType.CARD_CAPACITY));
|
this.cardCapacity = new DamagedItemDefinition("material.card.capacity", materials.createMaterial(MaterialType.CARD_CAPACITY));
|
||||||
this.cardPatternExpansion = new DamagedItemDefinition("material.card.pattern.expansion", materials.createMaterial(MaterialType.CARD_PATTERN_EXPANSION));
|
this.cardPatternExpansion = new DamagedItemDefinition("material.card.pattern.expansion", materials.createMaterial(MaterialType.CARD_PATTERN_EXPANSION));
|
||||||
|
this.cardQuantumLink = new DamagedItemDefinition("material.card.quantum.link", materials.createMaterial(MaterialType.CARD_QUANTUM_LINK));
|
||||||
|
this.cardMagnet = new DamagedItemDefinition("material.card.magnet", materials.createMaterial(MaterialType.CARD_MAGNET));
|
||||||
this.cardFuzzy = new DamagedItemDefinition("material.card.fuzzy", materials.createMaterial(MaterialType.CARD_FUZZY));
|
this.cardFuzzy = new DamagedItemDefinition("material.card.fuzzy", materials.createMaterial(MaterialType.CARD_FUZZY));
|
||||||
this.cardInverter = new DamagedItemDefinition("material.card.inverter", materials.createMaterial(MaterialType.CARD_INVERTER));
|
this.cardInverter = new DamagedItemDefinition("material.card.inverter", materials.createMaterial(MaterialType.CARD_INVERTER));
|
||||||
this.cardCrafting = new DamagedItemDefinition("material.card.crafting", materials.createMaterial(MaterialType.CARD_CRAFTING));
|
this.cardCrafting = new DamagedItemDefinition("material.card.crafting", materials.createMaterial(MaterialType.CARD_CRAFTING));
|
||||||
@@ -396,6 +400,16 @@ public final class ApiMaterials implements IMaterials {
|
|||||||
return this.cardPatternExpansion;
|
return this.cardPatternExpansion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemDefinition cardQuantumLink() {
|
||||||
|
return this.cardQuantumLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemDefinition cardMagnet() {
|
||||||
|
return this.cardMagnet;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemDefinition cardFuzzy() {
|
public IItemDefinition cardFuzzy() {
|
||||||
return this.cardFuzzy;
|
return this.cardFuzzy;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ package appeng.core.api.imc;
|
|||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.api.IIMCProcessor;
|
import appeng.core.api.IIMCProcessor;
|
||||||
|
import net.minecraft.launchwrapper.Launch;
|
||||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ public class IMCSpatial implements IIMCProcessor {
|
|||||||
public void process(final IMCMessage m) {
|
public void process(final IMCMessage m) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Class classInstance = Class.forName(m.getStringValue());
|
final Class classInstance = Class.forName(m.getStringValue(), false, Launch.classLoader);
|
||||||
AEApi.instance().registries().movable().whiteListTileEntity(classInstance);
|
AEApi.instance().registries().movable().whiteListTileEntity(classInstance);
|
||||||
} catch (final ClassNotFoundException e) {
|
} catch (final ClassNotFoundException e) {
|
||||||
AELog.info("Bad Class Registered: " + m.getStringValue() + " by " + m.getSender());
|
AELog.info("Bad Class Registered: " + m.getStringValue() + " by " + m.getSender());
|
||||||
|
|||||||
@@ -64,12 +64,17 @@ public enum AEFeature {
|
|||||||
ENTROPY_MANIPULATOR("EntropyManipulator", Constants.CATEGORY_TOOLS),
|
ENTROPY_MANIPULATOR("EntropyManipulator", Constants.CATEGORY_TOOLS),
|
||||||
MATTER_CANNON("MatterCannon", Constants.CATEGORY_TOOLS),
|
MATTER_CANNON("MatterCannon", Constants.CATEGORY_TOOLS),
|
||||||
WIRELESS_ACCESS_TERMINAL("WirelessAccessTerminal", Constants.CATEGORY_TOOLS),
|
WIRELESS_ACCESS_TERMINAL("WirelessAccessTerminal", Constants.CATEGORY_TOOLS),
|
||||||
|
WIRELESS_CRAFTING_TERMINAL("WirelessCraftingTerminal", Constants.CATEGORY_TOOLS),
|
||||||
|
WIRELESS_PATTERN_TERMINAL("WirelessPatternTerminal", Constants.CATEGORY_TOOLS),
|
||||||
|
WIRELESS_FLUID_TERMINAL("WirelessFluidTerminal", Constants.CATEGORY_TOOLS),
|
||||||
|
|
||||||
COLOR_APPLICATOR("ColorApplicator", Constants.CATEGORY_TOOLS),
|
COLOR_APPLICATOR("ColorApplicator", Constants.CATEGORY_TOOLS),
|
||||||
METEORITE_COMPASS("MeteoriteCompass", Constants.CATEGORY_TOOLS),
|
METEORITE_COMPASS("MeteoriteCompass", Constants.CATEGORY_TOOLS),
|
||||||
|
|
||||||
SECURITY("Security", Constants.CATEGORY_NETWORK_FEATURES),
|
SECURITY("Security", Constants.CATEGORY_NETWORK_FEATURES),
|
||||||
SPATIAL_IO("SpatialIO", Constants.CATEGORY_NETWORK_FEATURES),
|
SPATIAL_IO("SpatialIO", Constants.CATEGORY_NETWORK_FEATURES),
|
||||||
QUANTUM_NETWORK_BRIDGE("QuantumNetworkBridge", Constants.CATEGORY_NETWORK_FEATURES),
|
QUANTUM_NETWORK_BRIDGE("QuantumNetworkBridge", Constants.CATEGORY_NETWORK_FEATURES),
|
||||||
|
QUANTUM_LINKING_CARD("QuantumLinkingCard", Constants.CATEGORY_NETWORK_FEATURES),
|
||||||
CHANNELS("Channels", Constants.CATEGORY_NETWORK_FEATURES),
|
CHANNELS("Channels", Constants.CATEGORY_NETWORK_FEATURES),
|
||||||
|
|
||||||
INTERFACE("Interface", Constants.CATEGORY_NETWORK_BUSES),
|
INTERFACE("Interface", Constants.CATEGORY_NETWORK_BUSES),
|
||||||
|
|||||||
@@ -25,10 +25,13 @@ import appeng.api.features.IWirelessTermHandler;
|
|||||||
import appeng.api.features.IWirelessTermRegistry;
|
import appeng.api.features.IWirelessTermRegistry;
|
||||||
import appeng.core.localization.PlayerMessages;
|
import appeng.core.localization.PlayerMessages;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
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.text.TextComponentString;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -80,6 +83,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final IWirelessTermHandler handler = this.getWirelessTerminalHandler(item);
|
final IWirelessTermHandler handler = this.getWirelessTerminalHandler(item);
|
||||||
|
|
||||||
final String unparsedKey = handler.getEncryptionKey(item);
|
final String unparsedKey = handler.getEncryptionKey(item);
|
||||||
if (unparsedKey.isEmpty()) {
|
if (unparsedKey.isEmpty()) {
|
||||||
player.sendMessage(PlayerMessages.DeviceNotLinked.get());
|
player.sendMessage(PlayerMessages.DeviceNotLinked.get());
|
||||||
@@ -94,7 +98,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (handler.hasPower(player, 0.5, item)) {
|
if (handler.hasPower(player, 0.5, item)) {
|
||||||
Platform.openGUI(player, null, null, GuiBridge.GUI_WIRELESS_TERM);
|
Platform.openGUI(player, null, null, (GuiBridge) handler.getGuiHandler(item));
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(PlayerMessages.DeviceNotPowered.get());
|
player.sendMessage(PlayerMessages.DeviceNotPowered.get());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ public enum ButtonToolTips {
|
|||||||
// Used in the tooltips of the items in the terminal, when moused over
|
// Used in the tooltips of the items in the terminal, when moused over
|
||||||
ItemsStored,
|
ItemsStored,
|
||||||
ItemsRequestable,
|
ItemsRequestable,
|
||||||
|
ItemsCraftable,
|
||||||
|
|
||||||
SchedulingMode,
|
SchedulingMode,
|
||||||
SchedulingModeDefault,
|
SchedulingModeDefault,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public enum PlayerMessages {
|
|||||||
DeviceNotLinked,
|
DeviceNotLinked,
|
||||||
StationCanNotBeLocated,
|
StationCanNotBeLocated,
|
||||||
SettingCleared,
|
SettingCleared,
|
||||||
;
|
MissingPatternsToEncode;
|
||||||
|
|
||||||
public ITextComponent get() {
|
public ITextComponent get() {
|
||||||
return new TextComponentTranslation(this.getName());
|
return new TextComponentTranslation(this.getName());
|
||||||
|
|||||||
@@ -84,7 +84,9 @@ public class AppEngPacketHandlerBase {
|
|||||||
|
|
||||||
PACKET_INFORM_PLAYER(PacketInformPlayer.class),
|
PACKET_INFORM_PLAYER(PacketInformPlayer.class),
|
||||||
|
|
||||||
PACKET_CRAFTING_CPUS_UPDATE(PacketCraftingCPUsUpdate.class);
|
PACKET_CRAFTING_CPUS_UPDATE(PacketCraftingCPUsUpdate.class),
|
||||||
|
|
||||||
|
PACKET_TERMINAL_KEYBIND(PacketTerminalUse.class);
|
||||||
|
|
||||||
|
|
||||||
private final Class<? extends AppEngPacket> packetClass;
|
private final Class<? extends AppEngPacket> packetClass;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import appeng.container.AEBaseContainer;
|
|||||||
import appeng.container.ContainerNull;
|
import appeng.container.ContainerNull;
|
||||||
import appeng.container.ContainerOpenContext;
|
import appeng.container.ContainerOpenContext;
|
||||||
import appeng.container.implementations.*;
|
import appeng.container.implementations.*;
|
||||||
|
import appeng.container.interfaces.IInventorySlotAware;
|
||||||
import appeng.fluids.container.*;
|
import appeng.fluids.container.*;
|
||||||
import appeng.fluids.helper.IFluidInterfaceHost;
|
import appeng.fluids.helper.IFluidInterfaceHost;
|
||||||
import appeng.fluids.parts.PartFluidFormationPlane;
|
import appeng.fluids.parts.PartFluidFormationPlane;
|
||||||
@@ -71,6 +72,7 @@ import appeng.tile.storage.TileDrive;
|
|||||||
import appeng.tile.storage.TileIOPort;
|
import appeng.tile.storage.TileIOPort;
|
||||||
import appeng.tile.storage.TileSkyChest;
|
import appeng.tile.storage.TileSkyChest;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import baubles.api.BaublesApi;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -101,6 +103,10 @@ public enum GuiBridge implements IGuiHandler {
|
|||||||
GUI_PORTABLE_CELL(ContainerMEPortableCell.class, IPortableCell.class, GuiHostType.ITEM, null),
|
GUI_PORTABLE_CELL(ContainerMEPortableCell.class, IPortableCell.class, GuiHostType.ITEM, null),
|
||||||
|
|
||||||
GUI_WIRELESS_TERM(ContainerWirelessTerm.class, WirelessTerminalGuiObject.class, GuiHostType.ITEM, null),
|
GUI_WIRELESS_TERM(ContainerWirelessTerm.class, WirelessTerminalGuiObject.class, GuiHostType.ITEM, null),
|
||||||
|
GUI_WIRELESS_CRAFTING_TERMINAL(ContainerWirelessCraftingTerminal.class, WirelessTerminalGuiObject.class, GuiHostType.ITEM, null),
|
||||||
|
GUI_WIRELESS_PATTERN_TERMINAL(ContainerWirelessPatternTerminal.class, WirelessTerminalGuiObject.class, GuiHostType.ITEM, null),
|
||||||
|
GUI_WIRELESS_FLUID_TERMINAL(ContainerWirelessFluidTerminal.class, WirelessTerminalGuiObject.class, GuiHostType.ITEM, null),
|
||||||
|
|
||||||
|
|
||||||
GUI_NETWORK_STATUS(ContainerNetworkStatus.class, INetworkTool.class, GuiHostType.ITEM, null),
|
GUI_NETWORK_STATUS(ContainerNetworkStatus.class, INetworkTool.class, GuiHostType.ITEM, null),
|
||||||
|
|
||||||
@@ -226,13 +232,17 @@ public enum GuiBridge implements IGuiHandler {
|
|||||||
public Object getServerGuiElement(final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z) {
|
public Object getServerGuiElement(final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z) {
|
||||||
final AEPartLocation side = AEPartLocation.fromOrdinal(ordinal & 0x07);
|
final AEPartLocation side = AEPartLocation.fromOrdinal(ordinal & 0x07);
|
||||||
final GuiBridge ID = values()[ordinal >> 4];
|
final GuiBridge ID = values()[ordinal >> 4];
|
||||||
final boolean stem = ((ordinal >> 3) & 1) == 1;
|
final boolean usingItemOnTile = ((ordinal >> 3) & 1) == 1;
|
||||||
if (ID.type.isItem()) {
|
if (ID.type.isItem()) {
|
||||||
ItemStack it = ItemStack.EMPTY;
|
ItemStack it = ItemStack.EMPTY;
|
||||||
if (stem) {
|
if (usingItemOnTile) {
|
||||||
it = player.inventory.getCurrentItem();
|
it = player.inventory.getCurrentItem();
|
||||||
} else if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
} else if (y == 0) {
|
||||||
it = player.inventory.getStackInSlot(x);
|
if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
||||||
|
it = player.inventory.getStackInSlot(x);
|
||||||
|
}
|
||||||
|
} else if (y == 1 && z == Integer.MIN_VALUE) {
|
||||||
|
it = BaublesApi.getBaublesHandler(player).getStackInSlot(x);
|
||||||
}
|
}
|
||||||
final Object myItem = this.getGuiObject(it, player, w, x, y, z);
|
final Object myItem = this.getGuiObject(it, player, w, x, y, z);
|
||||||
if (myItem != null && ID.CorrectTileOrPart(myItem)) {
|
if (myItem != null && ID.CorrectTileOrPart(myItem)) {
|
||||||
@@ -337,13 +347,19 @@ public enum GuiBridge implements IGuiHandler {
|
|||||||
public Object getClientGuiElement(final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z) {
|
public Object getClientGuiElement(final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z) {
|
||||||
final AEPartLocation side = AEPartLocation.fromOrdinal(ordinal & 0x07);
|
final AEPartLocation side = AEPartLocation.fromOrdinal(ordinal & 0x07);
|
||||||
final GuiBridge ID = values()[ordinal >> 4];
|
final GuiBridge ID = values()[ordinal >> 4];
|
||||||
final boolean stem = ((ordinal >> 3) & 1) == 1;
|
final boolean usingItemOnTile = ((ordinal >> 3) & 1) == 1;
|
||||||
|
|
||||||
if (ID.type.isItem()) {
|
if (ID.type.isItem()) {
|
||||||
ItemStack it = ItemStack.EMPTY;
|
ItemStack it = ItemStack.EMPTY;
|
||||||
if (stem) {
|
if (usingItemOnTile) {
|
||||||
it = player.inventory.getCurrentItem();
|
it = player.inventory.getCurrentItem();
|
||||||
} else if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
} else if (y == 0) {
|
||||||
it = player.inventory.getStackInSlot(x);
|
if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
||||||
|
it = player.inventory.getStackInSlot(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (y == 1 && z == Integer.MIN_VALUE) {
|
||||||
|
it = BaublesApi.getBaublesHandler(player).getStackInSlot(x);
|
||||||
}
|
}
|
||||||
final Object myItem = this.getGuiObject(it, player, w, x, y, z);
|
final Object myItem = this.getGuiObject(it, player, w, x, y, z);
|
||||||
if (myItem != null && ID.CorrectTileOrPart(myItem)) {
|
if (myItem != null && ID.CorrectTileOrPart(myItem)) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import appeng.api.networking.security.IActionHost;
|
|||||||
import appeng.container.ContainerOpenContext;
|
import appeng.container.ContainerOpenContext;
|
||||||
import appeng.container.implementations.ContainerCraftAmount;
|
import appeng.container.implementations.ContainerCraftAmount;
|
||||||
import appeng.container.implementations.ContainerCraftConfirm;
|
import appeng.container.implementations.ContainerCraftConfirm;
|
||||||
|
import appeng.container.interfaces.IInventorySlotAware;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.sync.AppEngPacket;
|
import appeng.core.sync.AppEngPacket;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
@@ -91,7 +92,14 @@ public class PacketCraftRequest extends AppEngPacket {
|
|||||||
final ContainerOpenContext context = cca.getOpenContext();
|
final ContainerOpenContext context = cca.getOpenContext();
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
final TileEntity te = context.getTile();
|
final TileEntity te = context.getTile();
|
||||||
Platform.openGUI(player, te, cca.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_CONFIRM);
|
if (te != null) {
|
||||||
|
Platform.openGUI(player, te, cca.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_CONFIRM);
|
||||||
|
} else {
|
||||||
|
if (ah instanceof IInventorySlotAware) {
|
||||||
|
IInventorySlotAware i = ((IInventorySlotAware) ah);
|
||||||
|
Platform.openGUI(player, i.getInventorySlot(), GuiBridge.GUI_CRAFTING_CONFIRM, i.isBaubleSlot());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (player.openContainer instanceof ContainerCraftConfirm) {
|
if (player.openContainer instanceof ContainerCraftConfirm) {
|
||||||
final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
|
final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user