mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-15 09:34:42 +00:00
Merge branch 'master' into upstream
This commit is contained in:
27 files changed
+670
-355
No files matched your search
@@ -0,0 +1,9 @@
|
||||
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
|
||||
@@ -0,0 +1,45 @@
|
||||
# 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
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main ]
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
|
||||
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
|
||||
@@ -0,0 +1,51 @@
|
||||
# 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:
|
||||
- '*'
|
||||
|
||||
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 }}
|
||||
+74
-20
@@ -1,4 +1,4 @@
|
||||
//version: 1644894948
|
||||
//version: 1650343995
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
|
||||
@@ -6,12 +6,11 @@ Also, you may replace this file at any time if there is an update available.
|
||||
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
|
||||
*/
|
||||
|
||||
import org.gradle.internal.logging.text.StyledTextOutput
|
||||
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
||||
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
||||
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@@ -104,6 +103,7 @@ checkPropertyExists("usesShadowedDependencies")
|
||||
checkPropertyExists("developmentEnvironmentUserName")
|
||||
|
||||
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
|
||||
boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean()
|
||||
|
||||
String javaSourceDir = "src/main/java/"
|
||||
String scalaSourceDir = "src/main/scala/"
|
||||
@@ -180,6 +180,11 @@ catch (Exception ignored) {
|
||||
}
|
||||
|
||||
// Pulls version first from the VERSION env and then git tag
|
||||
String identifiedVersion
|
||||
String versionOverride = System.getenv("VERSION") ?: null
|
||||
try {
|
||||
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
out.style(Style.Failure).text(
|
||||
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
|
||||
@@ -187,11 +192,15 @@ catch (Exception ignored) {
|
||||
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
|
||||
)
|
||||
versionOverride = 'NO-GIT-TAG-SET'
|
||||
identifiedVersion = versionOverride
|
||||
}
|
||||
String versionTag = gitVersion().split("-")[gitVersion().split("-").length - 1]
|
||||
version = minecraftVersion + '-' + versionTag
|
||||
version = minecraftVersion + '-' + identifiedVersion
|
||||
ext {
|
||||
modVersion = versionTag
|
||||
modVersion = identifiedVersion
|
||||
}
|
||||
|
||||
if(identifiedVersion == versionOverride) {
|
||||
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
|
||||
}
|
||||
|
||||
group = modGroup
|
||||
@@ -205,13 +214,17 @@ else {
|
||||
def arguments = []
|
||||
def jvmArguments = []
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
if (usesMixins.toBoolean()) {
|
||||
arguments += [
|
||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||
]
|
||||
jvmArguments += [
|
||||
"-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"
|
||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
||||
]
|
||||
if (usesMixinDebug.toBoolean()) {
|
||||
jvmArguments += [
|
||||
"-Dmixin.debug.countInjections=true",
|
||||
"-Dmixin.debug.verbose=true",
|
||||
"-Dmixin.debug.export=true"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
@@ -303,18 +316,23 @@ def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfig
|
||||
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
|
||||
|
||||
task generateAssets {
|
||||
if(usesMixins.toBoolean()) {
|
||||
getFile("/src/main/resources/mixins." + modId + ".json").text = """{
|
||||
if (usesMixins.toBoolean()) {
|
||||
def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json");
|
||||
if (!mixinConfigFile.exists()) {
|
||||
mixinConfigFile.text = """{
|
||||
"required": true,
|
||||
"minVersion": "0.7.11",
|
||||
"package": "${modGroup}.${mixinsPackage}",
|
||||
"plugin": "${modGroup}.${mixinPlugin}",
|
||||
"refmap": "${mixingConfigRefMap}",
|
||||
"target": "@env(DEFAULT)",
|
||||
"compatibilityLevel": "JAVA_8"
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [],
|
||||
"client": [],
|
||||
"server": []
|
||||
}
|
||||
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,7 +471,7 @@ def getManifestAttributes() {
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from (sourceSets.main.allJava)
|
||||
from (sourceSets.main.allSource)
|
||||
from (file("$projectDir/LICENSE"))
|
||||
getArchiveClassifier().set('sources')
|
||||
}
|
||||
@@ -508,7 +526,7 @@ task devJar(type: Jar) {
|
||||
}
|
||||
|
||||
task apiJar(type: Jar) {
|
||||
from (sourceSets.main.allJava) {
|
||||
from (sourceSets.main.allSource) {
|
||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
||||
}
|
||||
|
||||
@@ -550,7 +568,7 @@ publishing {
|
||||
artifact source: shadowJar, classifier: ""
|
||||
}
|
||||
if(!noPublishedSources) {
|
||||
artifact source: sourcesJar, classifier: "src"
|
||||
artifact source: sourcesJar, classifier: "sources"
|
||||
}
|
||||
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
|
||||
if (apiPackage) {
|
||||
@@ -560,7 +578,7 @@ publishing {
|
||||
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
|
||||
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
|
||||
// Using the identified version, not project.version as it has the prepended 1.7.10
|
||||
version = System.getenv("RELEASE_VERSION") ?: versionTag
|
||||
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
|
||||
|
||||
// remove extra garbage from minecraft and minecraftDeps configuration
|
||||
pom.withXml {
|
||||
@@ -597,10 +615,46 @@ publishing {
|
||||
// Updating
|
||||
task updateBuildScript {
|
||||
doLast {
|
||||
if (performBuildScriptUpdate(projectDir.toString())) return
|
||||
|
||||
print("Build script already up-to-date!")
|
||||
}
|
||||
}
|
||||
|
||||
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
|
||||
if (autoUpdateBuildScript.toBoolean()) {
|
||||
performBuildScriptUpdate(projectDir.toString())
|
||||
} else {
|
||||
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
|
||||
}
|
||||
}
|
||||
|
||||
static URL availableBuildScriptUrl() {
|
||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
|
||||
}
|
||||
|
||||
boolean performBuildScriptUpdate(String projectDir) {
|
||||
if (isNewBuildScriptVersionAvailable(projectDir)) {
|
||||
def buildscriptFile = getFile("build.gradle")
|
||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
||||
out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
boolean isNewBuildScriptVersionAvailable(String projectDir) {
|
||||
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
|
||||
|
||||
String currentBuildScript = getFile("build.gradle").getText()
|
||||
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
||||
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
|
||||
String availableBuildScriptHash = getVersionHash(availableBuildScript)
|
||||
|
||||
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
|
||||
return !isUpToDate
|
||||
}
|
||||
|
||||
static String getVersionHash(String buildScriptContent) {
|
||||
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
|
||||
if(versionLine != null) {
|
||||
|
||||
+5
-2
@@ -1,10 +1,11 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.12-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-75-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-87-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")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.4:dev")
|
||||
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.27:dev")
|
||||
@@ -16,4 +17,6 @@ dependencies {
|
||||
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:GTplusplus:1.7.49:dev") {transitive = false}
|
||||
|
||||
}
|
||||
@@ -2,9 +2,11 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.ItemSubstitution;
|
||||
import appeng.api.config.PatternSlotConfig;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.FCBasePartContainerEx;
|
||||
@@ -16,6 +18,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
|
||||
@@ -27,14 +30,20 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
private GuiImgButton substitutionsEnabledBtn;
|
||||
private GuiImgButton substitutionsDisabledBtn;
|
||||
private GuiImgButton encodeBtn;
|
||||
private GuiImgButton invertBtn;
|
||||
private GuiImgButton clearBtn;
|
||||
private GuiImgButton doubleBtn;
|
||||
|
||||
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);
|
||||
|
||||
processingScrollBar.setHeight(70).setWidth(7).setLeft(6).setRange(0, 1, 1);
|
||||
processingScrollBar.setTexture(FluidCraft.MODID, "gui/pattern3.png", 242, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,19 +53,23 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
|
||||
if( this.encodeBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Encode", isShiftKeyDown() ? "2" : "1" ) );
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Encode", isShiftKeyDown() ? "2" : "1" ) );
|
||||
}
|
||||
else if( this.clearBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Clear", "1" ) );
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Clear", "1" ) );
|
||||
}
|
||||
else if( this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
|
||||
}
|
||||
else if( this.invertBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Invert", container.inverted ? "0" : "1" ) );
|
||||
}
|
||||
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn)
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Double", Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) ? "1": "0") );
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Double", Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) ? "1": "0") );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +87,10 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
this.substitutionsDisabledBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.substitutionsDisabledBtn );
|
||||
|
||||
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 );
|
||||
|
||||
this.clearBtn = new GuiImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE );
|
||||
this.clearBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.clearBtn );
|
||||
@@ -86,6 +103,8 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
this.doubleBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.doubleBtn );
|
||||
}
|
||||
|
||||
processingScrollBar.setTop(this.ySize - 164);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,12 +126,13 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
|
||||
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.processingScrollBar.draw(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground()
|
||||
{
|
||||
return "gui/pattern3.png";
|
||||
return container.inverted ? "gui/pattern4.png" : "gui/pattern3.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,4 +148,82 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float btn )
|
||||
{
|
||||
|
||||
if (container.substitute) {
|
||||
substitutionsEnabledBtn.visible = true;
|
||||
substitutionsDisabledBtn.visible = false;
|
||||
} else {
|
||||
substitutionsEnabledBtn.visible = false;
|
||||
substitutionsDisabledBtn.visible = true;
|
||||
}
|
||||
|
||||
final int offset = container.inverted? 18 * -3: 0;
|
||||
|
||||
substitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
substitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
doubleBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
clearBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
invertBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
|
||||
processingScrollBar.setCurrentScroll(container.activePage);
|
||||
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked( final int xCoord, final int yCoord, final int btn )
|
||||
{
|
||||
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||
this.processingScrollBar.click(this, xCoord - this.guiLeft, yCoord - this.guiTop);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
|
||||
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||
changeActivePage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove( final int x, final int y, final int c, final long d )
|
||||
{
|
||||
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||
this.processingScrollBar.click(this, x - this.guiLeft, y - this.guiTop );
|
||||
super.mouseClickMove(x, y, c, d);
|
||||
|
||||
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||
changeActivePage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput()
|
||||
{
|
||||
super.handleMouseInput();
|
||||
|
||||
final int wheel = Mouse.getEventDWheel();
|
||||
|
||||
if (wheel != 0) {
|
||||
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight;
|
||||
|
||||
if (this.processingScrollBar.contains(x - this.guiLeft, y - this.guiTop)) {
|
||||
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||
this.processingScrollBar.wheel(wheel);
|
||||
|
||||
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||
changeActivePage();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void changeActivePage()
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.ActivePage", String.valueOf(this.processingScrollBar.getCurrentScroll())));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,12 +31,9 @@ import appeng.util.Platform;
|
||||
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.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -94,14 +91,9 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
this.setScrollBar( scrollbar );
|
||||
this.repo = new ItemRepo( scrollbar, this );
|
||||
|
||||
this.xSize = 185;
|
||||
this.xSize = 195;
|
||||
this.ySize = 204;
|
||||
|
||||
if( te instanceof IViewCellStorage)
|
||||
{
|
||||
this.xSize += 33;
|
||||
}
|
||||
|
||||
this.standardSize = this.xSize;
|
||||
|
||||
this.configSrc = ( (IConfigurableObject) this.inventorySlots ).getConfigManager();
|
||||
@@ -312,7 +304,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
{
|
||||
if( s instanceof AppEngSlot)
|
||||
{
|
||||
if( ( (Slot) s ).xDisplayPosition < 197 )
|
||||
if( ( (Slot) s ).xDisplayPosition < 195 )
|
||||
{
|
||||
this.repositionSlot( (AppEngSlot) s );
|
||||
}
|
||||
@@ -589,7 +581,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
{
|
||||
|
||||
this.bindTextureBack( this.getBackground() );
|
||||
final int x_width = 197;
|
||||
final int x_width = 195;
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
|
||||
|
||||
if( this.viewCell )
|
||||
@@ -759,4 +751,31 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
{
|
||||
return searchField.isMouseIn(x,y);
|
||||
}
|
||||
|
||||
public boolean hideItemPanelSlot(int tx, int ty, int tw, int th)
|
||||
{
|
||||
|
||||
if (this.viewCell) {
|
||||
int rw = 33;
|
||||
int rh = 14 + myCurrentViewCells.length * 18;
|
||||
|
||||
if (rw <= 0 || rh <= 0 || tw <= 0 || th <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int rx = this.guiLeft + this.xSize;
|
||||
int ry = this.guiTop + 0;
|
||||
|
||||
rw += rx;
|
||||
rh += ry;
|
||||
tw += tx;
|
||||
th += ty;
|
||||
|
||||
// overflow || intersect
|
||||
return (rw < rx || rw > tx) && (rh < ry || rh > ty) && (tw < tx || tw > rx) && (th < ty || th > ry);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+12
-16
@@ -23,9 +23,6 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ContainerFluidPatternTerminal extends FCBasePartContainer implements PatternConsumer {
|
||||
|
||||
public ContainerFluidPatternTerminal(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
@@ -112,23 +109,22 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
|
||||
|
||||
private static IAEItemStack[] collectInventory(Slot[] slots) {
|
||||
// see note at top of FluidPatternDetails
|
||||
List<IAEItemStack> acc = new ArrayList<>();
|
||||
for (Slot slot : slots) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if (stack == null) {
|
||||
continue;
|
||||
}
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack));
|
||||
if (dropStack != null) {
|
||||
acc.add(dropStack);
|
||||
continue;
|
||||
IAEItemStack[] stacks = new IAEItemStack[slots.length];
|
||||
for (int i = 0; i < stacks.length; i++) {
|
||||
ItemStack stack = slots[i].getStack();
|
||||
if (stack != null) {
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack));
|
||||
if (dropStack != null) {
|
||||
stacks[i] = dropStack;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
IAEItemStack aeStack = AEItemStack.create(stack);
|
||||
acc.add(aeStack);
|
||||
stacks[i] = aeStack;
|
||||
}
|
||||
return acc.toArray(new IAEItemStack[0]);
|
||||
return stacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+14
-20
@@ -4,8 +4,7 @@ import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
@@ -23,9 +22,6 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx implements PatternConsumer {
|
||||
|
||||
public ContainerFluidPatternTerminalEx(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
@@ -109,23 +105,22 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
|
||||
private static IAEItemStack[] collectInventory(Slot[] slots) {
|
||||
// see note at top of FluidPatternDetails
|
||||
List<IAEItemStack> acc = new ArrayList<>();
|
||||
for (Slot slot : slots) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if (stack == null) {
|
||||
continue;
|
||||
}
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack));
|
||||
if (dropStack != null) {
|
||||
acc.add(dropStack);
|
||||
continue;
|
||||
IAEItemStack[] stacks = new IAEItemStack[slots.length];
|
||||
for (int i = 0; i < stacks.length; i++) {
|
||||
ItemStack stack = slots[i].getStack();
|
||||
if (stack != null) {
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack));
|
||||
if (dropStack != null) {
|
||||
stacks[i] = dropStack;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
IAEItemStack aeStack = AEItemStack.create(stack);
|
||||
acc.add(aeStack);
|
||||
stacks[i] = aeStack;
|
||||
}
|
||||
return acc.toArray(new IAEItemStack[0]);
|
||||
return stacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,8 +150,7 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
if ((slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs) && stack != null
|
||||
&& (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
|
||||
if ((slot instanceof OptionalSlotFake) && stack != null && (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
|
||||
FluidStack fluid = null;
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
|
||||
@@ -565,7 +565,7 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long emptyStots = enabledSlots.stream().filter(s -> s.getStack() == null).count();
|
||||
long fullSlots = enabledSlots.stream().filter(s-> s.getStack() != null && s.getStack().stackSize * 2 > 127).count();
|
||||
return fullSlots <= emptyStots;
|
||||
return fullSlots <= emptyStots && emptyStots < enabledSlots.size();
|
||||
}
|
||||
|
||||
static void doubleStacksInternal(SlotFake[] slots)
|
||||
|
||||
+84
-25
@@ -32,36 +32,62 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
||||
|
||||
private static final int CRAFTING_GRID_PAGES = 2;
|
||||
private static final int CRAFTING_GRID_WIDTH = 4;
|
||||
private static final int CRAFTING_GRID_HEIGHT = 4;
|
||||
private static final int CRAFTING_GRID_SLOTS = CRAFTING_GRID_WIDTH * CRAFTING_GRID_HEIGHT;
|
||||
|
||||
private static class ProcessingSlotFake extends OptionalSlotFake {
|
||||
|
||||
private static final int POSITION_SHIFT = 9000;
|
||||
private boolean hidden = false;
|
||||
|
||||
public ProcessingSlotFake(IInventory inv, IOptionalSlotHost containerBus, int idx, int x, int y, int offX, int offY, int groupNum) {
|
||||
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
|
||||
this.setRenderDisabled(false);
|
||||
}
|
||||
|
||||
public void setHidden(boolean hide) {
|
||||
if (this.hidden != hide) {
|
||||
this.hidden = hide;
|
||||
this.xDisplayPosition += (hide ? -1 : 1) * POSITION_SHIFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final PartFluidPatternTerminalEx patternTerminal;
|
||||
protected final SlotFakeCraftingMatrix[] craftingSlots = new SlotFakeCraftingMatrix[16];
|
||||
protected final OptionalSlotFake[] outputSlots = new OptionalSlotFake[4];
|
||||
protected final ProcessingSlotFake[] craftingSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
protected final ProcessingSlotFake[] outputSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
protected final SlotRestrictedInput patternSlotIN;
|
||||
protected final SlotRestrictedInput patternSlotOUT;
|
||||
@GuiSync( 96 )
|
||||
@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;
|
||||
|
||||
public FCBasePartContainerEx(final InventoryPlayer ip, final ITerminalHost monitorable )
|
||||
{
|
||||
super( ip, monitorable, false );
|
||||
this.patternTerminal = (PartFluidPatternTerminalEx) monitorable;
|
||||
this.inverted = patternTerminal.isInverted();
|
||||
|
||||
final IInventory patternInv = this.getPatternTerminal().getInventoryByName( "pattern" );
|
||||
final IInventory output = this.getPatternTerminal().getInventoryByName( "output" );
|
||||
|
||||
IInventory crafting = this.getPatternTerminal().getInventoryByName("crafting");
|
||||
|
||||
for( int y = 0; y < 4; y++ )
|
||||
{
|
||||
for( int x = 0; x < 4; x++ )
|
||||
{
|
||||
this.addSlotToContainer( this.craftingSlots[x + y * 4] = new SlotFakeCraftingMatrix(crafting, x + y * 4, 15 + x * 18, -83 + y * 18 ) );
|
||||
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
|
||||
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||
this.addSlotToContainer(this.craftingSlots[x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(crafting, this, x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS, 15, -83, x, y, x + 4));
|
||||
}
|
||||
}
|
||||
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||
this.addSlotToContainer(this.outputSlots[x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(output, this, x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS, 112, -83, -x, y, x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( int y = 0; y < 4; y++ )
|
||||
{
|
||||
this.addSlotToContainer( this.outputSlots[y] = new SlotPatternOutputs( output, this, y, 112, -83, 0, y, 1 ) );
|
||||
this.outputSlots[y].setRenderDisabled( false );
|
||||
}
|
||||
|
||||
this.addSlotToContainer( this.patternSlotIN = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, this.getInventoryPlayer() ) );
|
||||
@@ -184,7 +210,7 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
|
||||
private ItemStack[] getInputs()
|
||||
{
|
||||
final ItemStack[] input = new ItemStack[16];
|
||||
final ItemStack[] input = new ItemStack[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
boolean hasValue = false;
|
||||
|
||||
for( int x = 0; x < this.craftingSlots.length; x++ )
|
||||
@@ -206,7 +232,7 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
|
||||
private ItemStack[] getOutputs()
|
||||
{
|
||||
final List<ItemStack> list = new ArrayList<>( 4 );
|
||||
final List<ItemStack> list = new ArrayList<>( CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES );
|
||||
boolean hasValue = false;
|
||||
|
||||
for( final OptionalSlotFake outputSlot : this.outputSlots )
|
||||
@@ -260,17 +286,14 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
@Override
|
||||
public boolean isSlotEnabled( final int idx )
|
||||
{
|
||||
if( idx == 1 )
|
||||
if (idx < 4) // outputs
|
||||
{
|
||||
Platform.isServer();
|
||||
return true;
|
||||
return inverted || idx == 0;
|
||||
}
|
||||
else if( idx == 2 )
|
||||
else
|
||||
{
|
||||
Platform.isServer();
|
||||
return false;
|
||||
return !inverted || idx == 4;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -280,6 +303,32 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
this.substitute = this.patternTerminal.isSubstitution();
|
||||
if (inverted != patternTerminal.isInverted() || activePage != patternTerminal.getActivePage()) {
|
||||
inverted = patternTerminal.isInverted();
|
||||
activePage = patternTerminal.getActivePage();
|
||||
offsetSlots();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void offsetSlots()
|
||||
{
|
||||
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
|
||||
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||
this.craftingSlots[x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS].setHidden(page != activePage || x > 0 && inverted);
|
||||
this.outputSlots[x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS].setHidden(page != activePage || x > 0 && !inverted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(String field, Object oldValue, Object newValue) {
|
||||
super.onUpdate( field, oldValue, newValue );
|
||||
|
||||
if (field.equals( "inverted" ) || field.equals( "activePage" )) {
|
||||
offsetSlots();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,13 +337,15 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
{
|
||||
if( s == this.patternSlotOUT && Platform.isServer() )
|
||||
{
|
||||
inverted = patternTerminal.isInverted();
|
||||
|
||||
for( final Object crafter : this.crafters )
|
||||
{
|
||||
final ICrafting icrafting = (ICrafting) crafter;
|
||||
|
||||
for( final Object g : this.inventorySlots )
|
||||
{
|
||||
if( g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix )
|
||||
if( g instanceof OptionalSlotFake )
|
||||
{
|
||||
final Slot sri = (Slot) g;
|
||||
icrafting.sendSlotContents( this, sri.slotNumber, sri.getStack() );
|
||||
@@ -403,4 +454,12 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
return fluid > 0;
|
||||
}
|
||||
|
||||
public void setActivePage(final int activePage) {
|
||||
this.activePage = activePage;
|
||||
}
|
||||
|
||||
public int getActivePage() {
|
||||
return this.activePage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -117,100 +117,54 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
public void onChangeInventory0(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
{
|
||||
if( inv == this.pattern && slot == 1 )
|
||||
{
|
||||
final ItemStack is = this.pattern.getStackInSlot( 1 );
|
||||
if( is != null && is.getItem() instanceof ICraftingPatternItem)
|
||||
{
|
||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern.getPatternForItem( is, this.getHost().getTile().getWorldObj() );
|
||||
if( details != null )
|
||||
{
|
||||
this.setCraftingRecipe( details.isCraftable() );
|
||||
this.setSubstitution( details.canSubstitute() );
|
||||
|
||||
for( int x = 0; x < this.crafting.getSizeInventory(); x++ )
|
||||
{
|
||||
this.crafting.setInventorySlotContents( x, null );
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.output.getSizeInventory(); x++ )
|
||||
{
|
||||
this.output.setInventorySlotContents( x, null );
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.crafting.getSizeInventory() && x < details.getInputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getInputs()[x];
|
||||
this.crafting.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.output.getSizeInventory() && x < details.getOutputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getOutputs()[x];
|
||||
this.output.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( inv == this.crafting )
|
||||
{
|
||||
this.fixCraftingRecipes();
|
||||
}
|
||||
|
||||
this.getHost().markForSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
{
|
||||
if (inv == this.pattern && slot == 1) {
|
||||
final ItemStack is = inv.getStackInSlot(1);
|
||||
if (is != null && is.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
final ItemFluidEncodedPattern pattern = (ItemFluidEncodedPattern) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern.getPatternForItem( is, this.getHost().getTile().getWorldObj() );
|
||||
if( details != null )
|
||||
{
|
||||
this.setCraftingRecipe( details.isCraftable() );
|
||||
this.setSubstitution( details.canSubstitute() );
|
||||
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
|
||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern.getPatternForItem(is, this.getHost().getTile().getWorldObj());
|
||||
if (details != null) {
|
||||
final IAEItemStack[] inItems = details.getInputs();
|
||||
final IAEItemStack[] outItems = details.getOutputs();
|
||||
|
||||
for( int x = 0; x < this.crafting.getSizeInventory(); x++ )
|
||||
{
|
||||
this.crafting.setInventorySlotContents( x, null );
|
||||
this.setCraftingRecipe(details.isCraftable());
|
||||
this.setSubstitution(details.canSubstitute());
|
||||
|
||||
for (int i = 0; i < this.crafting.getSizeInventory(); i++) {
|
||||
this.crafting.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.output.getSizeInventory(); x++ )
|
||||
{
|
||||
this.output.setInventorySlotContents( x, null );
|
||||
for (int i = 0; i < this.output.getSizeInventory(); i++) {
|
||||
this.output.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.crafting.getSizeInventory() && x < details.getInputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getInputs()[x];
|
||||
if (item != null && item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.crafting.setInventorySlotContents(x, packet);
|
||||
for (int i = 0; i < this.crafting.getSizeInventory() && i < inItems.length; i++) {
|
||||
if (inItems[i] != null) {
|
||||
final IAEItemStack item = inItems[i];
|
||||
if (item != null && item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.crafting.setInventorySlotContents(i, packet);
|
||||
} else
|
||||
this.crafting.setInventorySlotContents(i, item == null ? null : item.getItemStack());
|
||||
}
|
||||
else this.crafting.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.output.getSizeInventory() && x < details.getOutputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getOutputs()[x];
|
||||
if (item != null && item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.output.setInventorySlotContents(x, packet);
|
||||
for (int i = 0; i < this.output.getSizeInventory() && i < outItems.length; i++) {
|
||||
if (outItems[i] != null) {
|
||||
final IAEItemStack item = outItems[i];
|
||||
if (item != null && item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.output.setInventorySlotContents(i, packet);
|
||||
} else
|
||||
this.output.setInventorySlotContents(i, item == null ? null : item.getItemStack());
|
||||
}
|
||||
else this.output.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
}
|
||||
}
|
||||
this.getHost().markForSave();
|
||||
return;
|
||||
}
|
||||
}
|
||||
onChangeInventory0(inv, slot, mc, removedStack, newStack);
|
||||
this.getHost().markForSave();
|
||||
}
|
||||
|
||||
private void fixCraftingRecipes()
|
||||
|
||||
@@ -11,7 +11,6 @@ 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.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
@@ -34,11 +33,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, 16 );
|
||||
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 4 );
|
||||
private final AppEngInternalInventory crafting = new AppEngInternalInventory( this, 32 );
|
||||
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 32 );
|
||||
private final AppEngInternalInventory pattern = new AppEngInternalInventory( this, 2 );
|
||||
|
||||
private boolean substitute = false;
|
||||
private boolean inverted = false;
|
||||
private int activePage = 0;
|
||||
|
||||
public PartFluidPatternTerminalEx(ItemStack is) {
|
||||
super(is, true);
|
||||
@@ -78,20 +79,26 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
this.setSubstitution( data.getBoolean( "substitute" ) );
|
||||
this.pattern.readFromNBT( data, "pattern" );
|
||||
this.output.readFromNBT( data, "outputList" );
|
||||
this.crafting.readFromNBT( data, "craftingGrid" );
|
||||
|
||||
this.setSubstitution( data.getBoolean( "substitute" ) );
|
||||
this.setInverted( data.getBoolean( "inverted" ) );
|
||||
this.setActivePage( data.getInteger( "activePage" ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
data.setBoolean( "substitute", this.substitute );
|
||||
this.pattern.writeToNBT( data, "pattern" );
|
||||
this.output.writeToNBT( data, "outputList" );
|
||||
this.crafting.writeToNBT( data, "craftingGrid" );
|
||||
|
||||
data.setBoolean( "substitute", this.substitute );
|
||||
data.setBoolean( "inverted", this.inverted );
|
||||
data.setInteger( "activePage", this.activePage );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,94 +121,82 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
public void onChangeInventory0(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
{
|
||||
if( inv == this.pattern && slot == 1 )
|
||||
{
|
||||
final ItemStack is = this.pattern.getStackInSlot( 1 );
|
||||
if( is != null && is.getItem() instanceof ICraftingPatternItem)
|
||||
{
|
||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern.getPatternForItem( is, this.getHost().getTile().getWorldObj() );
|
||||
if( details != null )
|
||||
{
|
||||
this.setSubstitution( details.canSubstitute() );
|
||||
|
||||
for( int x = 0; x < this.crafting.getSizeInventory(); x++ )
|
||||
{
|
||||
this.crafting.setInventorySlotContents( x, null );
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.output.getSizeInventory(); x++ )
|
||||
{
|
||||
this.output.setInventorySlotContents( x, null );
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.crafting.getSizeInventory() && x < details.getInputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getInputs()[x];
|
||||
this.crafting.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.output.getSizeInventory() && x < details.getOutputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getOutputs()[x];
|
||||
this.output.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.getHost().markForSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
{
|
||||
if (inv == this.pattern && slot == 1) {
|
||||
final ItemStack is = inv.getStackInSlot(1);
|
||||
if (is != null && is.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
final ItemFluidEncodedPattern pattern = (ItemFluidEncodedPattern) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern.getPatternForItem( is, this.getHost().getTile().getWorldObj() );
|
||||
if( details != null )
|
||||
{
|
||||
this.setSubstitution( details.canSubstitute() );
|
||||
|
||||
for( int x = 0; x < this.crafting.getSizeInventory(); x++ )
|
||||
{
|
||||
this.crafting.setInventorySlotContents( x, null );
|
||||
}
|
||||
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
|
||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern.getPatternForItem(is, this.getHost().getTile().getWorldObj());
|
||||
|
||||
for( int x = 0; x < this.output.getSizeInventory(); x++ )
|
||||
{
|
||||
this.output.setInventorySlotContents( x, null );
|
||||
}
|
||||
if (details != null) {
|
||||
final IAEItemStack[] inItems = details.getInputs();
|
||||
final IAEItemStack[] outItems = details.getOutputs();
|
||||
int inputsCount = 0;
|
||||
int outputCount = 0;
|
||||
|
||||
for( int x = 0; x < this.crafting.getSizeInventory() && x < details.getInputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getInputs()[x];
|
||||
if (item != null && item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.crafting.setInventorySlotContents(x, packet);
|
||||
for (int i = 0; i < inItems.length; i++) {
|
||||
if (inItems[i] != null) {
|
||||
inputsCount++;
|
||||
}
|
||||
else this.crafting.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
}
|
||||
|
||||
for( int x = 0; x < this.output.getSizeInventory() && x < details.getOutputs().length; x++ )
|
||||
{
|
||||
final IAEItemStack item = details.getOutputs()[x];
|
||||
if (item != null && item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.output.setInventorySlotContents(x, packet);
|
||||
for (int i = 0; i < outItems.length; i++) {
|
||||
if (outItems[i] != null) {
|
||||
outputCount++;
|
||||
}
|
||||
}
|
||||
|
||||
this.setSubstitution(details.canSubstitute());
|
||||
this.setInverted(inputsCount <= 8 && outputCount >= 8);
|
||||
this.setActivePage(0);
|
||||
|
||||
for (int i = 0; i < this.crafting.getSizeInventory(); i++) {
|
||||
this.crafting.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.output.getSizeInventory(); i++) {
|
||||
this.output.setInventorySlotContents(i, null);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.crafting.getSizeInventory() && i < inItems.length; i++) {
|
||||
final IAEItemStack item = inItems[i];
|
||||
if (item != null) {
|
||||
if (item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.crafting.setInventorySlotContents(i, packet);
|
||||
} else this.crafting.setInventorySlotContents(i, item.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
if (inverted) {
|
||||
for (int i = 0; i < this.output.getSizeInventory() && i < outItems.length; i++) {
|
||||
final IAEItemStack item = outItems[i];
|
||||
if (item != null) {
|
||||
if (item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.output.setInventorySlotContents(i, packet);
|
||||
} else this.output.setInventorySlotContents(i, item.getItemStack());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < outItems.length && i < 8; i++) {
|
||||
final IAEItemStack item = outItems[i];
|
||||
if (item != null) {
|
||||
if (item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.output.setInventorySlotContents(i >= 4 ? 12 + i : i, packet);
|
||||
} else
|
||||
this.output.setInventorySlotContents(i >= 4 ? 12 + i : i, item.getItemStack());
|
||||
}
|
||||
}
|
||||
else this.output.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
|
||||
}
|
||||
}
|
||||
this.getHost().markForSave();
|
||||
return;
|
||||
}
|
||||
}
|
||||
onChangeInventory0(inv, slot, mc, removedStack, newStack);
|
||||
this.getHost().markForSave();
|
||||
}
|
||||
|
||||
public boolean isSubstitution()
|
||||
@@ -270,4 +265,20 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInverted() {
|
||||
return inverted;
|
||||
}
|
||||
|
||||
public void setInverted(boolean inverted) {
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
public int getActivePage() {
|
||||
return this.activePage;
|
||||
}
|
||||
|
||||
public void setActivePage(int activePage) {
|
||||
this.activePage = activePage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.glodblock.github.nei;
|
||||
|
||||
import codechicken.nei.api.INEIGuiAdapter;
|
||||
import com.glodblock.github.client.gui.GuiFCBaseMonitor;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
public class NEIGuiHandler extends INEIGuiAdapter {
|
||||
|
||||
@Override
|
||||
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
|
||||
if (gui instanceof GuiFCBaseMonitor) {
|
||||
return ((GuiFCBaseMonitor) gui).hideItemPanelSlot(x, y, w, h);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,8 @@ public class NEI_FC_Config implements IConfigureNEI {
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
API.registerNEIGuiHandler(new NEIGuiHandler());
|
||||
|
||||
for (String identifier : FluidRecipe.getSupportRecipes()) {
|
||||
API.registerGuiOverlayHandler(GuiFluidPatternTerminal.class, FluidPatternTerminalRecipeTransferHandler.INSTANCE, identifier);
|
||||
API.registerGuiOverlayHandler(GuiFluidPatternTerminalEx.class, FluidPatternTerminalRecipeTransferHandler.INSTANCE, identifier);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.glodblock.github.nei.recipes.extractor.*;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import forestry.factory.recipes.nei.*;
|
||||
import gregapi.recipes.Recipe;
|
||||
import gregtech.api.util.GTPP_Recipe;
|
||||
import gregtech.api.util.GT_Recipe;
|
||||
|
||||
public class DefaultExtractorLoader implements Runnable {
|
||||
@@ -27,6 +28,14 @@ public class DefaultExtractorLoader implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.GTPP) {
|
||||
for (GTPP_Recipe.GTPP_Recipe_Map_Internal gtppMap : GTPP_Recipe.GTPP_Recipe_Map_Internal.sMappingsEx) {
|
||||
if (gtppMap.mNEIAllowed) {
|
||||
FluidRecipe.addRecipeMap(gtppMap.mNEIName, new GTPPRecipeExtractor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.EIO) {
|
||||
FluidRecipe.addRecipeMap("EIOEnchanter", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOAlloySmelter", new EnderIORecipeExtractor());
|
||||
@@ -37,6 +46,17 @@ public class DefaultExtractorLoader implements Runnable {
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.FTR) {
|
||||
// GTNH
|
||||
FluidRecipe.addRecipeMap("forestry.bottler", new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
||||
FluidRecipe.addRecipeMap("forestry.carpenter", new ForestryRecipeExtractor(new NEIHandlerCarpenter()));
|
||||
FluidRecipe.addRecipeMap("forestry.centrifuge", new ForestryRecipeExtractor(new NEIHandlerCentrifuge()));
|
||||
FluidRecipe.addRecipeMap("forestry.fabricator", new ForestryRecipeExtractor(new NEIHandlerFabricator()));
|
||||
FluidRecipe.addRecipeMap("forestry.fermenter", new ForestryRecipeExtractor(new NEIHandlerFermenter()));
|
||||
FluidRecipe.addRecipeMap("forestry.moistener", new ForestryRecipeExtractor(new NEIHandlerMoistener()));
|
||||
FluidRecipe.addRecipeMap("forestry.squeezer", new ForestryRecipeExtractor(new NEIHandlerSqueezer()));
|
||||
FluidRecipe.addRecipeMap("forestry.still", new ForestryRecipeExtractor(new NEIHandlerStill()));
|
||||
|
||||
// LEGACY
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCarpenter()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCentrifuge()));
|
||||
|
||||
+3
-29
@@ -5,19 +5,16 @@ 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 crazypants.enderio.nei.VatRecipeHandler;
|
||||
import com.glodblock.github.util.NEIUtil;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.recipes.nei.NEIHandlerFabricator;
|
||||
import forestry.factory.recipes.nei.NEIHandlerSqueezer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
|
||||
@@ -58,7 +55,7 @@ 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 = compress(rawInputs);
|
||||
List<PositionedStack> compressed = NEIUtil.compress(rawInputs);
|
||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||
tmp = getInputIngredients(compressed);
|
||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
||||
@@ -77,7 +74,7 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
removeGlass(rawOutputs);
|
||||
List<OrderStack<?>> tmp = new ArrayList<>();
|
||||
List<PositionedStack> compressed = compress(rawOutputs);
|
||||
List<PositionedStack> compressed = NEIUtil.compress(rawOutputs);
|
||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||
tmp = getOutputIngredients(compressed);
|
||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
|
||||
@@ -97,29 +94,6 @@ public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private 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());
|
||||
}
|
||||
|
||||
private void removeGlass(List<PositionedStack> list) {
|
||||
if (handler instanceof NEIHandlerFabricator) {
|
||||
list.remove(list.size() - 1);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
public class GTPPRecipeExtractor extends GregTech5RecipeExtractor {
|
||||
|
||||
public GTPPRecipeExtractor() {
|
||||
super(false);
|
||||
}
|
||||
|
||||
public GTPPRecipeExtractor(boolean removeSpecial) {
|
||||
super(removeSpecial);
|
||||
}
|
||||
|
||||
}
|
||||
+6
-30
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -12,21 +13,19 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
boolean r;
|
||||
boolean removeSpecial;
|
||||
|
||||
public GregTech5RecipeExtractor(boolean removeSpecial) {
|
||||
r = removeSpecial;
|
||||
this.removeSpecial = removeSpecial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
if (r) removeSpecial(rawInputs);
|
||||
List<PositionedStack> compressed = compress(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;
|
||||
@@ -48,7 +47,7 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
List<PositionedStack> compressed = compress(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;
|
||||
@@ -79,27 +78,4 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
private 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());
|
||||
}
|
||||
|
||||
}
|
||||
+3
-27
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -10,8 +11,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
@@ -24,7 +23,7 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
this.removeMachine(rawInputs);
|
||||
List<PositionedStack> compressed = compress(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;
|
||||
@@ -45,7 +44,7 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
List<PositionedStack> compressed = compress(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;
|
||||
@@ -78,27 +77,4 @@ public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
private 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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -81,25 +81,31 @@ public class CPacketFluidPatternTermBtns implements IMessage {
|
||||
cpt.doubleStacks(Value.equals("1"));
|
||||
break;
|
||||
}
|
||||
} else if( Name.startsWith( "PatternTerminal." ) && (c instanceof ContainerFluidPatternTerminalEx))
|
||||
} else if( Name.startsWith( "PatternTerminalEx." ) && (c instanceof ContainerFluidPatternTerminalEx))
|
||||
{
|
||||
final ContainerFluidPatternTerminalEx cpt = (ContainerFluidPatternTerminalEx) c;
|
||||
switch (Name) {
|
||||
case "PatternTerminal.Encode":
|
||||
case "PatternTerminalEx.Encode":
|
||||
if (Value.equals("2"))
|
||||
cpt.encodeAndMoveToInventory();
|
||||
else
|
||||
cpt.encode();
|
||||
break;
|
||||
case "PatternTerminal.Clear":
|
||||
case "PatternTerminalEx.Clear":
|
||||
cpt.clear();
|
||||
break;
|
||||
case "PatternTerminal.Substitute":
|
||||
case "PatternTerminalEx.Substitute":
|
||||
cpt.getPatternTerminal().setSubstitution(Value.equals("1"));
|
||||
break;
|
||||
case "PatternTerminal.Double":
|
||||
case "PatternTerminalEx.Invert":
|
||||
cpt.getPatternTerminal().setInverted(Value.equals("1"));
|
||||
break;
|
||||
case "PatternTerminalEx.Double":
|
||||
cpt.doubleStacks(Value.equals("1"));
|
||||
break;
|
||||
case "PatternTerminalEx.ActivePage":
|
||||
cpt.getPatternTerminal().setActivePage(Integer.parseInt(Value));
|
||||
break;
|
||||
}
|
||||
} else if(Name.equals( "Terminal.Cpu" ) && c instanceof ContainerFluidCraftConfirm) {
|
||||
final ContainerFluidCraftConfirm qk = (ContainerFluidCraftConfirm) c;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class CPacketTransferRecipe implements IMessage {
|
||||
private List<OrderStack<?>> inputs;
|
||||
private List<OrderStack<?>> outputs;
|
||||
private boolean isCraft;
|
||||
private final static int MAX_INDEX = 16;
|
||||
private final static int MAX_INDEX = 32;
|
||||
|
||||
public CPacketTransferRecipe(){
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -87,7 +88,9 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
|
||||
if (condensed.length == 0) {
|
||||
return false;
|
||||
}
|
||||
this.outputs = outputs;
|
||||
this.outputs = Arrays.stream(outputs)
|
||||
.filter(Objects::nonNull)
|
||||
.toArray(IAEItemStack[]::new);
|
||||
this.outputsCond = condensed;
|
||||
return true;
|
||||
}
|
||||
@@ -159,12 +162,11 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
|
||||
public static NBTTagList writeStackArray(IAEItemStack[] stacks) {
|
||||
NBTTagList listTag = new NBTTagList();
|
||||
for (IAEItemStack stack : stacks) {
|
||||
if (stack != null) {
|
||||
// see note at top of class
|
||||
NBTTagCompound stackTag = new NBTTagCompound();
|
||||
stack.writeToNBT(stackTag);
|
||||
listTag.appendTag(stackTag);
|
||||
}
|
||||
// see note at top of class
|
||||
NBTTagCompound stackTag = new NBTTagCompound();
|
||||
if (stack != null) stack.writeToNBT(stackTag);
|
||||
|
||||
listTag.appendTag(stackTag);
|
||||
}
|
||||
return listTag;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ public final class ModAndClassUtil {
|
||||
public static boolean EIO = false;
|
||||
public static boolean FTR = false;
|
||||
public static boolean OC = false;
|
||||
public static boolean GTPP = false;
|
||||
|
||||
public static boolean isDoubleButton;
|
||||
public static boolean isSaveText;
|
||||
@@ -98,8 +99,7 @@ public final class ModAndClassUtil {
|
||||
FTR = true;
|
||||
if (Loader.isModLoaded("OpenComputers"))
|
||||
OC = true;
|
||||
if (Loader.isModLoaded("miscutils"))
|
||||
GTPP = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 849 B |
Binary file not shown.
|
After Width: | Height: | Size: 924 B |
Reference in new issue
Block a user