Compare commits

..

8 Commits

Author SHA1 Message Date
fscan fa2b4fabc7 Fix ConcurrentModificatonException in NetworkEventBus (#3660) 2018-08-01 00:35:44 +02:00
Saereth f8d5f4ddb1 Fixes #3478: Changes the way xp drops from Certus Ore blocks (#3482) 2018-06-26 23:36:21 +02:00
fscan f8dfa2619e Fixes #3535: Prevent crash when either quartz types are disabled (#3542)
* Fixes crash when either quartz types are disabled and prevent cascading worldgen.
* Also fixes  #3486
2018-06-26 15:31:03 +02:00
fscan c1d1dc947f Fixes #3548: AEBaseTile now respect overridden markDirty implementations. (#3550) 2018-06-26 10:33:56 +02:00
fscan 6bb465be0b Fixes #3449: Prevent CellInventory#getCell() from mutating the cell itemstack definition (#3552)
CellInventory#getCell() initalizes the ItemStack with an empty NBT and therefore was messing with the item definition.
2018-06-26 10:32:58 +02:00
fscan 8902af9766 Fixes #3459: Open the inventory if raytrace misses (#3549) 2018-06-26 10:31:17 +02:00
fscan 2b592dd40e Fixes DriveBakedModel to not crash when SLOT_STATE is null (#3545)
Uses a null object in case the TE is not available for whichever reason.
2018-06-18 19:03:28 +02:00
fscan 41e7558b24 Fixes interface shift-clicking to generate correct onChangeInventory events (#3544) 2018-06-18 19:01:17 +02:00
1876 changed files with 104280 additions and 117634 deletions
-30
View File
@@ -1,30 +0,0 @@
---
name: Bug report
about: You found a bug or encountered a crash? Please report it here.
---
<!-- Provide a summary of the issue in the Title above, please do not "[Tag]" it. -->
**Describe the bug**
<!-- Always use the most recent version from ae-mod.info, it might already be fixed. -->
**To Reproduce**
<!-- Please provide the steps to reproduce it, otherwise we might not be able to fix it. -->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Additional context**
<!-- Screenshots, crashlogs, etc. -->
<!-- A complete crashlog is required when reporting a crash. No excerpts. -->
<!-- Please use pastebin or gist for posting the complete crashlog. -->
**Environment**
<!-- Include as many relevant details about the environment -->
<!-- Like the used version, SP/MP, other mods and their version -->
<!-- The following ones are required, please note "latest" is not a version -->
- Minecraft Version:
- AE2 Version:
- Forge Version:
-17
View File
@@ -1,17 +0,0 @@
---
name: Feature Request
about: A feature request or suggestion to improve Applied Energistics 2
---
<!-- Provide a summary of the issue in the Title above, please do not "[Tag]" it. -->
**Describe the feature**
<!-- Tell us how it should work. -->
**Reasons why it should be considered**
<!-- This can help us in various degrees, e.g. to determine if it fits our design ideas. -->
**Additional Context**
<!-- Use this for further details, e.g. screenshots, links to mods for integrations. -->
<!-- Features will only be considered for the latest/next version. -->
-25
View File
@@ -1,25 +0,0 @@
name: Build mod
on: [ push, pull_request, workflow_dispatch ]
jobs:
build:
name: Build mod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew -Pnet.minecraftforge.gradle.disableUpdateChecker=true build
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: appliedenergistics2
path: build/libs
-1
View File
@@ -8,7 +8,6 @@
!gradlew.bat !gradlew.bat
!build.gradle !build.gradle
!gradle.properties !gradle.properties
!settings.gradle
!.travis.yml !.travis.yml
# include markdowns # include markdowns
+6 -19
View File
@@ -7,27 +7,14 @@ jdk:
- openjdk8 - openjdk8
before_cache: before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json - rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/providedDummy.jar
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json.etag - rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/compileDummy.jar
- rm -fr $HOME/.gradle/caches/minecraft/deobfedDeps
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
cache: cache:
directories: directories:
- '$HOME/.m2/repository' - $HOME/.gradle/caches/
- '$HOME/.sonar/cache' - $HOME/.gradle/wrapper/
- '$HOME/.gradle/wrapper'
- '$HOME/.gradle/caches'
addons:
sonarcloud:
organization: "appliedenergistics"
install: "./gradlew setupCIWorkspace" install: "./gradlew setupCIWorkspace"
script: script: "./gradlew build test"
- "./gradlew build"
- "./gradlew test"
- "./gradlew sonarqube"
-58
View File
@@ -1,58 +0,0 @@
Changes so far :
Design changes/breakages:
- Interfaces no longer spill items of one pattern on other faces
- Interfaces now push patterns in round-robin (Interfaces, then sides)
Fixes:
- Fix gregtech machines appearing with 'unnamed' or 'draconium lens' on the interface terminal on specific situations.
- Add memorycard support for fluid interfaces, import/export/storage busses and level emitters ( this fix was upstreamed to AE2 for MC 1.16)
- Storage busses now hide/show inaccessible items as configured.
- Exclusive Blocking mode for GTCE ( shapes, molds and configured circuits do not block GTCE machines )
- Blocking modes default to block on any item in the iventory the entity exposes
- Fuzzy includes items that report that they're damageable, but report a maxDamage of 0 ( auto-crafting of basic capacitors -> resonant capacitors is now possible ) <- Broken item implementation.
- Fix CME exceptions on the energy grid
- Fix AE going offline even with enough power by extracting from the local buffer always last
- Fix IO-Port copying craftable flag into items
- Fix NBT of old items not clearing on drives that reached 64 types once
Performance:
- Added @talchas fixes for insane channelless AE networks.
- Implemented StorageDrawers slotless itemrepository.
- Removed CraftedEvent calls (really bad lag with craftweaker versions before CraftTweaker2-1.12-4.1.20.626)
- Count items set in interfaces before queuing crafting for them needlessly
- Backported b7ca98d ( Avoid copying items on simulated item extraction )
- Cache some level emitters functions
- Reduced import bus insert simulation to 1 before real insertion (if possible)
- Backported itemlist re-implementation along with pattern changes to avoid CraftingManager fallback issues
- Instead of recalculating all the content of the network on every change, track the changes properly and apply them to the cached list of items
QOL:
- added highlight interface button to interface terminal ("?" button on the left of the interface slots)
- Added bar on the interface terminal that search by inputs ( The one on the LEFT, also searchs by interface name )
- Shortcut to molecular assemblers with free slots on the terminal interface by @Theisyat
- Toggle button on interface terminal to hide full interfaces
- JEI "U", "R" and "A" (Usages/Recipes/Bookmark) now work on the Crafting Status GUI. ( the one that shows the total items to craft, and whats missing)
- Patterns can now be made with items currently showing on JEI. ( This is overriden by Just Enough Energistics. )
- Added multiplier buttons to processing pattern gui
- Switched crafting terminal JEI search to fuzzy mode. If the recipe uses a damageable item, AE will try to grab it ( damaged tools )
- Encoded patterns stack up to 64 ( holding shift and clicking the encode arrow will transfer the encoded pattern to the player inventory)
- Encoded patterns can be draggred on the interface terminal.
- Storage Monitor and Conversion Monitor now also ccepts fluids
- Draggable JEI ghost items (also works on bookmarked items. SHIFT + Click will move the hovered item into the first free target slot)
- JEI auto switches between crafting and processing patterns
- GTCE Blocking mode work through phantom itemfaces
- Shift-clicking blank patterns into the pattern terminal will try to fill the blank pattern slots first
- Mismached simulated/real item count ( most often due to compacting drawers ) will now tell the player wich item cause the failure when trying to start a craft
- Added 'pattern expansion' cards that adds an extra row of patterns to interfaces. up to 3 card on an interface. (each card will increase the interface idle power draw by 4 times)
HOTKEYS:
- Implemented mousetweaks API. AE2 custom keybinds now work. (Try right clicking and use the scroll-wheel on the terminals)
- Holding SHIFT and scrolling UP and DOWN will increase the items set on the configured slots of Interfaces and Pattern Terminal (Processing mode)
+220 -13
View File
@@ -1,34 +1,241 @@
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack. [![Travis](https://img.shields.io/travis/AppliedEnergistics/Applied-Energistics-2.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/AppliedEnergistics/Applied-Energistics-2)
[![Latest Release](https://img.shields.io/github/release/AppliedEnergistics/Applied-Energistics-2.svg?label=Latest%20Release&style=flat-square)](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases)
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
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory) ## Table of Contents
* [About](#about)
* [Contacts](#contacts)
* [License](#license)
* [Downloads](#downloads)
* [Installation](#installation)
* [Issues](#issues)
* [Building](#building)
* [Contribution](#contribution)
* [API](#applied-energistics-2-api)
* [CraftTweaker](#applied-energistics-2-crafttweaker)
* [Localization](#applied-energistics-2-localization)
* [Credits](#credits)
## About ## About
A Mod about Matter, Energy and using them to conquer the world.
## RecipeStages A Mod about Matter, Energy and using them to conquer the world..
You need to add the following into a CraftTweaker script:
```
mods.recipestages.Recipes.setPackageStage("appeng", allStages);
```
The second argument allows you to customize which stages exactly you want to be craftable with AE2. Idk why would you like to restrict any, but you can. ## Contacts
* [Website](http://ae-mod.info/)
* [IRC #appliedenergistics on esper.net](http://webchat.esper.net/?channels=appliedenergistics&prompt=1)
* [GitHub](https://github.com/AppliedEnergistics/Applied-Energistics-2)
## License ## License
* Applied Energistics 2 API * Applied Energistics 2 API
- (c) 2013 - 2018 AlgorithmX2 et al - (c) 2013 - 2017 AlgorithmX2 et al
- [![License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](http://opensource.org/licenses/MIT) - [![License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](http://opensource.org/licenses/MIT)
* Applied Energistics 2 * Applied Energistics 2
- (c) 2013 - 2018 AlgorithmX2 et al - (c) 2013 - 2017 AlgorithmX2 et al
- [![License](https://img.shields.io/badge/License-LGPLv3-blue.svg?style=flat-square)](https://raw.githubusercontent.com/AppliedEnergistics/Applied-Energistics-2/rv2/LICENSE) - [![License](https://img.shields.io/badge/License-LGPLv3-blue.svg?style=flat-square)](https://raw.githubusercontent.com/AppliedEnergistics/Applied-Energistics-2/rv2/LICENSE)
* Textures and Models * Textures and Models
- (c) 2013 - 2018 AlgorithmX2 et al - (c) 2013 - 2017 AlgorithmX2 et al
- [![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%203.0-yellow.svg?style=flat-square)](https://creativecommons.org/licenses/by-nc-sa/3.0/) - [![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%203.0-yellow.svg?style=flat-square)](https://creativecommons.org/licenses/by-nc-sa/3.0/)
* Text and Translations * Text and Translations
- [![License](https://img.shields.io/badge/License-No%20Restriction-green.svg?style=flat-square)](https://creativecommons.org/publicdomain/zero/1.0/) - [![License](https://img.shields.io/badge/License-No%20Restriction-green.svg?style=flat-square)](https://creativecommons.org/publicdomain/zero/1.0/)
## Downloads
Downloads can be found on [CurseForge](http://www.curse.com/mc-mods/minecraft/223794-applied-energistics-2) or on the [official website](http://ae-mod.info/Downloads/).
## Installation
You install this mod by putting it into the `minecraft/mods/` folder. It has no additional hard dependencies.
## Issues
Applied Energistics 2 crashing, have a suggestion, found a bug? Create an issue now!
1. Make sure your issue has not already been answered or fixed and you are using the latest version. Also think about whether your issue is a valid one before submitting it.
* If it is already possible with vanilla and AE2 itself, the suggestion will be considered invalid.
* Asking for a smaller version, more compact version, or more efficient version of something will also be considered invalid.
2. Go to [the issues page](https://github.com/AppliedEnergistics/Applied-Energistics-2/issues) and click [new issue](https://github.com/AppliedEnergistics/Applied-Energistics-2/issues/new)
3. Enter your a title of your issue (something that summarizes your issue), and then create a detailed description of the issue.
* Do not tag it with something like `[Feature]`, `[Bug]`, or a version.
* Restrict it to a single bug or feature, it makes managing them way easier for us.
* The following details are required. Also refer to the issue template when creating one.
* Forge version
* AE2 version
* Crash log, when reporting a crash (Please make sure to use [pastebin](http://pastebin.com/))
* Never post an excerpt of what you consider important
* Always post the full log
* Other mods and their version, when reporting an issue between AE and another mod
* Also consider updating these before submitting a new issue, it might be already fixed
* A detailed description of the bug or feature
* To further help in resolving your issues please try to include the follow if applicable:
* What was expected?
* How to reproduce the problem?
* This is usually a great detail and allows us to fix it way faster
* Server or Single Player?
* Screen shots or Pictures of the problem
* Mod Pack using and version?
* Keep in mind that some mods might use an outdated version of AE2
* If so you should report it to your modpack
4. Click `Submit New Issue`, and wait for feedback!
Providing as many details as possible does help us to find and resolve the issue faster and also you getting a fixed version as fast as possible.
Please note that we might close any issue not matching these requirements.
## Building
1. Clone this repository via
- SSH `git clone git@github.com:AppliedEnergistics/Applied-Energistics-2.git` or
- HTTPS `git clone https://github.com/AppliedEnergistics/Applied-Energistics-2.git`
2. Setup workspace
- Decompiled source `gradlew setupDecompWorkspace`
- Obfuscated source `gradlew setupDevWorkspace`
- CI server `gradlew setupCIWorkspace`
3. Build `gradlew build`. Jar will be in `build/libs`
4. For core developer: Setup IDE
- IntelliJ: Import into IDE, execute `gradlew genIntellijRuns` and change RunConfiguration to `*_main` as quickfix for [ForgeGradle](https://github.com/MinecraftForge/ForgeGradle/issues/357)
- Eclipse: execute `gradlew eclipse`
5. For add-on developer: Core-Mod Detection
- In order to have FML detect AE from your dev environment, add the following VM Option to your run profile
- `-Dfml.coreMods.load=appeng.coremod.AppEngCore`
## Contribution
Before you want to add major changes, you might want to discuss them with us first, before wasting your time.
If you are still willing to contribute to this project, you can contribute via [Pull-Request](https://help.github.com/articles/creating-a-pull-request).
The [guidelines for contributing](https://github.com/AppliedEnergistics/Applied-Energistics-2/blob/master/.github/CONTRIBUTING.md) contain more detailed information about topics like the used code style and should also be considered.
Here are a few things to keep in mind that will help get your PR approved.
* A PR should be focused on content. Any PRs where the changes are only syntax will be rejected.
* Use the file you are editing as a style guide.
* Consider your feature. [Suggestion Guidelines](http://ae-mod.info/Suggestion-Guidelines/)
- Is your suggestion already possible using Vanilla + AE2?
- Make sure your feature isn't already in the works, or hasn't been rejected previously.
- Does your feature simplify another feature of AE2? These changes will not be accepted.
- If your feature can be done by any popular mod, discuss with us first.
**Getting Started**
1. Fork this repository
2. Clone the fork via
* SSH `git clone git@github.com:<your username>/Applied-Energistics-2.git` or
* HTTPS `git clone https://github.com/<your username>/Applied-Energistics-2.git`
3. Change code base
4. Add changes to git `git add -A`
5. Commit changes to your clone `git commit -m "<summery of made changes>"`
6. Push to your fork `git push`
7. Create a Pull-Request on GitHub
8. Wait for review
9. Squash commits for cleaner history
If you are only doing single file pull requests, GitHub supports using a quick way without the need of cloning your fork. Also read up about [synching](https://help.github.com/articles/syncing-a-fork) if you plan to contribute on regular basis.
## Applied Energistics 2 API
The API for Applied Energistics 2. It is open source to discuss changes, improve documentation, and provide better add-on support in general.
Universal builds obtained [Here](http://ae2.ae-mod.info/Downloads/) should work in a development environment.
### Maven
When compiling against the AE2 API you can use gradle dependencies, just add
dependencies {
compile "appeng:appliedenergistics2:rv_-_____-__:dev"
}
or add the compile line to your existing dependencies task to your build.gradle
Where the __ are filled in with the correct version criteria; AE2 is available from the default forge maven so no additional repositories are necessary.
An example string would be `appeng:appliedenergistics2:rv2-alpha-30:dev`
## Applied Energistics 2 CraftTweaker
### Inscriber
Add a recipe. When `inscribe` is true the bottom and top inputs are not consumed.
mods.appliedenergistics2.Inscriber.addRecipe(ItemStack output, ItemStack input, boolean inscribe,
@Optional ItemStack topInput, @Optional ItemStack bottomInput );
Remove all recipes for this output stack.
mods.appliedenergistics2.Inscriber.removeRecipe(ItemStack output);
### Grindstone
Add a recipe.
mods.appliedenergistics2.Grinder.addRecipe( ItemStack output, ItemStack input, int turns,
@Optional ItemStack secondary1Output, @Optional float secondary1Chance,
@Optional ItemStack secondary2Output, @Optional float secondary2Chance);
Remove recipes for this input.
mods.appliedenergistics2.Grinder.removeRecipe(ItemStack input);
### Spatial
Whitelist a TileEntity class for Spatial IO.
mods.appliedenergistics2.Spatial.whitelistEntity( String fullEntityClassName );
### Attunement
Attune a ItemStack or ModID to a specific P2P-Tunnel type. ModID's are used as fallback when no ItemStack was found.
mods.appliedenergistics2.Attunement.attuneME( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneME( String modID );
mods.appliedenergistics2.Attunement.attuneItem( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneItem( String modID );
mods.appliedenergistics2.Attunement.attuneFluid( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneFluid( String modID );
mods.appliedenergistics2.Attunement.attuneRedstone( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneRedstone( String modID );
mods.appliedenergistics2.Attunement.attuneRF( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneRF( String modID );
mods.appliedenergistics2.Attunement.attuneIC2( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneIC2( String modID );
mods.appliedenergistics2.Attunement.attuneLight( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneLight( String modID );
### Cannon
Add ammo types for the matter cannon.
mods.appliedenergistics2.Cannon.registerAmmo( ItemStack itemStack, double weight );
## Applied Energistics 2 Localization
### English Text
`en_US` is included in this repository, fixes to typos are welcome.
### Encoding
Files must be encoded as UTF-8.
### New or updated Translations
The language files are located in `/src/main/resources/assets/appliedenergistics2/lang/` and use the [appropriate locale code](http://minecraft.gamepedia.com/Language) as name and `.lang` as extension.
To update an translation edit the corresponding file and improve/correct the existing entry. Or copy any entries from `en_US.lang` for missing translation.
To create a new translation, copy the contents of `en_US.lang`, create a new file with appropriate filename, and translate it to your language.
Please keep in mind that we use [String format](https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html) to pass additional data to the text for displaying.
Therefore you should preserve parts like `%s` or `%1$d%%`, which allows us to replace them with the correct values while you still have the option to change their order for match the rules of grammar.
This might not be possible for some languages. Should this be the case, please contact us.
### Final Note
If you have have issues localizing something feel free to contact us on IRC, at #AppliedEnergistics on Esper.net
Thanks to everyone helping out to improve localization of AE2.
## Credits ## Credits
Thanks to Thanks to
* Notch et al for Minecraft * Notch et al for Minecraft
+75 -987
View File
File diff suppressed because it is too large Load Diff
+15 -130
View File
@@ -1,148 +1,33 @@
aeversion=rv6 aeversion=rv5
aechannel=stable aechannel=alpha
aebuild=7 aebuild=0
aegroup=appeng aegroup=appeng
aebasename=appliedenergistics2 aebasename=appliedenergistics2
######################################################### #########################################################
# Versions # # Versions #
######################################################### #########################################################
minecraft_version=1.12.2 minecraft_version=1.12.2
mcp_mappings=snapshot_20171003 mcp_mappings=snapshot_20171003
forge_version=14.23.5.2847 forge_version=14.23.1.2554
######################################################### #########################################################
# Installable # # Installable #
######################################################### #########################################################
hwyla_version=1.8.26-B41_1.12.2 hwyla_version=1.8.20-B35_1.12
######################################################### #########################################################
# Provided APIs # # Provided APIs #
######################################################### #########################################################
jei_version=4.16.1.302 jei_version=4.8.0.105
tesla_version=1.0.63 tesla_version=1.0.61
ic2_version=2.8.73-ex112 ic2_version=2.8.19-ex112
top_version=1.12-1.4.23-16 top_version=1.12-1.4.18-10
crafttweaker_version=4.1.20.684 cofhcore_version=1.12-4.+
ctm_version=MC1.12.2-0.3.1.16 crafttweaker_version=4.0.10.310
forestry_version=5.8.2.387
######################################################### #########################################################
# Deployment # # Deployment #
######################################################### #########################################################
website_version=1.12.2 website_version=1.12.2
curse_versions=1.12.2 curse_versions=1.12.2
mapping_channel=snapshot
mapping_version=20171003
# Run Configurations
minecraft_username=Developer
extra_jvm_args=
modName=Applied Energistics 2
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId=appliedenergistics2
modGroup=appeng
# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion=rv6-stable-7-extended_life-v0.55.21
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar=false
# The name of your jar when you produce builds, not including any versioning info
modArchivesBaseName=appliedenergistics2
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript=false
minecraftVersion=1.12.2
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
# Alternatively this can be set with the 'DEV_USERNAME' environment variable.
developmentEnvironmentUserName=Developer
# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
# Using this requires that you use a Java 17 JDK for development.
enableModernJavaSyntax=true
# Generate a class with String fields for the mod id, name and version named with the fields below
generateGradleTokenClass=appeng.Tags
gradleTokenModId=
gradleTokenModName=
gradleTokenVersion=VERSION
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage=api
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/
# There can be multiple files in a comma-separated list.
# Example value: mymodid_at.cfg,jei_at.cfg
accessTransformersFile=appliedenergistics2_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins=false
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage=
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass=core.AE2ELCore
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that
# there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly=false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins=false
# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
includeWellKnownRepositories=true
# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will
# be available at compiletime and runtime for your mod (in-game and in-code).
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
includeCommonDevEnvMods=true
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies=false
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies=true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies=true
# Publishing to modrinth requires you to set the MODRINTH_API_KEY environment variable to your current modrinth API token.
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish on Modrinth.
# Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable.
modrinthProjectId=
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:jei;optional-project:top;incompatible-project:gregtech
modrinthRelations=
# Publishing to CurseForge requires you to set the CURSEFORGE_API_KEY environment variable to one of your CurseForge API tokens.
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
# Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable.
curseForgeProjectId=
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
curseForgeRelations=
# This project's release type on CurseForge and/or Modrinth
# Allowed types: release, beta, alpha
releaseType=beta
# Generate a default changelog for releases. Requires git to be installed, as it uses it to generate a changelog of
# commits since the last tagged release.
generateDefaultChangelog=false
# Prevent the source code from being published
noPublishedSources=false
# Enable spotless checks
# Enforces code formatting on your source code
# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless
# to format your code. However, you can create your own version of these files and place them in your project's
# root directory to apply your own formatting options instead.
enableSpotless=false
# Enable JUnit testing platform used for testing your code.
# Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/
enableJUnit=true
# Deployment debug setting
# Uncomment this to test deployments to CurseForge and Modrinth
# Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable.
deploymentDebug=false
# Gradle Settings
# Effectively applies the '--stacktrace' flag by default
org.gradle.logging.stacktrace=all
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
+59
View File
@@ -0,0 +1,59 @@
/*
* 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'
}
artifacts {
archives apiJar
archives javadocJar
archives sourceJar
}
+18 -41
View File
@@ -19,15 +19,6 @@
repositories { repositories {
mavenLocal() mavenLocal()
maven {
url "https://cursemaven.com"
}
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
maven { maven {
name "Mobius" name "Mobius"
url "http://mobiusstrip.eu/maven" url "http://mobiusstrip.eu/maven"
@@ -39,8 +30,8 @@ repositories {
} }
maven { maven {
name "Ellpeck" name = "Tesla repo"
url "https://maven.ellpeck.de" url "http://maven.mcmoddev.com"
} }
maven { maven {
@@ -63,15 +54,20 @@ repositories {
url "http://maven.k-4u.nl/" url "http://maven.k-4u.nl/"
} }
maven { // CraftTweaker maven { // Hwyla
name 'tehnut'
url "http://tehnut.info/maven"
}
maven { // CraftTweaker
name 'jared maven' name 'jared maven'
url "http://maven.blamejared.com/" url "http://maven.blamejared.com/"
} }
//maven { // modmaven, maven proxy maven { // modmaven, maven proxy
// name 'modmaven' name 'modmaven'
// url "https://modmaven.k-4u.nl/" url "https://modmaven.k-4u.nl/"
//} }
} }
configurations { configurations {
@@ -79,42 +75,23 @@ configurations {
} }
dependencies { dependencies {
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
// installable runtime dependencies // installable runtime dependencies
implementation rfg.deobf("curse.maven:gregtechceu-557242:4429261") mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
compileOnly "curse.maven:chisel-235279:2915375"
implementation rfg.deobf("curse.maven:baubles-227083:2518667")
//mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
mods "curse.maven:hwyla-253449:2568751"
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev" mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}" mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
// compile against provided APIs // compile against provided APIs
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api" compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}" compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
compileOnly "curse.maven:hwyla-253449:2568751" compileOnly "net.darkhax.tesla:Tesla-1.12:${tesla_version}"
//Code chicken lib, GTCE dependency
implementation rfg.deobf("curse.maven:CCL-242818:2779848")
compileOnly "curse.maven:recipe-stages-280554:3405072"
compileOnly "curse.maven:item-stages-280316:2696769"
compileOnly "curse.maven:game-stages-268655:2951844"
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api" compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api" compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
compileOnly "curse.maven:CoFHCore-69162:2920433" compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}" compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
implementation rfg.deobf("net.sengir.forestry:forestry_${minecraft_version}:$forestry_version")
// at runtime, use the full JEI jar // at runtime, use the full JEI jar
runtimeOnly "mezz.jei:jei_${minecraft_version}:${jei_version}" runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
// unit test dependencies // unit test dependencies
testImplementation "junit:junit:4.12" testCompile "junit:junit:4.12"
} }
+19 -18
View File
@@ -16,39 +16,40 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/ */
// HWYLA task wrapper(type: Wrapper) {
tasks.register('installHwyla', Copy) { gradleVersion = "2.14"
dependsOn "deinstallHwyla"
from { configurations.mods }
include "**/*Hwyla*.jar"
into file("/run/mods")
} }
tasks.register('deinstallHwyla', Delete) { // HWYLA
delete fileTree(dir: "/run/mods", include: "*Hwyla*.jar") 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 // IC2
tasks.register('installIC2', Copy) { task installIC2(type: Copy, dependsOn: "deinstallIC2") {
dependsOn "deinstallIC2"
from { configurations.mods } from { configurations.mods }
include "**/*industrialcraft-2*.jar" include "**/*industrialcraft-2*.jar"
into file("/run/mods") into file(minecraft.runDir + "/mods")
} }
tasks.register('deinstallIC2', Delete) { task deinstallIC2(type: Delete) {
delete fileTree(dir: "/run/mods", include: "*industrialcraft-2*.jar") delete fileTree(dir: minecraft.runDir + "/mods", include: "*industrialcraft-2*.jar")
} }
// TOP // TOP
tasks.register('installTop', Copy) { task installTop(type: Copy, dependsOn: ["deinstallTop"]) {
dependsOn["deinstallTop"]
from { configurations.mods } from { configurations.mods }
include "**/*TheOneProbe*.jar" include "**/*TheOneProbe*.jar"
into file("/run/mods") into file(minecraft.runDir + "/mods")
} }
tasks.register('deinstallTop', Delete) { task deinstallTop(type: Delete) {
delete fileTree(dir: "/run/mods", include: "*TheOneProbe*.jar") delete fileTree(dir: minecraft.runDir + "/mods", include: "*TheOneProbe*.jar")
} }
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Tue Jul 04 22:38:49 CEST 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
Vendored
+110 -190
View File
@@ -1,129 +1,78 @@
#!/bin/sh #!/usr/bin/env bash
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################## ##############################################################################
# ##
# Gradle start up script for POSIX generated by Gradle. ## Gradle start up script for UN*X
# ##
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
app_path=$0 PRG="$0"
# Need this for relative symlinks.
# Need this for daisy-chained symlinks. while [ -h "$PRG" ] ; do
while ls=`ls -ld "$PRG"`
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path link=`expr "$ls" : '.*-> \(.*\)$'`
[ -h "$app_path" ] if expr "$link" : '/.*' > /dev/null; then
do PRG="$link"
ls=$( ls -ld "$app_path" ) else
link=${ls#*' -> '} PRG=`dirname "$PRG"`"/$link"
case $link in #( fi
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
# This is normally unused APP_NAME="Gradle"
# shellcheck disable=SC2034 APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD="maximum"
warn () { warn ( ) {
echo "$*" echo "$*"
} >&2 }
die () { die ( ) {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} >&2 }
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "$( uname )" in #( case "`uname`" in
CYGWIN* ) cygwin=true ;; #( CYGWIN* )
Darwin* ) darwin=true ;; #( cygwin=true
MSYS* | MINGW* ) msys=true ;; #( ;;
NONSTOP* ) nonstop=true ;; Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java JAVACMD="$JAVA_HOME/jre/sh/java"
else else
JAVACMD=$JAVA_HOME/bin/java JAVACMD="$JAVA_HOME/bin/java"
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -132,7 +81,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
@@ -140,105 +89,76 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
case $MAX_FD in #( MAX_FD_LIMIT=`ulimit -H -n`
max*) if [ $? -eq 0 ] ; then
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
# shellcheck disable=SC3045 MAX_FD="$MAX_FD_LIMIT"
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" )
fi fi
# Roll the args list around exactly as many times as the number of ulimit -n $MAX_FD
# args, so each arg winds up back in the position where it started, but if [ $? -ne 0 ] ; then
# possibly modified. warn "Could not set maximum file descriptor limit: $MAX_FD"
# fi
# NB: a `for` loop captures its iteration list before it begins, so else
# changing the positional parameters here affects neither the number of warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
# iterations, nor the values presented in `arg`. fi
shift # remove old arg fi
set -- "$@" "$arg" # push replacement arg
# 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 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 fi
# Collect all arguments for the java command; # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of function splitJvmOpts() {
# shell script including quotes and variable substitutions, so put them in JVM_OPTS=("$@")
# double quotes to make sure that they get re-expanded; and }
# * put everything else in single quotes, so that it's not re-expanded. eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
set -- \ exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+6
View File
@@ -49,6 +49,7 @@ goto fail
@rem Get command-line arguments, handling Windows variants @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
@@ -59,6 +60,11 @@ set _SKIP=2
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute :execute
@rem Setup the command line @rem Setup the command line
-26
View File
@@ -1,26 +0,0 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name 'GTNH Maven'
//noinspection HttpUrlsUsage
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol = true
//noinspection GroovyAssignabilityCheck
mavenContent {
includeGroup 'com.gtnewhorizons'
includeGroup 'com.gtnewhorizons.retrofuturagradle'
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins {
// Automatic toolchain provisioning
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
}
rootProject.name = rootProject.projectDir.getName()
-6
View File
@@ -30,7 +30,6 @@ import appeng.api.networking.IGridHelper;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
import appeng.api.parts.IPartHelper; import appeng.api.parts.IPartHelper;
import appeng.api.storage.IStorageHelper; import appeng.api.storage.IStorageHelper;
import appeng.api.util.IClientHelper;
@AEInjectable @AEInjectable
@@ -61,9 +60,4 @@ public interface IAppEngApi
*/ */
IDefinitions definitions(); IDefinitions definitions();
/**
* @return Utility methods primarily useful for client side stuff
*/
IClientHelper client();
} }
@@ -26,20 +26,5 @@ package appeng.api.config;
public enum ActionItems public enum ActionItems
{ {
WRENCH, WRENCH, CLOSE, STASH, ENCODE, SUBSTITUTION
CLOSE,
STASH,
ENCODE,
SUBSTITUTION,
MULTIPLY_BY_TWO,
MULTIPLY_BY_THREE,
INCREASE_BY_ONE,
DIVIDE_BY_TWO,
DIVIDE_BY_THREE,
DECREASE_BY_ONE,
MAX_COUNT,
FREE_MOLECULAR_SLOT_SHORTCUT,
TOGGLE_SHOW_FULL_INTERFACES_ON,
TOGGLE_SHOW_FULL_INTERFACES_OFF,
HIGHLIGHT_INTERFACE
} }
@@ -28,8 +28,7 @@ public enum PowerUnits
{ {
AE( "gui.appliedenergistics2.units.appliedenergstics" ), // Native Units - AE Energy AE( "gui.appliedenergistics2.units.appliedenergstics" ), // Native Units - AE Energy
EU( "gui.appliedenergistics2.units.ic2" ), // IndustrialCraft 2 - Energy Units EU( "gui.appliedenergistics2.units.ic2" ), // IndustrialCraft 2 - Energy Units
RF( "gui.appliedenergistics2.units.rf" ), // RF - Redstone Flux RF( "gui.appliedenergistics2.units.rf" ); // RF - Redstone Flux
GTEU( "gui.appliedenergistics2.units.gteu" ); // RF - Redstone Flux
/** /**
* unlocalized name for the power unit. * unlocalized name for the power unit.
@@ -47,13 +46,14 @@ public enum PowerUnits
/** /**
* do power conversion using AE's conversion rates. * do power conversion using AE's conversion rates.
* <p> *
* Example: PowerUnits.EU.convertTo( PowerUnits.AE, 32 ); * Example: PowerUnits.EU.convertTo( PowerUnits.AE, 32 );
* <p> *
* will normally returns 64, as it will convert the EU, to AE with AE's power settings. * will normally returns 64, as it will convert the EU, to AE with AE's power settings.
* *
* @param target target power unit * @param target target power unit
* @param value value * @param value value
*
* @return value converted to target units, from this units. * @return value converted to target units, from this units.
*/ */
public double convertTo( final PowerUnits target, final double value ) public double convertTo( final PowerUnits target, final double value )
@@ -29,7 +29,6 @@ public enum TunnelType
ME, // Network Tunnel ME, // Network Tunnel
IC2_POWER, // EU Tunnel IC2_POWER, // EU Tunnel
FE_POWER, // Forge Energy tunnel FE_POWER, // Forge Energy tunnel
GTEU_POWER, // Forge Energy tunnel
REDSTONE, // Redstone Tunnel REDSTONE, // Redstone Tunnel
FLUID, // Fluid Tunnel FLUID, // Fluid Tunnel
ITEM, // Item Tunnel ITEM, // Item Tunnel
+50 -50
View File
@@ -32,61 +32,61 @@ import net.minecraft.item.ItemStack;
import appeng.api.definitions.IItemDefinition; import appeng.api.definitions.IItemDefinition;
public enum Upgrades { public enum Upgrades
/** {
* Gold Tier Upgrades. /**
*/ * Gold Tier Upgrades.
CAPACITY(0), */
REDSTONE(0), CAPACITY( 0 ), REDSTONE( 0 ), CRAFTING( 0 ),
CRAFTING(0),
MAGNET(0),
/** /**
* Diamond Tier Upgrades. * Diamond Tier Upgrades.
*/ */
FUZZY(1), FUZZY( 1 ), SPEED( 1 ), INVERTER( 1 );
SPEED(1),
INVERTER(1),
PATTERN_EXPANSION(1),
QUANTUM_LINK(1);
private final int tier; private final int tier;
private final Map<ItemStack, Integer> supportedMax = new HashMap<>(); private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
Upgrades(final int tier) { Upgrades( final int tier )
this.tier = tier; {
} this.tier = tier;
}
/** /**
* @return list of Items/Blocks that support this upgrade, and how many it supports. * @return list of Items/Blocks that support this upgrade, and how many it supports.
*/ */
public Map<ItemStack, Integer> getSupported() { public Map<ItemStack, Integer> getSupported()
return this.supportedMax; {
} return this.supportedMax;
}
/** /**
* Registers a specific amount of this upgrade into a specific machine * Registers a specific amount of this upgrade into a specific machine
* *
* @param item machine in which this upgrade can be installed * @param item machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed * @param maxSupported amount how many upgrades can be installed
*/ */
public void registerItem(final IItemDefinition item, final int maxSupported) { public void registerItem( final IItemDefinition item, final int maxSupported )
item.maybeStack(1).ifPresent(is -> this.registerItem(is, maxSupported)); {
} item.maybeStack( 1 ).ifPresent( is -> this.registerItem( is, maxSupported ) );
}
/** /**
* Registers a specific amount of this upgrade into a specific machine * Registers a specific amount of this upgrade into a specific machine
* *
* @param stack machine in which this upgrade can be installed * @param stack machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed * @param maxSupported amount how many upgrades can be installed
*/ */
public void registerItem(final ItemStack stack, final int maxSupported) { public void registerItem( final ItemStack stack, final int maxSupported )
if (stack != null) { {
this.supportedMax.put(stack, maxSupported); if( stack != null )
} {
} this.supportedMax.put( stack, maxSupported );
}
}
public int getTier() { public int getTier()
return this.tier; {
} return this.tier;
}
} }
@@ -148,8 +148,6 @@ public interface IBlocks
ITileDefinition iface(); ITileDefinition iface();
ITileDefinition fluidIface();
ITileDefinition cellWorkbench(); ITileDefinition cellWorkbench();
ITileDefinition iOPort(); ITileDefinition iOPort();
@@ -30,7 +30,8 @@ import appeng.api.util.AEColoredItemDefinition;
/** /**
* A list of all items in AE * A list of all items in AE
*/ */
public interface IItems { public interface IItems
{
IItemDefinition certusQuartzAxe(); IItemDefinition certusQuartzAxe();
IItemDefinition certusQuartzHoe(); IItemDefinition certusQuartzHoe();
@@ -63,12 +64,6 @@ public interface IItems {
IItemDefinition wirelessTerminal(); IItemDefinition wirelessTerminal();
IItemDefinition wirelessCraftingTerminal();
IItemDefinition wirelessPatternTerminal();
IItemDefinition wirelessFluidTerminal();
IItemDefinition biometricCard(); IItemDefinition biometricCard();
IItemDefinition chargedStaff(); IItemDefinition chargedStaff();
@@ -93,14 +88,6 @@ public interface IItems {
IItemDefinition cell64k(); IItemDefinition cell64k();
IItemDefinition fluidCell1k();
IItemDefinition fluidCell4k();
IItemDefinition fluidCell16k();
IItemDefinition fluidCell64k();
IItemDefinition spatialCell2(); IItemDefinition spatialCell2();
IItemDefinition spatialCell16(); IItemDefinition spatialCell16();
@@ -27,124 +27,111 @@ package appeng.api.definitions;
/** /**
* A list of all materials in AE * A list of all materials in AE
*/ */
public interface IMaterials { public interface IMaterials
IItemDefinition cell2SpatialPart(); {
IItemDefinition cell2SpatialPart();
IItemDefinition cell16SpatialPart(); IItemDefinition cell16SpatialPart();
IItemDefinition cell128SpatialPart(); IItemDefinition cell128SpatialPart();
IItemDefinition silicon(); IItemDefinition silicon();
IItemDefinition skyDust(); IItemDefinition skyDust();
IItemDefinition calcProcessorPress(); IItemDefinition calcProcessorPress();
IItemDefinition engProcessorPress(); IItemDefinition engProcessorPress();
IItemDefinition logicProcessorPress(); IItemDefinition logicProcessorPress();
IItemDefinition calcProcessorPrint(); IItemDefinition calcProcessorPrint();
IItemDefinition engProcessorPrint(); IItemDefinition engProcessorPrint();
IItemDefinition logicProcessorPrint(); IItemDefinition logicProcessorPrint();
IItemDefinition siliconPress(); IItemDefinition siliconPress();
IItemDefinition siliconPrint(); IItemDefinition siliconPrint();
IItemDefinition namePress(); IItemDefinition namePress();
IItemDefinition logicProcessor(); IItemDefinition logicProcessor();
IItemDefinition calcProcessor(); IItemDefinition calcProcessor();
IItemDefinition engProcessor(); IItemDefinition engProcessor();
IItemDefinition basicCard(); IItemDefinition basicCard();
IItemDefinition advCard(); IItemDefinition advCard();
IItemDefinition purifiedCertusQuartzCrystal(); IItemDefinition purifiedCertusQuartzCrystal();
IItemDefinition purifiedNetherQuartzCrystal(); IItemDefinition purifiedNetherQuartzCrystal();
IItemDefinition purifiedFluixCrystal(); IItemDefinition purifiedFluixCrystal();
IItemDefinition cell1kPart(); IItemDefinition cell1kPart();
IItemDefinition cell4kPart(); IItemDefinition cell4kPart();
IItemDefinition cell16kPart(); IItemDefinition cell16kPart();
IItemDefinition cell64kPart(); IItemDefinition cell64kPart();
IItemDefinition emptyStorageCell(); IItemDefinition emptyStorageCell();
IItemDefinition cardRedstone(); IItemDefinition cardRedstone();
IItemDefinition cardSpeed(); IItemDefinition cardSpeed();
IItemDefinition cardCapacity(); IItemDefinition cardCapacity();
IItemDefinition cardPatternExpansion(); IItemDefinition cardFuzzy();
IItemDefinition cardQuantumLink(); IItemDefinition cardInverter();
IItemDefinition cardMagnet(); IItemDefinition cardCrafting();
IItemDefinition cardFuzzy(); IItemDefinition enderDust();
IItemDefinition cardInverter(); IItemDefinition flour();
IItemDefinition cardCrafting(); IItemDefinition goldDust();
IItemDefinition enderDust(); IItemDefinition ironDust();
IItemDefinition flour(); IItemDefinition fluixDust();
IItemDefinition goldDust(); IItemDefinition certusQuartzDust();
IItemDefinition ironDust(); IItemDefinition netherQuartzDust();
IItemDefinition fluixDust(); IItemDefinition matterBall();
IItemDefinition certusQuartzDust(); IItemDefinition certusQuartzCrystal();
IItemDefinition netherQuartzDust(); IItemDefinition certusQuartzCrystalCharged();
IItemDefinition matterBall(); IItemDefinition fluixCrystal();
IItemDefinition certusQuartzCrystal(); IItemDefinition fluixPearl();
IItemDefinition certusQuartzCrystalCharged(); IItemDefinition woodenGear();
IItemDefinition fluixCrystal(); IItemDefinition wirelessReceiver();
IItemDefinition fluixPearl(); IItemDefinition wirelessBooster();
IItemDefinition woodenGear(); IItemDefinition annihilationCore();
IItemDefinition wirelessReceiver(); IItemDefinition formationCore();
IItemDefinition wirelessBooster(); IItemDefinition singularity();
IItemDefinition annihilationCore(); IItemDefinition qESingularity();
IItemDefinition formationCore(); IItemDefinition blankPattern();
IItemDefinition singularity();
IItemDefinition qESingularity();
IItemDefinition blankPattern();
IItemDefinition fluidCell1kPart();
IItemDefinition fluidCell4kPart();
IItemDefinition fluidCell16kPart();
IItemDefinition fluidCell64kPart();
} }
+40 -65
View File
@@ -30,106 +30,81 @@ import appeng.api.util.AEColoredItemDefinition;
/** /**
* A list of all parts in AE * A list of all parts in AE
*/ */
public interface IParts { public interface IParts
AEColoredItemDefinition cableSmart(); {
AEColoredItemDefinition cableSmart();
AEColoredItemDefinition cableCovered(); AEColoredItemDefinition cableCovered();
AEColoredItemDefinition cableGlass(); AEColoredItemDefinition cableGlass();
AEColoredItemDefinition cableDenseCovered(); AEColoredItemDefinition cableDenseCovered();
AEColoredItemDefinition cableDenseSmart(); AEColoredItemDefinition cableDenseSmart();
AEColoredItemDefinition lumenCableSmart(); AEColoredItemDefinition lumenCableSmart();
AEColoredItemDefinition lumenCableCovered(); AEColoredItemDefinition lumenCableCovered();
AEColoredItemDefinition lumenCableGlass(); AEColoredItemDefinition lumenCableGlass();
AEColoredItemDefinition lumenDenseCableSmart(); AEColoredItemDefinition lumenDenseCableSmart();
IItemDefinition quartzFiber(); IItemDefinition quartzFiber();
IItemDefinition toggleBus(); IItemDefinition toggleBus();
IItemDefinition invertedToggleBus(); IItemDefinition invertedToggleBus();
IItemDefinition storageBus(); IItemDefinition storageBus();
IItemDefinition oreDictStorageBus(); IItemDefinition importBus();
IItemDefinition importBus(); IItemDefinition exportBus();
IItemDefinition exportBus(); IItemDefinition iface();
IItemDefinition iface(); IItemDefinition levelEmitter();
IItemDefinition fluidIface(); IItemDefinition annihilationPlane();
IItemDefinition levelEmitter(); IItemDefinition identityAnnihilationPlane();
IItemDefinition annihilationPlane(); IItemDefinition formationPlane();
IItemDefinition identityAnnihilationPlane(); IItemDefinition p2PTunnelME();
IItemDefinition formationPlane(); IItemDefinition p2PTunnelRedstone();
IItemDefinition p2PTunnelME(); IItemDefinition p2PTunnelItems();
IItemDefinition p2PTunnelRedstone(); IItemDefinition p2PTunnelFluids();
IItemDefinition p2PTunnelItems(); IItemDefinition p2PTunnelEU();
IItemDefinition p2PTunnelFluids(); IItemDefinition p2PTunnelFE();
IItemDefinition p2PTunnelEU(); IItemDefinition p2PTunnelLight();
IItemDefinition p2PTunnelFE(); // IItemDefinition p2PTunnelOpenComputers();
IItemDefinition p2PTunnelGTEU(); IItemDefinition cableAnchor();
IItemDefinition p2PTunnelLight(); IItemDefinition monitor();
// IItemDefinition p2PTunnelOpenComputers(); IItemDefinition semiDarkMonitor();
IItemDefinition cableAnchor(); IItemDefinition darkMonitor();
IItemDefinition monitor(); IItemDefinition interfaceTerminal();
IItemDefinition semiDarkMonitor(); IItemDefinition patternTerminal();
IItemDefinition darkMonitor(); IItemDefinition craftingTerminal();
IItemDefinition interfaceTerminal(); IItemDefinition terminal();
IItemDefinition patternTerminal(); IItemDefinition storageMonitor();
IItemDefinition expandedProcessingPatternTerminal(); IItemDefinition conversionMonitor();
IItemDefinition interfaceConfigurationTerminal();
IItemDefinition fluidInterfaceConfigurationTerminal();
IItemDefinition craftingTerminal();
IItemDefinition terminal();
IItemDefinition storageMonitor();
IItemDefinition conversionMonitor();
IItemDefinition fluidTerminal();
IItemDefinition fluidImportBus();
IItemDefinition fluidExportBus();
IItemDefinition fluidStorageBus();
IItemDefinition fluidLevelEmitter();
IItemDefinition fluidAnnihilationPlane();
IItemDefinition fluidFormationnPlane();
} }
@@ -47,9 +47,7 @@ public interface IP2PTunnelRegistry
* @param type - the type of tunnel. Nullable, but then ignored * @param type - the type of tunnel. Nullable, but then ignored
*/ */
void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type ); void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type );
void addNewAttunement( @Nonnull String ModId, @Nullable TunnelType type ); void addNewAttunement( @Nonnull String ModId, @Nullable TunnelType type );
void addNewAttunement( @Nonnull Capability<?> cap, @Nullable TunnelType type ); void addNewAttunement( @Nonnull Capability<?> cap, @Nullable TunnelType type );
/** /**
@@ -28,45 +28,47 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.util.IConfigManager; import appeng.api.util.IConfigManager;
import net.minecraftforge.fml.common.network.IGuiHandler;
/** /**
* A handler for a wireless terminal. * A handler for a wireless terminal.
*/ */
public interface IWirelessTermHandler extends INetworkEncodable { public interface IWirelessTermHandler extends INetworkEncodable
{
/** /**
* @param is wireless terminal * @param is wireless terminal
* @return true, if usePower, hasPower, etc... can be called for the provided item *
*/ * @return true, if usePower, hasPower, etc... can be called for the provided item
boolean canHandle(ItemStack is); */
boolean canHandle( ItemStack is );
/** /**
* use an amount of power, in AE units * use an amount of power, in AE units
* *
* @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for * @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for
* hasPower * hasPower
* @param is wireless terminal * @param is wireless terminal
* @return true if wireless terminal uses power *
*/ * @return true if wireless terminal uses power
boolean usePower(EntityPlayer player, double amount, ItemStack is); */
boolean usePower( EntityPlayer player, double amount, ItemStack is );
/** /**
* gets the power status of the item. * gets the power status of the item.
* *
* @param is wireless terminal * @param is wireless terminal
* @return returns true if there is any power left. *
*/ * @return returns true if there is any power left.
boolean hasPower(EntityPlayer player, double amount, ItemStack is); */
boolean hasPower( EntityPlayer player, double amount, ItemStack is );
/** /**
* Return the config manager for the wireless terminal. * Return the config manager for the wireless terminal.
* *
* @param is wireless terminal * @param is wireless terminal
* @return config manager of wireless terminal *
*/ * @return config manager of wireless terminal
IConfigManager getConfigManager(ItemStack is); */
IConfigManager getConfigManager( ItemStack is );
IGuiHandler getGuiHandler(ItemStack is);
} }
@@ -1,7 +0,0 @@
package appeng.api.implementations;
public interface IUpgradeableCellContainer {
int availableUpgrades();
void setupUpgrades();
}
@@ -1,41 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.implementations;
import appeng.api.config.Upgrades;
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.util.IConfigurableObject;
public interface IUpgradeableCellHost extends IConfigurableObject, ISegmentedInventory {
/**
* determine how many of an upgrade are installed.
*/
default int getInstalledUpgrades(Upgrades u) {
return 0;
}
}
@@ -28,8 +28,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import appeng.api.util.AEColor;
/** /**
* Memory Card API * Memory Card API
@@ -43,18 +41,13 @@ public interface IMemoryCard
* Configures the data stored on the memory card, the SettingsName, will be * Configures the data stored on the memory card, the SettingsName, will be
* localized when displayed. * localized when displayed.
* *
* The data can contain an optional string with the key "tooltip", which will be used as
* unlocalized string to display it after the settings name.
*
* The data can contain an optional intArray using "colorCode" to be displayed on the model itself.
* It needs to have exactly 8 elements representing the ordinal of the matching {@link AEColor}.
* The first 4 values represent the top row, left to right. The second 4 the bottom row.
*
* @param is item * @param is item
* @param settingsName unlocalized string that represents the tile entity. * @param SettingsName unlocalized string that represents the tile entity.
* @param data the NBT tag, refer to the normal comment for special keys. * @param data may contain a String called "tooltip" which is is a
* unlocalized string displayed after the settings name, optional
* but can be used to add details to the card for later.
*/ */
void setMemoryCardContents( ItemStack is, String settingsName, NBTTagCompound data ); void setMemoryCardContents( ItemStack is, String SettingsName, NBTTagCompound data );
/** /**
* returns the settings name provided by a previous call to * returns the settings name provided by a previous call to
@@ -75,17 +68,6 @@ public interface IMemoryCard
*/ */
NBTTagCompound getData( ItemStack is ); NBTTagCompound getData( ItemStack is );
/**
* This represent as 4x2 grid of {@link AEColor} without transparent/fluix color.
*
* First 4 colors are used for the top row, second for the bottom one.
*
* @param is item
*
* @return a hash representation of the memory card content
*/
AEColor[] getColorCode( ItemStack is );
/** /**
* notify the user of a outcome related to the memory card. * notify the user of a outcome related to the memory card.
* *
@@ -24,13 +24,10 @@
package appeng.api.implementations.items; package appeng.api.implementations.items;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.storage.ICellWorkbenchItem; import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.IStorageChannel; import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
/** /**
@@ -43,7 +40,7 @@ import appeng.api.storage.data.IAEStack;
* *
* The standard AE implementation only provides 1-63 Types * The standard AE implementation only provides 1-63 Types
*/ */
public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem public interface IStorageCell extends ICellWorkbenchItem
{ {
/** /**
@@ -54,7 +51,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
* *
* @return number of bytes * @return number of bytes
*/ */
int getBytes( @Nonnull ItemStack cellItem ); int getBytes( ItemStack cellItem );
/** /**
* Determines the number of bytes used for any type included on the cell. * Determines the number of bytes used for any type included on the cell.
@@ -63,7 +60,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
* *
* @return number of bytes * @return number of bytes
*/ */
int getBytesPerType( @Nonnull ItemStack cellItem ); int getBytesPerType( ItemStack cellItem );
/** /**
* Must be between 1 and 63, indicates how many types you want to store on * Must be between 1 and 63, indicates how many types you want to store on
@@ -73,7 +70,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
* *
* @return number of types * @return number of types
*/ */
int getTotalTypes( @Nonnull ItemStack cellItem ); int getTotalTypes( ItemStack cellItem );
/** /**
* Allows you to fine tune which items are allowed on a given cell, if you * Allows you to fine tune which items are allowed on a given cell, if you
@@ -85,7 +82,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
* *
* @return true to preventAdditionOfItem * @return true to preventAdditionOfItem
*/ */
boolean isBlackListed( @Nonnull ItemStack cellItem, @Nonnull T requestedAddition ); boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition );
/** /**
* Allows you to specify if this storage cell can be stored inside other * Allows you to specify if this storage cell can be stored inside other
@@ -106,16 +103,10 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
* *
* @return if the ItemStack should behavior as a storage cell. * @return if the ItemStack should behavior as a storage cell.
*/ */
boolean isStorageCell( @Nonnull ItemStack i ); boolean isStorageCell( ItemStack i );
/** /**
* @return drain in ae/t this storage cell will use. * @return drain in ae/t this storage cell will use.
*/ */
double getIdleDrain(); double getIdleDrain();
/**
* @return the type of channel your cell should be part of
*/
@Nonnull
IStorageChannel<T> getChannel();
} }
@@ -29,5 +29,5 @@ package appeng.api.implementations.items;
*/ */
public enum MemoryCardMessages public enum MemoryCardMessages
{ {
INVALID_MACHINE, SETTINGS_LOADED, SETTINGS_SAVED, SETTINGS_RESET, SETTINGS_CLEARED INVALID_MACHINE, SETTINGS_LOADED, SETTINGS_SAVED, SETTINGS_CLEARED
} }
@@ -23,7 +23,6 @@
package appeng.api.implementations.tiles; package appeng.api.implementations.tiles;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
@@ -23,7 +23,6 @@
package appeng.api.implementations.tiles; package appeng.api.implementations.tiles;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
+4 -13
View File
@@ -24,8 +24,6 @@
package appeng.api.networking; package appeng.api.networking;
import javax.annotation.Nonnull;
import appeng.api.networking.events.MENetworkEvent; import appeng.api.networking.events.MENetworkEvent;
import appeng.api.util.IReadOnlyCollection; import appeng.api.util.IReadOnlyCollection;
@@ -45,8 +43,7 @@ public interface IGrid
* *
* @return the IGridCache you requested. * @return the IGridCache you requested.
*/ */
@Nonnull <C extends IGridCache> C getCache( Class<? extends IGridCache> iface );
<C extends IGridCache> C getCache( @Nonnull Class<? extends IGridCache> iface );
/** /**
* Post an event into the network event bus. * Post an event into the network event bus.
@@ -55,8 +52,7 @@ public interface IGrid
* *
* @return returns ev back to original poster * @return returns ev back to original poster
*/ */
@Nonnull MENetworkEvent postEvent( MENetworkEvent ev );
MENetworkEvent postEvent( @Nonnull MENetworkEvent ev );
/** /**
* Post an event into the network event bus, but direct it at a single node. * Post an event into the network event bus, but direct it at a single node.
@@ -65,8 +61,7 @@ public interface IGrid
* *
* @return returns ev back to original poster * @return returns ev back to original poster
*/ */
@Nonnull MENetworkEvent postEventTo( IGridNode node, MENetworkEvent ev );
MENetworkEvent postEventTo( @Nonnull IGridNode node, @Nonnull MENetworkEvent ev );
/** /**
* get a list of the diversity of classes, you can use this to better detect which machines your interested in, * get a list of the diversity of classes, you can use this to better detect which machines your interested in,
@@ -74,7 +69,6 @@ public interface IGrid
* *
* @return IReadOnlyCollection of all available host types (Of Type IGridHost). * @return IReadOnlyCollection of all available host types (Of Type IGridHost).
*/ */
@Nonnull
IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses(); IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
/** /**
@@ -84,13 +78,11 @@ public interface IGrid
* *
* @return IMachineSet of all nodes belonging to hosts of specified class. * @return IMachineSet of all nodes belonging to hosts of specified class.
*/ */
@Nonnull IMachineSet getMachines( Class<? extends IGridHost> gridHostClass );
IMachineSet getMachines( @Nonnull Class<? extends IGridHost> gridHostClass );
/** /**
* @return IReadOnlyCollection for all nodes on the network, node visitors are preferred. * @return IReadOnlyCollection for all nodes on the network, node visitors are preferred.
*/ */
@Nonnull
IReadOnlyCollection<IGridNode> getNodes(); IReadOnlyCollection<IGridNode> getNodes();
/** /**
@@ -101,6 +93,5 @@ public interface IGrid
/** /**
* @return the node considered the pivot point of the grid. * @return the node considered the pivot point of the grid.
*/ */
@Nonnull
IGridNode getPivot(); IGridNode getPivot();
} }
@@ -26,9 +26,6 @@ package appeng.api.networking;
import java.util.EnumSet; import java.util.EnumSet;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@@ -52,7 +49,6 @@ public interface IGridBlock
* *
* @return ae/t to use. * @return ae/t to use.
*/ */
@Nonnegative
double getIdlePowerUsage(); double getIdlePowerUsage();
/** /**
@@ -60,11 +56,10 @@ public interface IGridBlock
* *
* @return Set of flags for this IGridBlock * @return Set of flags for this IGridBlock
*/ */
@Nonnull
EnumSet<GridFlags> getFlags(); EnumSet<GridFlags> getFlags();
/** /**
* Generally speaking you will return true for this, the one exception is buses, or worm holes where the node * generally speaking you will return true for this, the one exception is buses, or worm holes where the node
* represents something that isn't a real connection in the world, but rather one represented internally to the * represents something that isn't a real connection in the world, but rather one represented internally to the
* block. * block.
* *
@@ -73,46 +68,37 @@ public interface IGridBlock
boolean isWorldAccessible(); boolean isWorldAccessible();
/** /**
* Must not return when {@link #isWorldAccessible()} is true.
* Otherwise the behavior is unspecified.
*
* @return current location of this node * @return current location of this node
*/ */
@Nonnull
DimensionalCoord getLocation(); DimensionalCoord getLocation();
/** /**
* @return Transparent, or a valid color, NULL IS NOT A VALID RETURN * @return Transparent, or a valid color, NULL IS NOT A VALID RETURN
*/ */
@Nonnull
AEColor getGridColor(); AEColor getGridColor();
/** /**
* Notifies your IGridBlock that changes were made to your connections * Notifies your IGridBlock that changes were made to your connections
*/ */
void onGridNotification( @Nonnull GridNotification notification ); void onGridNotification( GridNotification notification );
/** /**
* Update Blocks network/connection/booting status. grid, * Update Blocks network/connection/booting status. grid,
* *
* @param grid grid * @param grid grid
* @param channelsInUse used channels * @param channelsInUse used channels
* @deprecated to be removed in rv7
*/ */
@Deprecated
void setNetworkStatus( IGrid grid, int channelsInUse ); void setNetworkStatus( IGrid grid, int channelsInUse );
/** /**
* Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used * Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used
* for {@link IPart} implementations. * for {@link IPart} implementations.
*/ */
@Nonnull
EnumSet<EnumFacing> getConnectableSides(); EnumSet<EnumFacing> getConnectableSides();
/** /**
* @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking. * @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking.
*/ */
@Nonnull
IGridHost getMachine(); IGridHost getMachine();
/** /**
@@ -123,8 +109,7 @@ public interface IGridBlock
/** /**
* Determines what item stack is used to render this node in the GUI. * Determines what item stack is used to render this node in the GUI.
* *
* @return the render item stack to use to render this node. Returning an empty ItemStack will not show this node. * @return the render item stack to use to render this node, null is valid, and will not show this node.
*/ */
@Nonnull
ItemStack getMachineRepresentation(); ItemStack getMachineRepresentation();
} }
@@ -24,9 +24,6 @@
package appeng.api.networking; package appeng.api.networking;
import javax.annotation.Nonnull;
/** /**
* Allows you to create a network wise service, AE2 uses these for providing * Allows you to create a network wise service, AE2 uses these for providing
* item, spatial, and tunnel services. * item, spatial, and tunnel services.
@@ -53,7 +50,7 @@ public interface IGridCache
* @param gridNode removed from that grid * @param gridNode removed from that grid
* @param machine to be removed machine * @param machine to be removed machine
*/ */
void removeNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine ); void removeNode( IGridNode gridNode, IGridHost machine );
/** /**
* informs you cache that a machine was added to the grid. * informs you cache that a machine was added to the grid.
@@ -65,7 +62,7 @@ public interface IGridCache
* @param gridNode added to grid node * @param gridNode added to grid node
* @param machine to be added machine * @param machine to be added machine
*/ */
void addNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine ); void addNode( IGridNode gridNode, IGridHost machine );
/** /**
* Called when a grid splits into two grids, AE will call a split as it * Called when a grid splits into two grids, AE will call a split as it
@@ -74,7 +71,7 @@ public interface IGridCache
* *
* @param destinationStorage storage which receives half of old grid * @param destinationStorage storage which receives half of old grid
*/ */
void onSplit( @Nonnull IGridStorage destinationStorage ); void onSplit( IGridStorage destinationStorage );
/** /**
* Called when two grids merge into one, AE will call a join as it * Called when two grids merge into one, AE will call a join as it
@@ -83,12 +80,12 @@ public interface IGridCache
* *
* @param sourceStorage old storage * @param sourceStorage old storage
*/ */
void onJoin( @Nonnull IGridStorage sourceStorage ); void onJoin( IGridStorage sourceStorage );
/** /**
* Called when saving changes, * Called when saving changes,
* *
* @param destinationStorage storage * @param destinationStorage storage
*/ */
void populateGridStorage( @Nonnull IGridStorage destinationStorage ); void populateGridStorage( IGridStorage destinationStorage );
} }
@@ -24,9 +24,7 @@
package appeng.api.networking; package appeng.api.networking;
import java.util.Map; import java.util.HashMap;
import javax.annotation.Nonnull;
/** /**
@@ -40,14 +38,14 @@ public interface IGridCacheRegistry
* *
* @param iface grid cache class * @param iface grid cache class
*/ */
void registerGridCache( @Nonnull Class<? extends IGridCache> iface, @Nonnull Class<? extends IGridCache> implementation ); void registerGridCache( Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation );
/** /**
* requests a new INSTANCE of a grid cache for use, used internally * requests a new INSTANCE of a grid cache for use, used internally
* *
* @param grid grid * @param grid grid
* *
* @return a new Map of IGridCaches from the registry, called from IGrid when constructing a new grid. * @return a new HashMap of IGridCaches from the registry, called from IGrid when constructing a new grid.
*/ */
Map<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid ); HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid );
} }
@@ -24,8 +24,6 @@
package appeng.api.networking; package appeng.api.networking;
import javax.annotation.Nonnull;
import appeng.api.util.AEPartLocation; import appeng.api.util.AEPartLocation;
@@ -47,7 +45,6 @@ public interface IGridConnection
* *
* @return the IGridNode which represents the opposite side of the connection. * @return the IGridNode which represents the opposite side of the connection.
*/ */
@Nonnull
IGridNode getOtherSide( IGridNode gridNode ); IGridNode getOtherSide( IGridNode gridNode );
/** /**
@@ -57,7 +54,6 @@ public interface IGridConnection
* *
* @return the direction of the connection, only valid for in world connections. * @return the direction of the connection, only valid for in world connections.
*/ */
@Nonnull
AEPartLocation getDirection( IGridNode gridNode ); AEPartLocation getDirection( IGridNode gridNode );
/** /**
@@ -69,13 +65,11 @@ public interface IGridConnection
/** /**
* @return node A * @return node A
*/ */
@Nonnull
IGridNode a(); IGridNode a();
/** /**
* @return node B * @return node B
*/ */
@Nonnull
IGridNode b(); IGridNode b();
/** /**
@@ -24,9 +24,6 @@
package appeng.api.networking; package appeng.api.networking;
import javax.annotation.Nonnull;
public interface IGridConnectionVisitor extends IGridVisitor public interface IGridConnectionVisitor extends IGridVisitor
{ {
@@ -35,5 +32,5 @@ public interface IGridConnectionVisitor extends IGridVisitor
* *
* @param n the connection. * @param n the connection.
*/ */
void visitConnection( @Nonnull IGridConnection n ); void visitConnection( IGridConnection n );
} }
@@ -24,8 +24,6 @@
package appeng.api.networking; package appeng.api.networking;
import javax.annotation.Nonnull;
import appeng.api.exceptions.FailedConnectionException; import appeng.api.exceptions.FailedConnectionException;
@@ -49,8 +47,7 @@ public interface IGridHelper
* *
* @return grid node of block * @return grid node of block
*/ */
@Nonnull IGridNode createGridNode( IGridBlock block );
IGridNode createGridNode( @Nonnull IGridBlock block );
/** /**
* Create a direct connection between two {@link IGridNode}. * Create a direct connection between two {@link IGridNode}.
@@ -62,7 +59,6 @@ public interface IGridHelper
* *
* @throws appeng.api.exceptions.FailedConnectionException * @throws appeng.api.exceptions.FailedConnectionException
*/ */
@Nonnull IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnectionException;
IGridConnection createGridConnection( @Nonnull IGridNode a, @Nonnull IGridNode b ) throws FailedConnectionException;
} }
@@ -24,9 +24,6 @@
package appeng.api.networking; package appeng.api.networking;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
@@ -52,8 +49,7 @@ public interface IGridHost
* @return a new IGridNode, create these with * @return a new IGridNode, create these with
* AEApi.INSTANCE().createGridNode( MyIGridBlock ) * AEApi.INSTANCE().createGridNode( MyIGridBlock )
*/ */
@Nullable IGridNode getGridNode( AEPartLocation dir );
IGridNode getGridNode( @Nonnull AEPartLocation dir );
/** /**
* Determines how cables render when they connect to this block. Priority is * Determines how cables render when they connect to this block. Priority is
@@ -61,8 +57,7 @@ public interface IGridHost
* *
* @param dir direction * @param dir direction
*/ */
@Nonnull AECableType getCableConnectionType( AEPartLocation dir );
AECableType getCableConnectionType( @Nonnull AEPartLocation dir );
/** /**
* break this host, its violating security rules, just break your block, or part. * break this host, its violating security rules, just break your block, or part.
@@ -26,8 +26,6 @@ package appeng.api.networking;
import java.util.Iterator; import java.util.Iterator;
import javax.annotation.Nonnull;
/** /**
* An extension of IGridBlock, only means something when your getFlags() contains REQUIRE_CHANNEL, when done properly it * An extension of IGridBlock, only means something when your getFlags() contains REQUIRE_CHANNEL, when done properly it
@@ -42,6 +40,5 @@ public interface IGridMultiblock extends IGridBlock
* *
* @return an iterator that will iterate all the nodes for the multiblock. ( read-only iterator expected. ) * @return an iterator that will iterate all the nodes for the multiblock. ( read-only iterator expected. )
*/ */
@Nonnull
Iterator<IGridNode> getMultiblockNodes(); Iterator<IGridNode> getMultiblockNodes();
} }
@@ -26,8 +26,6 @@ package appeng.api.networking;
import java.util.EnumSet; import java.util.EnumSet;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -52,7 +50,7 @@ public interface IGridNode
* *
* @param visitor visitor * @param visitor visitor
*/ */
void beginVisit( @Nonnull IGridVisitor visitor ); void beginVisit( IGridVisitor visitor );
/** /**
* inform the node that your IGridBlock has changed its internal state, and force the node to update. * inform the node that your IGridBlock has changed its internal state, and force the node to update.
@@ -70,7 +68,6 @@ public interface IGridNode
* *
* @return grid host * @return grid host
*/ */
@Nonnull
IGridHost getMachine(); IGridHost getMachine();
/** /**
@@ -78,7 +75,6 @@ public interface IGridNode
* *
* @return grid * @return grid
*/ */
@Nonnull
IGrid getGrid(); IGrid getGrid();
/** /**
@@ -90,13 +86,11 @@ public interface IGridNode
/** /**
* @return the world the node is located in * @return the world the node is located in
*/ */
@Nonnull
World getWorld(); World getWorld();
/** /**
* @return a set of the connected sides, INTERNAL represents an invisible connection * @return a set of the connected sides, INTERNAL represents an invisible connection
*/ */
@Nonnull
EnumSet<AEPartLocation> getConnectedSides(); EnumSet<AEPartLocation> getConnectedSides();
/** /**
@@ -104,13 +98,11 @@ public interface IGridNode
* *
* @return grid connections * @return grid connections
*/ */
@Nonnull
IReadOnlyCollection<IGridConnection> getConnections(); IReadOnlyCollection<IGridConnection> getConnections();
/** /**
* @return the IGridBlock for this node * @return the IGridBlock for this node
*/ */
@Nonnull
IGridBlock getGridBlock(); IGridBlock getGridBlock();
/** /**
@@ -130,7 +122,7 @@ public interface IGridNode
* @param name nbt name * @param name nbt name
* @param nodeData to be loaded data * @param nodeData to be loaded data
*/ */
void loadFromNBT( @Nonnull String name, @Nonnull NBTTagCompound nodeData ); void loadFromNBT( String name, NBTTagCompound nodeData );
/** /**
* this should be called for each node you maintain, you can save all your nodes to the same tag with different * this should be called for each node you maintain, you can save all your nodes to the same tag with different
@@ -139,7 +131,7 @@ public interface IGridNode
* @param name nbt name * @param name nbt name
* @param nodeData to be saved data * @param nodeData to be saved data
*/ */
void saveToNBT( @Nonnull String name, @Nonnull NBTTagCompound nodeData ); void saveToNBT( String name, NBTTagCompound nodeData );
/** /**
* @return if the node's channel requirements are currently met, use this for display purposes, use isActive for * @return if the node's channel requirements are currently met, use this for display purposes, use isActive for
@@ -154,7 +146,7 @@ public interface IGridNode
* *
* @return true if has flag * @return true if has flag
*/ */
boolean hasFlag( @Nonnull GridFlags flag ); boolean hasFlag( GridFlags flag );
/** /**
* @return the ownerID this represents the person who placed the node. * @return the ownerID this represents the person who placed the node.
@@ -24,8 +24,6 @@
package appeng.api.networking; package appeng.api.networking;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@@ -35,7 +33,6 @@ public interface IGridStorage
/** /**
* @return an NBTTagCompound that can be read, and written too. * @return an NBTTagCompound that can be read, and written too.
*/ */
@Nonnull
NBTTagCompound dataObject(); NBTTagCompound dataObject();
/** /**
@@ -24,9 +24,6 @@
package appeng.api.networking; package appeng.api.networking;
import javax.annotation.Nonnull;
/** /**
* Simple Visitor pattern access to network nodes. * Simple Visitor pattern access to network nodes.
*/ */
@@ -42,5 +39,5 @@ public interface IGridVisitor
* *
* @return true to continue visiting nodes beyond this node. * @return true to continue visiting nodes beyond this node.
*/ */
boolean visitNode( @Nonnull IGridNode n ); boolean visitNode( IGridNode n );
} }
@@ -24,8 +24,6 @@
package appeng.api.networking; package appeng.api.networking;
import javax.annotation.Nonnull;
import appeng.api.util.IReadOnlyCollection; import appeng.api.util.IReadOnlyCollection;
@@ -35,6 +33,5 @@ public interface IMachineSet extends IReadOnlyCollection<IGridNode>
/** /**
* @return the machine class for this set. * @return the machine class for this set.
*/ */
@Nonnull
Class<? extends IGridHost> getMachineClass(); Class<? extends IGridHost> getMachineClass();
} }
@@ -28,8 +28,6 @@ import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor; import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import javax.annotation.Nullable;
public interface ICraftingCPU extends IBaseMonitor<IAEItemStack> public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
{ {
@@ -58,30 +56,4 @@ public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
* @return an empty string or the name of the cpu. * @return an empty string or the name of the cpu.
*/ */
String getName(); String getName();
/**
* @return final output of the current crafting operation, or null if not crafting
*/
@Nullable
default IAEItemStack getFinalOutput()
{
return null;
}
/**
* @return remaining count of items (or other units of processing) for the current crafting job
*/
default long getRemainingItemCount()
{
return 0;
}
/**
* @return total count of items (or other units of processing) for the current crafting job
*/
default long getStartItemCount()
{
return 0;
}
} }
@@ -24,9 +24,6 @@
package appeng.api.networking.crafting; package appeng.api.networking.crafting;
import javax.annotation.Nonnull;
public interface ICraftingCallback public interface ICraftingCallback
{ {
@@ -35,5 +32,5 @@ public interface ICraftingCallback
* *
* @param job - final job * @param job - final job
*/ */
void calculationComplete( @Nonnull ICraftingJob job ); void calculationComplete( ICraftingJob job );
} }
@@ -99,18 +99,9 @@ public interface ICraftingGrid extends IGridCache
/** /**
* is this item being crafted? * is this item being crafted?
* *
* @param what item being crafted * @param aeStackInSlot item being crafted
* *
* @return true if it is being crafting * @return true if it is being crafting
*/ */
boolean isRequesting( IAEItemStack what ); boolean isRequesting( IAEItemStack aeStackInSlot );
/**
* The total amount being requested across all crafting cpus of a grid.
*
* @param what item being requested, ignores stacksize
*
* @return The total amount being requested.
*/
long requesting( IAEItemStack what );
} }
@@ -31,9 +31,6 @@ import net.minecraft.world.World;
import appeng.api.implementations.ICraftingPatternItem; import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import java.util.Collections;
import java.util.List;
/** /**
* do not implement provided by {@link ICraftingPatternItem} * do not implement provided by {@link ICraftingPatternItem}
@@ -87,11 +84,6 @@ public interface ICraftingPatternDetails
*/ */
boolean canSubstitute(); boolean canSubstitute();
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. * Allow using this INSTANCE of the pattern details to preform the crafting action with performance enhancements.
* *
@@ -24,8 +24,6 @@
package appeng.api.networking.energy; package appeng.api.networking.energy;
import javax.annotation.Nonnull;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
@@ -44,7 +42,7 @@ public interface IAEPowerStorage extends IEnergySource
* *
* @return amount of power which was unable to be stored * @return amount of power which was unable to be stored
*/ */
double injectAEPower( double amt, @Nonnull Actionable mode ); double injectAEPower( double amt, Actionable mode );
/** /**
* @return the current maximum power ( this can change :P ) * @return the current maximum power ( this can change :P )
@@ -69,6 +67,5 @@ public interface IAEPowerStorage extends IEnergySource
* *
* @return access restriction what the network can do * @return access restriction what the network can do
*/ */
@Nonnull
AccessRestriction getPowerFlow(); AccessRestriction getPowerFlow();
} }
@@ -24,9 +24,6 @@
package appeng.api.networking.energy; package appeng.api.networking.energy;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.networking.IGridCache; import appeng.api.networking.IGridCache;
import appeng.api.networking.events.MENetworkPowerStatusChange; import appeng.api.networking.events.MENetworkPowerStatusChange;
@@ -41,20 +38,17 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
/** /**
* @return the current calculated idle energy drain each tick, is used internally to drain power for each tick. * @return the current calculated idle energy drain each tick, is used internally to drain power for each tick.
*/ */
@Nonnegative
double getIdlePowerUsage(); double getIdlePowerUsage();
/** /**
* @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of * @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
* extractPower. * extractPower.
*/ */
@Nonnegative
double getAvgPowerUsage(); double getAvgPowerUsage();
/** /**
* @return the average energy injected into the system per tick, for the last 10 ticks. * @return the average energy injected into the system per tick, for the last 10 ticks.
*/ */
@Nonnegative
double getAvgPowerInjection(); double getAvgPowerInjection();
/** /**
@@ -85,15 +79,13 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
* *
* @return the amount of power that the network has OVER the limit. * @return the amount of power that the network has OVER the limit.
*/ */
@Nonnegative double injectPower( double amt, Actionable mode );
double injectPower( @Nonnegative double amt, @Nonnull Actionable mode );
/** /**
* this is should be considered an estimate, and not relied upon for real calculations. * this is should be considered an estimate, and not relied upon for real calculations.
* *
* @return estimated available power. * @return estimated available power.
*/ */
@Nonnegative
double getStoredPower(); double getStoredPower();
/** /**
@@ -101,7 +93,6 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
* *
* @return estimated available power. * @return estimated available power.
*/ */
@Nonnegative
double getMaxStoredPower(); double getMaxStoredPower();
/** /**
@@ -110,6 +101,5 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
* *
* @return Amount of power required to charge the grid, in AE. * @return Amount of power required to charge the grid, in AE.
*/ */
@Nonnegative double getEnergyDemand( double maxRequired );
double getEnergyDemand( @Nonnegative double maxRequired );
} }
@@ -24,9 +24,6 @@
package appeng.api.networking.energy; package appeng.api.networking.energy;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier; import appeng.api.config.PowerMultiplier;
@@ -42,6 +39,5 @@ public interface IEnergySource
* *
* @return returns extracted power. * @return returns extracted power.
*/ */
@Nonnegative double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier );
double extractAEPower( @Nonnegative double amt, @Nonnull Actionable mode, @Nonnull PowerMultiplier usePowerMultiplier );
} }
@@ -24,9 +24,6 @@
package appeng.api.networking.energy; package appeng.api.networking.energy;
import javax.annotation.Nonnegative;
/** /**
* DO NOT IMPLEMENT. * DO NOT IMPLEMENT.
* *
@@ -42,7 +39,7 @@ public interface IEnergyWatcher
* @param amount * @param amount
* @return true, if successfully added. * @return true, if successfully added.
*/ */
boolean add( @Nonnegative double amount ); boolean add( double amount );
/** /**
* Remove a specific threshold from the watcher. * Remove a specific threshold from the watcher.
@@ -50,7 +47,7 @@ public interface IEnergyWatcher
* @param amount * @param amount
* @return true, if successfully removed. * @return true, if successfully removed.
*/ */
boolean remove( @Nonnegative double amount ); boolean remove( double amount );
/** /**
* Removes all thresholds and resets the watcher to a clean state. * Removes all thresholds and resets the watcher to a clean state.
@@ -24,9 +24,6 @@
package appeng.api.networking.energy; package appeng.api.networking.energy;
import javax.annotation.Nonnull;
public interface IEnergyWatcherHost public interface IEnergyWatcherHost
{ {
@@ -36,12 +33,12 @@ public interface IEnergyWatcherHost
* *
* @param newWatcher new watcher * @param newWatcher new watcher
*/ */
void updateWatcher( @Nonnull IEnergyWatcher newWatcher ); void updateWatcher( IEnergyWatcher newWatcher );
/** /**
* Called when a threshold is crossed. * Called when a threshold is crossed.
* *
* @param energyGrid grid * @param energyGrid grid
*/ */
void onThresholdPass( @Nonnull IEnergyGrid energyGrid ); void onThresholdPass( IEnergyGrid energyGrid );
} }
@@ -24,8 +24,6 @@
package appeng.api.networking.pathing; package appeng.api.networking.pathing;
import javax.annotation.Nonnull;
import appeng.api.networking.IGridCache; import appeng.api.networking.IGridCache;
@@ -41,7 +39,6 @@ public interface IPathingGrid extends IGridCache
* @return the controller state of the network, useful if you want to * @return the controller state of the network, useful if you want to
* require a controller for a feature. * require a controller for a feature.
*/ */
@Nonnull
ControllerState getControllerState(); ControllerState getControllerState();
/** /**
@@ -24,8 +24,6 @@
package appeng.api.networking.security; package appeng.api.networking.security;
import javax.annotation.Nonnull;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
@@ -40,6 +38,5 @@ public interface IActionHost
* @return the the gridnode that actions from this IGridHost are preformed * @return the the gridnode that actions from this IGridHost are preformed
* by. * by.
*/ */
@Nonnull
IGridNode getActionableNode(); IGridNode getActionableNode();
} }
@@ -24,9 +24,6 @@
package appeng.api.networking.security; package appeng.api.networking.security;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
@@ -49,7 +46,7 @@ public interface ISecurityGrid extends IGridCache
* *
* @return true if the player has permissions. * @return true if the player has permissions.
*/ */
boolean hasPermission( @Nonnull EntityPlayer player, @Nonnull SecurityPermissions perm ); boolean hasPermission( EntityPlayer player, SecurityPermissions perm );
/** /**
* Check if a player has permissions. * Check if a player has permissions.
@@ -59,7 +56,7 @@ public interface ISecurityGrid extends IGridCache
* *
* @return true if the player has permissions. * @return true if the player has permissions.
*/ */
boolean hasPermission( @Nonnegative int playerID, @Nonnull SecurityPermissions perm ); boolean hasPermission( int playerID, SecurityPermissions perm );
/** /**
* @return PlayerID of the admin, or owner, this is the person who placed the security block. * @return PlayerID of the admin, or owner, this is the person who placed the security block.
@@ -25,7 +25,7 @@ package appeng.api.networking.security;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Map; import java.util.HashMap;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
@@ -48,7 +48,7 @@ public interface ISecurityProvider
* *
* @param playerPerms player permissions * @param playerPerms player permissions
*/ */
void readPermissions( Map<Integer, EnumSet<SecurityPermissions>> playerPerms ); void readPermissions( HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms );
/** /**
* @return is security on or off? * @return is security on or off?
@@ -26,8 +26,6 @@ package appeng.api.networking.security;
import java.util.EnumSet; import java.util.EnumSet;
import javax.annotation.Nonnull;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
@@ -43,5 +41,5 @@ public interface ISecurityRegistry
* @param playerID player id * @param playerID player id
* @param permissions permissions of player * @param permissions permissions of player
*/ */
void addPlayer( int playerID, @Nonnull EnumSet<SecurityPermissions> permissions ); void addPlayer( int playerID, EnumSet<SecurityPermissions> permissions );
} }
@@ -44,7 +44,10 @@ public interface IStackWatcherHost
/** /**
* Called when a watched item changes amounts. * Called when a watched item changes amounts.
* *
* @param o changed item list
* @param fullStack old stack
* @param diffStack new stack * @param diffStack new stack
* @param src action source
* @param chan storage channel * @param chan storage channel
*/ */
void onStackChange( IItemList<?> o, IAEStack<?> fullStack, IAEStack<?> diffStack, IActionSource src, IStorageChannel<?> chan ); void onStackChange( IItemList<?> o, IAEStack<?> fullStack, IAEStack<?> diffStack, IActionSource src, IStorageChannel<?> chan );
@@ -51,7 +51,6 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
* @param input injected items * @param input injected items
*/ */
void postAlterationOfStoredItems( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src ); void postAlterationOfStoredItems( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src );
void postCraftablesChanges( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src);
/** /**
* Used to add a cell provider to the storage system * Used to add a cell provider to the storage system
@@ -24,8 +24,6 @@
package appeng.api.networking.ticking; package appeng.api.networking.ticking;
import javax.annotation.Nonnull;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
@@ -47,18 +45,18 @@ public interface IGridTickable
*/ */
/** /**
* Return a valid TickingRequest to tell AE a guide for which type of * You can return null, if you wish to tick using MC's ticking mechanism, or
* responsiveness your device wants. * you can return a valid TickingRequest to tell AE a guide for which type
* of responsiveness your device wants.
* *
* This will be called for your tile any time your tile changes grids, this * this will be called for your tile any time your tile changes grids, this
* can happen at any time, so if your using the sleep feature you may wish * can happen at any time, so if your using the sleep feature you may wish
* to preserve your sleep, in the result of this method. or you can simply * to preserve your sleep, in the result of this method. or you can simply
* reset it. * reset it.
* *
* @return a valid new TickingRequest * @return null or a valid new TickingRequest
*/ */
@Nonnull TickingRequest getTickingRequest( IGridNode node );
TickingRequest getTickingRequest( @Nonnull IGridNode node );
/** /**
* AE lets you adjust your tick rate based on the results of your tick, if * AE lets you adjust your tick rate based on the results of your tick, if
@@ -69,12 +67,11 @@ public interface IGridTickable
* *
* Note: this is never called if you return null from getTickingRequest. * Note: this is never called if you return null from getTickingRequest.
* *
* @param ticksSinceLastCall the number of world ticks that were skipped since your last * @param TicksSinceLastCall the number of world ticks that were skipped since your last
* tick, you can use this to adjust speed of processing or adjust * tick, you can use this to adjust speed of processing or adjust
* your tick rate. * your tick rate.
* *
* @return tick rate adjustment. * @return tick rate adjustment.
*/ */
@Nonnull TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall );
TickRateModulation tickingRequest( @Nonnull IGridNode node, int ticksSinceLastCall );
} }
@@ -24,8 +24,6 @@
package appeng.api.networking.ticking; package appeng.api.networking.ticking;
import javax.annotation.Nonnull;
import appeng.api.networking.IGridCache; import appeng.api.networking.IGridCache;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
@@ -44,7 +42,7 @@ public interface ITickManager extends IGridCache
* *
* @param node gridnode * @param node gridnode
*/ */
boolean alertDevice( @Nonnull IGridNode node ); boolean alertDevice( IGridNode node );
/** /**
* disables ticking for your device. * disables ticking for your device.
@@ -53,7 +51,7 @@ public interface ITickManager extends IGridCache
* *
* @return if the call was successful. * @return if the call was successful.
*/ */
boolean sleepDevice( @Nonnull IGridNode node ); boolean sleepDevice( IGridNode node );
/** /**
* enables ticking for your device, undoes a sleepDevice call. * enables ticking for your device, undoes a sleepDevice call.
@@ -62,5 +60,5 @@ public interface ITickManager extends IGridCache
* *
* @return if the call was successful. * @return if the call was successful.
*/ */
boolean wakeDevice( @Nonnull IGridNode node ); boolean wakeDevice( IGridNode node );
} }
+1 -2
View File
@@ -1,4 +1,3 @@
/* /*
* The MIT License (MIT) * The MIT License (MIT)
* *
@@ -22,7 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
@API(apiVersion = "rv6", owner = "appliedenergistics2", provides = "appliedenergistics2|API") @API( apiVersion = "@aeversion@", owner = "appliedenergistics2", provides = "appliedenergistics2|API" )
package appeng.api; package appeng.api;
-43
View File
@@ -209,7 +209,6 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
* Called when you right click the part, very similar to Block.onActivateBlock * Called when you right click the part, very similar to Block.onActivateBlock
* *
* @param player right clicking player * @param player right clicking player
* @param hand hand used
* @param pos position of block * @param pos position of block
* *
* @return if your activate method performed something. * @return if your activate method performed something.
@@ -220,41 +219,12 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
* Called when you right click the part, very similar to Block.onActivateBlock * Called when you right click the part, very similar to Block.onActivateBlock
* *
* @param player shift right clicking player * @param player shift right clicking player
* @param hand hand used
* @param pos position of block * @param pos position of block
* *
* @return if your activate method performed something, you should use false unless you really need it. * @return if your activate method performed something, you should use false unless you really need it.
*/ */
boolean onShiftActivate( EntityPlayer player, EnumHand hand, Vec3d pos ); boolean onShiftActivate( EntityPlayer player, EnumHand hand, Vec3d pos );
/**
* Called when you left click the part, very similar to Block.onBlockClicked
*
* @param player left clicking player
* @param hand hand used
* @param pos position of block
*
* @return if your activate method performed something, you should use false unless you really need it.
*/
default boolean onClicked( EntityPlayer player, EnumHand hand, Vec3d pos )
{
return false;
}
/**
* Called when you shift-left click the part, very similar to Block.onBlockClicked
*
* @param player shift-left clicking player
* @param hand hand used
* @param pos position of block
*
* @return if your activate method performed something, you should use false unless you really need it.
*/
default boolean onShiftClicked( EntityPlayer player, EnumHand hand, Vec3d pos )
{
return false;
}
/** /**
* Add drops to the items being dropped into the world, if your item stores its contents when wrenched use the * Add drops to the items being dropped into the world, if your item stores its contents when wrenched use the
* wrenched boolean to control what data is saved vs dropped when it is broken. * wrenched boolean to control what data is saved vs dropped when it is broken.
@@ -292,9 +262,6 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
/** /**
* Used to determine which parts can be placed on what cables. * Used to determine which parts can be placed on what cables.
* *
* Dense cables are not allowed for functional (getGridNode returns a node) parts.
* Doing so will result in crashes.
*
* @param what placed part * @param what placed part
* *
* @return true if the part can be placed on this support. * @return true if the part can be placed on this support.
@@ -358,14 +325,4 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
return null; return null;
} }
/**
* Flag to be passed to the renderer.
*
* @return flag or null
*/
default Long getRenderFlag()
{
return null;
}
} }
@@ -1,15 +0,0 @@
package appeng.api.parts;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.block.model.BakedQuad;
public interface IPartBakedModel
{
List<BakedQuad> getPartQuads( @Nullable Long partFlags, long rand );
}
+1 -1
View File
@@ -72,7 +72,7 @@ public interface IPartHost extends ICustomCableConnection
* @return null if the item failed to add, the side it was placed on other wise ( may different for cables, * @return null if the item failed to add, the side it was placed on other wise ( may different for cables,
* {@link AEPartLocation}.UNKNOWN ) * {@link AEPartLocation}.UNKNOWN )
*/ */
AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer owner, EnumHand hand ); AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer owner, EnumHand hand );
/** /**
* Get part by side ( center is {@link AEPartLocation}.UNKNOWN ) * Get part by side ( center is {@link AEPartLocation}.UNKNOWN )
@@ -23,7 +23,6 @@
package appeng.api.parts; package appeng.api.parts;
/** /**
* TODO: Consider removing and replacing with capabilities. * TODO: Consider removing and replacing with capabilities.
*/ */
@@ -30,7 +30,6 @@ import appeng.api.exceptions.MissingIngredientException;
import appeng.api.exceptions.RecipeException; import appeng.api.exceptions.RecipeException;
import appeng.api.exceptions.RegistrationException; import appeng.api.exceptions.RegistrationException;
@Deprecated @Deprecated
public interface ICraftHandler public interface ICraftHandler
{ {
@@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientException; import appeng.api.exceptions.MissingIngredientException;
import appeng.api.exceptions.RegistrationException; import appeng.api.exceptions.RegistrationException;
@Deprecated @Deprecated
public interface IIngredient public interface IIngredient
{ {
@@ -28,7 +28,6 @@ import java.io.BufferedReader;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@Deprecated @Deprecated
public interface IRecipeLoader public interface IRecipeLoader
{ {
@@ -1,47 +0,0 @@
package appeng.api.storage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.storage.data.IAEStack;
public interface ICellGuiHandler
{
/**
* Return true if this handler can show GUI for this channel.
*
* @param channel Storage channel
* @return True if handled, else false.
*/
<T extends IAEStack<T>> boolean isHandlerFor( IStorageChannel<T> channel );
/**
* Return true to prioritize this handler for the provided {@link ItemStack}.
*
* @param is Cell ItemStack
* @return True, if specialized else false.
*/
default boolean isSpecializedFor( ItemStack is )
{
return false;
}
/**
* Called when the storage cell is placed in an ME Chest and the user tries to open the terminal side, if your item
* is not available via ME Chests simply tell the user they can't use it, or something, other wise you should open
* your gui and display the cell to the user.
*
* @param player player opening chest gui
* @param chest to be opened chest
* @param cellHandler cell handler
* @param inv inventory handler
* @param is item
* @param chan storage channel
*/
<T extends IAEStack<T>> void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler<T> inv, ItemStack is, IStorageChannel<T> chan );
}
@@ -24,8 +24,10 @@
package appeng.api.storage; package appeng.api.storage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IAEStack;
@@ -50,12 +52,26 @@ public interface ICellHandler
* *
* @param is a storage cell item. * @param is a storage cell item.
* @param host anytime the contents of your storage cell changes it should use this to request a save, please * @param host anytime the contents of your storage cell changes it should use this to request a save, please
* note, this value can be null. If provided, the host is responsible for persisting the cell content. * note, this value can be null.
* @param channel the storage channel requested. * @param channel the storage channel requested.
* *
* @return a new IMEHandler for the provided item * @return a new IMEHandler for the provided item
*/ */
<T extends IAEStack<T>> ICellInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> channel ); <T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> channel );
/**
* Called when the storage cell is planed in an ME Chest and the user tries to open the terminal side, if your item
* is not available via ME Chests simply tell the user they can't use it, or something, other wise you should open
* your gui and display the cell to the user.
*
* @param player player opening chest gui
* @param chest to be opened chest
* @param cellHandler cell handler
* @param inv inventory handler
* @param is item
* @param chan storage channel
*/
<T extends IAEStack<T>> void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler<T> inv, ItemStack is, IStorageChannel<T> chan );
/** /**
* 0 - cell is missing. * 0 - cell is missing.
@@ -71,31 +87,10 @@ public interface ICellHandler
* *
* @return get the status of the cell based on its contents. * @return get the status of the cell based on its contents.
*/ */
default <T extends IAEStack<T>> int getStatusForCell( ItemStack is, ICellInventoryHandler<T> handler ) <T extends IAEStack<T>> int getStatusForCell( ItemStack is, IMEInventory<T> handler );
{
if( handler.getCellInv() != null )
{
int val = handler.getCellInv().getStatusForCell();
if( val == 1 && handler.isPreformatted() )
{
val = 2;
}
return val;
}
return 0;
}
/** /**
* @return the ae/t to drain for this storage cell inside a chest/drive. * @return the ae/t to drain for this storage cell inside a chest/drive.
*/ */
default <T extends IAEStack<T>> double cellIdleDrain( ItemStack is, ICellInventoryHandler<T> handler ) <T extends IAEStack<T>> double cellIdleDrain( ItemStack is, IMEInventory<T> handler );
{
if( handler.getCellInv() != null )
{
return handler.getCellInv().getIdleDrain();
}
return 1.0;
}
} }
@@ -28,10 +28,10 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IAEItemStack;
public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T> public interface ICellInventory extends IMEInventory<IAEItemStack>
{ {
/** /**
@@ -40,7 +40,7 @@ public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
ItemStack getItemStack(); ItemStack getItemStack();
/** /**
* @return the ae/t to drain for this storage cell inside a chest/drive. * @return idle cost for this Storage Cell
*/ */
double getIdleDrain(); double getIdleDrain();
@@ -115,20 +115,7 @@ public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
int getUnusedItemCount(); int getUnusedItemCount();
/** /**
* 0 - cell is missing. * @return the status number for this drive.
*
* 1 - green, ( usually means available room for types or items. )
*
* 2 - orange, ( usually means available room for items, but not types. )
*
* 3 - red, ( usually means the cell is 100% full )
*
* @return get the status of the cell based on its contents.
*/ */
int getStatusForCell(); int getStatusForCell();
/**
* Tells the cell to persist to NBT
*/
void persist();
} }
@@ -24,22 +24,17 @@
package appeng.api.storage; package appeng.api.storage;
import javax.annotation.Nullable;
import appeng.api.config.IncludeExclude; import appeng.api.config.IncludeExclude;
import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IAEItemStack;
public interface ICellInventoryHandler<T extends IAEStack<T>> extends IMEInventoryHandler<T> public interface ICellInventoryHandler extends IMEInventoryHandler<IAEItemStack>
{ {
/** /**
* Get access to the ICellInventory. Can be null for custom cells.
*
* @return get access to the Cell Inventory. * @return get access to the Cell Inventory.
*/ */
@Nullable ICellInventory getCellInv();
ICellInventory<T> getCellInv();
boolean isPreformatted(); boolean isPreformatted();
@@ -24,11 +24,7 @@
package appeng.api.storage; package appeng.api.storage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import appeng.api.IAppEngApi; import appeng.api.IAppEngApi;
import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IAEStack;
@@ -46,19 +42,9 @@ public interface ICellRegistry
/** /**
* Register a new handler. * Register a new handler.
* *
* Never be call before {@link FMLInitializationEvent} was handled by AE2.
* Will throw an exception otherwise.
*
* @param handler cell handler * @param handler cell handler
*/ */
void addCellHandler( @Nonnull ICellHandler handler ); void addCellHandler( ICellHandler handler );
/**
* Register a new handler
*
* @param handler cell gui handler
*/
void addCellGuiHandler( @Nonnull ICellGuiHandler handler );
/** /**
* return true, if you can get a InventoryHandler for the item passed. * return true, if you can get a InventoryHandler for the item passed.
@@ -71,34 +57,22 @@ public interface ICellRegistry
boolean isCellHandled( ItemStack is ); boolean isCellHandled( ItemStack is );
/** /**
* get the handler, for the requested item. * get the handler, for the requested type.
* *
* @param is to be checked item * @param is to be checked item
* *
* @return the handler registered for this item type. * @return the handler registered for this item type.
*/ */
@Nullable
ICellHandler getHandler( ItemStack is ); ICellHandler getHandler( ItemStack is );
/** /**
* get the handler, for the requested channel. * returns an IMEInventoryHandler for the provided item.
*
* @param channel requested channel
* @param Cell ItemStack
* @return the handler registered for this channel.
*/
@Nullable
<T extends IAEStack<T>> ICellGuiHandler getGuiHandler( IStorageChannel<T> channel, ItemStack is );
/**
* returns an ICellInventoryHandler for the provided item by querying all registered handlers.
* *
* @param is item with inventory handler * @param is item with inventory handler
* @param host can be null. If provided, the host is responsible for persisting the cell content. * @param host can be null, or the hosting tile / part.
* @param chan the storage channel to request the handler for. * @param chan the storage channel to request the handler for.
* *
* @return new ICellInventoryHandler, or null if there isn't one. * @return new IMEInventoryHandler, or null if there isn't one.
*/ */
@Nullable <T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
<T extends IAEStack<T>> ICellInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
} }
@@ -24,19 +24,8 @@
package appeng.api.storage; package appeng.api.storage;
import javax.annotation.Nullable;
/**
* Tells the cell provider that changes have been made an the cell must be persisted
*
*/
public interface ISaveProvider public interface ISaveProvider
{ {
/**
* Cell has changed and needs to be changed. void saveChanges( IMEInventory<?> cellInventory );
*
* @param cellInventory can be null for custom cells.
*/
void saveChanges( @Nullable ICellInventory<?> cellInventory );
} }
@@ -32,9 +32,10 @@ import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.IActionSource;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList; import appeng.api.storage.data.IItemList;
@@ -55,17 +56,6 @@ public interface IStorageChannel<T extends IAEStack<T>>
return 1; return 1;
} }
/**
* The number of units (eg item count, or millibuckets) that can be stored per byte in a storage cell.
* Standard value for items is 8, and for fluids it's 8000
*
* @return number of units
*/
default int getUnitsPerByte()
{
return 8;
}
/** /**
* Create a new {@link IItemList} of the specific type. * Create a new {@link IItemList} of the specific type.
* *
@@ -78,12 +68,9 @@ public interface IStorageChannel<T extends IAEStack<T>>
* Create a new {@link IAEStack} subtype of the specific object. * Create a new {@link IAEStack} subtype of the specific object.
* *
* The parameter is unbound to allow a slightly more flexible approach. * The parameter is unbound to allow a slightly more flexible approach.
* But the general intention is about converting an {@link ItemStack} or {@link FluidStack} into the corresponding * But the general intention is about converting an {@link ItemStack} into the corresponding {@link IAEItemStack}.
* {@link IAEStack}.
* Another valid case might be to use it instead of {@link IAEStack#copy()}, but this might not be supported by all * Another valid case might be to use it instead of {@link IAEStack#copy()}, but this might not be supported by all
* types. * types.
* IAEStacks that use custom items for {@link IAEStack#asItemStackRepresentation()} must also be able to convert
* these.
* *
* @param input The object to turn into an {@link IAEStack} * @param input The object to turn into an {@link IAEStack}
* @return The converted stack or null * @return The converted stack or null
@@ -101,11 +88,29 @@ public interface IStorageChannel<T extends IAEStack<T>>
T readFromPacket( @Nonnull ByteBuf input ) throws IOException; T readFromPacket( @Nonnull ByteBuf input ) throws IOException;
/** /**
* create from nbt data * use energy from energy, to remove request items from cell, at the request of src.
* *
* @param nbt * @param energy to be drained energy source
* @return * @param cell cell of requested items
* @param request requested items
* @param src action source
*
* @return items that successfully extracted.
*/ */
@Nullable @Nullable
T createFromNBT( @Nonnull NBTTagCompound nbt ); T poweredExtraction( @Nonnull IEnergySource energy, @Nonnull IMEInventory<T> cell, @Nonnull T request, @Nonnull IActionSource src );
/**
* use energy from energy, to inject input items into cell, at the request of src
*
* @param energy to be added energy source
* @param cell injected cell
* @param input to be injected items
* @param src action source
*
* @return items that failed to insert.
*/
@Nullable
T poweredInsert( @Nonnull IEnergySource energy, @Nonnull IMEInventory<T> cell, @Nonnull T input, @Nonnull IActionSource src );
} }
@@ -28,15 +28,10 @@ import java.util.Collection;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import appeng.api.config.Actionable;
import appeng.api.networking.crafting.ICraftingLink; import appeng.api.networking.crafting.ICraftingLink;
import appeng.api.networking.crafting.ICraftingRequester; import appeng.api.networking.crafting.ICraftingRequester;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IAEStack;
@@ -95,38 +90,4 @@ public interface IStorageHelper
*/ */
ICraftingLink loadCraftingLink( NBTTagCompound data, ICraftingRequester req ); ICraftingLink loadCraftingLink( NBTTagCompound data, ICraftingRequester req );
/**
* Extracts items from a {@link IMEInventory} respecting power requirements.
*
* @param energy Energy source.
* @param inv Inventory to extract from.
* @param request Requested item and count.
* @param src Action source.
* @param mode Simulate or modulate
* @return extracted items or {@code null} of nothing was extracted.
*/
<T extends IAEStack<T>> T poweredExtraction( final IEnergySource energy, final IMEInventory<T> inv, final T request, final IActionSource src, final Actionable mode );
/**
* Inserts items into a {@link IMEInventory} respecting power requirements.
*
* @param energy Energy source.
* @param inv Inventory to insert into.
* @param request Items to insert.
* @param src Action source.
* @param mode Simulate or modulate
* @return items not inserted or {@code null} if everything was inserted.
*/
<T extends IAEStack<T>> T poweredInsert( final IEnergySource energy, final IMEInventory<T> inv, final T input, final IActionSource src, final Actionable mode );
/**
* Posts alteration of stored items to the provided {@link IStorageGrid}.
* This can be used by cell containers to notify the grid of storage cell changes.
*
* @param gs the storage grid.
* @param removedCell the removed cell itemstack
* @param addedCell the added cell itemstack
* @param src the action source
*/
void postChanges( @Nonnull final IStorageGrid gs, @Nonnull final ItemStack removedCell, @Nonnull final ItemStack addedCell, @Nonnull final IActionSource src );
} }
@@ -112,17 +112,4 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
* @return definition stack * @return definition stack
*/ */
ItemStack getDefinition(); ItemStack getDefinition();
/**
* Compare this AE item stack to another item stack, but ignores
* the amount. It checks the item type, NBT and damage values.
*
* @param is An item stack
*/
boolean equals( ItemStack is );
ItemStack getCachedItemStack( long stackSize );
void setCachedItemStack( ItemStack is );
} }
@@ -149,14 +149,16 @@ public interface IAEStack<T extends IAEStack<T>>
boolean equals( Object obj ); boolean equals( Object obj );
/** /**
* Compare the same subtype of {@link IAEStack} with another using a fuzzy comparison. * compare stacks using fuzzy logic
* *
* @param other The stack to compare. * a IAEItemStack to another AEItemStack or a ItemStack.
* @param mode Which {@link FuzzyMode} should be used. *
* @param st stacks
* @param mode used fuzzy mode
* *
* @return true if two stacks are equal based on AE Fuzzy Comparison. * @return true if two stacks are equal based on AE Fuzzy Comparison.
*/ */
boolean fuzzyComparison( T other, FuzzyMode mode ); boolean fuzzyComparison( Object st, FuzzyMode mode );
/** /**
* Slower for disk saving, but smaller/more efficient for packets. * Slower for disk saving, but smaller/more efficient for packets.
@@ -1,42 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.util;
public enum AECableSize
{
NONE,
NORMAL,
DENSE;
public static AECableSize min( AECableSize a, AECableSize b )
{
return a.compareTo( b ) < 0 ? a : b;
}
public static AECableSize max( AECableSize a, AECableSize b )
{
return a.compareTo( b ) > 0 ? a : b;
}
}
+6 -99
View File
@@ -29,32 +29,32 @@ public enum AECableType
/** /**
* No Cable present. * No Cable present.
*/ */
NONE( AECableVariant.NONE, AECableSize.NONE ), NONE,
/** /**
* Connections to this block should render as glass. * Connections to this block should render as glass.
*/ */
GLASS( AECableVariant.GLASS, AECableSize.NORMAL ), GLASS,
/** /**
* Connections to this block should render as covered. * Connections to this block should render as covered.
*/ */
COVERED( AECableVariant.COVERED, AECableSize.NORMAL ), COVERED,
/** /**
* Connections to this block should render as smart. * Connections to this block should render as smart.
*/ */
SMART( AECableVariant.SMART, AECableSize.NORMAL ), SMART,
/** /**
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels. * Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
*/ */
DENSE_COVERED( AECableVariant.COVERED, AECableSize.DENSE ), DENSE_COVERED,
/** /**
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels. * Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
*/ */
DENSE_SMART( AECableVariant.SMART, AECableSize.DENSE ); DENSE_SMART;
public static final AECableType[] VALIDCABLES = { public static final AECableType[] VALIDCABLES = {
GLASS, GLASS,
@@ -64,97 +64,4 @@ public enum AECableType
DENSE_SMART DENSE_SMART
}; };
private final AECableVariant variant;
private final AECableSize size;
private AECableType( AECableVariant variant, AECableSize size )
{
this.variant = variant;
this.size = size;
}
public AECableSize size()
{
return this.size;
}
public AECableVariant variant()
{
return this.variant;
}
public boolean isValid()
{
return this.variant != AECableVariant.NONE && this.size != AECableSize.NONE;
}
public boolean isDense()
{
return this.size == AECableSize.DENSE;
}
public boolean isSmart()
{
return this.variant == AECableVariant.SMART;
}
public static AECableType min( AECableType a, AECableType b )
{
final AECableVariant v = AECableVariant.min( a.variant(), b.variant() );
final AECableSize s = AECableSize.min( a.size(), b.size() );
return AECableType.from( v, s );
}
public static AECableType max( AECableType a, AECableType b )
{
final AECableVariant v = AECableVariant.max( a.variant(), b.variant() );
final AECableSize s = AECableSize.max( a.size(), b.size() );
return AECableType.from( v, s );
}
private static AECableType from( AECableVariant variant, AECableSize size )
{
switch( variant )
{
case GLASS:
switch( size )
{
case NORMAL:
return GLASS;
default:
break;
}
break;
case COVERED:
switch( size )
{
case NORMAL:
return COVERED;
case DENSE:
return DENSE_COVERED;
default:
break;
}
break;
case SMART:
switch( size )
{
case NORMAL:
return SMART;
case DENSE:
return DENSE_SMART;
default:
break;
}
break;
default:
break;
}
return NONE;
}
} }
@@ -1,43 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.util;
public enum AECableVariant
{
NONE,
GLASS,
COVERED,
SMART;
public static AECableVariant min( AECableVariant a, AECableVariant b )
{
return a.compareTo( b ) < 0 ? a : b;
}
public static AECableVariant max( AECableVariant a, AECableVariant b )
{
return a.compareTo( b ) > 0 ? a : b;
}
}
+6 -12
View File
@@ -74,30 +74,25 @@ public enum AEColor
TRANSPARENT( "gui.appliedenergistics2.Fluix", null, 0x1B2344, 0x895CA8, 0xD7BBEC ); TRANSPARENT( "gui.appliedenergistics2.Fluix", null, 0x1B2344, 0x895CA8, 0xD7BBEC );
public static final List<AEColor> VALID_COLORS = Arrays.asList( WHITE, ORANGE, MAGENTA, LIGHT_BLUE, YELLOW, LIME, PINK, GRAY, LIGHT_GRAY, CYAN, PURPLE, public static final List<AEColor> VALID_COLORS = Arrays.asList( WHITE, ORANGE, MAGENTA, LIGHT_BLUE, YELLOW, LIME, PINK, GRAY, LIGHT_GRAY, CYAN, PURPLE, BLUE, BROWN, GREEN, RED, BLACK );
BLUE, BROWN, GREEN, RED, BLACK );
/** /**
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #blackVariant dark * The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #blackVariant dark variant} of the apprioriate AE color.
* variant} of the apprioriate AE color.
*/ */
public static final int TINTINDEX_DARK = 1; public static final int TINTINDEX_DARK = 1;
/** /**
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #mediumVariant medium * The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #mediumVariant medium variant} of the apprioriate AE color.
* variant} of the apprioriate AE color.
*/ */
public static final int TINTINDEX_MEDIUM = 2; public static final int TINTINDEX_MEDIUM = 2;
/** /**
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #whiteVariant bright * The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get the {@link #whiteVariant bright variant} of the apprioriate AE color.
* variant} of the apprioriate AE color.
*/ */
public static final int TINTINDEX_BRIGHT = 3; public static final int TINTINDEX_BRIGHT = 3;
/** /**
* The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get a color between the * The {@link BakedQuad#getTintIndex() tint index} that can normally be used to get a color between the {@link #mediumVariant medium}
* {@link #mediumVariant medium}
* and {@link #whiteVariant bright variant} of the apprioriate AE color. * and {@link #whiteVariant bright variant} of the apprioriate AE color.
*/ */
public static final int TINTINDEX_MEDIUM_BRIGHT = 4; public static final int TINTINDEX_MEDIUM_BRIGHT = 4;
@@ -146,8 +141,7 @@ public enum AEColor
{ {
switch( tintIndex ) switch( tintIndex )
{ {
// Please note that tintindex 0 is hardcoded for the block breaking particles. Returning anything other than // Please note that tintindex 0 is hardcoded for the block breaking particles. Returning anything other than -1 for tintindex=0 here
// -1 for tintindex=0 here
// will cause issues with those particles // will cause issues with those particles
case 0: case 0:
return -1; return -1;
@@ -1,21 +0,0 @@
package appeng.api.util;
import java.util.List;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.data.IAEStack;
public interface IClientHelper
{
/**
* Add cell information to the provided list. Used for tooltip content.
*
* @param handler Cell handler.
* @param lines List of lines to add to.
*/
<T extends IAEStack<T>> void addCellInformation( ICellInventoryHandler<T> handler, List<String> lines );
}
@@ -23,10 +23,8 @@
package appeng.api.util; package appeng.api.util;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
/** /**
* Implement on Tile or part to customize if the info gui opens, or an action is preformed. * Implement on Tile or part to customize if the info gui opens, or an action is preformed.
*/ */
@@ -1,11 +0,0 @@
package com.enderio.core.common.interfaces;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public interface IOverlayRenderAware {
public void renderItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition);
}
@@ -1,143 +0,0 @@
package com.jaquadro.minecraft.storagedrawers.api.capabilities;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import javax.annotation.Nonnull;
import java.util.function.Predicate;
/**
* An interface for treating an inventory as a slotless, central repository of items.
*
* For all operations that accept a predicate, if a predicate is supplied, a stored ItemStack must pass the predicate
* in order to be considered for the given operation.
*
* An IItemRepository implementation MAY relax or eliminate its own internal tests when a predicate is supplied. If
* the predicate is derived from DefaultPredicate, then the implementation MUST apply any tests it would have applied
* had no predicate been provided at all, in addition to testing the predicate itself.
*/
public interface IItemRepository
{
/**
* Gets a list of all items in the inventory. The same item may appear multiple times with varying counts.
* @return A list of zero or more items in the inventory.
*/
@Nonnull
NonNullList<ItemRecord> getAllItems ();
/**
* Inserts an ItemStack into the inventory and returns the remainder.
*
* @param stack ItemStack to insert.
* @param simulate If true, the insertion is only simulated
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return The remaining ItemStack that was not inserted. If the entire stack was accepted, returns
* ItemStack.EMPTY instead.
*/
@Nonnull
ItemStack insertItem (@Nonnull ItemStack stack, boolean simulate, Predicate<ItemStack> predicate);
@Nonnull
default ItemStack insertItem (@Nonnull ItemStack stack, boolean simulate) {
return insertItem(stack, simulate, null);
}
/**
* Tries to extract the given ItemStack from the inventory. The returned value will be a matching ItemStack
* with a stack size equal to or less than amount, or the empty ItemStack if the item could not be found at all.
* The returned stack size may exceed the ItemStack's getMaxStackSize() value.
* @param stack The item to extract. The stack size is ignored.
* @param amount Amount to extract (may be greater than the stacks max limit)
* @param simulate If true, the extraction is only simulated
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return ItemStack extracted from the inventory, or ItemStack.EMPTY if nothing could be extracted.
*/
@Nonnull
ItemStack extractItem (@Nonnull ItemStack stack, int amount, boolean simulate, Predicate<ItemStack> predicate);
@Nonnull
default ItemStack extractItem (@Nonnull ItemStack stack, int amount, boolean simulate) {
return extractItem(stack, amount, simulate, null);
}
/**
* Gets the number of items matching the given ItemStack stored by the inventory.
* @param stack ItemStack to query.
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return The number of stored matching items. A value of Integer.MAX_VALUE may indicate an infinite item source.
*/
default int getStoredItemCount (@Nonnull ItemStack stack, Predicate<ItemStack> predicate) {
ItemStack amount = extractItem(stack, Integer.MAX_VALUE, true, predicate);
return amount.getCount();
}
default int getStoredItemCount (@Nonnull ItemStack stack) {
return getStoredItemCount(stack, null);
}
/**
* Gets the number items matching the given ItemStack that additionally still be stored by the inventory.
* Remaining capacity may include space that is internally empty or unassigned to any given item.
*
* @param stack ItemStack to query.
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return The available remaining space for matching items.
*/
default int getRemainingItemCapacity (@Nonnull ItemStack stack, Predicate<ItemStack> predicate) {
stack = stack.copy();
stack.setCount(Integer.MAX_VALUE);
ItemStack remainder = insertItem(stack, true, predicate);
return Integer.MAX_VALUE - remainder.getCount();
}
default int getRemainingItemCapacity (@Nonnull ItemStack stack) {
return getRemainingItemCapacity(stack, null);
}
/**
* Gets the total inventory capacity for items matching the given ItemStack.
* Total capacity may include space that is internally empty or unassigned to any given item.
*
* @param stack ItemStack to query.
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return The total capacity for matching items.
*/
default int getItemCapacity (@Nonnull ItemStack stack, Predicate<ItemStack> predicate) {
long capacity = getStoredItemCount(stack, predicate) + getRemainingItemCapacity(stack, predicate);
if (capacity > Integer.MAX_VALUE)
return Integer.MAX_VALUE;
return (int)capacity;
}
default int getItemCapacity (@Nonnull ItemStack stack) {
return getItemCapacity(stack, null);
}
/**
* An item record representing an item and the amount stored.
*
* The ItemStack held by itemPrototype always reports a stack size of 1.
* IT IS IMPORTANT THAT YOU NEVER MODIFY itemPrototype.
*/
class ItemRecord
{
@Nonnull
public final ItemStack itemPrototype;
public final int count;
public ItemRecord (@Nonnull ItemStack itemPrototype, int count) {
this.itemPrototype = itemPrototype;
this.count = count;
}
}
/**
* A variant of the standard Predicate interface that when passed to IItemRepository functions, will ask the
* internal default predicate to be tested in addition to the custom predicate. An IItemRepository function
* may choose to enforce its own predicate regardless.
*/
interface DefaultPredicate<T> extends Predicate<T> { }
}
@@ -1,87 +0,0 @@
package yalter.mousetweaks.api;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
/**
* This is the interface you want to implement in your GuiScreen to make it compatible with Mouse Tweaks.
* If this interface is not enough (for example, you need a custom slot click function, or if you use a custom Container
* which happens to be incompatible), check IMTModGuiContainer2Ex instead.
* If you just need to disable Mouse Tweaks or the wheel tweak, see the MouseTweaksIgnore
* or the MouseTweaksDisableWheelTweak annotations.
*/
public interface IMTModGuiContainer2 {
/**
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
*
* @return True if Mouse Tweaks should be disabled, false otherwise.
*/
boolean MT_isMouseTweaksDisabled();
/**
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
*
* @return True if the Wheel Tweak should be disabled, false otherwise.
*/
boolean MT_isWheelTweakDisabled();
/**
* Returns the Container.
*
* @return Container that is currently in use.
*/
Container MT_getContainer();
/**
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
*
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
*/
Slot MT_getSlotUnderMouse();
/**
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
*
* @param slot the slot to check
* @return True if slot is a crafting output slot.
*/
boolean MT_isCraftingOutput(Slot slot);
/**
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
* slots and the Destroy Item slot in the vanilla creative inventory.
*
* @param slot the slot to check
* @return Tru if slot should be ignored by Mouse Tweaks.
*/
boolean MT_isIgnored(Slot slot);
/**
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
* events are handled (although note these events are handled every game tick, which is far less frequent than every
* render tick).<br><br>
*
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
*
* For vanilla containers this method looks like this:
* <pre>
* this.ignoreMouseUp = true;
*
* if (this.dragSplitting) {
* if (this.dragSplittingButton == 1) {
* this.dragSplitting = false;
* return true;
* }
* }
*
* return false;
* </pre>
*
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
*/
boolean MT_disableRMBDraggingFunctionality();
}
+464 -379
View File
@@ -19,12 +19,11 @@
package appeng.block; package appeng.block;
import appeng.api.util.IOrientable; import java.util.ArrayList;
import appeng.api.util.IOrientableBlock; import java.util.List;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision; import javax.annotation.Nullable;
import appeng.util.LookDirection;
import appeng.util.Platform;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@@ -47,378 +46,464 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable; import appeng.api.util.IOrientable;
import java.util.ArrayList; import appeng.api.util.IOrientableBlock;
import java.util.List; import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision;
import appeng.util.LookDirection;
public abstract class AEBaseBlock extends Block { import appeng.util.Platform;
private boolean isOpaque = true;
private boolean isFullSize = true; public abstract class AEBaseBlock extends Block
private boolean hasSubtypes = false; {
private boolean isInventory = false;
private boolean isOpaque = true;
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB; private boolean isFullSize = true;
private boolean hasSubtypes = false;
protected AEBaseBlock(final Material mat) { private boolean isInventory = false;
super(mat);
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
if (mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS) {
this.setSoundType(SoundType.GLASS); protected AEBaseBlock( final Material mat )
} else if (mat == Material.ROCK) { {
this.setSoundType(SoundType.STONE); super( mat );
} else if (mat == Material.WOOD) {
this.setSoundType(SoundType.WOOD); if( mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS )
} else { {
this.setSoundType(SoundType.METAL); this.setSoundType( SoundType.GLASS );
} }
else if( mat == Material.ROCK )
this.setLightOpacity(255); {
this.setLightLevel(0); this.setSoundType( SoundType.STONE );
this.setHardness(2.2F); }
this.setHarvestLevel("pickaxe", 0); else if( mat == Material.WOOD )
{
// Workaround as vanilla sets it way too early. this.setSoundType( SoundType.WOOD );
this.fullBlock = this.isFullSize(); }
} else
{
@Override this.setSoundType( SoundType.METAL );
protected BlockStateContainer createBlockState() { }
return new BlockStateContainer(this, this.getAEStates());
} this.setLightOpacity( 255 );
this.setLightLevel( 0 );
@Override this.setHardness( 2.2F );
public final boolean isNormalCube(IBlockState state) { this.setHarvestLevel( "pickaxe", 0 );
return this.isFullSize() && this.isOpaque();
} // Workaround as vanilla sets it way too early.
this.fullBlock = this.isFullSize();
@Override }
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return this.boundingBox; @Override
} protected BlockStateContainer createBlockState()
{
@SuppressWarnings("deprecation") return new BlockStateContainer( this, this.getAEStates() );
@Override }
public void addCollisionBoxToList(final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, @Nullable final Entity e, boolean p_185477_7_) {
final ICustomCollision collisionHandler = this.getCustomCollision(w, pos); @Override
public final boolean isNormalCube( IBlockState state )
if (collisionHandler != null && bb != null) { {
final List<AxisAlignedBB> tmp = new ArrayList<>(); return this.isFullSize() && this.isOpaque();
collisionHandler.addCollidingBlockToList(w, pos, bb, tmp, e); }
for (final AxisAlignedBB b : tmp) {
final AxisAlignedBB offset = b.offset(pos.getX(), pos.getY(), pos.getZ()); @Override
if (bb.intersects(offset)) { public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
out.add(offset); {
} return this.boundingBox;
} }
} else {
super.addCollisionBoxToList(state, w, pos, bb, out, e, p_185477_7_); @SuppressWarnings( "deprecation" )
} @Override
} public void addCollisionBoxToList( final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, @Nullable final Entity e, boolean p_185477_7_ )
{
@SuppressWarnings("deprecation") final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
@Override
@SideOnly(Side.CLIENT) if( collisionHandler != null && bb != null )
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, final World w, final BlockPos pos) { {
final ICustomCollision collisionHandler = this.getCustomCollision(w, pos); final List<AxisAlignedBB> tmp = new ArrayList<>();
collisionHandler.addCollidingBlockToList( w, pos, bb, tmp, e );
if (collisionHandler != null) { for( final AxisAlignedBB b : tmp )
if (Platform.isClient()) { {
final EntityPlayer player = Minecraft.getMinecraft().player; final AxisAlignedBB offset = b.offset( pos.getX(), pos.getY(), pos.getZ() );
final LookDirection ld = Platform.getPlayerRay(player, Platform.getEyeOffset(player)); if( bb.intersects( offset ) )
{
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool(w, pos, Minecraft.getMinecraft().player, true); out.add( offset );
AxisAlignedBB br = null; }
}
double lastDist = 0; }
else
for (final AxisAlignedBB bb : bbs) { {
this.boundingBox = bb; super.addCollisionBoxToList( state, w, pos, bb, out, e, p_185477_7_ );
}
final RayTraceResult r = super.collisionRayTrace(state, w, pos, ld.getA(), ld.getB()); }
this.boundingBox = FULL_BLOCK_AABB; @SuppressWarnings( "deprecation" )
@Override
if (r != null) { @SideOnly( Side.CLIENT )
final double xLen = (ld.getA().x - r.hitVec.x); public AxisAlignedBB getSelectedBoundingBox( IBlockState state, final World w, final BlockPos pos )
final double yLen = (ld.getA().y - r.hitVec.y); {
final double zLen = (ld.getA().z - r.hitVec.z); final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen; if( collisionHandler != null )
{
if (br == null || lastDist > thisDist) { if( Platform.isClient() )
lastDist = thisDist; {
br = bb; final EntityPlayer player = Minecraft.getMinecraft().player;
} final LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) );
}
} final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getMinecraft().player, true );
AxisAlignedBB br = null;
if (br != null) {
br = new AxisAlignedBB(br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos double lastDist = 0;
.getY(), br.maxZ + pos.getZ());
return br; for( final AxisAlignedBB bb : bbs )
} {
} this.boundingBox = bb;
AxisAlignedBB b = null; // new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d ); final RayTraceResult r = super.collisionRayTrace( state, w, pos, ld.getA(), ld.getB() );
for (final AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool(w, pos, null, false)) { this.boundingBox = FULL_BLOCK_AABB;
if (b == null) {
b = bx; if( r != null )
continue; {
} final double xLen = ( ld.getA().x - r.hitVec.x );
final double yLen = ( ld.getA().y - r.hitVec.y );
final double minX = Math.min(b.minX, bx.minX); final double zLen = ( ld.getA().z - r.hitVec.z );
final double minY = Math.min(b.minY, bx.minY);
final double minZ = Math.min(b.minZ, bx.minZ); final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
final double maxX = Math.max(b.maxX, bx.maxX);
final double maxY = Math.max(b.maxY, bx.maxY); if( br == null || lastDist > thisDist )
final double maxZ = Math.max(b.maxZ, bx.maxZ); {
lastDist = thisDist;
b = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ); br = bb;
} }
}
if (b == null) { }
b = new AxisAlignedBB(16d, 16d, 16d, 0d, 0d, 0d);
} else { if( br != null )
b = new AxisAlignedBB(b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos {
.getZ()); br = new AxisAlignedBB( br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos
} .getY(), br.maxZ + pos.getZ() );
return br;
return b; }
} }
return super.getSelectedBoundingBox(state, w, pos); AxisAlignedBB b = null; // new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
}
for( final AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, false ) )
@Override {
public final boolean isOpaqueCube(IBlockState state) { if( b == null )
return this.isOpaque(); {
} b = bx;
continue;
@SuppressWarnings("deprecation") }
@Override
public RayTraceResult collisionRayTrace(final IBlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b) { final double minX = Math.min( b.minX, bx.minX );
final ICustomCollision collisionHandler = this.getCustomCollision(w, pos); final double minY = Math.min( b.minY, bx.minY );
final double minZ = Math.min( b.minZ, bx.minZ );
if (collisionHandler != null) { final double maxX = Math.max( b.maxX, bx.maxX );
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool(w, pos, null, true); final double maxY = Math.max( b.maxY, bx.maxY );
RayTraceResult br = null; final double maxZ = Math.max( b.maxZ, bx.maxZ );
double lastDist = 0; b = new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
}
for (final AxisAlignedBB bb : bbs) {
this.boundingBox = bb; if( b == null )
{
final RayTraceResult r = super.collisionRayTrace(state, w, pos, a, b); b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
}
this.boundingBox = FULL_BLOCK_AABB; else
{
if (r != null) { b = new AxisAlignedBB( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos
final double xLen = (a.x - r.hitVec.x); .getZ() );
final double yLen = (a.y - r.hitVec.y); }
final double zLen = (a.z - r.hitVec.z);
return b;
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen; }
if (br == null || lastDist > thisDist) {
lastDist = thisDist; return super.getSelectedBoundingBox( state, w, pos );
br = r; }
}
} @Override
} public final boolean isOpaqueCube( IBlockState state )
{
return br; return this.isOpaque();
} }
this.boundingBox = FULL_BLOCK_AABB; @SuppressWarnings( "deprecation" )
return super.collisionRayTrace(state, w, pos, a, b); @Override
} public RayTraceResult collisionRayTrace( final IBlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b )
{
@Override final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
public boolean hasComparatorInputOverride(IBlockState state) {
return this.isInventory(); if( collisionHandler != null )
} {
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, true );
@Override RayTraceResult br = null;
public int getComparatorInputOverride(IBlockState state, final World worldIn, final BlockPos pos) {
return 0; double lastDist = 0;
}
for( final AxisAlignedBB bb : bbs )
@Override {
public final boolean isNormalCube(IBlockState state, final IBlockAccess world, final BlockPos pos) { this.boundingBox = bb;
return this.isFullSize();
} final RayTraceResult r = super.collisionRayTrace( state, w, pos, a, b );
@Override this.boundingBox = FULL_BLOCK_AABB;
public boolean rotateBlock(final World w, final BlockPos pos, final EnumFacing axis) {
final IOrientable rotatable = this.getOrientable(w, pos); if( r != null )
{
if (rotatable != null && rotatable.canBeRotated()) { final double xLen = ( a.x - r.hitVec.x );
if (this.hasCustomRotation()) { final double yLen = ( a.y - r.hitVec.y );
this.customRotateBlock(rotatable, axis); final double zLen = ( a.z - r.hitVec.z );
return true;
} else { final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
EnumFacing forward = rotatable.getForward(); if( br == null || lastDist > thisDist )
EnumFacing up = rotatable.getUp(); {
lastDist = thisDist;
for (int rs = 0; rs < 4; rs++) { br = r;
forward = Platform.rotateAround(forward, axis); }
up = Platform.rotateAround(up, axis); }
}
if (this.isValidOrientation(w, pos, forward, up)) {
rotatable.setOrientation(forward, up); if( br != null )
return true; {
} return br;
} }
}
} return null;
}
return super.rotateBlock(w, pos, axis);
} this.boundingBox = FULL_BLOCK_AABB;
return super.collisionRayTrace( state, w, pos, a, b );
@Override }
public EnumFacing[] getValidRotations(final World w, final BlockPos pos) {
return new EnumFacing[0]; @Override
} public boolean hasComparatorInputOverride( IBlockState state )
{
@SideOnly(Side.CLIENT) return this.isInventory();
@Override }
public void addInformation(final ItemStack is, final World world, final List<String> lines, final ITooltipFlag advancedItemTooltips) {
@Override
} public int getComparatorInputOverride( IBlockState state, final World worldIn, final BlockPos pos )
{
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) { return 0;
return false; }
}
@Override
public final EnumFacing mapRotation(final IOrientable ori, final EnumFacing dir) { public final boolean isNormalCube( IBlockState state, final IBlockAccess world, final BlockPos pos )
// case DOWN: return bottomIcon; {
// case UP: return blockIcon; return this.isFullSize();
// case NORTH: return northIcon; }
// case SOUTH: return southIcon;
// case WEST: return sideIcon; @Override
// case EAST: return sideIcon; public boolean rotateBlock( final World w, final BlockPos pos, final EnumFacing axis )
{
final EnumFacing forward = ori.getForward(); final IOrientable rotatable = this.getOrientable( w, pos );
final EnumFacing up = ori.getUp();
if( rotatable != null && rotatable.canBeRotated() )
if (forward == null || up == null) { {
return dir; if( this.hasCustomRotation() )
} {
this.customRotateBlock( rotatable, axis );
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY(); return true;
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ(); }
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX(); else
{
EnumFacing west = null; EnumFacing forward = rotatable.getForward();
for (final EnumFacing dx : EnumFacing.VALUES) { EnumFacing up = rotatable.getUp();
if (dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z) {
west = dx; for( int rs = 0; rs < 4; rs++ )
} {
} forward = Platform.rotateAround( forward, axis );
up = Platform.rotateAround( up, axis );
if (west == null) {
return dir; if( this.isValidOrientation( w, pos, forward, up ) )
} {
rotatable.setOrientation( forward, up );
if (dir == forward) { return true;
return EnumFacing.SOUTH; }
} }
if (dir == forward.getOpposite()) { }
return EnumFacing.NORTH; }
}
return super.rotateBlock( w, pos, axis );
if (dir == up) { }
return EnumFacing.UP;
} @Override
if (dir == up.getOpposite()) { public EnumFacing[] getValidRotations( final World w, final BlockPos pos )
return EnumFacing.DOWN; {
} return new EnumFacing[0];
}
if (dir == west) {
return EnumFacing.WEST; @SideOnly( Side.CLIENT )
} @Override
if (dir == west.getOpposite()) { public void addInformation( final ItemStack is, final World world, final List<String> lines, final ITooltipFlag advancedItemTooltips )
return EnumFacing.EAST; {
}
}
return null;
} public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
@Override return false;
public String toString() { }
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]"; public final EnumFacing mapRotation( final IOrientable ori, final EnumFacing dir )
} {
// case DOWN: return bottomIcon;
protected String getUnlocalizedName(final ItemStack is) { // case UP: return blockIcon;
return this.getUnlocalizedName(); // case NORTH: return northIcon;
} // case SOUTH: return southIcon;
// case WEST: return sideIcon;
protected boolean hasCustomRotation() { // case EAST: return sideIcon;
return false;
} final EnumFacing forward = ori.getForward();
final EnumFacing up = ori.getUp();
protected void customRotateBlock(final IOrientable rotatable, final EnumFacing axis) {
if( forward == null || up == null )
} {
return dir;
protected IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) { }
if (this instanceof IOrientableBlock) {
IOrientableBlock orientable = (IOrientableBlock) this; final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
return orientable.getOrientable(w, pos); final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
} final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
return null;
} EnumFacing west = null;
for( final EnumFacing dx : EnumFacing.VALUES )
protected boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) { {
return true; if( dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z )
} {
west = dx;
protected ICustomCollision getCustomCollision(final World w, final BlockPos pos) { }
if (this instanceof ICustomCollision) { }
return (ICustomCollision) this;
} if( west == null )
return null; {
} return dir;
}
protected IProperty[] getAEStates() {
return new IProperty[0]; if( dir == forward )
} {
return EnumFacing.SOUTH;
protected boolean isOpaque() { }
return this.isOpaque; if( dir == forward.getOpposite() )
} {
return EnumFacing.NORTH;
protected boolean setOpaque(final boolean isOpaque) { }
this.isOpaque = isOpaque;
return isOpaque; if( dir == up )
} {
return EnumFacing.UP;
protected boolean hasSubtypes() { }
return this.hasSubtypes; if( dir == up.getOpposite() )
} {
return EnumFacing.DOWN;
protected void setHasSubtypes(final boolean hasSubtypes) { }
this.hasSubtypes = hasSubtypes;
} if( dir == west )
{
protected boolean isFullSize() { return EnumFacing.WEST;
return this.isFullSize; }
} if( dir == west.getOpposite() )
{
protected boolean setFullSize(final boolean isFullSize) { return EnumFacing.EAST;
this.isFullSize = isFullSize; }
return isFullSize;
} return null;
}
protected boolean isInventory() {
return this.isInventory; @Override
} public String toString()
{
protected void setInventory(final boolean isInventory) { String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
this.isInventory = isInventory; return this.getClass().getSimpleName() + "[" + regName + "]";
} }
protected String getUnlocalizedName( final ItemStack is )
{
return this.getUnlocalizedName();
}
protected boolean hasCustomRotation()
{
return false;
}
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
{
}
protected IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
{
if( this instanceof IOrientableBlock )
{
IOrientableBlock orientable = (IOrientableBlock) this;
return orientable.getOrientable( w, pos );
}
return null;
}
protected boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
{
return true;
}
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
{
if( this instanceof ICustomCollision )
{
return (ICustomCollision) this;
}
return null;
}
protected IProperty[] getAEStates()
{
return new IProperty[0];
}
protected boolean isOpaque()
{
return this.isOpaque;
}
protected boolean setOpaque( final boolean isOpaque )
{
this.isOpaque = isOpaque;
return isOpaque;
}
protected boolean hasSubtypes()
{
return this.hasSubtypes;
}
protected void setHasSubtypes( final boolean hasSubtypes )
{
this.hasSubtypes = hasSubtypes;
}
protected boolean isFullSize()
{
return this.isFullSize;
}
protected boolean setFullSize( final boolean isFullSize )
{
this.isFullSize = isFullSize;
return isFullSize;
}
protected boolean isInventory()
{
return this.isInventory;
}
protected void setInventory( final boolean isInventory )
{
this.isInventory = isInventory;
}
} }
+154 -118
View File
@@ -19,13 +19,8 @@
package appeng.block; package appeng.block;
import appeng.api.util.IOrientable; import java.util.List;
import appeng.api.util.IOrientableBlock;
import appeng.block.misc.BlockLightDetector;
import appeng.block.misc.BlockSkyCompass;
import appeng.block.networking.BlockWireless;
import appeng.me.helpers.IGridProxyable;
import appeng.tile.AEBaseTile;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
@@ -39,137 +34,178 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.misc.BlockLightDetector;
import appeng.block.misc.BlockSkyCompass;
import appeng.block.networking.BlockWireless;
import appeng.me.helpers.IGridProxyable;
import appeng.tile.AEBaseTile;
public class AEBaseItemBlock extends ItemBlock { public class AEBaseItemBlock extends ItemBlock
{
private final AEBaseBlock blockType; private final AEBaseBlock blockType;
public AEBaseItemBlock(final Block id) { public AEBaseItemBlock( final Block id )
super(id); {
this.blockType = (AEBaseBlock) id; super( id );
this.hasSubtypes = this.blockType.hasSubtypes(); this.blockType = (AEBaseBlock) id;
} this.hasSubtypes = this.blockType.hasSubtypes();
}
@Override @Override
public int getMetadata(final int dmg) { public int getMetadata( final int dmg )
if (this.hasSubtypes) { {
return dmg; if( this.hasSubtypes )
} {
return 0; return dmg;
} }
return 0;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly( Side.CLIENT )
public final void addInformation(final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips) { public final void addInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
this.addCheckedInformation(itemStack, world, toolTip, advancedTooltips); {
} this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips );
}
@SideOnly(Side.CLIENT) @SideOnly( Side.CLIENT )
public void addCheckedInformation(final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips) { public void addCheckedInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
this.blockType.addInformation(itemStack, world, toolTip, advancedTooltips); {
} this.blockType.addInformation( itemStack, world, toolTip, advancedTooltips );
}
@Override @Override
public boolean isBookEnchantable(final ItemStack itemstack1, final ItemStack itemstack2) { public boolean isBookEnchantable( final ItemStack itemstack1, final ItemStack itemstack2 )
return false; {
} return false;
}
@Override @Override
public String getUnlocalizedName(final ItemStack is) { public String getUnlocalizedName( final ItemStack is )
return this.blockType.getUnlocalizedName(is); {
} return this.blockType.getUnlocalizedName( is );
}
@Override @Override
public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final IBlockState newState) { public boolean placeBlockAt( final ItemStack stack, final EntityPlayer player, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final IBlockState newState )
EnumFacing up = null; {
EnumFacing forward = null; EnumFacing up = null;
EnumFacing forward = null;
if (this.blockType instanceof AEBaseTileBlock) { if( this.blockType instanceof AEBaseTileBlock )
if (this.blockType instanceof BlockLightDetector) { {
up = side; if( this.blockType instanceof BlockLightDetector )
if (up == EnumFacing.UP || up == EnumFacing.DOWN) { {
forward = EnumFacing.SOUTH; up = side;
} else { if( up == EnumFacing.UP || up == EnumFacing.DOWN )
forward = EnumFacing.UP; {
} forward = EnumFacing.SOUTH;
} else if (this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass) { }
forward = side; else
if (forward == EnumFacing.UP || forward == EnumFacing.DOWN) { {
up = EnumFacing.SOUTH; forward = EnumFacing.UP;
} else { }
up = EnumFacing.UP; }
} else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
} else { {
up = EnumFacing.UP; forward = side;
if( forward == EnumFacing.UP || forward == EnumFacing.DOWN )
{
up = EnumFacing.SOUTH;
}
else
{
up = EnumFacing.UP;
}
}
else
{
up = EnumFacing.UP;
final byte rotation = (byte) (MathHelper.floor((player.rotationYaw * 4F) / 360F + 2.5D) & 3); final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
switch (rotation) { switch( rotation )
default: {
case 0: default:
forward = EnumFacing.SOUTH; case 0:
break; forward = EnumFacing.SOUTH;
case 1: break;
forward = EnumFacing.WEST; case 1:
break; forward = EnumFacing.WEST;
case 2: break;
forward = EnumFacing.NORTH; case 2:
break; forward = EnumFacing.NORTH;
case 3: break;
forward = EnumFacing.EAST; case 3:
break; forward = EnumFacing.EAST;
} break;
}
if (player.rotationPitch > 65) { if( player.rotationPitch > 65 )
up = forward.getOpposite(); {
forward = EnumFacing.UP; up = forward.getOpposite();
} else if (player.rotationPitch < -65) { forward = EnumFacing.UP;
up = forward.getOpposite(); }
forward = EnumFacing.DOWN; else if( player.rotationPitch < -65 )
} {
} up = forward.getOpposite();
} forward = EnumFacing.DOWN;
}
}
}
IOrientable ori = null; IOrientable ori = null;
if (this.blockType instanceof IOrientableBlock) { if( this.blockType instanceof IOrientableBlock )
ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos); {
up = side; ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos );
forward = EnumFacing.SOUTH; up = side;
if (up.getFrontOffsetY() == 0) { forward = EnumFacing.SOUTH;
forward = EnumFacing.UP; if( up.getFrontOffsetY() == 0 )
} {
} forward = EnumFacing.UP;
}
}
if (!this.blockType.isValidOrientation(w, pos, forward, up)) { if( !this.blockType.isValidOrientation( w, pos, forward, up ) )
return false; {
} return false;
}
if (super.placeBlockAt(stack, player, w, pos, side, hitX, hitY, hitZ, newState)) { if( super.placeBlockAt( stack, player, w, pos, side, hitX, hitY, hitZ, newState ) )
if (this.blockType instanceof AEBaseTileBlock && !(this.blockType instanceof BlockLightDetector)) { {
final AEBaseTile tile = ((AEBaseTileBlock) this.blockType).getTileEntity(w, pos); if( this.blockType instanceof AEBaseTileBlock && !( this.blockType instanceof BlockLightDetector ) )
ori = tile; {
final AEBaseTile tile = ( (AEBaseTileBlock) this.blockType ).getTileEntity( w, pos );
ori = tile;
if (tile == null) { if( tile == null )
return true; {
} return true;
}
if (ori.canBeRotated() && !this.blockType.hasCustomRotation()) { if( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
ori.setOrientation(forward, up); {
} ori.setOrientation( forward, up );
}
if (tile instanceof IGridProxyable) { if( tile instanceof IGridProxyable )
((IGridProxyable) tile).getProxy().setOwner(player); {
} ( (IGridProxyable) tile ).getProxy().setOwner( player );
}
tile.onPlacement(stack, player, side); tile.onPlacement( stack, player, side );
} else if (this.blockType instanceof IOrientableBlock) { }
ori.setOrientation(forward, up); else if( this.blockType instanceof IOrientableBlock )
} {
ori.setOrientation( forward, up );
}
return true; return true;
} }
return false; return false;
} }
} }
@@ -19,14 +19,9 @@
package appeng.block; package appeng.block;
import appeng.api.config.AccessRestriction; import java.text.MessageFormat;
import appeng.api.config.Actionable; import java.util.List;
import appeng.api.config.PowerUnits;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -35,102 +30,123 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import java.text.MessageFormat; import appeng.api.config.AccessRestriction;
import java.util.List; import appeng.api.config.Actionable;
import appeng.api.config.PowerUnits;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage { public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage
{
public AEBaseItemBlockChargeable(final Block id) { public AEBaseItemBlockChargeable( final Block id )
super(id); {
} super( id );
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly( Side.CLIENT )
public void addCheckedInformation(final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips) { public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
final NBTTagCompound tag = stack.getTagCompound(); {
double internalCurrentPower = 0; final NBTTagCompound tag = stack.getTagCompound();
final double internalMaxPower = this.getMaxEnergyCapacity(); double internalCurrentPower = 0;
final double internalMaxPower = this.getMaxEnergyCapacity();
if (internalMaxPower > 0) { if( tag != null )
if (tag != null) { {
internalCurrentPower = tag.getDouble("internalCurrentPower"); internalCurrentPower = tag.getDouble( "internalCurrentPower" );
} }
final double percent = internalCurrentPower / internalMaxPower; final double percent = internalCurrentPower / internalMaxPower;
lines.add(GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower) + Platform lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
.gui_localize(PowerUnits.AE.unlocalizedName) + " - " + MessageFormat.format(" {0,number,#.##%} ", percent)); .gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
} }
}
@Override @Override
public double injectAEPower(final ItemStack is, double amount, Actionable mode) { public double injectAEPower( final ItemStack is, double amount, Actionable mode )
final double internalCurrentPower = this.getInternal(is); {
final double internalMaxPower = this.getAEMaxPower(is); final double internalCurrentPower = this.getInternal( is );
final double required = internalMaxPower - internalCurrentPower; final double internalMaxPower = this.getAEMaxPower( is );
final double overflow = Math.max(0, amount - required); final double required = internalMaxPower - internalCurrentPower;
final double overflow = Math.max( 0, amount - required );
if (mode == Actionable.MODULATE) { if( mode == Actionable.MODULATE )
final double toAdd = Math.min(required, amount); {
final double newPowerStored = internalCurrentPower + toAdd; final double toAdd = Math.min( required, amount );
final double newPowerStored = internalCurrentPower + toAdd;
this.setInternal(is, newPowerStored); this.setInternal( is, newPowerStored );
} }
return overflow; return overflow;
} }
@Override @Override
public double extractAEPower(final ItemStack is, double amount, Actionable mode) { public double extractAEPower( final ItemStack is, double amount, Actionable mode )
final double internalCurrentPower = this.getInternal(is); {
final double fulfillable = Math.min(amount, internalCurrentPower); final double internalCurrentPower = this.getInternal( is );
final double fulfillable = Math.min( amount, internalCurrentPower );
if (mode == Actionable.MODULATE) { if( mode == Actionable.MODULATE )
final double newPowerStored = internalCurrentPower - fulfillable; {
final double newPowerStored = internalCurrentPower - fulfillable;
this.setInternal(is, newPowerStored); this.setInternal( is, newPowerStored );
} }
return fulfillable; return fulfillable;
} }
@Override @Override
public double getAEMaxPower(final ItemStack is) { public double getAEMaxPower( final ItemStack is )
return this.getMaxEnergyCapacity(); {
} return this.getMaxEnergyCapacity();
}
@Override @Override
public double getAECurrentPower(final ItemStack is) { public double getAECurrentPower( final ItemStack is )
return this.getInternal(is); {
} return this.getInternal( is );
}
@Override @Override
public AccessRestriction getPowerFlow(final ItemStack is) { public AccessRestriction getPowerFlow( final ItemStack is )
return AccessRestriction.WRITE; {
} return AccessRestriction.WRITE;
}
private double getMaxEnergyCapacity() { private double getMaxEnergyCapacity()
final Block blockID = Block.getBlockFromItem(this); {
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell(); final Block blockID = Block.getBlockFromItem( this );
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
return energyCell.maybeBlock().map(block -> return energyCell.maybeBlock().map( block ->
{ {
if (blockID == block) { if( blockID == block )
return 200000; {
} else { return 200000;
return 8 * 200000; }
} else
}).orElse(0); {
} return 8 * 200000;
}
} ).orElse( 0 );
}
private double getInternal(final ItemStack is) { private double getInternal( final ItemStack is )
final NBTTagCompound nbt = Platform.openNbtData(is); {
return nbt.getDouble("internalCurrentPower"); final NBTTagCompound nbt = Platform.openNbtData( is );
} return nbt.getDouble( "internalCurrentPower" );
}
private void setInternal(final ItemStack is, final double amt) { private void setInternal( final ItemStack is, final double amt )
final NBTTagCompound nbt = Platform.openNbtData(is); {
nbt.setDouble("internalCurrentPower", amt); final NBTTagCompound nbt = Platform.openNbtData( is );
} nbt.setDouble( "internalCurrentPower", amt );
}
} }
@@ -20,38 +20,31 @@ package appeng.block;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs; import net.minecraft.block.BlockStairs;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import javax.annotation.Nonnull;
public abstract class AEBaseStairBlock extends BlockStairs { public abstract class AEBaseStairBlock extends BlockStairs
{
protected AEBaseStairBlock(final Block block, final String type) { protected AEBaseStairBlock( final Block block, final String type )
super(block.getDefaultState()); {
super( block.getDefaultState() );
Preconditions.checkNotNull(block); Preconditions.checkNotNull( block );
Preconditions.checkNotNull(block.getUnlocalizedName()); Preconditions.checkNotNull( block.getUnlocalizedName() );
Preconditions.checkArgument(block.getUnlocalizedName().length() > 0); Preconditions.checkArgument( block.getUnlocalizedName().length() > 0 );
this.setUnlocalizedName("stair." + type); this.setUnlocalizedName( "stair." + type );
this.setLightOpacity(0); this.setLightOpacity( 0 );
} }
@Override @Override
public String toString() { public String toString()
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered"; {
return this.getClass().getSimpleName() + "[" + regName + "]"; 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;
}
} }
+296 -244
View File
@@ -19,23 +19,14 @@
package appeng.block; package appeng.block;
import appeng.api.implementations.items.IMemoryCard; import java.util.ArrayList;
import appeng.api.implementations.items.MemoryCardMessages; import java.util.List;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.util.AEColor; import javax.annotation.Nonnull;
import appeng.api.util.AEPartLocation; import javax.annotation.Nullable;
import appeng.api.util.IOrientable;
import appeng.block.networking.BlockCableBus;
import appeng.core.sync.GuiBridge;
import appeng.helpers.ICustomCollision;
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
import appeng.tile.AEBaseInvTile;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
import appeng.util.SettingsFrom;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@@ -55,287 +46,348 @@ import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import javax.annotation.Nonnull; import appeng.api.implementations.items.IMemoryCard;
import javax.annotation.Nullable; import appeng.api.implementations.items.MemoryCardMessages;
import java.util.ArrayList; import appeng.api.implementations.tiles.IColorableTile;
import java.util.List; import appeng.api.util.AEColor;
import appeng.api.util.IOrientable;
import appeng.block.networking.BlockCableBus;
import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseInvTile;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
import appeng.util.SettingsFrom;
public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntityProvider { public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntityProvider
{
@Nonnull @Nonnull
private Class<? extends AEBaseTile> tileEntityType; private Class<? extends AEBaseTile> tileEntityType;
public AEBaseTileBlock(final Material mat) { public AEBaseTileBlock( final Material mat )
super(mat); {
} super( mat );
}
public static final UnlistedDirection FORWARD = new UnlistedDirection("forward"); public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
public static final UnlistedDirection UP = new UnlistedDirection("up"); public static final UnlistedDirection UP = new UnlistedDirection( "up" );
@Override @Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
// A subclass may decide it doesn't want extended block state for whatever reason {
if (!(state instanceof IExtendedBlockState)) { // A subclass may decide it doesn't want extended block state for whatever reason
return state; if( !( state instanceof IExtendedBlockState ) )
} {
return state;
}
AEBaseTile tile = this.getTileEntity(world, pos); AEBaseTile tile = this.getTileEntity( world, pos );
if (tile == null) { if( tile == null )
return state; // No info available {
} return state; // No info available
}
IExtendedBlockState extState = (IExtendedBlockState) state; IExtendedBlockState extState = (IExtendedBlockState) state;
return extState.withProperty(FORWARD, tile.getForward()).withProperty(UP, tile.getUp()); return extState.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState()
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{ {
FORWARD, return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
UP FORWARD,
}); UP
} } );
}
@Override @Override
public int getMetaFromState(IBlockState state) { public int getMetaFromState( IBlockState state )
return 0; {
} return 0;
}
// TODO : Was this change needed? // TODO : Was this change needed?
public void setTileEntity(final Class<? extends AEBaseTile> c) { public void setTileEntity( final Class<? extends AEBaseTile> c )
this.tileEntityType = c; {
this.setInventory(AEBaseInvTile.class.isAssignableFrom(c)); this.tileEntityType = c;
} this.setInventory( AEBaseInvTile.class.isAssignableFrom( c ) );
}
@Override @Override
public boolean hasTileEntity(IBlockState state) { public boolean hasTileEntity( IBlockState state )
return this.hasBlockTileEntity(); {
} return this.hasBlockTileEntity();
}
private boolean hasBlockTileEntity() { private boolean hasBlockTileEntity()
return this.tileEntityType != null; {
} return this.tileEntityType != null;
}
public Class<? extends AEBaseTile> getTileEntityClass() { public Class<? extends AEBaseTile> getTileEntityClass()
return this.tileEntityType; {
} return this.tileEntityType;
}
@Nullable @Nullable
public <T extends AEBaseTile> T getTileEntity(final IBlockAccess w, final int x, final int y, final int z) { public <T extends AEBaseTile> T getTileEntity( final IBlockAccess w, final int x, final int y, final int z )
return this.getTileEntity(w, new BlockPos(x, y, z)); {
} return this.getTileEntity( w, new BlockPos( x, y, z ) );
}
@Nullable @Nullable
public <T extends AEBaseTile> T getTileEntity(final IBlockAccess w, final BlockPos pos) { public <T extends AEBaseTile> T getTileEntity( final IBlockAccess w, final BlockPos pos )
if (!this.hasBlockTileEntity()) { {
return null; if( !this.hasBlockTileEntity() )
} {
return null;
}
final TileEntity te = w.getTileEntity(pos); final TileEntity te = w.getTileEntity( pos );
if (this.tileEntityType.isInstance(te)) { if( this.tileEntityType.isInstance( te ) )
return (T) te; {
} return (T) te;
}
return null; return null;
} }
@Override @Override
public final TileEntity createNewTileEntity(final World var1, final int var2) { public final TileEntity createNewTileEntity( final World var1, final int var2 )
if (this.hasBlockTileEntity()) { {
try { if( this.hasBlockTileEntity() )
return this.tileEntityType.newInstance(); {
} catch (final InstantiationException e) { try
throw new IllegalStateException("Failed to create a new instance of an illegal class " + this.tileEntityType, e); {
} catch (final IllegalAccessException e) { return this.tileEntityType.newInstance();
throw new IllegalStateException("Failed to create a new instance of " + this.tileEntityType + ", because lack of permissions", e); }
} catch( final InstantiationException e )
} {
throw new IllegalStateException( "Failed to create a new instance of an illegal class " + this.tileEntityType, e );
}
catch( final IllegalAccessException e )
{
throw new IllegalStateException( "Failed to create a new instance of " + this.tileEntityType + ", because lack of permissions", e );
}
}
return null; return null;
} }
@Override @Override
public void breakBlock(final World w, final BlockPos pos, final IBlockState state) { public void breakBlock( final World w, final BlockPos pos, final IBlockState state )
final AEBaseTile te = this.getTileEntity(w, pos); {
if (te != null) { final AEBaseTile te = this.getTileEntity( w, pos );
final ArrayList<ItemStack> drops = new ArrayList<>(); if( te != null )
if (te.dropItems()) { {
te.getDrops(w, pos, drops); final ArrayList<ItemStack> drops = new ArrayList<>();
} else { if( te.dropItems() )
te.getNoDrops(w, pos, drops); {
} te.getDrops( w, pos, drops );
}
else
{
te.getNoDrops( w, pos, drops );
}
// Cry ;_; ... // Cry ;_; ...
Platform.spawnDrops(w, pos, drops); Platform.spawnDrops( w, pos, drops );
} }
// super will remove the TE, as it is not an instance of BlockContainer // super will remove the TE, as it is not an instance of BlockContainer
super.breakBlock(w, pos, state); super.breakBlock( w, pos, state );
} }
@Override @Override
public final EnumFacing[] getValidRotations(final World w, final BlockPos pos) { public final EnumFacing[] getValidRotations( final World w, final BlockPos pos )
final AEBaseTile obj = this.getTileEntity(w, pos); {
if (obj != null && obj.canBeRotated()) { final AEBaseTile obj = this.getTileEntity( w, pos );
return EnumFacing.VALUES; if( obj != null && obj.canBeRotated() )
} {
return EnumFacing.VALUES;
}
return super.getValidRotations(w, pos); return super.getValidRotations( w, pos );
} }
@Override @Override
public boolean recolorBlock(final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color) { public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color )
final TileEntity te = this.getTileEntity(world, pos); {
final TileEntity te = this.getTileEntity( world, pos );
if (te instanceof IColorableTile) { if( te instanceof IColorableTile )
final IColorableTile ct = (IColorableTile) te; {
final AEColor c = ct.getColor(); final IColorableTile ct = (IColorableTile) te;
final AEColor newColor = AEColor.values()[color.getMetadata()]; final AEColor c = ct.getColor();
final AEColor newColor = AEColor.values()[color.getMetadata()];
if (c != newColor) { if( c != newColor )
ct.recolourBlock(side, newColor, null); {
return true; ct.recolourBlock( side, newColor, null );
} return true;
return false; }
} return false;
}
return super.recolorBlock(world, pos, side, color); return super.recolorBlock( world, pos, side, color );
} }
@Override @Override
public int getComparatorInputOverride(IBlockState state, final World w, final BlockPos pos) { public int getComparatorInputOverride( IBlockState state, final World w, final BlockPos pos )
final TileEntity te = this.getTileEntity(w, pos); {
if (te instanceof AEBaseInvTile) { final TileEntity te = this.getTileEntity( w, pos );
AEBaseInvTile invTile = (AEBaseInvTile) te; if( te instanceof AEBaseInvTile )
if (invTile.getInternalInventory().getSlots() > 0) { {
return ItemHandlerHelper.calcRedstoneFromInventory(invTile.getInternalInventory()); AEBaseInvTile invTile = (AEBaseInvTile) te;
} if( invTile.getInternalInventory().getSlots() > 0 )
} {
return 0; return ItemHandlerHelper.calcRedstoneFromInventory( invTile.getInternalInventory() );
} }
}
return 0;
}
@Override @Override
public boolean eventReceived(final IBlockState state, final World worldIn, final BlockPos pos, final int eventID, final int eventParam) { public boolean eventReceived( final IBlockState state, final World worldIn, final BlockPos pos, final int eventID, final int eventParam )
super.eventReceived(state, worldIn, pos, eventID, eventParam); {
final TileEntity tileentity = worldIn.getTileEntity(pos); super.eventReceived( state, worldIn, pos, eventID, eventParam );
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam); final TileEntity tileentity = worldIn.getTileEntity( pos );
} return tileentity != null ? tileentity.receiveClientEvent( eventID, eventParam ) : false;
}
@Override @Override
public void onBlockPlacedBy(final World w, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack is) { public void onBlockPlacedBy( final World w, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack is )
if (is.hasDisplayName()) { {
final TileEntity te = this.getTileEntity(w, pos); if( is.hasDisplayName() )
if (te instanceof AEBaseTile) { {
((AEBaseTile) w.getTileEntity(pos)).setName(is.getDisplayName()); final TileEntity te = this.getTileEntity( w, pos );
} if( te instanceof AEBaseTile )
} {
} ( (AEBaseTile) w.getTileEntity( pos ) ).setName( is.getDisplayName() );
}
}
}
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { public boolean onBlockActivated( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ )
ItemStack heldItem; {
if (player != null && !player.getHeldItem(hand).isEmpty()) { ItemStack heldItem;
heldItem = player.getHeldItem(hand); if( player != null && !player.getHeldItem( hand ).isEmpty() )
{
heldItem = player.getHeldItem( hand );
if (Platform.isWrench(player, heldItem, pos) && player.isSneaking()) { if( Platform.isWrench( player, heldItem, pos ) && player.isSneaking() )
final IBlockState blockState = world.getBlockState(pos); {
final Block block = blockState.getBlock(); final IBlockState blockState = world.getBlockState( pos );
final Block block = blockState.getBlock();
if (block == null) { if( block == null )
return false; {
} return false;
}
final AEBaseTile tile = this.getTileEntity(world, pos); final AEBaseTile tile = this.getTileEntity( world, pos );
if (tile == null) { if( tile == null )
return false; {
} return false;
}
if (tile instanceof TileCableBus || tile instanceof TileSkyChest) { if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
return false; {
} return false;
}
final ItemStack[] itemDropCandidates = Platform.getBlockDrops(world, pos); final ItemStack[] itemDropCandidates = Platform.getBlockDrops( world, pos );
final ItemStack op = new ItemStack(this); final ItemStack op = new ItemStack( this );
for (final ItemStack ol : itemDropCandidates) { for( final ItemStack ol : itemDropCandidates )
if (Platform.itemComparisons().isEqualItemType(ol, op)) { {
final NBTTagCompound tag = tile.downloadSettings(SettingsFrom.DISMANTLE_ITEM); if( Platform.itemComparisons().isEqualItemType( ol, op ) )
if (tag != null) { {
ol.setTagCompound(tag); final NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
} if( tag != null )
} {
} ol.setTagCompound( tag );
}
}
}
if (block.removedByPlayer(blockState, world, pos, player, false)) { if( block.removedByPlayer( blockState, world, pos, player, false ) )
final List<ItemStack> itemsToDrop = Lists.newArrayList(itemDropCandidates); {
Platform.spawnDrops(world, pos, itemsToDrop); final List<ItemStack> itemsToDrop = Lists.newArrayList( itemDropCandidates );
world.setBlockToAir(pos); Platform.spawnDrops( world, pos, itemsToDrop );
} world.setBlockToAir( pos );
}
return false; return false;
} }
if (heldItem.getItem() instanceof IMemoryCard && !(this instanceof BlockCableBus)) { if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem(); {
final AEBaseTile tileEntity = this.getTileEntity(world, pos); final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
final AEBaseTile tileEntity = this.getTileEntity( world, pos );
if (tileEntity == null) { if( tileEntity == null )
return false; {
} return false;
}
final String name = this.getUnlocalizedName(); final String name = this.getUnlocalizedName();
if (player.isSneaking()) { if( player.isSneaking() )
final NBTTagCompound data = tileEntity.downloadSettings(SettingsFrom.MEMORY_CARD); {
if (data != null) { final NBTTagCompound data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD );
memoryCard.setMemoryCardContents(heldItem, name, data); if( data != null )
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_SAVED); {
} memoryCard.setMemoryCardContents( heldItem, name, data );
} else { memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
final String savedName = memoryCard.getSettingsName(heldItem); }
final NBTTagCompound data = memoryCard.getData(heldItem); }
else
{
final String savedName = memoryCard.getSettingsName( heldItem );
final NBTTagCompound data = memoryCard.getData( heldItem );
if (this.getUnlocalizedName().equals(savedName)) { if( this.getUnlocalizedName().equals( savedName ) )
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player); {
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED); tileEntity.uploadSettings( SettingsFrom.MEMORY_CARD, data );
} else { memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE); }
} else
} {
memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
}
}
return true; return true;
} }
}
if (heldItem.getItem() instanceof ToolQuartzCuttingKnife && !(this instanceof BlockCableBus)) { return this.onActivated( world, pos, player, hand, player.getHeldItem( hand ), facing, hitX, hitY, hitZ );
if (ForgeEventFactory.onItemUseStart(player, heldItem, 1) <= 0) return false; }
final AEBaseTile tile = this.getTileEntity(world, pos);
if (tile == null) return false;
Platform.openGUI(player, tile, AEPartLocation.fromFacing(facing), GuiBridge.GUI_RENAMER);
return true;
}
}
return this.onActivated(world, pos, player, hand, player.getHeldItem(hand), facing, hitX, hitY, hitZ); @Override
} public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
{
return this.getTileEntity( w, pos );
}
@Override @Override
public IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) { public ICustomCollision getCustomCollision( final World w, final BlockPos pos )
return this.getTileEntity(w, pos); {
} final AEBaseTile te = this.getTileEntity( w, pos );
if( te instanceof ICustomCollision )
{
return (ICustomCollision) te;
}
@Override return super.getCustomCollision( w, pos );
public ICustomCollision getCustomCollision(final World w, final BlockPos pos) { }
final AEBaseTile te = this.getTileEntity(w, pos);
if (te instanceof ICustomCollision) {
return (ICustomCollision) te;
}
return super.getCustomCollision(w, pos);
}
} }
@@ -22,8 +22,10 @@ package appeng.block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public abstract class AEDecorativeBlock extends AEBaseBlock { public abstract class AEDecorativeBlock extends AEBaseBlock
public AEDecorativeBlock(final Material mat) { {
super(mat); public AEDecorativeBlock( final Material mat )
} {
super( mat );
}
} }
@@ -23,24 +23,29 @@ import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.common.property.IUnlistedProperty;
public final class UnlistedBlockAccess implements IUnlistedProperty<IBlockAccess> { public final class UnlistedBlockAccess implements IUnlistedProperty<IBlockAccess>
@Override {
public String getName() { @Override
return "ba"; public String getName()
} {
return "ba";
}
@Override @Override
public boolean isValid(final IBlockAccess value) { public boolean isValid( final IBlockAccess value )
return true; {
} return true;
}
@Override @Override
public Class<IBlockAccess> getType() { public Class<IBlockAccess> getType()
return IBlockAccess.class; {
} return IBlockAccess.class;
}
@Override @Override
public String valueToString(final IBlockAccess value) { public String valueToString( final IBlockAccess value )
return null; {
} return null;
}
} }

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