Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c087930016 | ||
|
|
a805df0e9e | ||
|
|
5b6cc1471b | ||
|
|
b3fa0c09d1 | ||
|
|
9b992731c2 | ||
|
|
b02ac628e9 | ||
|
|
7f6933483f | ||
|
|
73fcfce454 | ||
|
|
a8d2b12ef9 | ||
|
|
76032e1e28 | ||
|
|
eff505cdb9 | ||
|
|
3d5ffbba4c | ||
|
|
7a18bed394 | ||
|
|
e4749970ef | ||
|
|
b6b3467251 | ||
|
|
1c791480d5 | ||
|
|
dc7c33bfa0 | ||
|
|
244e7fb4f8 | ||
|
|
3a0eeeac07 | ||
|
|
88875ab99b | ||
|
|
e311705327 | ||
|
|
086e46dc46 | ||
|
|
04c8aab837 | ||
|
|
5d31d6d6fb | ||
|
|
89068c4dff | ||
|
|
d29f035139 | ||
|
|
ce1ac164dc | ||
|
|
6da8cdf831 | ||
|
|
7def78aa90 | ||
|
|
fd6eb37369 | ||
|
|
ccd3a5da98 | ||
|
|
ceee7ad85f | ||
|
|
b576e4b178 | ||
|
|
546e02a9fe | ||
|
|
16003b93ba | ||
|
|
6cf7918cb8 | ||
|
|
e9351c5302 | ||
|
|
521a256378 | ||
|
|
c1c1aef1f5 | ||
|
|
da804448a8 | ||
|
|
e47c65fbdf | ||
|
|
02f3ed037c | ||
|
|
238fd317e4 |
No files matched your search
@@ -34,7 +34,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
|
||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-109-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.10-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-117-GTNH:dev')
|
||||
compile('curse.maven:cofh-core-69162:2388751')
|
||||
compile('com.github.GTNewHorizons:ExtraCells2:2.5.20:dev') {transitive = false}
|
||||
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.8.5:dev")
|
||||
compile('com.github.GTNewHorizons:waila:1.5.22:dev')
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.25:dev') { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.2: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:EnderIO:2.3.1.48:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.2.11: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: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')
|
||||
|
||||
@@ -5,6 +5,7 @@ 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.crossmod.waila.WailaInit;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.loader.ChannelLoader;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
@@ -21,7 +22,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, dependencies = "required-after:appliedenergistics2")
|
||||
@Mod(modid = FluidCraft.MODID, version = FluidCraft.VERSION, name = FluidCraft.MODNAME, dependencies = "required-after:appliedenergistics2;after:waila")
|
||||
public class FluidCraft {
|
||||
|
||||
public static final String MODID = "GRADLETOKEN_MODID";
|
||||
@@ -47,6 +48,9 @@ public class FluidCraft {
|
||||
if (ModAndClassUtil.OC) {
|
||||
OCDriverInit.run();
|
||||
}
|
||||
if (ModAndClassUtil.WAILA) {
|
||||
WailaInit.run();
|
||||
}
|
||||
proxy.init(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,15 @@ import net.minecraft.client.gui.GuiTextField;
|
||||
|
||||
public class FCGuiTextField extends GuiTextField {
|
||||
private static final int PADDING = 2;
|
||||
private final FontRenderer _fontRender;
|
||||
private String tooltip;
|
||||
|
||||
private final int _xPos;
|
||||
private final int _yPos;
|
||||
private final int _width;
|
||||
private final int _height;
|
||||
private int _border;
|
||||
private int _color;
|
||||
|
||||
/**
|
||||
* Uses the values to instantiate a padded version of a text field.
|
||||
@@ -30,6 +33,48 @@ public class FCGuiTextField extends GuiTextField {
|
||||
this._yPos = yPos;
|
||||
this._width = width;
|
||||
this._height = height;
|
||||
this._fontRender = fontRenderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTextBox() {
|
||||
super.drawTextBox();
|
||||
if (this.getBorder() > 0 && this.getVisible()) {
|
||||
GuiTextField.drawRect(
|
||||
this._xPos - this.getBorder(),
|
||||
this._yPos - this.getBorder(),
|
||||
this._width - 2 * PADDING - this._fontRender.getCharWidth('_') + this.getBorder(),
|
||||
this._height - 2 * PADDING + this.getBorder(),
|
||||
this.getColor()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public int getBorder() {
|
||||
return this._border;
|
||||
}
|
||||
|
||||
public void setBorder(int border) {
|
||||
this._border = border;
|
||||
this._color = 0;
|
||||
}
|
||||
|
||||
public void setBorder(int border, int color) {
|
||||
this._border = border;
|
||||
this._color = color;
|
||||
}
|
||||
|
||||
public void setBorder() {
|
||||
this._border = 0;
|
||||
this._color = 0;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this._color;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this._color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,13 +37,14 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
|
||||
private GuiImgButton encodeBtn;
|
||||
private GuiImgButton clearBtn;
|
||||
private GuiImgButton doubleBtn;
|
||||
private GuiImgButton beSubstitutionsEnabledBtn;
|
||||
private GuiImgButton beSubstitutionsDisabledBtn;
|
||||
|
||||
private GuiFCImgButton combineEnableBtn;
|
||||
private GuiFCImgButton combineDisableBtn;
|
||||
|
||||
public GuiBaseFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
||||
{
|
||||
super( inventoryPlayer, te, new FCBasePartContainer( inventoryPlayer, te ) );
|
||||
public GuiBaseFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(inventoryPlayer, te, new FCBasePartContainer(inventoryPlayer, te));
|
||||
this.container = (FCBasePartContainer) this.inventorySlots;
|
||||
setReservedSpace(81);
|
||||
}
|
||||
@@ -73,9 +74,12 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
|
||||
{
|
||||
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") );
|
||||
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Double", Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,24 +107,36 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
|
||||
this.buttonList.add( this.clearBtn );
|
||||
|
||||
this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE );
|
||||
this.buttonList.add( this.encodeBtn );
|
||||
this.buttonList.add(this.encodeBtn);
|
||||
|
||||
int combineLeft = 74;
|
||||
|
||||
int combineTop = 153;
|
||||
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 );
|
||||
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;
|
||||
}
|
||||
// if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
// combineLeft = 74;
|
||||
// combineTop -= 11;
|
||||
// this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||
// this.guiLeft + 84, this.guiTop + this.ySize - 153, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
|
||||
// this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||
// this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||
//
|
||||
// this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||
// this.guiLeft + 84, this.guiTop + this.ySize - 153, Settings.ACTIONS, PatternBeSubstitution.DISABLED);
|
||||
// this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||
// this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||
// }
|
||||
this.combineEnableBtn = new GuiFCImgButton(this.guiLeft + combineLeft, this.guiTop + this.ySize - combineTop, "FORCE_COMBINE", "DO_COMBINE");
|
||||
this.combineEnableBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.combineEnableBtn);
|
||||
|
||||
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 );
|
||||
this.combineDisableBtn = new GuiFCImgButton(this.guiLeft + combineLeft, this.guiTop + this.ySize - combineTop, "NOT_COMBINE", "DONT_COMBINE");
|
||||
this.combineDisableBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.combineDisableBtn);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,20 +175,26 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
|
||||
this.combineEnableBtn.visible = true;
|
||||
this.combineDisableBtn.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
this.combineEnableBtn.visible = false;
|
||||
this.combineDisableBtn.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.combineEnableBtn.visible = false;
|
||||
this.combineDisableBtn.visible = false;
|
||||
}
|
||||
if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
if (this.container.beSubstitute) {
|
||||
this.beSubstitutionsEnabledBtn.visible = true;
|
||||
this.beSubstitutionsDisabledBtn.visible = false;
|
||||
} else {
|
||||
this.beSubstitutionsEnabledBtn.visible = false;
|
||||
this.beSubstitutionsDisabledBtn.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752 );
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,14 +36,15 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
private GuiImgButton invertBtn;
|
||||
private GuiImgButton clearBtn;
|
||||
private GuiImgButton doubleBtn;
|
||||
private GuiImgButton beSubstitutionsEnabledBtn;
|
||||
private GuiImgButton beSubstitutionsDisabledBtn;
|
||||
|
||||
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 ) );
|
||||
public GuiBaseFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(inventoryPlayer, te, new FCBasePartContainerEx(inventoryPlayer, te));
|
||||
this.container = (FCBasePartContainerEx) this.inventorySlots;
|
||||
setReservedSpace(81);
|
||||
|
||||
@@ -80,9 +81,12 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
{
|
||||
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") );
|
||||
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.Double", Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.beSubstitute", "1"));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.beSubstitute", "0"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,12 +104,12 @@ 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.fluidPrioritizedEnabledBtn = new GuiFCImgButton(this.guiLeft + 97, this.guiTop + this.ySize - 114, "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.fluidPrioritizedDisabledBtn = new GuiFCImgButton(this.guiLeft + 97, this.guiTop + this.ySize - 114, "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);
|
||||
@@ -122,17 +126,27 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
if (ModAndClassUtil.isDoubleButton) {
|
||||
this.doubleBtn = new GuiImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 153, Settings.ACTIONS, ActionItems.DOUBLE );
|
||||
this.doubleBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.doubleBtn );
|
||||
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 );
|
||||
this.combineEnableBtn = new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 114, "FORCE_COMBINE", "DO_COMBINE");
|
||||
this.combineEnableBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.combineEnableBtn);
|
||||
|
||||
this.combineDisableBtn = new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 114, "NOT_COMBINE", "DONT_COMBINE");
|
||||
this.combineDisableBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.combineDisableBtn);
|
||||
// if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
// this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||
// this.guiLeft + 87, this.guiTop + this.ySize - 103, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
|
||||
// this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||
// this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||
//
|
||||
// this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||
// this.guiLeft + 87, this.guiTop + this.ySize - 103, Settings.ACTIONS, PatternBeSubstitution.DISABLED);
|
||||
// this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||
// this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||
// }
|
||||
processingScrollBar.setTop(this.ySize - 164);
|
||||
}
|
||||
|
||||
@@ -163,19 +177,25 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
this.fluidPrioritizedDisabledBtn.visible = false;
|
||||
}
|
||||
|
||||
if ( this.container.combine )
|
||||
{
|
||||
if (this.container.combine) {
|
||||
this.combineEnableBtn.visible = true;
|
||||
this.combineDisableBtn.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.combineEnableBtn.visible = false;
|
||||
this.combineDisableBtn.visible = true;
|
||||
}
|
||||
if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
if (this.container.beSubstitute) {
|
||||
this.beSubstitutionsEnabledBtn.visible = true;
|
||||
this.beSubstitutionsDisabledBtn.visible = false;
|
||||
} else {
|
||||
this.beSubstitutionsEnabledBtn.visible = false;
|
||||
this.beSubstitutionsDisabledBtn.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
||||
this.fontRendererObj.drawString( StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752 );
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752);
|
||||
this.processingScrollBar.draw(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import com.glodblock.github.client.gui.container.FCBaseFluidMonitorContain;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
|
||||
public class GuiBaseFluidTerminal extends GuiFCBaseFluidMonitor {
|
||||
protected EntityPlayer player;
|
||||
|
||||
public GuiBaseFluidTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te, FCBaseFluidMonitorContain c) {
|
||||
super(inventoryPlayer, te, new FCBaseFluidMonitorContain(inventoryPlayer, te));
|
||||
player = inventoryPlayer.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "gui/terminal.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
if (s.isPlayerSide()) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
} else {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.FLUID_PAT_TERM_CRAFTING_STATUS);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,732 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
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.me.InternalSlotME;
|
||||
import appeng.client.me.SlotDisconnected;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.*;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.util.TextHistory;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.FCBaseFluidMonitorContain;
|
||||
import com.glodblock.github.client.me.FluidRepo;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
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 com.glodblock.github.util.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, IConfigManagerHost, IDropToFillTextField {
|
||||
|
||||
public static int craftingGridOffsetX;
|
||||
public static int craftingGridOffsetY;
|
||||
|
||||
private static String memoryText = "";
|
||||
private final FluidRepo repo;
|
||||
private final int offsetX = 9;
|
||||
private final int lowerTextureOffset = 0;
|
||||
private final boolean viewCell;
|
||||
private final ItemStack[] myCurrentViewCells = new ItemStack[5];
|
||||
public IConfigManager configSrc;
|
||||
public FCBaseFluidMonitorContain monitorableContainer;
|
||||
public GuiTabButton craftingStatusBtn;
|
||||
private GuiImgButton craftingStatusImgBtn;
|
||||
private FCGuiTextField searchField;
|
||||
private int perRow = 9;
|
||||
private int reservedSpace = 0;
|
||||
private boolean customSortOrder = true;
|
||||
private int rows = 0;
|
||||
private int maxRows = Integer.MAX_VALUE;
|
||||
private int standardSize;
|
||||
private GuiImgButton ViewBox;
|
||||
private GuiImgButton SortByBox;
|
||||
private GuiImgButton SortDirBox;
|
||||
private GuiImgButton searchBoxSettings;
|
||||
private GuiImgButton terminalStyleBox;
|
||||
private GuiImgButton searchStringSave;
|
||||
|
||||
public GuiFCBaseFluidMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCBaseFluidMonitorContain c) {
|
||||
|
||||
super(c);
|
||||
|
||||
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||
this.setScrollBar(scrollbar);
|
||||
this.repo = new FluidRepo(scrollbar, this);
|
||||
|
||||
this.xSize = 195;
|
||||
this.ySize = 204;
|
||||
|
||||
this.standardSize = this.xSize;
|
||||
|
||||
this.configSrc = ((IConfigurableObject) this.inventorySlots).getConfigManager();
|
||||
(this.monitorableContainer = (FCBaseFluidMonitorContain) this.inventorySlots).setGui(this);
|
||||
|
||||
this.viewCell = te instanceof IViewCellStorage;
|
||||
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEFluidStack> list) {
|
||||
for (final IAEFluidStack is : list) {
|
||||
IAEItemStack stack = AEItemStack.create(ItemFluidDrop.newDisplayStack(is.getFluidStack()));
|
||||
stack.setStackSize(is.getStackSize());
|
||||
this.repo.postUpdate(stack);
|
||||
}
|
||||
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
}
|
||||
|
||||
private void setScrollBar() {
|
||||
this.getScrollBar().setTop(18).setLeft(175).setHeight(this.rows * 18 - 2);
|
||||
this.getScrollBar().setRange(0, (this.repo.size() + this.perRow - 1) / this.perRow - this.rows, Math.max(1, this.rows / 6));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
|
||||
if (btn == this.craftingStatusBtn || btn == this.craftingStatusImgBtn) {
|
||||
NetworkHandler.instance.sendToServer(new PacketSwitchGuis(GuiBridge.GUI_CRAFTING_STATUS));
|
||||
}
|
||||
|
||||
if (btn instanceof GuiImgButton) {
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
|
||||
final GuiImgButton iBtn = (GuiImgButton) btn;
|
||||
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||
final Enum<?> cv = iBtn.getCurrentValue();
|
||||
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||
|
||||
if (btn == this.terminalStyleBox) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
} else if (btn == this.searchBoxSettings) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
} else if (ModAndClassUtil.isSaveText && btn == this.searchStringSave) {
|
||||
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
|
||||
} else {
|
||||
try {
|
||||
NetworkHandler.instance.sendToServer(new PacketValueConfig(iBtn.getSetting().name(), next.name()));
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
iBtn.set(next);
|
||||
|
||||
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
|
||||
this.reinitalize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reinitalize() {
|
||||
this.buttonList.clear();
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
this.maxRows = this.getMaxRows();
|
||||
this.perRow = AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL ? 9 : 9 + ((this.width - this.standardSize) / 18);
|
||||
|
||||
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
|
||||
|
||||
final int NEI = hasNEI ? 0 : 0;
|
||||
int top = hasNEI ? 22 : 0;
|
||||
|
||||
final int magicNumber = 114 + 1;
|
||||
final int extraSpace = this.height - magicNumber - NEI - top - this.reservedSpace;
|
||||
|
||||
this.rows = (int) Math.floor(extraSpace / 18.0);
|
||||
if (this.rows > this.maxRows) {
|
||||
top += (this.rows - this.maxRows) * 18 / 2;
|
||||
this.rows = this.maxRows;
|
||||
}
|
||||
|
||||
if (hasNEI) {
|
||||
this.rows--;
|
||||
}
|
||||
|
||||
if (this.rows < 3) {
|
||||
this.rows = 3;
|
||||
}
|
||||
|
||||
this.getMeSlots().clear();
|
||||
for (int y = 0; y < this.rows; y++) {
|
||||
for (int x = 0; x < this.perRow; x++) {
|
||||
this.getMeSlots().add(new InternalSlotME(this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
if (AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL) {
|
||||
this.xSize = this.standardSize + ((this.perRow - 9) * 18);
|
||||
} else {
|
||||
this.xSize = this.standardSize;
|
||||
}
|
||||
|
||||
super.initGui();
|
||||
// full size : 204
|
||||
// extra slots : 72
|
||||
// slot 18
|
||||
|
||||
this.ySize = magicNumber + this.rows * 18 + this.reservedSpace;
|
||||
// this.guiTop = top;
|
||||
final int unusedSpace = this.height - this.ySize;
|
||||
this.guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
|
||||
|
||||
int offset = this.guiTop + 8;
|
||||
|
||||
if (this.customSortOrder) {
|
||||
this.buttonList.add(this.SortByBox = new GuiImgButton(this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting(Settings.SORT_BY)));
|
||||
offset += 20;
|
||||
}
|
||||
|
||||
// this.buttonList.add( this.ViewBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.VIEW_MODE, this.configSrc.getSetting( Settings.VIEW_MODE ) ) );
|
||||
// offset += 20;
|
||||
|
||||
this.buttonList.add(this.SortDirBox = new GuiImgButton(this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc.getSetting(Settings.SORT_DIRECTION)));
|
||||
offset += 20;
|
||||
|
||||
this.buttonList.add(this.searchBoxSettings = new GuiImgButton(this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE)));
|
||||
offset += 20;
|
||||
|
||||
if (ModAndClassUtil.isSaveText) {
|
||||
this.buttonList.add(this.searchStringSave = new GuiImgButton(this.guiLeft - 18, offset, Settings.SAVE_SEARCH, AEConfig.instance.preserveSearchBar ? YesNo.YES : YesNo.NO));
|
||||
offset += 20;
|
||||
}
|
||||
|
||||
this.buttonList.add(this.terminalStyleBox = new GuiImgButton(this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
|
||||
offset += 20;
|
||||
|
||||
this.searchField = new FCGuiTextField(this.fontRendererObj, this.guiLeft + Math.max(80, this.offsetX), this.guiTop + 4, 90, 12);
|
||||
this.searchField.setEnableBackgroundDrawing(false);
|
||||
this.searchField.setMaxStringLength(25);
|
||||
this.searchField.setTextColor(0xFFFFFF);
|
||||
this.searchField.setVisible(true);
|
||||
if (ModAndClassUtil.isSearchStringTooltip)
|
||||
searchField.setMessage(ButtonToolTips.SearchStringTooltip.getLocal());
|
||||
|
||||
if (this.viewCell) {
|
||||
if (ModAndClassUtil.isCraftStatus && AEConfig.instance.getConfigManager().getSetting(Settings.CRAFTING_STATUS).equals(CraftingStatus.BUTTON)) {
|
||||
this.buttonList.add(this.craftingStatusImgBtn = new GuiImgButton(this.guiLeft - 18, offset, Settings.CRAFTING_STATUS, AEConfig.instance.settings.getSetting(Settings.CRAFTING_STATUS)));
|
||||
} else {
|
||||
this.buttonList.add(this.craftingStatusBtn = new GuiTabButton(this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(), itemRender));
|
||||
this.craftingStatusBtn.setHideEdge(13); // GuiTabButton implementation //
|
||||
}
|
||||
}
|
||||
|
||||
// Enum setting = AEConfig.INSTANCE.getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
|
||||
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())) {
|
||||
setSearchString(memoryText, false);
|
||||
}
|
||||
if (this.isSubGui()) {
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
}
|
||||
|
||||
craftingGridOffsetX = Integer.MAX_VALUE;
|
||||
craftingGridOffsetY = Integer.MAX_VALUE;
|
||||
|
||||
for (final Object s : this.inventorySlots.inventorySlots) {
|
||||
if (s instanceof AppEngSlot) {
|
||||
if (((Slot) s).xDisplayPosition < 195) {
|
||||
this.repositionSlot((AppEngSlot) s);
|
||||
}
|
||||
}
|
||||
|
||||
if (s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix) {
|
||||
final Slot g = (Slot) s;
|
||||
if (g.xDisplayPosition > 0 && g.yDisplayPosition > 0) {
|
||||
craftingGridOffsetX = Math.min(craftingGridOffsetX, g.xDisplayPosition);
|
||||
craftingGridOffsetY = Math.min(craftingGridOffsetY, g.yDisplayPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
craftingGridOffsetX -= 25;
|
||||
craftingGridOffsetY -= 6;
|
||||
}
|
||||
|
||||
public void setSearchString(String memoryText, boolean updateView) {
|
||||
this.searchField.setText(memoryText);
|
||||
this.repo.setSearchString(memoryText);
|
||||
if (updateView) {
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(this.getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_TERMINAL)), 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH) {
|
||||
this.searchField.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
|
||||
setSearchString("", true);
|
||||
}
|
||||
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
final int wheel = Mouse.getEventDWheel();
|
||||
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight;
|
||||
|
||||
if (wheel != 0 && this.searchField.isMouseIn(x, y) && isCtrlKeyDown()) {
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode == SearchBoxMode.NEI_MANUAL_SEARCH || searchMode == SearchBoxMode.NEI_AUTOSEARCH) {
|
||||
try {
|
||||
Field cls = LayoutManager.searchField.getClass().getDeclaredField("history");
|
||||
cls.setAccessible(true);
|
||||
TextHistory history = ((TextHistory) cls.get("get"));
|
||||
TextHistory.Direction direction;
|
||||
if (wheel > 0) {
|
||||
direction = TextHistory.Direction.PREVIOUS;
|
||||
} else {
|
||||
direction = TextHistory.Direction.NEXT;
|
||||
}
|
||||
history.get(direction, this.searchField.getText())
|
||||
.map(newText -> {
|
||||
setSearchString(newText, true);
|
||||
return true;
|
||||
})
|
||||
.orElse(false);
|
||||
return;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
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;
|
||||
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU)) {
|
||||
if (action == InventoryAction.SPLIT_OR_PLACE_SINGLE) {
|
||||
action = InventoryAction.MOVE_REGION;
|
||||
} else {
|
||||
action = InventoryAction.PICKUP_SINGLE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (slot instanceof SlotPatternTerm) {
|
||||
if (mouseButton == 6) {
|
||||
return; // prevent weird double clicks..
|
||||
}
|
||||
|
||||
try {
|
||||
NetworkHandler.instance.sendToServer(((SlotPatternTerm) slot).getRequest(isShiftKeyDown()));
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
} else if (slot instanceof SlotCraftingTerm) {
|
||||
if (mouseButton == 6) {
|
||||
return; // prevent weird double clicks..
|
||||
}
|
||||
|
||||
InventoryAction action;
|
||||
if (isShiftKeyDown()) {
|
||||
action = InventoryAction.CRAFT_SHIFT;
|
||||
} else {
|
||||
// Craft stack on right-click, craft single on left-click
|
||||
action = (mouseButton == 1) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
|
||||
}
|
||||
|
||||
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
|
||||
if (this.enableSpaceClicking() && !(slot instanceof SlotPatternTerm)) {
|
||||
IAEItemStack stack = null;
|
||||
if (slot instanceof SlotME) {
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
}
|
||||
|
||||
int slotNum = Ae2ReflectClient.getInventorySlots(this).size();
|
||||
|
||||
if (!(slot instanceof SlotME) && slot != null) {
|
||||
slotNum = slot.slotNumber;
|
||||
}
|
||||
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.MOVE_REGION, slotNum, 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (slot instanceof SlotDisconnected) {
|
||||
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
InventoryAction action = null;
|
||||
|
||||
switch (mouseButton) {
|
||||
case 0: // pickup / set-down.
|
||||
{
|
||||
ItemStack heldStack = player.inventory.getItemStack();
|
||||
if (slot.getStack() == null && heldStack != null)
|
||||
action = InventoryAction.SPLIT_OR_PLACE_SINGLE;
|
||||
else if (slot.getStack() != null && (heldStack == null || heldStack.stackSize <= 1))
|
||||
action = InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
action = ctrlDown == 1 ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||
break;
|
||||
|
||||
case 3: // creative dupe:
|
||||
|
||||
if (player.capabilities.isCreativeMode) {
|
||||
action = InventoryAction.CREATIVE_DUPLICATE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
case 4: // drop item:
|
||||
case 6:
|
||||
}
|
||||
|
||||
if (action != null) {
|
||||
final PacketInventoryAction p = new PacketInventoryAction(action, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (slot instanceof SlotME) {
|
||||
InventoryAction action = null;
|
||||
IAEItemStack stack = null;
|
||||
|
||||
switch (mouseButton) {
|
||||
case 0: // pickup / set-down.
|
||||
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
|
||||
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack() == null) {
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
action = ctrlDown == 1 ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
break;
|
||||
|
||||
case 3: // creative dupe:
|
||||
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
if (stack.getItem() instanceof ItemFluidDrop) {
|
||||
stack = ItemFluidDrop.newAeStack(ItemFluidDrop.getAeFluidStack(stack));
|
||||
}
|
||||
if (stack != null && stack.isCraftable()) {
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
} else if (player.capabilities.isCreativeMode) {
|
||||
final IAEItemStack slotItem = ((SlotME) slot).getAEStack();
|
||||
if (slotItem != null) {
|
||||
action = InventoryAction.CREATIVE_DUPLICATE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case 4: // drop item:
|
||||
case 6:
|
||||
}
|
||||
|
||||
if (action == InventoryAction.AUTO_CRAFT) {
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, Ae2ReflectClient.getInventorySlots(this).size(), 0, stack));
|
||||
} else if (action != null) {
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
final PacketInventoryAction p = new PacketInventoryAction(action, Ae2ReflectClient.getInventorySlots(this).size(), 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
memoryText = this.searchField.getText();
|
||||
}
|
||||
|
||||
public void bindTextureBack(final String file) {
|
||||
final ResourceLocation loc = new ResourceLocation(FluidCraft.MODID, "textures/" + file);
|
||||
this.mc.getTextureManager().bindTexture(loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
|
||||
this.bindTextureBack(this.getBackground());
|
||||
final int x_width = 195;
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, x_width, 18);
|
||||
|
||||
if (this.viewCell) {
|
||||
this.drawTexturedModalRect(offsetX + x_width, offsetY, x_width, 0, 46, 128);
|
||||
}
|
||||
|
||||
for (int x = 0; x < this.rows; x++) {
|
||||
this.drawTexturedModalRect(offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18);
|
||||
}
|
||||
|
||||
this.drawTexturedModalRect(offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + this.reservedSpace - this.lowerTextureOffset);
|
||||
|
||||
if (this.viewCell) {
|
||||
boolean update = false;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (this.myCurrentViewCells[i] != this.monitorableContainer.getCellViewSlot(i).getStack()) {
|
||||
update = true;
|
||||
this.myCurrentViewCells[i] = this.monitorableContainer.getCellViewSlot(i).getStack();
|
||||
}
|
||||
}
|
||||
|
||||
if (update) {
|
||||
this.repo.setViewCell(this.myCurrentViewCells);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.searchField != null) {
|
||||
this.searchField.drawTextBox();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground() {
|
||||
return "gui/terminal.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isPowered() {
|
||||
return this.repo.hasPower();
|
||||
}
|
||||
|
||||
int getMaxRows() {
|
||||
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if (character == ' ' && this.searchField.getText().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.searchField.textboxKeyTyped(character, key)) {
|
||||
this.repo.setSearchString(this.searchField.getText());
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
} else {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
this.repo.setPower(this.monitorableContainer.isPowered());
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getSortBy() {
|
||||
return this.configSrc.getSetting(Settings.SORT_BY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getSortDir() {
|
||||
return this.configSrc.getSetting(Settings.SORT_DIRECTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getSortDisplay() {
|
||||
return this.configSrc.getSetting(Settings.VIEW_MODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
|
||||
if (this.SortByBox != null) {
|
||||
this.SortByBox.set(this.configSrc.getSetting(Settings.SORT_BY));
|
||||
}
|
||||
|
||||
if (this.SortDirBox != null) {
|
||||
this.SortDirBox.set(this.configSrc.getSetting(Settings.SORT_DIRECTION));
|
||||
}
|
||||
|
||||
if (this.ViewBox != null) {
|
||||
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
||||
}
|
||||
|
||||
this.repo.updateView();
|
||||
}
|
||||
|
||||
public int getReservedSpace() {
|
||||
return this.reservedSpace;
|
||||
}
|
||||
|
||||
public void setReservedSpace(final int reservedSpace) {
|
||||
this.reservedSpace = reservedSpace;
|
||||
}
|
||||
|
||||
public boolean isCustomSortOrder() {
|
||||
return this.customSortOrder;
|
||||
}
|
||||
|
||||
public void setCustomSortOrder(final boolean customSortOrder) {
|
||||
this.customSortOrder = customSortOrder;
|
||||
}
|
||||
|
||||
public int getStandardSize() {
|
||||
return this.standardSize;
|
||||
}
|
||||
|
||||
public void setStandardSize(final int standardSize) {
|
||||
this.standardSize = standardSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
if (ModAndClassUtil.isSearchBar && AEConfig.instance.preserveSearchBar && searchField != null)
|
||||
handleTooltip(mouseX, mouseY, searchField.new TooltipProvider());
|
||||
}
|
||||
|
||||
public boolean isOverSearchField(int x, int y) {
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverTextField(int mousex, int mousey) {
|
||||
return searchField.isMouseIn(mousex, mousey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
|
||||
if (Util.getFluidFromItem(stack) != null) {
|
||||
setSearchString(Util.getFluidFromItem(stack).getFluid().getLocalizedName(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,7 @@ 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.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.gui.widgets.*;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.client.me.SlotDisconnected;
|
||||
@@ -32,6 +29,8 @@ import appeng.integration.IntegrationType;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.util.TextHistory;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.FCBaseMonitorContain;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
@@ -48,10 +47,10 @@ import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfigManagerHost
|
||||
{
|
||||
public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfigManagerHost, IDropToFillTextField {
|
||||
|
||||
public static int craftingGridOffsetX;
|
||||
public static int craftingGridOffsetY;
|
||||
@@ -343,29 +342,62 @@ 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 );
|
||||
|
||||
if( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH )
|
||||
{
|
||||
this.searchField.mouseClicked( xCoord, yCoord, btn );
|
||||
protected void mouseClicked( final int xCoord, final int yCoord, final int btn ) {
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
ItemStack is = player.inventory.getItemStack();
|
||||
if (searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH) {
|
||||
this.searchField.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
|
||||
{
|
||||
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
|
||||
setSearchString("", true);
|
||||
}
|
||||
|
||||
super.mouseClicked( xCoord, yCoord, btn );
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick( final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton )
|
||||
{
|
||||
public void handleMouseInput() {
|
||||
final int wheel = Mouse.getEventDWheel();
|
||||
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight;
|
||||
|
||||
if (wheel != 0 && this.searchField.isMouseIn(x, y) && isCtrlKeyDown()) {
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode == SearchBoxMode.NEI_MANUAL_SEARCH || searchMode == SearchBoxMode.NEI_AUTOSEARCH) {
|
||||
try {
|
||||
Field cls = LayoutManager.searchField.getClass().getDeclaredField("history");
|
||||
cls.setAccessible(true);
|
||||
TextHistory history = ((TextHistory) cls.get("get"));
|
||||
TextHistory.Direction direction;
|
||||
if (wheel > 0) {
|
||||
direction = TextHistory.Direction.PREVIOUS;
|
||||
} else {
|
||||
direction = TextHistory.Direction.NEXT;
|
||||
}
|
||||
history.get(direction, this.searchField.getText())
|
||||
.map(newText -> {
|
||||
setSearchString(newText, true);
|
||||
return true;
|
||||
})
|
||||
.orElse(false);
|
||||
return;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if (mouseButton == 3 ){
|
||||
if (mouseButton == 3) {
|
||||
if (this instanceof GuiBaseFluidPatternTerminal
|
||||
&& ((GuiBaseFluidPatternTerminal) this).container.isCraftingMode()) {
|
||||
return;
|
||||
}
|
||||
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
||||
if (slot.getHasStack()) {
|
||||
InventoryAction action = InventoryAction.valueOf("SET_PATTERN_VALUE");
|
||||
@@ -790,4 +822,13 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverTextField(int mousex, int mousey) {
|
||||
return searchField.isMouseIn(mousex, mousey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
|
||||
setSearchString(displayName, true);
|
||||
}
|
||||
}
|
||||
@@ -35,20 +35,26 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
|
||||
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" );
|
||||
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");
|
||||
this.registerApp(4, "SUBMIT", "SUBMIT", "submit");
|
||||
this.registerApp(6, "DISABLE", "DISABLE", "disable");
|
||||
this.registerApp(7, "ENABLE", "ENABLE", "enable");
|
||||
}
|
||||
}
|
||||
|
||||
private void registerApp(final int iconIndex, final String setting, final String val, final String title )
|
||||
{
|
||||
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");
|
||||
if (StatCollector.translateToLocal(prefix + title + ".hint").equals(prefix + title + ".hint")) {
|
||||
a.displayValue = null;
|
||||
} else {
|
||||
a.displayValue = StatCollector.translateToLocal(prefix + title + ".hint");
|
||||
}
|
||||
a.index = iconIndex;
|
||||
appearances.put( new EnumPair( setting, val ), a );
|
||||
appearances.put(new EnumPair(setting, val), a);
|
||||
}
|
||||
|
||||
public void setVisibility( final boolean vis )
|
||||
@@ -156,39 +162,31 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
displayValue = buttonAppearance.displayValue;
|
||||
}
|
||||
|
||||
if( displayName != null )
|
||||
{
|
||||
String name = StatCollector.translateToLocal( displayName );
|
||||
String value = StatCollector.translateToLocal( displayValue );
|
||||
|
||||
if( name == null || name.isEmpty() )
|
||||
{
|
||||
if( displayName != null ) {
|
||||
String name = StatCollector.translateToLocal(displayName);
|
||||
if (name == null || name.isEmpty()) {
|
||||
name = displayName;
|
||||
}
|
||||
if( value == null || value.isEmpty() )
|
||||
{
|
||||
value = displayValue;
|
||||
}
|
||||
if (displayValue != null) {
|
||||
String value = StatCollector.translateToLocal(displayValue);
|
||||
|
||||
if( this.fillVar != null )
|
||||
{
|
||||
value = COMPILE.matcher( value ).replaceFirst( this.fillVar );
|
||||
}
|
||||
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 );
|
||||
value = PATTERN_NEW_LINE.matcher(value).replaceAll("\n");
|
||||
final StringBuilder sb = new StringBuilder(value);
|
||||
|
||||
int i = sb.lastIndexOf( "\n" );
|
||||
if( i <= 0 )
|
||||
{
|
||||
i = 0;
|
||||
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;
|
||||
}
|
||||
while( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
|
||||
{
|
||||
sb.replace( i, i + 1, "\n" );
|
||||
}
|
||||
|
||||
return name + '\n' + sb;
|
||||
return name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -221,35 +219,34 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
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_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 );
|
||||
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 );
|
||||
} else {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * 6, 0.5f / 16 * 6, 0.5f / 16 * 6);
|
||||
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") );
|
||||
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_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 );
|
||||
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();
|
||||
}
|
||||
}
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
@@ -15,6 +15,7 @@ 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.common.parts.PartFluidTerminal;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketCraftRequest;
|
||||
@@ -74,8 +75,7 @@ public class GuiFluidCraftAmount extends AEBaseGui
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
|
||||
if( target instanceof PartFluidPatternTerminal)
|
||||
{
|
||||
if (target instanceof PartFluidPatternTerminal) {
|
||||
myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL, 1);
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
@@ -83,16 +83,19 @@ public class GuiFluidCraftAmount extends AEBaseGui
|
||||
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 ) );
|
||||
if (target instanceof PartFluidTerminal) {
|
||||
myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERM, 1);
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
}
|
||||
|
||||
this.amountToCraft = new GuiNumberBox( this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT, Integer.class );
|
||||
this.amountToCraft.setEnableBackgroundDrawing( false );
|
||||
this.amountToCraft.setMaxStringLength( 16 );
|
||||
this.amountToCraft.setTextColor( 0xFFFFFF );
|
||||
if (this.originalGui != null && myIcon != null) {
|
||||
this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
|
||||
}
|
||||
|
||||
this.amountToCraft = new GuiNumberBox(this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT, Integer.class);
|
||||
this.amountToCraft.setEnableBackgroundDrawing(false);
|
||||
this.amountToCraft.setMaxStringLength(16);
|
||||
this.amountToCraft.setTextColor(0xFFFFFF);
|
||||
this.amountToCraft.setVisible( true );
|
||||
this.amountToCraft.setFocused( true );
|
||||
this.amountToCraft.setText( "1" );
|
||||
|
||||
@@ -10,14 +10,18 @@ import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketSwitchGuis;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -35,17 +39,39 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
private final ContainerFluidInterface cont;
|
||||
|
||||
private GuiTabButton switcher;
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
|
||||
public GuiFluidInterface(InventoryPlayer ipl, TileFluidInterface tile) {
|
||||
super(new ContainerFluidInterface(ipl, tile));
|
||||
this.cont = (ContainerFluidInterface) inventorySlots;
|
||||
this.ySize = 231;
|
||||
this.addMouseRegin();
|
||||
}
|
||||
|
||||
public GuiFluidInterface(InventoryPlayer ipl, PartFluidInterface tile) {
|
||||
super(new ContainerFluidInterface(ipl, tile));
|
||||
this.cont = (ContainerFluidInterface) inventorySlots;
|
||||
this.ySize = 231;
|
||||
this.addMouseRegin();
|
||||
}
|
||||
|
||||
private void addMouseRegin() {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mouseRegions.addRegion(TANK_X + TANK_X_OFF * i, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
new TankMouseHandler(
|
||||
isPart() ? ((PartFluidInterface) cont.getTile()).getInternalFluid() : ((TileFluidInterface) cont.getTile()).getInternalFluid(),
|
||||
i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
try {
|
||||
GuiContainer.class
|
||||
.getDeclaredMethod("func_146977_a_original", Slot.class)
|
||||
.invoke(this, s);
|
||||
} catch (final Exception ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,6 +105,7 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
fluidInv.getFluidInSlot(i), fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
}
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
public String dirName(int face) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import appeng.client.gui.implementations.GuiCraftingStatus;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
@@ -29,6 +30,9 @@ public class GuiFluidPatternTerminalCraftingStatus extends GuiCraftingStatus {
|
||||
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL, 1));
|
||||
else if (host instanceof PartFluidPatternTerminalEx)
|
||||
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL_EX, 1));
|
||||
else if (host instanceof PartFluidTerminal) {
|
||||
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.FLUID_TERM, 1));
|
||||
}
|
||||
super.initGui();
|
||||
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
|
||||
}
|
||||
@@ -40,6 +44,8 @@ public class GuiFluidPatternTerminalCraftingStatus extends GuiCraftingStatus {
|
||||
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL);
|
||||
else if (host instanceof PartFluidPatternTerminalEx)
|
||||
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL_EX);
|
||||
else if (host instanceof PartFluidTerminal)
|
||||
InventoryHandler.switchGui(GuiType.FLUID_TERMINAL);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidTerminal;
|
||||
import com.glodblock.github.client.gui.container.FCBaseFluidMonitorContain;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class GuiFluidTerminal extends GuiBaseFluidTerminal {
|
||||
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
public ContainerFluidTerminal container;
|
||||
|
||||
public GuiFluidTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super(inventoryPlayer, te, new FCBaseFluidMonitorContain(inventoryPlayer, te));
|
||||
this.container = new ContainerFluidTerminal(inventoryPlayer, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s))
|
||||
super.func_146977_a(s);
|
||||
}
|
||||
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
if (slot instanceof SlotME) {
|
||||
IAEItemStack stack = ((SlotME) slot).getAEStack();
|
||||
if (stack == null) return true;
|
||||
FluidStack fluidStack = ItemFluidDrop.getFluidStack(slot.getStack());
|
||||
this.drawWidget(slot.xDisplayPosition, slot.yDisplayPosition, fluidStack.getFluid());
|
||||
stackSizeRenderer.setAeStack(stack);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), stack.getItemStack(), slot.xDisplayPosition, slot.yDisplayPosition);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void drawWidget(int posX, int posY, Fluid fluid) {
|
||||
Minecraft.getMinecraft().renderEngine
|
||||
.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
if (fluid != null && fluid.getIcon() != null) {
|
||||
GL11.glColor3f((fluid.getColor() >> 16 & 0xFF) / 255.0F, (fluid.getColor() >> 8 & 0xFF) / 255.0F, (fluid.getColor() & 0xFF) / 255.0F);
|
||||
drawTexturedModelRectFromIcon(posX, posY,
|
||||
fluid.getIcon(), 16, 16);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
if (slot instanceof SlotME && Util.FluidUtil.isFluidContainer(player.inventory.getItemStack())) {
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
ItemStack itemStack = this.player.inventory.getItemStack().copy();
|
||||
tmp.put(0, ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack()));
|
||||
if (!isShiftKeyDown()) {
|
||||
itemStack.stackSize = 1;
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, itemStack));
|
||||
}
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
public void update(ItemStack itemStack) {
|
||||
this.player.inventory.setItemStack(itemStack);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,362 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNEIDragClick;
|
||||
import codechicken.nei.VisiblityData;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.TaggedInventoryArea;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||
import com.glodblock.github.network.CPacketLevelMaintainer;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
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.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
|
||||
public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/level_maintainer.png");
|
||||
private final ContainerLevelMaintainer cont;
|
||||
private final Component[] component = new Component[TileLevelMaintainer.REQ_COUNT];
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
private TileLevelMaintainer tile;
|
||||
private FCGuiTextField input;
|
||||
|
||||
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
|
||||
super(new ContainerLevelMaintainer(ipl, tile));
|
||||
this.cont = (ContainerLevelMaintainer) inventorySlots;
|
||||
this.xSize = 195;
|
||||
this.ySize = 214;
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public void postUpdate(List<IAEItemStack> list) {
|
||||
for (IAEItemStack is : list) {
|
||||
long size = is.getItemStack().getTagCompound().getLong("Batch");
|
||||
int i = is.getItemStack().getTagCompound().getInteger("Index");
|
||||
boolean isEnable = is.getItemStack().getTagCompound().getBoolean("Enable");
|
||||
component[i].getQty().textField.setText(String.valueOf(is.getStackSize()));
|
||||
component[i].getBatch().textField.setText(String.valueOf(size));
|
||||
component[i].setEnable(isEnable);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
if (ModAndClassUtil.isSearchBar) {
|
||||
for (Component com : this.component) {
|
||||
handleTooltip(mouseX, mouseY, com.getQty().textField.new TooltipProvider());
|
||||
handleTooltip(mouseX, mouseY, com.getBatch().textField.new TooltipProvider());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
component[i] = new Component(
|
||||
new Widget(
|
||||
new FCGuiTextField(this.fontRendererObj, guiLeft + 37, guiTop + 21 + 20 * i, 52, 16),
|
||||
new GuiFCImgButton(guiLeft + 37 + 47, guiTop + 20 + 20 * i, "SUBMIT", "SUBMIT"), I18n.format(NameConst.TT_REQUEST_SIZE),
|
||||
i, "TileLevelMaintainer.Quantity"),
|
||||
new Widget(
|
||||
new FCGuiTextField(this.fontRendererObj, guiLeft + 100, guiTop + 21 + 20 * i, 52, 16),
|
||||
new GuiFCImgButton(guiLeft + 100 + 47, guiTop + 20 + 20 * i, "SUBMIT", "SUBMIT"), I18n.format(NameConst.TT_BATCH_SIZE),
|
||||
i, "TileLevelMaintainer.Batch"),
|
||||
new GuiFCImgButton(guiLeft + 4, guiTop + 23 + 20 * i, "ENABLE", "ENABLE"),
|
||||
new GuiFCImgButton(guiLeft + 4, guiTop + 23 + 20 * i, "DISABLE", "DISABLE"),
|
||||
this.buttonList
|
||||
);
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.refresh"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
this.component[i].draw();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_LEVEL_MAINTAINER)), 8, 6, 0x404040);
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s))
|
||||
super.func_146977_a(s);
|
||||
}
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
if (slot instanceof SlotFake) {
|
||||
IAEItemStack stack = ((ContainerLevelMaintainer.FakeSlot) slot).getAeStack();
|
||||
super.func_146977_a(new SlotSingleItem(slot));
|
||||
if (stack == null) return true;
|
||||
IAEItemStack fake = stack.copy();
|
||||
if (this.component[slot.getSlotIndex()].getQty().textField.getText().matches("[0-9]+")) {
|
||||
fake.setStackSize(Long.parseLong(this.component[slot.getSlotIndex()].getQty().textField.getText()));
|
||||
} else {
|
||||
fake.setStackSize(0);
|
||||
}
|
||||
stackSizeRenderer.setAeStack(fake);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), stack.getItemStack(), slot.xDisplayPosition, slot.yDisplayPosition);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
if (btn == 0) {
|
||||
if (input != null) {
|
||||
input.setFocused(false);
|
||||
}
|
||||
for (Component com : this.component) {
|
||||
FCGuiTextField textField = com.isMouseIn(xCoord, yCoord);
|
||||
if (textField != null) {
|
||||
textField.setFocused(true);
|
||||
this.input = textField;
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.input = null;
|
||||
}
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (this.input == null) {
|
||||
super.keyTyped(character, key);
|
||||
return;
|
||||
}
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if (!((character == ' ') && this.input.getText().isEmpty())) {
|
||||
this.input.textboxKeyTyped(character, key);
|
||||
}
|
||||
super.keyTyped(character, key);
|
||||
if (!this.input.getText().matches("^[0-9]+")) {
|
||||
this.input.setTextColor(0xFF0000);
|
||||
} else {
|
||||
this.input.setTextColor(0xFFFFFF);
|
||||
}
|
||||
if (key == Keyboard.KEY_RETURN) {
|
||||
this.input.setFocused(false);
|
||||
this.input = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
if (slot instanceof ContainerLevelMaintainer.FakeSlot && this.cont.getPlayerInv().getItemStack() != null) {
|
||||
this.component[slot.getSlotIndex()].getQty().textField.setText(String.valueOf(this.cont.getPlayerInv().getItemStack().stackSize));
|
||||
return;
|
||||
}
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
public void updateAmount(int idx, int stackSize) {
|
||||
this.component[idx].getQty().textField.setText(String.valueOf(stackSize));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
for (Component com : this.component) {
|
||||
if (com.sendToServer(btn)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
|
||||
return currentVisibility;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Rectangle getSlotArea(SlotFake slot) {
|
||||
return new Rectangle(guiLeft + slot.getX(), guiTop + slot.getY(), 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
|
||||
for (ContainerLevelMaintainer.FakeSlot slot : this.cont.getRequestSlots()) {
|
||||
if (getSlotArea(slot).contains(mouseX, mouseY)) {
|
||||
slot.putStack(draggedStack);
|
||||
NetworkHandler.instance.sendToServer(new PacketNEIDragClick(draggedStack, slot.getSlotIndex()));
|
||||
if (draggedStack != null) {
|
||||
this.updateAmount(slot.getSlotIndex(), draggedStack.stackSize);
|
||||
draggedStack.stackSize = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (draggedStack != null) {
|
||||
draggedStack.stackSize = 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private class Component {
|
||||
public boolean isEnable = true;
|
||||
private Widget qty;
|
||||
private Widget batch;
|
||||
private GuiFCImgButton disable;
|
||||
private GuiFCImgButton enable;
|
||||
|
||||
public Component(Widget qtyInput, Widget batchInput, GuiFCImgButton enableBtn, GuiFCImgButton disableBtn, List buttonList) {
|
||||
this.qty = qtyInput;
|
||||
this.batch = batchInput;
|
||||
this.enable = enableBtn;
|
||||
this.disable = disableBtn;
|
||||
this.enable.setHalfSize(true);
|
||||
this.disable.setHalfSize(true);
|
||||
buttonList.add(this.qty.button);
|
||||
buttonList.add(this.batch.button);
|
||||
buttonList.add(this.enable);
|
||||
buttonList.add(this.disable);
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return this.getQty().idx;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.isEnable = enable;
|
||||
}
|
||||
|
||||
private boolean send(Widget widget) {
|
||||
if (((ContainerLevelMaintainer.FakeSlot) cont.inventorySlots.get(widget.idx)).getHasStack()) {
|
||||
if (!widget.textField.getText().isEmpty() && widget.textField.getText().matches("^[0-9]+")) {
|
||||
String str = widget.textField.getText().replaceAll("^(0+)", "");
|
||||
widget.textField.setText(str.isEmpty() ? "0" : str);
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(widget.action, widget.idx, widget.textField.getText()));
|
||||
widget.textField.setTextColor(0xFFFFFF);
|
||||
return true;
|
||||
} else {
|
||||
widget.textField.setTextColor(0xFF0000);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean sendToServer(GuiButton btn) {
|
||||
if (this.getQty().button == btn) {
|
||||
return this.send(this.getQty());
|
||||
}
|
||||
if (this.getBatch().button == btn) {
|
||||
return this.send(this.getBatch());
|
||||
}
|
||||
if (this.enable == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.Enable", this.getIndex()));
|
||||
} else if (this.disable == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.Disable", this.getIndex()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public FCGuiTextField isMouseIn(final int xCoord, final int yCoord) {
|
||||
if (this.getQty().textField.isMouseIn(xCoord, yCoord)) return this.getQty().textField;
|
||||
if (this.getBatch().textField.isMouseIn(xCoord, yCoord)) return this.getBatch().textField;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Widget getQty() {
|
||||
return this.qty;
|
||||
}
|
||||
|
||||
public Widget getBatch() {
|
||||
return this.batch;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
this.getQty().draw();
|
||||
this.getBatch().draw();
|
||||
if (this.isEnable) {
|
||||
this.enable.visible = true;
|
||||
this.disable.visible = false;
|
||||
} else {
|
||||
this.enable.visible = false;
|
||||
this.disable.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class Widget {
|
||||
public final int idx;
|
||||
public final String action;
|
||||
private FCGuiTextField textField;
|
||||
private GuiFCImgButton button;
|
||||
|
||||
public Widget(FCGuiTextField textField, GuiFCImgButton button, String tooltip, int idx, String action) {
|
||||
this.textField = textField;
|
||||
this.textField.setMessage(tooltip);
|
||||
this.textField.setEnableBackgroundDrawing(false);
|
||||
this.textField.setText("0");
|
||||
this.textField.setMaxStringLength(10); // it's enough to useful
|
||||
this.button = button;
|
||||
this.idx = idx;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
this.textField.drawTextBox();
|
||||
}
|
||||
|
||||
public GuiFCImgButton btn() {
|
||||
return this.button;
|
||||
}
|
||||
|
||||
public void setTooltip(String message) {
|
||||
this.textField.setMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotNormal;
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import com.glodblock.github.inventory.slot.FCSlotRestrictedInput;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.PACKET;
|
||||
|
||||
public class ContainerFluidPacketDecoder extends AEBaseContainer {
|
||||
|
||||
public ContainerFluidPacketDecoder(InventoryPlayer ipl, TileFluidPacketDecoder tile) {
|
||||
super(ipl, tile);
|
||||
addSlotToContainer(new SlotNormal(tile.getInventory(), 0, 80, 35));
|
||||
addSlotToContainer(new FCSlotRestrictedInput(PACKET.stack(), tile.getInventory(), 0, 80, 35, ipl));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
||||
}
|
||||
}
|
||||
|
||||
private static class SlotFluidConvertingFake extends SlotFake implements SlotFluid {
|
||||
public static class SlotFluidConvertingFake extends SlotFake implements SlotFluid {
|
||||
|
||||
private final AeStackInventory<IAEItemStack> inv;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
@@ -15,6 +16,7 @@ import com.glodblock.github.inventory.PatternConsumer;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -117,6 +119,7 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
|
||||
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
||||
pattern.setInputs(collectInventory(craftingSlots));
|
||||
pattern.setOutputs(collectInventory(outputSlots));
|
||||
// pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
|
||||
patternSlotOUT.putStack(pattern.writeToStack());
|
||||
}
|
||||
|
||||
@@ -197,4 +200,18 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
|
||||
super.doAction(player, action, slotId, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
|
||||
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||
ItemStack is = clickSlot.getStack();
|
||||
if (is != null && !patternSlotOUT.getHasStack() && is.stackSize == 1 && (is.getItem() instanceof ItemFluidEncodedPattern || is.getItem() instanceof ItemEncodedPattern)) {
|
||||
ItemStack output = is.copy();
|
||||
patternSlotOUT.putStack(output);
|
||||
p.inventory.setInventorySlotContents(clickSlot.getSlotIndex(), null);
|
||||
this.detectAndSendChanges();
|
||||
return null;
|
||||
} else {
|
||||
return super.transferStackInSlot(p, idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
@@ -14,6 +15,7 @@ import com.glodblock.github.inventory.PatternConsumer;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -114,6 +116,7 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
pattern.setCombine(this.combine ? 1:0);
|
||||
pattern.setInputs(collectInventory(craftingSlots));
|
||||
pattern.setOutputs(collectInventory(outputSlots));
|
||||
// pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
|
||||
patternSlotOUT.putStack(pattern.writeToStack());
|
||||
}
|
||||
|
||||
@@ -195,4 +198,18 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
super.doAction(player, action, slotId, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
|
||||
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||
ItemStack is = clickSlot.getStack();
|
||||
if (is != null && !patternSlotOUT.getHasStack() && is.stackSize == 1 && (is.getItem() instanceof ItemFluidEncodedPattern || is.getItem() instanceof ItemEncodedPattern)) {
|
||||
ItemStack output = is.copy();
|
||||
patternSlotOUT.putStack(output);
|
||||
p.inventory.setInventorySlotContents(clickSlot.getSlotIndex(), null);
|
||||
this.detectAndSendChanges();
|
||||
return null;
|
||||
} else {
|
||||
return super.transferStackInSlot(p, idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerFluidTerminal extends FCBaseFluidMonitorContain {
|
||||
public ContainerFluidTerminal(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public class ContainerLevelMaintainer extends AEBaseContainer {
|
||||
private final TileLevelMaintainer tile;
|
||||
private final FakeSlot[] requestSlots = new FakeSlot[TileLevelMaintainer.REQ_COUNT];
|
||||
|
||||
public ContainerLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
|
||||
super(ipl, tile);
|
||||
this.tile = tile;
|
||||
AeItemStackHandler request = new AeItemStackHandler(tile.getRequestSlots());
|
||||
for (int y = 0; y < TileLevelMaintainer.REQ_COUNT; y++) {
|
||||
FakeSlot slot = new FakeSlot(request, y, 17, 19 + y * 20);
|
||||
addSlotToContainer(slot);
|
||||
requestSlots[y] = slot;
|
||||
}
|
||||
bindPlayerInventory(ipl, 0, 132);
|
||||
}
|
||||
|
||||
public TileLevelMaintainer getTile() {
|
||||
return tile;
|
||||
}
|
||||
|
||||
public FakeSlot[] getRequestSlots() {
|
||||
return this.requestSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int idx) {
|
||||
for (FakeSlot slot : this.getRequestSlots()) {
|
||||
if (!slot.getHasStack()) {
|
||||
slot.setAeStack(AEItemStack.create(((Slot) this.inventorySlots.get(idx)).getStack()), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class FakeSlot extends ContainerFluidPatternEncoder.SlotFluidConvertingFake {
|
||||
|
||||
public FakeSlot(AeItemStackHandler inv, int idx, int x, int y) {
|
||||
super(inv, idx, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,454 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IMEChest;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.me.helpers.ChannelPowerSrc;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import com.glodblock.github.network.SPacketMEInventoryUpdate;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.nio.BufferOverflowException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEFluidStack> {
|
||||
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
||||
private final IMEMonitor<IAEFluidStack> monitor;
|
||||
private final IItemList<IAEFluidStack> items = AEApi.instance().storage().createFluidList();
|
||||
private final IConfigManager clientCM;
|
||||
private final ITerminalHost host;
|
||||
@GuiSync(99)
|
||||
public boolean canAccessViewCells = false;
|
||||
@GuiSync(98)
|
||||
public boolean hasPower = false;
|
||||
private IConfigManagerHost gui;
|
||||
private IConfigManager serverCM;
|
||||
private IGridNode networkNode;
|
||||
|
||||
public FCBaseFluidMonitorContain(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
this(ip, monitorable, true);
|
||||
}
|
||||
|
||||
protected FCBaseFluidMonitorContain(final InventoryPlayer ip, final ITerminalHost monitorable, final boolean bindInventory) {
|
||||
super(ip, monitorable instanceof TileEntity ? (TileEntity) monitorable : null, monitorable instanceof IPart ? (IPart) monitorable : null);
|
||||
this.host = monitorable;
|
||||
this.clientCM = new ConfigManager(this);
|
||||
|
||||
this.clientCM.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
this.clientCM.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
this.clientCM.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
if (Platform.isServer()) {
|
||||
this.serverCM = monitorable.getConfigManager();
|
||||
|
||||
this.monitor = monitorable.getFluidInventory();
|
||||
if (this.monitor != null) {
|
||||
this.monitor.addListener(this, null);
|
||||
|
||||
// this.setCellInventory( this.monitor );
|
||||
|
||||
if (monitorable instanceof IPortableCell) {
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
} else if (monitorable instanceof IMEChest) {
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
} else if (monitorable instanceof IGridHost) {
|
||||
final IGridNode node = ((IGridHost) monitorable).getGridNode(ForgeDirection.UNKNOWN);
|
||||
if (node != null) {
|
||||
this.networkNode = node;
|
||||
final IGrid g = node.getGrid();
|
||||
if (g != null) {
|
||||
this.setPowerSource(new ChannelPowerSrc(this.networkNode, g.getCache(IEnergyGrid.class)));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
this.monitor = null;
|
||||
}
|
||||
|
||||
this.canAccessViewCells = false;
|
||||
if (monitorable instanceof IViewCellStorage) {
|
||||
for (int y = 0; y < 5; y++) {
|
||||
this.cellView[y] = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.VIEW_CELL, ((IViewCellStorage) monitorable).getViewCellStorage(), y, 206, y * 18 + 8, this.getInventoryPlayer());
|
||||
this.cellView[y].setAllowEdit(this.canAccessViewCells);
|
||||
this.addSlotToContainer(this.cellView[y]);
|
||||
}
|
||||
}
|
||||
|
||||
if (bindInventory) {
|
||||
this.bindPlayerInventory(ip, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public IGridNode getNetworkNode() {
|
||||
return this.networkNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
||||
if (Platform.isClient()) {
|
||||
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack() && Util.FluidUtil.isFluidContainer(clickSlot.getStack())) {
|
||||
ItemStack tis = clickSlot.getStack();
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
tmp.put(0, ItemFluidDrop.getAeFluidStack(AEItemStack.create(tis)));
|
||||
int index = Util.findItemInPlayerInvSlot(p, clickSlot.getStack());
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, tis, index));
|
||||
}
|
||||
}
|
||||
return super.transferStackInSlot(p, idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
if (Platform.isServer()) {
|
||||
if (this.monitor != this.host.getFluidInventory()) {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
|
||||
for (final Settings set : this.serverCM.getSettings()) {
|
||||
final Enum<?> sideLocal = this.serverCM.getSetting(set);
|
||||
final Enum<?> sideRemote = this.clientCM.getSetting(set);
|
||||
|
||||
if (sideLocal != sideRemote) {
|
||||
this.clientCM.putSetting(set, sideLocal);
|
||||
for (final Object crafter : this.crafters) {
|
||||
try {
|
||||
NetworkHandler.instance.sendTo(new PacketValueConfig(set.name(), sideLocal.name()), (EntityPlayerMP) crafter);
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.items.isEmpty()) {
|
||||
final IItemList<IAEFluidStack> monitorCache = this.monitor.getStorageList();
|
||||
|
||||
final SPacketMEInventoryUpdate piu = new SPacketMEInventoryUpdate(true);
|
||||
|
||||
for (final IAEFluidStack is : this.items) {
|
||||
final IAEFluidStack send = monitorCache.findPrecise(is);
|
||||
if (send == null) {
|
||||
is.setStackSize(0);
|
||||
piu.appendFluid(is);
|
||||
} else {
|
||||
piu.appendFluid(send);
|
||||
}
|
||||
}
|
||||
|
||||
if (!piu.isEmpty()) {
|
||||
this.items.resetStatus();
|
||||
|
||||
for (final Object c : this.crafters) {
|
||||
if (c instanceof EntityPlayer) {
|
||||
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.updatePowerStatus();
|
||||
|
||||
final boolean oldAccessible = this.canAccessViewCells;
|
||||
this.canAccessViewCells =
|
||||
this.host instanceof WirelessTerminalGuiObject
|
||||
|| this.hasAccess(SecurityPermissions.BUILD, false);
|
||||
if (this.canAccessViewCells != oldAccessible) {
|
||||
for (int y = 0; y < 5; y++) {
|
||||
if (this.cellView[y] != null) {
|
||||
this.cellView[y].setAllowEdit(this.canAccessViewCells);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
protected void updatePowerStatus() {
|
||||
try {
|
||||
if (this.networkNode != null) {
|
||||
this.setPowered(this.networkNode.isActive());
|
||||
} else if (this.getPowerSource() instanceof IEnergyGrid) {
|
||||
this.setPowered(((IEnergyGrid) this.getPowerSource()).isNetworkPowered());
|
||||
} else {
|
||||
this.setPowered(this.getPowerSource().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG) > 0.8);
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||
if (field.equals("canAccessViewCells")) {
|
||||
for (int y = 0; y < 5; y++) {
|
||||
if (this.cellView[y] != null) {
|
||||
this.cellView[y].setAllowEdit(this.canAccessViewCells);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onUpdate(field, oldValue, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(final ICrafting c) {
|
||||
super.addCraftingToCrafters(c);
|
||||
this.queueInventory(c);
|
||||
}
|
||||
|
||||
private void queueInventory(final ICrafting c) {
|
||||
if (Platform.isServer() && c instanceof EntityPlayer && this.monitor != null) {
|
||||
SPacketMEInventoryUpdate piu = new SPacketMEInventoryUpdate(true);
|
||||
final IItemList<IAEFluidStack> monitorCache = this.monitor.getStorageList();
|
||||
|
||||
for (final IAEFluidStack send : monitorCache) {
|
||||
try {
|
||||
piu.appendFluid(send);
|
||||
} catch (final BufferOverflowException boe) {
|
||||
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
|
||||
|
||||
piu = new SPacketMEInventoryUpdate(true);
|
||||
piu.appendFluid(send);
|
||||
}
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(final EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
if (this.monitor != null) {
|
||||
this.monitor.removeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager() {
|
||||
if (Platform.isServer()) {
|
||||
return this.serverCM;
|
||||
}
|
||||
return this.clientCM;
|
||||
}
|
||||
|
||||
public ItemStack[] getViewCells() {
|
||||
final ItemStack[] list = new ItemStack[this.cellView.length];
|
||||
|
||||
for (int x = 0; x < this.cellView.length; x++) {
|
||||
list[x] = this.cellView[x].getStack();
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public SlotRestrictedInput getCellViewSlot(final int index) {
|
||||
return this.cellView[index];
|
||||
}
|
||||
|
||||
public boolean isPowered() {
|
||||
return this.hasPower;
|
||||
}
|
||||
|
||||
private void setPowered(final boolean isPowered) {
|
||||
this.hasPower = isPowered;
|
||||
}
|
||||
|
||||
private IConfigManagerHost getGui() {
|
||||
return this.gui;
|
||||
}
|
||||
|
||||
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Object verificationToken) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change, BaseActionSource actionSource) {
|
||||
for (final IAEFluidStack is : change) {
|
||||
this.items.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
private void dropItem(ItemStack is) {
|
||||
if (is.stackSize <= 0) return;
|
||||
ItemStack itemStack = is.copy();
|
||||
int i = itemStack.getMaxStackSize();
|
||||
while (itemStack.stackSize > 0) {
|
||||
if (i > itemStack.stackSize) {
|
||||
if (!getPlayerInv().addItemStackToInventory(itemStack.copy())) {
|
||||
getPlayerInv().player.entityDropItem(itemStack.copy(), 0);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
itemStack.stackSize -= i;
|
||||
ItemStack item = itemStack.copy();
|
||||
item.stackSize = i;
|
||||
if (!getPlayerInv().addItemStackToInventory(item)) {
|
||||
getPlayerInv().player.entityDropItem(item, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dropItem(ItemStack itemStack, int stackSize) {
|
||||
if (itemStack.stackSize <= 0) return;
|
||||
ItemStack is = itemStack.copy();
|
||||
is.stackSize = stackSize;
|
||||
this.dropItem(is);
|
||||
}
|
||||
|
||||
public void postChange(Iterable<IAEFluidStack> change, ItemStack fluidContainer, EntityPlayer player, int slotIndex) {
|
||||
for (IAEFluidStack fluid : change) {
|
||||
IAEFluidStack nfluid = this.monitor.getStorageList().findPrecise(fluid);
|
||||
ItemStack out = fluidContainer.copy();
|
||||
out.stackSize = 1;
|
||||
if (Util.FluidUtil.isEmpty(fluidContainer) && fluid != null) {
|
||||
// add fluid to tanks
|
||||
if (nfluid.getStackSize() <= 0) continue;
|
||||
final IAEFluidStack toExtract = nfluid.copy();
|
||||
MutablePair<Integer, ItemStack> fillStack = Util.FluidUtil.fillStack(out, toExtract.getFluidStack());
|
||||
if (fillStack.right == null || fillStack.left <= 0) continue;
|
||||
toExtract.setStackSize((long) fillStack.left * fluidContainer.stackSize);
|
||||
IAEFluidStack tmp = this.host.getFluidInventory().extractItems(toExtract, Actionable.SIMULATE, this.getActionSource());
|
||||
fillStack.right.stackSize = (int) (tmp.getStackSize() / fillStack.left);
|
||||
this.dropItem(fillStack.right);
|
||||
out.stackSize = fillStack.right.stackSize;
|
||||
if (fillStack.right.getItem() instanceof IFluidContainerItem) {
|
||||
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
if ((int) (tmp.getStackSize() % fillStack.left) > 0) {
|
||||
((IFluidContainerItem) fillStack.right.getItem()).drain(fillStack.right, fillStack.left - (int) (tmp.getStackSize() % fillStack.left), true);
|
||||
this.dropItem(fillStack.right, 1);
|
||||
out.stackSize++;
|
||||
}
|
||||
} else if (FluidContainerRegistry.isContainer(fillStack.right)) {
|
||||
toExtract.setStackSize((long) fillStack.right.stackSize * fillStack.left);
|
||||
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
}
|
||||
} else if (!Util.FluidUtil.isEmpty(fluidContainer)) {
|
||||
// add fluid to ae network
|
||||
AEFluidStack fluidStack = Util.getAEFluidFromItem(fluidContainer);
|
||||
final IAEFluidStack aeFluidStack = fluidStack.copy();
|
||||
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
|
||||
final IAEFluidStack notInserted = this.host.getFluidInventory().injectItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
MutablePair<Integer, ItemStack> drainStack = Util.FluidUtil.drainStack(out.copy(), aeFluidStack.getFluidStack());
|
||||
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||
if (fluidStack.getStackSize() == notInserted.getStackSize()) continue;
|
||||
aeFluidStack.decStackSize(notInserted.getStackSize());
|
||||
|
||||
if (drainStack.left > aeFluidStack.getStackSize() && FluidContainerRegistry.isContainer(drainStack.right)) {
|
||||
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
|
||||
this.host.getFluidInventory().extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
continue;
|
||||
}
|
||||
|
||||
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left)); // drop empty item
|
||||
out.stackSize = (int) (notInserted.getStackSize() / drainStack.left);
|
||||
if (drainStack.right.getItem() instanceof IFluidContainerItem) {
|
||||
if (notInserted.getStackSize() % drainStack.left > 0) {
|
||||
fluidStack.setStackSize((notInserted.getStackSize() % drainStack.left));
|
||||
((IFluidContainerItem) drainStack.right.getItem()).fill(drainStack.right, fluidStack.getFluidStack(), true);
|
||||
this.dropItem(drainStack.right, 1);
|
||||
}
|
||||
} else if (FluidContainerRegistry.isContainer(drainStack.right)) {
|
||||
if (notInserted.getStackSize() % drainStack.left > 0) {
|
||||
aeFluidStack.setStackSize(aeFluidStack.getStackSize() % drainStack.left);
|
||||
this.host.getFluidInventory().extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
out.stackSize++;
|
||||
}
|
||||
}
|
||||
if (slotIndex == -1) out.stackSize = fluidContainer.stackSize - out.stackSize;
|
||||
} else {
|
||||
out.stackSize = (int) (fluidContainer.stackSize - (aeFluidStack.getStackSize() / drainStack.left));
|
||||
this.dropItem(drainStack.right, fluidContainer.stackSize); // drop empty item
|
||||
if (slotIndex == -1) out.stackSize++;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
if (slotIndex == -1) {
|
||||
player.inventory.getItemStack().stackSize = player.inventory.getItemStack().stackSize - out.stackSize;
|
||||
if (player.inventory.getItemStack().stackSize > 0) {
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()), (EntityPlayerMP) player);
|
||||
} else {
|
||||
player.inventory.setItemStack(null);
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||
}
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
|
||||
}
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListUpdate() {
|
||||
for (final Object c : this.crafters) {
|
||||
if (c instanceof ICrafting) {
|
||||
final ICrafting cr = (ICrafting) c;
|
||||
this.queueInventory(cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
|
||||
if (this.getGui() != null) {
|
||||
this.getGui().updateSetting(manager, settingName, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,20 +54,22 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
protected final SlotPatternTerm craftSlot;
|
||||
protected final SlotRestrictedInput patternSlotIN;
|
||||
protected final SlotRestrictedInput patternSlotOUT;
|
||||
@GuiSync( 97 )
|
||||
@GuiSync(97)
|
||||
public boolean craftingMode = true;
|
||||
@GuiSync( 96 )
|
||||
@GuiSync(96)
|
||||
public boolean substitute = false;
|
||||
@GuiSync( 95 )
|
||||
@GuiSync(95)
|
||||
public boolean combine = false;
|
||||
@GuiSync(94)
|
||||
public boolean beSubstitute = false;
|
||||
|
||||
public FCBasePartContainer(final InventoryPlayer ip, final ITerminalHost monitorable )
|
||||
{
|
||||
super( ip, monitorable, false );
|
||||
|
||||
public FCBasePartContainer(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
super(ip, monitorable, false);
|
||||
this.patternTerminal = (PartFluidPatternTerminal) monitorable;
|
||||
|
||||
final IInventory patternInv = this.getPatternTerminal().getInventoryByName( "pattern" );
|
||||
final IInventory output = this.getPatternTerminal().getInventoryByName( "output" );
|
||||
final IInventory patternInv = this.getPatternTerminal().getInventoryByName("pattern");
|
||||
final IInventory output = this.getPatternTerminal().getInventoryByName("output");
|
||||
|
||||
this.crafting = this.getPatternTerminal().getInventoryByName( "crafting" );
|
||||
|
||||
@@ -238,9 +240,9 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
encodedValue.setTag( "in", tagIn );
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setBoolean( "crafting", this.isCraftingMode() );
|
||||
encodedValue.setBoolean( "substitute", this.isSubstitute() );
|
||||
|
||||
output.setTagCompound( encodedValue );
|
||||
encodedValue.setBoolean("substitute", this.isSubstitute());
|
||||
encodedValue.setBoolean("beSubstitute", this.canBeSubstitute());
|
||||
output.setTagCompound(encodedValue);
|
||||
}
|
||||
|
||||
private ItemStack[] getInputs()
|
||||
@@ -325,6 +327,7 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
if( i != null )
|
||||
{
|
||||
i.writeToNBT( c );
|
||||
c.setInteger( "Count", i.stackSize );
|
||||
}
|
||||
|
||||
return c;
|
||||
@@ -460,6 +463,7 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
|
||||
this.substitute = this.patternTerminal.isSubstitution();
|
||||
this.combine = this.patternTerminal.shouldCombine();
|
||||
this.beSubstitute = this.patternTerminal.canBeSubstitute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,23 +547,23 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
return this.craftingMode;
|
||||
}
|
||||
|
||||
private void setCraftingMode( final boolean craftingMode )
|
||||
{
|
||||
private void setCraftingMode(final boolean craftingMode) {
|
||||
this.craftingMode = craftingMode;
|
||||
}
|
||||
|
||||
public PartFluidPatternTerminal getPatternTerminal()
|
||||
{
|
||||
public PartFluidPatternTerminal getPatternTerminal() {
|
||||
return this.patternTerminal;
|
||||
}
|
||||
|
||||
private boolean isSubstitute()
|
||||
{
|
||||
private boolean canBeSubstitute() {
|
||||
return this.beSubstitute;
|
||||
}
|
||||
|
||||
private boolean isSubstitute() {
|
||||
return this.substitute;
|
||||
}
|
||||
|
||||
public void setSubstitute( final boolean substitute )
|
||||
{
|
||||
public void setSubstitute(final boolean substitute) {
|
||||
this.substitute = substitute;
|
||||
}
|
||||
|
||||
@@ -610,22 +614,10 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
assert !ow.hasNext();
|
||||
}
|
||||
|
||||
public void doubleStacks(boolean isShift)
|
||||
{
|
||||
if (!isCraftingMode() && canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots))
|
||||
{
|
||||
doubleStacksInternal(this.craftingSlots);
|
||||
doubleStacksInternal(this.outputSlots);
|
||||
if (isShift && !containsFluid(outputSlots) && !containsFluid(craftingSlots))
|
||||
{
|
||||
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots))
|
||||
{
|
||||
doubleStacksInternal(this.craftingSlots);
|
||||
doubleStacksInternal(this.outputSlots);
|
||||
}
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
static boolean containsItem(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long item = enabledSlots.stream().filter(s -> s.getStack() != null && !Util.isFluidPacket(s.getStack())).count();
|
||||
return item > 0;
|
||||
}
|
||||
|
||||
static boolean containsFluid(SlotFake[] slots) {
|
||||
@@ -634,4 +626,18 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
return fluid > 0;
|
||||
}
|
||||
|
||||
public void doubleStacks(boolean isShift) {
|
||||
if (!isCraftingMode() && canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
|
||||
doubleStacksInternal(this.craftingSlots);
|
||||
doubleStacksInternal(this.outputSlots);
|
||||
if (isShift && (containsItem(outputSlots) || containsItem(craftingSlots))) {
|
||||
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
|
||||
doubleStacksInternal(this.craftingSlots);
|
||||
doubleStacksInternal(this.outputSlots);
|
||||
}
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,25 +63,26 @@ 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 )
|
||||
@GuiSync(96 + (17 - 9) + 11)
|
||||
public boolean combine = false;
|
||||
@GuiSync( 96 + (17-9) + 12 )
|
||||
@GuiSync(96 + (17 - 9) + 12)
|
||||
public boolean substitute = false;
|
||||
@GuiSync( 96 + (17-9) + 16 )
|
||||
@GuiSync(96 + (17 - 9) + 16)
|
||||
public boolean inverted;
|
||||
@GuiSync( 96 + (17-9) + 17 )
|
||||
@GuiSync(96 + (17 - 9) + 17)
|
||||
public int activePage = 0;
|
||||
@GuiSync( 96 + (17-9) + 13 )
|
||||
@GuiSync(96 + (17 - 9) + 13)
|
||||
public boolean prioritize = false;
|
||||
@GuiSync(96 + (17 - 9) + 14)
|
||||
public boolean beSubstitute = false;
|
||||
|
||||
public FCBasePartContainerEx(final InventoryPlayer ip, final ITerminalHost monitorable )
|
||||
{
|
||||
super( ip, monitorable, false );
|
||||
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" );
|
||||
final IInventory patternInv = this.getPatternTerminal().getInventoryByName("pattern");
|
||||
final IInventory output = this.getPatternTerminal().getInventoryByName("output");
|
||||
IInventory crafting = this.getPatternTerminal().getInventoryByName("crafting");
|
||||
|
||||
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
|
||||
@@ -210,9 +211,9 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
|
||||
encodedValue.setTag( "in", tagIn );
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setBoolean( "substitute", this.isSubstitute() );
|
||||
|
||||
encodedValue.setTag( "in", tagIn );
|
||||
encodedValue.setBoolean("substitute", this.isSubstitute());
|
||||
encodedValue.setBoolean("beSubstitute", this.canBeSubstitute());
|
||||
encodedValue.setTag("in", tagIn);
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setBoolean( "prioritize", this.isPrioritize() );
|
||||
|
||||
@@ -289,6 +290,7 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
if( i != null )
|
||||
{
|
||||
i.writeToNBT( c );
|
||||
c.setInteger( "Count", i.stackSize );
|
||||
}
|
||||
|
||||
return c;
|
||||
@@ -315,6 +317,7 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
{
|
||||
this.substitute = this.patternTerminal.isSubstitution();
|
||||
this.combine = this.patternTerminal.shouldCombine(); //Check out
|
||||
this.beSubstitute = this.patternTerminal.canBeSubstitute();
|
||||
this.prioritize = this.patternTerminal.isPrioritize();
|
||||
if (inverted != patternTerminal.isInverted() || activePage != patternTerminal.getActivePage()) {
|
||||
inverted = patternTerminal.isInverted();
|
||||
@@ -445,22 +448,14 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
assert !ow.hasNext();
|
||||
}
|
||||
|
||||
public void doubleStacks(boolean isShift)
|
||||
{
|
||||
if (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots))
|
||||
{
|
||||
doubleStacksInternal(this.craftingSlots);
|
||||
doubleStacksInternal(this.outputSlots);
|
||||
if (isShift && !containsFluid(outputSlots) && !containsFluid(craftingSlots))
|
||||
{
|
||||
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots))
|
||||
{
|
||||
doubleStacksInternal(this.craftingSlots);
|
||||
doubleStacksInternal(this.outputSlots);
|
||||
}
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
static boolean containsItem(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long item = enabledSlots.stream().filter(s -> s.getStack() != null && !Util.isFluidPacket(s.getStack())).count();
|
||||
return item > 0;
|
||||
}
|
||||
|
||||
private boolean canBeSubstitute() {
|
||||
return this.beSubstitute;
|
||||
}
|
||||
|
||||
static boolean containsFluid(SlotFake[] slots) {
|
||||
@@ -469,6 +464,20 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
return fluid > 0;
|
||||
}
|
||||
|
||||
public void doubleStacks(boolean isShift) {
|
||||
if (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
|
||||
doubleStacksInternal(this.craftingSlots);
|
||||
doubleStacksInternal(this.outputSlots);
|
||||
if (isShift && (containsItem(outputSlots) || containsItem(craftingSlots))) {
|
||||
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
|
||||
doubleStacksInternal(this.craftingSlots);
|
||||
doubleStacksInternal(this.outputSlots);
|
||||
}
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void setActivePage(final int activePage) {
|
||||
this.activePage = activePage;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package com.glodblock.github.client.me;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.util.FluidSorters;
|
||||
import com.glodblock.github.util.Util;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public class FluidRepo extends ItemRepo {
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
private final ArrayList<IAEItemStack> view = new ArrayList<IAEItemStack>();
|
||||
private final ArrayList<ItemStack> dsp = new ArrayList<ItemStack>();
|
||||
private final IScrollSource src;
|
||||
private final ISortSource sortSrc;
|
||||
|
||||
private int rowSize = 9;
|
||||
|
||||
private String searchString = "";
|
||||
private IPartitionList<IAEItemStack> myPartitionList;
|
||||
private String innerSearch = "";
|
||||
private String NEIWord = null;
|
||||
private boolean hasPower;
|
||||
|
||||
public FluidRepo(final IScrollSource src, final ISortSource sortSrc) {
|
||||
super(src, sortSrc);
|
||||
this.src = src;
|
||||
this.sortSrc = sortSrc;
|
||||
}
|
||||
|
||||
public IAEItemStack getReferenceItem(int idx) {
|
||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||
|
||||
if (idx >= this.view.size()) {
|
||||
return null;
|
||||
}
|
||||
return this.view.get(idx);
|
||||
}
|
||||
|
||||
public ItemStack getItem(int idx) {
|
||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||
|
||||
if (idx >= this.dsp.size()) {
|
||||
return null;
|
||||
}
|
||||
return this.dsp.get(idx);
|
||||
}
|
||||
|
||||
void setSearch(final String search) {
|
||||
this.searchString = search == null ? "" : search;
|
||||
}
|
||||
|
||||
public void postUpdate(final IAEItemStack is) {
|
||||
final IAEItemStack st = this.list.findPrecise(is);
|
||||
if (st != null) {
|
||||
st.reset();
|
||||
st.add(is);
|
||||
} else {
|
||||
this.list.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
public void setViewCell(final ItemStack[] list) {
|
||||
this.myPartitionList = ItemViewCell.createFilter(list);
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
public void updateView() {
|
||||
this.view.clear();
|
||||
this.dsp.clear();
|
||||
|
||||
this.view.ensureCapacity(this.list.size());
|
||||
this.dsp.ensureCapacity(this.list.size());
|
||||
|
||||
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||
final Enum searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
|
||||
this.updateNEI(this.searchString);
|
||||
}
|
||||
|
||||
this.innerSearch = this.searchString;
|
||||
final boolean terminalSearchToolTips =
|
||||
AEConfig.instance.settings.getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
|
||||
// boolean terminalSearchMods = Configuration.INSTANCE.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
|
||||
|
||||
boolean searchMod = false;
|
||||
if (this.innerSearch.startsWith("@")) {
|
||||
searchMod = true;
|
||||
this.innerSearch = this.innerSearch.substring(1);
|
||||
}
|
||||
|
||||
Pattern m = null;
|
||||
try {
|
||||
m = Pattern.compile(this.innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE);
|
||||
} catch (final Throwable ignore) {
|
||||
try {
|
||||
m = Pattern.compile(Pattern.quote(this.innerSearch.toLowerCase()), Pattern.CASE_INSENSITIVE);
|
||||
} catch (final Throwable __) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
boolean notDone = false;
|
||||
for (IAEItemStack is : this.list) {
|
||||
if (this.myPartitionList != null) {
|
||||
if (!this.myPartitionList.isListed(is)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.CRAFTABLE) {
|
||||
is = is.copy();
|
||||
is.setStackSize(0);
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
|
||||
continue;
|
||||
}
|
||||
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
|
||||
if (searchMod) {
|
||||
if (m.matcher(Util.getFluidModID(fluid).toLowerCase()).find() ||
|
||||
m.matcher(Util.getFluidModName(fluid).toLowerCase()).find()) {
|
||||
this.view.add(is);
|
||||
}
|
||||
} else {
|
||||
if (m.matcher(fluid.getLocalizedName().toLowerCase()).find()) {
|
||||
this.view.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* if ( terminalSearchMods && notDone ) { if ( m.matcher( Platform.getMod( is.getItemStack() ) ).find() ) {
|
||||
* view.add( is ); notDone = false; } }
|
||||
*/
|
||||
}
|
||||
|
||||
final Enum SortBy = this.sortSrc.getSortBy();
|
||||
final Enum SortDir = this.sortSrc.getSortDir();
|
||||
|
||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||
FluidSorters.init();
|
||||
|
||||
if (SortBy == SortOrder.MOD) {
|
||||
Collections.sort(this.view, FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||
} else if (SortBy == SortOrder.AMOUNT) {
|
||||
Collections.sort(this.view, FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||
Collections.sort(this.view, FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||
} else {
|
||||
Collections.sort(this.view, FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||
}
|
||||
|
||||
for (final IAEItemStack is : this.view) {
|
||||
this.dsp.add(is.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateNEI(final String filter) {
|
||||
try {
|
||||
if (this.NEIWord == null || !this.NEIWord.equals(filter)) {
|
||||
final Class c =
|
||||
ReflectionHelper.getClass(this.getClass().getClassLoader(), "codechicken.nei.LayoutManager");
|
||||
final Field fldSearchField = c.getField("searchField");
|
||||
final Object searchField = fldSearchField.get(c);
|
||||
|
||||
final Method a = searchField.getClass().getMethod("setText", String.class);
|
||||
final Method b = searchField.getClass().getMethod("onTextChange", String.class);
|
||||
|
||||
this.NEIWord = filter;
|
||||
a.invoke(searchField, filter);
|
||||
b.invoke(searchField, "");
|
||||
}
|
||||
} catch (final Throwable ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.view.size();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.list.resetStatus();
|
||||
}
|
||||
|
||||
public boolean hasPower() {
|
||||
return this.hasPower;
|
||||
}
|
||||
|
||||
public void setPower(final boolean hasPower) {
|
||||
this.hasPower = hasPower;
|
||||
}
|
||||
|
||||
public int getRowSize() {
|
||||
return this.rowSize;
|
||||
}
|
||||
|
||||
public void setRowSize(final int rowSize) {
|
||||
this.rowSize = rowSize;
|
||||
}
|
||||
|
||||
public String getSearchString() {
|
||||
return this.searchString;
|
||||
}
|
||||
|
||||
public void setSearchString(@Nonnull final String searchString) {
|
||||
this.searchString = searchString;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.block.BlockLevelMaintainer;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderBlockLevelMaintainer extends BaseBlockRender<BlockLevelMaintainer, TileLevelMaintainer> {
|
||||
|
||||
public RenderBlockLevelMaintainer() {
|
||||
super(false, 20);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(final BlockLevelMaintainer block, final IBlockAccess world, final int x, final int y, final int z, final RenderBlocks renderer) {
|
||||
final TileLevelMaintainer ti = block.getTileEntity(world, x, y, z);
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
|
||||
if (ti != null && ti.isActive()) {
|
||||
final IIcon activeIcon = FCPartsTexture.BlockLevelMaintainer_Active.getIcon();
|
||||
final IIcon side = FCPartsTexture.BlockLevelMaintainer.getIcon();
|
||||
info.setTemporaryRenderIcons(side, side, activeIcon, side, side, side);
|
||||
}
|
||||
|
||||
final boolean fz = super.renderInWorld(block, world, x, y, z, renderer);
|
||||
|
||||
info.setTemporaryRenderIcon(null);
|
||||
|
||||
return fz;
|
||||
}
|
||||
}
|
||||
@@ -9,23 +9,21 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public enum FCPartsTexture {
|
||||
|
||||
PartFluidTerminal_Bright("fluid_terminal_bright"), PartFluidTerminal_Dark("fluid_terminal_dark"), PartFluidTerminal_Colored("fluid_terminal_medium"),
|
||||
PartFluidPatternTerminal_Bright("pattern_terminal_bright"), PartFluidPatternTerminal_Dark("pattern_terminal_dark"),
|
||||
PartFluidPatternTerminal_Colored("pattern_terminal_medium"), PartTerminalBroad("terminal_broad"),
|
||||
PartFluidImportBus("fluid_import_face"), PartFluidExportBus("fluid_export_face"),
|
||||
BlockFluidInterfaceAlternate_Arrow("fluid_interface_arrow"), BlockInterfaceAlternate("fluid_interface_a"),
|
||||
BlockInterface_Face("fluid_interface");
|
||||
BlockInterface_Face("fluid_interface"), BlockLevelMaintainer("level_maintainer"), BlockLevelMaintainer_Active("level_maintainer_active");
|
||||
|
||||
private final String name;
|
||||
public net.minecraft.util.IIcon IIcon;
|
||||
|
||||
FCPartsTexture( final String name )
|
||||
{
|
||||
FCPartsTexture(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static ResourceLocation GuiTexture(final String string)
|
||||
{
|
||||
public static ResourceLocation GuiTexture(final String string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.glodblock.github.common.block;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.util.Platform;
|
||||
import com.glodblock.github.client.render.RenderBlockLevelMaintainer;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
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 com.glodblock.github.util.Util;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockLevelMaintainer extends FCBaseBlock {
|
||||
|
||||
public BlockLevelMaintainer() {
|
||||
super(Material.iron, NameConst.BLOCK_LEVEL_MAINTAINER);
|
||||
setFullBlock(true);
|
||||
setOpaque(true);
|
||||
setTileEntity(TileLevelMaintainer.class);
|
||||
}
|
||||
|
||||
public BlockLevelMaintainer register() {
|
||||
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_LEVEL_MAINTAINER);
|
||||
GameRegistry.registerTileEntity(TileLevelMaintainer.class, NameConst.BLOCK_LEVEL_MAINTAINER);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlockLevelMaintainer getRenderer() {
|
||||
return new RenderBlockLevelMaintainer();
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
TileLevelMaintainer tile = getTileEntity(world, x, y, z);
|
||||
if (tile != null) {
|
||||
if (Platform.isServer()) {
|
||||
if (Util.hasPermission(player, SecurityPermissions.CRAFT, tile)) {
|
||||
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.LEVEL_MAINTAINER);
|
||||
} else {
|
||||
player.addChatComponentMessage(new ChatComponentText("You don't have permission to view."));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack stack(int size) {
|
||||
return new ItemStack(this, size);
|
||||
}
|
||||
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.storage.CellType;
|
||||
@@ -52,8 +53,10 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
|
||||
private final int totalBytes;
|
||||
private final int perType;
|
||||
private final double idleDrain;
|
||||
private final ReadableNumberConverter format = ReadableNumberConverter.INSTANCE;
|
||||
private final static HashMap<Integer, IIcon> icon = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("Guava")
|
||||
public ItemBasicFluidStorageCell( final CellType whichCell, final int kilobytes )
|
||||
{
|
||||
super( Optional.of( kilobytes + "k" ) );
|
||||
@@ -137,6 +140,17 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
|
||||
|
||||
lines.add( cellInventory.getStoredFluidTypes() + " " + GuiText.Of.getLocal() + ' ' + cellInventory.getTotalFluidTypes() + ' ' + GuiText.Types.getLocal() );
|
||||
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
if (cellInventory.getStoredFluidTypes() > 0) {
|
||||
lines.add(StatCollector.translateToLocal(NameConst.TT_CELL_CONTENTS));
|
||||
for (IAEFluidStack fluid : cellInventory.getContents()) {
|
||||
if (fluid != null) {
|
||||
lines.add(String.format(" %s x%smB", fluid.getFluidStack().getLocalizedName(), format.toWideReadableForm(fluid.getStackSize())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( handler.isPreformatted() )
|
||||
{
|
||||
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded).getLocal();
|
||||
|
||||
@@ -46,6 +46,9 @@ public class ItemFluidDrop extends Item {
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
FluidStack fluid = getFluidStack(stack);
|
||||
if (ItemFluidPacket.isDisplay(stack)) {
|
||||
return fluid != null ? fluid.getLocalizedName() : StatCollector.translateToLocalFormatted("error.unknown");
|
||||
}
|
||||
return StatCollector.translateToLocalFormatted("item.fluid_drop.name", fluid == null ? "???" : fluid.getLocalizedName());
|
||||
}
|
||||
|
||||
@@ -54,6 +57,7 @@ public class ItemFluidDrop extends Item {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean flag) {
|
||||
FluidStack fluid = getFluidStack(stack);
|
||||
if (ItemFluidPacket.isDisplay(stack)) return;
|
||||
if (fluid != null) {
|
||||
tooltip.add(String.format(EnumChatFormatting.GRAY + "%s, 1 mB", fluid.getLocalizedName()));
|
||||
} else {
|
||||
@@ -79,8 +83,39 @@ public class ItemFluidDrop extends Item {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack newDisplayStack(FluidStack fluid) {
|
||||
if (fluid == null) {
|
||||
return null;
|
||||
}
|
||||
ItemStack stack = new ItemStack(ItemAndBlockHolder.DROP, fluid.amount);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("Fluid", fluid.getFluid().getName());
|
||||
tag.setBoolean("DisplayOnly", true);
|
||||
stack.setTagCompound(tag);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static boolean isFluidStack(ItemStack stack) {
|
||||
if (getFluidStack(stack) != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isFluidStack(@Nullable IAEItemStack stack) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
if (getFluidStack(stack.getItemStack()) != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static FluidStack getFluidStack(ItemStack stack) {
|
||||
if (stack == null|| stack.getItem() != ItemAndBlockHolder.DROP || !stack.hasTagCompound()) {
|
||||
if (stack == null || stack.getItem() != ItemAndBlockHolder.DROP || !stack.hasTagCompound()) {
|
||||
return null;
|
||||
}
|
||||
NBTTagCompound tag = Objects.requireNonNull(stack.getTagCompound());
|
||||
|
||||
@@ -136,4 +136,8 @@ public class ItemFluidPacket extends Item {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_PACKET, FluidCraft.MODID);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||
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;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
|
||||
|
||||
|
||||
public class ItemPartFluidTerminal extends Item implements IPartItem {
|
||||
public ItemPartFluidTerminal() {
|
||||
this.setMaxStackSize(64);
|
||||
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_TERMINAL);
|
||||
AEApi.instance().partHelper().setItemBusRenderer(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PartFluidTerminal createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidTerminal(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean flag) {
|
||||
if (isShiftKeyDown()) tooltip.add(StatCollector.translateToLocalFormatted(NameConst.TT_FLUID_TERMINAL));
|
||||
}
|
||||
|
||||
public ItemPartFluidTerminal register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_TERMINAL, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ItemStack stack(int size) {
|
||||
return new ItemStack(this, size);
|
||||
}
|
||||
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,6 +41,7 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
private boolean craftingMode = true;
|
||||
private boolean substitute = false;
|
||||
private boolean combine = false;
|
||||
private boolean beSubstitute = false;
|
||||
|
||||
public PartFluidPatternTerminal(ItemStack is) {
|
||||
super(is, true);
|
||||
@@ -82,8 +83,9 @@ 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.setCombineMode(data.getBoolean("combine"));
|
||||
this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
this.pattern.readFromNBT(data, "pattern");
|
||||
this.output.readFromNBT( data, "outputList" );
|
||||
this.crafting.readFromNBT( data, "craftingGrid" );
|
||||
}
|
||||
@@ -94,8 +96,9 @@ 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" );
|
||||
data.setBoolean("combine", this.combine);
|
||||
data.setBoolean("beSubstitute", this.beSubstitute);
|
||||
this.pattern.writeToNBT(data, "pattern");
|
||||
this.output.writeToNBT( data, "outputList" );
|
||||
this.crafting.writeToNBT( data, "craftingGrid" );
|
||||
}
|
||||
@@ -137,6 +140,7 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
if(newStack != null){
|
||||
NBTTagCompound data = newStack.getTagCompound();
|
||||
this.setCombineMode(data.getInteger("combine") == 1);
|
||||
// this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
}
|
||||
for (int i = 0; i < this.crafting.getSizeInventory(); i++) {
|
||||
this.crafting.setInventorySlotContents(i, null);
|
||||
@@ -209,23 +213,29 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
return this.combine;
|
||||
}
|
||||
|
||||
public void setSubstitution( boolean canSubstitute )
|
||||
{
|
||||
public void setSubstitution(boolean canSubstitute) {
|
||||
this.substitute = canSubstitute;
|
||||
}
|
||||
|
||||
public void setCombineMode(boolean shouldCombine)
|
||||
{
|
||||
public void setCombineMode(boolean shouldCombine) {
|
||||
this.combine = shouldCombine;
|
||||
}
|
||||
|
||||
public void setBeSubstitute(boolean canBeSubstitute) {
|
||||
this.beSubstitute = canBeSubstitute;
|
||||
}
|
||||
|
||||
public boolean canBeSubstitute() {
|
||||
return this.beSubstitute;
|
||||
}
|
||||
|
||||
public void onChangeCrafting(IAEItemStack[] newCrafting, IAEItemStack[] newOutput) {
|
||||
IInventory crafting = this.getInventoryByName("crafting");
|
||||
IInventory output = this.getInventoryByName("output");
|
||||
if (crafting instanceof AppEngInternalInventory && output instanceof AppEngInternalInventory) {
|
||||
for (int x = 0; x < crafting.getSizeInventory() && x < newCrafting.length; x++) {
|
||||
final IAEItemStack item = newCrafting[x];
|
||||
crafting.setInventorySlotContents(x, item == null ? null: item.getItemStack());
|
||||
crafting.setInventorySlotContents(x, item == null ? null : item.getItemStack());
|
||||
}
|
||||
for (int x = 0; x < output.getSizeInventory() && x < newOutput.length; x++) {
|
||||
final IAEItemStack item = newOutput[x];
|
||||
|
||||
@@ -42,6 +42,7 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
private boolean combine = false;
|
||||
private boolean prioritize = false;
|
||||
private boolean inverted = false;
|
||||
private boolean beSubstitute = false;
|
||||
private int activePage = 0;
|
||||
|
||||
public PartFluidPatternTerminalEx(ItemStack is) {
|
||||
@@ -87,9 +88,9 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
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.crafting.readFromNBT(data, "craftingGrid");
|
||||
this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
this.setSubstitution(data.getBoolean("substitute"));
|
||||
this.setPrioritization( data.getBoolean( "priorization") );
|
||||
this.setInverted( data.getBoolean( "inverted" ) );
|
||||
this.setActivePage( data.getInteger( "activePage" ) );
|
||||
@@ -104,7 +105,8 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
data.setBoolean( "combine", this.combine );
|
||||
this.pattern.writeToNBT( data, "pattern" );
|
||||
this.output.writeToNBT( data, "outputList" );
|
||||
this.crafting.writeToNBT( data, "craftingGrid" );
|
||||
this.crafting.writeToNBT(data, "craftingGrid");
|
||||
data.setBoolean("beSubstitute", this.beSubstitute);
|
||||
data.setBoolean("priorization", this.prioritize);
|
||||
data.setBoolean( "substitute", this.substitute );
|
||||
data.setBoolean( "inverted", this.inverted );
|
||||
@@ -163,7 +165,7 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
if(newStack != null){
|
||||
NBTTagCompound data = newStack.getTagCompound();
|
||||
this.setCombineMode(data.getInteger("combine") == 1);
|
||||
this.setPrioritization(data.getInteger("prioritize") == 1);
|
||||
// this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
}
|
||||
this.setInverted(inputsCount <= 8 && outputCount > 8);
|
||||
this.setActivePage(0);
|
||||
@@ -224,22 +226,27 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
this.combine = shouldCombine;
|
||||
}
|
||||
|
||||
public boolean isSubstitution()
|
||||
{
|
||||
public boolean isSubstitution() {
|
||||
return this.substitute;
|
||||
}
|
||||
|
||||
public boolean isPrioritize()
|
||||
{
|
||||
public boolean isPrioritize() {
|
||||
return this.prioritize;
|
||||
}
|
||||
|
||||
public void setSubstitution( boolean canSubstitute )
|
||||
{
|
||||
public void setBeSubstitute(boolean canBeSubstitute) {
|
||||
this.beSubstitute = canBeSubstitute;
|
||||
}
|
||||
|
||||
public boolean canBeSubstitute() {
|
||||
return this.beSubstitute;
|
||||
}
|
||||
|
||||
public void setSubstitution(boolean canSubstitute) {
|
||||
this.substitute = canSubstitute;
|
||||
}
|
||||
public void setPrioritization( boolean canPrioritize )
|
||||
{
|
||||
|
||||
public void setPrioritization(boolean canPrioritize) {
|
||||
this.prioritize = canPrioritize;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.util.Platform;
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
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 net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class PartFluidTerminal extends FCBasePart {
|
||||
private static final FCPartsTexture FRONT_BRIGHT_ICON = FCPartsTexture.PartFluidTerminal_Bright;
|
||||
private static final FCPartsTexture FRONT_DARK_ICON = FCPartsTexture.PartFluidTerminal_Colored;
|
||||
private static final FCPartsTexture FRONT_COLORED_ICON = FCPartsTexture.PartFluidTerminal_Dark;
|
||||
|
||||
public PartFluidTerminal(ItemStack is) {
|
||||
super(is, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCPartsTexture getFrontBright() {
|
||||
return FRONT_BRIGHT_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCPartsTexture getFrontColored() {
|
||||
return FRONT_COLORED_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCPartsTexture getFrontDark() {
|
||||
return FRONT_DARK_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLightSource() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBooting() {
|
||||
return super.isBooting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos) {
|
||||
TileEntity te = this.getTile();
|
||||
BlockPos tePos = new BlockPos(te);
|
||||
if (Platform.isWrench(player, player.inventory.getCurrentItem(), tePos.getX(), tePos.getY(), tePos.getZ())) {
|
||||
return super.onPartActivate(player, pos);
|
||||
}
|
||||
if (Platform.isServer()) {
|
||||
if (Util.hasPermission(player, SecurityPermissions.INJECT, (IGridHost) this) || Util.hasPermission(player, SecurityPermissions.EXTRACT, (IGridHost) this)) {
|
||||
InventoryHandler.openGui(player, te.getWorldObj(), tePos, Objects.requireNonNull(Util.from(getSide())), GuiType.FLUID_TERMINAL);
|
||||
} else {
|
||||
player.addChatComponentMessage(new ChatComponentText("You don't have permission to view."));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiBridge getGui(final EntityPlayer p) {
|
||||
int x = (int) p.posX;
|
||||
int y = (int) p.posY;
|
||||
int z = (int) p.posZ;
|
||||
if (this.getHost().getTile() != null) {
|
||||
x = this.getTile().xCoord;
|
||||
y = this.getTile().yCoord;
|
||||
z = this.getTile().zCoord;
|
||||
}
|
||||
|
||||
if (GuiBridge.GUI_WIRELESS_TERM.hasPermissions(this.getHost().getTile(), x, y, z, this.getSide(), p)) {
|
||||
return GuiBridge.GUI_WIRELESS_TERM;
|
||||
}
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -120,11 +120,9 @@ public abstract class PartSharedFluidBus extends PartUpgradeable implements IGri
|
||||
return null;
|
||||
}
|
||||
|
||||
protected int calculateAmountToSend()
|
||||
{
|
||||
public int calculateAmountToSend() {
|
||||
double amount = 1000D;
|
||||
switch( this.getInstalledUpgrades( Upgrades.SPEED ) )
|
||||
{
|
||||
switch (this.getInstalledUpgrades(Upgrades.SPEED)) {
|
||||
case 4:
|
||||
amount = amount * 1.5;
|
||||
case 3:
|
||||
|
||||
@@ -11,7 +11,6 @@ import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -19,6 +18,9 @@ import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
private static final String FLUID_TYPE_TAG = "ft";
|
||||
@@ -35,6 +37,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
private short storedFluids;
|
||||
private IItemList<IAEFluidStack> cellItems;
|
||||
private final NBTTagCompound tagCompound;
|
||||
public static final int singleByteAmount = 256 * 8;
|
||||
|
||||
public FluidCellInventory( final ItemStack o, final ISaveProvider container ) throws AppEngException {
|
||||
|
||||
@@ -133,9 +136,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
@Override
|
||||
public boolean canHoldNewFluid() {
|
||||
final long bytesFree = this.getFreeBytes();
|
||||
|
||||
return ( bytesFree > this.getBytesPerType() || ( bytesFree == this.getBytesPerType() && this.getUnusedFluidCount() > 0 ) ) && this.getRemainingFluidTypes() > 0;
|
||||
return this.getRemainingFluidCount() > 0 && getRemainingFluidTypes() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,8 +151,10 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
@Override
|
||||
public long getUsedBytes() {
|
||||
final long bytesForItemCount = ( this.getStoredFluidCount() + this.getUnusedFluidCount() ) / 8 / 256;
|
||||
return this.getStoredFluidTypes() * this.getBytesPerType() + bytesForItemCount;
|
||||
long bytesForItemCount = this.getStoredFluidCount() / singleByteAmount;
|
||||
long tmp = (this.getStoredFluidTypes() * this.getBytesPerType()) + bytesForItemCount;
|
||||
if (this.getUnusedFluidCount() > 0 && tmp < this.getTotalBytes()) tmp++;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,20 +181,14 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
@Override
|
||||
public long getRemainingFluidCount() {
|
||||
final long remaining = this.getFreeBytes() * 8 * 256 + this.getUnusedFluidCount();
|
||||
final long remaining = this.getTotalBytes() * singleByteAmount - this.getStoredFluidCount();
|
||||
return remaining > 0 ? remaining : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUnusedFluidCount() {
|
||||
final int div = (int) ( this.getStoredFluidCount() % 8 );
|
||||
return (int) (this.getStoredFluidCount() % singleByteAmount);
|
||||
|
||||
if( div == 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 8 - div;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -346,13 +343,11 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
return input;
|
||||
}
|
||||
|
||||
final FluidStack sharedFluidStack = input.getFluidStack();
|
||||
|
||||
final IAEFluidStack l = this.getCellItems().findPrecise( input );
|
||||
|
||||
if( l != null )
|
||||
{
|
||||
final long remainingItemSlots = this.getRemainingFluidCount();
|
||||
final long remainingItemSlots = this.getRemainingFluidCount() - (long) this.getBytesPerType() * singleByteAmount;
|
||||
|
||||
if( remainingItemSlots < 0 )
|
||||
{
|
||||
@@ -370,7 +365,6 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
this.updateFluidCount( remainingItemSlots );
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
else
|
||||
@@ -388,27 +382,26 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
if( this.canHoldNewFluid() ) // room for new type, and for at least one item!
|
||||
{
|
||||
final long remainingItemCount = this.getRemainingFluidCount() - this.getBytesPerType() * 8;
|
||||
final long remainingItemCount = this.getRemainingFluidCount() - ((long) this.getBytesPerType() * singleByteAmount);
|
||||
|
||||
if( remainingItemCount > 0 )
|
||||
{
|
||||
if( input.getStackSize() > remainingItemCount )
|
||||
{
|
||||
final FluidStack toReturn = Util.cloneFluidStack(sharedFluidStack);
|
||||
toReturn.amount = (int) (sharedFluidStack.amount - remainingItemCount);
|
||||
final IAEFluidStack toReturn = input.copy();
|
||||
toReturn.decStackSize(remainingItemCount);
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
final FluidStack toWrite = Util.cloneFluidStack( sharedFluidStack );
|
||||
toWrite.amount = (int) remainingItemCount;
|
||||
if (mode == Actionable.MODULATE) {
|
||||
IAEFluidStack toWrite = input.copy();
|
||||
toWrite.setStackSize(remainingItemCount);
|
||||
|
||||
this.cellItems.add( AEFluidStack.create( toWrite ) );
|
||||
this.updateFluidCount( toWrite.amount );
|
||||
this.cellItems.add(toWrite);
|
||||
this.updateFluidCount(toWrite.getStackSize());
|
||||
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
return AEFluidStack.create( toReturn );
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
@@ -432,7 +425,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
return null;
|
||||
}
|
||||
|
||||
final long size = Math.min( Integer.MAX_VALUE, request.getStackSize() );
|
||||
final long size = request.getStackSize();
|
||||
|
||||
IAEFluidStack results = null;
|
||||
|
||||
@@ -475,10 +468,18 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
{
|
||||
out.add( i );
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IAEFluidStack> getContents() {
|
||||
List<IAEFluidStack> ret = new ArrayList<>();
|
||||
for (IAEFluidStack fluid : this.getCellItems()) {
|
||||
ret.add(fluid);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
|
||||
@@ -5,6 +5,8 @@ import appeng.api.storage.data.IAEFluidStack;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IFluidCellInventory extends IMEInventory<IAEFluidStack>
|
||||
{
|
||||
|
||||
@@ -71,4 +73,6 @@ public interface IFluidCellInventory extends IMEInventory<IAEFluidStack>
|
||||
long getStoredFluidTypes();
|
||||
|
||||
long getTotalFluidTypes();
|
||||
|
||||
List<IAEFluidStack> getContents();
|
||||
}
|
||||
@@ -158,6 +158,6 @@ public class TileFluidPacketDecoder extends AENetworkTile implements IGridTickab
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return inventory.isItemValidForSlot(slot, stack);
|
||||
return stack.getItem() instanceof ItemFluidPacket;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,12 @@ public class TileIngredientBuffer extends AEBaseInvTile implements IAEFluidInven
|
||||
markForUpdate();
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_WRITE )
|
||||
@Override
|
||||
public AEFluidInventory getInternalFluid() {
|
||||
return this.invFluids;
|
||||
}
|
||||
|
||||
@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));
|
||||
|
||||
@@ -60,6 +60,11 @@ public class TileLargeIngredientBuffer extends AEBaseInvTile implements IAEFluid
|
||||
markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEFluidInventory getInternalFluid() {
|
||||
return this.invFluids;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
protected void writeToStream(ByteBuf data) throws IOException {
|
||||
for (int i = 0; i < invItems.getSizeInventory(); i++) {
|
||||
|
||||
@@ -0,0 +1,423 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingRequester;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
||||
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.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.AELog;
|
||||
import appeng.crafting.CraftingLink;
|
||||
import appeng.helpers.NonNullArrayIterator;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import com.glodblock.github.inventory.AeStackInventory;
|
||||
import com.glodblock.github.inventory.AeStackInventoryImpl;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInventory, IGridTickable, ICraftingRequester, IPowerChannelState {
|
||||
|
||||
public static final int REQ_COUNT = 5;
|
||||
public final InventoryRequest requests = new InventoryRequest(this);
|
||||
private final BaseActionSource source;
|
||||
private final IInventory inv = new AeItemStackHandler(requests.getRequestStacks());
|
||||
private boolean isPowered = false;
|
||||
|
||||
public TileLevelMaintainer() {
|
||||
getProxy().setIdlePowerUsage(1D);
|
||||
getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.source = new MachineSource(this);
|
||||
}
|
||||
|
||||
public AeStackInventory<IAEItemStack> getRequestSlots() {
|
||||
return requests.getRequestStacks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return ImmutableSet.copyOf(new NonNullArrayIterator<ICraftingLink>(this.requests.getLinks()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) {
|
||||
try {
|
||||
if (this.getProxy().isActive()) {
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final double power = Math.ceil(ItemFluidDrop.isFluidStack(items) ? items.getStackSize() / 1000D : items.getStackSize());
|
||||
if (energy.extractAEPower(power, mode, PowerMultiplier.CONFIG) > power - 0.01) {
|
||||
if (ItemFluidDrop.isFluidStack(items)) {
|
||||
IAEFluidStack notInserted = this.getProxy().getStorage().getFluidInventory().injectItems(ItemFluidDrop.getAeFluidStack(items), mode, this.source);
|
||||
items.setStackSize(notInserted.getStackSize());
|
||||
return items;
|
||||
} else {
|
||||
return this.getProxy().getStorage().getItemInventory().injectItems(items, mode, this.source);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (GridAccessException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
@Override
|
||||
public void jobStateChange(ICraftingLink link) {
|
||||
if (this.requests.getLinks() != null) {
|
||||
for (int x = 0; x < this.requests.getLinks().length; x++) {
|
||||
if (this.requests.getLinks()[x] == link) {
|
||||
this.requests.getLinks()[x] = link;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
return new TickingRequest(5, 120, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall) {
|
||||
return this.canDoBusWork() ? this.doWork() : TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
private TickRateModulation doWork() {
|
||||
if (!this.getProxy().isActive() || !this.canDoBusWork()) {
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
boolean didSomething = false;
|
||||
try {
|
||||
ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
IGrid grid = this.getProxy().getGrid();
|
||||
final IItemList<IAEItemStack> inv = this.getProxy().getStorage().getItemInventory().getStorageList();
|
||||
for (int i = 0; i < REQ_COUNT; i++) {
|
||||
IAEItemStack is = requests.getRequestQtyStack(i);
|
||||
if (is != null && requests.getBatchSize(i) > 0) {
|
||||
IAEItemStack craftItem = requests.getCraftItem(i);
|
||||
if (cg.canEmitFor(craftItem) || cg.isRequesting(craftItem) ||
|
||||
(inv.findPrecise(is) != null && inv.findPrecise(is).getStackSize() >= is.getStackSize()) || !this.requests.isDone(i)
|
||||
)
|
||||
continue;
|
||||
// do crafting
|
||||
Future<ICraftingJob> jobTask = requests.getJobs()[i];
|
||||
if (jobTask == null) {
|
||||
requests.getJobs()[i] = cg.beginCraftingJob(getWorldObj(), grid, this.source, craftItem, null);
|
||||
} else if (jobTask.isDone()) {
|
||||
try {
|
||||
ICraftingJob job = jobTask.get();
|
||||
if (job != null) {
|
||||
ICraftingLink link = cg.submitJob(job, this, null, false, this.source);
|
||||
didSomething = true;
|
||||
requests.jobs[i] = null;
|
||||
if (link != null) {
|
||||
requests.getLinks()[i] = link;
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
return didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges() {
|
||||
super.saveChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
try {
|
||||
getProxy().getTick().alertDevice(getProxy().getNode());
|
||||
} catch (GridAccessException e) {
|
||||
// NO-OP
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean canDoBusWork() {
|
||||
return this.getProxy().isActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gridChanged() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowered() {
|
||||
return this.isPowered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return this.isPowered;
|
||||
}
|
||||
|
||||
public InventoryRequest getRequestInventory() {
|
||||
return this.requests;
|
||||
}
|
||||
|
||||
public IInventory getInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
public void updateQuantity(int idx, long size) {
|
||||
this.requests.updateQuantity(idx, size);
|
||||
}
|
||||
|
||||
public void updateBatchSize(int idx, long size) {
|
||||
this.requests.updateBatchSize(idx, size);
|
||||
}
|
||||
|
||||
public void setRequestStatus(int idx, boolean enable) {
|
||||
this.requests.setEnable(idx, enable);
|
||||
}
|
||||
|
||||
private void readLinkFromNBT(NBTTagCompound data) {
|
||||
try {
|
||||
for (int i = 0; i < this.requests.getLinks().length; i++) {
|
||||
final NBTTagCompound link = data.getCompoundTag("links-" + i);
|
||||
if (link != null && link.hasNoTags()) {
|
||||
this.requests.getLinks()[i] = null;
|
||||
} else {
|
||||
this.requests.getLinks()[i] = AEApi.instance().storage().loadCraftingLink(link, this);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// :P You don't have job to do XD
|
||||
}
|
||||
}
|
||||
|
||||
private NBTTagCompound writeLinkToNBT(NBTTagCompound data) {
|
||||
for (int i = 0; i < this.requests.getLinks().length; i++) {
|
||||
if (this.requests.getLinks()[i] != null) {
|
||||
CraftingLink link = (CraftingLink) this.requests.getLinks()[i];
|
||||
NBTTagCompound linkData = new NBTTagCompound();
|
||||
link.writeToNBT(linkData);
|
||||
data.setTag("links-" + i, linkData);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
this.requests.requestStacks.writeToNbt(data, "Inventory");
|
||||
this.requests.requestBatches.writeToNbt(data, "Batch");
|
||||
this.requests.requestQtys.writeToNbt(data, "Count");
|
||||
return writeLinkToNBT(data);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
this.requests.requestStacks.readFromNbt(data, "Inventory");
|
||||
this.requests.requestBatches.readFromNbt(data, "Batch");
|
||||
this.requests.requestQtys.readFromNbt(data, "Count");
|
||||
this.readLinkFromNBT(data);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public boolean readFromStream(final ByteBuf data) {
|
||||
final boolean oldPower = this.isPowered;
|
||||
this.isPowered = data.readBoolean();
|
||||
return this.isPowered != oldPower;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStream(final ByteBuf data) {
|
||||
data.writeBoolean(this.isActive());
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(final MENetworkPowerStatusChange p) {
|
||||
this.updatePowerState();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public final void bootingRender(final MENetworkBootingStatusChange c) {
|
||||
this.updatePowerState();
|
||||
}
|
||||
|
||||
private void updatePowerState() {
|
||||
boolean newState = false;
|
||||
|
||||
try {
|
||||
newState = this.getProxy().isActive()
|
||||
&& this.getProxy().getEnergy().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG)
|
||||
> 0.0001;
|
||||
} catch (final GridAccessException ignored) {
|
||||
|
||||
}
|
||||
|
||||
if (newState != this.isPowered) {
|
||||
this.isPowered = newState;
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public static class InventoryRequest {
|
||||
private final AeStackInventoryImpl<IAEItemStack> requestStacks;
|
||||
private final AeStackInventoryImpl<IAEItemStack> requestBatches;
|
||||
private final AeStackInventoryImpl<IAEItemStack> requestQtys;
|
||||
private final Future<ICraftingJob>[] jobs;
|
||||
private final ICraftingLink[] links;
|
||||
|
||||
public InventoryRequest(TileLevelMaintainer tile) {
|
||||
this.requestStacks = new AeStackInventoryImpl<>(StorageChannel.ITEMS, REQ_COUNT, tile);
|
||||
this.requestBatches = new AeStackInventoryImpl<>(StorageChannel.ITEMS, REQ_COUNT, tile);
|
||||
this.requestQtys = new AeStackInventoryImpl<>(StorageChannel.ITEMS, REQ_COUNT, tile);
|
||||
this.jobs = new Future[REQ_COUNT];
|
||||
this.links = new ICraftingLink[REQ_COUNT];
|
||||
}
|
||||
|
||||
public void setEnable(int idx, boolean enable) {
|
||||
IAEItemStack ias = this.getRequestStacks().getStack(idx);
|
||||
IAEItemStack ias1 = this.getRequestBatches().getStack(idx);
|
||||
if (ias != null && ias1 != null) {
|
||||
ItemStack is = ias1.getItemStack();
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("Enable", enable);
|
||||
is.setTagCompound(data);
|
||||
IAEItemStack i = AEItemStack.create(is);
|
||||
i.setStackSize(ias1.getStackSize());
|
||||
this.getRequestBatches().setStack(idx, i);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnable(int idx) {
|
||||
IAEItemStack ias = this.getRequestBatches().getStack(idx);
|
||||
if (ias != null) {
|
||||
ItemStack is = ias.getItemStack();
|
||||
try {
|
||||
return is.getTagCompound().getBoolean("Enable");
|
||||
} catch (NullPointerException e) {
|
||||
// support old version
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDone(int index) {
|
||||
if (this.getLinks()[index] != null) {
|
||||
return this.getLinks()[index].isDone() || this.getLinks()[index].isCanceled();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Future<ICraftingJob>[] getJobs() {
|
||||
return this.jobs;
|
||||
}
|
||||
|
||||
public ICraftingLink[] getLinks() {
|
||||
return links;
|
||||
}
|
||||
|
||||
public AeStackInventory<IAEItemStack> getRequestQtys() {
|
||||
return this.requestQtys;
|
||||
}
|
||||
|
||||
public AeStackInventory<IAEItemStack> getRequestBatches() {
|
||||
return this.requestBatches;
|
||||
}
|
||||
|
||||
public AeStackInventory<IAEItemStack> getRequestStacks() {
|
||||
return this.requestStacks;
|
||||
}
|
||||
|
||||
public void updateQuantity(int idx, long size) {
|
||||
IAEItemStack is = this.getRequestStacks().getStack(idx);
|
||||
if (is != null) {
|
||||
IAEItemStack i = is.copy();
|
||||
i.setStackSize(size);
|
||||
this.getRequestQtys().setStack(idx, i);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateBatchSize(int idx, long size) {
|
||||
IAEItemStack ias = this.getRequestStacks().getStack(idx);
|
||||
if (ias != null) {
|
||||
ItemStack is = ias.copy().getItemStack();
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("Enable", true);
|
||||
is.setTagCompound(data);
|
||||
IAEItemStack i = AEItemStack.create(is);
|
||||
i.setStackSize(size);
|
||||
this.getRequestBatches().setStack(idx, i);
|
||||
}
|
||||
}
|
||||
|
||||
public IAEItemStack getRequestQtyStack(int idx) {
|
||||
IAEItemStack is = this.getRequestStacks().getStack(idx);
|
||||
if (is == null) return null;
|
||||
IAEItemStack qis = this.getRequestQtys().getStack(idx);
|
||||
if (qis == null || !is.isSameType(qis)) return null;
|
||||
return this.getRequestQtys().getStack(idx);
|
||||
}
|
||||
|
||||
public long getQuantity(int idx) {
|
||||
IAEItemStack ias = this.getRequestQtyStack(idx);
|
||||
if (ias == null) {
|
||||
return 0;
|
||||
}
|
||||
return ias.getStackSize();
|
||||
}
|
||||
|
||||
public long getBatchSize(int idx) {
|
||||
if (!this.isEnable(idx)) return 0;
|
||||
IAEItemStack is = this.getRequestStacks().getStack(idx);
|
||||
IAEItemStack is1 = this.getRequestBatches().getStack(idx);
|
||||
if (is != null && is1 != null) {
|
||||
return is1.getStackSize();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public IAEItemStack getCraftItem(int idx) {
|
||||
IAEItemStack is = this.getRequestQtyStack(idx);
|
||||
if (is != null) {
|
||||
IAEItemStack ias = is.copy();
|
||||
ias.setStackSize(this.getBatchSize(idx));
|
||||
return ias;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,9 @@ public class FCClassTransformer implements IClassTransformer {
|
||||
case "appeng.integration.modules.NEI":
|
||||
tform = NEITransfermer.INSTANCE;
|
||||
break;
|
||||
case "appeng.tile.storage.TileIOPort":
|
||||
tform = TitleIOPortTransformer.INSTANCE;
|
||||
break;
|
||||
default:
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -7,10 +7,9 @@ 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.StorageChannel;
|
||||
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;
|
||||
@@ -21,6 +20,7 @@ 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;
|
||||
import com.glodblock.github.common.storage.FluidCellInventory;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.inventory.FluidConvertingInventoryAdaptor;
|
||||
import com.glodblock.github.inventory.FluidConvertingInventoryCrafting;
|
||||
@@ -189,9 +189,18 @@ public class CoreModHooks {
|
||||
|
||||
public static boolean shouldShowTooltip(GuiContainer gui) {
|
||||
if (gui instanceof GuiFluidCraftConfirm) {
|
||||
return ((GuiFluidCraftConfirm)gui).getHoveredStack() == null;
|
||||
return ((GuiFluidCraftConfirm) gui).getHoveredStack() == null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void updateFluidTag(ItemStack whatToSend, ItemStack Result) {
|
||||
if (Result != null && Result.getItem() instanceof ItemFluidPacket) {
|
||||
whatToSend.setTagCompound(Result.getTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
public static long IOPortMinSpeed(long possible, long itemsToMove, final StorageChannel chan) {
|
||||
return chan == StorageChannel.FLUIDS ? Math.min(possible, itemsToMove * FluidCellInventory.singleByteAmount) : Math.min(possible, itemsToMove);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class DualityInterfaceTransformer extends FCClassTransformer.ClassMapper
|
||||
case "pushItemsOut":
|
||||
case "pushPattern":
|
||||
case "isBusy":
|
||||
return new TransformInvAdaptorCalls(api, super.visitMethod(access, name, desc, signature, exceptions));
|
||||
return new TransformInvAdaptorCalls(api, super.visitMethod(access, name, desc, signature, exceptions), name);
|
||||
default:
|
||||
return super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
@@ -39,9 +39,24 @@ public class DualityInterfaceTransformer extends FCClassTransformer.ClassMapper
|
||||
}
|
||||
|
||||
private static class TransformInvAdaptorCalls extends MethodVisitor {
|
||||
private final String name;
|
||||
private int const_1 = 0;
|
||||
|
||||
TransformInvAdaptorCalls(int api, MethodVisitor mv) {
|
||||
private TransformInvAdaptorCalls(int api, MethodVisitor mv, String name) {
|
||||
super(api, mv);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
|
||||
super.visitFieldInsn(opcode, owner, name, desc);
|
||||
if (this.name.equals("pushItemsOut") && opcode == Opcodes.PUTFIELD && const_1 == 0) {
|
||||
// update fluid tag
|
||||
super.visitVarInsn(Opcodes.ALOAD, 5);
|
||||
super.visitVarInsn(Opcodes.ALOAD, 10);
|
||||
super.visitMethodInsn(Opcodes.INVOKESTATIC, "com/glodblock/github/coremod/hooker/CoreModHooks", "updateFluidTag", "(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)V", false);
|
||||
const_1++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
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 TitleIOPortTransformer extends FCClassTransformer.ClassMapper {
|
||||
public static final TitleIOPortTransformer INSTANCE = new TitleIOPortTransformer();
|
||||
|
||||
private TitleIOPortTransformer() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
return new TitleIOPortTransformer.TransformTitleIOPort(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
private static class TransformTitleIOPort extends ClassVisitor {
|
||||
|
||||
TransformTitleIOPort(int api, ClassVisitor cv) {
|
||||
super(api, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
if (name.equals("transferContents")) {
|
||||
return new TitleIOPortTransformer.TransformTransferContents(api, super.visitMethod(access, name, desc, signature, exceptions));
|
||||
}
|
||||
return super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TransformTransferContents extends MethodVisitor {
|
||||
|
||||
TransformTransferContents(int api, MethodVisitor mv) {
|
||||
super(api, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
if (opcode == Opcodes.INVOKESTATIC && owner.equals("java/lang/Math") && name.equals("min")) {
|
||||
super.visitVarInsn(Opcodes.ALOAD, 6);
|
||||
super.visitMethodInsn(Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"IOPortMinSpeed",
|
||||
"(JJLappeng/api/storage/StorageChannel;)J",
|
||||
false);
|
||||
} else {
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.glodblock.github.crossmod.opencomputers;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
import li.cil.oc.api.driver.EnvironmentProvider;
|
||||
import li.cil.oc.api.driver.NamedBlock;
|
||||
import li.cil.oc.api.driver.SidedBlock;
|
||||
import li.cil.oc.api.internal.Database;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.ManagedEnvironment;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.integration.ManagedTileEntityEnvironment;
|
||||
import li.cil.oc.server.network.Component;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class DriverDualFluidInterface implements SidedBlock {
|
||||
|
||||
@Override
|
||||
public boolean worksWith(World world, int x, int y, int z, ForgeDirection side) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
return isDualFluidInterface(te, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(World world, int x, int y, int z, ForgeDirection side) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
return new DriverDualFluidInterface.Environment(getInterface(te, side));
|
||||
}
|
||||
|
||||
public static class Environment extends ManagedTileEntityEnvironment<DualityFluidInterface> implements NamedBlock {
|
||||
|
||||
public Environment(DualityFluidInterface tileEntity) {
|
||||
super(tileEntity, NameConst.BLOCK_FLUID_INTERFACE);
|
||||
}
|
||||
|
||||
@Callback(doc = "function(index:number):table -- Get the configuration of the dual fluid interface on the specified slot.")
|
||||
public Object[] getFluidInterfaceConfiguration(Context context, Arguments args) {
|
||||
int index = args.checkInteger(0);
|
||||
if (index >= 0 && index < DualityFluidInterface.NUMBER_OF_TANKS) {
|
||||
FluidStack fluid = tileEntity.getConfig().getFluidStackInSlot(index);
|
||||
return new Object[] {fluid == null ? null : new FluidStack(fluid.getFluid(), 1000)};
|
||||
}
|
||||
throw new IllegalArgumentException("invalid slot");
|
||||
}
|
||||
|
||||
@Callback(doc = "function(index:number[, database:address, entry:number]):boolean -- Configure the filter in fluid interface on the specified slot.")
|
||||
public Object[] setFluidInterfaceConfiguration(Context context, Arguments args) {
|
||||
int index = args.checkInteger(0);
|
||||
String address;
|
||||
int entry;
|
||||
if (args.count() == 3){
|
||||
address = args.checkString(1);
|
||||
entry = args.checkInteger(2);
|
||||
} else {
|
||||
tileEntity.getConfig().setFluidInSlot(index, null);
|
||||
context.pause(0.5);
|
||||
return new Object[] {true};
|
||||
}
|
||||
Node node = node().network().node(address);
|
||||
if (!(node instanceof Component))
|
||||
throw new IllegalArgumentException("no such component");
|
||||
if (!(node.host() instanceof Database))
|
||||
throw new IllegalArgumentException("not a database");
|
||||
Database database = (Database) node.host();
|
||||
if (index >= 0 && index < DualityFluidInterface.NUMBER_OF_TANKS) {
|
||||
ItemStack data = database.getStackInSlot(entry - 1);
|
||||
if (data == null) {
|
||||
tileEntity.getConfig().setFluidInSlot(index, null);
|
||||
}
|
||||
else {
|
||||
FluidStack fluid = Util.getFluidFromItem(data);
|
||||
tileEntity.getConfig().setFluidInSlot(index, tileEntity.getStandardFluid(fluid));
|
||||
}
|
||||
context.pause(0.5);
|
||||
return new Object[] {true};
|
||||
}
|
||||
throw new IllegalArgumentException("invalid slot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String preferredName() {
|
||||
return NameConst.BLOCK_FLUID_INTERFACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int priority() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isDualFluidInterface(TileEntity te, ForgeDirection face) {
|
||||
if (te != null) {
|
||||
if (te instanceof TileFluidInterface) {
|
||||
return true;
|
||||
}
|
||||
if (te instanceof IPartHost) {
|
||||
return ((IPartHost) te).getPart(face) instanceof PartFluidInterface;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static DualityFluidInterface getInterface(TileEntity te, ForgeDirection face) {
|
||||
if (te != null) {
|
||||
if (te instanceof TileFluidInterface) {
|
||||
return ((TileFluidInterface) te).getDualityFluid();
|
||||
}
|
||||
if (te instanceof IPartHost && ((IPartHost) te).getPart(face) instanceof PartFluidInterface) {
|
||||
return ((PartFluidInterface) ((IPartHost) te).getPart(face)).getDualityFluid();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Provider implements EnvironmentProvider {
|
||||
Provider() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getEnvironment(ItemStack itemStack) {
|
||||
if (itemStack != null && (itemStack.isItemEqual(ItemAndBlockHolder.FLUID_INTERFACE.stack())
|
||||
|| itemStack.isItemEqual(ItemAndBlockHolder.INTERFACE.stack()))) {
|
||||
return DriverDualFluidInterface.Environment.class;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package com.glodblock.github.crossmod.opencomputers;
|
||||
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import li.cil.oc.api.driver.EnvironmentProvider;
|
||||
import li.cil.oc.api.driver.NamedBlock;
|
||||
import li.cil.oc.api.internal.Database;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.Component;
|
||||
import li.cil.oc.api.network.ManagedEnvironment;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.prefab.DriverSidedTileEntity;
|
||||
import li.cil.oc.integration.ManagedTileEntityEnvironment;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
return TileLevelMaintainer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(World world, int x, int y, int z, ForgeDirection forgeDirection) {
|
||||
return new DriverLevelMaintainer.Environment((TileLevelMaintainer) world.getTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
public static class Environment extends ManagedTileEntityEnvironment<TileLevelMaintainer>
|
||||
implements NamedBlock {
|
||||
|
||||
public Environment(TileLevelMaintainer tileEntity) {
|
||||
super(tileEntity, NameConst.BLOCK_LEVEL_MAINTAINER);
|
||||
}
|
||||
|
||||
private int getSlot(Arguments args, IInventory inv, int index, int def) {
|
||||
if (index >= 0 && index < args.count()) {
|
||||
int slot = args.checkInteger(index) - 1;
|
||||
if (slot < 0 || slot >= inv.getSizeInventory()) {
|
||||
throw new IllegalArgumentException("Invalid slot");
|
||||
}
|
||||
return slot;
|
||||
} else {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDone(Arguments args) {
|
||||
int slot = args.checkInteger(0) - 1;
|
||||
if (slot < 0 || slot >= TileLevelMaintainer.REQ_COUNT) {
|
||||
throw new IllegalArgumentException("Invalid slot");
|
||||
}
|
||||
return tileEntity.requests.isDone(slot);
|
||||
}
|
||||
|
||||
private boolean isEnable(Arguments args) {
|
||||
int slot = args.checkInteger(0) - 1;
|
||||
if (slot < 0 || slot >= TileLevelMaintainer.REQ_COUNT) {
|
||||
throw new IllegalArgumentException("Invalid slot");
|
||||
}
|
||||
return tileEntity.requests.isEnable(slot);
|
||||
}
|
||||
|
||||
private boolean setEnable(Arguments args) {
|
||||
if (args.count() != 2) {
|
||||
throw new IllegalArgumentException("Invalid args!");
|
||||
} else {
|
||||
int slot = args.checkInteger(0) - 1;
|
||||
if (slot < 0 || slot >= TileLevelMaintainer.REQ_COUNT) {
|
||||
throw new IllegalArgumentException("Invalid slot");
|
||||
}
|
||||
boolean enable = args.checkBoolean(1);
|
||||
tileEntity.requests.setEnable(slot, enable);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateOrder(int slot, int quantity, int batch) {
|
||||
tileEntity.updateQuantity(slot, quantity);
|
||||
tileEntity.updateBatchSize(slot, batch);
|
||||
}
|
||||
|
||||
@Callback(doc = "function([slot:number]):table -- Get the slot status.")
|
||||
public Object[] getSlot(Context context, Arguments args) {
|
||||
IInventory config = tileEntity.getInventory();
|
||||
int slot = getSlot(args, config, 0, 0);
|
||||
ItemStack stack = config.getStackInSlot(slot);
|
||||
if (stack != null) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("damage", stack.getItemDamage());
|
||||
result.put("hasTag", stack.hasTagCompound());
|
||||
result.put("label", stack.getDisplayName());
|
||||
result.put("maxDamage", stack.getMaxDamage());
|
||||
result.put("name", GameRegistry.findUniqueIdentifierFor(stack.getItem()).toString());
|
||||
result.put("quantity", tileEntity.requests.getQuantity(slot));
|
||||
result.put("batch", tileEntity.requests.getBatchSize(slot));
|
||||
result.put("isFluid", ItemFluidDrop.isFluidStack(stack));
|
||||
if (ItemFluidDrop.isFluidStack(stack)) result.put("fluid", ItemFluidDrop.getFluidStack(stack));
|
||||
result.put("isEnable", tileEntity.requests.isEnable(slot));
|
||||
result.put("isDone", tileEntity.requests.isDone(slot));
|
||||
return new Object[]{result};
|
||||
}
|
||||
return new Object[]{null};
|
||||
}
|
||||
|
||||
private void setSlot(int slot, String address, int index) {
|
||||
Node node = node().network().node(address);
|
||||
if (node instanceof Component) {
|
||||
if (node.host() instanceof Database) {
|
||||
ItemStack dbStack = ((Database) node.host()).getStackInSlot(index);
|
||||
if (dbStack == null) {
|
||||
throw new IllegalArgumentException("Invalid slot");
|
||||
}
|
||||
dbStack.stackSize = 1;
|
||||
((AeItemStackHandler) tileEntity.getInventory()).getAeInventory().setStack(slot, AEItemStack.create(dbStack));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Not a database");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("No such component");
|
||||
}
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number[,database:address[,index:number]],quantity:number,batch:number):boolean -- Configuration the slot.")
|
||||
public Object[] setSlot(Context context, Arguments args) {
|
||||
int slot;
|
||||
String address;
|
||||
int index;
|
||||
int quantity;
|
||||
int batch;
|
||||
slot = args.checkInteger(0) - 1;
|
||||
|
||||
if (slot < 0 || slot >= TileLevelMaintainer.REQ_COUNT) {
|
||||
throw new IllegalArgumentException("Invalid slot");
|
||||
}
|
||||
if (args.count() == 5) {
|
||||
address = args.checkString(1);
|
||||
index = args.checkInteger(2) - 1;
|
||||
quantity = args.checkInteger(3);
|
||||
batch = args.checkInteger(4);
|
||||
setSlot(slot, address, index);
|
||||
updateOrder(slot, quantity, batch);
|
||||
} else if (args.count() == 3) {
|
||||
quantity = args.checkInteger(1);
|
||||
batch = args.checkInteger(2);
|
||||
updateOrder(slot, quantity, batch);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid args");
|
||||
}
|
||||
return new Object[]{true};
|
||||
}
|
||||
|
||||
private boolean isActive() {
|
||||
return tileEntity.isActive();
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number):boolean -- Get the crafting task state.")
|
||||
public Object[] isDone(Context context, Arguments args) {
|
||||
return new Object[]{this.isDone(args)};
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number):boolean -- Get the crafting state of slot.")
|
||||
public Object[] isEnable(Context context, Arguments args) {
|
||||
return new Object[]{this.isEnable(args)};
|
||||
}
|
||||
|
||||
@Callback(doc = "function(slot:number,value:boolean):boolean -- Set the crafting state of slot.")
|
||||
public Object[] setEnable(Context context, Arguments args) {
|
||||
return new Object[]{this.setEnable(args)};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean Get Level Maintainer state")
|
||||
public Object[] active(Context context, Arguments args) {
|
||||
return new Object[]{this.isActive()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String preferredName() {
|
||||
return NameConst.BLOCK_LEVEL_MAINTAINER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int priority() {
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Provider implements EnvironmentProvider {
|
||||
Provider() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getEnvironment(ItemStack itemStack) {
|
||||
if (itemStack != null && itemStack.isItemEqual(ItemAndBlockHolder.LEVEL_MAINTAINER.stack())) {
|
||||
return DriverLevelMaintainer.Environment.class;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,10 @@ public class OCDriverInit {
|
||||
public static void run() {
|
||||
Driver.add(new DriverOCPatternEditor());
|
||||
Driver.add(new DriverOCPatternEditor.Provider());
|
||||
Driver.add(new DriverLevelMaintainer());
|
||||
Driver.add(new DriverLevelMaintainer.Provider());
|
||||
Driver.add(new DriverDualFluidInterface());
|
||||
Driver.add(new DriverDualFluidInterface.Provider());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.util.Util;
|
||||
import mcp.mobius.waila.handlers.nei.TooltipHandlerWaila;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FCTooltipHandlerWaila extends TooltipHandlerWaila {
|
||||
@Override
|
||||
public List<String> handleItemDisplayName(GuiContainer arg0, ItemStack itemstack, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer arg0, ItemStack itemstack, int arg2, int arg3, List<String> currenttip) {
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemFluidDrop && currenttip.size() > 0) {
|
||||
FluidStack fs = ItemFluidDrop.getFluidStack(itemstack);
|
||||
if (fs == null) return currenttip;
|
||||
currenttip.set(0, Tooltip.partFluidTerminalFluidFormat(fs));
|
||||
if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips) {
|
||||
currenttip.set(1, EnumChatFormatting.GRAY + String.format("%s:%s", Util.getFluidModID(fs.getFluid()), fs.getFluid().getName()) + EnumChatFormatting.RESET);
|
||||
}
|
||||
String modName = Util.getFluidModName(fs.getFluid());
|
||||
if (modName != null && !modName.equals(""))
|
||||
currenttip.set(currenttip.size() - 1, "\u00a79\u00a7o" + modName);
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer arg0, int arg1, int arg2, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.IPartWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.PartAccessor;
|
||||
import appeng.integration.modules.waila.part.Tracer;
|
||||
import com.glodblock.github.crossmod.waila.part.FluidInvWailaDataProvider;
|
||||
import com.glodblock.github.crossmod.waila.part.SpeedWailaDataProvider;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.Lists;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PartWailaDataProvider implements IWailaDataProvider {
|
||||
private final List<IPartWailaDataProvider> providers;
|
||||
private final PartAccessor accessor = new PartAccessor();
|
||||
private final Tracer tracer = new Tracer();
|
||||
|
||||
public PartWailaDataProvider() {
|
||||
final IPartWailaDataProvider speed = new SpeedWailaDataProvider();
|
||||
final IPartWailaDataProvider fluidInv = new FluidInvWailaDataProvider();
|
||||
this.providers = Lists.newArrayList(speed, fluidInv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final MovingObjectPosition mop = accessor.getPosition();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart(te, mop);
|
||||
|
||||
if (maybePart.isPresent()) {
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
ItemStack wailaStack = null;
|
||||
|
||||
for (final IPartWailaDataProvider provider : this.providers) {
|
||||
wailaStack = provider.getWailaStack(part, config, wailaStack);
|
||||
if (wailaStack != null) break;
|
||||
}
|
||||
return wailaStack;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final MovingObjectPosition mop = accessor.getPosition();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart(te, mop);
|
||||
|
||||
if (maybePart.isPresent()) {
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for (final IPartWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaHead(part, currentToolTip, accessor, config);
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final MovingObjectPosition mop = accessor.getPosition();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart(te, mop);
|
||||
|
||||
if (maybePart.isPresent()) {
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for (final IPartWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaBody(part, currentToolTip, accessor, config);
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final MovingObjectPosition mop = accessor.getPosition();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart(te, mop);
|
||||
|
||||
if (maybePart.isPresent()) {
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for (final IPartWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaTail(part, currentToolTip, accessor, config);
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
final MovingObjectPosition mop = this.tracer.retraceBlock(world, player, x, y, z);
|
||||
|
||||
if (mop != null) {
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart(te, mop);
|
||||
|
||||
if (maybePart.isPresent()) {
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for (final IPartWailaDataProvider provider : this.providers) {
|
||||
provider.getNBTData(player, part, te, tag, world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import com.glodblock.github.crossmod.waila.tile.FluidInvWailaDataProvider;
|
||||
import com.glodblock.github.crossmod.waila.tile.LevelMaintainerWailaDataProvide;
|
||||
import com.google.common.collect.Lists;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileWailaDataProvider implements IWailaDataProvider {
|
||||
private final List<IWailaDataProvider> providers;
|
||||
|
||||
public TileWailaDataProvider() {
|
||||
final IWailaDataProvider fluidInv = new FluidInvWailaDataProvider();
|
||||
final IWailaDataProvider levelMaintainer = new LevelMaintainerWailaDataProvide();
|
||||
this.providers = Lists.newArrayList(fluidInv, levelMaintainer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaHead(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaBody(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getWailaTail(itemStack, currentToolTip, accessor, config);
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
for (final IWailaDataProvider provider : this.providers) {
|
||||
provider.getNBTData(player, te, tag, world, x, y, z);
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import appeng.util.Utility;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class Tooltip {
|
||||
public static String fluidFormat(String name, int amount) {
|
||||
return String.format("%s: %s mB", name, Utility.formatNumbers(amount));
|
||||
}
|
||||
|
||||
public static String partFluidBusFormat(int amount) {
|
||||
return String.format("%s: %s mB/t", I18n.format(NameConst.WAILA_SPEED), Utility.formatNumbers(amount / 5));
|
||||
}
|
||||
|
||||
public static String tileFluidInterfaceFormat(String name, int amount, int face) {
|
||||
return String.format("%s %s: %s mB", I18n.format(NameConst.GUI_FLUID_INTERFACE + "." + face), name, Utility.formatNumbers(amount));
|
||||
}
|
||||
|
||||
public static String tileLevelMaintainerFormat(String name, long quantity, long batch, boolean isEnable) {
|
||||
return String.format("%s: %s / %s %s",
|
||||
name, Utility.formatNumbers(quantity), Utility.formatNumbers(batch),
|
||||
isEnable ? I18n.format(NameConst.WAILA_ENABLE) : I18n.format(NameConst.WAILA_DISABLE)
|
||||
);
|
||||
}
|
||||
|
||||
public static String partFluidTerminalFluidFormat(FluidStack fs) {
|
||||
int fid = Util.getFluidID(fs.getFluid());
|
||||
if (fid == -1) {
|
||||
return fs.getFluid().getLocalizedName();
|
||||
} else if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips) {
|
||||
return String.format("%s (#%s) %s", fs.getFluid().getLocalizedName(), fid, fid);
|
||||
} else {
|
||||
return String.format("%s %s", fs.getFluid().getLocalizedName(), fid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.glodblock.github.crossmod.waila;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
|
||||
public class WailaInit {
|
||||
|
||||
public static void run() {
|
||||
FMLInterModComms.sendMessage("Waila", "register", WailaInit.class.getName() + ".register");
|
||||
}
|
||||
|
||||
public static void register(final IWailaRegistrar registrar) {
|
||||
final IWailaDataProvider part = new PartWailaDataProvider();
|
||||
registrar.registerBodyProvider(part, IPartHost.class);
|
||||
registrar.registerNBTProvider(part, IPartHost.class);
|
||||
GuiContainerManager.addTooltipHandler(new FCTooltipHandlerWaila());
|
||||
|
||||
final IWailaDataProvider tile = new TileWailaDataProvider();
|
||||
registrar.registerBodyProvider(tile, AEBaseTile.class);
|
||||
registrar.registerNBTProvider(tile, AEBaseTile.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.glodblock.github.crossmod.waila.part;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.BasePartWailaDataProvider;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FluidInvWailaDataProvider extends BasePartWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final IPart part,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
if (part instanceof IAEFluidInventory) {
|
||||
((IAEFluidInventory) part).getInternalFluid().readFromNBT(accessor.getNBTData(), "fluidInv");
|
||||
AEFluidInventory fluidInventory = ((IAEFluidInventory) part).getInternalFluid();
|
||||
for (int i = 0; i < fluidInventory.getSlots(); i++) {
|
||||
FluidStack fs = fluidInventory.getFluidStackInSlot(i);
|
||||
if (fs == null) continue;
|
||||
currentToolTip.add(Tooltip.fluidFormat(fs.getFluid().getLocalizedName(), fs.amount));
|
||||
}
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final IPart part,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
if (part instanceof IAEFluidInventory) {
|
||||
((IAEFluidInventory) part).getInternalFluid().writeToNBT(tag, "fluidInv");
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.glodblock.github.crossmod.waila.part;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.BasePartWailaDataProvider;
|
||||
import com.glodblock.github.common.parts.PartSharedFluidBus;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SpeedWailaDataProvider extends BasePartWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final IPart part,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
if (part instanceof PartSharedFluidBus) {
|
||||
part.readFromNBT(accessor.getNBTData());
|
||||
currentToolTip.add(Tooltip.partFluidBusFormat(((PartSharedFluidBus) part).calculateAmountToSend()));
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final IPart part,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
if (part instanceof PartSharedFluidBus) {
|
||||
part.writeToNBT(tag);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.glodblock.github.crossmod.waila.tile;
|
||||
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FluidInvWailaDataProvider extends BaseWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if (te instanceof TileFluidInterface) {
|
||||
((IAEFluidInventory) te).getInternalFluid().readFromNBT(accessor.getNBTData(), "fluidInv");
|
||||
addTooltip(currentToolTip, ((IAEFluidInventory) te).getInternalFluid(), true);
|
||||
} else if (te instanceof IAEFluidInventory) {
|
||||
((IAEFluidInventory) te).getInternalFluid().readFromNBT(accessor.getNBTData(), "fluidInv");
|
||||
addTooltip(currentToolTip, ((IAEFluidInventory) te).getInternalFluid());
|
||||
} else if (te instanceof TileFluidPacketDecoder) {
|
||||
te.readFromNBT(accessor.getNBTData());
|
||||
IInventory inv = ((TileFluidPacketDecoder) te).getInventory();
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack is = inv.getStackInSlot(i);
|
||||
if (is != null && is.getItem() instanceof ItemFluidPacket) {
|
||||
FluidStack fs = ItemFluidPacket.getFluidStack(is);
|
||||
currentToolTip.add(Tooltip.fluidFormat(fs.getFluid().getLocalizedName(), fs.amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
private void addTooltip(List<String> currentToolTip, IAEFluidTank ft, boolean prefix) {
|
||||
for (int i = 0; i < ft.getSlots(); i++) {
|
||||
if (ft.getFluidInSlot(i) == null) continue;
|
||||
FluidStack fs = ft.getFluidInSlot(i).getFluidStack();
|
||||
if (prefix) {
|
||||
currentToolTip.add(Tooltip.tileFluidInterfaceFormat(fs.getFluid().getLocalizedName(), fs.amount, i));
|
||||
} else {
|
||||
currentToolTip.add(Tooltip.fluidFormat(fs.getFluid().getLocalizedName(), fs.amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addTooltip(List<String> currentToolTip, IAEFluidTank ft) {
|
||||
this.addTooltip(currentToolTip, ft, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
if (te instanceof IAEFluidInventory) {
|
||||
((IAEFluidInventory) te).getInternalFluid().writeToNBT(tag, "fluidInv");
|
||||
} else if (te instanceof TileFluidPacketDecoder) {
|
||||
te.writeToNBT(tag);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.glodblock.github.crossmod.waila.tile;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LevelMaintainerWailaDataProvide extends BaseWailaDataProvider {
|
||||
@Override
|
||||
public List<String> getWailaBody(
|
||||
final ItemStack itemStack,
|
||||
final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor,
|
||||
final IWailaConfigHandler config) {
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if (te instanceof TileLevelMaintainer) {
|
||||
te.readFromNBT(accessor.getNBTData());
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
IAEItemStack ias = ((TileLevelMaintainer) te).requests.getRequestStacks().getStack(i);
|
||||
if (ias != null) {
|
||||
currentToolTip.add(Tooltip.tileLevelMaintainerFormat(
|
||||
ias.getItemStack().getDisplayName(),
|
||||
((TileLevelMaintainer) te).requests.getQuantity(i),
|
||||
((TileLevelMaintainer) te).requests.getBatchSize(i),
|
||||
((TileLevelMaintainer) te).requests.isEnable(i)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(
|
||||
final EntityPlayerMP player,
|
||||
final TileEntity te,
|
||||
final NBTTagCompound tag,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z) {
|
||||
if (te instanceof TileLevelMaintainer) {
|
||||
te.writeToNBT(tag);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,8 @@ public class AEFluidInventory implements IAEFluidTank
|
||||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
this.fluids[x] = null;
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.glodblock.github.inventory;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.InsertionMode;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.p2p.PartP2PLiquids;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
@@ -29,6 +31,8 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
|
||||
@@ -78,7 +82,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
fluid = ItemFluidDrop.getFluidStack(toBeAdded);
|
||||
}
|
||||
|
||||
if (fluid != null) {
|
||||
if (fluid != null && invFluids.canFill(side, fluid.getFluid())) {
|
||||
int filled = invFluids.fill(side, fluid, true);
|
||||
if (filled > 0) {
|
||||
fluid.amount -= filled;
|
||||
@@ -179,12 +183,52 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|
||||
|
||||
@Override
|
||||
public boolean containsItems() {
|
||||
if (invFluids != null && invFluids.getTankInfo(side) != null) {
|
||||
for (FluidTankInfo tank : invFluids.getTankInfo(side)) {
|
||||
FluidStack fluid = tank.fluid;
|
||||
if (fluid != null && fluid.amount > 0) {
|
||||
return true;
|
||||
if (invFluids == null && invItems == null) {
|
||||
// If this entity doesn't have fluid or item inventory, we just view it as full of things.
|
||||
return true;
|
||||
}
|
||||
if (invFluids != null && invFluids.getTankInfo(this.side) != null) {
|
||||
List<FluidTankInfo[]> tankInfos = new LinkedList<>();
|
||||
if (invFluids instanceof TileCableBus && ((TileCableBus) invFluids).getPart(this.side) instanceof PartP2PLiquids) {
|
||||
// read other ends of p2p for blocking mode
|
||||
PartP2PLiquids invFluidsP2P = (PartP2PLiquids) ((TileCableBus) invFluids).getPart(this.side);
|
||||
try {
|
||||
Iterator<PartP2PLiquids> it = invFluidsP2P.getOutputs().iterator();
|
||||
boolean checkedInput = false;
|
||||
while (it.hasNext() || !checkedInput) {
|
||||
PartP2PLiquids p2p;
|
||||
if (it.hasNext()) {
|
||||
p2p = it.next();
|
||||
} else {
|
||||
p2p = invFluidsP2P.getInput();
|
||||
checkedInput = true;
|
||||
}
|
||||
if (p2p == invFluidsP2P || p2p == null)
|
||||
continue;
|
||||
IFluidHandler target = Ae2Reflect.getP2PLiquidTarget(p2p);
|
||||
if (target == null)
|
||||
continue;
|
||||
tankInfos.add(target.getTankInfo(p2p.getSide().getOpposite()));
|
||||
}
|
||||
} catch (GridAccessException e) {
|
||||
// ignore
|
||||
}
|
||||
} else {
|
||||
tankInfos.add(invFluids.getTankInfo(this.side));
|
||||
}
|
||||
boolean hasTank = false;
|
||||
for (FluidTankInfo[] tankInfoArray : tankInfos) {
|
||||
for (FluidTankInfo tank : tankInfoArray) {
|
||||
hasTank = true;
|
||||
FluidStack fluid = tank.fluid;
|
||||
if (fluid != null && fluid.amount > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasTank && invItems == null) {
|
||||
// If this entity doesn't have fluid or item inventory, we just view it as full of things.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return invItems != null && invItems.containsItems();
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IAEFluidInventory
|
||||
{
|
||||
void onFluidInventoryChanged( final IAEFluidTank inv, final int slot );
|
||||
void onFluidInventoryChanged(final IAEFluidTank inv, final int slot);
|
||||
|
||||
AEFluidInventory getInternalFluid();
|
||||
}
|
||||
@@ -19,7 +19,17 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public enum GuiType {
|
||||
LEVEL_MAINTAINER(new TileGuiFactory<TileLevelMaintainer>(TileLevelMaintainer.class) {
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileLevelMaintainer inv) {
|
||||
return new ContainerLevelMaintainer(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createClientGui(EntityPlayer player, TileLevelMaintainer inv) {
|
||||
return new GuiLevelMaintainer(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
OC_PATTERN_EDITOR(new TileGuiFactory<TileOCPatternEditor>(TileOCPatternEditor.class) {
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileOCPatternEditor inv) {
|
||||
@@ -152,6 +162,18 @@ public enum GuiType {
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_TERMINAL(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new ContainerFluidTerminal(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
|
||||
return new GuiFluidTerminal(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
|
||||
FLUID_PATTERN_TERMINAL(new PartGuiFactory<ITerminalHost>(ITerminalHost.class) {
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.glodblock.github.inventory.slot;
|
||||
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FCSlotRestrictedInput extends SlotRestrictedInput {
|
||||
private ItemStack valid;
|
||||
|
||||
public FCSlotRestrictedInput(ItemStack valid, IInventory i, int slotIndex, int x, int y, InventoryPlayer p) {
|
||||
super(PlacableItemType.INSCRIBER_PLATE, i, slotIndex, x, y, p);
|
||||
this.valid = valid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(final ItemStack i) {
|
||||
if (i.getItem().getClass().isAssignableFrom(valid.getItem().getClass())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ 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);
|
||||
FluidCraft.proxy.netHandler.registerMessage(new CPacketPatternValueSet.Handler(), CPacketPatternValueSet.class, id++, Side.SERVER);
|
||||
FluidCraft.proxy.netHandler.registerMessage(new CPacketFluidUpdate.Handler(), CPacketFluidUpdate.class, id++, Side.SERVER);
|
||||
FluidCraft.proxy.netHandler.registerMessage(new CPacketLevelMaintainer.Handler(), CPacketLevelMaintainer.class, id++, Side.SERVER);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.glodblock.github.common.storage.CellType;
|
||||
public class ItemAndBlockHolder {
|
||||
|
||||
public static BlockFluidDiscretizer DISCRETIZER = new BlockFluidDiscretizer().register();
|
||||
public static BlockLevelMaintainer LEVEL_MAINTAINER = new BlockLevelMaintainer().register();
|
||||
public static BlockFluidPatternEncoder ENCODER = new BlockFluidPatternEncoder().register();
|
||||
public static BlockFluidPacketDecoder DECODER = new BlockFluidPacketDecoder().register();
|
||||
public static BlockFluidInterface INTERFACE = new BlockFluidInterface().register();
|
||||
@@ -17,6 +18,7 @@ public class ItemAndBlockHolder {
|
||||
|
||||
public static ItemFluidDrop DROP = new ItemFluidDrop().register();
|
||||
public static ItemFluidEncodedPattern PATTERN = new ItemFluidEncodedPattern().register();
|
||||
public static ItemPartFluidTerminal FLUID_TERM = new ItemPartFluidTerminal().register();
|
||||
public static ItemPartFluidPatternTerminal FLUID_TERMINAL = new ItemPartFluidPatternTerminal().register();
|
||||
public static ItemPartFluidPatternTerminalEx FLUID_TERMINAL_EX = new ItemPartFluidPatternTerminalEx().register();
|
||||
public static ItemPartFluidInterface FLUID_INTERFACE = new ItemPartFluidInterface().register();
|
||||
|
||||
@@ -34,6 +34,9 @@ public class RecipeLoader implements Runnable {
|
||||
public final static ItemStack AE2_CORE_FOM = new ItemStack(GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"), 1, 43);
|
||||
public final static ItemStack PISTON = new ItemStack(Blocks.piston, 1);
|
||||
public final static ItemStack AE2_BLANK_PATTERN = new ItemStack(GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"), 1, 52);
|
||||
public final static ItemStack AE2_TERMINAL = new ItemStack(GameRegistry.findItem("appliedenergistics2", "item.ItemMultiPart"), 1, 380);
|
||||
public final static ItemStack AE2_CRAFTING_CP_UNIT = new ItemStack(GameRegistry.findItem("appliedenergistics2", "tile.BlockCraftingUnit"), 1, 1);
|
||||
public final static ItemStack AE2_PATTERN_CAPACITY_CARD = new ItemStack(GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"), 1, 54);
|
||||
public final static ItemStack BUCKET = new ItemStack(Items.bucket, 1);
|
||||
public final static ItemStack IRON_BAR = new ItemStack(Blocks.iron_bars, 1);
|
||||
|
||||
@@ -49,7 +52,9 @@ public class RecipeLoader implements Runnable {
|
||||
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());
|
||||
GameRegistry.addShapelessRecipe(AE2_BLANK_PATTERN, PATTERN.stack());
|
||||
GameRegistry.addShapelessRecipe(FLUID_TERM.stack(), AE2_TERMINAL, BUFFER);
|
||||
GameRegistry.addShapelessRecipe(LEVEL_MAINTAINER.stack(), AE2_CRAFTING_CP_UNIT, ENCODER, AE2_PATTERN_CAPACITY_CARD);
|
||||
if (Config.fluidCells) {
|
||||
OreDictionary.registerOre("anyCertusCrystal", AE2_PURE_CERTUS);
|
||||
for (ItemStack it : OreDictionary.getOres("crystalCertusQuartz"))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.glodblock.github.nei;
|
||||
|
||||
import codechicken.nei.api.INEIGuiAdapter;
|
||||
import com.glodblock.github.client.gui.GuiFCBaseFluidMonitor;
|
||||
import com.glodblock.github.client.gui.GuiFCBaseMonitor;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
@@ -10,6 +11,8 @@ public class NEIGuiHandler extends INEIGuiAdapter {
|
||||
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);
|
||||
} else if (gui instanceof GuiFCBaseFluidMonitor) {
|
||||
return ((GuiFCBaseFluidMonitor) gui).hideItemPanelSlot(x, y, w, h);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -95,6 +95,9 @@ public class CPacketFluidPatternTermBtns implements IMessage {
|
||||
case "PatternTerminal.Combine":
|
||||
cpt.getPatternTerminal().setCombineMode(Value.equals("1"));
|
||||
break;
|
||||
case "PatternTerminal.beSubstitute":
|
||||
cpt.getPatternTerminal().setBeSubstitute(Value.equals("1"));
|
||||
break;
|
||||
}
|
||||
} else if( Name.startsWith( "PatternTerminalEx." ) && (c instanceof ContainerFluidPatternTerminalEx))
|
||||
{
|
||||
@@ -134,6 +137,9 @@ public class CPacketFluidPatternTermBtns implements IMessage {
|
||||
case "PatternTerminalEx.Prioritize":
|
||||
cpt.getPatternTerminal().setPrioritization(Value.equals("1"));
|
||||
break;
|
||||
case "PatternTerminalEx.beSubstitute":
|
||||
cpt.getPatternTerminal().setBeSubstitute(Value.equals("1"));
|
||||
break;
|
||||
}
|
||||
} else if(Name.equals( "Terminal.Cpu" ) && c instanceof ContainerFluidCraftConfirm) {
|
||||
final ContainerFluidCraftConfirm qk = (ContainerFluidCraftConfirm) c;
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.glodblock.github.network;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.client.gui.container.FCBaseFluidMonitorContain;
|
||||
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.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CPacketFluidUpdate implements IMessage {
|
||||
|
||||
private Map<Integer, IAEFluidStack> list;
|
||||
private ItemStack itemStack;
|
||||
private int slotIndex;
|
||||
|
||||
public CPacketFluidUpdate() {
|
||||
}
|
||||
|
||||
public CPacketFluidUpdate(Map<Integer, IAEFluidStack> data, ItemStack itemStack) {
|
||||
this.list = data;
|
||||
this.itemStack = itemStack;
|
||||
this.slotIndex = -1;
|
||||
}
|
||||
|
||||
public CPacketFluidUpdate(Map<Integer, IAEFluidStack> data) {
|
||||
this.list = data;
|
||||
}
|
||||
|
||||
public CPacketFluidUpdate(Map<Integer, IAEFluidStack> data, ItemStack itemStack, int slotIndex) {
|
||||
this.list = data;
|
||||
this.itemStack = itemStack;
|
||||
this.slotIndex = slotIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
int size = buf.readInt();
|
||||
this.list = new HashMap<>();
|
||||
try {
|
||||
for (int i = 0; i < size; i++) {
|
||||
int id = buf.readInt();
|
||||
boolean isNull = buf.readBoolean();
|
||||
if (!isNull)
|
||||
list.put(id, null);
|
||||
else {
|
||||
IAEFluidStack fluid = AEFluidStack.loadFluidStackFromPacket(buf);
|
||||
list.put(id, fluid);
|
||||
}
|
||||
}
|
||||
if (buf.readBoolean()) {
|
||||
this.itemStack = AEItemStack.loadItemStackFromPacket(buf).getItemStack();
|
||||
this.slotIndex = buf.readInt();
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(list.size());
|
||||
try {
|
||||
for (Map.Entry<Integer, IAEFluidStack> fs : list.entrySet()) {
|
||||
buf.writeInt(fs.getKey());
|
||||
if (fs.getValue() == null)
|
||||
buf.writeBoolean(false);
|
||||
else {
|
||||
buf.writeBoolean(true);
|
||||
fs.getValue().writeToPacket(buf);
|
||||
}
|
||||
}
|
||||
if (this.itemStack != null) {
|
||||
buf.writeBoolean(true);
|
||||
AEItemStack.create(itemStack).writeToPacket(buf);
|
||||
buf.writeInt(this.slotIndex);
|
||||
} else {
|
||||
buf.writeBoolean(false);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<CPacketFluidUpdate, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(CPacketFluidUpdate message, MessageContext ctx) {
|
||||
Container container = ctx.getServerHandler().playerEntity.openContainer;
|
||||
EntityPlayer player = ctx.getServerHandler().playerEntity;
|
||||
if (container instanceof FCBaseFluidMonitorContain) {
|
||||
ItemStack item = player.inventory.getItemStack();
|
||||
((FCBaseFluidMonitorContain) container).postChange(new ArrayList<IAEFluidStack>(message.list.values()), message.itemStack == null ? item : message.itemStack, player, message.slotIndex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.glodblock.github.network;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
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.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class CPacketLevelMaintainer implements IMessage {
|
||||
|
||||
private String action;
|
||||
private long size;
|
||||
private int slotIndex;
|
||||
|
||||
public CPacketLevelMaintainer() {
|
||||
}
|
||||
|
||||
public CPacketLevelMaintainer(String action, int slotIndex) {
|
||||
this.action = action;
|
||||
this.size = 0;
|
||||
this.slotIndex = slotIndex;
|
||||
}
|
||||
|
||||
public CPacketLevelMaintainer(String action) {
|
||||
this.action = action;
|
||||
this.size = 0;
|
||||
this.slotIndex = 0;
|
||||
}
|
||||
|
||||
public CPacketLevelMaintainer(String action, int slotIndex, long size) {
|
||||
this.action = action;
|
||||
this.size = size;
|
||||
this.slotIndex = slotIndex;
|
||||
}
|
||||
|
||||
public CPacketLevelMaintainer(String action, int slotIndex, String size) {
|
||||
this.action = action;
|
||||
this.slotIndex = slotIndex;
|
||||
this.size = size.isEmpty() ? 0 : Long.parseLong(size);
|
||||
}
|
||||
|
||||
public static IAEItemStack setTag(IAEItemStack ias, long batch, int slotIndex, boolean enable) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
ItemStack is = ias.getItemStack();
|
||||
data.setLong("Batch", batch);
|
||||
data.setLong("Index", slotIndex);
|
||||
data.setBoolean("Enable", enable);
|
||||
is.setTagCompound(data);
|
||||
IAEItemStack iaeItemStack = AEItemStack.create(is);
|
||||
iaeItemStack.setStackSize(ias.getStackSize());
|
||||
return iaeItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
int leAction = buf.readInt();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < leAction; i++) {
|
||||
sb.append(buf.readChar());
|
||||
}
|
||||
this.action = sb.toString();
|
||||
this.slotIndex = buf.readInt();
|
||||
this.size = buf.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(this.action.length());
|
||||
for (int i = 0; i < this.action.length(); i++) {
|
||||
buf.writeChar(this.action.charAt(i));
|
||||
}
|
||||
buf.writeInt(this.slotIndex);
|
||||
buf.writeLong(this.size);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<CPacketLevelMaintainer, IMessage> {
|
||||
private void refresh(ContainerLevelMaintainer cca, EntityPlayerMP player) {
|
||||
SPacketMEInventoryUpdate piu = new SPacketMEInventoryUpdate(false);
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
IAEItemStack is = cca.getTile().requests.getRequestQtyStack(i);
|
||||
IAEItemStack is1 = cca.getTile().requests.getRequestBatches().getStack(i);
|
||||
if (is != null) {
|
||||
if (is1 != null) {
|
||||
NBTTagCompound data;
|
||||
data = is1.getItemStack().getTagCompound();
|
||||
piu.appendItem(setTag(is, is1.getStackSize(), i, data.getBoolean("Enable")));
|
||||
} else {
|
||||
piu.appendItem(setTag(is, 0, i, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendTo(piu, player);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IMessage onMessage(CPacketLevelMaintainer message, MessageContext ctx) {
|
||||
if (message.action.startsWith("TileLevelMaintainer.") && ctx.getServerHandler().playerEntity.openContainer instanceof ContainerLevelMaintainer) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
final ContainerLevelMaintainer cca = (ContainerLevelMaintainer) ctx.getServerHandler().playerEntity.openContainer;
|
||||
switch (message.action) {
|
||||
case "TileLevelMaintainer.Quantity":
|
||||
cca.getTile().updateQuantity(message.slotIndex, message.size);
|
||||
break;
|
||||
case "TileLevelMaintainer.Batch":
|
||||
cca.getTile().updateBatchSize(message.slotIndex, message.size);
|
||||
break;
|
||||
case "TileLevelMaintainer.Enable":
|
||||
cca.getTile().setRequestStatus(message.slotIndex, false);
|
||||
break;
|
||||
case "TileLevelMaintainer.Disable":
|
||||
cca.getTile().setRequestStatus(message.slotIndex, true);
|
||||
break;
|
||||
}
|
||||
this.refresh(cca, player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.glodblock.github.network;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
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 appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.client.gui.*;
|
||||
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.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@@ -20,12 +20,24 @@ import java.util.Map;
|
||||
public class SPacketFluidUpdate implements IMessage {
|
||||
|
||||
private Map<Integer, IAEFluidStack> list;
|
||||
private IAEItemStack itemStack;
|
||||
|
||||
public SPacketFluidUpdate() {
|
||||
}
|
||||
|
||||
public SPacketFluidUpdate(Map<Integer, IAEFluidStack> data) {
|
||||
this.list = data;
|
||||
this.itemStack = null;
|
||||
}
|
||||
|
||||
public SPacketFluidUpdate(Map<Integer, IAEFluidStack> data, IAEItemStack itemStack) {
|
||||
this.list = data;
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public SPacketFluidUpdate(Map<Integer, IAEFluidStack> data, ItemStack itemStack) {
|
||||
this.list = data;
|
||||
this.itemStack = AEItemStack.create(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,7 +45,7 @@ public class SPacketFluidUpdate implements IMessage {
|
||||
int size = buf.readInt();
|
||||
this.list = new HashMap<>();
|
||||
try {
|
||||
for (int i = 0; i < size; i ++) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
int id = buf.readInt();
|
||||
boolean isNull = buf.readBoolean();
|
||||
if (!isNull)
|
||||
@@ -43,6 +55,9 @@ public class SPacketFluidUpdate implements IMessage {
|
||||
list.put(id, fluid);
|
||||
}
|
||||
}
|
||||
if (buf.readBoolean()) {
|
||||
this.itemStack = AEItemStack.loadItemStackFromPacket(buf);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -61,6 +76,13 @@ public class SPacketFluidUpdate implements IMessage {
|
||||
fs.getValue().writeToPacket(buf);
|
||||
}
|
||||
}
|
||||
if (this.itemStack != null) {
|
||||
buf.writeBoolean(true);
|
||||
this.itemStack.writeToPacket(buf);
|
||||
} else {
|
||||
buf.writeBoolean(false);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -86,8 +108,14 @@ public class SPacketFluidUpdate implements IMessage {
|
||||
( (GuiFluidIO) gs ).update(e.getKey(), e.getValue());
|
||||
}
|
||||
} else if (gs instanceof GuiFluidInterface) {
|
||||
for (Map.Entry<Integer, IAEFluidStack> e : message.list.entrySet() ) {
|
||||
( (GuiFluidInterface) gs ).update(e.getKey(), e.getValue());
|
||||
for (Map.Entry<Integer, IAEFluidStack> e : message.list.entrySet()) {
|
||||
((GuiFluidInterface) gs).update(e.getKey(), e.getValue());
|
||||
}
|
||||
} else if (gs instanceof GuiFluidTerminal) {
|
||||
if (message.itemStack != null) {
|
||||
((GuiFluidTerminal) gs).update(message.itemStack.getItemStack());
|
||||
} else {
|
||||
((GuiFluidTerminal) gs).update(null);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.glodblock.github.network;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.client.gui.GuiFCBaseFluidMonitor;
|
||||
import com.glodblock.github.client.gui.GuiFCBaseMonitor;
|
||||
import com.glodblock.github.client.gui.GuiFluidCraftConfirm;
|
||||
import com.glodblock.github.client.gui.GuiLevelMaintainer;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
@@ -18,27 +22,39 @@ import java.util.List;
|
||||
|
||||
public class SPacketMEInventoryUpdate implements IMessage {
|
||||
|
||||
private List<IAEItemStack> list;
|
||||
private List<Object> list;
|
||||
private byte ref;
|
||||
private boolean isFluid = false;
|
||||
|
||||
public SPacketMEInventoryUpdate() {
|
||||
ref = 0;
|
||||
list = new LinkedList<>();
|
||||
}
|
||||
|
||||
public SPacketMEInventoryUpdate(Boolean isFluid) {
|
||||
ref = 0;
|
||||
list = new LinkedList<>();
|
||||
this.isFluid = isFluid;
|
||||
}
|
||||
|
||||
public SPacketMEInventoryUpdate(byte b) {
|
||||
this.ref = b;
|
||||
ref = b;
|
||||
list = new LinkedList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
isFluid = buf.readBoolean();
|
||||
long amount = buf.readLong();
|
||||
ref = buf.readByte();
|
||||
list = new LinkedList<>();
|
||||
try {
|
||||
for (int i = 0; i < amount; i ++) {
|
||||
list.add(AEItemStack.loadItemStackFromPacket(buf));
|
||||
if (isFluid) {
|
||||
list.add(AEFluidStack.loadFluidStackFromPacket(buf));
|
||||
} else {
|
||||
list.add(AEItemStack.loadItemStackFromPacket(buf));
|
||||
}
|
||||
}
|
||||
} catch (IOException io) {
|
||||
io.printStackTrace();
|
||||
@@ -47,18 +63,28 @@ public class SPacketMEInventoryUpdate implements IMessage {
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
if (isFluid) {
|
||||
buf.writeBoolean(true);
|
||||
} else {
|
||||
buf.writeBoolean(false);
|
||||
}
|
||||
buf.writeLong(list.size());
|
||||
buf.writeByte(ref);
|
||||
try {
|
||||
for (IAEItemStack itemStack : list) {
|
||||
itemStack.writeToPacket(buf);
|
||||
for (Object is : list) {
|
||||
if (is instanceof IAEItemStack) ((IAEItemStack) is).writeToPacket(buf);
|
||||
if (is instanceof IAEFluidStack) ((IAEFluidStack) is).writeToPacket(buf);
|
||||
}
|
||||
} catch (IOException io) {
|
||||
io.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void appendItem( final IAEItemStack is ) throws BufferOverflowException {
|
||||
public void appendItem(final IAEItemStack is) throws BufferOverflowException {
|
||||
list.add(is);
|
||||
}
|
||||
|
||||
public void appendFluid(final IAEFluidStack is) throws BufferOverflowException {
|
||||
list.add(is);
|
||||
}
|
||||
|
||||
@@ -71,12 +97,14 @@ public class SPacketMEInventoryUpdate implements IMessage {
|
||||
@Override
|
||||
public IMessage onMessage(SPacketMEInventoryUpdate message, MessageContext ctx) {
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
if( gs instanceof GuiFCBaseMonitor)
|
||||
{
|
||||
( (GuiFCBaseMonitor) gs ).postUpdate(message.list);
|
||||
}
|
||||
else if ( gs instanceof GuiFluidCraftConfirm) {
|
||||
( (GuiFluidCraftConfirm) gs ).postUpdate( message.list, message.ref );
|
||||
if (gs instanceof GuiFCBaseFluidMonitor) {
|
||||
((GuiFCBaseFluidMonitor) gs).postUpdate((List<IAEFluidStack>) (List<?>) message.list);
|
||||
} else if (gs instanceof GuiFCBaseMonitor) {
|
||||
((GuiFCBaseMonitor) gs).postUpdate((List<IAEItemStack>) (List<?>) message.list);
|
||||
} else if (gs instanceof GuiFluidCraftConfirm) {
|
||||
((GuiFluidCraftConfirm) gs).postUpdate((List<IAEItemStack>) (List<?>) message.list, message.ref);
|
||||
} else if (gs instanceof GuiLevelMaintainer) {
|
||||
((GuiLevelMaintainer) gs).postUpdate((List<IAEItemStack>) (List<?>) message.list);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ import appeng.crafting.MECraftingInventory;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.me.storage.MEInventoryHandler;
|
||||
import appeng.me.storage.MEPassThrough;
|
||||
import appeng.parts.p2p.PartP2PLiquids;
|
||||
import appeng.util.inv.ItemSlot;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -36,6 +38,7 @@ public class Ae2Reflect {
|
||||
private static final Method mCPU_getGrid;
|
||||
private static final Method mCPU_postChange;
|
||||
private static final Method mCPU_markDirty;
|
||||
private static final Method mP2PLiquids_getTarget;
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -53,6 +56,7 @@ public class Ae2Reflect {
|
||||
mCPU_getGrid = reflectMethod(CraftingCPUCluster.class, "getGrid");
|
||||
mCPU_postChange = reflectMethod(CraftingCPUCluster.class, "postChange", IAEItemStack.class, BaseActionSource.class);
|
||||
mCPU_markDirty = reflectMethod(CraftingCPUCluster.class, "markDirty");
|
||||
mP2PLiquids_getTarget = reflectMethod(PartP2PLiquids.class, "getTarget");
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Failed to initialize AE2 reflection hacks!", e);
|
||||
}
|
||||
@@ -172,4 +176,12 @@ public class Ae2Reflect {
|
||||
}
|
||||
}
|
||||
|
||||
public static IFluidHandler getP2PLiquidTarget(PartP2PLiquids p2p) {
|
||||
try {
|
||||
return (IFluidHandler) mP2PLiquids_getTarget.invoke(p2p);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Failed to invoke method: " + mP2PLiquids_getTarget, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -236,6 +236,11 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEFluidInventory getInternalFluid() {
|
||||
return this.tanks;
|
||||
}
|
||||
|
||||
private boolean hasWorkToDo() {
|
||||
for (IAEFluidStack requiredWork : this.requireWork) {
|
||||
if (requiredWork != null) {
|
||||
|
||||
@@ -22,12 +22,21 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
|
||||
private IAEItemStack[] inputs = null, inputsCond = null, outputs = null, outputsCond = null;
|
||||
private int priority = 0;
|
||||
private int combine = 0;
|
||||
private int beSubstitute = 0;
|
||||
|
||||
public FluidPatternDetails(ItemStack stack) {
|
||||
this.patternStack = stack;
|
||||
this.patternStackAe = Objects.requireNonNull(AEItemStack.create(stack)); // s2g
|
||||
}
|
||||
|
||||
public boolean canBeSubstitute() {
|
||||
return beSubstitute != 0;
|
||||
}
|
||||
|
||||
public void setCanBeSubstitute(int beSubstitute) {
|
||||
this.beSubstitute = beSubstitute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPattern() {
|
||||
return patternStack;
|
||||
@@ -150,6 +159,7 @@ public class FluidPatternDetails implements ICraftingPatternDetails, Comparable<
|
||||
tag.setTag("in", writeStackArray(checkInitialized(inputs)));
|
||||
tag.setTag("out", writeStackArray(checkInitialized(outputs)));
|
||||
tag.setInteger("combine", this.getCombine());
|
||||
tag.setBoolean("beSubstitute", this.canBeSubstitute());
|
||||
patternStack.setTagCompound(tag);
|
||||
patternStackAe = Objects.requireNonNull(AEItemStack.create(patternStack));
|
||||
return patternStack;
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IInvTweaks;
|
||||
import appeng.util.Platform;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
public class FluidSorters {
|
||||
private static SortDir Direction = SortDir.ASCENDING;
|
||||
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_MOD = new Comparator<IAEItemStack>() {
|
||||
|
||||
@Override
|
||||
public int compare(final IAEItemStack o1, final IAEItemStack o2) {
|
||||
final Fluid f1 = ItemFluidDrop.getAeFluidStack(o1).getFluid();
|
||||
final Fluid f2 = ItemFluidDrop.getAeFluidStack(o2).getFluid();
|
||||
if (getDirection() == SortDir.ASCENDING) {
|
||||
return this.secondarySort(Util.getFluidModName(f2).compareToIgnoreCase(Util.getFluidModName(f1)), f1, f2);
|
||||
}
|
||||
return this.secondarySort(Util.getFluidModName(f1).compareToIgnoreCase(Util.getFluidModName(f2)), f2, f1);
|
||||
}
|
||||
|
||||
private int secondarySort(final int compareToIgnoreCase, final Fluid f1, final Fluid f2) {
|
||||
if (compareToIgnoreCase == 0) {
|
||||
return f2.getLocalizedName().compareToIgnoreCase(f1.getLocalizedName());
|
||||
}
|
||||
|
||||
return compareToIgnoreCase;
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_NAME = new Comparator<IAEItemStack>() {
|
||||
|
||||
@Override
|
||||
public int compare(final IAEItemStack o1, final IAEItemStack o2) {
|
||||
if (getDirection() == SortDir.ASCENDING) {
|
||||
return Platform.getItemDisplayName(o1).compareToIgnoreCase(Platform.getItemDisplayName(o2));
|
||||
}
|
||||
return Platform.getItemDisplayName(o2).compareToIgnoreCase(Platform.getItemDisplayName(o1));
|
||||
}
|
||||
};
|
||||
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_SIZE = new Comparator<IAEItemStack>() {
|
||||
|
||||
@Override
|
||||
public int compare(final IAEItemStack o1, final IAEItemStack o2) {
|
||||
if (getDirection() == SortDir.ASCENDING) {
|
||||
return compareLong(o2.getStackSize(), o1.getStackSize());
|
||||
}
|
||||
return compareLong(o1.getStackSize(), o2.getStackSize());
|
||||
}
|
||||
};
|
||||
private static IInvTweaks api;
|
||||
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_INV_TWEAKS = new Comparator<IAEItemStack>() {
|
||||
|
||||
@Override
|
||||
public int compare(final IAEItemStack o1, final IAEItemStack o2) {
|
||||
if (api == null) {
|
||||
return CONFIG_BASED_SORT_BY_NAME.compare(o1, o2);
|
||||
}
|
||||
|
||||
final int cmp = api.compareItems(o1.getItemStack(), o2.getItemStack());
|
||||
|
||||
if (getDirection() == SortDir.ASCENDING) {
|
||||
return cmp;
|
||||
}
|
||||
return -cmp;
|
||||
}
|
||||
};
|
||||
|
||||
public static void init() {
|
||||
if (api != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.InvTweaks)) {
|
||||
api = (IInvTweaks) IntegrationRegistry.INSTANCE.getInstance(IntegrationType.InvTweaks);
|
||||
} else {
|
||||
api = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int compareInt(final int a, final int b) {
|
||||
if (a == b) {
|
||||
return 0;
|
||||
}
|
||||
if (a < b) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int compareLong(final long a, final long b) {
|
||||
if (a == b) {
|
||||
return 0;
|
||||
}
|
||||
if (a < b) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static int compareDouble(final double a, final double b) {
|
||||
if (a == b) {
|
||||
return 0;
|
||||
}
|
||||
if (a < b) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static SortDir getDirection() {
|
||||
return Direction;
|
||||
}
|
||||
|
||||
public static void setDirection(final SortDir direction) {
|
||||
Direction = direction;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public final class ModAndClassUtil {
|
||||
public static boolean NEI = false;
|
||||
public static boolean COFH = false;
|
||||
public static boolean GTPP = false;
|
||||
|
||||
public static boolean WAILA = false;
|
||||
public static boolean isDoubleButton;
|
||||
public static boolean isSaveText;
|
||||
public static boolean isSearchStringTooltip;
|
||||
@@ -33,6 +33,8 @@ public final class ModAndClassUtil {
|
||||
public static boolean isShiftTooltip;
|
||||
public static boolean isBigInterface;
|
||||
|
||||
public static boolean isBeSubstitutionsButton;
|
||||
|
||||
public static Class<?> essentiaGas;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@@ -69,6 +71,12 @@ public final class ModAndClassUtil {
|
||||
} catch (NoSuchFieldException e) {
|
||||
isDoubleButton = false;
|
||||
}
|
||||
try {
|
||||
Field d = ButtonToolTips.class.getDeclaredField("BeSubstitutionsDescEnabled");
|
||||
// isBeSubstitutionsButton = true;
|
||||
} catch (NoSuchFieldException e) {
|
||||
isBeSubstitutionsButton = false;
|
||||
}
|
||||
|
||||
try {
|
||||
Field d = Settings.class.getDeclaredField("SAVE_SEARCH");
|
||||
@@ -124,5 +132,7 @@ public final class ModAndClassUtil {
|
||||
COFH = true;
|
||||
if (Loader.isModLoaded("miscutils"))
|
||||
GTPP = true;
|
||||
if (Loader.isModLoaded("Waila"))
|
||||
WAILA = true;
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,11 @@ public class NameConst {
|
||||
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 BLOCK_LEVEL_MAINTAINER = "level_maintainer";
|
||||
|
||||
public static final String ITEM_FLUID_DROP = "fluid_drop";
|
||||
public static final String ITEM_FLUID_ENCODED_PATTERN = "fluid_encoded_pattern";
|
||||
public static final String ITEM_PART_FLUID_TERMINAL = "part_fluid_terminal";
|
||||
public static final String ITEM_PART_FLUID_PATTERN_TERMINAL = "part_fluid_pattern_terminal";
|
||||
public static final String ITEM_PART_FLUID_PATTERN_TERMINAL_EX = "part_fluid_pattern_terminal_ex";
|
||||
public static final String ITEM_PART_FLUID_INTERFACE = "part_fluid_interface";
|
||||
@@ -24,17 +26,27 @@ public class NameConst {
|
||||
public static final String ITEM_FLUID_PART = "fluid_part";
|
||||
|
||||
public static final String TT_KEY = FluidCraft.MODID + ".tooltip.";
|
||||
public static final String TT_FLUID_TERMINAL = TT_KEY + "fluid_terminal";
|
||||
public static final String TT_INVALID_FLUID = TT_KEY + "invalid_fluid";
|
||||
public static final String TT_FLUID_PACKET = TT_KEY + "fluid_packet";
|
||||
public static final String TT_ENCODE_PATTERN = TT_KEY + "encode_pattern";
|
||||
public static final String TT_EMPTY = TT_KEY + "empty";
|
||||
public static final String TT_DUMP_TANK = TT_KEY + "dump_tank";
|
||||
public static final String TT_REQUEST_SIZE = TT_KEY + "request_size";
|
||||
public static final String TT_BATCH_SIZE = TT_KEY + "batch_size";
|
||||
public static final String TT_CELL_CONTENTS = TT_KEY + "cell_contents";
|
||||
|
||||
public static final String WAILA_KEY = FluidCraft.MODID + ".waila.";
|
||||
public static final String WAILA_ENABLE = WAILA_KEY + "enable";
|
||||
public static final String WAILA_DISABLE = WAILA_KEY + "disable";
|
||||
public static final String WAILA_SPEED = WAILA_KEY + "speed";
|
||||
public static final String RES_KEY = FluidCraft.MODID + ":";
|
||||
|
||||
public static final String GUI_KEY = FluidCraft.MODID + ".gui.";
|
||||
public static final String GUI_FLUID_TERMINAL = GUI_KEY + ITEM_PART_FLUID_TERMINAL;
|
||||
public static final String GUI_FLUID_PATTERN_TERMINAL = GUI_KEY + ITEM_PART_FLUID_PATTERN_TERMINAL;
|
||||
public static final String GUI_FLUID_PATTERN_TERMINAL_EX = GUI_KEY + ITEM_PART_FLUID_PATTERN_TERMINAL_EX;
|
||||
public static final String GUI_LEVEL_MAINTAINER = GUI_KEY + BLOCK_LEVEL_MAINTAINER;
|
||||
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;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
@@ -9,15 +10,16 @@ import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
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.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
public final class Util {
|
||||
|
||||
@@ -35,8 +37,10 @@ public final class Util {
|
||||
|
||||
public static ForgeDirection from(EnumFacing direction) {
|
||||
switch (direction) {
|
||||
case WEST: return ForgeDirection.EAST;
|
||||
case EAST: return ForgeDirection.WEST;
|
||||
case WEST:
|
||||
return ForgeDirection.EAST;
|
||||
case EAST:
|
||||
return ForgeDirection.WEST;
|
||||
default: {
|
||||
int o = direction.ordinal();
|
||||
return ForgeDirection.values()[o];
|
||||
@@ -44,6 +48,13 @@ public final class Util {
|
||||
}
|
||||
}
|
||||
|
||||
public static int findItemInPlayerInvSlot(EntityPlayer player, ItemStack itemStack) {
|
||||
for (int i = 0; i < player.inventory.mainInventory.length; i++) {
|
||||
if (player.inventory.mainInventory[i] != null && player.inventory.mainInventory[i] == itemStack) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static boolean hasPermission(EntityPlayer player, SecurityPermissions permission, IGrid grid) {
|
||||
return grid == null || hasPermission(player, permission, (ISecurityGrid) grid.getCache(ISecurityGrid.class));
|
||||
}
|
||||
@@ -68,8 +79,7 @@ public final class Util {
|
||||
return player == null || permission == null || securityGrid == null || securityGrid.hasPermission(player, permission);
|
||||
}
|
||||
|
||||
public static ItemStack copyStackWithSize(ItemStack itemStack, int size)
|
||||
{
|
||||
public static ItemStack copyStackWithSize(ItemStack itemStack, int size) {
|
||||
if (size == 0 || itemStack == null)
|
||||
return null;
|
||||
ItemStack copy = itemStack.copy();
|
||||
@@ -77,6 +87,28 @@ public final class Util {
|
||||
return copy;
|
||||
}
|
||||
|
||||
public static AEFluidStack getAEFluidFromItem(ItemStack stack) {
|
||||
if (stack != null && (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
|
||||
if (stack.getItem() instanceof IFluidContainerItem) {
|
||||
FluidStack fluid = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
|
||||
if (fluid != null) {
|
||||
AEFluidStack fluid0 = AEFluidStack.create(fluid.copy());
|
||||
fluid0.setStackSize(fluid0.getStackSize() * stack.stackSize);
|
||||
return fluid0;
|
||||
}
|
||||
}
|
||||
if (FluidContainerRegistry.isContainer(stack)) {
|
||||
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
|
||||
if (fluid != null) {
|
||||
AEFluidStack fluid0 = AEFluidStack.create(fluid.copy());
|
||||
fluid0.setStackSize(fluid0.getStackSize() * stack.stackSize);
|
||||
return fluid0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FluidStack getFluidFromItem(ItemStack stack) {
|
||||
if (stack != null && (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
|
||||
if (stack.getItem() instanceof IFluidContainerItem) {
|
||||
@@ -108,14 +140,40 @@ public final class Util {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IAEFluidStack loadFluidStackFromNBT( final NBTTagCompound i )
|
||||
{
|
||||
public static String getFluidModID(Fluid fluid) {
|
||||
String name = FluidRegistry.getDefaultFluidName(fluid);
|
||||
try {
|
||||
return name.split(":")[0];
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static ModContainer getFluidMod(Fluid fluid) {
|
||||
return GameData.findModOwner(String.format("%s:%s", getFluidModID(fluid), fluid.getName()));
|
||||
}
|
||||
|
||||
public static int getFluidID(Fluid fluid) {
|
||||
return GameData.getBlockRegistry().getId(fluid.getBlock());
|
||||
}
|
||||
|
||||
public static String getFluidModName(Fluid fluid) {
|
||||
try {
|
||||
ModContainer mod = getFluidMod(fluid);
|
||||
return mod == null ? "Minecraft" : mod.getName();
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static IAEFluidStack loadFluidStackFromNBT(final NBTTagCompound i) {
|
||||
//Fuck ae2
|
||||
final FluidStack t = FluidRegistry.getFluidStack(i.getString("FluidName"), 1);
|
||||
final AEFluidStack fluid = AEFluidStack.create( t );
|
||||
fluid.setStackSize( i.getLong( "Cnt" ) );
|
||||
fluid.setCountRequestable( i.getLong( "Req" ) );
|
||||
fluid.setCraftable( i.getBoolean( "Craft" ) );
|
||||
final AEFluidStack fluid = AEFluidStack.create(t);
|
||||
fluid.setStackSize(i.getLong("Cnt"));
|
||||
fluid.setCountRequestable(i.getLong("Req"));
|
||||
fluid.setCraftable(i.getBoolean("Craft"));
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@@ -124,4 +182,156 @@ public final class Util {
|
||||
return fluid1.isFluidEqual(fluid2);
|
||||
}
|
||||
|
||||
public static class FluidUtil {
|
||||
public static IAEFluidStack createAEFluidStack(Fluid fluid) {
|
||||
return createAEFluidStack(new FluidStack(fluid,
|
||||
FluidContainerRegistry.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
public static IAEFluidStack createAEFluidStack(Fluid fluid, long amount) {
|
||||
return createAEFluidStack(fluid.getID(), amount);
|
||||
}
|
||||
|
||||
public static IAEFluidStack createAEFluidStack(FluidStack fluid) {
|
||||
return AEApi.instance().storage().createFluidStack(fluid);
|
||||
}
|
||||
|
||||
public static IAEFluidStack createAEFluidStack(int fluidId, long amount) {
|
||||
return createAEFluidStack(new FluidStack(FluidRegistry.getFluid(fluidId), 1)).setStackSize(
|
||||
amount);
|
||||
}
|
||||
|
||||
public static boolean isEmpty(ItemStack itemStack) {
|
||||
if (itemStack == null)
|
||||
return false;
|
||||
Item item = itemStack.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
FluidStack content = ((IFluidContainerItem) item)
|
||||
.getFluid(itemStack);
|
||||
return content == null || content.amount <= 0;
|
||||
}
|
||||
return FluidContainerRegistry.isEmptyContainer(itemStack);
|
||||
}
|
||||
|
||||
public static boolean isFilled(ItemStack itemStack) {
|
||||
if (itemStack == null)
|
||||
return false;
|
||||
Item item = itemStack.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
FluidStack content = ((IFluidContainerItem) item)
|
||||
.getFluid(itemStack);
|
||||
return content != null && content.amount > 0;
|
||||
}
|
||||
return FluidContainerRegistry.isFilledContainer(itemStack);
|
||||
}
|
||||
|
||||
public static boolean isFluidContainer(ItemStack itemStack) {
|
||||
if (itemStack == null)
|
||||
return false;
|
||||
Item item = itemStack.getItem();
|
||||
return item instanceof IFluidContainerItem
|
||||
|| FluidContainerRegistry.isContainer(itemStack);
|
||||
}
|
||||
|
||||
public static FluidStack getFluidFromContainer(ItemStack itemStack) {
|
||||
if (itemStack == null)
|
||||
return null;
|
||||
|
||||
ItemStack container = itemStack.copy();
|
||||
Item item = container.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
return ((IFluidContainerItem) item).getFluid(container);
|
||||
} else {
|
||||
return FluidContainerRegistry.getFluidForFilledItem(container);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getCapacity(ItemStack itemStack, Fluid fluid) {
|
||||
if (itemStack == null)
|
||||
return 0;
|
||||
Item item = itemStack.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
IFluidContainerItem fluidContainerItem = (IFluidContainerItem) item;
|
||||
int capacity = fluidContainerItem.getCapacity(itemStack);
|
||||
FluidStack existing = fluidContainerItem.getFluid(itemStack);
|
||||
if (existing != null) {
|
||||
if (!existing.getFluid().equals(fluid)) {
|
||||
return 0;
|
||||
}
|
||||
capacity -= existing.amount;
|
||||
}
|
||||
return capacity;
|
||||
} else if (FluidContainerRegistry.isContainer(itemStack)) {
|
||||
return FluidContainerRegistry.getContainerCapacity(new FluidStack(fluid, Integer.MAX_VALUE), itemStack);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static ItemStack clearFluid(ItemStack itemStack) {
|
||||
if (itemStack == null)
|
||||
return null;
|
||||
Item item = itemStack.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
((IFluidContainerItem) item).drain(itemStack,
|
||||
((IFluidContainerItem) item).getFluid(itemStack).amount, true);
|
||||
return itemStack;
|
||||
} else if (FluidContainerRegistry.isContainer(itemStack)) {
|
||||
return FluidContainerRegistry.drainFluidContainer(itemStack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MutablePair<Integer, ItemStack> drainStack(
|
||||
ItemStack itemStack, FluidStack fluid) {
|
||||
if (itemStack == null)
|
||||
return null;
|
||||
Item item = itemStack.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
FluidStack drained = ((IFluidContainerItem) item).drain(itemStack,
|
||||
fluid.amount, true);
|
||||
int amountDrained = drained != null
|
||||
&& drained.getFluid() == fluid.getFluid() ? drained.amount
|
||||
: 0;
|
||||
return new MutablePair<Integer, ItemStack>(amountDrained, itemStack);
|
||||
} else if (FluidContainerRegistry.isContainer(itemStack)) {
|
||||
FluidStack content = FluidContainerRegistry
|
||||
.getFluidForFilledItem(itemStack);
|
||||
int amountDrained = content != null
|
||||
&& content.getFluid() == fluid.getFluid() ? content.amount
|
||||
: 0;
|
||||
return new MutablePair<Integer, ItemStack>(amountDrained,
|
||||
FluidContainerRegistry.drainFluidContainer(itemStack));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MutablePair<Integer, ItemStack> fillStack(
|
||||
ItemStack itemStack, FluidStack fluid) {
|
||||
if (itemStack == null || itemStack.stackSize != 1)
|
||||
return null;
|
||||
Item item = itemStack.getItem();
|
||||
//If its a fluid container item instance
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
//Call the fill method on it.
|
||||
int filled = ((IFluidContainerItem) item).fill(itemStack, fluid,
|
||||
true);
|
||||
|
||||
//Return the filled itemstack.
|
||||
return new MutablePair<Integer, ItemStack>(filled, itemStack);
|
||||
} else if (FluidContainerRegistry.isContainer(itemStack)) {
|
||||
//Fill it through the fluidcontainer registry.
|
||||
ItemStack filledContainer = FluidContainerRegistry
|
||||
.fillFluidContainer(fluid, itemStack);
|
||||
//get the filled fluidstack.
|
||||
FluidStack filled = FluidContainerRegistry
|
||||
.getFluidForFilledItem(filledContainer);
|
||||
//Return filled container and fill amount.
|
||||
return new MutablePair<Integer, ItemStack>(
|
||||
filled != null ? filled.amount : 0, filledContainer);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,3 +5,5 @@ 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
|
||||
|
||||
public net.minecraft.client.renderer.texture.TextureMap field_110574_e # mapRegisteredSprites
|
||||
@@ -1,5 +1,6 @@
|
||||
item.fluid_drop.name=drop of %s
|
||||
item.fluid_encoded_pattern.name=Encode Pattern
|
||||
item.part_fluid_terminal.name=ME Fluid Terminal
|
||||
item.part_fluid_pattern_terminal.name=ME Fluid Pattern Terminal
|
||||
item.part_fluid_pattern_terminal_ex.name=ME Fluid Processing Pattern Terminal
|
||||
item.part_fluid_interface.name=ME Dual Interface
|
||||
@@ -28,7 +29,16 @@ 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
|
||||
tile.level_maintainer.name=ME Level Maintainer
|
||||
|
||||
ae2fc.waila.speed=Speed
|
||||
ae2fc.waila.enable=Enable
|
||||
ae2fc.waila.disable=Disable
|
||||
|
||||
ae2fc.tooltip.request_size=Amount to Maintain
|
||||
ae2fc.tooltip.batch_size=Crafting Batch Size
|
||||
ae2fc.tooltip.cell_contents=Contains Fluid:
|
||||
ae2fc.tooltip.fluid_terminal=uh So we don't need EC2 anymore?
|
||||
ae2fc.tooltip.invalid_fluid=Invalid fluid!
|
||||
ae2fc.tooltip.encode_pattern=Encode Patter
|
||||
ae2fc.tooltip.fluid_packet=Use a Fluid Packet Decoder to\nconvert this back into fluid.
|
||||
@@ -44,6 +54,9 @@ 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.tooltip.submit=Submit
|
||||
ae2fc.tooltip.enable=Enabled
|
||||
ae2fc.tooltip.disable=Disabled
|
||||
|
||||
ae2fc.gui.part_fluid_pattern_terminal=Fluid Pattern Terminal
|
||||
ae2fc.gui.part_fluid_pattern_terminal_ex=Fluid Processing Pattern Terminal
|
||||
@@ -52,6 +65,7 @@ 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.level_maintainer=ME Level Maintainer
|
||||
ae2fc.gui.fluid_interface.0=D
|
||||
ae2fc.gui.fluid_interface.1=U
|
||||
ae2fc.gui.fluid_interface.2=N
|
||||
@@ -62,4 +76,8 @@ 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
|
||||
ae2fc.gui.part_fluid_terminal=Fluid Terminal
|
||||
|
||||
error.unknown=Unknown
|
||||
|
||||
itemGroup.ae2fc=Fluid Craft For AE2
|
||||
@@ -1,5 +1,6 @@
|
||||
item.fluid_drop.name=%s液滴
|
||||
item.fluid_encoded_pattern.name=编码样板
|
||||
item.part_fluid_terminal.name=ME流体终端
|
||||
item.part_fluid_pattern_terminal.name=ME流体样板终端
|
||||
item.part_fluid_pattern_terminal_ex.name=ME增广流体样板终端
|
||||
item.part_fluid_interface.name=ME二合一接口
|
||||
@@ -28,7 +29,16 @@ tile.fluid_interface.name=ME二合一接口
|
||||
tile.ingredient_buffer.name=原材料缓存仓
|
||||
tile.large_ingredient_buffer.name=大型原材料缓存仓
|
||||
tile.oc_pattern_editor.name=OC样板编辑器
|
||||
tile.level_maintainer.name=ME缓存指令器
|
||||
|
||||
ae2fc.waila.speed=速度
|
||||
ae2fc.waila.enable=启用
|
||||
ae2fc.waila.disable=禁用
|
||||
|
||||
ae2fc.tooltip.request_size=缓存量
|
||||
ae2fc.tooltip.batch_size=批量制作数量
|
||||
ae2fc.tooltip.cell_contents=内含流体:
|
||||
ae2fc.tooltip.fluid_terminal=我们不再需要EC2了吗?
|
||||
ae2fc.tooltip.invalid_fluid=流体无效!
|
||||
ae2fc.tooltip.encode_pattern=编写样板
|
||||
ae2fc.tooltip.fluid_packet=使用ME流体封包解码器\n来将其转换回流体形式。
|
||||
@@ -44,6 +54,9 @@ ae2fc.tooltip.not_prio=优先放置流体
|
||||
ae2fc.tooltip.not_prio.hint=启用
|
||||
ae2fc.tooltip.prio=优先放置流体
|
||||
ae2fc.tooltip.prio.hint=禁用
|
||||
ae2fc.tooltip.submit=提交
|
||||
ae2fc.tooltip.enable=启用
|
||||
ae2fc.tooltip.disable=禁用
|
||||
|
||||
ae2fc.gui.part_fluid_pattern_terminal=ME流体样板终端
|
||||
ae2fc.gui.part_fluid_pattern_terminal_ex=ME增广流体样板终端
|
||||
@@ -52,6 +65,7 @@ ae2fc.gui.fluid_packet_decoder=ME流体封包解码器
|
||||
ae2fc.gui.ingredient_buffer=原材料缓存仓
|
||||
ae2fc.gui.large_ingredient_buffer=大型原材料缓存仓
|
||||
ae2fc.gui.fluid_interface=ME二合一接口
|
||||
ae2fc.gui.level_maintainer=ME缓存指令器
|
||||
ae2fc.gui.fluid_interface.0=下
|
||||
ae2fc.gui.fluid_interface.1=上
|
||||
ae2fc.gui.fluid_interface.2=北
|
||||
@@ -62,4 +76,8 @@ ae2fc.gui.oc_pattern_editor=OC样板编辑器
|
||||
ae2fc.gui.button.set=设置
|
||||
ae2fc.gui.part_fluid_import=ME流体输入总线
|
||||
ae2fc.gui.part_fluid_export=ME流体输出总线
|
||||
ae2fc.gui.part_fluid_terminal=流体终端
|
||||
|
||||
error.unknown=未知流体
|
||||
|
||||
itemGroup.ae2fc=AE2流体合成套件重置
|
||||
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 203 B |
|
After Width: | Height: | Size: 288 B |
|
After Width: | Height: | Size: 202 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.7 KiB |