Compare commits

..
Author SHA1 Message Date
Martin Robertz b6b9f71677 Merge pull request #21 from GTNewHorizons/eio-compact-fix
eio conduct compact and fix transfer item and fluid in different dirs
2022-10-01 12:56:28 +02:00
Martin Robertz 63daee5e56 Merge pull request #20 from asdflj/master
Update and fix some bug
2022-10-01 10:49:50 +02:00
GlodBlock c6f7c17854 eio conduct compact and fix transfer item and fluid in differentdirections 2022-10-01 14:44:34 +08:00
asdflj 61ac42d270 fix MouseRegionManager can't display tooltip.
when ingredient buffer outputting fluid, the current slot is used continuously,not from first slot to start output.
2022-09-30 16:55:11 +08:00
GlodBlock 989cd173fb more sanity asm 2022-09-29 21:42:27 +08:00
asdflj 8cafbceed7 add crafting preview screen support nei bookmark 2022-09-29 19:50:22 +08:00
Martin Robertz 292a70ab6e Merge pull request #18 from asdflj/master
me dual interface add insert mode
2022-09-22 17:25:49 +02:00
Martin Robertz a575e58ac7 Merge pull request #19 from GTNewHorizons/packet
add obs check
2022-09-21 18:16:09 +02:00
GlodBlock b6e7a2f570 add obs check 2022-09-21 22:00:40 +08:00
Martin Robertz 69418714dd Merge pull request #17 from GTNewHorizons/packet
asm packet return to crafting inventory
2022-09-21 09:02:35 +02:00
GlodBlock de89faed70 . 2022-09-21 13:48:32 +08:00
asdflj 2b8c983e8a me dual interface add insert mode 2022-09-21 12:32:45 +08:00
GlodBlock 733774e7a3 asm packet return to crafting inventory 2022-09-21 00:04:41 +08:00
Martin Robertz a63add7bff Merge pull request #16 from asdflj/master
update
2022-09-17 14:17:02 +02:00
zy f6c10901d9 update
add recipe encode pattern crafting blank pattern
add control shift click to encode whole stack
fix import export nane display error
2022-09-17 20:05:30 +08:00
zy c313f51750 update
add recipe encode pattern crafting blank pattern
add control shift click to encode whole stack
fix import export nane display error
2022-09-17 19:05:31 +08:00
Martin Robertz 1d4acb8076 Merge pull request #15 from GTNewHorizons/fix/rename
Display dual interface custom name
2022-09-08 12:08:15 +02:00
DianeXD bdf3ab1a56 Display dual interface custom name 2022-09-07 21:18:19 +08:00
Martin Robertz b51f786f53 Merge pull request #14 from asdflj/master
update zh lang and fix import export bus shift click transfer upgrade card
2022-09-04 17:49:39 +02:00
asdflj 6d5c8ca435 Update zh_CN.lang 2022-09-04 19:03:33 +08:00
zy 9d6c0b4c56 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/main/java/com/glodblock/github/client/gui/container/ContainerFluidConfigurable.java
2022-09-03 20:20:49 +08:00
zy 49181f3df6 add fluid bus shift click transfer upgrade card into the slot 2022-09-03 20:19:38 +08:00
zy 92e5c4adc7 add fluid bus shift click transfer upgrade card into the slot 2022-09-03 18:55:42 +08:00
asdflj 409e1f2a8d Merge branch 'GTNewHorizons:master' into master 2022-09-03 03:47:32 -05:00
asdflj 15c056556d update zh_ch lang 2022-09-02 10:44:29 +08:00
Martin Robertz 76f2ddf18e Merge pull request #13 from GTNewHorizons/overflow
fix int overflow in fluid storage cell
2022-09-01 11:32:26 +02:00
GlodBlock 6a69f807f1 update ec2 dep 2022-08-31 23:33:11 +08:00
GlodBlock b9d82c5da5 fix oversight in nbt load 2022-08-31 23:32:46 +08:00
GlodBlock 72270a3f64 use long for data storage 2022-08-31 23:06:09 +08:00
Yang Xizhi 89ca4b8313 fix oversight
fix https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11138
2022-08-27 17:42:26 +08:00
Martin Robertz 52031271b4 Merge pull request #12 from GTNewHorizons/oc
fix oc driver register crash
2022-08-23 08:20:11 +02:00
GlodBlock 88ccb54fe3 fix oc driver register crash 2022-08-23 10:07:01 +08:00
Martin Robertz bba4eb14cc Merge pull request #11 from GTNewHorizons/render-fix
fix render npe from certain liquids
2022-08-22 10:53:54 +02:00
GlodBlock de3715cbf3 subnet fluid check 2022-08-22 15:11:50 +08:00
GlodBlock acf8ab44d7 remove unnecessary update event 2022-08-22 14:44:46 +08:00
GlodBlock c7925b2b6c fix npe from drops render 2022-08-22 14:38:43 +08:00
Martin Robertz 72c2673768 Merge pull request #10 from GTNewHorizons/GlodBlock-patch-1
fix crash when clicking priority button in dual interface
2022-08-20 09:51:36 +02:00
Yang Xizhi a0e6277a3b fix crash when clicking priority button in dual interface
who adds the 10000 button?
2022-08-20 08:28:30 +08:00
Martin Robertz df5ee936ce Merge pull request #9 from vfyjxf/master
Allows the use of the middle mouse button to modify the number of items in the pattern.
2022-08-14 12:09:57 +02:00
Martin Robertz 19d6bb119c Merge pull request #8 from Runakai1/Terminal
Terminal
2022-08-14 12:09:24 +02:00
Runakai1 05b8538154 added another nullcheck 2022-08-14 11:16:48 +02:00
vfyjxf 48c783dd25 remove useless methods 2022-08-14 17:16:26 +08:00
Runakai1 3f15f9524b Added nullcheck 2022-08-14 11:12:13 +02:00
vfyjxf f53db65b88 Fix build failure 2022-08-14 13:31:44 +08:00
Runakai1 539538d551 Stuff Changed 2022-08-13 19:09:15 +02:00
vfyjxf dbbaea9235 Allows the use of the middle mouse button to modify the number of items in the pattern. 2022-08-14 00:44:55 +08:00
Runakai1 13a23165c2 removed unnecessary var 2022-08-13 16:22:19 +02:00
Runakai1 69fe6b2950 Removed unimportant imports 2022-08-13 15:57:26 +02:00
Runakai1 aff48957cd Merge branch 'Terminal' of https://github.com/Runakai1/AE2FluidCraft-Rework into Terminal 2022-08-13 15:44:24 +02:00
Runakai1 b3f3ecfe2e Made button functional added icon + proper functionality 2022-08-13 15:41:55 +02:00
Runakai1 2fc407ce61 Changed way to see if item is a fluid display 2022-08-13 12:25:37 +02:00
Alexandre Tardif 9834066b4b Button works! 2022-08-13 12:25:37 +02:00
Runakai1 6aa1a877e5 Test
Test
2022-08-13 12:24:07 +02:00
Runakai1 ae7de51dbf Changed way to see if item is a fluid display 2022-08-13 11:56:51 +02:00
Alexandre Tardif 4ec705dd74 Button works! 2022-08-12 18:41:48 -04:00
Runakai1 b51bff6772 Test
Test
2022-08-12 23:29:20 +02:00
Martin Robertz 1998750489 Merge pull request #7 from GlodBlock/npe
fix npe from getItem()
2022-08-05 21:08:45 +07:00
GlodBlock 220eb8016a fix npe from getitem 2022-08-05 21:13:42 +08:00
Martin Robertz a27a6f1609 Merge pull request #6 from GlodBlock/bugfix
fix drops leak to item cell when discretizer go offline
2022-08-01 14:50:45 +07:00
Yang Xizhi d91991482a Merge branch 'master' into bugfix 2022-08-01 14:57:29 +08:00
Yang Xizhi d7d22c1a3e Merge pull request #35 from GlodBlock/bugfix
fix drops leak to item cell when discretizer go offline
2022-08-01 14:53:43 +08:00
GlodBlock e8825d74e7 fix drops leak to item cell when discretizer go offline 2022-08-01 14:52:57 +08:00
Yang Xizhi 0937feb979 comment out the problemaic code
it is more tricky than me thougt...
2022-07-31 22:17:54 +08:00
Martin Robertz 8373bae017 Merge branch 'GlodBlock:1.7.10' into master 2022-07-31 13:25:23 +07:00
Martin Robertz 38accb20fb Merge pull request #5 from GlodBlock/upstream
upstream
2022-07-31 13:25:12 +07:00
Yang Xizhi c961a5d922 Merge pull request #34 from GlodBlock/bugfix
Bugfix
2022-07-30 22:36:09 +08:00
Yang Xizhi 63d12aa759 Merge branch 'upstream' into bugfix 2022-07-30 22:36:03 +08:00
Yang Xizhi 2b94b20e2e Merge pull request #33 from GlodBlock/bugfix
fix 4096k int overflow and drops
2022-07-30 22:33:36 +08:00
GlodBlock ec9f55d17a fix 4096k int overflow and drops 2022-07-30 22:32:42 +08:00
GlodBlock 3e8c507556 clean up 2022-07-30 19:03:37 +08:00
GlodBlock dc6445bb6e check nei 2022-07-29 22:10:58 +08:00
GlodBlock 510bd94c5c add ic2 nei support 2022-07-29 22:07:05 +08:00
Yang Xizhi 5ee263e9de Merge pull request #32 from GlodBlock/1.7.10
upstreamfix
2022-07-29 20:44:20 +08:00
GlodBlock e8133a8522 ignore stack size 0 2022-07-29 20:39:34 +08:00
GlodBlock 411ec67624 wwwaaaaahhh 2022-07-29 17:36:07 +08:00
GlodBlock 26bc19c207 fix craft mode 2022-07-29 17:24:59 +08:00
Yang Xizhi e241b75065 Merge pull request #31 from GlodBlock/fixstream
fix update
2022-07-27 23:29:54 +08:00
Yang Xizhi b97a0f6126 Merge branch 'upstream' into fixstream 2022-07-27 23:29:46 +08:00
GlodBlock 3d2df578a6 make dual interface use the same adpator like normal one 2022-07-27 22:23:39 +08:00
GlodBlock ea9ba2c4cc fix cell byte calulation 2022-07-26 22:05:48 +08:00
GlodBlock 56d81eef56 move block loader to postinit 2022-07-25 22:08:34 +08:00
Yang Xizhi 9fee31d784 Update GregTech5RecipeExtractor.java 2022-07-24 19:46:26 +08:00
Yang Xizhi 079e5e34c4 Merge branch 'master' into upstream 2022-07-24 19:40:51 +08:00
GlodBlock 3ebf64f38b fix wct display drops 2022-07-24 18:29:46 +08:00
GlodBlock 736a4b2051 combine button 2022-07-24 18:00:10 +08:00
GlodBlock 5747b4535b clean up reflection 2022-07-22 19:18:13 +08:00
GlodBlock 3c128450b5 creative tabs 2022-07-22 12:10:04 +08:00
Jason Mitchell 76eeeb1be9 [ci skip] Migrate github actions to GTNH-Actions-Workflows 2022-07-16 10:36:56 -07:00
Yang Xizhi 8cd24b9a3b Merge pull request #29 from mczph/1.7.10
Update zh_cn.lang 1.7.10
2022-07-15 15:48:57 +08:00
mczph f40c6477de Update zh_CN.lang 2022-07-15 15:45:04 +08:00
GlodBlock bc32f7743e update readme 2022-07-15 13:15:36 +08:00
mczph 70f9ffefc3 Update zh_CN.lang 2022-07-15 12:11:42 +08:00
mczph 6cf27b1ba5 Add files via upload 2022-07-15 12:07:11 +08:00
GlodBlock 35f2dd4073 add larger buffer 2022-07-13 21:16:19 +08:00
GlodBlock 61cdd8c487 black essentia gas from ThE 2022-07-13 20:05:14 +08:00
103 changed files with 2436 additions and 443 deletions

No files matched your search

-9
View File
@@ -1,9 +0,0 @@
directory="run/crash-reports"
if [ -d $directory ]; then
echo "Crash reports detected:"
cat $directory/*
exit 1
else
echo "No crash reports detected"
exit 0
fi
+2 -34
View File
@@ -1,5 +1,3 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build and test
@@ -11,35 +9,5 @@ on:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Run server for 1 minute
run: |
mkdir run
echo "eula=true" > run/eula.txt
timeout 60 ./gradlew runServer || true
- name: Test no crashes happend
run: |
chmod +x .github/scripts/test-no-crash-reports.sh
.github/scripts/test-no-crash-reports.sh
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
+7 -44
View File
@@ -1,51 +1,14 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release tagged build
on:
push:
tags:
- '*'
tags: [ '*' ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Release under current tag
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
prerelease: false
title: "${{ env.RELEASE_VERSION }}"
files: build/libs/*.jar
- name: Publish to Maven
run: ./gradlew publish
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
release-tags:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
secrets: inherit
-3
View File
@@ -1,3 +0,0 @@
# Any Github changes require admin approval
/.github/** @GTNewHorizons/admin
+2 -40
View File
@@ -40,46 +40,8 @@ Unofficial AE2([PAE2](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-
Official AE2 isn't supported, you can use origin [AE2FC](https://github.com/phantamanta44/ae2-fluid-crafting) if you are playing with Official AE2.
## Basic Devices
### Fluid Discretizer
The **Fluid Discretizer** is a device that, when attached to ME network, exposes the contents of its fluid storage grid as items, which take the form of "fluid drops".
It does this by functioning as a sort of storage bus: when fluid drops are removed from its storage via the item grid, it extracts the corresponding fluid from the fluid grid.
Conversely, when fluid drops inserted into its storage via the item grid, it injects the corresponding fluid into the fluid grid.
Each fluid drop is equivalent to one mB of its respective fluid, which means a full stack of them is equivalent to 64 mB.
Fluid drops have an important property: when an ME interface attempts to export fluid drops to a machine, it will attempt to convert them to fluid.
This means an interface exporting drops of gelid cryotheum into a fluid transposer will successfully fill the transposer's internal tank rather than inserting the drops as items.
This is the central mechanic that makes fluid autocrafting possible.
Note that the only way to convert between fluids and fluid drops is a discretizer attached to an ME network.
While you could theoretically use this as a very convoluted method of transporting fluids, it is not recomomended to do so.
### Fluid Pattern Encoder
Most crafting recipes involving fluids require far more than 64 mB of a particular fluid, and so the standard pattern terminal will not do for encoding such recipes into patterns.
This problem is solved by the **Fluid Pattern Encoder**, a utility that functions similarly to a pattern terminal.
When a fluid-handling item (e.g. a bucket or tank) is inserted into the crafting ingredient slots, they will be converted into an equivalent stack of the corresponding fluid drops.
Using this, patterns for recipes that require more than a stack of fluid drops can easily be encoded.
AE2 Fluid Crafting also comes with a handy JEI integration module that allows the fluid pattern encoder to encode any JEI recipe involving fluids.
This is the recommended way to play with the mod, since encoding patterns by hand is a little cumbersome.
### Fluid Pattern Terminal
Encoding recipes in a big and bulky workbench separate from the rest of your AE2 equipment can be a little inconvenient.
Luckily, we have the **Fluid Pattern Terminal**, which combines the functionality of the standard pattern terminal and the fluid pattern encoder.
Now, you can encode your fluid recipes using the same familiar interface you know and love!
### Fluid Pattern Interface
The standard ME interface lets you emit items and fluid packets with AE2FC, but it will only accept items, as in vanilla AE2.
This is a little inconvenient when you want to build compact setups for autocrafting with fluid outputs, where you would need to use both an item interface for inputs, and a separate fluid interface for outputs.
To make things easier, we have the **Fluid Pattern Interface**, which functions as a combination of an item interface and a fluid interface!
Its GUI is the same as normal ME interface, but it can emit fluids directly instead of fluid packets! It also accepts fluid and item inputs.
Automating fluid crafting machines has never been this quick and painless!
### Fluid Packets
When putting fluid pattern in a normal ME interface, it will emit fluid packets as fluid.
So if you prefer to deal with item instead of fluids, you can transport these packets and turn them back to fluid with **ME Fluid Packet Decoder**.
Simply connect the decoder to your ME network and insert the fluid packet; the decoder will, if possible, inject the fluid into your fluid storage grid.
## How to Use It
https://github.com/GlodBlock/AE2FluidCraft-Rework/wiki
## Credited Works
+8 -4
View File
@@ -2,21 +2,25 @@
dependencies {
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev')
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-87-GTNH:dev')
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-92-GTNH:dev')
compile('curse.maven:cofh-core-69162:2388751')
compile('com.github.GTNewHorizons:ExtraCells2:2.5.9:dev') {transitive = false}
compile("com.github.GTNewHorizons:ForestryMC:4.4.7:dev")
compile('com.github.GTNewHorizons:ExtraCells2:2.5.20:dev') {transitive = false}
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.8.5:dev")
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.4:dev")
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.7:dev")
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.27:dev")
compileOnly("com.github.GTNewHorizons:EnderCore:0.2.6:dev")
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.41:dev')
compileOnly('com.github.GTNewHorizons:StructureLib:1.0.15:dev')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:AppleCore:3.1.9:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') {transitive = false}
compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.7.5.23-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.3.19-GTNH:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.29:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:GTplusplus:1.7.49:dev") {transitive = false}
runtime("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
}
+1 -1
View File
@@ -39,7 +39,7 @@ apiPackage =
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile =
accessTransformersFile = ae2fc_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
@@ -4,6 +4,7 @@ import appeng.api.AEApi;
import appeng.api.config.Upgrades;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.FluidCellHandler;
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.loader.ChannelLoader;
import com.glodblock.github.loader.ItemAndBlockHolder;
@@ -20,7 +21,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@Mod(modid = FluidCraft.MODID, version = FluidCraft.VERSION, name = FluidCraft.MODNAME)
@Mod(modid = FluidCraft.MODID, version = FluidCraft.VERSION, name = FluidCraft.MODNAME, dependencies = "required-after:appliedenergistics2")
public class FluidCraft {
public static final String MODID = "GRADLETOKEN_MODID";
@@ -43,8 +44,9 @@ public class FluidCraft {
@Mod.EventHandler
public static void init(FMLInitializationEvent event) {
ModAndClassUtil.init();
AEApi.instance().registries().cell().addCellHandler(new FluidCellHandler());
ItemAndBlockHolder.loadSetting();
if (ModAndClassUtil.OC) {
OCDriverInit.run();
}
proxy.init(event);
}
@@ -52,6 +54,9 @@ public class FluidCraft {
public static void postInit(FMLPostInitializationEvent event) {
NetworkRegistry.INSTANCE.registerGuiHandler(FluidCraft.INSTANCE, new InventoryHandler());
AEApi.instance().registries().cell().addCellHandler(new FluidCellHandler());
ItemAndBlockHolder.loadSetting();
if (!Config.removeRecipe) {
(new RecipeLoader()).run();
}
@@ -11,8 +11,6 @@ import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.FCBasePartContainer;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.gui.GuiButton;
@@ -30,7 +28,7 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
private static final String CRAFTMODE_CRFTING = "1";
private static final String CRAFTMODE_PROCESSING = "0";
public final FCBasePartContainer container;
public FCBasePartContainer container;
private GuiTabButton tabCraftButton;
private GuiTabButton tabProcessButton;
@@ -40,11 +38,14 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
private GuiImgButton clearBtn;
private GuiImgButton doubleBtn;
private GuiFCImgButton combineEnableBtn;
private GuiFCImgButton combineDisableBtn;
public GuiBaseFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
super( inventoryPlayer, te, new FCBasePartContainer( inventoryPlayer, te ) );
this.container = (FCBasePartContainer) this.inventorySlots;
Ae2ReflectClient.setReservedSpace(this, 81);
setReservedSpace(81);
}
@Override
@@ -58,7 +59,7 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
}
else if( this.encodeBtn == btn )
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Encode", isShiftKeyDown() ? "2" : "1" ) );
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Encode", (isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0) ));
}
else if( this.clearBtn == btn )
{
@@ -68,6 +69,10 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
}
else if( this.combineDisableBtn == btn || this.combineEnableBtn == btn )
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Combine", this.combineDisableBtn == btn ? "1" : "0" ) );
}
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn)
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Double", Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) ? "1": "0") );
@@ -100,11 +105,22 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE );
this.buttonList.add( this.encodeBtn );
int combineLeft = 74;
if (ModAndClassUtil.isDoubleButton) {
this.doubleBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 153, Settings.ACTIONS, ActionItems.DOUBLE );
this.doubleBtn.setHalfSize( true );
this.buttonList.add( this.doubleBtn );
combineLeft = 84;
}
this.combineEnableBtn = new GuiFCImgButton( this.guiLeft + combineLeft, this.guiTop + this.ySize - 153, "FORCE_COMBINE", "DO_COMBINE" );
this.combineEnableBtn.setHalfSize( true );
this.buttonList.add( this.combineEnableBtn );
this.combineDisableBtn = new GuiFCImgButton( this.guiLeft + combineLeft, this.guiTop + this.ySize - 153, "NOT_COMBINE", "DONT_COMBINE" );
this.combineDisableBtn.setHalfSize( true );
this.buttonList.add( this.combineDisableBtn );
}
@Override
@@ -136,8 +152,27 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
this.substitutionsDisabledBtn.visible = true;
}
if (!this.container.isCraftingMode())
{
if ( this.container.combine )
{
this.combineEnableBtn.visible = true;
this.combineDisableBtn.visible = false;
}
else
{
this.combineEnableBtn.visible = false;
this.combineDisableBtn.visible = true;
}
}
else
{
this.combineEnableBtn.visible = false;
this.combineDisableBtn.visible = false;
}
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL), 8, this.ySize - 96 + 2 - Ae2ReflectClient.getReservedSpace(this), 4210752 );
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752 );
}
@Override
@@ -11,7 +11,6 @@ import appeng.container.slot.AppEngSlot;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.FCBasePartContainerEx;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.gui.GuiButton;
@@ -24,23 +23,29 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
private static final String SUBSITUTION_DISABLE = "0";
private static final String SUBSITUTION_ENABLE = "1";
private static final String PRIORITY_DISABLE = "0";
private static final String PRIORITY_ENABLE = "1";
public FCBasePartContainerEx container;
private GuiImgButton substitutionsEnabledBtn;
private GuiImgButton substitutionsDisabledBtn;
private GuiFCImgButton fluidPrioritizedEnabledBtn;
private GuiFCImgButton fluidPrioritizedDisabledBtn;
private GuiImgButton encodeBtn;
private GuiImgButton invertBtn;
private GuiImgButton clearBtn;
private GuiImgButton doubleBtn;
private GuiFCImgButton combineEnableBtn;
private GuiFCImgButton combineDisableBtn;
private final GuiScrollbar processingScrollBar = new GuiScrollbar();
public GuiBaseFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
super( inventoryPlayer, te, new FCBasePartContainerEx( inventoryPlayer, te ) );
this.container = (FCBasePartContainerEx) this.inventorySlots;
Ae2ReflectClient.setReservedSpace(this, 81);
setReservedSpace(81);
processingScrollBar.setHeight(70).setWidth(7).setLeft(6).setRange(0, 1, 1);
processingScrollBar.setTexture(FluidCraft.MODID, "gui/pattern3.png", 242, 0);
@@ -53,7 +58,7 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
if( this.encodeBtn == btn )
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Encode", isShiftKeyDown() ? "2" : "1" ) );
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Encode",(isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0)) );
}
else if( this.clearBtn == btn )
{
@@ -63,10 +68,18 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
}
else if( this.fluidPrioritizedEnabledBtn == btn || this.fluidPrioritizedDisabledBtn == btn )
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Prioritize", container.prioritize ? PRIORITY_DISABLE : PRIORITY_ENABLE ) );
}
else if( this.invertBtn == btn )
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Invert", container.inverted ? "0" : "1" ) );
}
else if( this.combineDisableBtn == btn || this.combineEnableBtn == btn )
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Combine", this.combineDisableBtn == btn ? "1" : "0" ) );
}
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn)
{
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Double", Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) ? "1": "0") );
@@ -87,6 +100,14 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
this.substitutionsDisabledBtn.setHalfSize( true );
this.buttonList.add( this.substitutionsDisabledBtn );
this.fluidPrioritizedEnabledBtn = new GuiFCImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 143, "FORCE_PRIO", "DO_PRIO" );
this.fluidPrioritizedEnabledBtn.setHalfSize( true );
this.buttonList.add( this.fluidPrioritizedEnabledBtn );
this.fluidPrioritizedDisabledBtn = new GuiFCImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 143, "NOT_PRIO", "DONT_PRIO" );
this.fluidPrioritizedDisabledBtn.setHalfSize( true );
this.buttonList.add( this.fluidPrioritizedDisabledBtn );
invertBtn = new GuiImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 153, Settings.ACTIONS, container.inverted ? PatternSlotConfig.C_4_16 : PatternSlotConfig.C_16_4);
invertBtn.setHalfSize( true );
this.buttonList.add( this.invertBtn );
@@ -104,6 +125,14 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
this.buttonList.add( this.doubleBtn );
}
this.combineEnableBtn = new GuiFCImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 143, "FORCE_COMBINE", "DO_COMBINE" );
this.combineEnableBtn.setHalfSize( true );
this.buttonList.add( this.combineEnableBtn );
this.combineDisableBtn = new GuiFCImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 143, "NOT_COMBINE", "DONT_COMBINE" );
this.combineDisableBtn.setHalfSize( true );
this.buttonList.add( this.combineDisableBtn );
processingScrollBar.setTop(this.ySize - 164);
}
@@ -123,9 +152,30 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
this.substitutionsEnabledBtn.visible = false;
this.substitutionsDisabledBtn.visible = true;
}
if( this.container.prioritize )
{
this.fluidPrioritizedEnabledBtn.visible = false;
this.fluidPrioritizedDisabledBtn.visible = true;
}
else
{
this.fluidPrioritizedEnabledBtn.visible = true;
this.fluidPrioritizedDisabledBtn.visible = false;
}
if ( this.container.combine )
{
this.combineEnableBtn.visible = true;
this.combineDisableBtn.visible = false;
}
else
{
this.combineEnableBtn.visible = false;
this.combineDisableBtn.visible = true;
}
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString( StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX), 8, this.ySize - 96 + 2 - Ae2ReflectClient.getReservedSpace(this), 4210752 );
this.fontRendererObj.drawString( StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752 );
this.processingScrollBar.draw(this);
}
@@ -159,14 +209,25 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
substitutionsEnabledBtn.visible = false;
substitutionsDisabledBtn.visible = true;
}
if (container.prioritize) {
fluidPrioritizedEnabledBtn.visible = true;
fluidPrioritizedDisabledBtn.visible = false;
} else {
fluidPrioritizedEnabledBtn.visible = false;
fluidPrioritizedDisabledBtn.visible = true;
}
final int offset = container.inverted? 18 * -3: 0;
substitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
substitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
fluidPrioritizedEnabledBtn.xPosition = this.guiLeft + 97 + offset;
fluidPrioritizedDisabledBtn.xPosition = this.guiLeft + 97 + offset;
doubleBtn.xPosition = this.guiLeft + 97 + offset;
clearBtn.xPosition = this.guiLeft + 87 + offset;
invertBtn.xPosition = this.guiLeft + 87 + offset;
combineEnableBtn.xPosition = this.guiLeft + 87 + offset;
combineDisableBtn.xPosition = this.guiLeft + 87 + offset;
processingScrollBar.setCurrentScroll(container.activePage);
@@ -1,5 +1,6 @@
package com.glodblock.github.client.gui;
import appeng.api.config.InsertionMode;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.client.gui.implementations.GuiUpgradeable;
@@ -30,6 +31,7 @@ public class GuiDualInterface extends GuiUpgradeable {
private GuiTabButton switcher;
private GuiImgButton BlockMode;
private GuiToggleButton interfaceMode;
private GuiImgButton insertionMode;
private final IInterfaceHost host;
public GuiDualInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
@@ -53,6 +55,9 @@ public class GuiDualInterface extends GuiUpgradeable {
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal() );
this.buttonList.add( this.interfaceMode );
this.insertionMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 44, Settings.INSERTION_MODE, InsertionMode.DEFAULT );
this.buttonList.add( this.insertionMode );
}
@Override
@@ -67,8 +72,12 @@ public class GuiDualInterface extends GuiUpgradeable {
{
this.interfaceMode.setState( ( (ContainerInterface) this.cvb ).getInterfaceTerminalMode() == YesNo.YES );
}
if( this.insertionMode != null )
{
this.insertionMode.set( ( (ContainerInterface) this.cvb ).getInsertionMode());
}
this.fontRendererObj.drawString( StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE), 8, 6, 4210752 );
this.fontRendererObj.drawString( getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 4210752 );
}
@Override
@@ -124,5 +133,9 @@ public class GuiDualInterface extends GuiUpgradeable {
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.BlockMode.getSetting(), backwards ) );
}
if( btn == this.insertionMode )
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.insertionMode.getSetting(), backwards ) );
}
}
}
@@ -7,7 +7,10 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.gui.widgets.*;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.me.InternalSlotME;
import appeng.client.me.ItemRepo;
import appeng.client.me.SlotDisconnected;
@@ -28,9 +31,9 @@ import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.FCBaseMonitorContain;
import com.glodblock.github.client.gui.container.FCBasePartContainer;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
@@ -61,7 +64,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
private final boolean viewCell;
private final ItemStack[] myCurrentViewCells = new ItemStack[5];
public FCBaseMonitorContain monitorableContainer;
private GuiTabButton craftingStatusBtn;
public GuiTabButton craftingStatusBtn;
private GuiImgButton craftingStatusImgBtn;
private FCGuiTextField searchField;
private int perRow = 9;
@@ -77,11 +80,6 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
private GuiImgButton terminalStyleBox;
private GuiImgButton searchStringSave;
public GuiFCBaseMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
this( inventoryPlayer, te, new FCBasePartContainer( inventoryPlayer, te ) );
}
public GuiFCBaseMonitor( final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCBaseMonitorContain c )
{
@@ -136,8 +134,8 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
final GuiImgButton iBtn = (GuiImgButton) btn;
if( iBtn.getSetting() != Settings.ACTIONS )
{
final Enum cv = iBtn.getCurrentValue();
final Enum next = Platform.rotateEnum( cv, backwards, iBtn.getSetting().getPossibleValues() );
final Enum<?> cv = iBtn.getCurrentValue();
final Enum<?> next = Platform.rotateEnum( cv, backwards, iBtn.getSetting().getPossibleValues() );
if( btn == this.terminalStyleBox )
{
@@ -180,6 +178,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
}
@Override
@SuppressWarnings("unchecked")
public void initGui()
{
Keyboard.enableRepeatEvents( true );
@@ -195,7 +194,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
final int magicNumber = 114 + 1;
final int extraSpace = this.height - magicNumber - NEI - top - this.reservedSpace;
this.rows = (int) Math.floor( extraSpace / 18 );
this.rows = (int) Math.floor( extraSpace / 18.0 );
if( this.rows > this.maxRows )
{
top += ( this.rows - this.maxRows ) * 18 / 2;
@@ -284,7 +283,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
}
// Enum setting = AEConfig.INSTANCE.getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
final Enum setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
final Enum<?> setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting );
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || this.isSubGui()))
@@ -346,7 +345,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
@Override
protected void mouseClicked( final int xCoord, final int yCoord, final int btn )
{
final Enum searchMode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
final Enum<?> searchMode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
if( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH )
{
@@ -366,6 +365,19 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
{
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (mouseButton == 3 ){
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
if (slot.getHasStack()) {
InventoryAction action = InventoryAction.valueOf("SET_PATTERN_VALUE");
IAEItemStack stack = AEItemStack.create(slot.getStack());
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, Ae2ReflectClient.getInventorySlots(this).size(), 0, stack));
return;
}
}
}
if( slot instanceof SlotFake)
{
InventoryAction action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
@@ -413,7 +425,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
return; // prevent weird double clicks..
}
InventoryAction action = null;
InventoryAction action;
if( isShiftKeyDown() )
{
action = InventoryAction.CRAFT_SHIFT;
@@ -673,19 +685,19 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
}
@Override
public Enum getSortBy()
public Enum<?> getSortBy()
{
return this.configSrc.getSetting( Settings.SORT_BY );
}
@Override
public Enum getSortDir()
public Enum<?> getSortDir()
{
return this.configSrc.getSetting( Settings.SORT_DIRECTION );
}
@Override
public Enum getSortDisplay()
public Enum<?> getSortDisplay()
{
return this.configSrc.getSetting( Settings.VIEW_MODE );
}
@@ -711,12 +723,12 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
this.repo.updateView();
}
int getReservedSpace()
public int getReservedSpace()
{
return this.reservedSpace;
}
void setReservedSpace( final int reservedSpace )
public void setReservedSpace( final int reservedSpace )
{
this.reservedSpace = reservedSpace;
}
@@ -726,7 +738,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
return this.customSortOrder;
}
void setCustomSortOrder( final boolean customSortOrder )
public void setCustomSortOrder( final boolean customSortOrder )
{
this.customSortOrder = customSortOrder;
}
@@ -736,7 +748,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
return this.standardSize;
}
void setStandardSize( final int standardSize )
public void setStandardSize( final int standardSize )
{
this.standardSize = standardSize;
}
@@ -0,0 +1,300 @@
package com.glodblock.github.client.gui;
import appeng.client.gui.widgets.ITooltip;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
public class GuiFCImgButton extends GuiButton implements ITooltip {
private static final Pattern COMPILE = Pattern.compile( "%s" );
private static final Pattern PATTERN_NEW_LINE = Pattern.compile( "\\n", Pattern.LITERAL );
private static Map<EnumPair, ButtonAppearance> appearances;
private final String buttonSetting;
private boolean halfSize = false;
private String fillVar;
private String currentValue;
private static final String prefix = NameConst.TT_KEY;
public GuiFCImgButton( final int x, final int y, final String idx, final String val ) {
super(0, 0, 16, "");
this.buttonSetting = idx;
this.currentValue = val;
this.xPosition = x;
this.yPosition = y;
this.width = 16;
this.height = 16;
if( appearances == null ) {
appearances = new HashMap<>();
this.registerApp( 0, "NOT_COMBINE", "DONT_COMBINE", "not_combine" );
this.registerApp( 1, "FORCE_COMBINE", "DO_COMBINE", "combine" );
this.registerApp( 2, "FORCE_PRIO", "DO_PRIO", "prio" );
this.registerApp( 3, "NOT_PRIO", "DONT_PRIO", "not_prio" );
}
}
private void registerApp(final int iconIndex, final String setting, final String val, final String title )
{
final ButtonAppearance a = new ButtonAppearance();
a.displayName = StatCollector.translateToLocal(prefix + title);
a.displayValue = StatCollector.translateToLocal(prefix + title + ".hint");
a.index = iconIndex;
appearances.put( new EnumPair( setting, val ), a );
}
public void setVisibility( final boolean vis )
{
this.visible = vis;
this.enabled = vis;
}
private int getIconIndex()
{
if( this.buttonSetting != null && this.currentValue != null )
{
final ButtonAppearance app = appearances.get(new EnumPair( this.buttonSetting, this.currentValue ));
if( app == null )
{
return 8;
}
return app.index;
}
return 8;
}
public String getSetting()
{
return this.buttonSetting;
}
public String getCurrentValue()
{
return this.currentValue;
}
public void set( final String e )
{
if(!this.currentValue.equals(e))
{
this.currentValue = e;
}
}
public boolean isHalfSize()
{
return this.halfSize;
}
public void setHalfSize( final boolean halfSize )
{
this.halfSize = halfSize;
}
public String getFillVar()
{
return this.fillVar;
}
public void setFillVar( final String fillVar )
{
this.fillVar = fillVar;
}
@Override
public int xPos()
{
return this.xPosition;
}
@Override
public int yPos()
{
return this.yPosition;
}
@Override
public int getWidth()
{
return this.halfSize ? 8 : 16;
}
@Override
public int getHeight()
{
return this.halfSize ? 8 : 16;
}
@Override
public boolean isVisible()
{
return this.visible;
}
@Override
public String getMessage()
{
String displayName = null;
String displayValue = null;
if( this.buttonSetting != null && this.currentValue != null )
{
final ButtonAppearance buttonAppearance = appearances.get( new EnumPair( this.buttonSetting, this.currentValue ) );
if( buttonAppearance == null )
{
return "No Such Message";
}
displayName = buttonAppearance.displayName;
displayValue = buttonAppearance.displayValue;
}
if( displayName != null )
{
String name = StatCollector.translateToLocal( displayName );
String value = StatCollector.translateToLocal( displayValue );
if( name == null || name.isEmpty() )
{
name = displayName;
}
if( value == null || value.isEmpty() )
{
value = displayValue;
}
if( this.fillVar != null )
{
value = COMPILE.matcher( value ).replaceFirst( this.fillVar );
}
value = PATTERN_NEW_LINE.matcher( value ).replaceAll( "\n" );
final StringBuilder sb = new StringBuilder( value );
int i = sb.lastIndexOf( "\n" );
if( i <= 0 )
{
i = 0;
}
while( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
{
sb.replace( i, i + 1, "\n" );
}
return name + '\n' + sb;
}
return null;
}
@Override
public void drawButton(final Minecraft par1Minecraft, final int par2, final int par3 )
{
if( this.visible )
{
final int iconIndex = this.getIconIndex();
if( this.halfSize )
{
this.width = 8;
this.height = 8;
GL11.glPushMatrix();
GL11.glTranslatef( this.xPosition, this.yPosition, 0.0F );
GL11.glScalef( 0.5f / 16 * 3, 0.5f / 16 * 3, 0.5f / 16 * 3 );
if( this.enabled )
{
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
}
else
{
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
}
par1Minecraft.renderEngine.bindTexture( FluidCraft.resource("textures/gui/states.png") );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
final int uv_y = (int) Math.floor( iconIndex / 3.0 );
final int uv_x = iconIndex - uv_y * 3;
this.drawTexturedModalRect( 0, 0, Math.round(32F * 16F / 3F), Math.round(32F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F) );
this.drawTexturedModalRect( 0, 0, Math.round(uv_x * 16F * 16F / 3F), Math.round(uv_y * 16F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F) );
this.mouseDragged( par1Minecraft, par2, par3 );
GL11.glPopMatrix();
}
else
{
if( this.enabled )
{
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
}
else
{
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
}
par1Minecraft.renderEngine.bindTexture( FluidCraft.resource("textures/gui/states.png") );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
final int uv_y = (int) Math.floor( iconIndex / 3.0 );
final int uv_x = iconIndex - uv_y * 3;
this.drawTexturedModalRect( this.xPosition, this.yPosition, 32, 32, 16, 16 );
this.drawTexturedModalRect( this.xPosition, this.yPosition, uv_x * 16, uv_y * 16, 16, 16 );
this.mouseDragged( par1Minecraft, par2, par3 );
}
}
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
}
private static final class EnumPair
{
final String setting;
final String value;
EnumPair( final String a, final String b )
{
this.setting = a;
this.value = b;
}
@Override
public int hashCode()
{
return this.setting.hashCode() ^ this.value.hashCode();
}
@Override
public boolean equals( final Object obj )
{
if( obj == null )
{
return false;
}
if( this.getClass() != obj.getClass() )
{
return false;
}
final EnumPair other = (EnumPair) obj;
return other.setting.equals(this.setting) && other.value.equals(this.value);
}
}
private static class ButtonAppearance
{
public int index;
public String displayName;
public String displayValue;
}
}
@@ -17,7 +17,6 @@ import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketSwitchGuis;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -62,6 +61,7 @@ public class GuiFCPriority extends AEBaseGui
this.buttonList.add( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c ) );
this.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d ) );
this.buttonList.add( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a ) );
this.buttonList.add( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b ) );
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
@@ -14,6 +14,7 @@ import appeng.core.localization.GuiText;
import appeng.helpers.Reflected;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketCraftRequest;
@@ -78,6 +79,10 @@ public class GuiFluidCraftAmount extends AEBaseGui
myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL, 1);
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
}
if (target instanceof PartFluidPatternTerminalEx) {
myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL_EX, 1);
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
}
if( this.originalGui != null && myIcon != null )
{
@@ -250,8 +255,4 @@ public class GuiFluidCraftAmount extends AEBaseGui
}
}
protected String getBackground()
{
return "guis/craftAmt.png";
}
}
@@ -48,6 +48,7 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
private GuiButton start;
private GuiButton selectCPU;
private int tooltip = -1;
private ItemStack hoveredStack;
public GuiFluidCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
{
@@ -202,7 +203,7 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
final List<String> lineList = new LinkedList<String>();
int toolPosX = 0;
int toolPosY = 0;
hoveredStack = null;
final int offY = 23;
for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ )
@@ -324,6 +325,7 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
toolPosX = x * ( 1 + sectionLength ) + xo + sectionLength - 8;
toolPosY = y * offY + yo;
hoveredStack = is;
}
this.drawItem( posX, posY, is );
@@ -551,4 +553,7 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
}
}
public ItemStack getHoveredStack() {
return hoveredStack;
}
}
@@ -6,6 +6,8 @@ import appeng.core.localization.GuiText;
import com.glodblock.github.client.gui.container.ContainerFluidIO;
import com.glodblock.github.common.parts.PartFluidImportBus;
import com.glodblock.github.common.parts.PartSharedFluidBus;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
public class GuiFluidIO extends GuiUpgradeable
@@ -28,5 +30,30 @@ public class GuiFluidIO extends GuiUpgradeable
public void update(int id, IAEFluidStack stack) {
((ContainerFluidIO)this.cvb).getBus().setFluidInSlot(id, stack);
}
@Override
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName(I18n.format(this.bus instanceof PartFluidImportBus ? NameConst.GUI_FLUID_IMPORT : NameConst.GUI_FLUID_EXPORT)), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if( this.redstoneMode != null )
{
this.redstoneMode.set( this.cvb.getRedStoneMode() );
}
if( this.fuzzyMode != null )
{
this.fuzzyMode.set( this.cvb.getFuzzyMode() );
}
if( this.craftMode != null )
{
this.craftMode.set( this.cvb.getCraftingMode() );
}
if( this.schedulingMode != null )
{
this.schedulingMode.set( this.cvb.getSchedulingMode() );
}
}
}
@@ -12,7 +12,6 @@ import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.slot.SlotFluid;
import com.glodblock.github.inventory.slot.SlotSingleItem;
import com.glodblock.github.network.CPacketEncodePattern;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.gui.FontRenderer;
@@ -11,7 +11,6 @@ import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.slot.SlotSingleItem;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Ae2ReflectClient;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
@@ -27,13 +26,15 @@ public class GuiFluidPatternTerminal extends GuiBaseFluidPatternTerminal {
ContainerFluidPatternTerminal container = new ContainerFluidPatternTerminal(inventoryPlayer, te);
container.setGui(this);
this.inventorySlots = container;
Ae2ReflectClient.setGuiContainer(this, container);
this.container = container;
this.monitorableContainer = container;
this.configSrc = container.getConfigManager();
}
@Override
public void initGui() {
super.initGui();
craftingStatusBtn = Ae2ReflectClient.getCraftingStatusButton(this);
craftingStatusBtn = super.craftingStatusBtn;
}
@Override
@@ -8,7 +8,6 @@ import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Ae2ReflectClient;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
@@ -11,7 +11,6 @@ import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.slot.SlotSingleItem;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Ae2ReflectClient;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
@@ -35,7 +34,7 @@ public class GuiFluidPatternTerminalEx extends GuiBaseFluidPatternTerminalEx {
@Override
public void initGui() {
super.initGui();
craftingStatusBtn = Ae2ReflectClient.getCraftingStatusButton(this);
craftingStatusBtn = super.craftingStatusBtn;
}
@Override
@@ -12,7 +12,6 @@ import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.gui.TankMouseHandler;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
@@ -0,0 +1,99 @@
package com.glodblock.github.client.gui;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerLargeIngredientBuffer;
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
import com.glodblock.github.inventory.IAEFluidTank;
import com.glodblock.github.inventory.gui.ButtonMouseHandler;
import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.gui.TankMouseHandler;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import javax.annotation.Nullable;
public class GuiLargeIngredientBuffer extends AEBaseGui {
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/large_ingredient_buffer.png");
private static final int TANK_X = 13, TANK_X_OFF = 22, TANK_Y = 18;
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 37;
private final ContainerLargeIngredientBuffer cont;
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
public GuiLargeIngredientBuffer(InventoryPlayer ipl, TileLargeIngredientBuffer tile) {
super(new ContainerLargeIngredientBuffer(ipl, tile));
this.cont = (ContainerLargeIngredientBuffer) inventorySlots;
this.ySize = 222;
for (int i = 0; i < 7; i++) {
mouseRegions.addRegion(TANK_X + TANK_X_OFF * i, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
new TankMouseHandler(cont.getTile().getFluidInventory(), i));
mouseRegions.addRegion(TANK_X + 10 + 22 * i, TANK_Y + TANK_HEIGHT + 2, 7, 7,
ButtonMouseHandler.dumpTank(cont, i));
}
}
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn) {
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
super.mouseClicked(xCoord, yCoord, btn);
}
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
mc.getTextureManager().bindTexture(TEX_BG);
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)), 8, 6, 0x404040);
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
GL11.glColor4f(1F, 1F, 1F, 1F);
IAEFluidTank fluidInv = cont.getTile().getFluidInventory();
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
for (int i = 0; i < 7; i++) {
renderFluidIntoGui(TANK_X + i * TANK_X_OFF, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
fluidInv.getFluidInSlot(i), fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
}
GL11.glColor4f(1F, 1F, 1F, 1F);
mouseRegions.render(mouseX, mouseY);
}
public void renderFluidIntoGui(int x, int y, int width, int height,
@Nullable IAEFluidStack aeFluidStack, int capacity) {
if (aeFluidStack != null) {
GL11.glDisable(2896);
GL11.glColor3f(1.0F, 1.0F, 1.0F);
int hi = (int) (height * ((double) aeFluidStack.getStackSize() / capacity));
if (aeFluidStack.getStackSize() > 0 && hi > 0) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
IIcon fluidIcon = aeFluidStack.getFluid().getStillIcon();
GL11.glColor3f((float)(aeFluidStack.getFluid().getColor() >> 16 & 255) / 255.0F, (float)(aeFluidStack.getFluid().getColor() >> 8 & 255) / 255.0F, (float)(aeFluidStack.getFluid().getColor() & 255) / 255.0F);
for (int th = 0; th <= hi; th += 16) {
if (hi - th <= 0) break;
this.drawTexturedModelRectFromIcon(x, y + height - Math.min(16, hi - th) - th, fluidIcon, width, Math.min(16, hi - th));
}
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
}
}
public void update(int slot, IAEFluidStack aeFluidStack) {
cont.getTile().getFluidInventory().setFluidInSlot(slot, aeFluidStack);
}
}
@@ -0,0 +1,240 @@
package com.glodblock.github.client.gui;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.helpers.Reflected;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketPatternValueSet;
import com.glodblock.github.network.CPacketSwitchGuis;
import com.glodblock.github.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public class GuiPatternValueAmount extends AEBaseGui {
private GuiTextField amountToSet;
private GuiTabButton originalGuiBtn;
private GuiButton set;
private GuiButton plus1;
private GuiButton plus10;
private GuiButton plus100;
private GuiButton plus1000;
private GuiButton minus1;
private GuiButton minus10;
private GuiButton minus100;
private GuiButton minus1000;
private GuiType originalGui;
private final int valueIndex;
private final int originalAmount;
@Reflected
public GuiPatternValueAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(new ContainerPatternValueAmount(inventoryPlayer, te));
GuiContainer gui = (GuiContainer) Minecraft.getMinecraft().currentScreen;
if (gui != null && gui.theSlot != null && gui.theSlot.getHasStack()) {
Slot slot = gui.theSlot;
originalAmount = this.getOriginalAmount(slot.getStack());
valueIndex = slot.slotNumber;
} else {
valueIndex = -1;
originalAmount = 0;
}
}
@Override
public void initGui() {
super.initGui();
final int a = AEConfig.instance.craftItemsByStackAmounts(0);
final int b = AEConfig.instance.craftItemsByStackAmounts(1);
final int c = AEConfig.instance.craftItemsByStackAmounts(2);
final int d = AEConfig.instance.craftItemsByStackAmounts(3);
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a));
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b));
this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c));
this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d));
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a));
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b));
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c));
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d));
this.buttonList.add(this.set = new GuiButton(0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal()));
ItemStack myIcon = null;
final Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
if (target instanceof PartFluidPatternTerminal) {
myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL, 1);
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
}
if (target instanceof PartFluidPatternTerminalEx) {
myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL_EX, 1);
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
}
if (this.originalGui != null && myIcon != null) {
this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
}
this.amountToSet = new GuiTextField(this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT);
this.amountToSet.setEnableBackgroundDrawing(false);
this.amountToSet.setMaxStringLength(16);
this.amountToSet.setTextColor(0xFFFFFF);
this.amountToSet.setVisible(true);
this.amountToSet.setFocused(true);
this.amountToSet.setText(String.valueOf(originalAmount));
this.amountToSet.setSelectionPos(0);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 0x404040);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.set.displayString = I18n.format("ae2fc.gui.button.set");
this.set.enabled = valueIndex >= 0;
this.bindTexture("guis/craftAmt.png");
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
try {
String out = this.amountToSet.getText();
double resultD = Calculator.conversion(out);
int resultI;
if (resultD <= 0 || Double.isNaN(resultD)) {
resultI = 0;
} else {
resultI = (int) ArithHelper.round(resultD, 0);
}
this.set.enabled = resultI > 0;
} catch (final NumberFormatException e) {
this.set.enabled = false;
}
this.amountToSet.drawTextBox();
}
@Override
protected void keyTyped(final char character, final int key) {
if (!this.checkHotbarKeys(key)) {
if (key == 28) {
this.actionPerformed(this.set);
}
this.amountToSet.textboxKeyTyped(character, key);
super.keyTyped(character, key);
}
}
@Override
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
try {
if (btn == this.originalGuiBtn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(this.originalGui));
}
if (btn == this.set && btn.enabled) {
double resultD = Calculator.conversion(this.amountToSet.getText());
int resultI;
if (resultD <= 0 || Double.isNaN(resultD)) {
resultI = 1;
} else {
resultI = (int) ArithHelper.round(resultD, 0);
}
FluidCraft.proxy.netHandler.sendToServer(new CPacketPatternValueSet(originalGui.ordinal(), resultI, valueIndex));
}
} catch (final NumberFormatException e) {
// nope..
this.amountToSet.setText("1");
}
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if (isPlus || isMinus) {
this.addQty(this.getQty(btn));
}
}
private void addQty(final int i) {
try {
String out = this.amountToSet.getText();
double resultD = Calculator.conversion(out);
int resultI;
if (resultD <= 0 || Double.isNaN(resultD)) {
resultI = 0;
} else {
resultI = (int) ArithHelper.round(resultD, 0);
}
if (resultI == 1 && i > 1) {
resultI = 0;
}
resultI += i;
if (resultI < 1) {
resultI = 1;
}
out = Integer.toString(resultI);
this.amountToSet.setText(out);
} catch (final NumberFormatException e) {
// :P
}
}
private int getOriginalAmount(ItemStack stack) {
if (Util.isFluidPacket(stack)) {
FluidStack fluidStack = ItemFluidPacket.getFluidStack(stack);
return fluidStack.amount;
} else {
return stack.stackSize;
}
}
}
@@ -18,6 +18,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -57,9 +59,22 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable {
break;
}
}
this.standardDetectAndSendChanges();
return null;
} else {
if(idx < this.availableUpgrades()){
if(!mergeItemStack(tis, this.getFakeFluidInv().getSizeInventory()+this.availableUpgrades(), this.inventorySlots.size(), false)) return null;
}else if(idx>=this.getFakeFluidInv().getSizeInventory()+this.availableUpgrades()){
if(!mergeItemStack(tis, 0, this.availableUpgrades(), false)) return null;
}
if (tis.stackSize == 0) {
clickSlot.putStack(null);
} else {
clickSlot.onSlotChanged();
}
this.standardDetectAndSendChanges();
return tis;
}
this.standardDetectAndSendChanges();
return null;
}
protected void setupConfig()
@@ -28,6 +28,8 @@ import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.SPacketMEInventoryUpdate;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.Util;
import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -39,6 +41,7 @@ import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Objects;
import java.util.concurrent.Future;
public class ContainerFluidCraftConfirm extends AEBaseContainer {
@@ -312,7 +315,7 @@ public class ContainerFluidCraftConfirm extends AEBaseContainer {
this.setAutoStart( false );
if( g != null && originalGui != null && this.getOpenContext() != null )
{
InventoryHandler.switchGui(originalGui);
InventoryHandler.openGui(this.getInventoryPlayer().player, getWorld(), new BlockPos(this.getOpenContext().getTile()), Objects.requireNonNull(Util.from(this.getOpenContext().getSide())), originalGui);
}
}
}
@@ -29,6 +29,19 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
super(ip, monitorable);
}
public void encodeAllItemAndMoveToInventory(){
encode();
ItemStack output = this.patternSlotOUT.getStack();
if(output != null){
if(this.patternSlotIN.getStack() != null) output.stackSize += this.patternSlotIN.getStack().stackSize;
if (!getPlayerInv().addItemStackToInventory( output )){
getPlayerInv().player.entityDropItem(output, 0);
}
this.patternSlotOUT.putStack( null );
this.patternSlotIN.putStack(null);
}
}
@Override
public void encode() {
if (!checkHasFluidPattern()) {
@@ -28,6 +28,19 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
super(ip, monitorable);
}
public void encodeAllItemAndMoveToInventory(){
encode();
ItemStack output = this.patternSlotOUT.getStack();
if(output != null){
if(this.patternSlotIN.getStack() != null) output.stackSize += this.patternSlotIN.getStack().stackSize;
if (!getPlayerInv().addItemStackToInventory( output )){
getPlayerInv().player.entityDropItem(output, 0);
}
this.patternSlotOUT.putStack( null );
this.patternSlotIN.putStack(null);
}
}
@Override
public void encode() {
if (!checkHasFluidPattern()) {
@@ -98,6 +111,8 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
private void encodeFluidPattern() {
ItemStack patternStack = new ItemStack(ItemAndBlockHolder.PATTERN);
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
pattern.setCombine(this.combine ? 1:0);
pattern.setPriority(this.prioritize? 1:0);
pattern.setInputs(collectInventory(craftingSlots));
pattern.setOutputs(collectInventory(outputSlots));
patternSlotOUT.putStack(pattern.writeToStack());
@@ -0,0 +1,67 @@
package com.glodblock.github.client.gui.container;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotNormal;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.TankDumpable;
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
import com.glodblock.github.network.SPacketFluidUpdate;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import java.util.HashMap;
import java.util.Map;
public class ContainerLargeIngredientBuffer extends AEBaseContainer implements TankDumpable {
private final TileLargeIngredientBuffer tile;
public ContainerLargeIngredientBuffer(InventoryPlayer ipl, TileLargeIngredientBuffer tile) {
super(ipl, tile);
this.tile = tile;
IInventory inv = tile.getInternalInventory();
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new SlotNormal(inv, i * 9 + j, 8 + 18 * j, 72 + 18 * i));
}
}
bindPlayerInventory(ipl, 0, 140);
}
public TileLargeIngredientBuffer getTile() {
return tile;
}
@Override
public boolean canDumpTank(int index) {
return tile.getFluidInventory().getFluidInSlot(index) != null;
}
@Override
public void dumpTank(int index) {
if (index >= 0 && index < tile.getFluidInventory().getSlots()) {
tile.getFluidInventory().setFluidInSlot(index, null);
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
for (int i = 0; i < tile.getFluidInventory().getSlots(); i ++) {
tmp.put(i, tile.getFluidInventory().getFluidInSlot(i));
}
for( final Object g : this.crafters )
{
if( g instanceof EntityPlayer)
{
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(tmp), (EntityPlayerMP) g);
}
}
}
}
@@ -0,0 +1,45 @@
package com.glodblock.github.client.gui.container;
import appeng.api.config.SecurityPermissions;
import appeng.api.storage.ITerminalHost;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotInaccessible;
import appeng.tile.inventory.AppEngInternalInventory;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
public class ContainerPatternValueAmount extends AEBaseContainer {
private final Slot patternValue;
private int valueIndex;
public ContainerPatternValueAmount(final InventoryPlayer ip, final ITerminalHost te )
{
super( ip, te );
this.patternValue = new SlotInaccessible( new AppEngInternalInventory( null, 1 ), 0, 34, 53 );
this.addSlotToContainer( patternValue );
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
this.verifyPermissions( SecurityPermissions.CRAFT, false );
}
public Slot getPatternValue()
{
return patternValue;
}
public int getValueIndex()
{
return valueIndex;
}
public void setValueIndex( int valueIndex )
{
this.valueIndex = valueIndex;
}
}
@@ -58,6 +58,8 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
public boolean craftingMode = true;
@GuiSync( 96 )
public boolean substitute = false;
@GuiSync( 95 )
public boolean combine = false;
public FCBasePartContainer(final InventoryPlayer ip, final ITerminalHost monitorable )
{
@@ -457,6 +459,7 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
}
this.substitute = this.patternTerminal.isSubstitution();
this.combine = this.patternTerminal.shouldCombine();
}
}
@@ -4,7 +4,10 @@ import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.storage.ITerminalHost;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.*;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotRestrictedInput;
import appeng.helpers.IContainerCraftingPacket;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
@@ -60,12 +63,16 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
protected final ProcessingSlotFake[] outputSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
protected final SlotRestrictedInput patternSlotIN;
protected final SlotRestrictedInput patternSlotOUT;
@GuiSync( 96 + (17-9) + 11 )
public boolean combine = false;
@GuiSync( 96 + (17-9) + 12 )
public boolean substitute = false;
@GuiSync( 96 + (17-9) + 16 )
public boolean inverted;
@GuiSync( 96 + (17-9) + 17 )
public int activePage = 0;
@GuiSync( 96 + (17-9) + 13 )
public boolean prioritize = false;
public FCBasePartContainerEx(final InventoryPlayer ip, final ITerminalHost monitorable )
{
@@ -205,6 +212,10 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
encodedValue.setTag( "out", tagOut );
encodedValue.setBoolean( "substitute", this.isSubstitute() );
encodedValue.setTag( "in", tagIn );
encodedValue.setTag( "out", tagOut );
encodedValue.setBoolean( "prioritize", this.isPrioritize() );
output.setTagCompound( encodedValue );
}
@@ -248,7 +259,7 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
if( hasValue )
{
return list.toArray( new ItemStack[list.size()] );
return list.toArray(new ItemStack[0]);
}
return null;
@@ -303,6 +314,8 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
if( Platform.isServer() )
{
this.substitute = this.patternTerminal.isSubstitution();
this.combine = this.patternTerminal.shouldCombine(); //Check out
this.prioritize = this.patternTerminal.isPrioritize();
if (inverted != patternTerminal.isInverted() || activePage != patternTerminal.getActivePage()) {
inverted = patternTerminal.isInverted();
activePage = patternTerminal.getActivePage();
@@ -383,6 +396,8 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
return this.substitute;
}
private boolean isPrioritize() { return this.prioritize; }
static boolean canDoubleStacks(SlotFake[] slots)
{
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
@@ -0,0 +1,12 @@
package com.glodblock.github.client.gui.container;
import akka.actor.Status;
import java.lang.reflect.Type;
public enum FluidPrioritization {
ENABLED,
DISABLED;
}
@@ -82,8 +82,15 @@ public class ItemDropRender implements IItemRenderer {
}
int colour = fluid.getColor();
if (colour == 0xFFFFFF) {
TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks()
.getTextureExtry(fluid.getStillIcon().getIconName());
TextureAtlasSprite sprite;
try {
sprite = Minecraft.getMinecraft().getTextureMapBlocks()
.getTextureExtry(fluid.getStillIcon().getIconName());
} catch (NullPointerException e) {
colourCache.put(fluid.getName(), colour);
return colour;
}
if (sprite != null && sprite.getFrameCount() > 0) {
int[][] image = sprite.getFrameTextureData(0);
int r = 0, g = 0, b = 0, count = 0;
@@ -2,8 +2,10 @@ package com.glodblock.github.client.render;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.RenderUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@@ -22,12 +24,12 @@ public class ItemPacketRender implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type == ItemRenderType.INVENTORY;
return type != ItemRenderType.FIRST_PERSON_MAP;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return false;
return type == ItemRenderType.ENTITY;
}
@Override
@@ -50,18 +52,11 @@ public class ItemPacketRender implements IItemRenderer {
GL11.glColor3f((RGB >> 16 & 0xFF) / 255.0F, (RGB >> 8 & 0xFF) / 255.0F, (RGB & 0xFF) / 255.0F);
}
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
// draw a simple rectangle for the inventory icon
final float x_min = icon.getMinU();
final float x_max = icon.getMaxU();
final float y_min = icon.getMinV();
final float y_max = icon.getMaxV();
tess.addVertexWithUV( 0, 16, 0, x_min, y_max);
tess.addVertexWithUV(16, 16, 0, x_max, y_max);
tess.addVertexWithUV(16, 0, 0, x_max, y_min);
tess.addVertexWithUV( 0, 0, 0, x_min, y_min);
tess.draw();
if (type.equals(ItemRenderType.INVENTORY)) {
RenderUtil.renderItemIcon(icon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
} else {
ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
@@ -13,6 +13,7 @@ public class Config {
public static boolean noFluidPacket;
public static boolean fluidIOBus;
public static boolean removeRecipe;
public static boolean blacklistEssentiaGas;
public static void run() {
loadCategory();
@@ -21,9 +22,10 @@ public class Config {
private static void loadProperty() {
fluidCells = Config.getBoolean("Enable Fluid Storage Cell", "Fluid Craft for AE2", true, "Enable this to generate the fluid storage cells. If you are playing with EC2, you can turn it off.");
noFluidPacket = Config.getBoolean("No Fluid Packet", "Fluid Craft for AE2", false, "Enable this to make normal ME Interface can emit fluid with fluid pattern, like the Fluid Interface.");
noFluidPacket = Config.getBoolean("No Fluid Packet", "Fluid Craft for AE2", false, "Enable this to make normal ME Interface can emit fluid with fluid pattern, like the ME Dual Interface.");
fluidIOBus = Config.getBoolean("Enable AE2FC's Fluid I/O Bus", "Fluid Craft for AE2", true, "Enable this to add Fluid Import/Export Bus like EC2's one.");
removeRecipe = Config.getBoolean("Disable all recipes", "Fluid Craft for AE2", false, "Disable all recipes, for quick tweaker.");
blacklistEssentiaGas = Config.getBoolean("Blacklist Essentia Gas", "Fluid Craft for AE2", true, "Blacklist Essentia Gas from Thaumic Energistics, so they won't be stored in Fluid Storage Cells.");
if (Config.hasChanged())
Config.save();
@@ -1,6 +1,7 @@
package com.glodblock.github.common.block;
import appeng.block.AEBaseItemBlock;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileFluidDiscretizer;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -19,6 +20,7 @@ public class BlockFluidDiscretizer extends FCBaseBlock {
public BlockFluidDiscretizer register() {
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_FLUID_DISCRETIZER);
GameRegistry.registerTileEntity(TileFluidDiscretizer.class, NameConst.BLOCK_FLUID_DISCRETIZER);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -3,10 +3,10 @@ package com.glodblock.github.common.block;
import appeng.api.util.IOrientable;
import appeng.block.AEBaseItemBlock;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
import com.glodblock.github.client.render.RenderBlockFluidInterface;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
@@ -78,6 +78,7 @@ public class BlockFluidInterface extends FCBaseBlock {
public BlockFluidInterface register() {
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_FLUID_INTERFACE);
GameRegistry.registerTileEntity(TileFluidInterface.class, NameConst.BLOCK_FLUID_INTERFACE);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -1,6 +1,7 @@
package com.glodblock.github.common.block;
import appeng.block.AEBaseItemBlock;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
@@ -40,6 +41,7 @@ public class BlockFluidPacketDecoder extends FCBaseBlock {
public BlockFluidPacketDecoder register() {
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_FLUID_PACKET_DECODER);
GameRegistry.registerTileEntity(TileFluidPacketDecoder.class, NameConst.BLOCK_FLUID_PACKET_DECODER);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -1,6 +1,7 @@
package com.glodblock.github.common.block;
import appeng.block.AEBaseItemBlock;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
@@ -40,6 +41,7 @@ public class BlockFluidPatternEncoder extends FCBaseBlock {
public BlockFluidPatternEncoder register() {
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_FLUID_PATTERN_ENCODER);
GameRegistry.registerTileEntity(TileFluidPatternEncoder.class, NameConst.BLOCK_FLUID_PATTERN_ENCODER);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -1,6 +1,7 @@
package com.glodblock.github.common.block;
import appeng.block.AEBaseItemBlock;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileIngredientBuffer;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
@@ -41,6 +42,7 @@ public class BlockIngredientBuffer extends FCBaseBlock {
public BlockIngredientBuffer register() {
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_INGREDIENT_BUFFER);
GameRegistry.registerTileEntity(TileIngredientBuffer.class, NameConst.BLOCK_INGREDIENT_BUFFER);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -0,0 +1,57 @@
package com.glodblock.github.common.block;
import appeng.block.AEBaseItemBlock;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public class BlockLargeIngredientBuffer extends FCBaseBlock {
public BlockLargeIngredientBuffer() {
super(Material.iron, NameConst.BLOCK_LARGE_INGREDIENT_BUFFER);
setTileEntity(TileLargeIngredientBuffer.class);
setOpaque(false);
setFullBlock(false);
this.lightOpacity = 4;
}
@Override
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
if (player.isSneaking()) {
return false;
}
TileLargeIngredientBuffer tile = getTileEntity(world, x, y, z);
if (tile != null) {
if (!world.isRemote) {
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.LARGE_INGREDIENT_BUFFER);
}
return true;
}
return false;
}
public BlockLargeIngredientBuffer register() {
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_LARGE_INGREDIENT_BUFFER);
GameRegistry.registerTileEntity(TileLargeIngredientBuffer.class, NameConst.BLOCK_LARGE_INGREDIENT_BUFFER);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
public ItemStack stack(int size) {
return new ItemStack(this, size);
}
public ItemStack stack() {
return new ItemStack(this, 1);
}
}
@@ -1,8 +1,8 @@
package com.glodblock.github.common.block;
import appeng.block.AEBaseItemBlock;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileOCPatternEditor;
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
@@ -43,7 +43,7 @@ public class BlockOCPatternEditor extends FCBaseBlock {
if (ModAndClassUtil.OC) {
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_OC_PATTERN_EDITOR);
GameRegistry.registerTileEntity(TileOCPatternEditor.class, NameConst.BLOCK_OC_PATTERN_EDITOR);
OCDriverInit.run();
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
return null;
@@ -23,6 +23,8 @@ import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import com.google.common.base.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -157,6 +159,9 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
}
return false;
}
@@ -325,6 +330,7 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
public ItemBasicFluidStorageCell register() {
if (!Config.fluidCells) return null;
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_STORAGE + this.totalBytes / 1024 , FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -2,6 +2,7 @@ package com.glodblock.github.common.item;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -59,6 +60,7 @@ public class ItemBasicFluidStoragePart extends Item {
public ItemBasicFluidStoragePart register() {
if (!Config.fluidCells) return null;
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_PART, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -1,13 +1,18 @@
package com.glodblock.github.common.item;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.core.localization.GuiText;
import appeng.items.misc.ItemEncodedPattern;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.util.FluidPatternDetails;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
public class ItemFluidEncodedPattern extends ItemEncodedPattern {
@@ -27,5 +32,20 @@ public class ItemFluidEncodedPattern extends ItemEncodedPattern {
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_ENCODED_PATTERN, FluidCraft.MODID);
return this;
}
@Override
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
{
NBTTagCompound data = stack.getTagCompound();
final boolean combine = data.getBoolean("combine");
final boolean prio = data.getBoolean("prioritize");
super.addCheckedInformation(stack,player,lines,displayMoreInfo);
// lines.add(String.format("%s: %s",combine ? StatCollector.translateToLocal(NameConst.TT_KEY+"combine"):StatCollector.translateToLocal(NameConst.TT_KEY+"not_combine"),combine ? GuiText.Yes.getLocal() : GuiText.No.getLocal()));
// lines.add(String.format("%s: %s",prio ? StatCollector.translateToLocal(NameConst.TT_KEY+"prio"):StatCollector.translateToLocal(NameConst.TT_KEY+"not_prio"),prio ? GuiText.Yes.getLocal() : GuiText.No.getLocal()));
}
public ItemStack stack() {
return new ItemStack(this, 1);
}
public ItemStack stack(int size) {
return new ItemStack(this, size);
}
}
@@ -5,6 +5,7 @@ import appeng.api.parts.IPartItem;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.parts.PartFluidExportBus;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -39,6 +40,7 @@ public class ItemFluidExportBus extends Item implements IPartItem {
public ItemFluidExportBus register() {
if (!Config.fluidIOBus) return null;
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_EXPORT, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -5,6 +5,7 @@ import appeng.api.parts.IPartItem;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.parts.PartFluidImportBus;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -39,6 +40,7 @@ public class ItemFluidImportBus extends Item implements IPartItem {
public ItemFluidImportBus register() {
if (!Config.fluidIOBus) return null;
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_IMPORT, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -4,6 +4,7 @@ import appeng.api.AEApi;
import appeng.api.parts.IPartItem;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -37,6 +38,7 @@ public class ItemPartFluidInterface extends Item implements IPartItem {
public ItemPartFluidInterface register() {
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_INTERFACE, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -4,6 +4,7 @@ import appeng.api.AEApi;
import appeng.api.parts.IPartItem;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -37,6 +38,7 @@ public class ItemPartFluidPatternTerminal extends Item implements IPartItem {
public ItemPartFluidPatternTerminal register() {
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_PATTERN_TERMINAL, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -4,6 +4,7 @@ import appeng.api.AEApi;
import appeng.api.parts.IPartItem;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -37,6 +38,7 @@ public class ItemPartFluidPatternTerminalEx extends Item implements IPartItem {
public ItemPartFluidPatternTerminalEx register() {
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_PATTERN_TERMINAL_EX, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@@ -16,7 +16,6 @@ import appeng.api.parts.IPartRenderHelper;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.texture.CableBusTextures;
import appeng.core.settings.TickRates;
import appeng.me.GridAccessException;
import appeng.parts.misc.PartInterface;
import appeng.tile.inventory.AppEngInternalAEInventory;
@@ -11,8 +11,8 @@ import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
import com.glodblock.github.client.textures.FCPartsTexture;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.BiggerAppEngInventory;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
@@ -34,12 +34,13 @@ public class PartFluidPatternTerminal extends FCBasePart {
private static final FCPartsTexture FRONT_DARK_ICON = FCPartsTexture.PartFluidPatternTerminal_Colored;
private static final FCPartsTexture FRONT_COLORED_ICON = FCPartsTexture.PartFluidPatternTerminal_Dark;
private final AppEngInternalInventory crafting = new AppEngInternalInventory( this, 9 );
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 3 );
private final AppEngInternalInventory crafting = new BiggerAppEngInventory( this, 9 );
private final AppEngInternalInventory output = new BiggerAppEngInventory( this, 3 );
private final AppEngInternalInventory pattern = new AppEngInternalInventory( this, 2 );
private boolean craftingMode = true;
private boolean substitute = false;
private boolean combine = false;
public PartFluidPatternTerminal(ItemStack is) {
super(is, true);
@@ -81,6 +82,7 @@ public class PartFluidPatternTerminal extends FCBasePart {
super.readFromNBT( data );
this.setCraftingRecipe( data.getBoolean( "craftingMode" ) );
this.setSubstitution( data.getBoolean( "substitute" ) );
this.setCombineMode( data.getBoolean("combine") );
this.pattern.readFromNBT( data, "pattern" );
this.output.readFromNBT( data, "outputList" );
this.crafting.readFromNBT( data, "craftingGrid" );
@@ -92,6 +94,7 @@ public class PartFluidPatternTerminal extends FCBasePart {
super.writeToNBT( data );
data.setBoolean( "craftingMode", this.craftingMode );
data.setBoolean( "substitute", this.substitute );
data.setBoolean( "combine", this.combine );
this.pattern.writeToNBT( data, "pattern" );
this.output.writeToNBT( data, "outputList" );
this.crafting.writeToNBT( data, "craftingGrid" );
@@ -131,7 +134,10 @@ public class PartFluidPatternTerminal extends FCBasePart {
this.setCraftingRecipe(details.isCraftable());
this.setSubstitution(details.canSubstitute());
if(newStack != null){
NBTTagCompound data = newStack.getTagCompound();
this.setCombineMode(data.getInteger("combine") == 1);
}
for (int i = 0; i < this.crafting.getSizeInventory(); i++) {
this.crafting.setInventorySlotContents(i, null);
}
@@ -198,11 +204,21 @@ public class PartFluidPatternTerminal extends FCBasePart {
return this.substitute;
}
public boolean shouldCombine()
{
return this.combine;
}
public void setSubstitution( boolean canSubstitute )
{
this.substitute = canSubstitute;
}
public void setCombineMode(boolean shouldCombine)
{
this.combine = shouldCombine;
}
public void onChangeCrafting(IAEItemStack[] newCrafting, IAEItemStack[] newOutput) {
IInventory crafting = this.getInventoryByName("crafting");
IInventory output = this.getInventoryByName("output");
@@ -12,6 +12,7 @@ import appeng.util.Platform;
import com.glodblock.github.client.textures.FCPartsTexture;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.BiggerAppEngInventory;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
@@ -33,11 +34,13 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
private static final FCPartsTexture FRONT_DARK_ICON = FCPartsTexture.PartFluidPatternTerminal_Colored;
private static final FCPartsTexture FRONT_COLORED_ICON = FCPartsTexture.PartFluidPatternTerminal_Dark;
private final AppEngInternalInventory crafting = new AppEngInternalInventory( this, 32 );
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 32 );
private final AppEngInternalInventory crafting = new BiggerAppEngInventory( this, 32 );
private final AppEngInternalInventory output = new BiggerAppEngInventory( this, 32 );
private final AppEngInternalInventory pattern = new AppEngInternalInventory( this, 2 );
private boolean substitute = false;
private boolean combine = false;
private boolean prioritize = false;
private boolean inverted = false;
private int activePage = 0;
@@ -79,11 +82,15 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
public void readFromNBT( final NBTTagCompound data )
{
super.readFromNBT( data );
this.setSubstitution( data.getBoolean( "substitute" ) );
this.setCombineMode( data.getBoolean("combine") );
this.pattern.readFromNBT( data, "pattern" );
this.output.readFromNBT( data, "outputList" );
this.crafting.readFromNBT( data, "craftingGrid" );
this.setSubstitution( data.getBoolean( "substitute" ) );
this.setPrioritization( data.getBoolean( "priorization") );
this.setInverted( data.getBoolean( "inverted" ) );
this.setActivePage( data.getInteger( "activePage" ) );
}
@@ -92,10 +99,13 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
public void writeToNBT( final NBTTagCompound data )
{
super.writeToNBT( data );
data.setBoolean( "substitute", this.substitute );
data.setBoolean( "combine", this.combine );
this.pattern.writeToNBT( data, "pattern" );
this.output.writeToNBT( data, "outputList" );
this.crafting.writeToNBT( data, "craftingGrid" );
data.setBoolean("priorization", this.prioritize);
data.setBoolean( "substitute", this.substitute );
data.setBoolean( "inverted", this.inverted );
data.setInteger( "activePage", this.activePage );
@@ -150,6 +160,11 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
}
this.setSubstitution(details.canSubstitute());
if(newStack != null){
NBTTagCompound data = newStack.getTagCompound();
this.setCombineMode(data.getInteger("combine") == 1);
this.setPrioritization(data.getInteger("prioritize") == 1);
}
this.setInverted(inputsCount <= 8 && outputCount >= 8);
this.setActivePage(0);
@@ -199,15 +214,34 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
this.getHost().markForSave();
}
public boolean shouldCombine()
{
return this.combine;
}
public void setCombineMode(boolean shouldCombine)
{
this.combine = shouldCombine;
}
public boolean isSubstitution()
{
return this.substitute;
}
public boolean isPrioritize()
{
return this.prioritize;
}
public void setSubstitution( boolean canSubstitute )
{
this.substitute = canSubstitute;
}
public void setPrioritization( boolean canPrioritize )
{
this.prioritize = canPrioritize;
}
public void onChangeCrafting(IAEItemStack[] newCrafting, IAEItemStack[] newOutput) {
IInventory crafting = this.getInventoryByName("crafting");
@@ -5,10 +5,8 @@ import appeng.api.config.Upgrades;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.texture.CableBusTextures;
import appeng.me.GridAccessException;
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory;
@@ -18,9 +16,6 @@ import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.Util;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -31,7 +31,7 @@ public class FluidCellInventory implements IFluidCellInventory {
private final ItemStack cellItem;
private final ISaveProvider container;
private final static int MAX_TYPE = 1;
private int storedFluidCount;
private long storedFluidCount;
private short storedFluids;
private IItemList<IAEFluidStack> cellItems;
private final NBTTagCompound tagCompound;
@@ -78,7 +78,7 @@ public class FluidCellInventory implements IFluidCellInventory {
this.container = container;
this.tagCompound = Platform.openNbtData( o );
this.storedFluids = this.tagCompound.getShort( FLUID_TYPE_TAG );
this.storedFluidCount = this.tagCompound.getInteger( FLUID_COUNT_TAG );
this.storedFluidCount = this.tagCompound.getLong( FLUID_COUNT_TAG );
this.cellItems = null;
}
@@ -178,8 +178,7 @@ public class FluidCellInventory implements IFluidCellInventory {
@Override
public long getRemainingFluidCount() {
final long remaining = this.getFreeBytes() * 8 + this.getUnusedFluidCount();
final long remaining = this.getFreeBytes() * 8 * 256 + this.getUnusedFluidCount();
return remaining > 0 ? remaining : 0;
}
@@ -222,14 +221,15 @@ public class FluidCellInventory implements IFluidCellInventory {
for( int x = 0; x < types; x++ )
{
final FluidStack t = FluidStack.loadFluidStackFromNBT( this.tagCompound.getCompoundTag( fluidSlots[x] ) );
final AEFluidStack aet = AEFluidStack.create( t );
if( t != null )
if( aet != null )
{
t.amount = this.tagCompound.getInteger( fluidSlotCount[x] );
aet.setStackSize( this.tagCompound.getLong( fluidSlotCount[x] ) );
if( t.amount > 0 )
if( aet.getStackSize() > 0 )
{
this.cellItems.add( AEFluidStack.create( t ) );
this.cellItems.add( aet );
}
}
}
@@ -248,12 +248,12 @@ public class FluidCellInventory implements IFluidCellInventory {
private void updateFluidCount( final long delta )
{
this.storedFluidCount += delta;
this.tagCompound.setInteger( FLUID_COUNT_TAG, this.storedFluidCount );
this.tagCompound.setLong( FLUID_COUNT_TAG, this.storedFluidCount );
}
private void saveChanges()
{
int itemCount = 0;
long itemCount = 0;
int x = 0;
@@ -278,7 +278,7 @@ public class FluidCellInventory implements IFluidCellInventory {
* NBTBase tagSlotCount = tagCompound.getTag( itemSlotCount[x] ); if ( tagSlotCount instanceof
* NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else
*/
this.tagCompound.setInteger( fluidSlotCount[x], (int) v.getStackSize() );
this.tagCompound.setLong( fluidSlotCount[x], v.getStackSize() );
x++;
}
@@ -313,7 +313,7 @@ public class FluidCellInventory implements IFluidCellInventory {
}
else
{
this.tagCompound.setInteger( FLUID_COUNT_TAG, itemCount );
this.tagCompound.setLong( FLUID_COUNT_TAG, itemCount );
}
// clean any old crusty stuff...
@@ -388,19 +388,19 @@ public class FluidCellInventory implements IFluidCellInventory {
if( this.canHoldNewFluid() ) // room for new type, and for at least one item!
{
final int remainingItemCount = (int) this.getRemainingFluidCount() - this.getBytesPerType() * 8;
final long remainingItemCount = this.getRemainingFluidCount() - this.getBytesPerType() * 8;
if( remainingItemCount > 0 )
{
if( input.getStackSize() > remainingItemCount )
{
final FluidStack toReturn = Util.cloneFluidStack(sharedFluidStack);
toReturn.amount = sharedFluidStack.amount - remainingItemCount;
toReturn.amount = (int) (sharedFluidStack.amount - remainingItemCount);
if( mode == Actionable.MODULATE )
{
final FluidStack toWrite = Util.cloneFluidStack( sharedFluidStack );
toWrite.amount = remainingItemCount;
toWrite.amount = (int) remainingItemCount;
this.cellItems.add( AEFluidStack.create( toWrite ) );
this.updateFluidCount( toWrite.amount );
@@ -0,0 +1,20 @@
package com.glodblock.github.common.tabs;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.loader.ItemAndBlockHolder;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class FluidCraftingTabs extends CreativeTabs {
public static final FluidCraftingTabs INSTANCE = new FluidCraftingTabs(FluidCraft.MODID);
public FluidCraftingTabs(String name){
super(name);
}
@Override
public Item getTabIconItem() {
return ItemAndBlockHolder.DISCRETIZER.stack().getItem();
}
}
@@ -19,7 +19,6 @@ import appeng.me.GridAccessException;
import appeng.me.cache.CraftingGridCache;
import appeng.me.storage.MEInventoryHandler;
import appeng.tile.grid.AENetworkTile;
import appeng.util.Platform;
import com.glodblock.github.common.item.ItemFluidDrop;
import java.util.ArrayList;
@@ -48,8 +47,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
@SuppressWarnings("rawtypes")
public List<IMEInventoryHandler> getCellArray(StorageChannel channel) {
/*conflict = !checkDiscreatizer();
if (conflict) return Collections.emptyList();*/
if (getProxy().isActive()) {
if (channel == StorageChannel.ITEMS) {
return Collections.singletonList(fluidDropInv.invHandler);
@@ -142,7 +139,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
public IAEItemStack injectItems(IAEItemStack request, Actionable type, BaseActionSource src) {
/*if (conflict) return request;*/
IAEFluidStack fluidStack = ItemFluidDrop.getAeFluidStack(request);
if (fluidStack == null) {
return request;
@@ -165,7 +161,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src) {
/*if (conflict) return null;*/
IAEFluidStack fluidStack = ItemFluidDrop.getAeFluidStack(request);
if (fluidStack == null) {
return null;
@@ -188,7 +183,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
/*if (conflict) return out;*/
if (itemCache == null) {
itemCache = new ArrayList<>();
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
@@ -253,7 +247,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
@SuppressWarnings("rawtypes")
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
/*if (conflict) return null;*/
ICraftingGrid craftingGrid;
try {
craftingGrid = getProxy().getGrid().getCache(ICraftingGrid.class);
@@ -2,18 +2,12 @@ package com.glodblock.github.common.tile;
import appeng.api.config.Upgrades;
import appeng.api.networking.IGridNode;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEFluidStack;
import appeng.me.GridAccessException;
import appeng.tile.TileEvent;
import appeng.tile.events.TileEventType;
import appeng.tile.inventory.AppEngInternalAEInventory;
@@ -52,11 +46,13 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
@MENetworkEventSubscribe
public void stateChange(final MENetworkChannelsChanged c) {
fluidDuality.onChannelStateChange(c);
super.stateChange(c);
}
@MENetworkEventSubscribe
public void stateChange(final MENetworkPowerStatusChange c) {
fluidDuality.onPowerStateChange(c);
super.stateChange(c);
}
@Override
@@ -10,7 +10,6 @@ import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import com.glodblock.github.inventory.AeStackInventory;
import com.glodblock.github.inventory.AeStackInventoryImpl;
import com.glodblock.github.util.BlockPos;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -0,0 +1,154 @@
package com.glodblock.github.common.tile;
import appeng.api.storage.data.IAEFluidStack;
import appeng.tile.AEBaseInvTile;
import appeng.tile.TileEvent;
import appeng.tile.events.TileEventType;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.item.AEFluidStack;
import com.glodblock.github.inventory.AEFluidInventory;
import com.glodblock.github.inventory.IAEFluidInventory;
import com.glodblock.github.inventory.IAEFluidTank;
import cpw.mods.fml.common.network.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import javax.annotation.Nonnull;
import java.io.IOException;
public class TileLargeIngredientBuffer extends AEBaseInvTile implements IAEFluidInventory, IFluidHandler {
private final AppEngInternalInventory invItems = new AppEngInternalInventory(this, 27);
private final AEFluidInventory invFluids = new AEFluidInventory(this, 7, 64000);
@Nonnull
@Override
public IInventory getInternalInventory() {
return invItems;
}
public IAEFluidTank getFluidInventory() {
return invFluids;
}
@Override
public boolean canBeRotated() {
return false;
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added) {
markForUpdate();
}
@Override
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
}
@Override
public void onFluidInventoryChanged(IAEFluidTank inv, int slot) {
saveChanges();
markForUpdate();
}
@TileEvent(TileEventType.NETWORK_WRITE)
protected void writeToStream(ByteBuf data) throws IOException {
for (int i = 0; i < invItems.getSizeInventory(); i++) {
ByteBufUtils.writeItemStack(data, invItems.getStackInSlot(i));
}
int fluidMask = 0;
for (int i = 0; i < invFluids.getSlots(); i++) {
if (invFluids.getFluidInSlot(i) != null) {
fluidMask |= 1 << i;
}
}
data.writeByte(fluidMask);
for (int i = 0; i < invFluids.getSlots(); i++) {
IAEFluidStack fluid = invFluids.getFluidInSlot(i);
if (fluid != null) {
fluid.writeToPacket(data);
}
}
}
@TileEvent(TileEventType.NETWORK_READ)
protected boolean readFromStream(ByteBuf data) throws IOException {
boolean changed = false;
for (int i = 0; i < invItems.getSizeInventory(); i++) {
ItemStack stack = ByteBufUtils.readItemStack(data);
if (!ItemStack.areItemStacksEqual(stack, invItems.getStackInSlot(i))) {
invItems.setInventorySlotContents(i, stack);
changed = true;
}
}
int fluidMask = data.readByte();
for (int i = 0; i < invFluids.getSlots(); i++) {
if ((fluidMask & (1 << i)) != 0) {
IAEFluidStack fluid = AEFluidStack.loadFluidStackFromPacket(data);
if (fluid != null) { // this shouldn't happen, but better safe than sorry
IAEFluidStack origFluid = invFluids.getFluidInSlot(i);
if (!fluid.equals(origFluid) || fluid.getStackSize() != origFluid.getStackSize()) {
invFluids.setFluidInSlot(i, fluid);
changed = true;
}
}
} else if (invFluids.getFluidInSlot(i) != null) {
invFluids.setFluidInSlot(i, null);
changed = true;
}
}
return changed;
}
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBTEvent(NBTTagCompound data) {
invItems.readFromNBT(data, "ItemInv");
invFluids.readFromNBT(data, "FluidInv");
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
invItems.writeToNBT(data, "ItemInv");
invFluids.writeToNBT(data, "FluidInv");
return data;
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return invFluids.fill(from, resource, doFill);
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
return invFluids.drain(from, resource, doDrain);
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return invFluids.drain(from, maxDrain, doDrain);
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid) {
return invFluids.canFill(from, fluid);
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid) {
return invFluids.canDrain(from, fluid);
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
return invFluids.getTankInfo(from);
}
}
@@ -26,8 +26,12 @@ public class FCClassTransformer implements IClassTransformer {
break;
case "appeng.client.gui.implementations.GuiCraftingCPU":
case "appeng.client.gui.implementations.GuiCraftConfirm":
case "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm":
tform = GuiCraftingTransformer.INSTANCE;
break;
case "appeng.integration.modules.NEI":
tform = NEITransfermer.INSTANCE;
break;
default:
return code;
}
@@ -1,14 +1,23 @@
package com.glodblock.github.coremod.hooker;
import appeng.api.config.Actionable;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.IMachineSet;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.implementations.GuiCraftConfirm;
import appeng.client.gui.implementations.GuiCraftingCPU;
import appeng.crafting.MECraftingInventory;
import appeng.me.MachineSet;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.parts.misc.PartInterface;
import appeng.tile.misc.TileInterface;
import appeng.util.InventoryAdaptor;
import com.glodblock.github.client.gui.GuiFluidCraftConfirm;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidInterface;
@@ -20,6 +29,7 @@ import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.SetBackedMachineSet;
import com.glodblock.github.util.Util;
import com.google.common.collect.Sets;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -33,7 +43,7 @@ import java.util.Set;
public class CoreModHooks {
public static InventoryCrafting wrapCraftingBuffer(InventoryCrafting inv) {
return new FluidConvertingInventoryCrafting(Ae2Reflect.getCraftContainer(inv), Ae2Reflect.getCraftWidth(inv), inv.getSizeInventory()/Ae2Reflect.getCraftWidth(inv));
return new FluidConvertingInventoryCrafting(inv.eventHandler, inv.inventoryWidth, inv.getSizeInventory()/inv.inventoryWidth);
}
public static IAEItemStack wrapFluidPacketStack(IAEItemStack stack) {
@@ -46,6 +56,17 @@ public class CoreModHooks {
return stack;
}
public static ItemStack removeFluidPackets(InventoryCrafting inv, int index) {
ItemStack stack = inv.getStackInSlot(index);
if (stack != null && stack.getItem() instanceof ItemFluidPacket) {
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
return ItemFluidDrop.newStack(fluid);
}
else {
return stack;
}
}
@Nullable
public static InventoryAdaptor wrapInventory(@Nullable TileEntity tile, ForgeDirection face) {
return tile != null ? FluidConvertingInventoryAdaptor.wrap(tile, Util.from(face)) : null;
@@ -105,4 +126,65 @@ public class CoreModHooks {
else return aeStack.getStackSize();
}
public static void storeFluidItem(CraftingCPUCluster instance) {
final IGrid g = Ae2Reflect.getGrid(instance);
if( g == null )
{
return;
}
final IStorageGrid sg = g.getCache( IStorageGrid.class );
final IMEInventory<IAEItemStack> ii = sg.getItemInventory();
final IMEInventory<IAEFluidStack> jj = sg.getFluidInventory();
final MECraftingInventory inventory = Ae2Reflect.getCPUInventory(instance);
for( IAEItemStack is : inventory.getItemList() )
{
is = inventory.extractItems( is.copy(), Actionable.MODULATE, Ae2Reflect.getCPUSource(instance) );
if( is != null )
{
Ae2Reflect.postCPUChange(instance, is, Ae2Reflect.getCPUSource(instance));
if (is.getItem() instanceof ItemFluidDrop) {
IAEFluidStack fluidDrop = ItemFluidDrop.getAeFluidStack(is);
fluidDrop = jj.injectItems(fluidDrop, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
if (fluidDrop == null) {
is = null;
} else {
is.setStackSize(fluidDrop.getStackSize());
}
} else {
is = ii.injectItems(is, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
}
}
if( is != null )
{
inventory.injectItems( is, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance) );
}
}
if( inventory.getItemList().isEmpty() )
{
Ae2Reflect.setCPUInventory(instance, new MECraftingInventory());
}
Ae2Reflect.markCPUDirty(instance);
}
public static ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey) {
if (gui instanceof GuiFluidCraftConfirm) {
return ((GuiFluidCraftConfirm) gui).getHoveredStack();
}
return null;
}
public static boolean shouldShowTooltip(GuiContainer gui) {
if (gui instanceof GuiFluidCraftConfirm) {
return ((GuiFluidCraftConfirm)gui).getHoveredStack() == null;
}
return true;
}
}
@@ -29,6 +29,8 @@ public class CraftingCpuTransformer extends FCClassTransformer.ClassMapper {
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if (name.equals("executeCrafting")) {
return new TransformExecuteCrafting(api, super.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("cancel")) {
return new TransformStoreItems(api, super.visitMethod(access, name, desc, signature, exceptions));
}
return super.visitMethod(access, name, desc, signature, exceptions);
}
@@ -81,6 +83,15 @@ public class CraftingCpuTransformer extends FCClassTransformer.ClassMapper {
return;
}
}
if (opcode == Opcodes.INVOKEVIRTUAL
&& owner.equals("net/minecraft/inventory/InventoryCrafting") && (name.equals("getStackInSlot") || name.equals("func_70301_a"))) {
super.visitMethodInsn(Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"removeFluidPackets",
"(Lnet/minecraft/inventory/InventoryCrafting;I)Lnet/minecraft/item/ItemStack;",
false);
return;
}
super.visitMethodInsn(opcode, owner, name, desc, itf);
if (gotInventory) {
if (opcode == Opcodes.INVOKESTATIC
@@ -104,4 +115,27 @@ public class CraftingCpuTransformer extends FCClassTransformer.ClassMapper {
}
private static class TransformStoreItems extends MethodVisitor {
TransformStoreItems(int api, MethodVisitor mv) {
super(api, mv);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
if (opcode == Opcodes.INVOKESPECIAL
&& owner.equals("appeng/me/cluster/implementations/CraftingCPUCluster") && name.equals("storeItems")) {
super.visitMethodInsn(Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"storeFluidItem",
"(Lappeng/me/cluster/implementations/CraftingCPUCluster;)V",
false
);
} else {
super.visitMethodInsn(opcode, owner, name, desc, itf);
}
}
}
}
@@ -0,0 +1,93 @@
package com.glodblock.github.coremod.transform;
import com.glodblock.github.coremod.FCClassTransformer;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class NEITransfermer extends FCClassTransformer.ClassMapper {
public static final NEITransfermer INSTANCE = new NEITransfermer();
private NEITransfermer() {
// NO-OP
}
@Override
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
return new TransformNEI(Opcodes.ASM5, downstream);
}
private static class TransformNEI extends ClassVisitor {
TransformNEI(int api, ClassVisitor cv) {
super(api, cv);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
switch (name) {
case "getStackUnderMouse":
return new TransformStackUnderMouse(api, super.visitMethod(access, name, desc, signature, exceptions));
case "shouldShowTooltip":
return new TransformShowTooltip(api, super.visitMethod(access, name, desc, signature, exceptions));
default:
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
}
private static class TransformStackUnderMouse extends MethodVisitor {
TransformStackUnderMouse(int api, MethodVisitor mv) {
super(api, mv);
}
@Override
public void visitInsn(int opcode) {
if (opcode == Opcodes.ACONST_NULL) {
super.visitVarInsn(Opcodes.ALOAD, 1);
super.visitVarInsn(Opcodes.ILOAD, 2);
super.visitVarInsn(Opcodes.ILOAD, 3);
super.visitMethodInsn(Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"getStackUnderMouse",
"(Lnet/minecraft/client/gui/inventory/GuiContainer;II)Lnet/minecraft/item/ItemStack;",
false
);
return;
}
super.visitInsn(opcode);
}
}
private static class TransformShowTooltip extends MethodVisitor {
int const_1 = 0;
TransformShowTooltip(int api, MethodVisitor mv) {
super(api, mv);
}
@Override
public void visitInsn(int opcode) {
if (opcode == Opcodes.ICONST_1 && const_1 == 2) {
super.visitVarInsn(Opcodes.ALOAD, 1);
super.visitMethodInsn(Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"shouldShowTooltip",
"(Lnet/minecraft/client/gui/inventory/GuiContainer;)Z",
false
);
const_1 ++;
return;
}
if (opcode == Opcodes.ICONST_1) {
const_1 ++;
}
super.visitInsn(opcode);
}
}
}
@@ -5,8 +5,6 @@ import appeng.core.AELog;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import com.glodblock.github.util.Util;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
@@ -14,13 +12,12 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidTank;
import java.util.Objects;
public class AEFluidInventory implements IAEFluidTank
{
private final IAEFluidStack[] fluids;
private final IAEFluidInventory handler;
private final int capacity;
public int lastIndex;
public AEFluidInventory( final IAEFluidInventory handler, final int slots, final int capcity )
{
@@ -257,9 +254,10 @@ public class AEFluidInventory implements IAEFluidTank
FluidStack totalDrained = null;
int toDrain = maxDrain;
for( int slot = 0; slot < this.getSlots(); ++slot )
for( int slot = lastIndex; slot < this.getSlots(); ++slot )
{
if (this.getFluidInSlot(slot) == null) {
if(slot == this.getSlots()-1) lastIndex = 0;
continue;
}
@@ -268,6 +266,7 @@ public class AEFluidInventory implements IAEFluidTank
totalDrained = this.drain( slot, toDrain, doDrain );
if( totalDrained != null )
{
lastIndex = slot;
toDrain -= totalDrained.amount;
}
}
@@ -0,0 +1,57 @@
package com.glodblock.github.inventory;
import appeng.core.AELog;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
* Since there is no ae2 available now for compiling, we copied it over, and it will need to be removed in the future.
*/
@Deprecated
public class BiggerAppEngInventory extends AppEngInternalInventory {
private final ItemStack[] inv;
public BiggerAppEngInventory(IAEAppEngInventory inventory, int size) {
super(inventory, size);
inv = ObfuscationReflectionHelper.getPrivateValue(AppEngInternalInventory.class, this, "inv");
}
protected void writeToNBT(final NBTTagCompound target) {
for (int x = 0; x < this.getSizeInventory(); x++) {
try {
final NBTTagCompound c = new NBTTagCompound();
if (this.inv[x] != null) {
this.inv[x].writeToNBT(c);
c.setInteger("Count", this.inv[x].stackSize);
}
target.setTag("#" + x, c);
} catch (final Exception ignored) {
}
}
}
public void readFromNBT(final NBTTagCompound target) {
for (int x = 0; x < this.getSizeInventory(); x++) {
try {
final NBTTagCompound c = target.getCompoundTag("#" + x);
if (c != null) {
ItemStack stack = ItemStack.loadItemStackFromNBT(c);
if (stack != null) {
stack.stackSize = c.getInteger("Count");
}
this.inv[x] = stack;
}
} catch (final Exception e) {
AELog.debug(e);
}
}
}
}
@@ -1,17 +1,21 @@
package com.glodblock.github.inventory;
import appeng.api.config.FuzzyMode;
import appeng.api.config.InsertionMode;
import appeng.tile.misc.TileInterface;
import appeng.tile.networking.TileCableBus;
import appeng.util.InventoryAdaptor;
import appeng.util.inv.IInventoryDestination;
import appeng.util.inv.ItemSlot;
import cofh.api.transport.IItemDuct;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.Util;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
@@ -32,23 +36,36 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
TileEntity inter = capProvider.getWorldObj().getTileEntity(capProvider.xCoord + f.offsetX, capProvider.yCoord + f.offsetY, capProvider.zCoord + f.offsetZ);
if (!Config.noFluidPacket && !(inter instanceof TileFluidInterface || (inter instanceof TileCableBus && ((TileCableBus) inter).getPart(f.getOpposite()) instanceof PartFluidInterface)))
return InventoryAdaptor.getAdaptor(capProvider, f);
IInventory item = capProvider instanceof IInventory ? (IInventory) capProvider : null;
InventoryAdaptor item = InventoryAdaptor.getAdaptor(capProvider, f);
IFluidHandler fluid = capProvider instanceof IFluidHandler ? (IFluidHandler) capProvider : null;
return new FluidConvertingInventoryAdaptor(item, fluid, face);
boolean onmi = false;
if (inter instanceof TileInterface) {
onmi = ((TileInterface) inter).getTargets().size() > 1;
}
Object conduct = null;
if (ModAndClassUtil.COFH && capProvider instanceof IItemDuct) {
conduct = capProvider;
}
return new FluidConvertingInventoryAdaptor(item, fluid, face, new BlockPos(inter), onmi, conduct);
}
private final InventoryAdaptor invItems;
private final IFluidHandler invFluids;
private final ForgeDirection side;
private final BlockPos posInterface;
private final Object eioDuct;
private final boolean onmi;
public FluidConvertingInventoryAdaptor(@Nullable IInventory invItems, @Nullable IFluidHandler invFluids, EnumFacing facing) {
this.invItems = invItems != null ? InventoryAdaptor.getAdaptor(invItems, Util.from(facing)) : null;
public FluidConvertingInventoryAdaptor(@Nullable InventoryAdaptor invItems, @Nullable IFluidHandler invFluids, EnumFacing facing, BlockPos pos, boolean isOnmi, Object eioConduct) {
this.invItems = invItems;
this.invFluids = invFluids;
this.side = Util.from(facing);
this.posInterface = pos;
this.eioDuct = eioConduct;
this.onmi = isOnmi;
}
@Override
public ItemStack addItems(ItemStack toBeAdded) {
public ItemStack addItems( ItemStack toBeAdded, InsertionMode insertionMode ) {
if (toBeAdded.getItem() instanceof ItemFluidPacket) {
if (invFluids != null) {
FluidStack fluid = ItemFluidPacket.getFluidStack(toBeAdded);
@@ -62,12 +79,44 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
return toBeAdded;
}
return invItems != null ? invItems.addItems(toBeAdded) : toBeAdded;
if (eioDuct != null) {
return ((IItemDuct) eioDuct).insertItem(side, toBeAdded);
}
return invItems != null ? invItems.addItems(toBeAdded,insertionMode) : toBeAdded;
}
@Override
public ItemStack addItems(ItemStack toBeAdded) {
return addItems(toBeAdded, InsertionMode.DEFAULT);
}
@Override
public ItemStack simulateAdd(ItemStack toBeSimulated) {
return simulateAdd(toBeSimulated, InsertionMode.DEFAULT);
}
@Override
public ItemStack simulateAdd(ItemStack toBeSimulated, InsertionMode insertionMode) {
if (toBeSimulated.getItem() instanceof ItemFluidPacket) {
if (onmi) {
boolean sus = false;
FluidStack fluid = ItemFluidPacket.getFluidStack(toBeSimulated);
if (fluid != null) {
for (ForgeDirection dir : ForgeDirection.values()) {
TileEntity te = posInterface.getOffSet(dir).getTileEntity();
if (te instanceof IFluidHandler) {
int filled = ((IFluidHandler) te).fill(dir.getOpposite(), fluid, false);
if (filled > 0) {
sus = true;
break;
}
}
}
} else {
sus = true;
}
return sus ? null : toBeSimulated;
}
if (invFluids != null) {
FluidStack fluid = ItemFluidPacket.getFluidStack(toBeSimulated);
if (fluid != null) {
@@ -80,7 +129,11 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
return toBeSimulated;
}
return invItems != null ? invItems.simulateAdd(toBeSimulated) : toBeSimulated;
//Assert EIO conduct can hold all item, as it is the origin practice in AE2
if (eioDuct != null) {
return null;
}
return invItems != null ? invItems.simulateAdd(toBeSimulated, insertionMode) : toBeSimulated;
}
@Override
@@ -16,7 +16,7 @@ public class FluidConvertingInventoryCrafting extends InventoryCrafting {
@Override
public void setInventorySlotContents(int index, ItemStack stack) {
if (stack.getItem() instanceof ItemFluidDrop) {
if (stack != null && stack.getItem() instanceof ItemFluidDrop) {
FluidStack fluid = ItemFluidDrop.getFluidStack(stack);
if (fluid != null) {
super.setInventorySlotContents(index, ItemFluidPacket.newStack(new FluidStack(fluid, stack.stackSize)));
@@ -128,6 +128,18 @@ public enum GuiType {
}
}),
LARGE_INGREDIENT_BUFFER(new TileGuiFactory<TileLargeIngredientBuffer>(TileLargeIngredientBuffer.class) {
@Override
protected Object createServerGui(EntityPlayer player, TileLargeIngredientBuffer inv) {
return new ContainerLargeIngredientBuffer(player.inventory, inv);
}
@Override
protected Object createClientGui(EntityPlayer player, TileLargeIngredientBuffer inv) {
return new GuiLargeIngredientBuffer(player.inventory, inv);
}
}),
FLUID_PAT_TERM_CRAFTING_STATUS(new PartGuiFactory<FCBasePart>(FCBasePart.class) {
@Override
protected Object createServerGui(EntityPlayer player, FCBasePart inv) {
@@ -210,6 +222,18 @@ public enum GuiType {
protected Object createClientGui(EntityPlayer player, TileFluidPacketDecoder inv) {
return new GuiFluidPacketDecoder(player.inventory, inv);
}
}),
PATTERN_VALUE_SET(new PartGuiFactory<FCBasePart>(FCBasePart.class) {
@Override
protected Object createServerGui(EntityPlayer player, FCBasePart inv) {
return new ContainerPatternValueAmount(player.inventory, inv);
}
@Override
protected Object createClientGui(EntityPlayer player, FCBasePart inv) {
return new GuiPatternValueAmount(player.inventory, inv);
}
});
public static final List<GuiType> VALUES = ImmutableList.copyOf(values());
@@ -1,6 +1,6 @@
package com.glodblock.github.inventory.gui;
import com.glodblock.github.util.Ae2ReflectClient;
import appeng.client.gui.AEBaseGui;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.util.ResourceLocation;
@@ -22,8 +22,8 @@ public class MouseRegionManager {
}
public boolean onClick(int mX, int mY, int button) {
mX -= Ae2ReflectClient.getGuiLeft(gui);
mY -= Ae2ReflectClient.getGuiTop(gui);
mX -= gui.guiLeft;
mY -= gui.guiTop;
for (Region region : regions) {
if (region.containsMouse(mX, mY) && region.handler.onClick(button)) {
gui.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1F));
@@ -34,12 +34,13 @@ public class MouseRegionManager {
}
public void render(int mX, int mY) {
mX -= Ae2ReflectClient.getGuiLeft(gui);
mY -= Ae2ReflectClient.getGuiTop(gui);
mX -= gui.guiLeft;
mY -= gui.guiTop;
for (Region region : regions) {
if (region.containsMouse(mX, mY)) {
List<String> tooltip = region.handler.getTooltip();
if (tooltip != null) {
((AEBaseGui)gui).drawTooltip(mX,mY,0,String.join("\n",tooltip));
return;
}
}
@@ -20,5 +20,6 @@ public class ChannelLoader implements Runnable {
FluidCraft.proxy.netHandler.registerMessage(new CPacketTransferRecipe.Handler(), CPacketTransferRecipe.class, id ++, Side.SERVER);
FluidCraft.proxy.netHandler.registerMessage(new CPacketDumpTank.Handler(), CPacketDumpTank.class, id ++, Side.SERVER);
FluidCraft.proxy.netHandler.registerMessage(new SPacketFluidUpdate.Handler(), SPacketFluidUpdate.class, id ++, Side.CLIENT);
FluidCraft.proxy.netHandler.registerMessage(new CPacketPatternValueSet.Handler(), CPacketPatternValueSet.class, id ++, Side.SERVER);
}
}
@@ -7,6 +7,14 @@ import com.glodblock.github.common.storage.CellType;
public class ItemAndBlockHolder {
public static BlockFluidDiscretizer DISCRETIZER = new BlockFluidDiscretizer().register();
public static BlockFluidPatternEncoder ENCODER = new BlockFluidPatternEncoder().register();
public static BlockFluidPacketDecoder DECODER = new BlockFluidPacketDecoder().register();
public static BlockFluidInterface INTERFACE = new BlockFluidInterface().register();
public static BlockIngredientBuffer BUFFER = new BlockIngredientBuffer().register();
public static BlockLargeIngredientBuffer LARGE_BUFFER = new BlockLargeIngredientBuffer().register();
public static BlockOCPatternEditor OC_EDITOR = new BlockOCPatternEditor().register();
public static ItemFluidDrop DROP = new ItemFluidDrop().register();
public static ItemFluidEncodedPattern PATTERN = new ItemFluidEncodedPattern().register();
public static ItemPartFluidPatternTerminal FLUID_TERMINAL = new ItemPartFluidPatternTerminal().register();
@@ -24,13 +32,6 @@ public class ItemAndBlockHolder {
public static ItemBasicFluidStorageCell CELL4096K = new ItemBasicFluidStorageCell(CellType.Cell4096kPart, 4096).register();
public static ItemBasicFluidStoragePart CELL_PART = new ItemBasicFluidStoragePart().register();
public static BlockFluidDiscretizer DISCRETIZER = new BlockFluidDiscretizer().register();
public static BlockFluidPatternEncoder ENCODER = new BlockFluidPatternEncoder().register();
public static BlockFluidPacketDecoder DECODER = new BlockFluidPacketDecoder().register();
public static BlockFluidInterface INTERFACE = new BlockFluidInterface().register();
public static BlockIngredientBuffer BUFFER = new BlockIngredientBuffer().register();
public static BlockOCPatternEditor OC_EDITOR = new BlockOCPatternEditor().register();
public static void loadSetting() {
if (!Config.fluidCells) return;
CellType.Cell1kPart.setItemInstance(CELL_PART);
@@ -48,7 +48,8 @@ public class RecipeLoader implements Runnable {
GameRegistry.addShapelessRecipe(FLUID_TERMINAL.stack(), AE2_PATTERN_TERM, ENCODER);
GameRegistry.addShapelessRecipe(FLUID_TERMINAL_EX.stack(), FLUID_TERMINAL.stack(), AE2_PROCESS_CAL, AE2_PROCESS_ENG, AE2_PROCESS_LOG);
GameRegistry.addRecipe(new ShapedOreRecipe(BUFFER.stack(), "ILI", "AGF", "IBI", 'I', "ingotIron", 'G', AE2_QUARTZ_GLASS, 'L', AE2_CELL_1K, 'A', AE2_CORE_ANN, 'F', AE2_CORE_FOM, 'B', BUCKET));
GameRegistry.addRecipe(new ShapedOreRecipe(LARGE_BUFFER.stack(), "BGB", "GEG", "BGB", 'B', BUFFER.stack(), 'G', AE2_QUARTZ_GLASS, 'E', AE2_PROCESS_ENG));
GameRegistry.addShapelessRecipe(AE2_BLANK_PATTERN,PATTERN.stack());
if (Config.fluidCells) {
OreDictionary.registerOre("anyCertusCrystal", AE2_PURE_CERTUS);
for (ItemStack it : OreDictionary.getOres("crystalCertusQuartz"))
@@ -4,8 +4,10 @@ import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.recipe.IRecipeHandler;
import codechicken.nei.recipe.TemplateRecipeHandler;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.GuiBaseFluidPatternTerminalEx;
import com.glodblock.github.client.gui.GuiFluidPatternTerminal;
import com.glodblock.github.client.gui.GuiFluidPatternTerminalEx;
import com.glodblock.github.client.gui.container.FluidPrioritization;
import com.glodblock.github.nei.object.OrderStack;
import com.glodblock.github.nei.recipes.FluidRecipe;
import com.glodblock.github.network.CPacketTransferRecipe;
@@ -30,7 +32,11 @@ public class FluidPatternTerminalRecipeTransferHandler implements IOverlayHandle
@Override
public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) {
if (isCorrectGui(firstGui)) {
List<OrderStack<?>> in = FluidRecipe.getPackageInputs(recipe, recipeIndex);
boolean priority = false;
if (firstGui instanceof GuiBaseFluidPatternTerminalEx) {
priority = ((GuiBaseFluidPatternTerminalEx)firstGui).container.prioritize;
}
List<OrderStack<?>> in = FluidRecipe.getPackageInputs(recipe, recipeIndex, priority);
List<OrderStack<?>> out = FluidRecipe.getPackageOutputs(recipe, recipeIndex, !notUseOther(recipe));
boolean craft = shouldCraft(recipe);
FluidCraft.proxy.netHandler.sendToServer(new CPacketTransferRecipe(in, out, craft));
@@ -0,0 +1,64 @@
package com.glodblock.github.nei;
import com.glodblock.github.nei.object.OrderStack;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class NEIUtils {
public static List<OrderStack<?>> compress(List<OrderStack<?>> list) {
List<OrderStack<?>> comp = new LinkedList<>();
for (OrderStack<?> orderStack : list) {
if (orderStack == null) continue;
if (orderStack.getStack() instanceof FluidStack) {
comp.add(orderStack);
continue;
}
ItemStack currentStack = (ItemStack) orderStack.getStack();
if (currentStack.stackSize == 0) continue;
boolean find = false;
for (OrderStack<?> storedStack : comp) {
if (storedStack == null || !(storedStack.getStack() instanceof ItemStack)) continue;
ItemStack firstStack = (ItemStack) storedStack.getStack();
boolean areItemStackEqual = firstStack.isItemEqual(currentStack) && ItemStack.areItemStackTagsEqual(firstStack, currentStack);
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
find = true;
((ItemStack) storedStack.getStack()).stackSize = firstStack.stackSize + currentStack.stackSize;
}
}
if (!find) {
comp.add(orderStack);
}
}
return comp.stream().filter(Objects::nonNull).collect(Collectors.toList());
}
public static List<OrderStack<?>> clearNull(List<OrderStack<?>> list) {
List<OrderStack<?>> cleared = new LinkedList<>();
HashMap<Integer, Object> map = new HashMap<>();
int upper = 0;
for (OrderStack<?> orderStack : list) {
if (orderStack != null && orderStack.getStack() != null) {
if (orderStack.getStack() instanceof ItemStack && ((ItemStack) orderStack.getStack()).stackSize == 0)
continue;
map.put(orderStack.getIndex(), orderStack.getStack());
upper = Math.max(upper, orderStack.getIndex());
}
}
int id = 0;
for (int i = 0; i <= upper; i ++) {
if (map.containsKey(i)) {
cleared.add(new OrderStack<>(map.get(i), id));
id ++;
}
}
return cleared;
}
}
@@ -67,6 +67,19 @@ public class DefaultExtractorLoader implements Runnable {
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerStill()));
}
if (ModAndClassUtil.IC2) {
FluidRecipe.addRecipeMap("blastfurnace", new IndustrialCraftRecipeExtractor());
FluidRecipe.addRecipeMap("BlockCutter", new IndustrialCraftRecipeExtractor());
FluidRecipe.addRecipeMap("centrifuge", new IndustrialCraftRecipeExtractor());
FluidRecipe.addRecipeMap("compressor", new IndustrialCraftRecipeExtractor());
FluidRecipe.addRecipeMap("extractor", new IndustrialCraftRecipeExtractor());
FluidRecipe.addRecipeMap("fluidcanner", new IndustrialCraftRecipeExtractor());
FluidRecipe.addRecipeMap("macerator", new IndustrialCraftRecipeExtractor());
FluidRecipe.addRecipeMap("metalformer", new IndustrialCraftRecipeExtractor());
FluidRecipe.addRecipeMap("oreWashing", new IndustrialCraftRecipeExtractor());
FluidRecipe.addRecipeMap("solidcanner", new IndustrialCraftRecipeExtractor());
}
}
}
@@ -6,6 +6,11 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
import com.glodblock.github.nei.object.IRecipeExtractor;
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
import com.glodblock.github.nei.object.OrderStack;
import gregtech.common.items.GT_FluidDisplayItem;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.Collections;
@@ -24,14 +29,30 @@ public final class FluidRecipe {
}
}
public static List<OrderStack<?>> getPackageInputs(IRecipeHandler recipe, int index) {
public static List<OrderStack<?>> getPackageInputs(IRecipeHandler recipe, int index, boolean priority) {
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
if (tRecipe == null || !IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return new ArrayList<>();
if (tRecipe.getOverlayIdentifier() == null) return getPackageInputsLegacy(recipe, index);
IRecipeExtractor extractor = IdentifierMap.get(tRecipe.getOverlayIdentifier());
if (extractor == null) return new ArrayList<>();
List<PositionedStack> tmp = new ArrayList<>(tRecipe.getIngredientStacks(index));
return extractor.getInputIngredients(tmp, recipe, index);
List<OrderStack<?>> out = extractor.getInputIngredients(tmp, recipe, index);
if (priority) {
List<OrderStack<?>> reordered = new ArrayList<>();
byte numFluids = 0;
for (OrderStack<?> orderStack : out) {
if (orderStack != null && orderStack.getStack() instanceof FluidStack) {
reordered.add(new OrderStack(orderStack.getStack(), numFluids++));
}
}
for (OrderStack<?> orderStack : out) {
if (orderStack != null && orderStack.getStack() instanceof ItemStack) {
reordered.add(new OrderStack(orderStack.getStack(), numFluids++));
}
}
return reordered;
}
return out;
}
public static List<OrderStack<?>> getPackageOutputs(IRecipeHandler recipe, int index, boolean useOther) {
@@ -5,7 +5,6 @@ import codechicken.nei.recipe.IRecipeHandler;
import codechicken.nei.recipe.TemplateRecipeHandler;
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
import com.glodblock.github.nei.object.OrderStack;
import com.glodblock.github.util.NEIUtil;
import forestry.core.recipes.nei.PositionedFluidTank;
import forestry.core.recipes.nei.RecipeHandlerBase;
import forestry.factory.recipes.nei.NEIHandlerFabricator;
@@ -55,14 +54,13 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
List<OrderStack<?>> tmp = new ArrayList<>();
List<PositionedStack> compressed = NEIUtil.compress(rawInputs);
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
tmp = getInputIngredients(compressed);
tmp = getInputIngredients(rawInputs);
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
if (tanks.size() > 0 && !(handler instanceof NEIHandlerSqueezer)) {
FluidStack fluid = tanks.get(0).tank.getFluid();
if (fluid != null) {
tmp.add(new OrderStack<>(fluid, compressed.size()));
tmp.add(new OrderStack<>(fluid, rawInputs.size()));
}
}
}
@@ -74,20 +72,19 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
removeGlass(rawOutputs);
List<OrderStack<?>> tmp = new ArrayList<>();
List<PositionedStack> compressed = NEIUtil.compress(rawOutputs);
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
tmp = getOutputIngredients(compressed);
tmp = getOutputIngredients(rawOutputs);
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
if (tanks.size() > 0 && handler instanceof NEIHandlerSqueezer) {
FluidStack fluid = tanks.get(0).tank.getFluid();
if (fluid != null) {
tmp.add(new OrderStack<>(fluid, compressed.size()));
tmp.add(new OrderStack<>(fluid, rawOutputs.size()));
}
}
else if (tanks.size() > 1) {
FluidStack fluid = tanks.get(1).tank.getFluid();
if (fluid != null) {
tmp.add(new OrderStack<>(fluid, compressed.size()));
tmp.add(new OrderStack<>(fluid, rawOutputs.size()));
}
}
}
@@ -3,7 +3,6 @@ package com.glodblock.github.nei.recipes.extractor;
import codechicken.nei.PositionedStack;
import com.glodblock.github.nei.object.IRecipeExtractor;
import com.glodblock.github.nei.object.OrderStack;
import com.glodblock.github.util.NEIUtil;
import gregtech.api.enums.ItemList;
import gregtech.common.items.GT_FluidDisplayItem;
import net.minecraft.item.ItemStack;
@@ -25,11 +24,10 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
@Override
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
if (removeSpecial) removeSpecial(rawInputs);
List<PositionedStack> compressed = NEIUtil.compress(rawInputs);
List<OrderStack<?>> tmp = new LinkedList<>();
for (int i = 0; i < compressed.size(); i ++) {
if (compressed.get(i) == null) continue;
ItemStack item = compressed.get(i).items[0];
for (int i = 0; i < rawInputs.size(); i ++) {
if (rawInputs.get(i) == null) continue;
ItemStack item = rawInputs.get(i).items[0].copy();
OrderStack<?> stack;
if (item.getItem() instanceof GT_FluidDisplayItem) {
NBTTagCompound aNBT = item.getTagCompound();
@@ -38,7 +36,7 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
stack = new OrderStack<>(new FluidStack(FluidRegistry.getFluid(item.getItemDamage()), amt), i);
tmp.add(stack);
} else {
stack = OrderStack.pack(compressed.get(i), i);
stack = OrderStack.pack(rawInputs.get(i), i);
if (stack != null) tmp.add(stack);
}
}
@@ -47,11 +45,10 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
@Override
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
List<PositionedStack> compressed = NEIUtil.compress(rawOutputs);
List<OrderStack<?>> tmp = new LinkedList<>();
for (int i = 0; i < compressed.size(); i ++) {
if (compressed.get(i) == null) continue;
ItemStack item = compressed.get(i).items[0];
for (int i = 0; i < rawOutputs.size(); i ++) {
if (rawOutputs.get(i) == null) continue;
ItemStack item = rawOutputs.get(i).items[0].copy();
OrderStack<?> stack;
if (item.getItem() instanceof GT_FluidDisplayItem) {
NBTTagCompound aNBT = item.getTagCompound();
@@ -60,7 +57,7 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
stack = new OrderStack<>(new FluidStack(FluidRegistry.getFluid(item.getItemDamage()), amt), i);
tmp.add(stack);
} else {
stack = OrderStack.pack(compressed.get(i), i);
stack = OrderStack.pack(rawOutputs.get(i), i);
if (stack != null) tmp.add(stack);
}
}
@@ -3,7 +3,6 @@ package com.glodblock.github.nei.recipes.extractor;
import codechicken.nei.PositionedStack;
import com.glodblock.github.nei.object.IRecipeExtractor;
import com.glodblock.github.nei.object.OrderStack;
import com.glodblock.github.util.NEIUtil;
import gregapi.item.ItemFluidDisplay;
import gregapi.recipes.Recipe;
import net.minecraft.item.ItemStack;
@@ -23,11 +22,10 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
@Override
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
this.removeMachine(rawInputs);
List<PositionedStack> compressed = NEIUtil.compress(rawInputs);
List<OrderStack<?>> tmp = new LinkedList<>();
for (int i = 0; i < compressed.size(); i ++) {
if (compressed.get(i) == null) continue;
ItemStack item = compressed.get(i).items[0];
for (int i = 0; i < rawInputs.size(); i ++) {
if (rawInputs.get(i) == null) continue;
ItemStack item = rawInputs.get(i).items[0].copy();
OrderStack<?> stack;
if (item.getItem() instanceof ItemFluidDisplay) {
FluidStack fluid = ((ItemFluidDisplay) item.getItem()).getFluid(item);
@@ -35,7 +33,7 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
stack = new OrderStack<>(fluid, i);
tmp.add(stack);
} else {
stack = OrderStack.pack(compressed.get(i), i);
stack = OrderStack.pack(rawInputs.get(i), i);
if (stack != null) tmp.add(stack);
}
}
@@ -44,11 +42,10 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
@Override
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
List<PositionedStack> compressed = NEIUtil.compress(rawOutputs);
List<OrderStack<?>> tmp = new LinkedList<>();
for (int i = 0; i < compressed.size(); i ++) {
if (compressed.get(i) == null) continue;
ItemStack item = compressed.get(i).items[0];
for (int i = 0; i < rawOutputs.size(); i ++) {
if (rawOutputs.get(i) == null) continue;
ItemStack item = rawOutputs.get(i).items[0].copy();
OrderStack<?> stack;
if (item.getItem() instanceof ItemFluidDisplay) {
FluidStack fluid = ((ItemFluidDisplay) item.getItem()).getFluid(item);
@@ -56,7 +53,7 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
stack = new OrderStack<>(fluid, i);
tmp.add(stack);
} else {
stack = OrderStack.pack(compressed.get(i), i);
stack = OrderStack.pack(rawOutputs.get(i), i);
if (stack != null) tmp.add(stack);
}
}
@@ -0,0 +1,114 @@
package com.glodblock.github.nei.recipes.extractor;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.IRecipeHandler;
import com.glodblock.github.nei.object.IRecipeExtractor;
import com.glodblock.github.nei.object.OrderStack;
import com.glodblock.github.util.Ae2Reflect;
import ic2.neiIntegration.core.recipehandler.FluidCannerRecipeHandler;
import ic2.neiIntegration.core.recipehandler.OreWashingRecipeHandler;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class IndustrialCraftRecipeExtractor implements IRecipeExtractor {
@Override
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
List<OrderStack<?>> tmp = new LinkedList<>();
for (int i = 0; i < rawInputs.size(); i ++) {
if (rawInputs.get(i) == null) continue;
tmp.add(OrderStack.pack(rawInputs.get(i), i));
}
return tmp;
}
@Override
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
List<OrderStack<?>> tmp = new LinkedList<>();
for (int i = 0; i < rawOutputs.size(); i ++) {
if (rawOutputs.get(i) == null) continue;
tmp.add(OrderStack.pack(rawOutputs.get(i), i));
}
return tmp;
}
@Override
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
List<OrderStack<?>> stacks = new LinkedList<>();
if (recipe instanceof FluidCannerRecipeHandler) {
FluidCannerRecipeHandler.CachedFluidCannerRecipe cachedRecipe = (FluidCannerRecipeHandler.CachedFluidCannerRecipe) ((FluidCannerRecipeHandler) recipe).arecipes.get(index);
FluidStack input = ReflectIC2.getInputFluid(cachedRecipe);
PositionedStack add = rawInputs.size() > 1 ? rawInputs.get(1) : null;
stacks.add(OrderStack.pack(add, 0));
stacks.add(new OrderStack<>(input, 1));
}
else if (recipe instanceof OreWashingRecipeHandler) {
stacks = getInputIngredients(rawInputs);
int water = ReflectIC2.getOreWasherWater((OreWashingRecipeHandler) recipe, index);
stacks.add(new OrderStack<>(new FluidStack(FluidRegistry.WATER, water), stacks.size()));
} else {
stacks = getInputIngredients(rawInputs);
}
return stacks.stream().filter(Objects::nonNull).collect(Collectors.toList());
}
@Override
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
List<OrderStack<?>> stacks = new LinkedList<>();
if (recipe instanceof FluidCannerRecipeHandler) {
FluidCannerRecipeHandler.CachedFluidCannerRecipe cachedRecipe = (FluidCannerRecipeHandler.CachedFluidCannerRecipe) ((FluidCannerRecipeHandler) recipe).arecipes.get(index);
FluidStack output = ReflectIC2.getOutputFluid(cachedRecipe);
stacks.add(new OrderStack<>(output, 0));
} else {
stacks = getOutputIngredients(rawOutputs);
}
return stacks.stream().filter(Objects::nonNull).collect(Collectors.toList());
}
private static class ReflectIC2 {
private final static Field inputsF;
private final static Field resultF;
private final static Method oreWasherWater;
static {
try {
inputsF = Ae2Reflect.reflectField(FluidCannerRecipeHandler.CachedFluidCannerRecipe.class, "fluidInput");
resultF = Ae2Reflect.reflectField(FluidCannerRecipeHandler.CachedFluidCannerRecipe.class, "fluidOutput");
oreWasherWater = Ae2Reflect.reflectMethod(OreWashingRecipeHandler.class, "getreqWater", int.class);
} catch (NoSuchFieldException | NoSuchMethodException e) {
throw new IllegalStateException("Failed to initialize IC2 reflection hacks!", e);
}
}
private static FluidStack getInputFluid(FluidCannerRecipeHandler.CachedFluidCannerRecipe recipe) {
return Ae2Reflect.readField(recipe, inputsF);
}
private static FluidStack getOutputFluid(FluidCannerRecipeHandler.CachedFluidCannerRecipe recipe) {
return Ae2Reflect.readField(recipe, resultF);
}
private static int getOreWasherWater(OreWashingRecipeHandler recipeHandler, int index) {
try {
return (int) oreWasherWater.invoke(recipeHandler, index);
} catch (Exception e) {
throw new IllegalStateException("Failed to invoke method: " + oreWasherWater, e);
}
}
}
}
@@ -19,6 +19,11 @@ public class CPacketFluidPatternTermBtns implements IMessage {
Value = value;
}
public CPacketFluidPatternTermBtns( final String name, final Integer value ) {
Name = name;
Value = value.toString();
}
public CPacketFluidPatternTermBtns() {
// NO-OP
}
@@ -66,10 +71,17 @@ public class CPacketFluidPatternTermBtns implements IMessage {
cpt.getPatternTerminal().setCraftingRecipe(Value.equals("1"));
break;
case "PatternTerminal.Encode":
if (Value.equals("2"))
cpt.encodeAndMoveToInventory();
else
cpt.encode();
switch (Value) {
case "0":
cpt.encode();
break;
case "1":
cpt.encodeAndMoveToInventory();
break;
case "3":
cpt.encodeAllItemAndMoveToInventory();
break;
}
break;
case "PatternTerminal.Clear":
cpt.clear();
@@ -80,16 +92,26 @@ public class CPacketFluidPatternTermBtns implements IMessage {
case "PatternTerminal.Double":
cpt.doubleStacks(Value.equals("1"));
break;
case "PatternTerminal.Combine":
cpt.getPatternTerminal().setCombineMode(Value.equals("1"));
break;
}
} else if( Name.startsWith( "PatternTerminalEx." ) && (c instanceof ContainerFluidPatternTerminalEx))
{
final ContainerFluidPatternTerminalEx cpt = (ContainerFluidPatternTerminalEx) c;
switch (Name) {
case "PatternTerminalEx.Encode":
if (Value.equals("2"))
cpt.encodeAndMoveToInventory();
else
cpt.encode();
switch (Value) {
case "0":
cpt.encode();
break;
case "1":
cpt.encodeAndMoveToInventory();
break;
case "3":
cpt.encodeAllItemAndMoveToInventory();
break;
}
break;
case "PatternTerminalEx.Clear":
cpt.clear();
@@ -103,9 +125,15 @@ public class CPacketFluidPatternTermBtns implements IMessage {
case "PatternTerminalEx.Double":
cpt.doubleStacks(Value.equals("1"));
break;
case "PatternTerminalEx.Combine":
cpt.getPatternTerminal().setCombineMode(Value.equals("1"));
break;
case "PatternTerminalEx.ActivePage":
cpt.getPatternTerminal().setActivePage(Integer.parseInt(Value));
break;
case "PatternTerminalEx.Prioritize":
cpt.getPatternTerminal().setPrioritization(Value.equals("1"));
break;
}
} else if(Name.equals( "Terminal.Cpu" ) && c instanceof ContainerFluidCraftConfirm) {
final ContainerFluidCraftConfirm qk = (ContainerFluidCraftConfirm) c;
@@ -4,8 +4,11 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.core.sync.GuiBridge;
import appeng.helpers.InventoryAction;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
@@ -108,6 +111,24 @@ public class CPacketInventoryAction implements IMessage {
cca.detectAndSendChanges();
}
}
}else if (message.action == InventoryAction.valueOf("SET_PATTERN_VALUE"))
{
final ContainerOpenContext context = baseContainer.getOpenContext();
if( context != null )
{
final TileEntity te = context.getTile();
InventoryHandler.openGui(sender, te.getWorldObj(), new BlockPos(te), Objects.requireNonNull(Util.from(baseContainer.getOpenContext().getSide())), GuiType.PATTERN_VALUE_SET );
if( sender.openContainer instanceof ContainerPatternValueAmount)
{
final ContainerPatternValueAmount cpv = (ContainerPatternValueAmount) sender.openContainer;
if( baseContainer.getTargetStack() != null )
{
cpv.setValueIndex( message.slot );
cpv.getPatternValue().putStack( baseContainer.getTargetStack().getItemStack() );
}
cpv.detectAndSendChanges();
}
}
}
else
{
@@ -0,0 +1,94 @@
package com.glodblock.github.network;
import appeng.api.networking.IGridHost;
import appeng.container.ContainerOpenContext;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.Util;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
import java.util.Objects;
public class CPacketPatternValueSet implements IMessage {
private GuiType originGui;
private int amount;
private int valueIndex;
public CPacketPatternValueSet() {
}
public CPacketPatternValueSet( int originalGui, int amount, int valueIndex ){
this.originGui = GuiType.getByOrdinal(originalGui);
this.amount = amount;
this.valueIndex = valueIndex;
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(originGui.ordinal());
buf.writeInt(amount);
buf.writeInt(valueIndex);
}
@Override
public void fromBytes(ByteBuf buf) {
this.originGui = GuiType.getByOrdinal(buf.readInt());
this.amount = buf.readInt();
this.valueIndex = buf.readInt();
}
public static class Handler implements IMessageHandler<CPacketPatternValueSet, IMessage> {
@Override
public IMessage onMessage(CPacketPatternValueSet message, MessageContext ctx) {
EntityPlayer player = ctx.getServerHandler().playerEntity;
if (player.openContainer instanceof ContainerPatternValueAmount) {
ContainerPatternValueAmount cpv = (ContainerPatternValueAmount) player.openContainer;
final Object target = cpv.getTarget();
if (target instanceof IGridHost) {
final ContainerOpenContext context = cpv.getOpenContext();
if (context != null) {
final TileEntity te = context.getTile();
InventoryHandler.openGui(player, player.worldObj, new BlockPos(te), Objects.requireNonNull(Util.from(context.getSide())), message.originGui);
if (player.openContainer instanceof ContainerFluidPatternTerminal || player.openContainer instanceof ContainerFluidPatternTerminalEx) {
Slot slot = player.openContainer.getSlot(message.valueIndex);
if (slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack().copy();
if (Util.isFluidPacket(stack)) {
FluidStack fluidStack = ItemFluidPacket.getFluidStack(stack);
if (fluidStack != null) {
fluidStack = ItemFluidPacket.getFluidStack(stack).copy();
fluidStack.amount = message.amount;
}
slot.putStack(ItemFluidPacket.newStack(fluidStack));
} else {
stack.stackSize = message.amount;
slot.putStack(stack);
}
}
}
}
}
}
return null;
}
}
}
@@ -62,7 +62,6 @@ public class CPacketSwitchGuis implements IMessage {
InventoryHandler.openGui(player, player.worldObj, new BlockPos(te), Objects.requireNonNull(Util.from(context.getSide())), message.guiType);
return null;
}
}
}
@@ -3,6 +3,7 @@ package com.glodblock.github.network;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.nei.NEIUtils;
import com.glodblock.github.nei.object.OrderStack;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
@@ -80,6 +81,7 @@ public class CPacketTransferRecipe implements IMessage {
Container c = ctx.getServerHandler().playerEntity.openContainer;
if (c instanceof ContainerFluidPatternTerminal) {
ContainerFluidPatternTerminal cf = (ContainerFluidPatternTerminal) c;
boolean combine = cf.combine;
cf.getPatternTerminal().setCraftingRecipe(message.isCraft);
IInventory inputSlot = cf.getInventoryByName("crafting");
IInventory outputSlot = cf.getInventoryByName("output");
@@ -89,6 +91,16 @@ public class CPacketTransferRecipe implements IMessage {
for (int i = 0; i < outputSlot.getSizeInventory(); i ++) {
outputSlot.setInventorySlotContents(i, null);
}
if (!message.isCraft) {
if (combine) {
message.inputs = NEIUtils.compress(message.inputs);
message.outputs = NEIUtils.compress(message.outputs);
}
message.inputs = NEIUtils.clearNull(message.inputs);
message.outputs = NEIUtils.clearNull(message.outputs);
}
for (OrderStack<?> stack : message.inputs) {
if (stack != null) {
int index = stack.getIndex();
@@ -123,6 +135,7 @@ public class CPacketTransferRecipe implements IMessage {
c.onCraftMatrixChanged(outputSlot);
} else if (c instanceof ContainerFluidPatternTerminalEx) {
ContainerFluidPatternTerminalEx cf = (ContainerFluidPatternTerminalEx) c;
boolean combine = cf.combine;
IInventory inputSlot = cf.getInventoryByName("crafting");
IInventory outputSlot = cf.getInventoryByName("output");
for (int i = 0; i < inputSlot.getSizeInventory(); i ++) {
@@ -131,6 +144,14 @@ public class CPacketTransferRecipe implements IMessage {
for (int i = 0; i < outputSlot.getSizeInventory(); i ++) {
outputSlot.setInventorySlotContents(i, null);
}
if (combine) {
message.inputs = NEIUtils.compress(message.inputs);
message.outputs = NEIUtils.compress(message.outputs);
}
message.inputs = NEIUtils.clearNull(message.inputs);
message.outputs = NEIUtils.clearNull(message.outputs);
for (OrderStack<?> stack : message.inputs) {
if (stack != null) {
int index = stack.getIndex();
@@ -5,6 +5,7 @@ import appeng.util.item.AEFluidStack;
import com.glodblock.github.client.gui.GuiFluidIO;
import com.glodblock.github.client.gui.GuiFluidInterface;
import com.glodblock.github.client.gui.GuiIngredientBuffer;
import com.glodblock.github.client.gui.GuiLargeIngredientBuffer;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
@@ -75,6 +76,10 @@ public class SPacketFluidUpdate implements IMessage {
for (Map.Entry<Integer, IAEFluidStack> e : message.list.entrySet() ) {
( (GuiIngredientBuffer) gs ).update(e.getKey(), e.getValue());
}
} else if (gs instanceof GuiLargeIngredientBuffer) {
for (Map.Entry<Integer, IAEFluidStack> e : message.list.entrySet() ) {
( (GuiLargeIngredientBuffer) gs ).update(e.getKey(), e.getValue());
}
} else if( gs instanceof GuiFluidIO)
{
for (Map.Entry<Integer, IAEFluidStack> e : message.list.entrySet() ) {
@@ -3,6 +3,7 @@ package com.glodblock.github.proxy;
import com.glodblock.github.loader.ListenerLoader;
import com.glodblock.github.loader.RenderLoader;
import com.glodblock.github.nei.recipes.DefaultExtractorLoader;
import com.glodblock.github.util.ModAndClassUtil;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@@ -24,6 +25,8 @@ public class ClientProxy extends CommonProxy {
@Override
public void postInit(FMLPostInitializationEvent event){
super.postInit(event);
(new DefaultExtractorLoader()).run();
if (ModAndClassUtil.NEI) {
(new DefaultExtractorLoader()).run();
}
}
}
@@ -1,58 +1,56 @@
package com.glodblock.github.util;
import appeng.api.implementations.IUpgradeableHost;
import appeng.api.networking.IGrid;
import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.MachineSource;
import appeng.api.storage.IMEInventory;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.implementations.GuiCraftingStatus;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.render.AppEngRenderItem;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.implementations.ContainerUpgradeable;
import appeng.container.implementations.CraftingCPURecord;
import appeng.crafting.MECraftingInventory;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.me.storage.MEInventoryHandler;
import appeng.me.storage.MEPassThrough;
import appeng.util.inv.ItemSlot;
import appeng.util.prioitylist.IPartitionList;
import com.glodblock.github.client.gui.GuiBaseFluidPatternTerminal;
import com.glodblock.github.client.gui.GuiFCBaseMonitor;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
public class Ae2Reflect {
private static final Field fInventory_container;
private static final Field fInventory_containerUpgrade;
private static final Field fInventory_width;
private static final Field fAEPass_internal;
private static final Field fAEInv_partitionList;
private static final Field fCPU_cpu;
private static final Field fCPU_myName;
private static final Field fCPU_processors;
private static final Field fCPU_size;
private static final Field fCPU_inventory;
private static final Field fCPU_machineSrc;
private static final Method mItemSlot_setExtractable;
private static final Method mCPU_getGrid;
private static final Method mCPU_postChange;
private static final Method mCPU_markDirty;
static {
try {
fInventory_container = reflectField(InventoryCrafting.class, "eventHandler", "field_70465_c", "c");
fInventory_containerUpgrade = reflectField(ContainerUpgradeable.class, "upgradeable");
fInventory_width = reflectField(InventoryCrafting.class, "inventoryWidth", "field_70464_b", "b");
fAEPass_internal = reflectField(MEPassThrough.class, "internal");
fAEInv_partitionList = reflectField(MEInventoryHandler.class, "myPartitionList");
fCPU_cpu = Ae2Reflect.reflectField(CraftingCPURecord.class, "cpu");
fCPU_myName = Ae2Reflect.reflectField(CraftingCPURecord.class, "myName");
fCPU_processors = Ae2Reflect.reflectField(CraftingCPURecord.class, "processors");
fCPU_size = Ae2Reflect.reflectField(CraftingCPURecord.class, "size");
fCPU_inventory = Ae2Reflect.reflectField(CraftingCPUCluster.class, "inventory");
fCPU_machineSrc = Ae2Reflect.reflectField(CraftingCPUCluster.class, "machineSrc");
mItemSlot_setExtractable = reflectMethod(ItemSlot.class, "setExtractable", boolean.class);
mCPU_getGrid = reflectMethod(CraftingCPUCluster.class, "getGrid");
mCPU_postChange = reflectMethod(CraftingCPUCluster.class, "postChange", IAEItemStack.class, BaseActionSource.class);
mCPU_markDirty = reflectMethod(CraftingCPUCluster.class, "markDirty");
} catch (Exception e) {
throw new IllegalStateException("Failed to initialize AE2 reflection hacks!", e);
}
@@ -104,14 +102,6 @@ public class Ae2Reflect {
return Ae2Reflect.readField(me, fAEPass_internal);
}
public static Container getCraftContainer(InventoryCrafting inv) {
return Ae2Reflect.readField(inv, fInventory_container);
}
public static int getCraftWidth(InventoryCrafting inv) {
return Ae2Reflect.readField(inv, fInventory_width);
}
public static void setItemSlotExtractable(ItemSlot slot, boolean extractable) {
try {
mItemSlot_setExtractable.invoke(slot, extractable);
@@ -140,4 +130,40 @@ public class Ae2Reflect {
return Ae2Reflect.readField(container, fInventory_containerUpgrade);
}
public static IGrid getGrid(CraftingCPUCluster cpu) {
try {
return (IGrid) mCPU_getGrid.invoke(cpu);
} catch (Exception e) {
throw new IllegalStateException("Failed to invoke method: " + mCPU_getGrid, e);
}
}
public static MECraftingInventory getCPUInventory(CraftingCPUCluster cpu) {
return Ae2Reflect.readField(cpu, fCPU_inventory);
}
public static void setCPUInventory(CraftingCPUCluster cpu, MECraftingInventory value) {
Ae2Reflect.writeField(cpu, fCPU_inventory, value);
}
public static MachineSource getCPUSource(CraftingCPUCluster cpu) {
return Ae2Reflect.readField(cpu, fCPU_machineSrc);
}
public static void postCPUChange(CraftingCPUCluster cpu, IAEItemStack stack, MachineSource src) {
try {
mCPU_postChange.invoke(cpu, stack, src);
} catch (Exception e) {
throw new IllegalStateException("Failed to invoke method: " + mCPU_postChange, e);
}
}
public static void markCPUDirty(CraftingCPUCluster cpu) {
try {
mCPU_markDirty.invoke(cpu);
} catch (Exception e) {
throw new IllegalStateException("Failed to invoke method: " + mCPU_markDirty, e);
}
}
}
@@ -4,12 +4,8 @@ import appeng.client.gui.AEBaseGui;
import appeng.client.gui.implementations.GuiCraftingStatus;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.render.AppEngRenderItem;
import com.glodblock.github.client.gui.GuiBaseFluidPatternTerminal;
import com.glodblock.github.client.gui.GuiFCBaseMonitor;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@@ -23,34 +19,18 @@ public class Ae2ReflectClient {
private static final Field fAEBaseGui_stackSizeRenderer;
private static final Field fGuiCraftingStatus_originalGuiBtn;
private static final Field fGuiPatternTerm_container;
private static final Field fGuiCPUStatus_icon;
private static final Field fGuiMEMonitorable_monitorableContainer;
private static final Field fGuiMEMonitorable_configSrc;
private static final Field fGuiMEMonitorable_craftingStatusBtn;
private static final Field fGuiContainer_guiLeft;
private static final Field fGuiContainer_guiTop;
private static final Field fGui_drag;
private static final Method mGuiPatternTerm_inventorySlots;
private static final Method mGuiPatternTerm_reservedSpace;
private static final Method mGuiPatternTerm_reservedSpaceSetter;
static {
try {
fAEBaseGui_stackSizeRenderer = Ae2Reflect.reflectField(AEBaseGui.class, "aeRenderItem");
fGuiCraftingStatus_originalGuiBtn = Ae2Reflect.reflectField(GuiCraftingStatus.class, "originalGuiBtn");
fGuiPatternTerm_container = Ae2Reflect.reflectField(GuiBaseFluidPatternTerminal.class, "container");
fGuiMEMonitorable_monitorableContainer = Ae2Reflect.reflectField(GuiFCBaseMonitor.class, "monitorableContainer");
fGuiMEMonitorable_configSrc = Ae2Reflect.reflectField(GuiFCBaseMonitor.class, "configSrc");
fGuiMEMonitorable_craftingStatusBtn = Ae2Reflect.reflectField(GuiFCBaseMonitor.class, "craftingStatusBtn");
fGuiCPUStatus_icon = Ae2Reflect.reflectField(GuiCraftingStatus.class, "myIcon");
fGuiContainer_guiLeft = Ae2Reflect.reflectField(GuiContainer.class, "guiLeft", "field_147003_i", "i");
fGuiContainer_guiTop = Ae2Reflect.reflectField(GuiContainer.class, "guiTop", "field_147009_r", "r");
fGui_drag = Ae2Reflect.reflectField(AEBaseGui.class, "drag_click");
mGuiPatternTerm_inventorySlots = Ae2Reflect.reflectMethod(AEBaseGui.class, "getInventorySlots");
mGuiPatternTerm_reservedSpace = Ae2Reflect.reflectMethod(GuiFCBaseMonitor.class, "getReservedSpace");
mGuiPatternTerm_reservedSpaceSetter = Ae2Reflect.reflectMethod(GuiFCBaseMonitor.class, "setReservedSpace", int.class);
} catch (NoSuchFieldException | NoSuchMethodException e) {
throw new IllegalStateException("Failed to initialize AE2 reflection hacks!", e);
}
@@ -73,30 +53,6 @@ public class Ae2ReflectClient {
return Ae2Reflect.readField(gui, fGui_drag);
}
public static int getGuiLeft(GuiContainer gui) {
return Ae2Reflect.readField(gui, fGuiContainer_guiLeft);
}
public static int getGuiTop(GuiContainer gui) {
return Ae2Reflect.readField(gui, fGuiContainer_guiTop);
}
public static void setReservedSpace(GuiFCBaseMonitor gui, int size) {
try {
mGuiPatternTerm_reservedSpaceSetter.invoke(gui, size);
} catch (Exception e) {
throw new IllegalStateException("Failed to invoke method: " + mGuiPatternTerm_reservedSpaceSetter, e);
}
}
public static int getReservedSpace(GuiFCBaseMonitor gui) {
try {
return (int) mGuiPatternTerm_reservedSpace.invoke(gui);
} catch (Exception e) {
throw new IllegalStateException("Failed to invoke method: " + mGuiPatternTerm_reservedSpace, e);
}
}
public static AppEngRenderItem getStackSizeRenderer(AEBaseGui gui) {
return Ae2Reflect.readField(gui, fAEBaseGui_stackSizeRenderer);
}
@@ -105,14 +61,4 @@ public class Ae2ReflectClient {
return Ae2Reflect.readField(gui, fGuiCraftingStatus_originalGuiBtn);
}
public static void setGuiContainer(GuiBaseFluidPatternTerminal instance, ContainerFluidPatternTerminal container) {
Ae2Reflect.writeField(instance, fGuiPatternTerm_container, container);
Ae2Reflect.writeField(instance, fGuiMEMonitorable_monitorableContainer, container);
Ae2Reflect.writeField(instance, fGuiMEMonitorable_configSrc, container.getConfigManager());
}
public static GuiTabButton getCraftingStatusButton(GuiFCBaseMonitor gui) {
return Ae2Reflect.readField(gui, fGuiMEMonitorable_craftingStatusBtn);
}
}
@@ -1,30 +1,49 @@
package com.glodblock.github.util;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import javax.annotation.Nonnull;
import java.util.Objects;
public class BlockPos {
private final int x;
private final int y;
private final int z;
private final World w;
public BlockPos(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
this.w = null;
}
public BlockPos(int x, int y, int z, World w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
public BlockPos(@Nonnull TileEntity te) {
this.x = te.xCoord;
this.y = te.yCoord;
this.z = te.zCoord;
this.w = te.getWorldObj();
}
public BlockPos getOffSet(ForgeDirection face) {
return new BlockPos(this.x + face.offsetX, this.y + face.offsetY, this.z + face.offsetZ);
return new BlockPos(this.x + face.offsetX, this.y + face.offsetY, this.z + face.offsetZ, this.w);
}
public TileEntity getTileEntity() {
if (w != null) {
return w.getTileEntity(x, y, z);
}
return null;
}
public int getX() {
@@ -39,11 +58,15 @@ public class BlockPos {
return z;
}
public World getWorld() {
return w;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof BlockPos) {
BlockPos pos = (BlockPos) obj;
return pos.x == x && pos.y == y && pos.z == z;
return pos.x == x && pos.y == y && pos.z == z && Objects.equals(pos.w, w);
}
return false;
}
@@ -22,6 +22,7 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
private IAEItemStack patternStackAe;
private IAEItemStack[] inputs = null, inputsCond = null, outputs = null, outputsCond = null;
private int priority = 0;
private int combine = 0;
public FluidPatternDetails(ItemStack stack) {
this.patternStack = stack;
@@ -42,6 +43,8 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
public void setPriority(int priority) {
this.priority = priority;
}
public void setCombine(int combine){ this.combine = combine;}
public int getCombine(){return combine;}
@Override
public boolean isCraftable() {
@@ -154,6 +157,8 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
//Shits
tag.setTag("in", writeStackArray(checkInitialized(inputs)));
tag.setTag("out", writeStackArray(checkInitialized(outputs)));
tag.setInteger("prioritize",this.getPriority());
tag.setInteger("combine",this.getCombine());
patternStack.setTagCompound(tag);
patternStackAe = Objects.requireNonNull(AEItemStack.create(patternStack));
return patternStack;
@@ -18,6 +18,11 @@ public final class ModAndClassUtil {
public static boolean EIO = false;
public static boolean FTR = false;
public static boolean OC = false;
public static boolean ThE = false;
public static boolean WCT = false;
public static boolean IC2 = false;
public static boolean NEI = false;
public static boolean COFH = false;
public static boolean GTPP = false;
public static boolean isDoubleButton;
@@ -28,6 +33,8 @@ public final class ModAndClassUtil {
public static boolean isShiftTooltip;
public static boolean isBigInterface;
public static Class<?> essentiaGas;
@SuppressWarnings("all")
public static void init() {
@@ -87,6 +94,12 @@ public final class ModAndClassUtil {
isCraftStatus = false;
}
try {
essentiaGas = Class.forName("thaumicenergistics.common.fluids.GaseousEssentia");
} catch (ClassNotFoundException e) {
essentiaGas = null;
}
if (Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi"))
GT5 = true;
if (Loader.isModLoaded("gregapi") && Loader.isModLoaded("gregapi_post"))
@@ -99,6 +112,16 @@ public final class ModAndClassUtil {
FTR = true;
if (Loader.isModLoaded("OpenComputers"))
OC = true;
if (Loader.isModLoaded("thaumicenergistics"))
ThE = true;
if (Loader.isModLoaded("ae2wct"))
WCT = true;
if (Loader.isModLoaded("IC2"))
IC2 = true;
if (Loader.isModLoaded("NotEnoughItems"))
NEI = true;
if (Loader.isModLoaded("CoFHCore"))
COFH = true;
if (Loader.isModLoaded("miscutils"))
GTPP = true;
}
@@ -1,36 +0,0 @@
package com.glodblock.github.util;
import codechicken.nei.PositionedStack;
import net.minecraft.item.ItemStack;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class NEIUtil {
public static List<PositionedStack> compress(List<PositionedStack> list) {
List<PositionedStack> comp = new LinkedList<>();
for (PositionedStack positionedStack : list) {
if (positionedStack == null) continue;
ItemStack currentStack = positionedStack.items[0].copy();
if (currentStack.stackSize == 0) continue;
boolean find = false;
for (PositionedStack storedStack : comp) {
if (storedStack == null) continue;
ItemStack firstStack = storedStack.items[0].copy();
boolean areItemStackEqual = firstStack.isItemEqual(currentStack) && ItemStack.areItemStackTagsEqual(firstStack, currentStack);
if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
find = true;
storedStack.items[0].stackSize = firstStack.stackSize + currentStack.stackSize;
}
}
if (!find) {
comp.add(positionedStack.copy());
}
}
return comp.stream().filter(Objects::nonNull).collect(Collectors.toList());
}
}
@@ -9,6 +9,7 @@ public class NameConst {
public static final String BLOCK_FLUID_PACKET_DECODER = "fluid_packet_decoder";
public static final String BLOCK_FLUID_INTERFACE = "fluid_interface";
public static final String BLOCK_INGREDIENT_BUFFER = "ingredient_buffer";
public static final String BLOCK_LARGE_INGREDIENT_BUFFER = "large_ingredient_buffer";
public static final String BLOCK_OC_PATTERN_EDITOR = "oc_pattern_editor";
public static final String ITEM_FLUID_DROP = "fluid_drop";
@@ -37,7 +38,10 @@ public class NameConst {
public static final String GUI_FLUID_PATTERN_ENCODER = GUI_KEY + BLOCK_FLUID_PATTERN_ENCODER;
public static final String GUI_FLUID_PACKET_DECODER = GUI_KEY + BLOCK_FLUID_PACKET_DECODER;
public static final String GUI_INGREDIENT_BUFFER = GUI_KEY + BLOCK_INGREDIENT_BUFFER;
public static final String GUI_LARGE_INGREDIENT_BUFFER = GUI_KEY + BLOCK_LARGE_INGREDIENT_BUFFER;
public static final String GUI_FLUID_INTERFACE = GUI_KEY + BLOCK_FLUID_INTERFACE;
public static final String GUI_OC_PATTERN_EDITOR = GUI_KEY + BLOCK_OC_PATTERN_EDITOR;
public static final String GUI_FLUID_IMPORT = GUI_KEY + ITEM_PART_FLUID_IMPORT;
public static final String GUI_FLUID_EXPORT = GUI_KEY + ITEM_PART_FLUID_EXPORT;
}
@@ -14,7 +14,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
public final class Util {
+7
View File
@@ -0,0 +1,7 @@
public net.minecraft.inventory.InventoryCrafting field_70465_c # eventHandler
public net.minecraft.inventory.InventoryCrafting field_70464_b # inventoryWidth
public net.minecraft.client.gui.inventory.GuiContainer field_147003_i # guiLeft
public net.minecraft.client.gui.inventory.GuiContainer field_147009_r # guiTop
#Pattern Value Setting
public net.minecraft.client.gui.inventory.GuiContainer field_147006_u #theSlot
@@ -26,6 +26,7 @@ tile.fluid_pattern_encoder.name=Fluid Pattern Encoder
tile.fluid_packet_decoder.name=ME Fluid Packet Decoder
tile.fluid_interface.name=ME Dual Interface
tile.ingredient_buffer.name=Ingredient Buffer
tile.large_ingredient_buffer.name=Large Ingredient Buffer
tile.oc_pattern_editor.name=OC Pattern Editor
ae2fc.tooltip.invalid_fluid=Invalid fluid!
@@ -34,12 +35,22 @@ ae2fc.tooltip.fluid_packet=Use a Fluid Packet Decoder to\nconvert this back into
ae2fc.tooltip.empty=Empty
ae2fc.tooltip.dump_tank=Dump Tank Contents
ae2fc.tooltip.switch_fluid_interface=Switch ME Dual Interface GUI
ae2fc.tooltip.not_combine=Merge the same items
ae2fc.tooltip.not_combine.hint=Disabled
ae2fc.tooltip.combine=Merge the same items
ae2fc.tooltip.combine.hint=Enabled
ae2fc.tooltip.not_prio=Allow fluids to be placed first
ae2fc.tooltip.not_prio.hint=Enabled
ae2fc.tooltip.prio=Allow fluids to be placed first
ae2fc.tooltip.prio.hint=Disabled
ae2fc.gui.part_fluid_pattern_terminal=Fluid Pattern Terminal
ae2fc.gui.part_fluid_pattern_terminal_ex=Fluid Processing Pattern Terminal
ae2fc.gui.fluid_pattern_encoder=Fluid Pattern Encoder
ae2fc.gui.fluid_packet_decoder=ME Fluid Packet Decoder
ae2fc.gui.ingredient_buffer=Ingredient Buffer
ae2fc.gui.large_ingredient_buffer=Large Ingredient Buffer
ae2fc.gui.fluid_interface=ME Dual Interface
ae2fc.gui.fluid_interface.0=D
ae2fc.gui.fluid_interface.1=U
@@ -48,3 +59,7 @@ ae2fc.gui.fluid_interface.3=S
ae2fc.gui.fluid_interface.4=W
ae2fc.gui.fluid_interface.5=E
ae2fc.gui.oc_pattern_editor=OC Pattern Editor
ae2fc.gui.button.set=Set
ae2fc.gui.part_fluid_import=ME Fluid Import Bus
ae2fc.gui.part_fluid_export=ME Fluid Export Bus
itemGroup.ae2fc=Fluid Craft For AE2
@@ -0,0 +1,65 @@
item.fluid_drop.name=%s液滴
item.fluid_encoded_pattern.name=编码样板
item.part_fluid_pattern_terminal.name=ME流体样板终端
item.part_fluid_pattern_terminal_ex.name=ME增广流体样板终端
item.part_fluid_interface.name=ME二合一接口
item.part_fluid_import.name=ME流体输入总线
item.part_fluid_export.name=ME流体输出总线
item.fluid_packet.name=流体封包
item.fluid_storage.1.name=1k-ME流体存储元件
item.fluid_storage.4.name=4k-ME流体存储元件
item.fluid_storage.16.name=16k-ME流体存储元件
item.fluid_storage.64.name=64k-ME流体存储元件
item.fluid_storage.256.name=256k-ME流体存储元件
item.fluid_storage.1024.name=1024k-ME流体存储元件
item.fluid_storage.4096.name=4096k-ME流体存储元件
item.fluid_part.0.name=1k-ME流体存储组件
item.fluid_part.1.name=4k-ME流体存储组件
item.fluid_part.2.name=16k-ME流体存储组件
item.fluid_part.3.name=64k-ME流体存储组件
item.fluid_part.4.name=256k-ME流体存储组件
item.fluid_part.5.name=1024k-ME流体存储组件
item.fluid_part.6.name=4096k-ME流体存储组件
tile.fluid_discretizer.name=ME流体离散器
tile.fluid_pattern_encoder.name=流体适配型样板编码台
tile.fluid_packet_decoder.name=ME流体封包解码器
tile.fluid_interface.name=ME二合一接口
tile.ingredient_buffer.name=原材料缓存仓
tile.large_ingredient_buffer.name=大型原材料缓存仓
tile.oc_pattern_editor.name=OC样板编辑器
ae2fc.tooltip.invalid_fluid=流体无效!
ae2fc.tooltip.encode_pattern=编写样板
ae2fc.tooltip.fluid_packet=使用ME流体封包解码器\n来将其转换回流体形式。
ae2fc.tooltip.empty=空
ae2fc.tooltip.dump_tank=排空该流体槽
ae2fc.tooltip.switch_fluid_interface=切换ME二合一接口GUI
ae2fc.tooltip.not_combine=合并输出相同物品
ae2fc.tooltip.not_combine.hint=禁用
ae2fc.tooltip.combine=合并输出相同物品
ae2fc.tooltip.combine.hint=启用
ae2fc.tooltip.not_prio=优先放置流体
ae2fc.tooltip.not_prio.hint=启用
ae2fc.tooltip.prio=优先放置流体
ae2fc.tooltip.prio.hint=禁用
ae2fc.gui.part_fluid_pattern_terminal=ME流体样板终端
ae2fc.gui.part_fluid_pattern_terminal_ex=ME增广流体样板终端
ae2fc.gui.fluid_pattern_encoder=流体适配型样板编码台
ae2fc.gui.fluid_packet_decoder=ME流体封包解码器
ae2fc.gui.ingredient_buffer=原材料缓存仓
ae2fc.gui.large_ingredient_buffer=大型原材料缓存仓
ae2fc.gui.fluid_interface=ME二合一接口
ae2fc.gui.fluid_interface.0=下
ae2fc.gui.fluid_interface.1=上
ae2fc.gui.fluid_interface.2=北
ae2fc.gui.fluid_interface.3=南
ae2fc.gui.fluid_interface.4=西
ae2fc.gui.fluid_interface.5=东
ae2fc.gui.oc_pattern_editor=OC样板编辑器
ae2fc.gui.button.set=设置
ae2fc.gui.part_fluid_import=ME流体输入总线
ae2fc.gui.part_fluid_export=ME流体输出总线
itemGroup.ae2fc=AE2流体合成套件重置
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff. Show more