Compare commits

..

1 Commits

Author SHA1 Message Date
PrototypeTrousers 66ab022c95 package patterns 2023-02-08 21:18:51 -03:00
495 changed files with 5222 additions and 7326 deletions
+15
View File
@@ -0,0 +1,15 @@
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'
-68
View File
@@ -1,68 +0,0 @@
# Publishes built jars to distribution platforms
name: Publish
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # any semver tag, e.g. 1.2.3
env:
# type of release
RELEASE_TYPE: "release"
jobs:
Publish:
runs-on: ubuntu-latest
permissions:
contents: write # needed to create GitHub releases
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Check for Duplicate Tags
run: |
if git rev-parse -q --verify "refs/tags/${{ github.ref }}" >/dev/null; then
echo "Tag already exists. A version bump is required."
exit 1
fi
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Build Project
uses: gradle/gradle-build-action@v2
with:
arguments: 'build --build-cache --daemon' # use the daemon here so the rest of the process is faster
generate-job-summary: false
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
- name: Publish to GitHub
uses: softprops/action-gh-release@v1
with:
files: "build/libs/*.jar"
generate_release_notes: true
fail_on_unmatched_files: true
- name: Publish to Curseforge
uses: gradle/gradle-build-action@v2
env:
CURSEFORGE_API_KEY: "${{secrets.CURSEFORGE_API_KEY}}"
CURSEFORGE_PROJECT_ID: "${{secrets.CURSEFORGE_PROJECT_ID}}"
RELEASE_TYPE: "${{env.RELEASE_TYPE}}"
with:
arguments: 'curseforge --daemon'
generate-job-summary: false
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
-39
View File
@@ -1,39 +0,0 @@
# Updates the Gradle Cache when relevant files change
name: Update Gradle Cache
on:
workflow_dispatch:
push:
branches:
- master
paths:
- "gradle**" # covers gradle folder, gradle.properties, gradlew
- "build.gradle*"
- "settings.gradle*"
- "src/main/resources/*_at.cfg" # access transformers
jobs:
Update_Cache:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Update Cache
uses: gradle/gradle-build-action@v2
with:
arguments: 'test --build-cache --no-daemon' # disable daemon since only one gradle operation will happen
generate-job-summary: false
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
cache-write-only: true
+24 -76
View File
@@ -1,83 +1,31 @@
.nopublish
# exclude all
/*
### Windows ###
# include important folders
# need gradle
!gradle/
!gradlew
!gradlew.bat
!build.gradle
!gradle.properties
!.travis.yml
thumbs.db
*.db
# include markdowns
!README.md
!LICENSE
### Java ###
# include sourcecode
!src/
*.class
# include git important files
!.gitmodules
!.gitignore
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# code format to reduce noise in git commits
!codeformat/
# Package Files #
*.war
*.ear
*.txt
# Github specific files and directories
!.github/
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
/eclipse
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
### Intellij IDEA ###
*.iml
*.ipr
*.iws
.idea/
.idea_modules/
/classes/
/out/
/build/
# Linux
*~
run/
logs/
# Explicit ignores
Thumbs.db
+33
View File
@@ -0,0 +1,33 @@
sudo: required
dist: trusty
language: java
jdk:
- oraclejdk8
- openjdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json.etag
- rm -fr $HOME/.gradle/caches/minecraft/deobfedDeps
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/.sonar/cache'
- '$HOME/.gradle/wrapper'
- '$HOME/.gradle/caches'
addons:
sonarcloud:
organization: "appliedenergistics"
install: "./gradlew setupCIWorkspace"
script:
- "./gradlew build"
- "./gradlew test"
- "./gradlew sonarqube"
+7 -15
View File
@@ -1,25 +1,19 @@
# Applied Energistics 2 Unofficial Extended Life
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack.
[![Downloads](http://cf.way2muchnoise.eu/570458.svg)](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [![MCVersion](http://cf.way2muchnoise.eu/versions/570458.svg)](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [![GitHub issues](https://img.shields.io/github/issues/AE2-UEL/Applied-Energistics-2.svg)](https://github.com/AE2-UEL/Applied-Energistics-2/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/AE2-UEL/Applied-Energistics-2.svg)](https://github.com/AE2-UEL/Applied-Energistics-2/pulls)
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.
---
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory)
## About
A maintained fork of a Mod about Matter, Energy and using them to conquer the world.
This project started as a fork of [Applied Energistics 2](https://github.com/AppliedEnergistics/Applied-Energistics-2) by [PrototypeTrousers](https://github.com/PrototypeTrousers), initially addressing issues related to the [Nomifactory](https://www.curseforge.com/minecraft/modpacks/nomifactory) modpack. It is now being maintained by the [AE2 Unofficial Extended Life Team](https://github.com/AE2-UEL).
See [Releases](https://github.com/PrototypeTrousers/Applied-Energistics-2/releases) for the compiled jars.
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. Not sure why you would do that, but we support that nonetheless!
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
* Applied Energistics 2 API
@@ -35,10 +29,8 @@ The second argument allows you to customize which stages exactly you want to be
- [![License](https://img.shields.io/badge/License-No%20Restriction-green.svg?style=flat-square)](https://creativecommons.org/publicdomain/zero/1.0/)
## Credits
Special thanks to:
* PrototypeTrousers for the initial fork
Thanks to
* Notch et al for Minecraft
* Lex et al for MinecraftForge
* AlgorithmX2 for AppliedEnergistics2
+86 -1189
View File
File diff suppressed because it is too large Load Diff
-52
View File
@@ -1,52 +0,0 @@
//file:noinspection DependencyNotationArgument
// TODO remove when fixed in RFG ^
/*
* Add your dependencies here. Common configurations:
* - implementation("group:name:version:classifier"): if you need this for internal implementation details of the mod.
* Available at compiletime and runtime for your environment.
*
* - compileOnlyApi("g:n:v:c"): if you need this for internal implementation details of the mod.
* Available at compiletime but not runtime for your environment.
*
* - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry
*
* - testCONFIG("g:n:v:c"): replace CONFIG by one of the above, same as above but for the test sources instead of main
*
* You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed.
*
* To add a mod with CurseMaven, replace '("g:n:v:c")' in the above with 'rfg.deobf("curse.maven:project_slug-project_id:file_id")'
* Example: implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4527757")
*
* To shadow a dependency, use 'shadowImplementation'. For more info, see https://github.com/GregTechCEu/Buildscripts/blob/master/docs/shadow.md
*
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
// Mods always in-game
implementation rfg.deobf("curse.maven:gregtechceu-557242:4429261") // GTCEu
implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // CCL 3.2.3.358
implementation rfg.deobf("curse.maven:baubles-227083:2518667") // Baubles
implementation rfg.deobf("curse.maven:industrial-craft-242638:2547175") // IC2
implementation rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry
// Mods only in code by default
compileOnly "curse.maven:chisel-235279:2915375"
compileOnly "curse.maven:hwyla-253449:2568751"
compileOnly "curse.maven:recipe-stages-280554:3405072"
compileOnly "curse.maven:item-stages-280316:2696769"
compileOnly "curse.maven:game-stages-268655:2951844"
compileOnly "net.darkhax.tesla:Tesla-1.12.2:1.0.63"
compileOnly "curse.maven:CoFHCore-69162:2920433"
compileOnly "CraftTweaker2:CraftTweaker2-API:4.1.20.684"
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
compileOnly rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31
compileOnly rfg.deobf("curse.maven:actually-additions-228404:3117927") // ActuallyAdditions r152
}
minecraft {
injectedTags.put('AEVERSION', aeversion)
injectedTags.put('AECHANNEL', aechannel)
injectedTags.put('AEBUILD', aebuild)
}
+30 -181
View File
@@ -1,184 +1,33 @@
modName = AE2 Unofficial Extended Life
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = appliedenergistics2
modGroup = appeng
# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion =
# AE2 Specific Version Settings
aeversion=rv6
aechannel=stable
aebuild=7
# 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 = MODID
gradleTokenModName = MODNAME
gradleTokenVersion = VERSION
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage = api
# If you want to keep your API code in src/api instead of src/main
useSrcApiPath = true
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/
# There can be multiple files in a comma-separated list.
# Example value: mymodid_at.cfg,jei_at.cfg
accessTransformersFile = appliedenergistics2_at.cfg
# 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 =
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
generateMixinConfig = false
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass = core.AE2ELCore
# 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
# Outputs pre-transformed and post-transformed loaded classes to run/CLASSLOADER_TEMP. Can be used in combination with
# diff to see exactly what your ASM or Mixins are changing in the target file.
# Optionally can be specified with the 'CORE_MOD_DEBUG' env var. Will output a lot of files!
enableCoreModDebug = false
# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
includeWellKnownRepositories = true
# 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
# Separate run directories into "run/client" for runClient task, and "run/server" for runServer task.
# Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/"
separateRunDirectories = false
# The display name format of versions published to Curse and Modrinth. $MOD_NAME and $VERSION are available variables.
# Default: $MOD_NAME \u2212 $VERSION. \u2212 is the minus character which looks much better than the hyphen minus on Curse.
versionDisplayFormat = $MOD_NAME \u2212 $VERSION
# Publishing to modrinth requires you to set the MODRINTH_API_KEY environment variable to your current modrinth API token.
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish on Modrinth.
# Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable.
modrinthProjectId =
# 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
# Alternatively this can be set with the 'RELEASE_TYPE' environment variable.
# Allowed types: release, beta, alpha
releaseType = release
# Generate a default changelog for releases. Requires git to be installed, as it uses it to generate a changelog of
# commits since the last tagged release.
generateDefaultChangelog = false
# Prevent the source code from being published
noPublishedSources = false
# Publish to a custom maven location. Follows a few rules:
# Group ID can be set with the 'ARTIFACT_GROUP_ID' environment variable, default to 'project.group'
# Artifact ID can be set with the 'ARTIFACT_ID' environment variable, default to 'project.name'
# Version can be set with the 'RELEASE_VERSION' environment variable, default to 'modVersion'
# For maven credentials:
# Username is set with the 'MAVEN_USER' environment variable, default to "NONE"
# Password is set with the 'MAVEN_PASSWORD' environment variable, default to "NONE"
customMavenPublishUrl =
# The group for maven artifacts. Defaults to the 'project.modGroup' until the last '.' (if any).
# So 'mymod' becomes 'mymod' and 'com.myname.mymodid' 'becomes com.myname'
mavenArtifactGroup =
# Enable spotless checks
# Enforces code formatting on your source code
# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless
# to format your code. However, you can create your own version of these files and place them in your project's
# root directory to apply your own formatting options instead.
enableSpotless = false
# 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
aegroup=appeng
aebasename=appliedenergistics2
extended=extended_life
extendedversion=v0.55.2
#########################################################
# Versions #
#########################################################
minecraft_version=1.12.2
mcp_mappings=snapshot_20171003
forge_version=14.23.5.2847
#########################################################
# Installable #
#########################################################
hwyla_version=1.8.26-B41_1.12.2
#########################################################
# Provided APIs #
#########################################################
jei_version=4.16.1.302
tesla_version=1.0.63
ic2_version=2.8.73-ex112
top_version=1.12-1.4.23-16
cofhcore_version=1.12.2-4.5.2.19
crafttweaker_version=4.1.8.9
ctm_version=MC1.12.2-0.3.1.16
forestry_version=5.8.2.387
#########################################################
# Deployment #
#########################################################
website_version=1.12.2
curse_versions=1.12.2
+75
View File
@@ -0,0 +1,75 @@
/*
* 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'
}
task devJar(type: Jar, overwrite: true) {
from sourceSets.api.output
from sourceSets.main.output
classifier = 'dev'
}
artifacts {
archives apiJar
archives javadocJar
archives sourceJar
archives devJar
}
+120
View File
@@ -0,0 +1,120 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
repositories {
mavenLocal()
maven {
url "https://cursemaven.com"
}
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
maven {
name "Mobius"
url "http://mobiusstrip.eu/maven"
}
maven {
name = "JEI repo"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name "Ellpeck"
url "https://maven.ellpeck.de"
}
maven {
name = "IC2 repo"
url = "http://maven.ic2.player.to"
}
maven {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven { // TheOneProbe
name 'tterrag maven'
url "http://maven.tterrag.com/"
}
maven { // McJtyLib
name 'mcjty'
url "http://maven.k-4u.nl/"
}
maven { // CraftTweaker
name 'jared maven'
url "http://maven.blamejared.com/"
}
//maven { // modmaven, maven proxy
// name 'modmaven'
// url "https://modmaven.k-4u.nl/"
//}
}
configurations {
mods
}
dependencies {
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
// installable runtime dependencies
deobfCompile "curse.maven:gregtechceu-557242:3949406"
compileOnly "curse.maven:chisel-235279:2915375"
deobfCompile "baubles:Baubles:1.12:1.5.2"
//mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
mods "curse.maven:hwyla-253449:2568751"
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
// compile against provided APIs
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
compileOnly "curse.maven:hwyla-253449:2568751"
//Code chicken lib, GTCE dependency
deobfCompile "curse.maven:CCL-242818:2779848"
compileOnly "curse.maven:recipe-stages-280554:3405072"
compileOnly "curse.maven:item-stages-280316:2696769"
compileOnly "curse.maven:game-stages-268655:2951844"
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
compileOnly "curse.maven:inventory-bogo-sorter-632327:4329854"
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
deobfCompile "net.sengir.forestry:forestry_${minecraft_version}:$forestry_version"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
// unit test dependencies
testCompile "junit:junit:4.12"
}
+55
View File
@@ -0,0 +1,55 @@
/*
* 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>.
*/
task wrapper(type: Wrapper) {
gradleVersion = "2.14"
}
// HWYLA
task installHwyla(type: Copy, dependsOn: "deinstallHwyla") {
from { configurations.mods }
include "**/*Hwyla*.jar"
into file(minecraft.runDir + "/mods")
}
task deinstallHwyla(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*Hwyla*.jar")
}
// IC2
task installIC2(type: Copy, dependsOn: "deinstallIC2") {
from { configurations.mods }
include "**/*industrialcraft-2*.jar"
into file(minecraft.runDir + "/mods")
}
task deinstallIC2(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*industrialcraft-2*.jar")
}
// TOP
task installTop(type: Copy, dependsOn: ["deinstallTop"]) {
from { configurations.mods }
include "**/*TheOneProbe*.jar"
into file(minecraft.runDir + "/mods")
}
task deinstallTop(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*TheOneProbe*.jar")
}
Binary file not shown.
+1 -3
View File
@@ -1,7 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
Vendored
+115 -191
View File
@@ -1,126 +1,78 @@
#!/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.
#
#!/usr/bin/env sh
##############################################################################
#
# 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/.
#
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
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
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
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
MAX_FD="maximum"
warn () {
echo "$*"
} >&2
}
die () {
echo
echo "$*"
echo
exit 1
} >&2
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD=$JAVA_HOME/bin/java
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -129,120 +81,92 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
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.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# 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" )
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
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
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# 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
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# 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"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
# 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" "$@"
Vendored
+24 -32
View File
@@ -1,20 +1,4 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,23 +9,19 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -55,7 +35,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -65,26 +45,38 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
-30
View File
@@ -1,30 +0,0 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name 'GTNH Maven'
url 'https://nexus.gtnewhorizons.com/repository/public/'
//noinspection GroovyAssignabilityCheck
mavenContent {
includeGroup 'com.gtnewhorizons'
includeGroup 'com.gtnewhorizons.retrofuturagradle'
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins {
id 'com.diffplug.blowdryerSetup' version '1.7.0'
// Automatic toolchain provisioning
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}
blowdryerSetup {
repoSubfolder 'spotless'
github 'GregTechCEu/Buildscripts', 'tag', 'v1.0.7'
}
rootProject.name = rootProject.projectDir.getName()
@@ -0,0 +1,5 @@
package appeng.api.config;
public enum Packaging {
ENABLED, DISABLED;
}
@@ -40,13 +40,11 @@ public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable
/**
* 0 - cell is missing.
*
* 1 - green, the cell is present and partially empty
* 1 - green,
*
* 2 - orange, the cell is present and full on types
* 2 - orange,
*
* 3 - red, the cell is present and full on bytes
*
* 4 - blue, the cell is present but totally empty
* 3 - red
*
* @param slot slot index
*
@@ -37,82 +37,86 @@ import java.util.List;
/**
* do not implement provided by {@link ICraftingPatternItem}
*
* <p>
* caching this INSTANCE will increase performance of validation and checks.
*/
public interface ICraftingPatternDetails
{
public interface ICraftingPatternDetails {
/**
* @return source item.
*/
ItemStack getPattern();
/**
* @return source item.
*/
ItemStack getPattern();
/**
* @param slotIndex specific slot index
* @param itemStack item in slot
* @param world crafting world
*
* @return if an item can be used in the specific slot for this pattern.
*/
boolean isValidItemForSlot( int slotIndex, ItemStack itemStack, World world );
/**
* @param slotIndex specific slot index
* @param itemStack item in slot
* @param world crafting world
* @return if an item can be used in the specific slot for this pattern.
*/
boolean isValidItemForSlot(int slotIndex, ItemStack itemStack, World world);
/**
* @return if this pattern is a crafting pattern ( work bench )
*/
boolean isCraftable();
/**
* @return if this pattern is a crafting pattern ( work bench )
*/
boolean isCraftable();
/**
* @return a list of the inputs, will include nulls.
*/
IAEItemStack[] getInputs();
/**
* @return a list of the inputs, will include nulls.
*/
IAEItemStack[] getInputs();
/**
* @return a list of the inputs, will be clean
*/
IAEItemStack[] getCondensedInputs();
/**
* @return a list of the inputs, will be clean
*/
IAEItemStack[] getCondensedInputs();
/**
* @return a list of the outputs, will be clean
*/
IAEItemStack[] getCondensedOutputs();
/**
* @return a list of the outputs, will be clean
*/
IAEItemStack[] getCondensedOutputs();
/**
* @return a list of the outputs, will include nulls.
*/
IAEItemStack[] getOutputs();
/**
* @return a list of the outputs, will include nulls.
*/
IAEItemStack[] getOutputs();
/**
* @return if this pattern is enabled to support substitutions.
*/
boolean canSubstitute();
/**
* @return if this pattern is enabled to support substitutions.
*/
boolean canSubstitute();
default List<IAEItemStack> getSubstituteInputs( int slot )
{
return Collections.emptyList();
}
default List<IAEItemStack> getSubstituteInputs(int slot) {
return Collections.emptyList();
}
/**
* Allow using this INSTANCE of the pattern details to preform the crafting action with performance enhancements.
*
* @param craftingInv inventory
* @param world crafting world
*
* @return the crafted ( work bench ) item.
*/
ItemStack getOutput( InventoryCrafting craftingInv, World world );
/**
* Allow using this INSTANCE of the pattern details to preform the crafting action with performance enhancements.
*
* @param craftingInv inventory
* @param world crafting world
* @return the crafted ( work bench ) item.
*/
ItemStack getOutput(InventoryCrafting craftingInv, World world);
/**
* Get the priority of this pattern
*
* @return the priority of this pattern
*/
int getPriority();
/**
* Get the priority of this pattern
*
* @return the priority of this pattern
*/
int getPriority();
/**
* Set the priority the of this pattern.
*
* @param priority priority of pattern
*/
void setPriority( int priority );
/**
* Set the priority the of this pattern.
*
* @param priority priority of pattern
*/
void setPriority(int priority);
/**
* @return if this pattern is a packaging pattern.
*/
default boolean isPackage() {
return false;
}
}
+1 -1
View File
@@ -22,7 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@API(apiVersion = "rv6", owner = "appliedenergistics2", provides = "appliedenergistics2|API")
@API( apiVersion = "@aeversion@", owner = "appliedenergistics2", provides = "appliedenergistics2|API" )
package appeng.api;
@@ -41,13 +41,6 @@ import appeng.api.util.AEPartLocation;
public interface IFacadeContainer
{
/**
* Checks if the {@link IFacadePart} can be added to the given side.
*
* @return true if the facade can be successfully added
*/
boolean canAddFacade( IFacadePart a );
/**
* Attempts to add the {@link IFacadePart} to the given side.
*
+26 -50
View File
@@ -24,7 +24,6 @@
package appeng.api.parts;
import appeng.api.util.AEPartLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
@@ -33,11 +32,35 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nullable;
public interface IPartHelper
{
/**
* Register a new layer with the part layer system, this allows you to write an in between between tile entities and
* parts.
*
* AE By Default includes,
*
* 1. ISidedInventory ( and by extension IInventory. )
*
* 2. IFluidHandler Forge Fluids
*
* 3. IPowerEmitter BC Power output.
*
* 4. IPowerReceptor BC Power input.
*
* 5. IEnergySink IC2 Power input.
*
* 6. IEnergySource IC2 Power output.
*
* 7. IPipeConnection BC Pipe Connections
*
* As long as a valid layer is registered for a interface you can simply implement that interface on a part get
* implement it.
*
* @return true on success, false on failure, usually a error will be logged as well.
*/
boolean registerNewLayer( String string, String layerInterface );
/**
* use in use item, to try and place a IBusItem
@@ -56,51 +79,4 @@ public interface IPartHelper
* @return the render mode
*/
CableRenderMode getCableRenderMode();
/**
* Try to get a part at a specific place in the world.
*
* @param w world the part is in
* @param pos pos of the part host
* @param side side to test for a part on.
*
* @return the part if it exists, null otherwise
*/
@Nullable
IPart getPart( World w, BlockPos pos, AEPartLocation side );
/**
* Try to get a part host at a specific place in the world.
*
* @param w world the part host is in
* @param pos pos of the part host
*
* @return the part host if it exists, null otherwise
*/
@Nullable
IPartHost getPartHost( World w, BlockPos pos );
/**
* Get a part host if it exists, or place one if it doesn't.
*
* @param w world the part host is in
* @param pos pos to get or place the part host
* @param force whether to skip permission and existing block checks and forcibly place the part host here.
* @param p the placing player, or null if none
*
* @return the existing or created part host, or null if it didn't already exist and part host is unable to be placed.
*/
@Nullable
IPartHost getOrPlacePartHost( World w, BlockPos pos, boolean force, @Nullable EntityPlayer p );
/**
* Test if a part host can be successfully placed at a given position by the provided player.
*
* @param w world the part host is in
* @param pos pos to test for part host placement
* @param p the placing player, or null if none
*
* @return if the part can be placed at the provided world and position
*/
boolean canPlacePartHost( World w, BlockPos pos, @Nullable EntityPlayer p );
}
+7 -13
View File
@@ -145,24 +145,13 @@ public interface IPartHost extends ICustomCableConnection
*/
SelectedPart selectPart( Vec3d pos );
/**
* Same as {@link #selectPart(Vec3d)}, but with global instead of local coordinates.
*/
default SelectedPart selectPartGlobal( Vec3d pos ) {
DimensionalCoord globalPos = getLocation();
return selectPart(pos.subtract(
globalPos.getPos().getX(),
globalPos.getPos().getY(),
globalPos.getPos().getZ()));
}
/**
* can be used by parts to trigger the tile or part to save.
*/
void markForSave();
/**
* called when parts are added or removed
* part of the {@link LayerBase}
*/
void partChanged();
@@ -180,6 +169,11 @@ public interface IPartHost extends ICustomCableConnection
*/
boolean isEmpty();
/**
* @return a mutable list of flags you can adjust to track state.
*/
Set<LayerFlags> getLayerFlags();
/**
* remove host from world...
*/
@@ -197,4 +191,4 @@ public interface IPartHost extends ICustomCableConnection
*/
boolean isInWorld();
}
}
@@ -0,0 +1,98 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.parts;
import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import appeng.api.util.AEPartLocation;
/**
* All Layers must extends this, this get part implementation is provided to interface with the parts, however a real
* implementation will be used at runtime.
*
* TODO: Consider removing and replacing with capabilities.
*/
public abstract class LayerBase extends TileEntity // implements IPartHost
{
/**
* Grants access for the layer to the parts of the host.
*
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
*
* @param side side of part
*
* @return the part for the requested side.
*/
public IPart getPart( final AEPartLocation side )
{
return null; // place holder.
}
/**
* Grants access for the layer to the parts of the host.
*
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
*
* @param side side of part
*
* @return the part for the requested side.
*/
public IPart getPart( final EnumFacing side )
{
return null; // place holder.
}
/**
* called when the parts change in the container, YOU MUST CALL super.PartChanged();
*/
public void notifyNeighbors()
{
}
/**
* called when the parts change in the container, YOU MUST CALL super.PartChanged();
*/
public void partChanged()
{
}
/**
* @return a mutable list of flags you can adjust to track state.
*/
public Set<LayerFlags> getLayerFlags()
{
return null; // place holder.
}
public void markForSave()
{
// something!
}
}
@@ -0,0 +1,35 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.parts;
/**
* TODO: Consider removing and replacing with capabilities.
*/
public enum LayerFlags
{
IC2_ENET
}
@@ -123,8 +123,6 @@ public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
*
* 3 - red, ( usually means the cell is 100% full )
*
* 4 - blue, ( usually means the cell is available and completely empty. )
*
* @return get the status of the cell based on its contents.
*/
int getStatusForCell();
@@ -0,0 +1,87 @@
package yalter.mousetweaks.api;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
/**
* This is the interface you want to implement in your GuiScreen to make it compatible with Mouse Tweaks.
* If this interface is not enough (for example, you need a custom slot click function, or if you use a custom Container
* which happens to be incompatible), check IMTModGuiContainer2Ex instead.
* If you just need to disable Mouse Tweaks or the wheel tweak, see the MouseTweaksIgnore
* or the MouseTweaksDisableWheelTweak annotations.
*/
public interface IMTModGuiContainer2 {
/**
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
*
* @return True if Mouse Tweaks should be disabled, false otherwise.
*/
boolean MT_isMouseTweaksDisabled();
/**
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
*
* @return True if the Wheel Tweak should be disabled, false otherwise.
*/
boolean MT_isWheelTweakDisabled();
/**
* Returns the Container.
*
* @return Container that is currently in use.
*/
Container MT_getContainer();
/**
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
*
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
*/
Slot MT_getSlotUnderMouse();
/**
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
*
* @param slot the slot to check
* @return True if slot is a crafting output slot.
*/
boolean MT_isCraftingOutput(Slot slot);
/**
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
* slots and the Destroy Item slot in the vanilla creative inventory.
*
* @param slot the slot to check
* @return Tru if slot should be ignored by Mouse Tweaks.
*/
boolean MT_isIgnored(Slot slot);
/**
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
* events are handled (although note these events are handled every game tick, which is far less frequent than every
* render tick).<br><br>
*
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
*
* For vanilla containers this method looks like this:
* <pre>
* this.ignoreMouseUp = true;
*
* if (this.dragSplitting) {
* if (this.dragSplittingButton == 1) {
* this.dragSplitting = false;
* return true;
* }
* }
*
* return false;
* </pre>
*
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
*/
boolean MT_disableRMBDraggingFunctionality();
}
@@ -1,14 +0,0 @@
package yalter.mousetweaks.api;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Put this on your GuiScreen to disable Mouse Tweaks.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MouseTweaksIgnore {
}
+7 -7
View File
@@ -307,13 +307,13 @@ public abstract class AEBaseBlock extends Block {
return dir;
}
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
final int west_y = forward.getZOffset() * up.getYOffset() - forward.getXOffset() * up.getZOffset();
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
EnumFacing west = null;
for (final EnumFacing dx : EnumFacing.VALUES) {
if (dx.getXOffset() == west_x && dx.getYOffset() == west_y && dx.getZOffset() == west_z) {
if (dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z) {
west = dx;
}
}
@@ -348,12 +348,12 @@ public abstract class AEBaseBlock extends Block {
@Override
public String toString() {
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]";
}
protected String getTranslationKey(final ItemStack is) {
return this.getTranslationKey();
protected String getUnlocalizedName(final ItemStack is) {
return this.getUnlocalizedName();
}
protected boolean hasCustomRotation() {
@@ -38,7 +38,6 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -78,9 +77,8 @@ public class AEBaseItemBlock extends ItemBlock {
}
@Override
@NotNull
public String getTranslationKey(final ItemStack is) {
return this.blockType.getTranslationKey(is);
public String getUnlocalizedName(final ItemStack is) {
return this.blockType.getUnlocalizedName(is);
}
@Override
@@ -139,7 +137,7 @@ public class AEBaseItemBlock extends ItemBlock {
ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos);
up = side;
forward = EnumFacing.SOUTH;
if (up.getYOffset() == 0) {
if (up.getFrontOffsetY() == 0) {
forward = EnumFacing.UP;
}
}
@@ -22,12 +22,6 @@ package appeng.block;
import com.google.common.base.Preconditions;
import net.minecraft.block.Block;
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 {
@@ -36,22 +30,17 @@ public abstract class AEBaseStairBlock extends BlockStairs {
super(block.getDefaultState());
Preconditions.checkNotNull(block);
Preconditions.checkNotNull(block.getTranslationKey());
Preconditions.checkArgument(block.getTranslationKey().length() > 0);
Preconditions.checkNotNull(block.getUnlocalizedName());
Preconditions.checkArgument(block.getUnlocalizedName().length() > 0);
this.setTranslationKey("stair." + type);
this.setUnlocalizedName("stair." + type);
this.setLightOpacity(0);
}
@Override
public String toString() {
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]";
}
@Override
public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
return false;
}
}
@@ -288,7 +288,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
return false;
}
final String name = this.getTranslationKey();
final String name = this.getUnlocalizedName();
if (player.isSneaking()) {
final NBTTagCompound data = tileEntity.downloadSettings(SettingsFrom.MEMORY_CARD);
@@ -300,7 +300,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
final String savedName = memoryCard.getSettingsName(heldItem);
final NBTTagCompound data = memoryCard.getData(heldItem);
if (this.getTranslationKey().equals(savedName)) {
if (this.getUnlocalizedName().equals(savedName)) {
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
} else {
@@ -43,7 +43,6 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
import java.util.EnumSet;
@@ -112,7 +111,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -38,8 +38,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockMolecularAssembler extends AEBaseTileBlock {
@@ -74,7 +72,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock {
*/
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -121,15 +121,15 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision {
final EnumFacing forward = tile.getForward();
final AEAxisAlignedBB bb = new AEAxisAlignedBB(twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels);
if (up.getXOffset() != 0) {
if (up.getFrontOffsetX() != 0) {
bb.minX = 0;
bb.maxX = 1;
}
if (up.getYOffset() != 0) {
if (up.getFrontOffsetY() != 0) {
bb.minY = 0;
bb.maxY = 1;
}
if (up.getZOffset() != 0) {
if (up.getFrontOffsetZ() != 0) {
bb.minZ = 0;
bb.maxZ = 1;
}
@@ -68,7 +68,7 @@ public class BlockInscriber extends AEBaseTileBlock {
}
@Override
public String getTranslationKey(final ItemStack is) {
return super.getTranslationKey(is);
public String getUnlocalizedName(final ItemStack is) {
return super.getUnlocalizedName(is);
}
}
@@ -41,7 +41,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Random;
@@ -116,9 +115,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
final EnumFacing up = this.getOrientable(w, pos).getUp();
final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getZOffset();
final double xOff = -0.3 * up.getFrontOffsetX();
final double yOff = -0.3 * up.getFrontOffsetY();
final double zOff = -0.3 * up.getFrontOffsetZ();
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
}
@@ -168,7 +167,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -44,7 +44,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Random;
@@ -108,9 +107,9 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity e, final boolean isVisual) {
final EnumFacing up = this.getOrientable(w, pos).getUp();
final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getZOffset();
final double xOff = -0.3 * up.getFrontOffsetX();
final double yOff = -0.3 * up.getFrontOffsetY();
final double zOff = -0.3 * up.getFrontOffsetZ();
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
}
@@ -135,9 +134,9 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
}
final EnumFacing up = this.getOrientable(w, pos).getUp();
final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getZOffset();
final double xOff = -0.3 * up.getFrontOffsetX();
final double yOff = -0.3 * up.getFrontOffsetY();
final double zOff = -0.3 * up.getFrontOffsetZ();
for (int bolts = 0; bolts < 3; bolts++) {
if (AppEng.proxy.shouldAddParticles(r)) {
final LightningFX fx = new LightningFX(w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D);
@@ -193,7 +192,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -87,9 +87,9 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
double ry = 0.5 + pos.getY();
double rz = 0.5 + pos.getZ();
rx += up.getXOffset() * d0;
ry += up.getYOffset() * d0;
rz += up.getZOffset() * d0;
rx += up.getFrontOffsetX() * d0;
ry += up.getFrontOffsetY() * d0;
rz += up.getFrontOffsetZ() * d0;
final int x = pos.getX();
final int y = pos.getY();
@@ -103,25 +103,25 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
case 0:
dx = 0.6;
dz = d1;
pt = new BlockPos(x + west.getXOffset(), y + west.getYOffset(), z + west.getZOffset());
pt = new BlockPos(x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ());
break;
case 1:
dx = d1;
dz += 0.6;
pt = new BlockPos(x + forward.getXOffset(), y + forward.getYOffset(), z + forward.getZOffset());
pt = new BlockPos(x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ());
break;
case 2:
dx = d1;
dz = -0.6;
pt = new BlockPos(x - forward.getXOffset(), y - forward.getYOffset(), z - forward.getZOffset());
pt = new BlockPos(x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ());
break;
case 3:
dx = -0.6;
dz = d1;
pt = new BlockPos(x - west.getXOffset(), y - west.getYOffset(), z - west.getZOffset());
pt = new BlockPos(x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ());
break;
}
@@ -130,13 +130,13 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
return;
}
rx += dx * west.getXOffset();
ry += dx * west.getYOffset();
rz += dx * west.getZOffset();
rx += dx * west.getFrontOffsetX();
ry += dx * west.getFrontOffsetY();
rz += dx * west.getFrontOffsetZ();
rx += dz * forward.getXOffset();
ry += dz * forward.getYOffset();
rz += dz * forward.getZOffset();
rx += dz * forward.getFrontOffsetX();
ry += dz * forward.getFrontOffsetY();
rz += dz * forward.getFrontOffsetZ();
final LightningFX fx = new LightningFX(w, rx, ry, rz, 0.0D, 0.0D, 0.0D);
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
@@ -37,7 +37,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -57,7 +56,7 @@ public class BlockSecurityStation extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -89,7 +89,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
if (world.getRedstonePowerFromNeighbors(pos) > 0) {
if (world.isBlockIndirectlyGettingPowered(pos) > 0) {
this.startFuse(world, pos, null);
world.setBlockToAir(pos);
}
@@ -99,7 +99,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
public void onBlockAdded(final World w, final BlockPos pos, final IBlockState state) {
super.onBlockAdded(w, pos, state);
if (w.getRedstonePowerFromNeighbors(pos) > 0) {
if (w.isBlockIndirectlyGettingPowered(pos) > 0) {
this.startFuse(w, pos, null);
w.setBlockToAir(pos);
}
@@ -102,20 +102,20 @@ public final class BlockVibrationChamber extends AEBaseTileBlock {
final EnumFacing forward = tc.getForward();
final EnumFacing up = tc.getUp();
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
f1 += forward.getXOffset() * 0.6;
f2 += forward.getYOffset() * 0.6;
f3 += forward.getZOffset() * 0.6;
f1 += forward.getFrontOffsetX() * 0.6;
f2 += forward.getFrontOffsetY() * 0.6;
f3 += forward.getFrontOffsetZ() * 0.6;
final float ox = r.nextFloat();
final float oy = r.nextFloat() * 0.2f;
f1 += up.getXOffset() * (-0.3 + oy);
f2 += up.getYOffset() * (-0.3 + oy);
f3 += up.getZOffset() * (-0.3 + oy);
f1 += up.getFrontOffsetX() * (-0.3 + oy);
f2 += up.getFrontOffsetY() * (-0.3 + oy);
f3 += up.getFrontOffsetZ() * (-0.3 + oy);
f1 += west_x * (0.3 * ox - 0.15);
f2 += west_y * (0.3 * ox - 0.15);
@@ -29,6 +29,7 @@ import appeng.block.AEBaseTileBlock;
import appeng.client.UnlistedProperty;
import appeng.client.render.cablebus.CableBusBakedModel;
import appeng.client.render.cablebus.CableBusRenderState;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
@@ -90,6 +91,10 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
private static Class<? extends AEBaseTile> noTesrTile;
private static Class<? extends AEBaseTile> tesrTile;
public BlockCableBus() {
super(AEGlassMaterial.INSTANCE);
this.setLightOpacity(0);
@@ -147,7 +152,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
}
@Override
public void onEntityCollision(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) {
public void onEntityCollidedWithBlock(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) {
this.cb(w, pos).onEntityCollision(entityIn);
}
@@ -373,9 +378,10 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
}
public void setupTile() {
this.setTileEntity(TileCableBus.class);
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance(TileCableBus.class);
this.setTileEntity(noTesrTile);
GameRegistry.registerTileEntity(TileCableBus.class, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
GameRegistry.registerTileEntity(noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
if (Platform.isClient()) {
setupTesr();
@@ -384,8 +390,9 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
@SideOnly(Side.CLIENT)
private static void setupTesr() {
GameRegistry.registerTileEntity(TileCableBusTESR.class, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
ClientRegistry.bindTileEntitySpecialRenderer(TileCableBusTESR.class, new CableBusTESR());
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance(TileCableBusTESR.class);
GameRegistry.registerTileEntity(tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
ClientRegistry.bindTileEntitySpecialRenderer(BlockCableBus.getTesrTile(), new CableBusTESR());
}
@Override
@@ -431,6 +438,14 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
super.onEntityWalk(world, pos, entityIn);
}
public static Class<? extends AEBaseTile> getNoTesrTile() {
return noTesrTile;
}
public static Class<? extends AEBaseTile> getTesrTile() {
return tesrTile;
}
// Helper to get access to the protected constructor
@SideOnly(Side.CLIENT)
private static class DestroyFX extends ParticleDigging {
@@ -33,8 +33,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockController extends AEBaseTileBlock {
@@ -146,7 +144,7 @@ public class BlockController extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -40,7 +40,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
@@ -69,7 +68,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision {
}
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -44,7 +44,6 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.Random;
@@ -82,7 +81,7 @@ public class BlockPaint extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -37,8 +37,6 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision {
@@ -88,7 +86,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
}
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -105,9 +105,9 @@ class QnbFormedBakedModel implements IBakedModel {
for (EnumFacing facing : EnumFacing.values()) {
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
// (avoids z-fighting)
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f);
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f);
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f);
builder.setDrawFaces(EnumSet.of(facing));
builder.addCube(
@@ -130,9 +130,9 @@ class QnbFormedBakedModel implements IBakedModel {
for (EnumFacing facing : EnumFacing.values()) {
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
// (avoids z-fighting)
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f);
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f);
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f);
builder.setDrawFaces(EnumSet.of(facing));
builder.addCube(
@@ -26,15 +26,12 @@ import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nullable;
@@ -42,11 +39,8 @@ import javax.annotation.Nullable;
public class BlockSpatialIOPort extends AEBaseTileBlock {
public static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockSpatialIOPort() {
super(Material.IRON);
setDefaultState(getDefaultState().withProperty(POWERED, false));
}
@Override
@@ -57,19 +51,6 @@ public class BlockSpatialIOPort extends AEBaseTileBlock {
}
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileSpatialIOPort te = this.getTileEntity(worldIn, pos);
boolean powered = te != null && te.isActive();
return super.getActualState(state, worldIn, pos)
.withProperty(POWERED, powered);
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (p.isSneaking()) {
@@ -34,8 +34,6 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
public class BlockSpatialPylon extends AEBaseTileBlock {
@@ -85,7 +83,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -38,7 +38,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -57,7 +56,7 @@ public class BlockChest extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -40,7 +40,6 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -53,7 +52,7 @@ public class BlockDrive extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getRenderLayer() {
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -19,7 +19,6 @@
package appeng.block.storage;
import appeng.api.config.Upgrades;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
@@ -27,15 +26,12 @@ import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nullable;
@@ -43,34 +39,15 @@ import javax.annotation.Nullable;
public class BlockIOPort extends AEBaseTileBlock {
public static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockIOPort() {
super(Material.IRON);
setDefaultState(getDefaultState().withProperty(POWERED, false));
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileIOPort te = this.getTileEntity(worldIn, pos);
boolean powred = te != null && te.isActive();
return super.getActualState(state, worldIn, pos)
.withProperty(POWERED, powred);
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
final TileIOPort te = this.getTileEntity(world, pos);
if (te != null) {
if (te.getInstalledUpgrades(Upgrades.REDSTONE) != 0) {
te.updateRedstoneState();
}
te.updateRedstoneState();
}
}
@@ -26,8 +26,6 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -50,8 +48,6 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
private static final double AABB_OFFSET_SIDES = 0.06;
private static final double AABB_OFFSET_TOP = 0.125;
public static final PropertyBool NATURAL = PropertyBool.create("natural");
public enum SkyChestType {
STONE, BLOCK
}
@@ -65,22 +61,6 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
this.setHardness(50);
this.blockResistance = 150.0f;
this.type = type;
setDefaultState(getDefaultState().withProperty(NATURAL, true));
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{NATURAL};
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(NATURAL) ? 1 : 0;
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(NATURAL, meta == 1);
}
@Override
@@ -119,18 +99,18 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
o = sk.getUp();
}
final double offsetX = o.getXOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetY = o.getYOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetZ = o.getZOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_SIDES : 0.0;
// for x/z top and bottom is swapped
final double minX = Math.max(0.0, offsetX + (o.getXOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getXOffset() * AABB_OFFSET_TOP)));
final double minY = Math.max(0.0, offsetY + (o.getYOffset() < 0 ? AABB_OFFSET_TOP : (o.getYOffset() * AABB_OFFSET_BOTTOM)));
final double minZ = Math.max(0.0, offsetZ + (o.getZOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getZOffset() * AABB_OFFSET_TOP)));
final double minX = Math.max(0.0, offsetX + (o.getFrontOffsetX() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetX() * AABB_OFFSET_TOP)));
final double minY = Math.max(0.0, offsetY + (o.getFrontOffsetY() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetY() * AABB_OFFSET_BOTTOM)));
final double minZ = Math.max(0.0, offsetZ + (o.getFrontOffsetZ() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetZ() * AABB_OFFSET_TOP)));
final double maxX = Math.min(1.0, 1.0 - offsetX - (o.getXOffset() < 0 ? AABB_OFFSET_TOP : (o.getXOffset() * AABB_OFFSET_BOTTOM)));
final double maxY = Math.min(1.0, 1.0 - offsetY - (o.getYOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getYOffset() * AABB_OFFSET_TOP)));
final double maxZ = Math.min(1.0, 1.0 - offsetZ - (o.getZOffset() < 0 ? AABB_OFFSET_TOP : (o.getZOffset() * AABB_OFFSET_BOTTOM)));
final double maxX = Math.min(1.0, 1.0 - offsetX - (o.getFrontOffsetX() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetX() * AABB_OFFSET_BOTTOM)));
final double maxY = Math.min(1.0, 1.0 - offsetY - (o.getFrontOffsetY() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetY() * AABB_OFFSET_TOP)));
final double maxZ = Math.min(1.0, 1.0 - offsetZ - (o.getFrontOffsetZ() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetZ() * AABB_OFFSET_BOTTOM)));
return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
}
@@ -40,10 +40,7 @@ public enum DriveSlotState implements IStringSerializable {
TYPES_FULL("types_full"),
// Completely full
FULL("full"),
// Online and completely empty
NO_CONTENTS("no_contents");
FULL("full");
private final String name;
@@ -67,8 +64,6 @@ public enum DriveSlotState implements IStringSerializable {
return DriveSlotState.TYPES_FULL;
case 3:
return DriveSlotState.FULL;
case 4:
return DriveSlotState.NO_CONTENTS;
}
}
@@ -164,7 +164,7 @@ class BlockDefinitionBuilder implements IBlockBuilder {
// Create block and matching item, and set factory name of both
Block block = this.blockSupplier.get();
block.setRegistryName(AppEng.MOD_ID, this.registryName);
block.setTranslationKey("appliedenergistics2." + this.registryName);
block.setUnlocalizedName("appliedenergistics2." + this.registryName);
ItemBlock item = this.constructItemFromBlock(block);
if (item != null) {
@@ -25,31 +25,21 @@ import appeng.bootstrap.components.StateMapperComponent;
import appeng.bootstrap.components.TesrComponent;
import appeng.client.render.model.AutoRotatingModel;
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.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.client.renderer.color.IBlockColor;
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.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.SideOnly;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Predicate;
class BlockRendering implements IBlockRendering, ISelectiveResourceReloadListener {
class BlockRendering implements IBlockRendering {
@SideOnly(Side.CLIENT)
private BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> modelCustomizer;
@@ -66,13 +56,6 @@ class BlockRendering implements IBlockRendering, ISelectiveResourceReloadListene
@SideOnly(Side.CLIENT)
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
@SideOnly(Side.CLIENT)
public IBlockRendering modelCustomizer(BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer) {
@@ -116,15 +99,11 @@ class BlockRendering implements IBlockRendering, ISelectiveResourceReloadListene
}
if (this.modelCustomizer != null) {
factory.addModelOverride(block.getRegistryName().getPath(), this.modelCustomizer);
factory.addModelOverride(block.getRegistryName().getResourcePath(), this.modelCustomizer);
} else if (block instanceof AEBaseTileBlock) {
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
// extended props
factory.addModelOverride(block.getRegistryName().getPath(), (l, m) -> {
AutoRotatingModel model = new AutoRotatingModel(m);
BlockRendering.this.reloads.add(model);
return model;
});
factory.addModelOverride(block.getRegistryName().getResourcePath(), (l, m) -> new AutoRotatingModel(m));
}
// TODO : 1.12
@@ -138,13 +117,4 @@ class BlockRendering implements IBlockRendering, ISelectiveResourceReloadListene
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));
}
}
}
@@ -126,7 +126,7 @@ class ItemDefinitionBuilder implements IItemBuilder {
ItemDefinition definition = new ItemDefinition(this.registryName, item);
item.setTranslationKey("appliedenergistics2." + this.registryName);
item.setUnlocalizedName("appliedenergistics2." + this.registryName);
item.setCreativeTab(this.creativeTab);
// Register all extra handlers
@@ -61,7 +61,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
IModel missingModel = ModelLoaderRegistry.getMissingModel();
for (ModelResourceLocation location : keys) {
if (!location.getNamespace().equals(AppEng.MOD_ID)) {
if (!location.getResourceDomain().equals(AppEng.MOD_ID)) {
continue;
}
@@ -72,7 +72,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
continue;
}
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getPath());
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getResourcePath());
if (customizer != null) {
IBakedModel newModel = customizer.apply(location, orgModel);
+49 -12
View File
@@ -49,7 +49,6 @@ import mezz.jei.api.gui.IGhostIngredientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
@@ -69,11 +68,13 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.items.SlotItemHandler;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import yalter.mousetweaks.api.MouseTweaksIgnore;
import yalter.mousetweaks.api.IMTModGuiContainer2;
import javax.annotation.Nonnull;
import java.awt.*;
import java.io.IOException;
import java.text.DecimalFormat;
@@ -86,8 +87,8 @@ import static appeng.integration.modules.jei.JEIPlugin.aeGuiHandler;
import static appeng.integration.modules.jei.JEIPlugin.runtime;
@MouseTweaksIgnore
public abstract class AEBaseGui extends GuiContainer {
@Optional.Interface(iface = "yalter.mousetweaks.api.IMTModGuiContainer2", modid = "mousetweaks")
public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContainer2 {
private final List<InternalSlotME> meSlots = new ArrayList<>();
// drag y
private final Set<Slot> drag_click = new HashSet<>();
@@ -567,10 +568,7 @@ public abstract class AEBaseGui extends GuiContainer {
action = (mouseButton == 1) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
stack = ((SlotME) slot).getAEStack();
if (stack != null
&& action == InventoryAction.PICKUP_OR_SET_DOWN
&& (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown())
&& player.inventory.getItemStack().isEmpty()) {
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack().isEmpty()) {
action = InventoryAction.AUTO_CRAFT;
}
@@ -933,10 +931,6 @@ public abstract class AEBaseGui extends GuiContainer {
}
} else if (s instanceof AppEngSlot) {
AppEngSlot appEngSlot = ((AppEngSlot) s);
if (s.getStack().isEmpty()) {
super.drawSlot(s);
return;
}
appEngSlot.setDisplay(true);
appEngSlot.setReturnAsSingleStack(true);
@@ -988,4 +982,47 @@ public abstract class AEBaseGui extends GuiContainer {
protected List<InternalSlotME> getMeSlots() {
return this.meSlots;
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isMouseTweaksDisabled() {
return false;
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isWheelTweakDisabled() {
return true;
}
@Override
@Optional.Method(modid = "mousetweaks")
public Container MT_getContainer() {
return this.inventorySlots;
}
@Override
@Optional.Method(modid = "mousetweaks")
public Slot MT_getSlotUnderMouse() {
return getSlotUnderMouse();
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isCraftingOutput(Slot slot) {
return slot instanceof SlotOutput || slot instanceof AppEngCraftingSlot;
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isIgnored(Slot slot) {
return false;
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_disableRMBDraggingFunctionality() {
return false;
}
}
@@ -76,11 +76,6 @@ public abstract class AEBaseMEGui extends AEBaseGui {
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);
return;
@@ -1,208 +0,0 @@
package appeng.client.gui;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collections;
import java.util.Stack;
public class MathExpressionParser {
private final Stack<String> postfixStack = new Stack<>();
private final Stack<Character> opStack = new Stack<>();
private static final int[] OPERATOR_PRIORITY = new int[] { 0, 3, 2, 1, -1, 1, 0, 2 };
public static double parse(String expression) {
double result;
if (expression == null) return Double.NaN;
expression = expression.replace(" ", "");
if (expression.length() == 1 && Character.isDigit(expression.charAt(0))) {
return expression.charAt(0) - '0';
}
try {
expression = transform(expression);
result = new MathExpressionParser().calculate(expression);
} catch (Exception e) {
return Double.NaN;
}
return result;
}
/**
* replace '-' with '~'
* e.g.-2+-1*(-3E-2)-(-1) -> ~2+~1*(~3E~2)-(~1)
*/
private static String transform(String expression) {
char[] arr = expression.toCharArray();
for (int i = 0; i < arr.length; i++) {
if (arr[i] == '-') {
if (i == 0) {
arr[i] = '~';
} else {
char c = arr[i - 1];
if (c == '+' || c == '-' || c == '*' || c == '/' || c == '(' || c == 'E' || c == 'e') {
arr[i] = '~';
}
}
}
}
if (arr[0] == '~' || arr[1] == '(') {
arr[0] = '-';
return "0" + new String(arr);
} else {
return new String(arr);
}
}
public double calculate(String expression) {
Stack<String> resultStack = new Stack<>();
prepare(expression);
Collections.reverse(postfixStack);
String firstValue, secondValue, currentValue;
while (!postfixStack.isEmpty()) {
currentValue = postfixStack.pop();
if (!isOperator(currentValue.charAt(0))) {
currentValue = currentValue.replace("~", "-");
resultStack.push(currentValue);
} else {
secondValue = resultStack.pop();
firstValue = resultStack.pop();
firstValue = firstValue.replace("~", "-");
secondValue = secondValue.replace("~", "-");
String tempResult = calculate(firstValue, secondValue, currentValue.charAt(0));
resultStack.push(String.valueOf(tempResult));
}
}
return Double.parseDouble(resultStack.pop());
}
private void prepare(String expression) {
opStack.push(',');
char[] arr = expression.toCharArray();
int currentIndex = 0;
int count = 0;
char currentOp, peekOp;
for (int i = 0; i < arr.length; i++) {
currentOp = arr[i];
if (isOperator(currentOp)) {
if (count > 0) {
postfixStack.push(new String(arr, currentIndex, count));
}
peekOp = opStack.peek();
if (currentOp == ')') {
while (opStack.peek() != '(') {
postfixStack.push(String.valueOf(opStack.pop()));
}
opStack.pop();
} else {
while (currentOp != '(' && peekOp != ',' && compare(currentOp, peekOp)) {
postfixStack.push(String.valueOf(opStack.pop()));
peekOp = opStack.peek();
}
opStack.push(currentOp);
}
count = 0;
currentIndex = i + 1;
} else {
count++;
}
}
if (count > 1 || (count == 1 && !isOperator(arr[currentIndex]))) {
postfixStack.push(new String(arr, currentIndex, count));
}
while (opStack.peek() != ',') {
postfixStack.push(String.valueOf(opStack.pop()));
}
}
private static boolean isOperator(char c) {
return c == '+' || c == '-' || c == '*' || c == '/' || c == '(' || c == ')';
}
private static boolean compare(char cur, char peek) {
return OPERATOR_PRIORITY[(peek) - 40] >= OPERATOR_PRIORITY[(cur) - 40];
}
private String calculate(String firstValue, String secondValue, char currentOp) {
return switch (currentOp) {
case '+' -> add(firstValue, secondValue);
case '-' -> sub(firstValue, secondValue);
case '*' -> mul(firstValue, secondValue);
case '/' -> div(firstValue, secondValue);
default -> "";
};
}
public static String add(String v1, String v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return String.valueOf(b1.add(b2));
}
/**
* subtraction
*
* @param v1 p1
* @param v2 p2
* @return sub
*/
public static String sub(String v1, String v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return String.valueOf(b1.subtract(b2));
}
/**
* multiplication
*
* @param v1 p1
* @param v2 p2
* @return mul
*/
public static String mul(String v1, String v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return String.valueOf(b1.multiply(b2));
}
/**
* division. e = 10^-10
*
* @param v1 p1
* @param v2 p2
* @return div
*/
public static String div(String v1, String v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return String.valueOf(b1.divide(b2, 16, RoundingMode.HALF_UP));
}
/**
* rounding
*
* @param v p
* @param scale scale
* @return result
*/
public static double round(double v, int scale) {
if (scale < 0) {
throw new IllegalArgumentException("The scale must be a positive integer or zero");
}
BigDecimal b = new BigDecimal(Double.toString(v));
return b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP).doubleValue();
}
public static String round(String v, int scale) {
if (scale < 0) {
throw new IllegalArgumentException("The scale must be a positive integer or zero");
}
BigDecimal b = new BigDecimal(v);
return String.valueOf(b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP));
}
}
@@ -22,9 +22,10 @@ package appeng.client.gui.implementations;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.MathExpressionParser;
import appeng.client.gui.widgets.GuiNumberBox;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.container.implementations.ContainerCraftAmount;
@@ -41,7 +42,6 @@ import appeng.parts.reporting.PartExpandedProcessingPatternTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard;
@@ -50,7 +50,7 @@ import java.io.IOException;
public class GuiCraftAmount extends AEBaseGui {
private GuiTextField amountToCraft;
private GuiNumberBox amountToCraft;
private GuiTabButton originalGuiBtn;
private GuiButton next;
@@ -126,7 +126,7 @@ public class GuiCraftAmount extends AEBaseGui {
this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender));
}
this.amountToCraft = new GuiTextField(0, this.fontRenderer, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRenderer.FONT_HEIGHT);
this.amountToCraft = new GuiNumberBox(this.fontRenderer, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRenderer.FONT_HEIGHT, Integer.class);
this.amountToCraft.setEnableBackgroundDrawing(false);
this.amountToCraft.setMaxStringLength(16);
this.amountToCraft.setTextColor(0xFFFFFF);
@@ -149,17 +149,8 @@ public class GuiCraftAmount extends AEBaseGui {
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
try {
String out = this.amountToCraft.getText();
double resultD = MathExpressionParser.parse(out);
long amt;
if (resultD <= 0 || Double.isNaN(resultD)) {
amt = 0;
} else {
amt = (long) MathExpressionParser.round(resultD, 0);
}
this.next.enabled = amt > 0;
long amt = Long.parseLong(this.amountToCraft.getText());
this.next.enabled = (!this.amountToCraft.getText().isEmpty() && amt > 0);
} catch (final NumberFormatException e) {
this.next.enabled = false;
}
@@ -173,7 +164,33 @@ public class GuiCraftAmount extends AEBaseGui {
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
this.actionPerformed(this.next);
}
if (!this.amountToCraft.textboxKeyTyped(character, key)) {
if ((key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit(character)) && this.amountToCraft
.textboxKeyTyped(character, key)) {
try {
String out = this.amountToCraft.getText();
boolean fixed = false;
while (out.startsWith("0") && out.length() > 1) {
out = out.substring(1);
fixed = true;
}
if (fixed) {
this.amountToCraft.setText(out);
}
if (out.isEmpty()) {
out = "0";
}
final long result = Long.parseLong(out);
if (result < 0) {
this.amountToCraft.setText("1");
}
} catch (final NumberFormatException e) {
// :P
}
} else {
super.keyTyped(character, key);
}
}
@@ -190,15 +207,7 @@ public class GuiCraftAmount extends AEBaseGui {
}
if (btn == this.next) {
double resultD = MathExpressionParser.parse(this.amountToCraft.getText());
int result;
if (resultD <= 0 || Double.isNaN(resultD)) {
result = 1;
} else {
result = (int) MathExpressionParser.round(resultD, 0);
}
NetworkHandler.instance().sendToServer(new PacketCraftRequest(result, isShiftKeyDown()));
NetworkHandler.instance().sendToServer(new PacketCraftRequest(Integer.parseInt(this.amountToCraft.getText()), isShiftKeyDown()));
}
} catch (final NumberFormatException e) {
// nope..
@@ -217,15 +226,22 @@ public class GuiCraftAmount extends AEBaseGui {
try {
String out = this.amountToCraft.getText();
double resultD = MathExpressionParser.parse(out);
int result;
if (resultD <= 0 || Double.isNaN(resultD)) {
result = 0;
} else {
result = (int) MathExpressionParser.round(resultD, 0);
boolean fixed = false;
while (out.startsWith("0") && out.length() > 1) {
out = out.substring(1);
fixed = true;
}
if (fixed) {
this.amountToCraft.setText(out);
}
if (out.isEmpty()) {
out = "0";
}
long result = Integer.parseInt(out);
if (result == 1 && i > 1) {
result = 0;
}
@@ -235,7 +251,8 @@ public class GuiCraftAmount extends AEBaseGui {
result = 1;
}
out = Integer.toString(result);
out = Long.toString(result);
Integer.parseInt(out);
this.amountToCraft.setText(out);
} catch (final NumberFormatException e) {
// :P
@@ -1,7 +1,7 @@
package appeng.client.gui.implementations;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.Packaging;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
@@ -36,6 +36,9 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
private static final String SUBSITUTION_DISABLE = "0";
private static final String SUBSITUTION_ENABLE = "1";
private static final String PACKAGING_DISABLE = "0";
private static final String PACKAGING_ENABLE = "1";
private static final String CRAFTMODE_CRFTING = "1";
private static final String CRAFTMODE_PROCESSING = "0";
@@ -52,10 +55,14 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
private GuiImgButton divThreeBtn;
private GuiImgButton minusOneBtn;
private GuiImgButton maxCountBtn;
private GuiImgButton packagingEnabledBtn;
private GuiImgButton packagingDisabledBtn;
public Map<IGhostIngredientHandler.Target<?>, Object> mapTargetSlot = new HashMap<>();
private ContainerExpandedProcessingPatternTerm container;
public GuiExpandedProcessingPatternTerm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(inventoryPlayer, te, new ContainerExpandedProcessingPatternTerm(inventoryPlayer, te));
this.container = (ContainerExpandedProcessingPatternTerm) this.inventorySlots;
this.setReservedSpace(81);
}
@@ -112,6 +119,13 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
if (this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn) {
NetworkHandler.instance().sendToServer(new PacketValueConfig("PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE));
}
if (this.packagingEnabledBtn == btn || this.packagingDisabledBtn == btn) {
NetworkHandler.instance()
.sendToServer(
new PacketValueConfig("PatternTerminal.Package", this.packagingEnabledBtn == btn ? PACKAGING_DISABLE : PACKAGING_ENABLE));
}
} catch (final IOException e) {
AELog.error(e);
}
@@ -121,29 +135,26 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
public void initGui() {
super.initGui();
this.tabCraftButton = new GuiTabButton(this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack(Blocks.CRAFTING_TABLE), GuiText.CraftingPattern.getLocal(), this.itemRender);
this.buttonList.add(this.tabCraftButton);
this.tabProcessButton = new GuiTabButton(this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack(Blocks.FURNACE), GuiText.ProcessingPattern.getLocal(), this.itemRender);
this.buttonList.add(this.tabProcessButton);
this.substitutionsEnabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED);
this.substitutionsEnabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsEnabledBtn);
this.packagingEnabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, Packaging.ENABLED);
this.packagingEnabledBtn.setHalfSize(true);
this.buttonList.add(this.packagingEnabledBtn);
this.substitutionsDisabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED);
this.substitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsDisabledBtn);
this.packagingDisabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, Packaging.DISABLED);
this.packagingDisabledBtn.setHalfSize(true);
this.buttonList.add(this.packagingDisabledBtn);
this.clearBtn = new GuiImgButton(this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE);
this.clearBtn.setHalfSize(true);
this.buttonList.add(this.clearBtn);
this.x3Btn = new GuiImgButton(this.guiLeft + 131, this.guiTop + this.ySize - 158, Settings.ACTIONS, ActionItems.MULTIPLY_BY_THREE);
this.x3Btn = new GuiImgButton(this.guiLeft + 131, this.guiTop + this.ySize - 154, Settings.ACTIONS, ActionItems.MULTIPLY_BY_THREE);
this.x3Btn.setHalfSize(true);
this.buttonList.add(this.x3Btn);
this.x2Btn = new GuiImgButton(this.guiLeft + 131, this.guiTop + this.ySize - 148, Settings.ACTIONS, ActionItems.MULTIPLY_BY_TWO);
this.x2Btn = new GuiImgButton(this.guiLeft + 131, this.guiTop + this.ySize - 144, Settings.ACTIONS, ActionItems.MULTIPLY_BY_TWO);
this.x2Btn.setHalfSize(true);
this.buttonList.add(this.x2Btn);
@@ -151,11 +162,11 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
this.plusOneBtn.setHalfSize(true);
this.buttonList.add(this.plusOneBtn);
this.divThreeBtn = new GuiImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 158, Settings.ACTIONS, ActionItems.DIVIDE_BY_THREE);
this.divThreeBtn = new GuiImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 154, Settings.ACTIONS, ActionItems.DIVIDE_BY_THREE);
this.divThreeBtn.setHalfSize(true);
this.buttonList.add(this.divThreeBtn);
this.divTwoBtn = new GuiImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 148, Settings.ACTIONS, ActionItems.DIVIDE_BY_TWO);
this.divTwoBtn = new GuiImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 144, Settings.ACTIONS, ActionItems.DIVIDE_BY_TWO);
this.divTwoBtn.setHalfSize(true);
this.buttonList.add(this.divTwoBtn);
@@ -173,16 +184,21 @@ public class GuiExpandedProcessingPatternTerm extends GuiMEMonitorable implement
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.tabCraftButton.visible = false;
this.tabProcessButton.visible = true;
this.substitutionsEnabledBtn.visible = false;
this.substitutionsDisabledBtn.visible = false;
this.x2Btn.visible = true;
this.x3Btn.visible = true;
this.divTwoBtn.visible = true;
this.divThreeBtn.visible = true;
this.plusOneBtn.visible = true;
this.minusOneBtn.visible = true;
if (this.container.packaging) {
this.packagingEnabledBtn.visible = true;
this.packagingDisabledBtn.visible = false;
} else {
this.packagingEnabledBtn.visible = false;
this.packagingDisabledBtn.visible = true;
}
//this.maxCountBtn.visible = true;
super.drawFG(offsetX, offsetY, mouseX, mouseY);
@@ -394,7 +394,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
return false;
}
boolean foundMatchingFluidStack = false;
boolean foundMatchingItemStack = false;
final String displayName = Platform.getFluidDisplayName(iaeFluidStack).toLowerCase();
@@ -405,12 +405,10 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
return false;
}
} else if (displayName.contains(term)) {
foundMatchingFluidStack = true;
} else {
return false;
foundMatchingItemStack = true;
}
}
return foundMatchingFluidStack;
return foundMatchingItemStack;
}
/**
@@ -409,8 +409,6 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
}
} else if (displayName.contains(term)) {
foundMatchingItemStack = true;
} else {
return false;
}
}
return foundMatchingItemStack;
@@ -50,7 +50,6 @@ import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.common.Loader;
import org.lwjgl.input.Mouse;
@@ -568,15 +567,15 @@ public class GuiInterfaceTerminal extends AEBaseGui {
return searchTerm.matches(GuiText.InvalidPattern.getLocal());
}
final NBTTagList tag;
NBTTagList tag = new NBTTagList();
if (pass == 0) {
tag = encodedValue.getTagList("in", Constants.NBT.TAG_COMPOUND);
tag = encodedValue.getTagList("in", 10);
} else {
tag = encodedValue.getTagList("out", Constants.NBT.TAG_COMPOUND);
tag = encodedValue.getTagList("out", 10);
}
boolean foundMatchingItemStack = false;
final String[] splitTerm = searchTerm.split(" ");
for (int i = 0; i < tag.tagCount(); i++) {
final ItemStack parsedItemStack = new ItemStack(tag.getCompoundTagAt(i));
@@ -585,7 +584,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
.getItemDisplayName(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack))
.toLowerCase();
for (String term : splitTerm) {
for (String term : searchTerm.split(" ")) {
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
term = term.substring(1);
if (displayName.contains(term)) {
@@ -319,6 +319,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.searchField.setText(memoryText);
this.searchField.selectAll();
this.repo.setSearchString(memoryText);
this.repo.updateView();
this.setScrollBar();
}
@@ -380,6 +381,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
this.searchField.setText("");
this.repo.setSearchString("");
this.repo.updateView();
this.setScrollBar();
}
@@ -474,6 +476,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
if (this.searchField.textboxKeyTyped(character, key)) {
this.repo.setSearchString(this.searchField.getText());
this.repo.updateView();
this.setScrollBar();
// tell forge the key event is handled and should not be sent out
this.keyHandled = mouseInGui;
@@ -34,7 +34,7 @@ public class GuiOreDictStorageBus extends AEBaseGui {
private GuiImgButton partition;
private GuiImgButton storageFilter;
private GuiImgButton rwMode;
private static final Pattern ORE_DICTIONARY_FILTER = Pattern.compile("[0-9a-zA-Z* &|^!()]*");
private static final Pattern ORE_DICTIONARY_FILTER = Pattern.compile("[(!]* *[0-9a-zA-Z*]* *\\)*( *[&|^]? *[(!]* *[0-9a-zA-Z*]* *\\)*)*");
private MEGuiTextField searchFieldInputs;
public GuiOreDictStorageBus(final InventoryPlayer inventoryPlayer, final PartOreDicStorageBus te) {
@@ -21,6 +21,7 @@ package appeng.client.gui.implementations;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.Packaging;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
@@ -60,6 +61,9 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
private static final String SUBSITUTION_DISABLE = "0";
private static final String SUBSITUTION_ENABLE = "1";
private static final String PACKAGING_DISABLE = "0";
private static final String PACKAGING_ENABLE = "1";
private static final String CRAFTMODE_CRFTING = "1";
private static final String CRAFTMODE_PROCESSING = "0";
@@ -78,6 +82,8 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
private GuiImgButton divThreeBtn;
private GuiImgButton minusOneBtn;
private GuiImgButton maxCountBtn;
private GuiImgButton packagingEnabledBtn;
private GuiImgButton packagingDisabledBtn;
public Map<Target<?>, Object> mapTargetSlot = new HashMap<>();
public GuiPatternTerm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
@@ -149,6 +155,12 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
.sendToServer(
new PacketValueConfig("PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE));
}
if (this.packagingEnabledBtn == btn || this.packagingDisabledBtn == btn) {
NetworkHandler.instance()
.sendToServer(
new PacketValueConfig("PatternTerminal.Package", this.packagingEnabledBtn == btn ? PACKAGING_DISABLE : PACKAGING_ENABLE));
}
} catch (final IOException e) {
AELog.error(e);
}
@@ -174,6 +186,14 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
this.substitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsDisabledBtn);
this.packagingEnabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, Packaging.ENABLED);
this.packagingEnabledBtn.setHalfSize(true);
this.buttonList.add(this.packagingEnabledBtn);
this.packagingDisabledBtn = new GuiImgButton(this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, Packaging.DISABLED);
this.packagingDisabledBtn.setHalfSize(true);
this.buttonList.add(this.packagingDisabledBtn);
this.clearBtn = new GuiImgButton(this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE);
this.clearBtn.setHalfSize(true);
this.buttonList.add(this.clearBtn);
@@ -221,6 +241,8 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
this.divThreeBtn.visible = false;
this.plusOneBtn.visible = false;
this.minusOneBtn.visible = false;
this.packagingEnabledBtn.visible = false;
this.packagingDisabledBtn.visible = false;
//this.maxCountBtn.visible = false;
if (this.container.substitute) {
@@ -231,6 +253,13 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
this.substitutionsDisabledBtn.visible = true;
}
} else {
if (this.container.packaging) {
this.packagingEnabledBtn.visible = true;
this.packagingDisabledBtn.visible = false;
} else {
this.packagingEnabledBtn.visible = false;
this.packagingDisabledBtn.visible = true;
}
this.tabCraftButton.visible = false;
this.tabProcessButton.visible = true;
this.substitutionsEnabledBtn.visible = false;
@@ -1,52 +0,0 @@
package appeng.client.gui.toasts;
import appeng.core.localization.GuiText;
import net.minecraft.client.gui.toasts.GuiToast;
import net.minecraft.client.gui.toasts.IToast;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;
@SideOnly(Side.CLIENT)
public class CraftingStatusToast implements IToast {
private final ItemStack itemStack;
private final boolean cancelled;
private long firstDrawTime;
private boolean newDisplay;
public CraftingStatusToast(@NotNull ItemStack itemStack, boolean cancelled) {
this.itemStack = itemStack;
this.cancelled = cancelled;
}
@NotNull
public Visibility draw(@NotNull GuiToast toastGui, long delta)
{
if (this.newDisplay)
{
this.firstDrawTime = delta;
this.newDisplay = false;
}
var minecraft = toastGui.getMinecraft();
var fontRenderer = minecraft.fontRenderer;
// Texture
minecraft.getTextureManager().bindTexture(TEXTURE_TOASTS);
GlStateManager.color(1.0F, 1.0F, 1.0F);
toastGui.drawTexturedModalRect(0, 0, 0, 32, 160, 32);
// Text
var statusText = cancelled ? GuiText.CraftingToastCancelled : GuiText.CraftingToastDone;
fontRenderer.drawString(statusText.getLocal(), 30, 7, -11534256);
fontRenderer.drawString(itemStack.getDisplayName(), 30, 18, -16777216);
// Item
RenderHelper.enableGUIStandardItemLighting();
minecraft.getRenderItem().renderItemAndEffectIntoGUI(null, itemStack, 8, 8);
return delta - this.firstDrawTime < 5000L ? Visibility.SHOW : Visibility.HIDE;
}
}
@@ -125,6 +125,9 @@ public class GuiImgButton extends GuiButton implements ITooltip {
this.registerApp(4 + 3 * 16, Settings.ACTIONS, ItemSubstitution.ENABLED, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDescEnabled);
this.registerApp(7 + 3 * 16, Settings.ACTIONS, ItemSubstitution.DISABLED, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDescDisabled);
this.registerApp(8 + 3 * 16, Settings.ACTIONS, Packaging.ENABLED, ButtonToolTips.Packaging, ButtonToolTips.PackagingDescEnabled);
this.registerApp(9 + 3 * 16, Settings.ACTIONS, Packaging.DISABLED, ButtonToolTips.Packaging, ButtonToolTips.PackagingDescDisabled);
this.registerApp(16, Settings.VIEW_MODE, ViewItems.STORED, ButtonToolTips.View, ButtonToolTips.StoredItems);
this.registerApp(18, Settings.VIEW_MODE, ViewItems.ALL, ButtonToolTips.View, ButtonToolTips.StoredCraftable);
this.registerApp(19, Settings.VIEW_MODE, ViewItems.CRAFTABLE, ButtonToolTips.View, ButtonToolTips.Craftable);
@@ -37,9 +37,6 @@ public class GuiNumberBox extends GuiTextField {
final String original = this.getText();
super.writeText(selectedText);
if (this.getText().isEmpty()) {
return;
}
try {
if (this.type == int.class || this.type == Integer.class) {
Integer.parseInt(this.getText());
+62 -116
View File
@@ -37,7 +37,7 @@ import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
@@ -45,7 +45,7 @@ import java.util.regex.Pattern;
public class ItemRepo {
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
private List<IAEItemStack> view = new ArrayList<>();
private final ArrayList<IAEItemStack> view = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
@@ -56,16 +56,6 @@ public class ItemRepo {
private String innerSearch = "";
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) {
this.src = src;
this.sortSrc = sortSrc;
@@ -93,8 +83,6 @@ public class ItemRepo {
} else {
this.list.add(is);
}
changed = true;
}
public long getItemCount(final IAEItemStack is) {
@@ -104,88 +92,22 @@ public class ItemRepo {
public void setViewCell(final ItemStack[] list) {
this.myPartitionList = ItemViewCell.createFilter(list);
this.changed = true;
this.updateView();
}
public void updateView() {
this.view.clear();
this.view.ensureCapacity(this.list.size());
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;
}
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
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;
@@ -207,52 +129,76 @@ public class ItemRepo {
}
}
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
return;
boolean notDone = false;
for (IAEItemStack is : this.list) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
}
}
}
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
return;
}
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
continue;
}
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
return;
}
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}
final String dspName = (searchMod ? Platform.getModId(is) : Platform.getItemDisplayName(is)).toLowerCase();
boolean foundMatchingItemStack = true;
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)) {
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;
}
} 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 (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);
}
this.view.add(is);
}
}
if (foundMatchingItemStack) {
if (needsZeroCopy) {
is = is.copy();
is.setStackSize(0);
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) {
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
Collections.sort(this.view, 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);
}
this.view.add(is);
} else {
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_NAME);
}
}
@@ -26,7 +26,6 @@ import appeng.util.ISlimReadableNumberConverter;
import appeng.util.IWideReadableNumberConverter;
import appeng.util.ReadableNumberConverter;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
@@ -49,7 +48,7 @@ public class StackSizeRenderer {
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
fontRenderer.setUnicodeFlag(false);
if ((aeStack.getStackSize() == 0 || GuiScreen.isAltKeyDown()) && aeStack.isCraftable()) {
if (aeStack.getStackSize() == 0 && aeStack.isCraftable()) {
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
.getLocal();
GlStateManager.disableLighting();
@@ -65,7 +64,8 @@ public class StackSizeRenderer {
GlStateManager.enableDepth();
GlStateManager.enableBlend();
}
else if (aeStack.getStackSize() > 0) {
if (aeStack.getStackSize() > 0) {
final String stackSize = this.getToBeRenderedStackSize(aeStack.getStackSize());
GlStateManager.disableLighting();
@@ -47,7 +47,7 @@ public class TesrRenderHelper {
* at the center of a block.
*/
public static void moveToFace(EnumFacing face) {
GlStateManager.translate(face.getXOffset() * 0.50, face.getYOffset() * 0.50, face.getZOffset() * 0.50);
GlStateManager.translate(face.getFrontOffsetX() * 0.50, face.getFrontOffsetY() * 0.50, face.getFrontOffsetZ() * 0.50);
}
/**
@@ -22,7 +22,6 @@ package appeng.client.render.cablebus;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.core.AppEng;
import appeng.core.AEConfig;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
@@ -328,12 +327,8 @@ class CableBuilder {
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.SMART).get(cableColor);
cubeBuilder.setTexture(texture);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
// Thin part of connector, here to prevent the color of the channels
// from leaking into it
addCoveredCableSizedCube(facing, cubeBuilder);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
// For to-machine connections, use a thicker end-cap for the connection
if (connectionType != AECableType.GLASS && !cableBusAdjacent) {
@@ -355,6 +350,7 @@ class CableBuilder {
cubeBuilder.setTexture(texture);
}
addCoveredCableSizedCube(facing, cubeBuilder);
// Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true);
@@ -378,8 +374,8 @@ class CableBuilder {
addStraightCoveredCableSizedCube(facing, cubeBuilder);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
// Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true);
@@ -407,8 +403,8 @@ class CableBuilder {
addCoveredCableSizedCube(facing, distanceFromEdge, cubeBuilder);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
// Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true);
@@ -468,10 +464,10 @@ class CableBuilder {
addDenseCableSizedCube(facing, cubeBuilder);
// Dense cables show used channels in groups of 4, rounded up
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
channels = (channels + 3) / 4;
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
// Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true);
@@ -496,7 +492,7 @@ class CableBuilder {
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_COVERED).get(cableColor);
cubeBuilder.setTexture(texture);
setStraightCableUVs(cubeBuilder, facing, 3, 13);
setStraightCableUVs(cubeBuilder, facing, 5, 11);
addStraightDenseCableSizedCube(facing, cubeBuilder);
}
@@ -507,15 +503,15 @@ class CableBuilder {
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_SMART).get(cableColor);
cubeBuilder.setTexture(texture);
setStraightCableUVs(cubeBuilder, facing, 3, 13);
setStraightCableUVs(cubeBuilder, facing, 5, 11);
addStraightDenseCableSizedCube(facing, cubeBuilder);
// Dense cables show used channels in groups of 4, rounded up
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
channels = (channels + 3) / 4;
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
// Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true);
@@ -559,14 +555,14 @@ class CableBuilder {
case DOWN:
case UP:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.addCube(3, -0.01f, 3, 13, 16.01f, 13);
cubeBuilder.addCube(3, 0, 3, 13, 16, 13);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
break;
case EAST:
case WEST:
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 3);
cubeBuilder.addCube(-0.01f, 3, 3, 16.01f, 13, 13);
cubeBuilder.addCube(0, 3, 3, 16, 13, 13);
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
break;
@@ -574,7 +570,7 @@ class CableBuilder {
case SOUTH:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.setUvRotation(EnumFacing.WEST, 3);
cubeBuilder.addCube(3, 3, -0.01f, 13, 13, 16.01f);
cubeBuilder.addCube(3, 3, 0, 13, 13, 16);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
break;
@@ -614,14 +610,14 @@ class CableBuilder {
case DOWN:
case UP:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.addCube(5, -0.01f, 5, 11, 16.01f, 11);
cubeBuilder.addCube(5, 0, 5, 11, 16, 11);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
break;
case EAST:
case WEST:
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 3);
cubeBuilder.addCube(-0.01f, 5, 5, 16.01f, 11, 11);
cubeBuilder.addCube(0, 5, 5, 16, 11, 11);
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
break;
@@ -629,7 +625,7 @@ class CableBuilder {
case SOUTH:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.setUvRotation(EnumFacing.WEST, 3);
cubeBuilder.addCube(5, 5, -0.01f, 11, 11, 16.01f);
cubeBuilder.addCube(5, 5, 0, 11, 11, 16);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
break;
@@ -705,7 +701,6 @@ class CableBuilder {
}
Collections.addAll(locations, SmartCableTextures.SMART_CHANNELS_TEXTURES);
Collections.addAll(locations, SmartCableTextures.DENSE_SMART_CHANNELS_TEXTURES);
return locations;
}
@@ -45,7 +45,7 @@ import java.util.Map.Entry;
public class CableBusBakedModel implements IBakedModel {
static final Map<CableBusRenderState, List<BakedQuad>> CABLE_MODEL_CACHE = new HashMap<>();
private static final Map<CableBusRenderState, List<BakedQuad>> CABLE_MODEL_CACHE = new HashMap<>();
private final CableBuilder cableBuilder;
@@ -27,26 +27,21 @@ import com.google.common.collect.ImmutableMap;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
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.TRSRTransformation;
import java.util.Collection;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* The built-in model for the cable bus block.
*/
public class CableBusModel implements IModel, ISelectiveResourceReloadListener {
public class CableBusModel implements IModel {
private final PartModels partModels;
@@ -106,12 +101,4 @@ public class CableBusModel implements IModel, ISelectiveResourceReloadListener {
public IModelState getDefaultState() {
return TRSRTransformation.identity();
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate) {
if (resourcePredicate.test(VanillaResourceType.MODELS)) {
CableBusBakedModel.CABLE_MODEL_CACHE.clear();
}
}
}
@@ -398,7 +398,7 @@ public class CubeBuilder {
builder.put(i, x, y, z);
break;
case NORMAL:
builder.put(i, face.getXOffset(), face.getYOffset(), face.getZOffset());
builder.put(i, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ());
break;
case COLOR:
// Color format is RGBA
@@ -72,7 +72,7 @@ public class QuadRotator {
// Figure out where the position is in the array
VertexFormat format = quad.getFormat();
int posIdx = this.findPositionOffset(format) / 4;
int stride = format.getSize() / 4;
int stride = format.getNextOffset() / 4;
int normalIdx = format.getNormalOffset();
VertexFormatElement.EnumType normalType = null;
// Figure out the type of the normals
@@ -32,43 +32,20 @@ import java.util.function.Function;
*/
public class SmartCableTextures {
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_01"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_02"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_03"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_04"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_10"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_11"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_12"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_13"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14"),
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_01"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_02"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_03"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_04"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_10"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_11"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_12"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_13"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14")
};
// Textures used to display channels on smart cables. There's two sets of 5 textures each, and
// one of each set are composed together to get even/odd colored channels
private final TextureAtlasSprite[] textures;
public static final ResourceLocation[] DENSE_SMART_CHANNELS_TEXTURES = {
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_00"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_01"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_02"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_03"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_04"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_10"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_11"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_12"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_13"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_14"),
};
// Textures used to display channels on dense smart cables. There's two sets of 5 textures each, and
// one of each set are composed together to get even/odd colored channels
private final TextureAtlasSprite[] denseTextures;
public SmartCableTextures(Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
this.textures = Arrays.stream(SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new);
this.denseTextures = Arrays.stream(DENSE_SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new);
}
/**
@@ -84,18 +61,8 @@ public class SmartCableTextures {
}
}
public TextureAtlasSprite getOddTextureForDenseChannels(int channels) {
if (channels < 0) {
return this.denseTextures[0];
} else if (channels <= 4) {
return this.denseTextures[channels];
} else {
return this.denseTextures[4];
}
}
/**
* The even variant is used for displaying channels 5-8 as in use.
* The odd variant is used for displaying channels 5-8 as in use.
*/
public TextureAtlasSprite getEvenTextureForChannels(int channels) {
if (channels < 5) {
@@ -106,14 +73,4 @@ public class SmartCableTextures {
return this.textures[9];
}
}
public TextureAtlasSprite getEvenTextureForDenseChannels(int channels) {
if (channels < 5) {
return this.denseTextures[5];
} else if (channels <= 8) {
return this.denseTextures[1 + channels];
} else {
return this.denseTextures[9];
}
}
}
@@ -33,8 +33,6 @@ import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.Vec3i;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
@@ -48,7 +46,7 @@ import java.util.ArrayList;
import java.util.List;
public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadListener {
public class AutoRotatingModel implements IBakedModel {
private final IBakedModel parent;
private final LoadingCache<AutoRotatingCacheKey, List<BakedQuad>> quadCache;
@@ -154,11 +152,6 @@ public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadLis
return this.quadCache.getUnchecked(key);
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
this.quadCache.invalidateAll();
}
public static class VertexRotator extends QuadGatheringTransformer {
private final FacingToRotation f2r;
private final EnumFacing face;
@@ -43,16 +43,16 @@ public class BuiltInModelLoader implements ICustomModelLoader {
@Override
public boolean accepts(ResourceLocation modelLocation) {
if (!modelLocation.getNamespace().equals(AppEng.MOD_ID)) {
if (!modelLocation.getResourceDomain().equals(AppEng.MOD_ID)) {
return false;
}
return this.builtInModels.containsKey(modelLocation.getPath());
return this.builtInModels.containsKey(modelLocation.getResourcePath());
}
@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception {
return this.builtInModels.get(modelLocation.getPath());
return this.builtInModels.get(modelLocation.getResourcePath());
}
@Override
@@ -18,6 +18,7 @@
package appeng.client.render.model;
import appeng.block.storage.BlockDrive;
import appeng.block.storage.DriveSlotState;
import appeng.block.storage.DriveSlotsState;
@@ -38,6 +39,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class DriveBakedModel implements IBakedModel {
private final IBakedModel bakedBase;
private final Map<DriveSlotState, IBakedModel> bakedCells;
@@ -70,10 +72,9 @@ public class DriveBakedModel implements IBakedModel {
Matrix4f transform = new Matrix4f();
transform.setIdentity();
// Position this drive model copy at the correct slot. The transform is based on
// the
// 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 = -col * 8 / 16.0f;
float xOffset = -col * 7 / 16.0f;
float yOffset = -row * 3 / 16.0f;
transform.setTranslation(new Vector3f(xOffset, yOffset, 0));
@@ -42,14 +42,12 @@ public class DriveModel implements IModel {
private static final ResourceLocation MODEL_BASE = new ResourceLocation("appliedenergistics2:block/drive_base");
private static final Map<DriveSlotState, ResourceLocation> MODELS_CELLS = ImmutableMap.<DriveSlotState, ResourceLocation>builder()
.put(DriveSlotState.EMPTY, new ResourceLocation("appliedenergistics2:block/drive_cell_empty"))
.put(DriveSlotState.OFFLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_off"))
.put(DriveSlotState.ONLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_on"))
.put(DriveSlotState.TYPES_FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_types_full"))
.put(DriveSlotState.FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_full"))
.put(DriveSlotState.NO_CONTENTS, new ResourceLocation("appliedenergistics2:block/drive_cell_no_contents"))
.build();
private static final Map<DriveSlotState, ResourceLocation> MODELS_CELLS = ImmutableMap.of(
DriveSlotState.EMPTY, new ResourceLocation("appliedenergistics2:block/drive_cell_empty"),
DriveSlotState.OFFLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_off"),
DriveSlotState.ONLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_on"),
DriveSlotState.TYPES_FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_types_full"),
DriveSlotState.FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_full"));
@Override
public Collection<ResourceLocation> getDependencies() {
@@ -32,7 +32,6 @@ import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.JsonUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.EnumHelperClient;
import net.minecraftforge.client.model.ICustomModelLoader;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoader;
@@ -55,6 +54,7 @@ import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
@@ -74,7 +74,11 @@ public enum UVLModelLoader implements ICustomModelLoader {
static {
try {
Field modifiers = Field.class.getDeclaredField("modifiers");
modifiers.setAccessible(true);
faceBakery = ReflectionHelper.findField(ModelBakery.class, "faceBakery", "field_177607_l");
modifiers.set(faceBakery, faceBakery.getModifiers() & (~Modifier.FINAL));
Class clas = Class.forName(ModelLoader.class.getName() + "$VanillaModelWrapper");
vanillaModelWrapper = clas.getDeclaredConstructor(ModelLoader.class, ResourceLocation.class, ModelBlock.class, boolean.class,
@@ -114,7 +118,7 @@ public enum UVLModelLoader implements ICustomModelLoader {
private static void setFaceBakery(ModelBakery modelBakery, FaceBakery faceBakery) {
try {
EnumHelperClient.setFailsafeFieldValue(UVLModelLoader.faceBakery, modelBakery, faceBakery);
UVLModelLoader.faceBakery.set(modelBakery, faceBakery);
} catch (Exception e) {
throw Throwables.propagate(e);
}
@@ -137,14 +141,14 @@ public enum UVLModelLoader implements ICustomModelLoader {
@Override
public boolean accepts(ResourceLocation modelLocation) {
String modelPath = modelLocation.getPath();
if (modelLocation.getPath().startsWith("models/")) {
String modelPath = modelLocation.getResourcePath();
if (modelLocation.getResourcePath().startsWith("models/")) {
modelPath = modelPath.substring("models/".length());
}
try (InputStreamReader io = new InputStreamReader(Minecraft.getMinecraft()
.getResourceManager()
.getResource(new ResourceLocation(modelLocation.getNamespace(), "models/" + modelPath + ".json"))
.getResource(new ResourceLocation(modelLocation.getResourceDomain(), "models/" + modelPath + ".json"))
.getInputStream())) {
return gson.fromJson(io, UVLMarker.class).ae2_uvl_marker;
} catch (Exception e) {
@@ -174,11 +178,11 @@ public enum UVLModelLoader implements ICustomModelLoader {
private final IModel parent;
public UVLModelWrapper(ResourceLocation modelLocation) {
String modelPath = modelLocation.getPath();
if (modelLocation.getPath().startsWith("models/")) {
String modelPath = modelLocation.getResourcePath();
if (modelLocation.getResourcePath().startsWith("models/")) {
modelPath = modelPath.substring("models/".length());
}
ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getNamespace(), "armatures/" + modelPath + ".json");
ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json");
ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(UVLModelLoader.this.resourceManager, armatureLocation);
ModelBlock model;
{
@@ -187,12 +191,12 @@ public enum UVLModelLoader implements ICustomModelLoader {
ModelBlock lvt_5_1_ = null;
try {
String s = modelLocation.getPath();
String s = modelLocation.getResourcePath();
iresource = Minecraft.getMinecraft()
.getResourceManager()
.getResource(
new ResourceLocation(modelLocation.getNamespace(), "models/" + modelPath + ".json"));
new ResourceLocation(modelLocation.getResourceDomain(), "models/" + modelPath + ".json"));
reader = new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8);
lvt_5_1_ = JsonUtils.gsonDeserialize(this.UVLSERIALIZER, reader, ModelBlock.class, false);
@@ -41,7 +41,7 @@ public class SpatialPylonRendering extends BlockRenderingCustomizer {
@Override
@SideOnly(Side.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.builtInModel(MODEL_ID.getPath(), new SpatialPylonModel());
rendering.builtInModel(MODEL_ID.getResourcePath(), new SpatialPylonModel());
rendering.stateMapper(this::mapState);
}
@@ -22,7 +22,6 @@ package appeng.container;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.SecurityPermissions;
import appeng.api.definitions.IItemDefinition;
import appeng.api.implementations.guiobjects.IGuiItemObject;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
@@ -38,9 +37,14 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
import appeng.container.guisync.GuiSync;
import appeng.container.guisync.SyncData;
import appeng.container.implementations.ContainerInterface;
import appeng.container.slot.*;
import appeng.container.slot.SlotRestrictedInput.PlacableItemType;
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.core.AELog;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
@@ -57,12 +61,14 @@ 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.inventory.Container;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.lang.reflect.Field;
@@ -78,7 +84,7 @@ public abstract class AEBaseContainer extends Container {
private final HashSet<Integer> locked = new HashSet<>();
private final TileEntity tileEntity;
private final IPart part;
protected final IGuiItemObject obj;
private final IGuiItemObject obj;
private final HashMap<Integer, SyncData> syncData = new HashMap<>();
private boolean isContainerValid = true;
private String customName;
@@ -312,13 +318,10 @@ public abstract class AEBaseContainer extends Container {
}
if (clickSlot != null && clickSlot.getHasStack()) {
ItemStack tis = clickSlot.getStack();
if (tis.isEmpty()) {
return ItemStack.EMPTY;
}
IItemDefinition expansionCard = AEApi.instance().definitions().materials().cardPatternExpansion();
ContainerInterface casted;
final List<Slot> selectedSlots = new ArrayList<>();
@@ -329,10 +332,6 @@ public abstract class AEBaseContainer extends Container {
tis = this.transferStackToContainer(tis);
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...
for (final Object inventorySlot : this.inventorySlots) {
final AppEngSlot cs = (AppEngSlot) inventorySlot;
@@ -395,12 +394,11 @@ public abstract class AEBaseContainer extends Container {
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();
if (maxSize > d.getSlotStackLimit()) {
maxSize = d.getSlotStackLimit();
}
int maxSize = Math.max(tis.getMaxStackSize(), d.getSlotStackLimit());
int placeAble = maxSize - t.getCount();
if (tis.getCount() < placeAble) {
@@ -435,7 +433,10 @@ public abstract class AEBaseContainer extends Container {
if (d.isItemValid(tis)) {
if (!d.getHasStack()) {
int maxSize = Math.max(tis.getMaxStackSize(), d.getSlotStackLimit());
int maxSize = tis.getMaxStackSize();
if (maxSize > d.getSlotStackLimit()) {
maxSize = d.getSlotStackLimit();
}
final ItemStack tmp = tis.copy();
if (tmp.getCount() > maxSize) {
@@ -454,13 +455,6 @@ public abstract class AEBaseContainer extends Container {
return ItemStack.EMPTY;
} else {
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
}
}
}
}
@@ -951,47 +945,6 @@ public abstract class AEBaseContainer extends Container {
b.putStack(testB);
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, @NotNull EntityPlayer player) {
if (slotId >= 0 && clickTypeIn == ClickType.PICKUP) {
final var slot = this.getSlot(slotId);
if (slot instanceof AppEngSlot appEngSlot) {
var slotStack = slot.getStack();
var draggedStack = this.invPlayer.getItemStack();
// The default vanilla behavior assumes that slots can't hold more items than the default stack size.
// Thus, it's possible to underflow the vanilla code when clicking non-empty slots with an item stack.
if (!draggedStack.isEmpty()) {
if (appEngSlot.isItemValid(draggedStack)) {
if (slotStack.getItem() == draggedStack.getItem() && slotStack.getMetadata() == draggedStack.getMetadata() && ItemStack.areItemStackTagsEqual(slotStack, draggedStack)) {
var maxSize = Math.max(appEngSlot.getSlotStackLimit(), draggedStack.getMaxStackSize());
var maxInsertable = Math.min(draggedStack.getCount(), maxSize - appEngSlot.getStack().getCount());
var toInsert = Math.min(maxInsertable, dragType == 0 ? maxInsertable : 1);
draggedStack.shrink(toInsert);
slotStack.grow(toInsert);
slot.onSlotChanged();
return ItemStack.EMPTY;
}
}
}
// Fixes taking and halving issues from oversized slots.
else if (dragType == 0 || dragType == 1) {
if (slot.canTakeStack(player) && !slotStack.isEmpty()) {
var toTake = Math.min(slotStack.getCount(), slotStack.getMaxStackSize());
this.invPlayer.setItemStack(slot.decrStackSize(dragType == 0 ? toTake : (toTake + 1) / 2));
slot.onTake(player, invPlayer.getItemStack());
return ItemStack.EMPTY;
}
}
}
}
return super.slotClick(slotId, dragType, clickTypeIn, player);
}
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
}
@@ -23,7 +23,6 @@ import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.networking.crafting.ICraftingJob;
@@ -39,7 +38,6 @@ import appeng.api.storage.data.IItemList;
import appeng.client.gui.implementations.GuiCraftConfirm;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.core.AELog;
import appeng.core.sync.GuiBridge;
import appeng.core.sync.network.NetworkHandler;
@@ -126,19 +124,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
return;
}
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 ICraftingGrid cc = this.getGrid().getCache(ICraftingGrid.class);
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
int matches = 0;
@@ -212,7 +198,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
p.reset();
p.setStackSize(out.getCountRequestable());
final IStorageGrid sg = grid.getCache(IStorageGrid.class);
final IStorageGrid sg = this.getGrid().getCache(IStorageGrid.class);
final IMEInventory<IAEItemStack> items = sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
IAEItemStack m = null;
@@ -265,6 +251,11 @@ public class ContainerCraftConfirm extends AEBaseContainer {
this.verifyPermissions(SecurityPermissions.CRAFT, false);
}
private IGrid getGrid() {
final IActionHost h = ((IActionHost) this.getTarget());
return h.getActionableNode().getGrid();
}
private boolean cpuMatches(final ICraftingCPU c) {
return c.getAvailableStorage() >= this.getUsedBytes() && !c.isBusy();
}
@@ -309,32 +300,13 @@ public class ContainerCraftConfirm extends AEBaseContainer {
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()) {
final ICraftingGrid cc = grid.getCache(ICraftingGrid.class);
final ICraftingGrid cc = this.getGrid().getCache(ICraftingGrid.class);
final ICraftingLink g = cc.submitJob(this.result, null, this.getSelectedCpu() == -1 ? null : this.cpus.get(this.getSelectedCpu()).getCpu(), true, this.getActionSrc());
this.setAutoStart(false);
if (g == null) {
this.setJob(cc.beginCraftingJob(this.getWorld(), grid, this.getActionSrc(), this.result.getOutput(), null));
} else if (originalGui != null && this.getOpenContext() != null) {
if (g != null && originalGui != null && this.getOpenContext() != null) {
final TileEntity te = this.getOpenContext().getTile();
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());
}
}
Platform.openGUI(this.getInventoryPlayer().player, te, this.getOpenContext().getSide(), originalGui);
}
}
}
@@ -163,7 +163,7 @@ public final class ContainerFluidInterfaceConfigurationTerminal extends AEBaseCo
}
}
if (!this.data.isEmpty()) {
if (!this.data.hasNoTags()) {
try {
NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
} catch (final IOException e) {
@@ -251,7 +251,7 @@ public final class ContainerFluidInterfaceConfigurationTerminal extends AEBaseCo
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
final NBTTagCompound tag = data.getCompoundTag(name);
if (tag.isEmpty()) {
if (tag.hasNoTags()) {
tag.setLong("sortBy", inv.sortBy);
tag.setString("un", inv.unlocalizedName);
tag.setTag("pos", NBTUtil.createPosTag(inv.pos));
@@ -28,8 +28,13 @@ import appeng.container.guisync.GuiSync;
import appeng.container.slot.*;
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.AppEngInternalOversizedInventory;
import appeng.util.Platform;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.item.ItemStack;
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost {
@@ -66,6 +71,19 @@ public class ContainerInterface extends ContainerUpgradeable implements IOptiona
}
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
if (this.inventorySlots.get(slotId) instanceof SlotOversized) {
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(true);
ItemStack ret = super.slotClick(slotId, dragType, clickTypeIn, player);
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(false);
return ret;
}
}
return super.slotClick(slotId, dragType, clickTypeIn, player);
}
@Override
protected int getHeight() {
return 256;
@@ -153,7 +153,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
}
}
if (!this.data.isEmpty()) {
if (!this.data.hasNoTags()) {
try {
NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
} catch (final IOException e) {
@@ -296,7 +296,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
final NBTTagCompound tag = data.getCompoundTag(name);
if (tag.isEmpty()) {
if (tag.hasNoTags()) {
tag.setLong("sortBy", inv.sortBy);
tag.setString("un", inv.unlocalizedName);
tag.setTag("pos", NBTUtil.createPosTag(inv.pos));
@@ -25,12 +25,9 @@ import appeng.api.config.YesNo;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
import appeng.api.networking.security.IActionHost;
import appeng.client.me.SlotDisconnected;
import appeng.container.AEBaseContainer;
import appeng.container.slot.AppEngSlot;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketCompressedNBT;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.InventoryAction;
@@ -47,7 +44,6 @@ import appeng.util.inv.WrapperCursorItemHandler;
import appeng.util.inv.WrapperFilteredItemHandler;
import appeng.util.inv.WrapperRangeItemHandler;
import appeng.util.inv.filter.IAEItemFilter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -55,7 +51,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
import java.io.IOException;
import java.util.HashMap;
@@ -165,7 +160,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
}
}
if (!this.data.isEmpty()) {
if (!this.data.hasNoTags()) {
try {
NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
} catch (final IOException e) {
@@ -180,26 +175,6 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slot, final long id) {
final InvTracker inv = this.byId.get(id);
if (inv != null) {
// The code below this block assumes "slot" is an interface slot id. Not in this case.
if (action == InventoryAction.PLACE_SINGLE) {
final AppEngSlot playerSlot;
try {
playerSlot = (AppEngSlot) this.inventorySlots.get(slot);
} catch (IndexOutOfBoundsException ignored) { return; }
if (!playerSlot.isPlayerSide() || !playerSlot.getHasStack()) return;
var itemStack = playerSlot.getStack();
if (!itemStack.isEmpty()) {
var handler = new WrapperFilteredItemHandler(
new WrapperRangeItemHandler(inv.server, 0, 9 * (inv.numUpgrades + 1)), new PatternSlotFilter());
playerSlot.putStack(ItemHandlerHelper.insertItem(handler, itemStack, false));
detectAndSendChanges();
}
return;
}
final ItemStack is = inv.server.getStackInSlot(slot);
final boolean hasItemInHand = !player.inventory.getItemStack().isEmpty();
@@ -296,6 +271,8 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
}
break;
default:
return;
}
this.updateHeld(player);
@@ -353,7 +330,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
final NBTTagCompound tag = data.getCompoundTag(name);
if (tag.isEmpty()) {
if (tag.hasNoTags()) {
tag.setLong("sortBy", inv.sortBy);
tag.setString("un", inv.unlocalizedName);
tag.setTag("pos", NBTUtil.createPosTag(inv.pos));
@@ -379,27 +356,6 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
data.setTag(name, tag);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
if (Platform.isClient()) {
var playerSlot = this.inventorySlots.get(idx);
if (playerSlot instanceof AppEngSlot playerAppEngSlot && playerAppEngSlot.isPlayerSide()) {
for (var slot : this.inventorySlots) {
if (slot instanceof SlotDisconnected slotDisconnected && !slot.getHasStack()) {
// Signal the server to move the pattern.
var packet = new PacketInventoryAction(InventoryAction.PLACE_SINGLE,
playerAppEngSlot.slotNumber, slotDisconnected.getSlot().getId());
NetworkHandler.instance().sendToServer(packet);
return ItemStack.EMPTY;
}
}
}
}
return super.transferStackInSlot(p, idx);
}
private static class InvTracker {
private final long sortBy;
@@ -21,25 +21,43 @@ package appeng.container.implementations;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.IUpgradeableCellContainer;
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.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.items.IItemHandler;
public class ContainerMEPortableCell extends ContainerMEMonitorable implements IInventorySlotAware {
public class ContainerMEPortableCell extends ContainerMEMonitorable implements IUpgradeableCellContainer, IAEAppEngInventory, IInventorySlotAware {
protected final IPortableCell portableCell;
protected final WirelessTerminalGuiObject wirelessTerminalGUIObject;
private final int slot;
private double powerMultiplier = 0.5;
private int ticks = 0;
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell guiObject) {
super(ip, guiObject, guiObject, false);
if (guiObject != null) {
final int slotIndex = ((IInventorySlotAware) guiObject).getInventorySlot();
if (!((IInventorySlotAware) guiObject).isBaubleSlot()) {
protected AppEngInternalInventory upgrades;
protected SlotRestrictedInput magnetSlot;
public ContainerMEPortableCell(InventoryPlayer ip, WirelessTerminalGuiObject monitorable, boolean bindInventory) {
super(ip, monitorable, bindInventory);
if (monitorable != null) {
final int slotIndex = ((IInventorySlotAware) monitorable).getInventorySlot();
if (!((IInventorySlotAware) monitorable).isBaubleSlot()) {
this.lockPlayerInventorySlot(slotIndex);
}
this.slot = slotIndex;
@@ -47,31 +65,82 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
this.slot = -1;
this.lockPlayerInventorySlot(ip.currentItem);
}
this.bindPlayerInventory(ip, 0, 0);
this.portableCell = guiObject;
this.wirelessTerminalGUIObject = monitorable;
this.upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2);
this.loadFromNBT();
this.setupUpgrades();
}
@Override
public void detectAndSendChanges() {
final ItemStack currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem() : this.getPlayerInv().getStackInSlot(this.slot);
if (Platform.isServer()) {
if (this.portableCell == null || currentItem.isEmpty()) {
this.setValidContainer(false);
} else if (!this.portableCell.getItemStack().isEmpty() && currentItem != this.portableCell.getItemStack()) {
if (!ItemStack.areItemsEqual(this.portableCell.getItemStack(), currentItem)) {
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)) {
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.wirelessTerminalGUIObject.getItemStack());
} else {
this.setValidContainer(false);
}
}
// drain 1 ae t
this.ticks++;
if (this.ticks > 10) {
this.wirelessTerminalGUIObject.extractAEPower(this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG);
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 (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);
}
// drain 1 ae t
this.ticks++;
if (this.ticks > 10) {
this.portableCell.extractAEPower(this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG);
this.ticks = 0;
}
super.detectAndSendChanges();
@Override
protected IActionHost getActionHost() {
return this.wirelessTerminalGUIObject;
}
private double getPowerMultiplier() {
@@ -83,7 +152,55 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
}
@Override
public int getInventorySlot() {
return this.slot;
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 onSlotChange(Slot s) {
super.detectAndSendChanges();
}
@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();
}
}
@@ -1,235 +0,0 @@
/*
* 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();
}
}
@@ -38,6 +38,8 @@ public class ContainerOreDictStorageBus extends AEBaseContainer {
public ContainerOreDictStorageBus(final InventoryPlayer ip, final PartOreDicStorageBus anchor) {
super(ip, anchor);
this.part = anchor;
this.bindPlayerInventory(ip, 14, 256 - /* height of player inventory */82);
}
@Override
@@ -12,14 +12,7 @@ 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.container.slot.*;
import appeng.core.sync.packets.PacketPatternSlot;
import appeng.helpers.IContainerCraftingPacket;
import appeng.items.storage.ItemViewCell;
@@ -74,6 +67,8 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
public boolean craftingMode = true;
@GuiSync(96)
public boolean substitute = false;
@GuiSync(95)
public boolean packaging = false;
protected ContainerPatternEncoder(InventoryPlayer ip, ITerminalHost monitorable, boolean bindInventory) {
super(ip, monitorable, bindInventory);
@@ -191,9 +186,6 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
}
this.detectAndSendChanges();
}
if (s == this.craftSlot && Platform.isClient()) {
this.getAndUpdateOutput();
}
}
public void encodeAndMoveToInventory() {
@@ -257,8 +249,12 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
encodedValue.setTag("in", tagIn);
encodedValue.setTag("out", tagOut);
encodedValue.setBoolean("crafting", this.isCraftingMode());
encodedValue.setBoolean("substitute", this.isSubstitute());
if (this.isCraftingMode()) {
encodedValue.setBoolean("crafting", this.isCraftingMode());
encodedValue.setBoolean("substitute", this.isSubstitute());
} else {
encodedValue.setBoolean("packaging", this.isPackaging());
}
output.setTagCompound(encodedValue);
@@ -535,6 +531,14 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
}
public void setSubstitute(final boolean substitute) {
if (getPart() != null) {
getPart().setSubstitution(substitute);
} else if (iGuiItemObject != null) {
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
if (nbtTagCompound != null) {
nbtTagCompound.setBoolean("isSubstitute", substitute);
}
}
this.substitute = substitute;
if (getPart() != null) {
getPart().setSubstitution(substitute);
@@ -546,6 +550,22 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
}
}
public boolean isPackaging() {
return this.packaging;
}
public void setPackaging(boolean packaging) {
if (getPart() != null) {
getPart().setPackaging(packaging);
} else if (iGuiItemObject != null) {
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
if (nbtTagCompound != null) {
nbtTagCompound.setBoolean("isPackaging", packaging);
}
}
this.packaging = packaging;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
@@ -555,6 +575,7 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
this.setCraftingMode(this.getPart().isCraftingRecipe());
this.updateOrderOfOutputSlots();
}
this.packaging = this.getPart().isPackaging();
this.substitute = this.getPart().isSubstitution();
} else if (iGuiItemObject != null) {
NBTTagCompound nbtTagCompound = iGuiItemObject.getItemStack().getTagCompound();
@@ -573,20 +594,23 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
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);
if (nbtTagCompound.hasKey("isSubstitute")) {
boolean substitute = nbtTagCompound.getBoolean("isSubstitute");
if (this.isSubstitute() != substitute) {
this.setSubstitute(substitute);
}
} else {
nbtTagCompound = new NBTTagCompound();
nbtTagCompound.setBoolean("isSubstitute", false);
iGuiItemObject.getItemStack().setTagCompound(nbtTagCompound);
}
if (nbtTagCompound.hasKey("isPackaging")) {
boolean packaging = nbtTagCompound.getBoolean("isPackaging");
if (this.isPackaging() != packaging) {
this.setPackaging(packaging);
}
} else {
nbtTagCompound.setBoolean("isPackaging", false);
}
}
}
@@ -19,7 +19,6 @@
package appeng.container.implementations;
import appeng.api.config.PowerMultiplier;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotRestrictedInput;
@@ -52,7 +51,7 @@ public class ContainerWireless extends AEBaseContainer {
final int boosters = this.boosterSlot.getStack().isEmpty() ? 0 : this.boosterSlot.getStack().getCount();
this.setRange((long) (10 * AEConfig.instance().wireless_getMaxRange(boosters)));
this.setDrain((long) (100 * PowerMultiplier.CONFIG.multiply(AEConfig.instance().wireless_getPowerDrain(boosters))));
this.setDrain((long) (100 * AEConfig.instance().wireless_getPowerDrain(boosters)));
super.detectAndSendChanges();
}

Some files were not shown because too many files have changed in this diff Show More