mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
191 files changed
+5048
-5166
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ dependencies {
|
||||
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}
|
||||
compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.49:dev') { transitive = false }
|
||||
|
||||
runtime('com.github.GTNewHorizons:Baubles:1.0.1.14:dev')
|
||||
}
|
||||
@@ -22,7 +22,11 @@ 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;after:waila")
|
||||
@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";
|
||||
@@ -32,7 +36,9 @@ public class FluidCraft {
|
||||
@Mod.Instance(MODID)
|
||||
public static FluidCraft INSTANCE;
|
||||
|
||||
@SidedProxy(clientSide = "com.glodblock.github.proxy.ClientProxy", serverSide = "com.glodblock.github.proxy.CommonProxy")
|
||||
@SidedProxy(
|
||||
clientSide = "com.glodblock.github.proxy.ClientProxy",
|
||||
serverSide = "com.glodblock.github.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Mod.EventHandler
|
||||
@@ -66,31 +72,29 @@ public class FluidCraft {
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.isBigInterface) {
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3 );
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3 );
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3);
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3);
|
||||
}
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 1 );
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 1 );
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 1);
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 1);
|
||||
|
||||
if (Config.fluidIOBus) {
|
||||
Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 2 );
|
||||
Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_IMPORT_BUS), 2 );
|
||||
Upgrades.REDSTONE.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 1 );
|
||||
Upgrades.REDSTONE.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_IMPORT_BUS), 1 );
|
||||
Upgrades.SPEED.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 4 );
|
||||
Upgrades.SPEED.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_IMPORT_BUS), 4 );
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 1 );
|
||||
Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 2);
|
||||
Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_IMPORT_BUS), 2);
|
||||
Upgrades.REDSTONE.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 1);
|
||||
Upgrades.REDSTONE.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_IMPORT_BUS), 1);
|
||||
Upgrades.SPEED.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 4);
|
||||
Upgrades.SPEED.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_IMPORT_BUS), 4);
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 1);
|
||||
}
|
||||
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onLoadComplete(FMLLoadCompleteEvent event) {
|
||||
}
|
||||
public void onLoadComplete(FMLLoadCompleteEvent event) {}
|
||||
|
||||
public static ResourceLocation resource(String path) {
|
||||
return new ResourceLocation(MODID, path);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,13 +9,10 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
public class ClientHelper {
|
||||
|
||||
@SubscribeEvent
|
||||
public void updateTextureSheet( final TextureStitchEvent.Pre ev )
|
||||
{
|
||||
if( ev.map.getTextureType() == 0 )
|
||||
{
|
||||
for( final FCPartsTexture cb : FCPartsTexture.values() )
|
||||
{
|
||||
cb.registerIcon( ev.map );
|
||||
public void updateTextureSheet(final TextureStitchEvent.Pre ev) {
|
||||
if (ev.map.getTextureType() == 0) {
|
||||
for (final FCPartsTexture cb : FCPartsTexture.values()) {
|
||||
cb.registerIcon(ev.map);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,5 +22,4 @@ public class ClientHelper {
|
||||
MinecraftForge.EVENT_BUS.register(handler);
|
||||
FMLCommonHandler.instance().bus().register(handler);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,8 +26,14 @@ public class FCGuiTextField extends GuiTextField {
|
||||
* @param width absolute width
|
||||
* @param height absolute height
|
||||
*/
|
||||
public FCGuiTextField(final FontRenderer fontRenderer, final int xPos, final int yPos, final int width, final int height) {
|
||||
super(fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - fontRenderer.getCharWidth('_'), height - 2 * PADDING);
|
||||
public FCGuiTextField(
|
||||
final FontRenderer fontRenderer, final int xPos, final int yPos, final int width, final int height) {
|
||||
super(
|
||||
fontRenderer,
|
||||
xPos + PADDING,
|
||||
yPos + PADDING,
|
||||
width - 2 * PADDING - fontRenderer.getCharWidth('_'),
|
||||
height - 2 * PADDING);
|
||||
|
||||
this._xPos = xPos;
|
||||
this._yPos = yPos;
|
||||
@@ -41,12 +47,11 @@ public class FCGuiTextField extends GuiTextField {
|
||||
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()
|
||||
);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,13 +105,11 @@ public class FCGuiTextField extends GuiTextField {
|
||||
return withinXRange && withinYRange;
|
||||
}
|
||||
|
||||
public void setMessage(String t)
|
||||
{
|
||||
public void setMessage(String t) {
|
||||
tooltip = t;
|
||||
}
|
||||
|
||||
public class TooltipProvider implements ITooltip
|
||||
{
|
||||
public class TooltipProvider implements ITooltip {
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return tooltip;
|
||||
@@ -128,7 +131,9 @@ public class FCGuiTextField extends GuiTextField {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() { return _width; }
|
||||
public int getWidth() {
|
||||
return _width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
|
||||
@@ -50,132 +50,136 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
if( this.tabCraftButton == btn || this.tabProcessButton == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.CraftMode", this.tabProcessButton == btn ? CRAFTMODE_CRFTING : CRAFTMODE_PROCESSING ) );
|
||||
}
|
||||
else if( this.encodeBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Encode", (isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0) ));
|
||||
}
|
||||
else if( this.clearBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Clear", "1" ) );
|
||||
}
|
||||
else if( this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
|
||||
}
|
||||
else if( this.combineDisableBtn == btn || this.combineEnableBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminal.Combine", this.combineDisableBtn == btn ? "1" : "0" ) );
|
||||
}
|
||||
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Double", Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
|
||||
if (this.tabCraftButton == btn || this.tabProcessButton == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.CraftMode",
|
||||
this.tabProcessButton == btn ? CRAFTMODE_CRFTING : CRAFTMODE_PROCESSING));
|
||||
} else if (this.encodeBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Encode", (isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0)));
|
||||
} else if (this.clearBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Clear", "1"));
|
||||
} else if (this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Substitute",
|
||||
this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE));
|
||||
} else if (this.combineDisableBtn == btn || this.combineEnableBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Combine", this.combineDisableBtn == btn ? "1" : "0"));
|
||||
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Double", Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.crafting_table ), GuiText.CraftingPattern.getLocal(), itemRender );
|
||||
this.buttonList.add( this.tabCraftButton );
|
||||
this.tabCraftButton = new GuiTabButton(
|
||||
this.guiLeft + 173,
|
||||
this.guiTop + this.ySize - 177,
|
||||
new ItemStack(Blocks.crafting_table),
|
||||
GuiText.CraftingPattern.getLocal(),
|
||||
itemRender);
|
||||
this.buttonList.add(this.tabCraftButton);
|
||||
|
||||
this.tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.furnace ), GuiText.ProcessingPattern.getLocal(), itemRender );
|
||||
this.buttonList.add( this.tabProcessButton );
|
||||
this.tabProcessButton = new GuiTabButton(
|
||||
this.guiLeft + 173,
|
||||
this.guiTop + this.ySize - 177,
|
||||
new ItemStack(Blocks.furnace),
|
||||
GuiText.ProcessingPattern.getLocal(),
|
||||
itemRender);
|
||||
this.buttonList.add(this.tabProcessButton);
|
||||
|
||||
this.substitutionsEnabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED );
|
||||
this.substitutionsEnabledBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.substitutionsEnabledBtn );
|
||||
this.substitutionsEnabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED);
|
||||
this.substitutionsEnabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.substitutionsEnabledBtn);
|
||||
|
||||
this.substitutionsDisabledBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED );
|
||||
this.substitutionsDisabledBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.substitutionsDisabledBtn );
|
||||
this.substitutionsDisabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED);
|
||||
this.substitutionsDisabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.substitutionsDisabledBtn);
|
||||
|
||||
this.clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE );
|
||||
this.clearBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.clearBtn );
|
||||
this.clearBtn = new GuiImgButton(
|
||||
this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE);
|
||||
this.clearBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.clearBtn);
|
||||
|
||||
this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE );
|
||||
this.encodeBtn = new GuiImgButton(
|
||||
this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE);
|
||||
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 = 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");
|
||||
// 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.combineDisableBtn = new GuiFCImgButton(this.guiLeft + combineLeft, this.guiTop + this.ySize - combineTop, "NOT_COMBINE", "DONT_COMBINE");
|
||||
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
|
||||
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
if( !this.container.isCraftingMode() )
|
||||
{
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
if (!this.container.isCraftingMode()) {
|
||||
this.tabCraftButton.visible = false;
|
||||
this.tabProcessButton.visible = true;
|
||||
if (ModAndClassUtil.isDoubleButton)
|
||||
this.doubleBtn.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ModAndClassUtil.isDoubleButton) this.doubleBtn.visible = true;
|
||||
} else {
|
||||
this.tabCraftButton.visible = true;
|
||||
this.tabProcessButton.visible = false;
|
||||
if (ModAndClassUtil.isDoubleButton)
|
||||
this.doubleBtn.visible = false;
|
||||
if (ModAndClassUtil.isDoubleButton) this.doubleBtn.visible = false;
|
||||
}
|
||||
|
||||
if( this.container.substitute )
|
||||
{
|
||||
if (this.container.substitute) {
|
||||
this.substitutionsEnabledBtn.visible = true;
|
||||
this.substitutionsDisabledBtn.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.substitutionsEnabledBtn.visible = false;
|
||||
this.substitutionsDisabledBtn.visible = true;
|
||||
}
|
||||
|
||||
if (!this.container.isCraftingMode())
|
||||
{
|
||||
if ( this.container.combine )
|
||||
{
|
||||
if (!this.container.isCraftingMode()) {
|
||||
if (this.container.combine) {
|
||||
this.combineEnableBtn.visible = true;
|
||||
this.combineDisableBtn.visible = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.combineEnableBtn.visible = false;
|
||||
this.combineDisableBtn.visible = true;
|
||||
}
|
||||
@@ -194,30 +198,27 @@ public class GuiBaseFluidPatternTerminal extends GuiFCBaseMonitor {
|
||||
}
|
||||
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL),
|
||||
8,
|
||||
this.ySize - 96 + 2 - getReservedSpace(),
|
||||
4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground()
|
||||
{
|
||||
if( this.container.isCraftingMode() )
|
||||
{
|
||||
protected String getBackground() {
|
||||
if (this.container.isCraftingMode()) {
|
||||
return "gui/pattern.png";
|
||||
}
|
||||
return "gui/pattern2.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot( final AppEngSlot s )
|
||||
{
|
||||
if( s.isPlayerSide() )
|
||||
{
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
if (s.isPlayerSide()) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+102
-108
@@ -53,126 +53,128 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
if( this.encodeBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Encode",(isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0)) );
|
||||
}
|
||||
else if( this.clearBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Clear", "1" ) );
|
||||
}
|
||||
else if( this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Substitute", this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE ) );
|
||||
}
|
||||
else if( this.fluidPrioritizedEnabledBtn == btn || this.fluidPrioritizedDisabledBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Prioritize", container.prioritize ? PRIORITY_DISABLE : PRIORITY_ENABLE ) );
|
||||
}
|
||||
else if( this.invertBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Invert", container.inverted ? "0" : "1" ) );
|
||||
}
|
||||
else if( this.combineDisableBtn == btn || this.combineEnableBtn == btn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "PatternTerminalEx.Combine", this.combineDisableBtn == btn ? "1" : "0" ) );
|
||||
}
|
||||
else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.Double", Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
|
||||
if (this.encodeBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminalEx.Encode", (isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0)));
|
||||
} else if (this.clearBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.Clear", "1"));
|
||||
} else if (this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminalEx.Substitute",
|
||||
this.substitutionsEnabledBtn == btn ? SUBSITUTION_DISABLE : SUBSITUTION_ENABLE));
|
||||
} else if (this.fluidPrioritizedEnabledBtn == btn || this.fluidPrioritizedDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminalEx.Prioritize", container.prioritize ? PRIORITY_DISABLE : PRIORITY_ENABLE));
|
||||
} else if (this.invertBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns("PatternTerminalEx.Invert", container.inverted ? "0" : "1"));
|
||||
} else if (this.combineDisableBtn == btn || this.combineEnableBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminalEx.Combine", this.combineDisableBtn == btn ? "1" : "0"));
|
||||
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminalEx.Double", Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.beSubstitute", "1"));
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns("PatternTerminalEx.beSubstitute", "1"));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.beSubstitute", "0"));
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns("PatternTerminalEx.beSubstitute", "0"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.substitutionsEnabledBtn = new GuiImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED );
|
||||
this.substitutionsEnabledBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.substitutionsEnabledBtn );
|
||||
this.substitutionsEnabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 97, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED);
|
||||
this.substitutionsEnabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.substitutionsEnabledBtn);
|
||||
|
||||
this.substitutionsDisabledBtn = new GuiImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED );
|
||||
this.substitutionsDisabledBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.substitutionsDisabledBtn );
|
||||
this.substitutionsDisabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 97, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED);
|
||||
this.substitutionsDisabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.substitutionsDisabledBtn);
|
||||
|
||||
this.fluidPrioritizedEnabledBtn = new GuiFCImgButton(this.guiLeft + 97, this.guiTop + this.ySize - 114, "FORCE_PRIO", "DO_PRIO");
|
||||
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.buttonList.add(this.fluidPrioritizedEnabledBtn);
|
||||
|
||||
this.fluidPrioritizedDisabledBtn = new GuiFCImgButton(this.guiLeft + 97, this.guiTop + this.ySize - 114, "NOT_PRIO", "DONT_PRIO");
|
||||
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 );
|
||||
this.buttonList.add(this.fluidPrioritizedDisabledBtn);
|
||||
|
||||
invertBtn = new GuiImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 153, Settings.ACTIONS, container.inverted ? PatternSlotConfig.C_4_16 : PatternSlotConfig.C_16_4);
|
||||
invertBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.invertBtn );
|
||||
invertBtn = new GuiImgButton(
|
||||
this.guiLeft + 87,
|
||||
this.guiTop + this.ySize - 153,
|
||||
Settings.ACTIONS,
|
||||
container.inverted ? PatternSlotConfig.C_4_16 : PatternSlotConfig.C_16_4);
|
||||
invertBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.invertBtn);
|
||||
|
||||
this.clearBtn = new GuiImgButton( this.guiLeft + 87, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE );
|
||||
this.clearBtn.setHalfSize( true );
|
||||
this.buttonList.add( this.clearBtn );
|
||||
this.clearBtn = new GuiImgButton(
|
||||
this.guiLeft + 87, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE);
|
||||
this.clearBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.clearBtn);
|
||||
|
||||
this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE );
|
||||
this.buttonList.add( this.encodeBtn );
|
||||
this.encodeBtn = new GuiImgButton(
|
||||
this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE);
|
||||
this.buttonList.add(this.encodeBtn);
|
||||
|
||||
if (ModAndClassUtil.isDoubleButton) {
|
||||
this.doubleBtn = new GuiImgButton( this.guiLeft + 97, this.guiTop + this.ySize - 153, Settings.ACTIONS, ActionItems.DOUBLE );
|
||||
this.doubleBtn.setHalfSize( true );
|
||||
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.combineEnableBtn = new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 114, "FORCE_COMBINE", "DO_COMBINE");
|
||||
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 =
|
||||
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);
|
||||
// }
|
||||
// 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
if (ModAndClassUtil.isDoubleButton)
|
||||
this.doubleBtn.visible = true;
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
if (ModAndClassUtil.isDoubleButton) this.doubleBtn.visible = true;
|
||||
|
||||
if( this.container.substitute )
|
||||
{
|
||||
if (this.container.substitute) {
|
||||
this.substitutionsEnabledBtn.visible = true;
|
||||
this.substitutionsDisabledBtn.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.substitutionsEnabledBtn.visible = false;
|
||||
this.substitutionsDisabledBtn.visible = true;
|
||||
}
|
||||
if( this.container.prioritize )
|
||||
{
|
||||
if (this.container.prioritize) {
|
||||
this.fluidPrioritizedEnabledBtn.visible = false;
|
||||
this.fluidPrioritizedDisabledBtn.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.fluidPrioritizedEnabledBtn.visible = true;
|
||||
this.fluidPrioritizedDisabledBtn.visible = false;
|
||||
}
|
||||
@@ -195,32 +197,30 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
}
|
||||
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX), 8, this.ySize - 96 + 2 - getReservedSpace(), 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX),
|
||||
8,
|
||||
this.ySize - 96 + 2 - getReservedSpace(),
|
||||
4210752);
|
||||
this.processingScrollBar.draw(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground()
|
||||
{
|
||||
protected String getBackground() {
|
||||
return container.inverted ? "gui/pattern4.png" : "gui/pattern3.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot( final AppEngSlot s )
|
||||
{
|
||||
if( s.isPlayerSide() )
|
||||
{
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
if (s.isPlayerSide()) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float btn )
|
||||
{
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
|
||||
if (container.substitute) {
|
||||
substitutionsEnabledBtn.visible = true;
|
||||
@@ -237,14 +237,14 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
fluidPrioritizedDisabledBtn.visible = true;
|
||||
}
|
||||
|
||||
final int offset = container.inverted? 18 * -3: 0;
|
||||
final int offset = container.inverted ? 18 * -3 : 0;
|
||||
|
||||
substitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
substitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
substitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
fluidPrioritizedEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
fluidPrioritizedDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
doubleBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
clearBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
clearBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
invertBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
combineEnableBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
combineDisableBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
@@ -255,8 +255,7 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked( final int xCoord, final int yCoord, final int btn )
|
||||
{
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||
this.processingScrollBar.click(this, xCoord - this.guiLeft, yCoord - this.guiTop);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
@@ -267,10 +266,9 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove( final int x, final int y, final int c, final long d )
|
||||
{
|
||||
protected void mouseClickMove(final int x, final int y, final int c, final long d) {
|
||||
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||
this.processingScrollBar.click(this, x - this.guiLeft, y - this.guiTop );
|
||||
this.processingScrollBar.click(this, x - this.guiLeft, y - this.guiTop);
|
||||
super.mouseClickMove(x, y, c, d);
|
||||
|
||||
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||
@@ -279,8 +277,7 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput()
|
||||
{
|
||||
public void handleMouseInput() {
|
||||
super.handleMouseInput();
|
||||
|
||||
final int wheel = Mouse.getEventDWheel();
|
||||
@@ -296,15 +293,12 @@ public class GuiBaseFluidPatternTerminalEx extends GuiFCBaseMonitor {
|
||||
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||
changeActivePage();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void changeActivePage()
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminalEx.ActivePage", String.valueOf(this.processingScrollBar.getCurrentScroll())));
|
||||
private void changeActivePage() {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminalEx.ActivePage", String.valueOf(this.processingScrollBar.getCurrentScroll())));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,6 @@ 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;
|
||||
|
||||
@@ -51,5 +50,4 @@ public class GuiBaseFluidTerminal extends GuiFCBaseFluidMonitor {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,59 +45,68 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void addButtons()
|
||||
{
|
||||
this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender );
|
||||
this.buttonList.add( this.priority );
|
||||
protected void addButtons() {
|
||||
this.priority =
|
||||
new GuiTabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender);
|
||||
this.buttonList.add(this.priority);
|
||||
|
||||
this.switcher = new GuiTabButton( this.guiLeft + 132, this.guiTop, host instanceof PartFluidInterface ? ItemAndBlockHolder.FLUID_INTERFACE.stack() : ItemAndBlockHolder.INTERFACE.stack(), StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"), itemRender );
|
||||
this.buttonList.add( this.switcher );
|
||||
this.switcher = new GuiTabButton(
|
||||
this.guiLeft + 132,
|
||||
this.guiTop,
|
||||
host instanceof PartFluidInterface
|
||||
? ItemAndBlockHolder.FLUID_INTERFACE.stack()
|
||||
: ItemAndBlockHolder.INTERFACE.stack(),
|
||||
StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"),
|
||||
itemRender);
|
||||
this.buttonList.add(this.switcher);
|
||||
|
||||
this.BlockMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO );
|
||||
this.buttonList.add( this.BlockMode );
|
||||
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO);
|
||||
this.buttonList.add(this.BlockMode);
|
||||
|
||||
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal() );
|
||||
this.buttonList.add( this.interfaceMode );
|
||||
this.interfaceMode = new GuiToggleButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + 26,
|
||||
84,
|
||||
85,
|
||||
GuiText.InterfaceTerminal.getLocal(),
|
||||
GuiText.InterfaceTerminalHint.getLocal());
|
||||
this.buttonList.add(this.interfaceMode);
|
||||
|
||||
this.insertionMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 44, Settings.INSERTION_MODE, InsertionMode.DEFAULT );
|
||||
this.buttonList.add( this.insertionMode );
|
||||
this.insertionMode =
|
||||
new GuiImgButton(this.guiLeft - 18, this.guiTop + 44, Settings.INSERTION_MODE, InsertionMode.DEFAULT);
|
||||
this.buttonList.add(this.insertionMode);
|
||||
|
||||
if (isTile()) {
|
||||
this.sidelessMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 62, Settings.SIDELESS_MODE, SidelessMode.SIDELESS);
|
||||
this.buttonList.add( this.sidelessMode );
|
||||
this.sidelessMode = new GuiImgButton(
|
||||
this.guiLeft - 18, this.guiTop + 62, Settings.SIDELESS_MODE, SidelessMode.SIDELESS);
|
||||
this.buttonList.add(this.sidelessMode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
if( this.BlockMode != null )
|
||||
{
|
||||
this.BlockMode.set( ( (ContainerInterface) this.cvb ).getBlockingMode() );
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
if (this.BlockMode != null) {
|
||||
this.BlockMode.set(((ContainerInterface) this.cvb).getBlockingMode());
|
||||
}
|
||||
|
||||
if( this.interfaceMode != null )
|
||||
{
|
||||
this.interfaceMode.setState( ( (ContainerInterface) this.cvb ).getInterfaceTerminalMode() == YesNo.YES );
|
||||
if (this.interfaceMode != null) {
|
||||
this.interfaceMode.setState(((ContainerInterface) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
|
||||
}
|
||||
if( this.insertionMode != null )
|
||||
{
|
||||
this.insertionMode.set( ( (ContainerInterface) this.cvb ).getInsertionMode());
|
||||
if (this.insertionMode != null) {
|
||||
this.insertionMode.set(((ContainerInterface) this.cvb).getInsertionMode());
|
||||
}
|
||||
if (this.sidelessMode != null) {
|
||||
this.sidelessMode.set( ( (ContainerDualInterface) this.cvb ).getSidelessMode());
|
||||
this.sidelessMode.set(((ContainerDualInterface) this.cvb).getSidelessMode());
|
||||
}
|
||||
|
||||
this.fontRendererObj.drawString( getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 4210752 );
|
||||
this.fontRendererObj.drawString(
|
||||
getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground()
|
||||
{
|
||||
if (!ModAndClassUtil.isBigInterface)
|
||||
return "guis/interface.png";
|
||||
switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled())
|
||||
{
|
||||
protected String getBackground() {
|
||||
if (!ModAndClassUtil.isBigInterface) return "guis/interface.png";
|
||||
switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
|
||||
case 1:
|
||||
return "guis/interface2.png";
|
||||
case 2:
|
||||
@@ -109,48 +118,39 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
final boolean backwards = Mouse.isButtonDown( 1 );
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
|
||||
if( btn == this.priority )
|
||||
{
|
||||
if (btn == this.priority) {
|
||||
if (isTile()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.DUAL_INTERFACE_PRIORITY));
|
||||
}
|
||||
else if(isPart()) {
|
||||
} else if (isPart()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.DUAL_INTERFACE_PRIORITY_PART));
|
||||
}
|
||||
}
|
||||
|
||||
if( btn == this.switcher )
|
||||
{
|
||||
if (btn == this.switcher) {
|
||||
if (isTile()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.DUAL_INTERFACE_FLUID));
|
||||
}
|
||||
else if (isPart()) {
|
||||
} else if (isPart()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.DUAL_INTERFACE_FLUID_PART));
|
||||
}
|
||||
}
|
||||
|
||||
if( btn == this.interfaceMode )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.INTERFACE_TERMINAL, backwards ) );
|
||||
if (btn == this.interfaceMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.INTERFACE_TERMINAL, backwards));
|
||||
}
|
||||
|
||||
if( btn == this.BlockMode )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.BlockMode.getSetting(), backwards ) );
|
||||
if (btn == this.BlockMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
|
||||
}
|
||||
if( btn == this.insertionMode )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.insertionMode.getSetting(), backwards ) );
|
||||
if (btn == this.insertionMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.insertionMode.getSetting(), backwards));
|
||||
}
|
||||
if (btn == this.sidelessMode && this.sidelessMode != null)
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.sidelessMode.getSetting(), backwards ) );
|
||||
if (btn == this.sidelessMode && this.sidelessMode != null) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.sidelessMode.getSetting(), backwards));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ 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 java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -51,11 +54,8 @@ 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 class GuiFCBaseFluidMonitor extends AEBaseMEGui
|
||||
implements ISortSource, IConfigManagerHost, IDropToFillTextField {
|
||||
|
||||
public static int craftingGridOffsetX;
|
||||
public static int craftingGridOffsetY;
|
||||
@@ -84,7 +84,8 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
private GuiImgButton terminalStyleBox;
|
||||
private GuiImgButton searchStringSave;
|
||||
|
||||
public GuiFCBaseFluidMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCBaseFluidMonitorContain c) {
|
||||
public GuiFCBaseFluidMonitor(
|
||||
final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCBaseFluidMonitorContain c) {
|
||||
|
||||
super(c);
|
||||
|
||||
@@ -101,7 +102,6 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
(this.monitorableContainer = (FCBaseFluidMonitorContain) this.inventorySlots).setGui(this);
|
||||
|
||||
this.viewCell = te instanceof IViewCellStorage;
|
||||
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEFluidStack> list) {
|
||||
@@ -117,7 +117,9 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
|
||||
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));
|
||||
this.getScrollBar()
|
||||
.setRange(
|
||||
0, (this.repo.size() + this.perRow - 1) / this.perRow - this.rows, Math.max(1, this.rows / 6));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +135,8 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
final GuiImgButton iBtn = (GuiImgButton) btn;
|
||||
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||
final Enum<?> cv = iBtn.getCurrentValue();
|
||||
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||
final Enum<?> next =
|
||||
Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||
|
||||
if (btn == this.terminalStyleBox) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
@@ -143,7 +146,8 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
|
||||
} else {
|
||||
try {
|
||||
NetworkHandler.instance.sendToServer(new PacketValueConfig(iBtn.getSetting().name(), next.name()));
|
||||
NetworkHandler.instance.sendToServer(
|
||||
new PacketValueConfig(iBtn.getSetting().name(), next.name()));
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
@@ -169,7 +173,9 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -196,7 +202,8 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
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));
|
||||
this.getMeSlots()
|
||||
.add(new InternalSlotME(this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,28 +226,52 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
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)));
|
||||
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.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)));
|
||||
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)));
|
||||
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));
|
||||
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)));
|
||||
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 = 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);
|
||||
@@ -249,10 +280,25 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
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)));
|
||||
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.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 //
|
||||
}
|
||||
}
|
||||
@@ -303,7 +349,8 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
|
||||
@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(
|
||||
this.getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_TERMINAL)), 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||
}
|
||||
|
||||
@@ -340,11 +387,11 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
direction = TextHistory.Direction.NEXT;
|
||||
}
|
||||
history.get(direction, this.searchField.getText())
|
||||
.map(newText -> {
|
||||
setSearchString(newText, true);
|
||||
return true;
|
||||
})
|
||||
.orElse(false);
|
||||
.map(newText -> {
|
||||
setSearchString(newText, true);
|
||||
return true;
|
||||
})
|
||||
.orElse(false);
|
||||
return;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
}
|
||||
@@ -364,14 +411,16 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
IAEItemStack stack = AEItemStack.create(slot.getStack());
|
||||
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, Ae2ReflectClient.getInventorySlots(this).size(), 0, 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;
|
||||
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) {
|
||||
@@ -449,20 +498,19 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
|
||||
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;
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -475,7 +523,10 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
}
|
||||
|
||||
if (action != null) {
|
||||
final PacketInventoryAction p = new PacketInventoryAction(action, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
||||
final PacketInventoryAction p = new PacketInventoryAction(
|
||||
action,
|
||||
slot.getSlotIndex(),
|
||||
((SlotDisconnected) slot).getSlot().getId());
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
|
||||
@@ -491,7 +542,10 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
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) {
|
||||
if (stack != null
|
||||
&& action == InventoryAction.PICKUP_OR_SET_DOWN
|
||||
&& stack.getStackSize() == 0
|
||||
&& player.inventory.getItemStack() == null) {
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
}
|
||||
|
||||
@@ -502,7 +556,6 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
break;
|
||||
|
||||
case 3: // creative dupe:
|
||||
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
if (stack.getItem() instanceof ItemFluidDrop) {
|
||||
stack = ItemFluidDrop.newAeStack(ItemFluidDrop.getAeFluidStack(stack));
|
||||
@@ -524,10 +577,12 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
|
||||
if (action == InventoryAction.AUTO_CRAFT) {
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, Ae2ReflectClient.getInventorySlots(this).size(), 0, 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);
|
||||
final PacketInventoryAction p = new PacketInventoryAction(
|
||||
action, Ae2ReflectClient.getInventorySlots(this).size(), 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
|
||||
@@ -564,15 +619,23 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
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);
|
||||
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()) {
|
||||
if (this.myCurrentViewCells[i]
|
||||
!= this.monitorableContainer.getCellViewSlot(i).getStack()) {
|
||||
update = true;
|
||||
this.myCurrentViewCells[i] = this.monitorableContainer.getCellViewSlot(i).getStack();
|
||||
this.myCurrentViewCells[i] =
|
||||
this.monitorableContainer.getCellViewSlot(i).getStack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +659,9 @@ public class GuiFCBaseFluidMonitor extends AEBaseMEGui implements ISortSource, I
|
||||
}
|
||||
|
||||
int getMaxRows() {
|
||||
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
|
||||
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL
|
||||
? 6
|
||||
: Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
|
||||
@@ -36,6 +36,9 @@ import com.glodblock.github.client.gui.container.FCBaseMonitorContain;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -46,10 +49,6 @@ 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 GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfigManagerHost, IDropToFillTextField {
|
||||
|
||||
public static int craftingGridOffsetX;
|
||||
@@ -79,113 +78,98 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
private GuiImgButton terminalStyleBox;
|
||||
private GuiImgButton searchStringSave;
|
||||
|
||||
public GuiFCBaseMonitor( final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCBaseMonitorContain c )
|
||||
{
|
||||
public GuiFCBaseMonitor(
|
||||
final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCBaseMonitorContain c) {
|
||||
|
||||
super( c );
|
||||
super(c);
|
||||
|
||||
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||
this.setScrollBar( scrollbar );
|
||||
this.repo = new ItemRepo( scrollbar, this );
|
||||
this.setScrollBar(scrollbar);
|
||||
this.repo = new ItemRepo(scrollbar, this);
|
||||
|
||||
this.xSize = 195;
|
||||
this.ySize = 204;
|
||||
|
||||
this.standardSize = this.xSize;
|
||||
|
||||
this.configSrc = ( (IConfigurableObject) this.inventorySlots ).getConfigManager();
|
||||
( this.monitorableContainer = (FCBaseMonitorContain) this.inventorySlots ).setGui( this );
|
||||
this.configSrc = ((IConfigurableObject) this.inventorySlots).getConfigManager();
|
||||
(this.monitorableContainer = (FCBaseMonitorContain) this.inventorySlots).setGui(this);
|
||||
|
||||
this.viewCell = te instanceof IViewCellStorage;
|
||||
|
||||
}
|
||||
|
||||
public void postUpdate( final List<IAEItemStack> list )
|
||||
{
|
||||
for( final IAEItemStack is : list )
|
||||
{
|
||||
this.repo.postUpdate( is );
|
||||
public void postUpdate(final List<IAEItemStack> list) {
|
||||
for (final IAEItemStack is : list) {
|
||||
this.repo.postUpdate(is);
|
||||
}
|
||||
|
||||
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 ) );
|
||||
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 )
|
||||
{
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
|
||||
if( btn == this.craftingStatusBtn || btn == this.craftingStatusImgBtn )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
|
||||
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 );
|
||||
if (btn instanceof GuiImgButton) {
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
|
||||
final GuiImgButton iBtn = (GuiImgButton) btn;
|
||||
if( iBtn.getSetting() != Settings.ACTIONS )
|
||||
{
|
||||
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||
final Enum<?> cv = iBtn.getCurrentValue();
|
||||
final Enum<?> next = Platform.rotateEnum( cv, backwards, iBtn.getSetting().getPossibleValues() );
|
||||
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 )
|
||||
{
|
||||
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 );
|
||||
} else {
|
||||
try {
|
||||
NetworkHandler.instance.sendToServer(
|
||||
new PacketValueConfig(iBtn.getSetting().name(), next.name()));
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
iBtn.set( next );
|
||||
iBtn.set(next);
|
||||
|
||||
if( next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class )
|
||||
{
|
||||
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
|
||||
this.reinitalize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reinitalize()
|
||||
{
|
||||
private void reinitalize() {
|
||||
this.buttonList.clear();
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui()
|
||||
{
|
||||
Keyboard.enableRepeatEvents( true );
|
||||
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 );
|
||||
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 boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
|
||||
|
||||
final int NEI = hasNEI ? 0 : 0;
|
||||
int top = hasNEI ? 22 : 0;
|
||||
@@ -193,38 +177,31 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
final int magicNumber = 114 + 1;
|
||||
final int extraSpace = this.height - magicNumber - NEI - top - this.reservedSpace;
|
||||
|
||||
this.rows = (int) Math.floor( extraSpace / 18.0 );
|
||||
if( this.rows > this.maxRows )
|
||||
{
|
||||
top += ( this.rows - this.maxRows ) * 18 / 2;
|
||||
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 )
|
||||
{
|
||||
if (hasNEI) {
|
||||
this.rows--;
|
||||
}
|
||||
|
||||
if( this.rows < 3 )
|
||||
{
|
||||
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 ) );
|
||||
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
|
||||
{
|
||||
if (AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL) {
|
||||
this.xSize = this.standardSize + ((this.perRow - 9) * 18);
|
||||
} else {
|
||||
this.xSize = this.standardSize;
|
||||
}
|
||||
|
||||
@@ -236,61 +213,97 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
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 ) );
|
||||
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 ) ) );
|
||||
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 ) ) );
|
||||
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 ) ) );
|
||||
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 ) ) );
|
||||
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 ) );
|
||||
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 ) ) );
|
||||
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 );
|
||||
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)));
|
||||
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 //
|
||||
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 );
|
||||
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()))
|
||||
{
|
||||
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || this.isSubGui())) {
|
||||
setSearchString(memoryText, false);
|
||||
}
|
||||
if( this.isSubGui() )
|
||||
{
|
||||
if (this.isSubGui()) {
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
}
|
||||
@@ -298,23 +311,18 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
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 );
|
||||
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)
|
||||
{
|
||||
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 );
|
||||
if (g.xDisplayPosition > 0 && g.yDisplayPosition > 0) {
|
||||
craftingGridOffsetX = Math.min(craftingGridOffsetX, g.xDisplayPosition);
|
||||
craftingGridOffsetY = Math.min(craftingGridOffsetY, g.yDisplayPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,26 +331,23 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
craftingGridOffsetY -= 6;
|
||||
}
|
||||
|
||||
public void setSearchString(String memoryText, boolean updateView)
|
||||
{
|
||||
public void setSearchString(String memoryText, boolean updateView) {
|
||||
this.searchField.setText(memoryText);
|
||||
this.repo.setSearchString(memoryText);
|
||||
if (updateView)
|
||||
{
|
||||
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( GuiText.Terminal.getLocal() ), 8, 6, 4210752 );
|
||||
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(this.getGuiDisplayName(GuiText.Terminal.getLocal()), 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 ) {
|
||||
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();
|
||||
@@ -376,11 +381,11 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
direction = TextHistory.Direction.NEXT;
|
||||
}
|
||||
history.get(direction, this.searchField.getText())
|
||||
.map(newText -> {
|
||||
setSearchString(newText, true);
|
||||
return true;
|
||||
})
|
||||
.orElse(false);
|
||||
.map(newText -> {
|
||||
setSearchString(newText, true);
|
||||
return true;
|
||||
})
|
||||
.orElse(false);
|
||||
return;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
}
|
||||
@@ -395,7 +400,7 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
|
||||
if (mouseButton == 3) {
|
||||
if (this instanceof GuiBaseFluidPatternTerminal
|
||||
&& ((GuiBaseFluidPatternTerminal) this).container.isCraftingMode()) {
|
||||
&& ((GuiBaseFluidPatternTerminal) this).container.isCraftingMode()) {
|
||||
return;
|
||||
}
|
||||
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
||||
@@ -404,128 +409,107 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
IAEItemStack stack = AEItemStack.create(slot.getStack());
|
||||
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, Ae2ReflectClient.getInventorySlots(this).size(), 0, 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 (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 {
|
||||
} else {
|
||||
action = InventoryAction.PICKUP_SINGLE;
|
||||
}
|
||||
}
|
||||
|
||||
if( Ae2ReflectClient.getDragClick(this).size() > 1 )
|
||||
{
|
||||
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
|
||||
NetworkHandler.instance.sendToServer( p );
|
||||
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( slot instanceof SlotPatternTerm)
|
||||
{
|
||||
if( mouseButton == 6 )
|
||||
{
|
||||
if (slot instanceof SlotPatternTerm) {
|
||||
if (mouseButton == 6) {
|
||||
return; // prevent weird double clicks..
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( ( (SlotPatternTerm) slot ).getRequest( isShiftKeyDown() ) );
|
||||
try {
|
||||
NetworkHandler.instance.sendToServer(((SlotPatternTerm) slot).getRequest(isShiftKeyDown()));
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
else if( slot instanceof SlotCraftingTerm )
|
||||
{
|
||||
if( mouseButton == 6 )
|
||||
{
|
||||
} else if (slot instanceof SlotCraftingTerm) {
|
||||
if (mouseButton == 6) {
|
||||
return; // prevent weird double clicks..
|
||||
}
|
||||
|
||||
InventoryAction action;
|
||||
if( isShiftKeyDown() )
|
||||
{
|
||||
if (isShiftKeyDown()) {
|
||||
action = InventoryAction.CRAFT_SHIFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Craft stack on right-click, craft single on left-click
|
||||
action = ( mouseButton == 1 ) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
|
||||
action = (mouseButton == 1) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
|
||||
}
|
||||
|
||||
final PacketInventoryAction p = new PacketInventoryAction( action, slotIdx, 0 );
|
||||
NetworkHandler.instance.sendToServer( p );
|
||||
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 ) )
|
||||
{
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
|
||||
if (this.enableSpaceClicking() && !(slot instanceof SlotPatternTerm)) {
|
||||
IAEItemStack stack = null;
|
||||
if( slot instanceof SlotME )
|
||||
{
|
||||
stack = ( (SlotME) slot ).getAEStack();
|
||||
if (slot instanceof SlotME) {
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
}
|
||||
|
||||
int slotNum = Ae2ReflectClient.getInventorySlots(this).size();
|
||||
|
||||
if( !( slot instanceof SlotME ) && slot != null )
|
||||
{
|
||||
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 );
|
||||
((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 )
|
||||
{
|
||||
if (slot instanceof SlotDisconnected) {
|
||||
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
InventoryAction action = null;
|
||||
|
||||
switch( mouseButton )
|
||||
{
|
||||
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;
|
||||
{
|
||||
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 )
|
||||
{
|
||||
if (player.capabilities.isCreativeMode) {
|
||||
action = InventoryAction.CREATIVE_DUPLICATE;
|
||||
}
|
||||
|
||||
@@ -536,49 +520,46 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
case 6:
|
||||
}
|
||||
|
||||
if( action != null )
|
||||
{
|
||||
final PacketInventoryAction p = new PacketInventoryAction( action, slot.getSlotIndex(), ( (SlotDisconnected) slot ).getSlot().getId() );
|
||||
NetworkHandler.instance.sendToServer( p );
|
||||
if (action != null) {
|
||||
final PacketInventoryAction p = new PacketInventoryAction(
|
||||
action,
|
||||
slot.getSlotIndex(),
|
||||
((SlotDisconnected) slot).getSlot().getId());
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( slot instanceof SlotME )
|
||||
{
|
||||
if (slot instanceof SlotME) {
|
||||
InventoryAction action = null;
|
||||
IAEItemStack stack = null;
|
||||
|
||||
switch( mouseButton )
|
||||
{
|
||||
switch (mouseButton) {
|
||||
case 0: // pickup / set-down.
|
||||
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
stack = ( (SlotME) slot ).getAEStack();
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
|
||||
if( stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack() == null )
|
||||
{
|
||||
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();
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
break;
|
||||
|
||||
case 3: // creative dupe:
|
||||
|
||||
stack = ( (SlotME) slot ).getAEStack();
|
||||
if( stack != null && stack.isCraftable() )
|
||||
{
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
if (stack != null && stack.isCraftable()) {
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
}
|
||||
else if( player.capabilities.isCreativeMode )
|
||||
{
|
||||
final IAEItemStack slotItem = ( (SlotME) slot ).getAEStack();
|
||||
if( slotItem != null )
|
||||
{
|
||||
} else if (player.capabilities.isCreativeMode) {
|
||||
final IAEItemStack slotItem = ((SlotME) slot).getAEStack();
|
||||
if (slotItem != null) {
|
||||
action = InventoryAction.CREATIVE_DUPLICATE;
|
||||
}
|
||||
}
|
||||
@@ -590,214 +571,189 @@ public class GuiFCBaseMonitor extends AEBaseMEGui implements ISortSource, IConfi
|
||||
}
|
||||
|
||||
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 );
|
||||
((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 );
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed()
|
||||
{
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents( false );
|
||||
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 );
|
||||
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 )
|
||||
{
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
|
||||
this.bindTextureBack( this.getBackground() );
|
||||
this.bindTextureBack(this.getBackground());
|
||||
final int x_width = 195;
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, x_width, 18);
|
||||
|
||||
if( this.viewCell )
|
||||
{
|
||||
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
|
||||
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 );
|
||||
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 );
|
||||
this.drawTexturedModalRect(
|
||||
offsetX,
|
||||
offsetY + 16 + this.rows * 18 + this.lowerTextureOffset,
|
||||
0,
|
||||
106 - 18 - 18,
|
||||
x_width,
|
||||
99 + this.reservedSpace - this.lowerTextureOffset);
|
||||
|
||||
if( this.viewCell )
|
||||
{
|
||||
if (this.viewCell) {
|
||||
boolean update = false;
|
||||
|
||||
for( int i = 0; i < 5; i++ )
|
||||
{
|
||||
if( this.myCurrentViewCells[i] != this.monitorableContainer.getCellViewSlot( i ).getStack() )
|
||||
{
|
||||
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();
|
||||
this.myCurrentViewCells[i] =
|
||||
this.monitorableContainer.getCellViewSlot(i).getStack();
|
||||
}
|
||||
}
|
||||
|
||||
if( update )
|
||||
{
|
||||
this.repo.setViewCell( this.myCurrentViewCells );
|
||||
if (update) {
|
||||
this.repo.setViewCell(this.myCurrentViewCells);
|
||||
}
|
||||
}
|
||||
|
||||
if( this.searchField != null )
|
||||
{
|
||||
if (this.searchField != null) {
|
||||
this.searchField.drawTextBox();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
protected String getBackground() {
|
||||
return "gui/terminal.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isPowered()
|
||||
{
|
||||
protected boolean isPowered() {
|
||||
return this.repo.hasPower();
|
||||
}
|
||||
|
||||
int getMaxRows()
|
||||
{
|
||||
return AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
|
||||
int getMaxRows() {
|
||||
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL
|
||||
? 6
|
||||
: Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
protected void repositionSlot( final AppEngSlot s )
|
||||
{
|
||||
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() )
|
||||
{
|
||||
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() );
|
||||
if (this.searchField.textboxKeyTyped(character, key)) {
|
||||
this.repo.setSearchString(this.searchField.getText());
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
} else {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen()
|
||||
{
|
||||
this.repo.setPower( this.monitorableContainer.isPowered() );
|
||||
public void updateScreen() {
|
||||
this.repo.setPower(this.monitorableContainer.isPowered());
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getSortBy()
|
||||
{
|
||||
return this.configSrc.getSetting( Settings.SORT_BY );
|
||||
public Enum<?> getSortBy() {
|
||||
return this.configSrc.getSetting(Settings.SORT_BY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getSortDir()
|
||||
{
|
||||
return this.configSrc.getSetting( Settings.SORT_DIRECTION );
|
||||
public Enum<?> getSortDir() {
|
||||
return this.configSrc.getSetting(Settings.SORT_DIRECTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getSortDisplay()
|
||||
{
|
||||
return this.configSrc.getSetting( Settings.VIEW_MODE );
|
||||
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 ) );
|
||||
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.SortDirBox != null) {
|
||||
this.SortDirBox.set(this.configSrc.getSetting(Settings.SORT_DIRECTION));
|
||||
}
|
||||
|
||||
if( this.ViewBox != null )
|
||||
{
|
||||
this.ViewBox.set( this.configSrc.getSetting( Settings.VIEW_MODE ) );
|
||||
if (this.ViewBox != null) {
|
||||
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
||||
}
|
||||
|
||||
this.repo.updateView();
|
||||
}
|
||||
|
||||
public int getReservedSpace()
|
||||
{
|
||||
public int getReservedSpace() {
|
||||
return this.reservedSpace;
|
||||
}
|
||||
|
||||
public void setReservedSpace( final int reservedSpace )
|
||||
{
|
||||
public void setReservedSpace(final int reservedSpace) {
|
||||
this.reservedSpace = reservedSpace;
|
||||
}
|
||||
|
||||
public boolean isCustomSortOrder()
|
||||
{
|
||||
public boolean isCustomSortOrder() {
|
||||
return this.customSortOrder;
|
||||
}
|
||||
|
||||
public void setCustomSortOrder( final boolean customSortOrder )
|
||||
{
|
||||
public void setCustomSortOrder(final boolean customSortOrder) {
|
||||
this.customSortOrder = customSortOrder;
|
||||
}
|
||||
|
||||
public int getStandardSize()
|
||||
{
|
||||
public int getStandardSize() {
|
||||
return this.standardSize;
|
||||
}
|
||||
|
||||
public void setStandardSize( final int standardSize )
|
||||
{
|
||||
public void setStandardSize(final int standardSize) {
|
||||
this.standardSize = standardSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float btn ) {
|
||||
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 isOverSearchField(int x, int y) {
|
||||
return searchField.isMouseIn(x, y);
|
||||
}
|
||||
|
||||
public boolean hideItemPanelSlot(int tx, int ty, int tw, int th)
|
||||
{
|
||||
public boolean hideItemPanelSlot(int tx, int ty, int tw, int th) {
|
||||
|
||||
if (this.viewCell) {
|
||||
int rw = 33;
|
||||
|
||||
@@ -3,19 +3,18 @@ package com.glodblock.github.client.gui;
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
|
||||
private static final Pattern COMPILE = Pattern.compile( "%s" );
|
||||
private static final Pattern PATTERN_NEW_LINE = Pattern.compile( "\\n", Pattern.LITERAL );
|
||||
private static final Pattern COMPILE = Pattern.compile("%s");
|
||||
private static final Pattern PATTERN_NEW_LINE = Pattern.compile("\\n", Pattern.LITERAL);
|
||||
private static Map<EnumPair, ButtonAppearance> appearances;
|
||||
private final String buttonSetting;
|
||||
private boolean halfSize = false;
|
||||
@@ -23,7 +22,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
private String currentValue;
|
||||
private static final String prefix = NameConst.TT_KEY;
|
||||
|
||||
public GuiFCImgButton( final int x, final int y, final String idx, final String val ) {
|
||||
public GuiFCImgButton(final int x, final int y, final String idx, final String val) {
|
||||
super(0, 0, 16, "");
|
||||
|
||||
this.buttonSetting = idx;
|
||||
@@ -33,7 +32,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
this.width = 16;
|
||||
this.height = 16;
|
||||
|
||||
if( appearances == null ) {
|
||||
if (appearances == null) {
|
||||
appearances = new HashMap<>();
|
||||
this.registerApp(0, "NOT_COMBINE", "DONT_COMBINE", "not_combine");
|
||||
this.registerApp(1, "FORCE_COMBINE", "DO_COMBINE", "combine");
|
||||
@@ -45,7 +44,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if (StatCollector.translateToLocal(prefix + title + ".hint").equals(prefix + title + ".hint")) {
|
||||
@@ -57,19 +56,15 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
appearances.put(new EnumPair(setting, val), a);
|
||||
}
|
||||
|
||||
public void setVisibility( final boolean vis )
|
||||
{
|
||||
public void setVisibility(final boolean vis) {
|
||||
this.visible = vis;
|
||||
this.enabled = vis;
|
||||
}
|
||||
|
||||
private int getIconIndex()
|
||||
{
|
||||
if( this.buttonSetting != null && this.currentValue != null )
|
||||
{
|
||||
final ButtonAppearance app = appearances.get(new EnumPair( this.buttonSetting, this.currentValue ));
|
||||
if( app == null )
|
||||
{
|
||||
private int getIconIndex() {
|
||||
if (this.buttonSetting != null && this.currentValue != null) {
|
||||
final ButtonAppearance app = appearances.get(new EnumPair(this.buttonSetting, this.currentValue));
|
||||
if (app == null) {
|
||||
return 8;
|
||||
}
|
||||
return app.index;
|
||||
@@ -77,92 +72,77 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public String getSetting()
|
||||
{
|
||||
public String getSetting() {
|
||||
return this.buttonSetting;
|
||||
}
|
||||
|
||||
public String getCurrentValue()
|
||||
{
|
||||
public String getCurrentValue() {
|
||||
return this.currentValue;
|
||||
}
|
||||
|
||||
public void set( final String e )
|
||||
{
|
||||
if(!this.currentValue.equals(e))
|
||||
{
|
||||
public void set(final String e) {
|
||||
if (!this.currentValue.equals(e)) {
|
||||
this.currentValue = e;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isHalfSize()
|
||||
{
|
||||
public boolean isHalfSize() {
|
||||
return this.halfSize;
|
||||
}
|
||||
|
||||
public void setHalfSize( final boolean halfSize )
|
||||
{
|
||||
public void setHalfSize(final boolean halfSize) {
|
||||
this.halfSize = halfSize;
|
||||
}
|
||||
|
||||
public String getFillVar()
|
||||
{
|
||||
public String getFillVar() {
|
||||
return this.fillVar;
|
||||
}
|
||||
|
||||
public void setFillVar( final String fillVar )
|
||||
{
|
||||
public void setFillVar(final String fillVar) {
|
||||
this.fillVar = fillVar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos()
|
||||
{
|
||||
public int xPos() {
|
||||
return this.xPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos()
|
||||
{
|
||||
public int yPos() {
|
||||
return this.yPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
public int getWidth() {
|
||||
return this.halfSize ? 8 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
public int getHeight() {
|
||||
return this.halfSize ? 8 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
{
|
||||
public boolean isVisible() {
|
||||
return this.visible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
public String getMessage() {
|
||||
String displayName = null;
|
||||
String displayValue = null;
|
||||
|
||||
if( this.buttonSetting != null && this.currentValue != null )
|
||||
{
|
||||
final ButtonAppearance buttonAppearance = appearances.get( new EnumPair( this.buttonSetting, this.currentValue ) );
|
||||
if( buttonAppearance == null )
|
||||
{
|
||||
if (this.buttonSetting != null && this.currentValue != null) {
|
||||
final ButtonAppearance buttonAppearance =
|
||||
appearances.get(new EnumPair(this.buttonSetting, this.currentValue));
|
||||
if (buttonAppearance == null) {
|
||||
return "No Such Message";
|
||||
}
|
||||
displayName = buttonAppearance.displayName;
|
||||
displayValue = buttonAppearance.displayValue;
|
||||
}
|
||||
|
||||
if( displayName != null ) {
|
||||
if (displayName != null) {
|
||||
String name = StatCollector.translateToLocal(displayName);
|
||||
if (name == null || name.isEmpty()) {
|
||||
name = displayName;
|
||||
@@ -192,38 +172,47 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(final Minecraft par1Minecraft, final int par2, final int par3 )
|
||||
{
|
||||
if( this.visible )
|
||||
{
|
||||
public void drawButton(final Minecraft par1Minecraft, final int par2, final int par3) {
|
||||
if (this.visible) {
|
||||
final int iconIndex = this.getIconIndex();
|
||||
|
||||
if( this.halfSize )
|
||||
{
|
||||
if (this.halfSize) {
|
||||
this.width = 8;
|
||||
this.height = 8;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef( this.xPosition, this.yPosition, 0.0F );
|
||||
GL11.glScalef( 0.5f / 16 * 3, 0.5f / 16 * 3, 0.5f / 16 * 3 );
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * 3, 0.5f / 16 * 3, 0.5f / 16 * 3);
|
||||
|
||||
if( this.enabled )
|
||||
{
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
|
||||
if (this.enabled) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
} else {
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture( FluidCraft.resource("textures/gui/states.png") );
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
|
||||
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states.png"));
|
||||
this.field_146123_n = par2 >= this.xPosition
|
||||
&& par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
|
||||
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||
final int uv_x = iconIndex - uv_y * 3;
|
||||
|
||||
this.drawTexturedModalRect(0, 0, Math.round(32F * 16F / 3F), Math.round(32F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F));
|
||||
this.drawTexturedModalRect(0, 0, Math.round(uv_x * 16F * 16F / 3F), Math.round(uv_y * 16F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F));
|
||||
this.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();
|
||||
@@ -238,47 +227,56 @@ 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;
|
||||
this.field_146123_n = par2 >= this.xPosition
|
||||
&& par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
|
||||
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||
final int uv_x = iconIndex - uv_y * 3;
|
||||
|
||||
this.drawTexturedModalRect(0, 0, Math.round(32F * 16F / 3F), Math.round(32F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F));
|
||||
this.drawTexturedModalRect(0, 0, Math.round(uv_x * 16F * 16F / 3F), Math.round(uv_y * 16F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F));
|
||||
this.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 );
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
private static final class EnumPair
|
||||
{
|
||||
private static final class EnumPair {
|
||||
|
||||
final String setting;
|
||||
final String value;
|
||||
|
||||
EnumPair( final String a, final String b )
|
||||
{
|
||||
EnumPair(final String a, final String b) {
|
||||
this.setting = a;
|
||||
this.value = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
public int hashCode() {
|
||||
return this.setting.hashCode() ^ this.value.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( final Object obj )
|
||||
{
|
||||
if( obj == null )
|
||||
{
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if( this.getClass() != obj.getClass() )
|
||||
{
|
||||
if (this.getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final EnumPair other = (EnumPair) obj;
|
||||
@@ -286,12 +284,9 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class ButtonAppearance
|
||||
{
|
||||
private static class ButtonAppearance {
|
||||
public int index;
|
||||
public String displayName;
|
||||
public String displayValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,14 +17,12 @@ import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketSwitchGuis;
|
||||
import java.io.IOException;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GuiFCPriority extends AEBaseGui
|
||||
{
|
||||
public class GuiFCPriority extends AEBaseGui {
|
||||
|
||||
private GuiNumberBox priority;
|
||||
private GuiTabButton originalGuiBtn;
|
||||
@@ -40,180 +38,162 @@ public class GuiFCPriority extends AEBaseGui
|
||||
|
||||
private GuiType OriginalGui;
|
||||
|
||||
public GuiFCPriority( final InventoryPlayer inventoryPlayer, final IPriorityHost te )
|
||||
{
|
||||
super( new ContainerPriority( inventoryPlayer, te ) );
|
||||
public GuiFCPriority(final InventoryPlayer inventoryPlayer, final IPriorityHost te) {
|
||||
super(new ContainerPriority(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
final int a = AEConfig.instance.priorityByStacksAmounts( 0 );
|
||||
final int b = AEConfig.instance.priorityByStacksAmounts( 1 );
|
||||
final int c = AEConfig.instance.priorityByStacksAmounts( 2 );
|
||||
final int d = AEConfig.instance.priorityByStacksAmounts( 3 );
|
||||
final int a = AEConfig.instance.priorityByStacksAmounts(0);
|
||||
final int b = AEConfig.instance.priorityByStacksAmounts(1);
|
||||
final int c = AEConfig.instance.priorityByStacksAmounts(2);
|
||||
final int d = AEConfig.instance.priorityByStacksAmounts(3);
|
||||
|
||||
this.buttonList.add( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 32, 22, 20, "+" + a ) );
|
||||
this.buttonList.add( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 32, 28, 20, "+" + b ) );
|
||||
this.buttonList.add( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c ) );
|
||||
this.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d ) );
|
||||
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 32, 22, 20, "+" + a));
|
||||
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 32, 28, 20, "+" + b));
|
||||
this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c));
|
||||
this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d));
|
||||
|
||||
|
||||
this.buttonList.add( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a ) );
|
||||
this.buttonList.add( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b ) );
|
||||
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
|
||||
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
|
||||
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a));
|
||||
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b));
|
||||
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c));
|
||||
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d));
|
||||
|
||||
ItemStack myIcon = null;
|
||||
final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
|
||||
final Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
|
||||
|
||||
if( target instanceof TileFluidInterface)
|
||||
{
|
||||
if (target instanceof TileFluidInterface) {
|
||||
myIcon = ItemAndBlockHolder.INTERFACE.stack();
|
||||
this.OriginalGui = GuiType.DUAL_INTERFACE;
|
||||
}
|
||||
else if (target instanceof PartFluidInterface)
|
||||
{
|
||||
} else if (target instanceof PartFluidInterface) {
|
||||
myIcon = ItemAndBlockHolder.FLUID_INTERFACE.stack();
|
||||
this.OriginalGui = GuiType.DUAL_INTERFACE_FLUID_PART;
|
||||
}
|
||||
|
||||
if( this.OriginalGui != null && myIcon != null )
|
||||
{
|
||||
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) );
|
||||
if (this.OriginalGui != null && myIcon != null) {
|
||||
this.buttonList.add(
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
|
||||
}
|
||||
|
||||
this.priority = new GuiNumberBox( this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT, Long.class );
|
||||
this.priority.setEnableBackgroundDrawing( false );
|
||||
this.priority.setMaxStringLength( 16 );
|
||||
this.priority.setTextColor( 0xFFFFFF );
|
||||
this.priority.setVisible( true );
|
||||
this.priority.setFocused( true );
|
||||
( (ContainerPriority) this.inventorySlots ).setTextField( this.priority );
|
||||
this.priority = new GuiNumberBox(
|
||||
this.fontRendererObj,
|
||||
this.guiLeft + 62,
|
||||
this.guiTop + 57,
|
||||
59,
|
||||
this.fontRendererObj.FONT_HEIGHT,
|
||||
Long.class);
|
||||
this.priority.setEnableBackgroundDrawing(false);
|
||||
this.priority.setMaxStringLength(16);
|
||||
this.priority.setTextColor(0xFFFFFF);
|
||||
this.priority.setVisible(true);
|
||||
this.priority.setFocused(true);
|
||||
((ContainerPriority) this.inventorySlots).setTextField(this.priority);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
this.fontRendererObj.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 );
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(GuiText.Priority.getLocal(), 8, 6, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
this.bindTexture( getBackground() );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.bindTexture(getBackground());
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
this.priority.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
if( btn == this.originalGuiBtn )
|
||||
{
|
||||
if (btn == this.originalGuiBtn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(this.OriginalGui));
|
||||
}
|
||||
|
||||
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
|
||||
final boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
|
||||
final boolean isMinus =
|
||||
btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
|
||||
|
||||
if( isPlus || isMinus )
|
||||
{
|
||||
this.addQty( this.getQty( btn ) );
|
||||
if (isPlus || isMinus) {
|
||||
this.addQty(this.getQty(btn));
|
||||
}
|
||||
}
|
||||
|
||||
private void addQty( final int i )
|
||||
{
|
||||
try
|
||||
{
|
||||
private void addQty(final int i) {
|
||||
try {
|
||||
String out = this.priority.getText();
|
||||
|
||||
boolean fixed = false;
|
||||
while( out.startsWith( "0" ) && out.length() > 1 )
|
||||
{
|
||||
out = out.substring( 1 );
|
||||
while (out.startsWith("0") && out.length() > 1) {
|
||||
out = out.substring(1);
|
||||
fixed = true;
|
||||
}
|
||||
|
||||
if( fixed )
|
||||
{
|
||||
this.priority.setText( out );
|
||||
if (fixed) {
|
||||
this.priority.setText(out);
|
||||
}
|
||||
|
||||
if( out.isEmpty() )
|
||||
{
|
||||
if (out.isEmpty()) {
|
||||
out = "0";
|
||||
}
|
||||
|
||||
long result = Long.parseLong( out );
|
||||
long result = Long.parseLong(out);
|
||||
result += i;
|
||||
|
||||
this.priority.setText( out = Long.toString( result ) );
|
||||
this.priority.setText(out = Long.toString(result));
|
||||
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", out ) );
|
||||
}
|
||||
catch( final NumberFormatException e )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer(new PacketValueConfig("PriorityHost.Priority", out));
|
||||
} catch (final NumberFormatException e) {
|
||||
// nope..
|
||||
this.priority.setText( "0" );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
this.priority.setText("0");
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped( final char character, final int key )
|
||||
{
|
||||
if( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if( ( key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ) ) && this.priority.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if ((key == 211
|
||||
|| key == 205
|
||||
|| key == 203
|
||||
|| key == 14
|
||||
|| character == '-'
|
||||
|| Character.isDigit(character))
|
||||
&& this.priority.textboxKeyTyped(character, key)) {
|
||||
try {
|
||||
String out = this.priority.getText();
|
||||
|
||||
boolean fixed = false;
|
||||
while( out.startsWith( "0" ) && out.length() > 1 )
|
||||
{
|
||||
out = out.substring( 1 );
|
||||
while (out.startsWith("0") && out.length() > 1) {
|
||||
out = out.substring(1);
|
||||
fixed = true;
|
||||
}
|
||||
|
||||
if( fixed )
|
||||
{
|
||||
this.priority.setText( out );
|
||||
if (fixed) {
|
||||
this.priority.setText(out);
|
||||
}
|
||||
|
||||
if( out.isEmpty() )
|
||||
{
|
||||
if (out.isEmpty()) {
|
||||
out = "0";
|
||||
}
|
||||
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", out ) );
|
||||
NetworkHandler.instance.sendToServer(new PacketValueConfig("PriorityHost.Priority", out));
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
} else {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
protected String getBackground() {
|
||||
return "guis/priority.png";
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class GuiFluidCraftAmount extends AEBaseGui
|
||||
{
|
||||
public class GuiFluidCraftAmount extends AEBaseGui {
|
||||
private GuiNumberBox amountToCraft;
|
||||
private GuiTabButton originalGuiBtn;
|
||||
|
||||
@@ -43,35 +42,34 @@ public class GuiFluidCraftAmount extends AEBaseGui
|
||||
private GuiType originalGui;
|
||||
|
||||
@Reflected
|
||||
public GuiFluidCraftAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
||||
{
|
||||
super( new ContainerCraftAmount( inventoryPlayer, te ) );
|
||||
public GuiFluidCraftAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(new ContainerCraftAmount(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
final int a = AEConfig.instance.craftItemsByStackAmounts( 0 );
|
||||
final int b = AEConfig.instance.craftItemsByStackAmounts( 1 );
|
||||
final int c = AEConfig.instance.craftItemsByStackAmounts( 2 );
|
||||
final int d = AEConfig.instance.craftItemsByStackAmounts( 3 );
|
||||
final int a = AEConfig.instance.craftItemsByStackAmounts(0);
|
||||
final int b = AEConfig.instance.craftItemsByStackAmounts(1);
|
||||
final int c = AEConfig.instance.craftItemsByStackAmounts(2);
|
||||
final int d = AEConfig.instance.craftItemsByStackAmounts(3);
|
||||
|
||||
this.buttonList.add( this.plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a ) );
|
||||
this.buttonList.add( this.plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b ) );
|
||||
this.buttonList.add( this.plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c ) );
|
||||
this.buttonList.add( this.plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d ) );
|
||||
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a));
|
||||
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b));
|
||||
this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c));
|
||||
this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d));
|
||||
|
||||
this.buttonList.add( this.minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a ) );
|
||||
this.buttonList.add( this.minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b ) );
|
||||
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c ) );
|
||||
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d ) );
|
||||
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a));
|
||||
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b));
|
||||
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c));
|
||||
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d));
|
||||
|
||||
this.buttonList.add( this.next = new GuiButton( 0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal() ) );
|
||||
this.buttonList.add(
|
||||
this.next = new GuiButton(0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal()));
|
||||
|
||||
ItemStack myIcon = null;
|
||||
final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
|
||||
final Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
|
||||
@@ -89,40 +87,43 @@ public class GuiFluidCraftAmount extends AEBaseGui
|
||||
}
|
||||
|
||||
if (this.originalGui != null && myIcon != null) {
|
||||
this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
|
||||
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 = 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" );
|
||||
this.amountToCraft.setVisible(true);
|
||||
this.amountToCraft.setFocused(true);
|
||||
this.amountToCraft.setText("1");
|
||||
this.amountToCraft.setSelectionPos(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
this.fontRendererObj.drawString( GuiText.SelectAmount.getLocal(), 8, 6, 4210752 );
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.next.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
|
||||
|
||||
this.bindTexture( "guis/craftAmt.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
|
||||
this.bindTexture("guis/craftAmt.png");
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
try
|
||||
{
|
||||
Long.parseLong( this.amountToCraft.getText() );
|
||||
try {
|
||||
Long.parseLong(this.amountToCraft.getText());
|
||||
this.next.enabled = this.amountToCraft.getText().length() > 0;
|
||||
}
|
||||
catch( final NumberFormatException e )
|
||||
{
|
||||
} catch (final NumberFormatException e) {
|
||||
this.next.enabled = false;
|
||||
}
|
||||
|
||||
@@ -130,132 +131,110 @@ public class GuiFluidCraftAmount extends AEBaseGui
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped( final char character, final int key )
|
||||
{
|
||||
if( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if( key == 28 )
|
||||
{
|
||||
this.actionPerformed( this.next );
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if (key == 28) {
|
||||
this.actionPerformed(this.next);
|
||||
}
|
||||
if( ( key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ) ) && this.amountToCraft.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((key == 211
|
||||
|| key == 205
|
||||
|| key == 203
|
||||
|| key == 14
|
||||
|| character == '-'
|
||||
|| Character.isDigit(character))
|
||||
&& this.amountToCraft.textboxKeyTyped(character, key)) {
|
||||
try {
|
||||
String out = this.amountToCraft.getText();
|
||||
|
||||
boolean fixed = false;
|
||||
while( out.startsWith( "0" ) && out.length() > 1 )
|
||||
{
|
||||
out = out.substring( 1 );
|
||||
while (out.startsWith("0") && out.length() > 1) {
|
||||
out = out.substring(1);
|
||||
fixed = true;
|
||||
}
|
||||
|
||||
if( fixed )
|
||||
{
|
||||
this.amountToCraft.setText( out );
|
||||
if (fixed) {
|
||||
this.amountToCraft.setText(out);
|
||||
}
|
||||
|
||||
if( out.isEmpty() )
|
||||
{
|
||||
if (out.isEmpty()) {
|
||||
out = "0";
|
||||
}
|
||||
|
||||
final long result = Long.parseLong( out );
|
||||
if( result < 0 )
|
||||
{
|
||||
this.amountToCraft.setText( "1" );
|
||||
final long result = Long.parseLong(out);
|
||||
if (result < 0) {
|
||||
this.amountToCraft.setText("1");
|
||||
}
|
||||
}
|
||||
catch( final NumberFormatException e )
|
||||
{
|
||||
} catch (final NumberFormatException e) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
} else {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
|
||||
if( btn == this.originalGuiBtn )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketSwitchGuis( this.originalGui ) );
|
||||
if (btn == this.originalGuiBtn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(this.originalGui));
|
||||
}
|
||||
|
||||
if( btn == this.next )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), isShiftKeyDown() ) );
|
||||
if (btn == this.next) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketCraftRequest(Integer.parseInt(this.amountToCraft.getText()), isShiftKeyDown()));
|
||||
}
|
||||
}
|
||||
catch( final NumberFormatException e )
|
||||
{
|
||||
} catch (final NumberFormatException e) {
|
||||
// nope..
|
||||
this.amountToCraft.setText( "1" );
|
||||
this.amountToCraft.setText("1");
|
||||
}
|
||||
|
||||
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
|
||||
final boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
|
||||
final boolean isMinus =
|
||||
btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
|
||||
|
||||
if( isPlus || isMinus )
|
||||
{
|
||||
this.addQty( this.getQty( btn ) );
|
||||
if (isPlus || isMinus) {
|
||||
this.addQty(this.getQty(btn));
|
||||
}
|
||||
}
|
||||
|
||||
private void addQty( final int i )
|
||||
{
|
||||
try
|
||||
{
|
||||
private void addQty(final int i) {
|
||||
try {
|
||||
String out = this.amountToCraft.getText();
|
||||
|
||||
boolean fixed = false;
|
||||
while( out.startsWith( "0" ) && out.length() > 1 )
|
||||
{
|
||||
out = out.substring( 1 );
|
||||
while (out.startsWith("0") && out.length() > 1) {
|
||||
out = out.substring(1);
|
||||
fixed = true;
|
||||
}
|
||||
|
||||
if( fixed )
|
||||
{
|
||||
this.amountToCraft.setText( out );
|
||||
if (fixed) {
|
||||
this.amountToCraft.setText(out);
|
||||
}
|
||||
|
||||
if( out.isEmpty() )
|
||||
{
|
||||
if (out.isEmpty()) {
|
||||
out = "0";
|
||||
}
|
||||
|
||||
long result = Integer.parseInt( out );
|
||||
long result = Integer.parseInt(out);
|
||||
|
||||
if( result == 1 && i > 1 )
|
||||
{
|
||||
if (result == 1 && i > 1) {
|
||||
result = 0;
|
||||
}
|
||||
|
||||
result += i;
|
||||
if( result < 1 )
|
||||
{
|
||||
if (result < 1) {
|
||||
result = 1;
|
||||
}
|
||||
|
||||
out = Long.toString( result );
|
||||
Integer.parseInt( out );
|
||||
this.amountToCraft.setText( out );
|
||||
}
|
||||
catch( final NumberFormatException e )
|
||||
{
|
||||
out = Long.toString(result);
|
||||
Integer.parseInt(out);
|
||||
this.amountToCraft.setText(out);
|
||||
} catch (final NumberFormatException e) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,17 +19,16 @@ import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.network.CPacketSwitchGuis;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.google.common.base.Joiner;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiFluidCraftConfirm extends AEBaseGui {
|
||||
|
||||
@@ -50,78 +49,76 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
|
||||
private int tooltip = -1;
|
||||
private ItemStack hoveredStack;
|
||||
|
||||
public GuiFluidCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
||||
{
|
||||
super( new ContainerFluidCraftConfirm( inventoryPlayer, te ) );
|
||||
public GuiFluidCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(new ContainerFluidCraftConfirm(inventoryPlayer, te));
|
||||
this.xSize = 238;
|
||||
this.ySize = 206;
|
||||
|
||||
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||
this.setScrollBar( scrollbar );
|
||||
this.setScrollBar(scrollbar);
|
||||
|
||||
this.ccc = (ContainerFluidCraftConfirm) this.inventorySlots;
|
||||
|
||||
if( te instanceof PartFluidPatternTerminal)
|
||||
{
|
||||
if (te instanceof PartFluidPatternTerminal) {
|
||||
this.OriginalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
if( te instanceof PartFluidPatternTerminalEx)
|
||||
{
|
||||
if (te instanceof PartFluidPatternTerminalEx) {
|
||||
this.OriginalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isAutoStart()
|
||||
{
|
||||
return ( (ContainerFluidCraftConfirm) this.inventorySlots ).isAutoStart();
|
||||
boolean isAutoStart() {
|
||||
return ((ContainerFluidCraftConfirm) this.inventorySlots).isAutoStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.start = new GuiButton( 0, this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal() );
|
||||
this.start =
|
||||
new GuiButton(0, this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal());
|
||||
this.start.enabled = false;
|
||||
this.buttonList.add( this.start );
|
||||
this.buttonList.add(this.start);
|
||||
|
||||
this.selectCPU = new GuiButton( 0, this.guiLeft + ( 219 - 180 ) / 2, this.guiTop + this.ySize - 68, 180, 20, GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic );
|
||||
this.selectCPU = new GuiButton(
|
||||
0,
|
||||
this.guiLeft + (219 - 180) / 2,
|
||||
this.guiTop + this.ySize - 68,
|
||||
180,
|
||||
20,
|
||||
GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic);
|
||||
this.selectCPU.enabled = false;
|
||||
this.buttonList.add( this.selectCPU );
|
||||
this.buttonList.add(this.selectCPU);
|
||||
|
||||
if( this.OriginalGui != null )
|
||||
{
|
||||
this.cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
|
||||
if (this.OriginalGui != null) {
|
||||
this.cancel = new GuiButton(
|
||||
0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal());
|
||||
}
|
||||
|
||||
this.buttonList.add( this.cancel );
|
||||
this.buttonList.add(this.cancel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float btn )
|
||||
{
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
this.updateCPUButtonText();
|
||||
|
||||
this.start.enabled = !( this.ccc.hasNoCPU() || this.isSimulation() );
|
||||
this.start.enabled = !(this.ccc.hasNoCPU() || this.isSimulation());
|
||||
this.selectCPU.enabled = !this.isSimulation();
|
||||
|
||||
final int gx = ( this.width - this.xSize ) / 2;
|
||||
final int gy = ( this.height - this.ySize ) / 2;
|
||||
final int gx = (this.width - this.xSize) / 2;
|
||||
final int gy = (this.height - this.ySize) / 2;
|
||||
|
||||
this.tooltip = -1;
|
||||
|
||||
final int offY = 23;
|
||||
int y = 0;
|
||||
int x = 0;
|
||||
for( int z = 0; z <= 4 * 5; z++ )
|
||||
{
|
||||
for (int z = 0; z <= 4 * 5; z++) {
|
||||
final int minX = gx + 9 + x * 67;
|
||||
final int minY = gy + 22 + y * offY;
|
||||
|
||||
if( minX < mouseX && minX + 67 > mouseX )
|
||||
{
|
||||
if( minY < mouseY && minY + offY - 2 > mouseY )
|
||||
{
|
||||
if (minX < mouseX && minX + 67 > mouseX) {
|
||||
if (minY < mouseY && minY + offY - 2 > mouseY) {
|
||||
this.tooltip = z;
|
||||
break;
|
||||
}
|
||||
@@ -129,66 +126,61 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
|
||||
|
||||
x++;
|
||||
|
||||
if( x > 2 )
|
||||
{
|
||||
if (x > 2) {
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen( mouseX, mouseY, btn );
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
}
|
||||
|
||||
private void updateCPUButtonText()
|
||||
{
|
||||
private void updateCPUButtonText() {
|
||||
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal();
|
||||
if( this.ccc.getSelectedCpu() >= 0 )// && status.selectedCpu < status.cpus.size() )
|
||||
if (this.ccc.getSelectedCpu() >= 0) // && status.selectedCpu < status.cpus.size() )
|
||||
{
|
||||
if( this.ccc.getName().length() > 0 )
|
||||
{
|
||||
final String name = this.ccc.getName().substring( 0, Math.min( 20, this.ccc.getName().length() ) );
|
||||
if (this.ccc.getName().length() > 0) {
|
||||
final String name = this.ccc
|
||||
.getName()
|
||||
.substring(0, Math.min(20, this.ccc.getName().length()));
|
||||
btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.ccc.getSelectedCpu();
|
||||
}
|
||||
}
|
||||
|
||||
if( this.ccc.hasNoCPU() )
|
||||
{
|
||||
if (this.ccc.hasNoCPU()) {
|
||||
btnTextText = GuiText.NoCraftingCPUs.getLocal();
|
||||
}
|
||||
|
||||
this.selectCPU.displayString = btnTextText;
|
||||
}
|
||||
|
||||
private boolean isSimulation()
|
||||
{
|
||||
return ( (ContainerFluidCraftConfirm) this.inventorySlots ).isSimulation();
|
||||
private boolean isSimulation() {
|
||||
return ((ContainerFluidCraftConfirm) this.inventorySlots).isSimulation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
final long BytesUsed = this.ccc.getUsedBytes();
|
||||
final String byteUsed = NumberFormat.getInstance().format( BytesUsed );
|
||||
final String Add = BytesUsed > 0 ? ( byteUsed + ' ' + GuiText.BytesUsed.getLocal() ) : GuiText.CalculatingWait.getLocal();
|
||||
this.fontRendererObj.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 );
|
||||
final String byteUsed = NumberFormat.getInstance().format(BytesUsed);
|
||||
final String Add =
|
||||
BytesUsed > 0 ? (byteUsed + ' ' + GuiText.BytesUsed.getLocal()) : GuiText.CalculatingWait.getLocal();
|
||||
this.fontRendererObj.drawString(GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752);
|
||||
|
||||
String dsp = null;
|
||||
|
||||
if( this.isSimulation() )
|
||||
{
|
||||
if (this.isSimulation()) {
|
||||
dsp = GuiText.Simulation.getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
dsp = this.ccc.getCpuAvailableBytes() > 0 ? ( GuiText.Bytes.getLocal() + ": " + this.ccc.getCpuAvailableBytes() + " : " + GuiText.CoProcessors.getLocal() + ": " + this.ccc.getCpuCoProcessors() ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
|
||||
} else {
|
||||
dsp = this.ccc.getCpuAvailableBytes() > 0
|
||||
? (GuiText.Bytes.getLocal() + ": " + this.ccc.getCpuAvailableBytes() + " : "
|
||||
+ GuiText.CoProcessors.getLocal() + ": " + this.ccc.getCpuCoProcessors())
|
||||
: GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
|
||||
}
|
||||
|
||||
final int offset = ( 219 - this.fontRendererObj.getStringWidth( dsp ) ) / 2;
|
||||
this.fontRendererObj.drawString( dsp, offset, 165, 4210752 );
|
||||
final int offset = (219 - this.fontRendererObj.getStringWidth(dsp)) / 2;
|
||||
this.fontRendererObj.drawString(dsp, offset, 165, 4210752);
|
||||
|
||||
final int sectionLength = 67;
|
||||
|
||||
@@ -206,349 +198,297 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
|
||||
hoveredStack = null;
|
||||
final int offY = 23;
|
||||
|
||||
for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ )
|
||||
{
|
||||
final IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z );
|
||||
if( refStack != null )
|
||||
{
|
||||
for (int z = viewStart; z < Math.min(viewEnd, this.visual.size()); z++) {
|
||||
final IAEItemStack refStack = this.visual.get(z); // repo.getReferenceItem( z );
|
||||
if (refStack != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( 0.5, 0.5, 0.5 );
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
|
||||
final IAEItemStack stored = this.storage.findPrecise( refStack );
|
||||
final IAEItemStack pendingStack = this.pending.findPrecise( refStack );
|
||||
final IAEItemStack missingStack = this.missing.findPrecise( refStack );
|
||||
final IAEItemStack stored = this.storage.findPrecise(refStack);
|
||||
final IAEItemStack pendingStack = this.pending.findPrecise(refStack);
|
||||
final IAEItemStack missingStack = this.missing.findPrecise(refStack);
|
||||
|
||||
int lines = 0;
|
||||
|
||||
if( stored != null && stored.getStackSize() > 0 )
|
||||
{
|
||||
if (stored != null && stored.getStackSize() > 0) {
|
||||
lines++;
|
||||
}
|
||||
if( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
{
|
||||
if (pendingStack != null && pendingStack.getStackSize() > 0) {
|
||||
lines++;
|
||||
}
|
||||
if( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
{
|
||||
if (pendingStack != null && pendingStack.getStackSize() > 0) {
|
||||
lines++;
|
||||
}
|
||||
|
||||
final int negY = ( ( lines - 1 ) * 5 ) / 2;
|
||||
final int negY = ((lines - 1) * 5) / 2;
|
||||
int downY = 0;
|
||||
|
||||
if( stored != null && stored.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( stored.getStackSize() );
|
||||
if( stored.getStackSize() >= 10000 )
|
||||
{
|
||||
str = Long.toString( stored.getStackSize() / 1000 ) + 'k';
|
||||
if (stored != null && stored.getStackSize() > 0) {
|
||||
String str = Long.toString(stored.getStackSize());
|
||||
if (stored.getStackSize() >= 10000) {
|
||||
str = Long.toString(stored.getStackSize() / 1000) + 'k';
|
||||
}
|
||||
if( stored.getStackSize() >= 10000000 )
|
||||
{
|
||||
str = Long.toString( stored.getStackSize() / 1000000 ) + 'm';
|
||||
if (stored.getStackSize() >= 10000000) {
|
||||
str = Long.toString(stored.getStackSize() / 1000000) + 'm';
|
||||
}
|
||||
|
||||
str = GuiText.FromStorage.getLocal() + ": " + str;
|
||||
final int w = 4 + this.fontRendererObj.getStringWidth( str );
|
||||
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
|
||||
final int w = 4 + this.fontRendererObj.getStringWidth(str);
|
||||
this.fontRendererObj.drawString(
|
||||
str,
|
||||
(int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
|
||||
(y * offY + yo + 6 - negY + downY) * 2,
|
||||
4210752);
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
lineList.add( GuiText.FromStorage.getLocal() + ": " + stored.getStackSize());
|
||||
if (this.tooltip == z - viewStart) {
|
||||
lineList.add(GuiText.FromStorage.getLocal() + ": " + stored.getStackSize());
|
||||
}
|
||||
|
||||
downY += 5;
|
||||
}
|
||||
|
||||
boolean red = false;
|
||||
if( missingStack != null && missingStack.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( missingStack.getStackSize() );
|
||||
if( missingStack.getStackSize() >= 10000 )
|
||||
{
|
||||
str = Long.toString( missingStack.getStackSize() / 1000 ) + 'k';
|
||||
if (missingStack != null && missingStack.getStackSize() > 0) {
|
||||
String str = Long.toString(missingStack.getStackSize());
|
||||
if (missingStack.getStackSize() >= 10000) {
|
||||
str = Long.toString(missingStack.getStackSize() / 1000) + 'k';
|
||||
}
|
||||
if( missingStack.getStackSize() >= 10000000 )
|
||||
{
|
||||
str = Long.toString( missingStack.getStackSize() / 1000000 ) + 'm';
|
||||
if (missingStack.getStackSize() >= 10000000) {
|
||||
str = Long.toString(missingStack.getStackSize() / 1000000) + 'm';
|
||||
}
|
||||
|
||||
str = GuiText.Missing.getLocal() + ": " + str;
|
||||
final int w = 4 + this.fontRendererObj.getStringWidth( str );
|
||||
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
|
||||
final int w = 4 + this.fontRendererObj.getStringWidth(str);
|
||||
this.fontRendererObj.drawString(
|
||||
str,
|
||||
(int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
|
||||
(y * offY + yo + 6 - negY + downY) * 2,
|
||||
4210752);
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
lineList.add( GuiText.Missing.getLocal() + ": " + missingStack.getStackSize());
|
||||
if (this.tooltip == z - viewStart) {
|
||||
lineList.add(GuiText.Missing.getLocal() + ": " + missingStack.getStackSize());
|
||||
}
|
||||
|
||||
red = true;
|
||||
downY += 5;
|
||||
}
|
||||
|
||||
if( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( pendingStack.getStackSize() );
|
||||
if( pendingStack.getStackSize() >= 10000 )
|
||||
{
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000 ) + 'k';
|
||||
if (pendingStack != null && pendingStack.getStackSize() > 0) {
|
||||
String str = Long.toString(pendingStack.getStackSize());
|
||||
if (pendingStack.getStackSize() >= 10000) {
|
||||
str = Long.toString(pendingStack.getStackSize() / 1000) + 'k';
|
||||
}
|
||||
if( pendingStack.getStackSize() >= 10000000 )
|
||||
{
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + 'm';
|
||||
if (pendingStack.getStackSize() >= 10000000) {
|
||||
str = Long.toString(pendingStack.getStackSize() / 1000000) + 'm';
|
||||
}
|
||||
|
||||
str = GuiText.ToCraft.getLocal() + ": " + str;
|
||||
final int w = 4 + this.fontRendererObj.getStringWidth( str );
|
||||
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
|
||||
final int w = 4 + this.fontRendererObj.getStringWidth(str);
|
||||
this.fontRendererObj.drawString(
|
||||
str,
|
||||
(int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
|
||||
(y * offY + yo + 6 - negY + downY) * 2,
|
||||
4210752);
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
lineList.add( GuiText.ToCraft.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
|
||||
if (this.tooltip == z - viewStart) {
|
||||
lineList.add(GuiText.ToCraft.getLocal() + ": " + Long.toString(pendingStack.getStackSize()));
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
final int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
|
||||
final int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
|
||||
final int posY = y * offY + yo;
|
||||
|
||||
final ItemStack is = CoreModHooks.displayFluid(refStack.copy());
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
dspToolTip = Platform.getItemDisplayName( is );
|
||||
if( lineList.size() > 0 )
|
||||
{
|
||||
if (this.tooltip == z - viewStart) {
|
||||
dspToolTip = Platform.getItemDisplayName(is);
|
||||
if (lineList.size() > 0) {
|
||||
addItemTooltip(is, lineList);
|
||||
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
|
||||
dspToolTip = dspToolTip + '\n' + Joiner.on("\n").join(lineList);
|
||||
}
|
||||
|
||||
toolPosX = x * ( 1 + sectionLength ) + xo + sectionLength - 8;
|
||||
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
|
||||
toolPosY = y * offY + yo;
|
||||
hoveredStack = is;
|
||||
}
|
||||
|
||||
this.drawItem( posX, posY, is );
|
||||
this.drawItem(posX, posY, is);
|
||||
|
||||
if( red )
|
||||
{
|
||||
final int startX = x * ( 1 + sectionLength ) + xo;
|
||||
if (red) {
|
||||
final int startX = x * (1 + sectionLength) + xo;
|
||||
final int startY = posY - 4;
|
||||
drawRect( startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000 );
|
||||
drawRect(startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000);
|
||||
}
|
||||
|
||||
x++;
|
||||
|
||||
if( x > 2 )
|
||||
{
|
||||
if (x > 2) {
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( this.tooltip >= 0 && dspToolTip.length() > 0 )
|
||||
{
|
||||
this.drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
|
||||
if (this.tooltip >= 0 && dspToolTip.length() > 0) {
|
||||
this.drawTooltip(toolPosX, toolPosY + 10, 0, dspToolTip);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.setScrollBar();
|
||||
this.bindTexture( "guis/craftingreport.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
|
||||
this.bindTexture("guis/craftingreport.png");
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
private void setScrollBar()
|
||||
{
|
||||
private void setScrollBar() {
|
||||
final int size = this.visual.size();
|
||||
|
||||
this.getScrollBar().setTop( 19 ).setLeft( 218 ).setHeight( 114 );
|
||||
this.getScrollBar().setRange( 0, ( size + 2 ) / 3 - this.rows, 1 );
|
||||
this.getScrollBar().setTop(19).setLeft(218).setHeight(114);
|
||||
this.getScrollBar().setRange(0, (size + 2) / 3 - this.rows, 1);
|
||||
}
|
||||
|
||||
public void postUpdate( final List<IAEItemStack> list, final byte ref )
|
||||
{
|
||||
switch( ref )
|
||||
{
|
||||
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
|
||||
switch (ref) {
|
||||
case 0:
|
||||
for( final IAEItemStack l : list )
|
||||
{
|
||||
this.handleInput( this.storage, l );
|
||||
for (final IAEItemStack l : list) {
|
||||
this.handleInput(this.storage, l);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
for( final IAEItemStack l : list )
|
||||
{
|
||||
this.handleInput( this.pending, l );
|
||||
for (final IAEItemStack l : list) {
|
||||
this.handleInput(this.pending, l);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
for( final IAEItemStack l : list )
|
||||
{
|
||||
this.handleInput( this.missing, l );
|
||||
for (final IAEItemStack l : list) {
|
||||
this.handleInput(this.missing, l);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for( final IAEItemStack l : list )
|
||||
{
|
||||
final long amt = this.getTotal( l );
|
||||
for (final IAEItemStack l : list) {
|
||||
final long amt = this.getTotal(l);
|
||||
|
||||
if( amt <= 0 )
|
||||
{
|
||||
this.deleteVisualStack( l );
|
||||
}
|
||||
else
|
||||
{
|
||||
final IAEItemStack is = this.findVisualStack( l );
|
||||
is.setStackSize( amt );
|
||||
if (amt <= 0) {
|
||||
this.deleteVisualStack(l);
|
||||
} else {
|
||||
final IAEItemStack is = this.findVisualStack(l);
|
||||
is.setStackSize(amt);
|
||||
}
|
||||
}
|
||||
|
||||
this.setScrollBar();
|
||||
}
|
||||
|
||||
private void handleInput( final IItemList<IAEItemStack> s, final IAEItemStack l )
|
||||
{
|
||||
IAEItemStack a = s.findPrecise( l );
|
||||
private void handleInput(final IItemList<IAEItemStack> s, final IAEItemStack l) {
|
||||
IAEItemStack a = s.findPrecise(l);
|
||||
|
||||
if( l.getStackSize() <= 0 )
|
||||
{
|
||||
if( a != null )
|
||||
{
|
||||
if (l.getStackSize() <= 0) {
|
||||
if (a != null) {
|
||||
a.reset();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( a == null )
|
||||
{
|
||||
s.add( l.copy() );
|
||||
a = s.findPrecise( l );
|
||||
} else {
|
||||
if (a == null) {
|
||||
s.add(l.copy());
|
||||
a = s.findPrecise(l);
|
||||
}
|
||||
|
||||
if( a != null )
|
||||
{
|
||||
a.setStackSize( l.getStackSize() );
|
||||
if (a != null) {
|
||||
a.setStackSize(l.getStackSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private long getTotal( final IAEItemStack is )
|
||||
{
|
||||
final IAEItemStack a = this.storage.findPrecise( is );
|
||||
final IAEItemStack c = this.pending.findPrecise( is );
|
||||
final IAEItemStack m = this.missing.findPrecise( is );
|
||||
private long getTotal(final IAEItemStack is) {
|
||||
final IAEItemStack a = this.storage.findPrecise(is);
|
||||
final IAEItemStack c = this.pending.findPrecise(is);
|
||||
final IAEItemStack m = this.missing.findPrecise(is);
|
||||
|
||||
long total = 0;
|
||||
|
||||
if( a != null )
|
||||
{
|
||||
if (a != null) {
|
||||
total += a.getStackSize();
|
||||
}
|
||||
|
||||
if( c != null )
|
||||
{
|
||||
if (c != null) {
|
||||
total += c.getStackSize();
|
||||
}
|
||||
|
||||
if( m != null )
|
||||
{
|
||||
if (m != null) {
|
||||
total += m.getStackSize();
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
private void deleteVisualStack( final IAEItemStack l )
|
||||
{
|
||||
private void deleteVisualStack(final IAEItemStack l) {
|
||||
final Iterator<IAEItemStack> i = this.visual.iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
while (i.hasNext()) {
|
||||
final IAEItemStack o = i.next();
|
||||
if( o.equals( l ) )
|
||||
{
|
||||
if (o.equals(l)) {
|
||||
i.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IAEItemStack findVisualStack( final IAEItemStack l )
|
||||
{
|
||||
for( final IAEItemStack o : this.visual )
|
||||
{
|
||||
if( o.equals( l ) )
|
||||
{
|
||||
private IAEItemStack findVisualStack(final IAEItemStack l) {
|
||||
for (final IAEItemStack o : this.visual) {
|
||||
if (o.equals(l)) {
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
final IAEItemStack stack = l.copy();
|
||||
this.visual.add( stack );
|
||||
this.visual.add(stack);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped( final char character, final int key )
|
||||
{
|
||||
if( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if( key == 28 )
|
||||
{
|
||||
this.actionPerformed( this.start );
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if (key == 28) {
|
||||
this.actionPerformed(this.start);
|
||||
}
|
||||
super.keyTyped( character, key );
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
final boolean backwards = Mouse.isButtonDown( 1 );
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
|
||||
if( btn == this.selectCPU )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
|
||||
if (btn == this.selectCPU) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns("Terminal.Cpu", backwards ? "Prev" : "Next"));
|
||||
}
|
||||
|
||||
if( btn == this.cancel )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketSwitchGuis( this.OriginalGui ) );
|
||||
if (btn == this.cancel) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(this.OriginalGui));
|
||||
}
|
||||
|
||||
if( btn == this.start )
|
||||
{
|
||||
try
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendToServer( new CPacketFluidPatternTermBtns( "Terminal.Start", "Start" ) );
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
if (btn == this.start) {
|
||||
try {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("Terminal.Start", "Start"));
|
||||
} catch (final Throwable e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
protected void addItemTooltip(ItemStack is, List<String> lineList)
|
||||
{
|
||||
if (isShiftKeyDown())
|
||||
{
|
||||
protected void addItemTooltip(ItemStack is, List<String> lineList) {
|
||||
if (isShiftKeyDown()) {
|
||||
List l = is.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
if (!l.isEmpty())
|
||||
l.remove(0);
|
||||
if (!l.isEmpty()) l.remove(0);
|
||||
lineList.addAll(l);
|
||||
}
|
||||
else if (ModAndClassUtil.isShiftTooltip)
|
||||
{
|
||||
} else if (ModAndClassUtil.isShiftTooltip) {
|
||||
lineList.add(GuiText.HoldShiftForTooltip.getLocal());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,51 +10,49 @@ import com.glodblock.github.util.NameConst;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiFluidIO extends GuiUpgradeable
|
||||
{
|
||||
public class GuiFluidIO extends GuiUpgradeable {
|
||||
private final PartSharedFluidBus bus;
|
||||
|
||||
public GuiFluidIO(InventoryPlayer inventoryPlayer, PartSharedFluidBus te )
|
||||
{
|
||||
super( new ContainerFluidIO( inventoryPlayer, te ) );
|
||||
public GuiFluidIO(InventoryPlayer inventoryPlayer, PartSharedFluidBus te) {
|
||||
super(new ContainerFluidIO(inventoryPlayer, te));
|
||||
this.bus = te;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected GuiText getName()
|
||||
{
|
||||
protected GuiText getName() {
|
||||
return this.bus instanceof PartFluidImportBus ? GuiText.ImportBus : GuiText.ExportBus;
|
||||
}
|
||||
|
||||
public void update(int id, IAEFluidStack stack) {
|
||||
((ContainerFluidIO)this.cvb).getBus().setFluidInSlot(id, stack);
|
||||
((ContainerFluidIO) this.cvb).getBus().setFluidInSlot(id, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
this.fontRendererObj.drawString( this.getGuiDisplayName(I18n.format(this.bus instanceof PartFluidImportBus ? NameConst.GUI_FLUID_IMPORT : NameConst.GUI_FLUID_EXPORT)), 8, 6, 4210752 );
|
||||
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(
|
||||
this.getGuiDisplayName(I18n.format(
|
||||
this.bus instanceof PartFluidImportBus
|
||||
? NameConst.GUI_FLUID_IMPORT
|
||||
: NameConst.GUI_FLUID_EXPORT)),
|
||||
8,
|
||||
6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||
|
||||
if( this.redstoneMode != null )
|
||||
{
|
||||
this.redstoneMode.set( this.cvb.getRedStoneMode() );
|
||||
if (this.redstoneMode != null) {
|
||||
this.redstoneMode.set(this.cvb.getRedStoneMode());
|
||||
}
|
||||
|
||||
if( this.fuzzyMode != null )
|
||||
{
|
||||
this.fuzzyMode.set( this.cvb.getFuzzyMode() );
|
||||
if (this.fuzzyMode != null) {
|
||||
this.fuzzyMode.set(this.cvb.getFuzzyMode());
|
||||
}
|
||||
|
||||
if( this.craftMode != null )
|
||||
{
|
||||
this.craftMode.set( this.cvb.getCraftingMode() );
|
||||
if (this.craftMode != null) {
|
||||
this.craftMode.set(this.cvb.getCraftingMode());
|
||||
}
|
||||
|
||||
if( this.schedulingMode != null )
|
||||
{
|
||||
this.schedulingMode.set( this.cvb.getSchedulingMode() );
|
||||
if (this.schedulingMode != null) {
|
||||
this.schedulingMode.set(this.cvb.getSchedulingMode());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ 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 javax.annotation.Nullable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -28,8 +29,6 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class GuiFluidInterface extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/interface_fluid.png");
|
||||
@@ -57,10 +56,16 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,19 +73,23 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
public void func_146977_a(final Slot s) {
|
||||
try {
|
||||
GuiContainer.class
|
||||
.getDeclaredMethod("func_146977_a_original", Slot.class)
|
||||
.invoke(this, s);
|
||||
.getDeclaredMethod("func_146977_a_original", Slot.class)
|
||||
.invoke(this, s);
|
||||
} catch (final Exception ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.switcher = new GuiTabButton( this.guiLeft + 154, this.guiTop, isPart() ? ItemAndBlockHolder.FLUID_INTERFACE.stack() : ItemAndBlockHolder.INTERFACE.stack(), StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"), itemRender );
|
||||
this.buttonList.add( this.switcher );
|
||||
this.switcher = new GuiTabButton(
|
||||
this.guiLeft + 154,
|
||||
this.guiTop,
|
||||
isPart() ? ItemAndBlockHolder.FLUID_INTERFACE.stack() : ItemAndBlockHolder.INTERFACE.stack(),
|
||||
StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"),
|
||||
itemRender);
|
||||
this.buttonList.add(this.switcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,8 +110,13 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
if (!isPart()) {
|
||||
fontRendererObj.drawString(dirName(i), TANK_X + i * TANK_X_OFF + 5, 22, 0x404040);
|
||||
}
|
||||
renderFluidIntoGui(TANK_X + i * TANK_X_OFF, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i), fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
renderFluidIntoGui(
|
||||
TANK_X + i * TANK_X_OFF,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i),
|
||||
fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
}
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
@@ -118,8 +132,8 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
}
|
||||
|
||||
public void renderFluidIntoGui(int x, int y, int width, int height,
|
||||
@Nullable IAEFluidStack aeFluidStack, int capacity) {
|
||||
public void renderFluidIntoGui(
|
||||
int x, int y, int width, int height, @Nullable IAEFluidStack aeFluidStack, int capacity) {
|
||||
if (aeFluidStack != null) {
|
||||
GL11.glDisable(2896);
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
@@ -127,10 +141,14 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
if (aeFluidStack.getStackSize() > 0 && hi > 0) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
IIcon fluidIcon = aeFluidStack.getFluid().getStillIcon();
|
||||
GL11.glColor3f((float)(aeFluidStack.getFluid().getColor() >> 16 & 255) / 255.0F, (float)(aeFluidStack.getFluid().getColor() >> 8 & 255) / 255.0F, (float)(aeFluidStack.getFluid().getColor() & 255) / 255.0F);
|
||||
GL11.glColor3f(
|
||||
(float) (aeFluidStack.getFluid().getColor() >> 16 & 255) / 255.0F,
|
||||
(float) (aeFluidStack.getFluid().getColor() >> 8 & 255) / 255.0F,
|
||||
(float) (aeFluidStack.getFluid().getColor() & 255) / 255.0F);
|
||||
for (int th = 0; th <= hi; th += 16) {
|
||||
if (hi - th <= 0) break;
|
||||
this.drawTexturedModelRectFromIcon(x, y + height - Math.min(16, hi - th) - th, fluidIcon, width, Math.min(16, hi - th));
|
||||
this.drawTexturedModelRectFromIcon(
|
||||
x, y + height - Math.min(16, hi - th) - th, fluidIcon, width, Math.min(16, hi - th));
|
||||
}
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
@@ -138,11 +156,11 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
if (btn == this.switcher) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(isPart() ? GuiType.DUAL_INTERFACE_PART : GuiType.DUAL_INTERFACE));
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketSwitchGuis(isPart() ? GuiType.DUAL_INTERFACE_PART : GuiType.DUAL_INTERFACE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,9 +172,8 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
} else {
|
||||
((TileFluidInterface) cont.getTile()).setConfig(id, stack);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(isPart()) {
|
||||
} else {
|
||||
if (isPart()) {
|
||||
((PartFluidInterface) cont.getTile()).setFluidInv(id, stack);
|
||||
} else {
|
||||
((TileFluidInterface) cont.getTile()).setFluidInv(id, stack);
|
||||
@@ -167,6 +184,4 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
private boolean isPart() {
|
||||
return this.cont.getTile() instanceof PartFluidInterface;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,5 +29,4 @@ public class GuiFluidPacketDecoder extends AEBaseGui {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PACKET_DECODER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,9 @@ import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||
import com.glodblock.github.network.CPacketEncodePattern;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -23,10 +26,6 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_pattern_encoder.png");
|
||||
@@ -37,7 +36,7 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
|
||||
public GuiFluidPatternEncoder(InventoryPlayer ipl, TileFluidPatternEncoder tile) {
|
||||
super(new ContainerFluidPatternEncoder(ipl, tile));
|
||||
this.cont = (ContainerFluidPatternEncoder)inventorySlots;
|
||||
this.cont = (ContainerFluidPatternEncoder) inventorySlots;
|
||||
mouseRegions.addRegion(141, 38, 10, 10, new MouseRegionManager.Handler() {
|
||||
@Override
|
||||
public List<String> getTooltip() {
|
||||
@@ -78,14 +77,13 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a( final Slot s )
|
||||
{
|
||||
this.drawSlot0( s );
|
||||
public void func_146977_a(final Slot s) {
|
||||
this.drawSlot0(s);
|
||||
}
|
||||
|
||||
public void drawSlot0(Slot slot) {
|
||||
if (slot instanceof SlotFluid) {
|
||||
IAEItemStack stack = ((SlotFluid)slot).getAeStack();
|
||||
IAEItemStack stack = ((SlotFluid) slot).getAeStack();
|
||||
super.func_146977_a(new SlotSingleItem(slot));
|
||||
if (stack == null) return;
|
||||
IAEItemStack fake = stack.copy();
|
||||
@@ -94,7 +92,12 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
|
||||
}
|
||||
stackSizeRenderer.setAeStack(fake);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), stack.getItemStack(), slot.xDisplayPosition, slot.yDisplayPosition);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
stack.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
} else {
|
||||
super.func_146977_a(slot);
|
||||
}
|
||||
@@ -107,29 +110,23 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
|
||||
if (fluid != null) {
|
||||
list = Arrays.asList(fluid.getLocalizedName(), String.format(EnumChatFormatting.GRAY + "%,d mB", fluid.amount));
|
||||
}
|
||||
else {
|
||||
list = Arrays.asList(
|
||||
fluid.getLocalizedName(), String.format(EnumChatFormatting.GRAY + "%,d mB", fluid.amount));
|
||||
} else {
|
||||
list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
}
|
||||
|
||||
for (int k = 0; k < list.size(); ++k)
|
||||
{
|
||||
if (k == 0)
|
||||
{
|
||||
list.set(k, stack.getRarity().rarityColor + (String)list.get(k));
|
||||
}
|
||||
else
|
||||
{
|
||||
list.set(k, EnumChatFormatting.GRAY + (String)list.get(k));
|
||||
for (int k = 0; k < list.size(); ++k) {
|
||||
if (k == 0) {
|
||||
list.set(k, stack.getRarity().rarityColor + (String) list.get(k));
|
||||
} else {
|
||||
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
|
||||
}
|
||||
}
|
||||
FontRenderer font = stack.getItem().getFontRenderer(stack);
|
||||
drawHoveringText(list, x, y, (font == null ? fontRendererObj : font));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,10 +38,8 @@ public class GuiFluidPatternTerminal extends GuiBaseFluidPatternTerminal {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a( final Slot s )
|
||||
{
|
||||
if (drawSlot0(s))
|
||||
super.func_146977_a( s );
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s)) super.func_146977_a(s);
|
||||
}
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
@@ -53,11 +51,14 @@ public class GuiFluidPatternTerminal extends GuiBaseFluidPatternTerminal {
|
||||
if (fake.getItemStack().getItem() instanceof ItemFluidPacket) {
|
||||
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
|
||||
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
} else return true;
|
||||
stackSizeRenderer.setAeStack(fake);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), stack.getItemStack(), slot.xDisplayPosition, slot.yDisplayPosition);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
stack.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -71,5 +72,4 @@ public class GuiFluidPatternTerminal extends GuiBaseFluidPatternTerminal {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+2
-5
@@ -40,15 +40,12 @@ public class GuiFluidPatternTerminalCraftingStatus extends GuiCraftingStatus {
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == originalGuiBtn) {
|
||||
if (host instanceof PartFluidPatternTerminal)
|
||||
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL);
|
||||
if (host instanceof PartFluidPatternTerminal) 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 if (host instanceof PartFluidTerminal) InventoryHandler.switchGui(GuiType.FLUID_TERMINAL);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,10 +38,8 @@ public class GuiFluidPatternTerminalEx extends GuiBaseFluidPatternTerminalEx {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a( final Slot s )
|
||||
{
|
||||
if (drawSlot0(s))
|
||||
super.func_146977_a( s );
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s)) super.func_146977_a(s);
|
||||
}
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
@@ -53,11 +51,14 @@ public class GuiFluidPatternTerminalEx extends GuiBaseFluidPatternTerminalEx {
|
||||
if (fake.getItemStack().getItem() instanceof ItemFluidPacket) {
|
||||
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
|
||||
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
} else return true;
|
||||
stackSizeRenderer.setAeStack(fake);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), stack.getItemStack(), slot.xDisplayPosition, slot.yDisplayPosition);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
stack.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -71,5 +72,4 @@ public class GuiFluidPatternTerminalEx extends GuiBaseFluidPatternTerminalEx {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,8 @@ 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 java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -21,9 +23,6 @@ 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;
|
||||
@@ -40,11 +39,9 @@ public class GuiFluidTerminal extends GuiBaseFluidTerminal {
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s))
|
||||
super.func_146977_a(s);
|
||||
if (drawSlot0(s)) super.func_146977_a(s);
|
||||
}
|
||||
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
if (slot instanceof SlotME) {
|
||||
IAEItemStack stack = ((SlotME) slot).getAEStack();
|
||||
@@ -52,23 +49,29 @@ public class GuiFluidTerminal extends GuiBaseFluidTerminal {
|
||||
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);
|
||||
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);
|
||||
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.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);
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.glodblock.github.inventory.gui.ButtonMouseHandler;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -20,8 +21,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class GuiIngredientBuffer extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/ingredient_buffer.png");
|
||||
@@ -36,10 +35,14 @@ public class GuiIngredientBuffer extends AEBaseGui {
|
||||
this.cont = (ContainerIngredientBuffer) inventorySlots;
|
||||
this.ySize = 222;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mouseRegions.addRegion(TANK_X + TANK_X_OFF * i, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
new TankMouseHandler(cont.getTile().getFluidInventory(), i));
|
||||
mouseRegions.addRegion(TANK_X + 10 + 22 * i, TANK_Y + TANK_HEIGHT + 2, 7, 7,
|
||||
ButtonMouseHandler.dumpTank(cont, i));
|
||||
mouseRegions.addRegion(
|
||||
TANK_X + TANK_X_OFF * i,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
new TankMouseHandler(cont.getTile().getFluidInventory(), i));
|
||||
mouseRegions.addRegion(
|
||||
TANK_X + 10 + 22 * i, TANK_Y + TANK_HEIGHT + 2, 7, 7, ButtonMouseHandler.dumpTank(cont, i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,16 +68,21 @@ public class GuiIngredientBuffer extends AEBaseGui {
|
||||
IAEFluidTank fluidInv = cont.getTile().getFluidInventory();
|
||||
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
renderFluidIntoGui(TANK_X + i * TANK_X_OFF, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i), fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
renderFluidIntoGui(
|
||||
TANK_X + i * TANK_X_OFF,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i),
|
||||
fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
}
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
public void renderFluidIntoGui(int x, int y, int width, int height,
|
||||
@Nullable IAEFluidStack aeFluidStack, int capacity) {
|
||||
public void renderFluidIntoGui(
|
||||
int x, int y, int width, int height, @Nullable IAEFluidStack aeFluidStack, int capacity) {
|
||||
if (aeFluidStack != null) {
|
||||
GL11.glDisable(2896);
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
@@ -82,10 +90,14 @@ public class GuiIngredientBuffer extends AEBaseGui {
|
||||
if (aeFluidStack.getStackSize() > 0 && hi > 0) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
IIcon fluidIcon = aeFluidStack.getFluid().getStillIcon();
|
||||
GL11.glColor3f((float)(aeFluidStack.getFluid().getColor() >> 16 & 255) / 255.0F, (float)(aeFluidStack.getFluid().getColor() >> 8 & 255) / 255.0F, (float)(aeFluidStack.getFluid().getColor() & 255) / 255.0F);
|
||||
GL11.glColor3f(
|
||||
(float) (aeFluidStack.getFluid().getColor() >> 16 & 255) / 255.0F,
|
||||
(float) (aeFluidStack.getFluid().getColor() >> 8 & 255) / 255.0F,
|
||||
(float) (aeFluidStack.getFluid().getColor() & 255) / 255.0F);
|
||||
for (int th = 0; th <= hi; th += 16) {
|
||||
if (hi - th <= 0) break;
|
||||
this.drawTexturedModelRectFromIcon(x, y + height - Math.min(16, hi - th) - th, fluidIcon, width, Math.min(16, hi - th));
|
||||
this.drawTexturedModelRectFromIcon(
|
||||
x, y + height - Math.min(16, hi - th) - th, fluidIcon, width, Math.min(16, hi - th));
|
||||
}
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
@@ -95,5 +107,4 @@ public class GuiIngredientBuffer extends AEBaseGui {
|
||||
public void update(int slot, IAEFluidStack aeFluidStack) {
|
||||
cont.getTile().getFluidInventory().setFluidInSlot(slot, aeFluidStack);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import com.glodblock.github.inventory.gui.ButtonMouseHandler;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -20,8 +21,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class GuiLargeIngredientBuffer extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/large_ingredient_buffer.png");
|
||||
@@ -36,10 +35,14 @@ public class GuiLargeIngredientBuffer extends AEBaseGui {
|
||||
this.cont = (ContainerLargeIngredientBuffer) inventorySlots;
|
||||
this.ySize = 222;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
mouseRegions.addRegion(TANK_X + TANK_X_OFF * i, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
new TankMouseHandler(cont.getTile().getFluidInventory(), i));
|
||||
mouseRegions.addRegion(TANK_X + 10 + 22 * i, TANK_Y + TANK_HEIGHT + 2, 7, 7,
|
||||
ButtonMouseHandler.dumpTank(cont, i));
|
||||
mouseRegions.addRegion(
|
||||
TANK_X + TANK_X_OFF * i,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
new TankMouseHandler(cont.getTile().getFluidInventory(), i));
|
||||
mouseRegions.addRegion(
|
||||
TANK_X + 10 + 22 * i, TANK_Y + TANK_HEIGHT + 2, 7, 7, ButtonMouseHandler.dumpTank(cont, i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,23 +61,29 @@ public class GuiLargeIngredientBuffer extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getFluidInventory();
|
||||
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
for (int i = 0; i < 7; i++) {
|
||||
renderFluidIntoGui(TANK_X + i * TANK_X_OFF, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i), fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
renderFluidIntoGui(
|
||||
TANK_X + i * TANK_X_OFF,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i),
|
||||
fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
}
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
public void renderFluidIntoGui(int x, int y, int width, int height,
|
||||
@Nullable IAEFluidStack aeFluidStack, int capacity) {
|
||||
public void renderFluidIntoGui(
|
||||
int x, int y, int width, int height, @Nullable IAEFluidStack aeFluidStack, int capacity) {
|
||||
if (aeFluidStack != null) {
|
||||
GL11.glDisable(2896);
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
@@ -82,10 +91,14 @@ public class GuiLargeIngredientBuffer extends AEBaseGui {
|
||||
if (aeFluidStack.getStackSize() > 0 && hi > 0) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
IIcon fluidIcon = aeFluidStack.getFluid().getStillIcon();
|
||||
GL11.glColor3f((float)(aeFluidStack.getFluid().getColor() >> 16 & 255) / 255.0F, (float)(aeFluidStack.getFluid().getColor() >> 8 & 255) / 255.0F, (float)(aeFluidStack.getFluid().getColor() & 255) / 255.0F);
|
||||
GL11.glColor3f(
|
||||
(float) (aeFluidStack.getFluid().getColor() >> 16 & 255) / 255.0F,
|
||||
(float) (aeFluidStack.getFluid().getColor() >> 8 & 255) / 255.0F,
|
||||
(float) (aeFluidStack.getFluid().getColor() & 255) / 255.0F);
|
||||
for (int th = 0; th <= hi; th += 16) {
|
||||
if (hi - th <= 0) break;
|
||||
this.drawTexturedModelRectFromIcon(x, y + height - Math.min(16, hi - th) - th, fluidIcon, width, Math.min(16, hi - th));
|
||||
this.drawTexturedModelRectFromIcon(
|
||||
x, y + height - Math.min(16, hi - th) - th, fluidIcon, width, Math.min(16, hi - th));
|
||||
}
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
@@ -95,5 +108,4 @@ public class GuiLargeIngredientBuffer extends AEBaseGui {
|
||||
public void update(int slot, IAEFluidStack aeFluidStack) {
|
||||
cont.getTile().getFluidInventory().setFluidInSlot(slot, aeFluidStack);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,9 @@ 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 java.awt.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -28,10 +31,6 @@ 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 {
|
||||
|
||||
@@ -76,18 +75,21 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
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
|
||||
);
|
||||
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"));
|
||||
}
|
||||
@@ -109,8 +111,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s))
|
||||
super.func_146977_a(s);
|
||||
if (drawSlot0(s)) super.func_146977_a(s);
|
||||
}
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
@@ -120,12 +121,18 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
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()));
|
||||
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);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
stack.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -176,8 +183,12 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
|
||||
@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));
|
||||
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);
|
||||
@@ -187,7 +198,6 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
this.component[idx].getQty().textField.setText(String.valueOf(stackSize));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
@@ -248,7 +258,12 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
private GuiFCImgButton disable;
|
||||
private GuiFCImgButton enable;
|
||||
|
||||
public Component(Widget qtyInput, Widget batchInput, GuiFCImgButton enableBtn, GuiFCImgButton disableBtn, List buttonList) {
|
||||
public Component(
|
||||
Widget qtyInput,
|
||||
Widget batchInput,
|
||||
GuiFCImgButton enableBtn,
|
||||
GuiFCImgButton disableBtn,
|
||||
List buttonList) {
|
||||
this.qty = qtyInput;
|
||||
this.batch = batchInput;
|
||||
this.enable = enableBtn;
|
||||
@@ -271,10 +286,12 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
|
||||
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]+")) {
|
||||
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()));
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelMaintainer(widget.action, widget.idx, widget.textField.getText()));
|
||||
widget.textField.setTextColor(0xFFFFFF);
|
||||
return true;
|
||||
} else {
|
||||
@@ -293,9 +310,11 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
return this.send(this.getBatch());
|
||||
}
|
||||
if (this.enable == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.Enable", this.getIndex()));
|
||||
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()));
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelMaintainer("TileLevelMaintainer.Disable", this.getIndex()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -325,7 +344,6 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
this.disable.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class Widget {
|
||||
@@ -356,7 +374,5 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
public void setTooltip(String message) {
|
||||
this.textField.setMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -85,8 +85,8 @@ public class GuiPatternValueAmount extends AEBaseGui {
|
||||
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c));
|
||||
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d));
|
||||
|
||||
this.buttonList.add(this.set = new GuiButton(0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal()));
|
||||
|
||||
this.buttonList.add(
|
||||
this.set = new GuiButton(0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal()));
|
||||
|
||||
ItemStack myIcon = null;
|
||||
final Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
|
||||
@@ -104,10 +104,13 @@ public class GuiPatternValueAmount extends AEBaseGui {
|
||||
}
|
||||
|
||||
if (this.originalGui != null && myIcon != null) {
|
||||
this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
|
||||
this.buttonList.add(
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender));
|
||||
}
|
||||
|
||||
this.amountToSet = new GuiTextField(this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT);
|
||||
this.amountToSet = new GuiTextField(
|
||||
this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT);
|
||||
this.amountToSet.setEnableBackgroundDrawing(false);
|
||||
this.amountToSet.setMaxStringLength(16);
|
||||
this.amountToSet.setTextColor(0xFFFFFF);
|
||||
@@ -115,10 +118,8 @@ public class GuiPatternValueAmount extends AEBaseGui {
|
||||
this.amountToSet.setFocused(true);
|
||||
this.amountToSet.setText(String.valueOf(originalAmount));
|
||||
this.amountToSet.setSelectionPos(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 0x404040);
|
||||
@@ -183,7 +184,8 @@ public class GuiPatternValueAmount extends AEBaseGui {
|
||||
resultI = (int) ArithHelper.round(resultD, 0);
|
||||
}
|
||||
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketPatternValueSet(originalGui.ordinal(), resultI, valueIndex));
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketPatternValueSet(originalGui.ordinal(), resultI, valueIndex));
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
// nope..
|
||||
@@ -191,7 +193,8 @@ public class GuiPatternValueAmount extends AEBaseGui {
|
||||
}
|
||||
|
||||
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
|
||||
final boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
|
||||
final boolean isMinus =
|
||||
btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
|
||||
|
||||
if (isPlus || isMinus) {
|
||||
this.addQty(this.getQty(btn));
|
||||
@@ -236,5 +239,4 @@ public class GuiPatternValueAmount extends AEBaseGui {
|
||||
return stack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,5 +5,4 @@ public interface TankDumpable {
|
||||
boolean canDumpTank(int index);
|
||||
|
||||
void dumpTank(int index);
|
||||
|
||||
}
|
||||
+45
-59
@@ -14,58 +14,54 @@ import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.Util;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class ContainerFluidConfigurable extends ContainerUpgradeable {
|
||||
|
||||
public ContainerFluidConfigurable(InventoryPlayer ip, IUpgradeableHost te)
|
||||
{
|
||||
super( ip, te );
|
||||
public ContainerFluidConfigurable(InventoryPlayer ip, IUpgradeableHost te) {
|
||||
super(ip, te);
|
||||
}
|
||||
|
||||
public abstract AppEngInternalAEInventory getFakeFluidInv();
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx )
|
||||
{
|
||||
AppEngSlot clickSlot = (AppEngSlot)this.inventorySlots.get(idx);
|
||||
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
||||
AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx);
|
||||
if (clickSlot == null || !clickSlot.getHasStack()) return null;
|
||||
|
||||
ItemStack tis = clickSlot.getStack();
|
||||
FluidStack fs = Util.getFluidFromItem(tis);
|
||||
if( fs != null )
|
||||
{
|
||||
if (fs != null) {
|
||||
final AppEngInternalAEInventory inv = this.getFakeFluidInv();
|
||||
final IAEFluidStack stack = AEFluidStack.create( fs );
|
||||
for( int i = 0; i < inv.getSizeInventory(); ++i )
|
||||
{
|
||||
if( inv.getStackInSlot(i) == null && this.isValidForConfig( i, stack ) )
|
||||
{
|
||||
final IAEFluidStack stack = AEFluidStack.create(fs);
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
if (inv.getStackInSlot(i) == null && this.isValidForConfig(i, stack)) {
|
||||
ItemStack tmp = ItemFluidPacket.newStack(fs);
|
||||
if (tmp != null) {
|
||||
tmp.setStackDisplayName(fs.getLocalizedName());
|
||||
}
|
||||
inv.setInventorySlotContents( i, tmp );
|
||||
inv.setInventorySlotContents(i, tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.standardDetectAndSendChanges();
|
||||
return null;
|
||||
} else {
|
||||
if(idx < this.availableUpgrades()){
|
||||
if(!mergeItemStack(tis, this.getFakeFluidInv().getSizeInventory()+this.availableUpgrades(), this.inventorySlots.size(), false)) return null;
|
||||
}else if(idx>=this.getFakeFluidInv().getSizeInventory()+this.availableUpgrades()){
|
||||
if(!mergeItemStack(tis, 0, this.availableUpgrades(), false)) return null;
|
||||
if (idx < this.availableUpgrades()) {
|
||||
if (!mergeItemStack(
|
||||
tis,
|
||||
this.getFakeFluidInv().getSizeInventory() + this.availableUpgrades(),
|
||||
this.inventorySlots.size(),
|
||||
false)) return null;
|
||||
} else if (idx >= this.getFakeFluidInv().getSizeInventory() + this.availableUpgrades()) {
|
||||
if (!mergeItemStack(tis, 0, this.availableUpgrades(), false)) return null;
|
||||
}
|
||||
if (tis.stackSize == 0) {
|
||||
clickSlot.putStack(null);
|
||||
@@ -77,37 +73,32 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setupConfig()
|
||||
{
|
||||
protected void setupConfig() {
|
||||
this.setupUpgrades();
|
||||
|
||||
final IInventory inv = Ae2Reflect.getUpgradeList(this).getInventoryByName( "config" );
|
||||
final IInventory inv = Ae2Reflect.getUpgradeList(this).getInventoryByName("config");
|
||||
final int y = 40;
|
||||
final int x = 80;
|
||||
this.addSlotToContainer( new OptionalFluidSlotFakeTypeOnly( inv, null, this, 0, x, y, 0, 0, 0 ) );
|
||||
if( this.supportCapacity() )
|
||||
{
|
||||
this.addSlotToContainer( new OptionalFluidSlotFakeTypeOnly( inv, null, this, 1, x, y, -1, 0, 1 ) );
|
||||
this.addSlotToContainer( new OptionalFluidSlotFakeTypeOnly( inv, null, this, 2, x, y, 1, 0, 1 ) );
|
||||
this.addSlotToContainer( new OptionalFluidSlotFakeTypeOnly( inv, null, this, 3, x, y, 0, -1, 1 ) );
|
||||
this.addSlotToContainer( new OptionalFluidSlotFakeTypeOnly( inv, null, this, 4, x, y, 0, 1, 1 ) );
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, x, y, 0, 0, 0));
|
||||
if (this.supportCapacity()) {
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 1, x, y, -1, 0, 1));
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 2, x, y, 1, 0, 1));
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 3, x, y, 0, -1, 1));
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 4, x, y, 0, 1, 1));
|
||||
|
||||
this.addSlotToContainer( new OptionalFluidSlotFakeTypeOnly( inv, null, this, 5, x, y, -1, -1, 2 ) );
|
||||
this.addSlotToContainer( new OptionalFluidSlotFakeTypeOnly( inv, null, this, 6, x, y, 1, -1, 2 ) );
|
||||
this.addSlotToContainer( new OptionalFluidSlotFakeTypeOnly( inv, null, this, 7, x, y, -1, 1, 2 ) );
|
||||
this.addSlotToContainer( new OptionalFluidSlotFakeTypeOnly( inv, null, this, 8, x, y, 1, 1, 2 ) );
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 5, x, y, -1, -1, 2));
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 6, x, y, 1, -1, 2));
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 7, x, y, -1, 1, 2));
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 8, x, y, 1, 1, 2));
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isValidForConfig( int slot, IAEFluidStack fs )
|
||||
{
|
||||
if( this.supportCapacity() )
|
||||
{
|
||||
protected boolean isValidForConfig(int slot, IAEFluidStack fs) {
|
||||
if (this.supportCapacity()) {
|
||||
// assumes 4 slots per upgrade
|
||||
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
|
||||
|
||||
if( slot > 0 && upgrades < 1 )
|
||||
{
|
||||
if (slot > 0 && upgrades < 1) {
|
||||
return false;
|
||||
}
|
||||
return slot <= 4 || upgrades >= 2;
|
||||
@@ -117,30 +108,25 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void standardDetectAndSendChanges()
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
protected void standardDetectAndSendChanges() {
|
||||
if (Platform.isServer()) {
|
||||
// clear out config items that are no longer valid (eg capacity upgrade removed)
|
||||
final AppEngInternalAEInventory inv = this.getFakeFluidInv();
|
||||
final Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
for( int i = 0; i < inv.getSizeInventory(); ++i )
|
||||
{
|
||||
if( inv.getStackInSlot( i ) != null && !this.isValidForConfig( i, AEFluidStack.create(ItemFluidPacket.getFluidStack(inv.getStackInSlot( i )))) )
|
||||
{
|
||||
inv.setInventorySlotContents( i, null );
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
if (inv.getStackInSlot(i) != null
|
||||
&& !this.isValidForConfig(
|
||||
i, AEFluidStack.create(ItemFluidPacket.getFluidStack(inv.getStackInSlot(i))))) {
|
||||
inv.setInventorySlotContents(i, null);
|
||||
}
|
||||
tmp.put(i, AEFluidStack.create(ItemFluidPacket.getFluidStack(inv.getStackInSlot( i ))));
|
||||
tmp.put(i, AEFluidStack.create(ItemFluidPacket.getFluidStack(inv.getStackInSlot(i))));
|
||||
}
|
||||
for( final Object g : this.crafters )
|
||||
{
|
||||
if( g instanceof EntityPlayer)
|
||||
{
|
||||
for (final Object g : this.crafters) {
|
||||
if (g instanceof EntityPlayer) {
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(tmp), (EntityPlayerMP) g);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
+154
-211
@@ -31,6 +31,11 @@ import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Future;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -38,67 +43,58 @@ import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class ContainerFluidCraftConfirm extends AEBaseContainer {
|
||||
|
||||
private final ArrayList<CraftingCPURecord> cpus = new ArrayList<CraftingCPURecord>();
|
||||
private Future<ICraftingJob> job;
|
||||
private ICraftingJob result;
|
||||
@GuiSync( 0 )
|
||||
|
||||
@GuiSync(0)
|
||||
public long bytesUsed;
|
||||
@GuiSync( 1 )
|
||||
|
||||
@GuiSync(1)
|
||||
public long cpuBytesAvail;
|
||||
@GuiSync( 2 )
|
||||
|
||||
@GuiSync(2)
|
||||
public int cpuCoProcessors;
|
||||
@GuiSync( 3 )
|
||||
|
||||
@GuiSync(3)
|
||||
public boolean autoStart = false;
|
||||
@GuiSync( 4 )
|
||||
|
||||
@GuiSync(4)
|
||||
public boolean simulation = true;
|
||||
@GuiSync( 5 )
|
||||
|
||||
@GuiSync(5)
|
||||
public int selectedCpu = -1;
|
||||
@GuiSync( 6 )
|
||||
|
||||
@GuiSync(6)
|
||||
public boolean noCPU = true;
|
||||
@GuiSync( 7 )
|
||||
|
||||
@GuiSync(7)
|
||||
public String myName = "";
|
||||
|
||||
public ContainerFluidCraftConfirm(final InventoryPlayer ip, final ITerminalHost te )
|
||||
{
|
||||
super( ip, te );
|
||||
public ContainerFluidCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
|
||||
super(ip, te);
|
||||
}
|
||||
|
||||
public void cycleCpu( final boolean next )
|
||||
{
|
||||
if( next )
|
||||
{
|
||||
this.setSelectedCpu( this.getSelectedCpu() + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setSelectedCpu( this.getSelectedCpu() - 1 );
|
||||
public void cycleCpu(final boolean next) {
|
||||
if (next) {
|
||||
this.setSelectedCpu(this.getSelectedCpu() + 1);
|
||||
} else {
|
||||
this.setSelectedCpu(this.getSelectedCpu() - 1);
|
||||
}
|
||||
|
||||
if( this.getSelectedCpu() < -1 )
|
||||
{
|
||||
this.setSelectedCpu( this.cpus.size() - 1 );
|
||||
}
|
||||
else if( this.getSelectedCpu() >= this.cpus.size() )
|
||||
{
|
||||
this.setSelectedCpu( -1 );
|
||||
if (this.getSelectedCpu() < -1) {
|
||||
this.setSelectedCpu(this.cpus.size() - 1);
|
||||
} else if (this.getSelectedCpu() >= this.cpus.size()) {
|
||||
this.setSelectedCpu(-1);
|
||||
}
|
||||
|
||||
if( this.getSelectedCpu() == -1 )
|
||||
{
|
||||
this.setCpuAvailableBytes( 0 );
|
||||
this.setCpuCoProcessors( 0 );
|
||||
this.setName( "" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.getSelectedCpu() == -1) {
|
||||
this.setCpuAvailableBytes(0);
|
||||
this.setCpuCoProcessors(0);
|
||||
this.setName("");
|
||||
} else {
|
||||
this.setName(Ae2Reflect.getName(this.cpus.get(this.getSelectedCpu())));
|
||||
this.setCpuAvailableBytes(Ae2Reflect.getSize(this.cpus.get(this.getSelectedCpu())));
|
||||
this.setCpuCoProcessors(Ae2Reflect.getProcessors(this.cpus.get(this.getSelectedCpu())));
|
||||
@@ -106,339 +102,286 @@ public class ContainerFluidCraftConfirm extends AEBaseContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
public void detectAndSendChanges() {
|
||||
if (Platform.isClient()) {
|
||||
return;
|
||||
}
|
||||
if (getGrid() == null)
|
||||
return;
|
||||
if (getGrid() == null) return;
|
||||
|
||||
final ICraftingGrid cc = this.getGrid().getCache( ICraftingGrid.class );
|
||||
final ICraftingGrid cc = this.getGrid().getCache(ICraftingGrid.class);
|
||||
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
|
||||
|
||||
int matches = 0;
|
||||
boolean changed = false;
|
||||
for( final ICraftingCPU c : cpuSet )
|
||||
{
|
||||
for (final ICraftingCPU c : cpuSet) {
|
||||
boolean found = false;
|
||||
for( final CraftingCPURecord ccr : this.cpus )
|
||||
{
|
||||
if( Ae2Reflect.getCPU(ccr) == c )
|
||||
{
|
||||
for (final CraftingCPURecord ccr : this.cpus) {
|
||||
if (Ae2Reflect.getCPU(ccr) == c) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
final boolean matched = this.cpuMatches( c );
|
||||
final boolean matched = this.cpuMatches(c);
|
||||
|
||||
if( matched )
|
||||
{
|
||||
if (matched) {
|
||||
matches++;
|
||||
}
|
||||
|
||||
if( found == !matched )
|
||||
{
|
||||
if (found == !matched) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( changed || this.cpus.size() != matches )
|
||||
{
|
||||
if (changed || this.cpus.size() != matches) {
|
||||
this.cpus.clear();
|
||||
for( final ICraftingCPU c : cpuSet )
|
||||
{
|
||||
if( this.cpuMatches( c ) )
|
||||
{
|
||||
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
|
||||
for (final ICraftingCPU c : cpuSet) {
|
||||
if (this.cpuMatches(c)) {
|
||||
this.cpus.add(new CraftingCPURecord(c.getAvailableStorage(), c.getCoProcessors(), c));
|
||||
}
|
||||
}
|
||||
|
||||
this.sendCPUs();
|
||||
}
|
||||
|
||||
this.setNoCPU( this.cpus.isEmpty() );
|
||||
this.setNoCPU(this.cpus.isEmpty());
|
||||
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if( this.getJob() != null && this.getJob().isDone() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.getJob() != null && this.getJob().isDone()) {
|
||||
try {
|
||||
this.result = this.getJob().get();
|
||||
|
||||
if( !this.result.isSimulation() )
|
||||
{
|
||||
this.setSimulation( false );
|
||||
if( this.isAutoStart() )
|
||||
{
|
||||
if (!this.result.isSimulation()) {
|
||||
this.setSimulation(false);
|
||||
if (this.isAutoStart()) {
|
||||
this.startJob();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setSimulation( true );
|
||||
} else {
|
||||
this.setSimulation(true);
|
||||
}
|
||||
|
||||
final SPacketMEInventoryUpdate a = new SPacketMEInventoryUpdate( (byte) 0 );
|
||||
final SPacketMEInventoryUpdate b = new SPacketMEInventoryUpdate( (byte) 1 );
|
||||
final SPacketMEInventoryUpdate c = this.result.isSimulation() ? new SPacketMEInventoryUpdate( (byte) 2 ) : null;
|
||||
final SPacketMEInventoryUpdate a = new SPacketMEInventoryUpdate((byte) 0);
|
||||
final SPacketMEInventoryUpdate b = new SPacketMEInventoryUpdate((byte) 1);
|
||||
final SPacketMEInventoryUpdate c =
|
||||
this.result.isSimulation() ? new SPacketMEInventoryUpdate((byte) 2) : null;
|
||||
|
||||
final IItemList<IAEItemStack> plan = AEApi.instance().storage().createItemList();
|
||||
this.result.populatePlan( plan );
|
||||
this.result.populatePlan(plan);
|
||||
|
||||
this.setUsedBytes( this.result.getByteTotal() );
|
||||
this.setUsedBytes(this.result.getByteTotal());
|
||||
|
||||
for( final IAEItemStack out : plan )
|
||||
{
|
||||
for (final IAEItemStack out : plan) {
|
||||
|
||||
IAEItemStack o = out.copy();
|
||||
o.reset();
|
||||
o.setStackSize( out.getStackSize() );
|
||||
o.setStackSize(out.getStackSize());
|
||||
|
||||
final IAEItemStack p = out.copy();
|
||||
p.reset();
|
||||
p.setStackSize( out.getCountRequestable() );
|
||||
p.setStackSize(out.getCountRequestable());
|
||||
|
||||
final IStorageGrid sg = this.getGrid().getCache( IStorageGrid.class );
|
||||
final IStorageGrid sg = this.getGrid().getCache(IStorageGrid.class);
|
||||
final IMEInventory<IAEItemStack> items = sg.getItemInventory();
|
||||
|
||||
IAEItemStack m = null;
|
||||
if( c != null && this.result.isSimulation() )
|
||||
{
|
||||
if (c != null && this.result.isSimulation()) {
|
||||
m = o.copy();
|
||||
o = items.extractItems( o, Actionable.SIMULATE, this.getActionSource() );
|
||||
o = items.extractItems(o, Actionable.SIMULATE, this.getActionSource());
|
||||
|
||||
if( o == null )
|
||||
{
|
||||
if (o == null) {
|
||||
o = m.copy();
|
||||
o.setStackSize( 0 );
|
||||
o.setStackSize(0);
|
||||
}
|
||||
|
||||
m.setStackSize( m.getStackSize() - o.getStackSize() );
|
||||
m.setStackSize(m.getStackSize() - o.getStackSize());
|
||||
}
|
||||
|
||||
if( o.getStackSize() > 0 )
|
||||
{
|
||||
a.appendItem( o );
|
||||
if (o.getStackSize() > 0) {
|
||||
a.appendItem(o);
|
||||
}
|
||||
|
||||
if( p.getStackSize() > 0 )
|
||||
{
|
||||
b.appendItem( p );
|
||||
if (p.getStackSize() > 0) {
|
||||
b.appendItem(p);
|
||||
}
|
||||
|
||||
if( c != null && m != null && m.getStackSize() > 0 )
|
||||
{
|
||||
c.appendItem( m );
|
||||
if (c != null && m != null && m.getStackSize() > 0) {
|
||||
c.appendItem(m);
|
||||
}
|
||||
}
|
||||
|
||||
for( final Object g : this.crafters )
|
||||
{
|
||||
if( g instanceof EntityPlayer)
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendTo( a, (EntityPlayerMP) g );
|
||||
FluidCraft.proxy.netHandler.sendTo( b, (EntityPlayerMP) g );
|
||||
if( c != null )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendTo( c, (EntityPlayerMP) g );
|
||||
for (final Object g : this.crafters) {
|
||||
if (g instanceof EntityPlayer) {
|
||||
FluidCraft.proxy.netHandler.sendTo(a, (EntityPlayerMP) g);
|
||||
FluidCraft.proxy.netHandler.sendTo(b, (EntityPlayerMP) g);
|
||||
if (c != null) {
|
||||
FluidCraft.proxy.netHandler.sendTo(c, (EntityPlayerMP) g);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
this.getPlayerInv().player.addChatMessage( new ChatComponentText( "Error: " + e.toString() ) );
|
||||
AELog.debug( e );
|
||||
this.setValidContainer( false );
|
||||
} catch (final Throwable e) {
|
||||
this.getPlayerInv().player.addChatMessage(new ChatComponentText("Error: " + e.toString()));
|
||||
AELog.debug(e);
|
||||
this.setValidContainer(false);
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
this.setJob( null );
|
||||
this.setJob(null);
|
||||
}
|
||||
this.verifyPermissions( SecurityPermissions.CRAFT, false );
|
||||
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
||||
}
|
||||
|
||||
private IGrid getGrid()
|
||||
{
|
||||
final IActionHost h = ( (IActionHost) this.getTarget() );
|
||||
if (h == null || h.getActionableNode() == null)
|
||||
return null;
|
||||
private IGrid getGrid() {
|
||||
final IActionHost h = ((IActionHost) this.getTarget());
|
||||
if (h == null || h.getActionableNode() == null) return null;
|
||||
return h.getActionableNode().getGrid();
|
||||
}
|
||||
|
||||
private boolean cpuMatches( final ICraftingCPU c )
|
||||
{
|
||||
private boolean cpuMatches(final ICraftingCPU c) {
|
||||
return c.getAvailableStorage() >= this.getUsedBytes() && !c.isBusy();
|
||||
}
|
||||
|
||||
private void sendCPUs()
|
||||
{
|
||||
Collections.sort( this.cpus );
|
||||
private void sendCPUs() {
|
||||
Collections.sort(this.cpus);
|
||||
|
||||
if( this.getSelectedCpu() >= this.cpus.size() )
|
||||
{
|
||||
this.setSelectedCpu( -1 );
|
||||
this.setCpuAvailableBytes( 0 );
|
||||
this.setCpuCoProcessors( 0 );
|
||||
this.setName( "" );
|
||||
}
|
||||
else if( this.getSelectedCpu() != -1 )
|
||||
{
|
||||
if (this.getSelectedCpu() >= this.cpus.size()) {
|
||||
this.setSelectedCpu(-1);
|
||||
this.setCpuAvailableBytes(0);
|
||||
this.setCpuCoProcessors(0);
|
||||
this.setName("");
|
||||
} else if (this.getSelectedCpu() != -1) {
|
||||
this.setName(Ae2Reflect.getName(this.cpus.get(this.getSelectedCpu())));
|
||||
this.setCpuAvailableBytes(Ae2Reflect.getSize(this.cpus.get(this.getSelectedCpu())));
|
||||
this.setCpuCoProcessors(Ae2Reflect.getProcessors(this.cpus.get(this.getSelectedCpu())));
|
||||
}
|
||||
}
|
||||
|
||||
public void startJob()
|
||||
{
|
||||
public void startJob() {
|
||||
GuiType originalGui = null;
|
||||
|
||||
final IActionHost ah = this.getActionHost();
|
||||
if( ah instanceof PartFluidPatternTerminal)
|
||||
{
|
||||
if (ah instanceof PartFluidPatternTerminal) {
|
||||
originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
if( ah instanceof PartFluidPatternTerminalEx)
|
||||
{
|
||||
if (ah instanceof PartFluidPatternTerminalEx) {
|
||||
originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
}
|
||||
|
||||
if( this.result != null && !this.isSimulation() && getGrid() != null)
|
||||
{
|
||||
final ICraftingGrid cc = this.getGrid().getCache( ICraftingGrid.class );
|
||||
final ICraftingLink g = cc.submitJob( this.result, null, this.getSelectedCpu() == -1 ? null : Ae2Reflect.getCPU(this.cpus.get(this.getSelectedCpu())), true, this.getActionSrc() );
|
||||
this.setAutoStart( false );
|
||||
if( g != null && originalGui != null && this.getOpenContext() != null )
|
||||
{
|
||||
InventoryHandler.openGui(this.getInventoryPlayer().player, getWorld(), new BlockPos(this.getOpenContext().getTile()), Objects.requireNonNull(Util.from(this.getOpenContext().getSide())), originalGui);
|
||||
if (this.result != null && !this.isSimulation() && getGrid() != null) {
|
||||
final ICraftingGrid cc = this.getGrid().getCache(ICraftingGrid.class);
|
||||
final ICraftingLink g = cc.submitJob(
|
||||
this.result,
|
||||
null,
|
||||
this.getSelectedCpu() == -1 ? null : Ae2Reflect.getCPU(this.cpus.get(this.getSelectedCpu())),
|
||||
true,
|
||||
this.getActionSrc());
|
||||
this.setAutoStart(false);
|
||||
if (g != null && originalGui != null && this.getOpenContext() != null) {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(this.getOpenContext().getTile()),
|
||||
Objects.requireNonNull(Util.from(this.getOpenContext().getSide())),
|
||||
originalGui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BaseActionSource getActionSrc()
|
||||
{
|
||||
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
|
||||
private BaseActionSource getActionSrc() {
|
||||
return new PlayerSource(this.getPlayerInv().player, (IActionHost) this.getTarget());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCraftingFromCrafters( final ICrafting c )
|
||||
{
|
||||
super.removeCraftingFromCrafters( c );
|
||||
if( this.getJob() != null )
|
||||
{
|
||||
this.getJob().cancel( true );
|
||||
this.setJob( null );
|
||||
public void removeCraftingFromCrafters(final ICrafting c) {
|
||||
super.removeCraftingFromCrafters(c);
|
||||
if (this.getJob() != null) {
|
||||
this.getJob().cancel(true);
|
||||
this.setJob(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed( final EntityPlayer par1EntityPlayer )
|
||||
{
|
||||
super.onContainerClosed( par1EntityPlayer );
|
||||
if( this.getJob() != null )
|
||||
{
|
||||
this.getJob().cancel( true );
|
||||
this.setJob( null );
|
||||
public void onContainerClosed(final EntityPlayer par1EntityPlayer) {
|
||||
super.onContainerClosed(par1EntityPlayer);
|
||||
if (this.getJob() != null) {
|
||||
this.getJob().cancel(true);
|
||||
this.setJob(null);
|
||||
}
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
{
|
||||
public World getWorld() {
|
||||
return this.getPlayerInv().player.worldObj;
|
||||
}
|
||||
|
||||
public boolean isAutoStart()
|
||||
{
|
||||
public boolean isAutoStart() {
|
||||
return this.autoStart;
|
||||
}
|
||||
|
||||
public void setAutoStart( final boolean autoStart )
|
||||
{
|
||||
public void setAutoStart(final boolean autoStart) {
|
||||
this.autoStart = autoStart;
|
||||
}
|
||||
|
||||
public long getUsedBytes()
|
||||
{
|
||||
public long getUsedBytes() {
|
||||
return this.bytesUsed;
|
||||
}
|
||||
|
||||
private void setUsedBytes( final long bytesUsed )
|
||||
{
|
||||
private void setUsedBytes(final long bytesUsed) {
|
||||
this.bytesUsed = bytesUsed;
|
||||
}
|
||||
|
||||
public long getCpuAvailableBytes()
|
||||
{
|
||||
public long getCpuAvailableBytes() {
|
||||
return this.cpuBytesAvail;
|
||||
}
|
||||
|
||||
private void setCpuAvailableBytes( final long cpuBytesAvail )
|
||||
{
|
||||
private void setCpuAvailableBytes(final long cpuBytesAvail) {
|
||||
this.cpuBytesAvail = cpuBytesAvail;
|
||||
}
|
||||
|
||||
public int getCpuCoProcessors()
|
||||
{
|
||||
public int getCpuCoProcessors() {
|
||||
return this.cpuCoProcessors;
|
||||
}
|
||||
|
||||
private void setCpuCoProcessors( final int cpuCoProcessors )
|
||||
{
|
||||
private void setCpuCoProcessors(final int cpuCoProcessors) {
|
||||
this.cpuCoProcessors = cpuCoProcessors;
|
||||
}
|
||||
|
||||
public int getSelectedCpu()
|
||||
{
|
||||
public int getSelectedCpu() {
|
||||
return this.selectedCpu;
|
||||
}
|
||||
|
||||
private void setSelectedCpu( final int selectedCpu )
|
||||
{
|
||||
private void setSelectedCpu(final int selectedCpu) {
|
||||
this.selectedCpu = selectedCpu;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.myName;
|
||||
}
|
||||
|
||||
private void setName( @Nonnull final String myName )
|
||||
{
|
||||
private void setName(@Nonnull final String myName) {
|
||||
this.myName = myName;
|
||||
}
|
||||
|
||||
public boolean hasNoCPU()
|
||||
{
|
||||
public boolean hasNoCPU() {
|
||||
return this.noCPU;
|
||||
}
|
||||
|
||||
private void setNoCPU( final boolean noCPU )
|
||||
{
|
||||
private void setNoCPU(final boolean noCPU) {
|
||||
this.noCPU = noCPU;
|
||||
}
|
||||
|
||||
public boolean isSimulation()
|
||||
{
|
||||
public boolean isSimulation() {
|
||||
return this.simulation;
|
||||
}
|
||||
|
||||
private void setSimulation( final boolean simulation )
|
||||
{
|
||||
private void setSimulation(final boolean simulation) {
|
||||
this.simulation = simulation;
|
||||
}
|
||||
|
||||
private Future<ICraftingJob> getJob()
|
||||
{
|
||||
private Future<ICraftingJob> getJob() {
|
||||
return this.job;
|
||||
}
|
||||
|
||||
public void setJob( final Future<ICraftingJob> job )
|
||||
{
|
||||
public void setJob(final Future<ICraftingJob> job) {
|
||||
this.job = job;
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,11 @@ import com.glodblock.github.common.parts.PartSharedFluidBus;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerFluidIO extends ContainerFluidConfigurable
|
||||
{
|
||||
public class ContainerFluidIO extends ContainerFluidConfigurable {
|
||||
private final PartSharedFluidBus bus;
|
||||
|
||||
public ContainerFluidIO(InventoryPlayer ip, PartSharedFluidBus te )
|
||||
{
|
||||
super( ip, te );
|
||||
public ContainerFluidIO(InventoryPlayer ip, PartSharedFluidBus te) {
|
||||
super(ip, te);
|
||||
this.bus = te;
|
||||
}
|
||||
|
||||
@@ -32,7 +30,7 @@ public class ContainerFluidIO extends ContainerFluidConfigurable
|
||||
protected void loadSettingsFromHost(IConfigManager cm) {
|
||||
super.loadSettingsFromHost(cm);
|
||||
if (Ae2Reflect.getUpgradeableHost(this) instanceof PartFluidExportBus) {
|
||||
this.setCraftingMode((YesNo)cm.getSetting(Settings.CRAFT_ONLY));
|
||||
this.setCraftingMode((YesNo) cm.getSetting(Settings.CRAFT_ONLY));
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
-18
@@ -10,14 +10,13 @@ import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ContainerFluidInterface extends AEBaseContainer implements IOptionalSlotHost {
|
||||
|
||||
private final Object tile;
|
||||
@@ -29,7 +28,8 @@ public class ContainerFluidInterface extends AEBaseContainer implements IOptiona
|
||||
final int y = 35;
|
||||
final int x = 35;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, tile.getDualityFluid().getConfig(), this, i, x, y, i, 0, 0));
|
||||
addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(
|
||||
inv, tile.getDualityFluid().getConfig(), this, i, x, y, i, 0, 0));
|
||||
}
|
||||
bindPlayerInventory(ipl, 0, 149);
|
||||
}
|
||||
@@ -41,7 +41,8 @@ public class ContainerFluidInterface extends AEBaseContainer implements IOptiona
|
||||
final int y = 35;
|
||||
final int x = 35;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, tile.getDualityFluid().getConfig(), this, i, x, y, i, 0, 0));
|
||||
addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(
|
||||
inv, tile.getDualityFluid().getConfig(), this, i, x, y, i, 0, 0));
|
||||
}
|
||||
bindPlayerInventory(ipl, 0, 149);
|
||||
}
|
||||
@@ -60,29 +61,31 @@ public class ContainerFluidInterface extends AEBaseContainer implements IOptiona
|
||||
super.detectAndSendChanges();
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
if (tile instanceof TileFluidInterface) {
|
||||
for (int i = 0; i < ((TileFluidInterface) tile).getInternalFluid().getSlots(); i ++) {
|
||||
for (int i = 0; i < ((TileFluidInterface) tile).getInternalFluid().getSlots(); i++) {
|
||||
tmp.put(i, ((TileFluidInterface) tile).getInternalFluid().getFluidInSlot(i));
|
||||
}
|
||||
for (int i = 0; i < ((TileFluidInterface) tile).getConfig().getSizeInventory(); i ++) {
|
||||
tmp.put(i + 100, AEFluidStack.create(ItemFluidPacket.getFluidStack(((TileFluidInterface) tile).getConfig().getStackInSlot( i ))));
|
||||
for (int i = 0; i < ((TileFluidInterface) tile).getConfig().getSizeInventory(); i++) {
|
||||
tmp.put(
|
||||
i + 100,
|
||||
AEFluidStack.create(ItemFluidPacket.getFluidStack(
|
||||
((TileFluidInterface) tile).getConfig().getStackInSlot(i))));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < ((PartFluidInterface) tile).getInternalFluid().getSlots(); i ++) {
|
||||
} else {
|
||||
for (int i = 0; i < ((PartFluidInterface) tile).getInternalFluid().getSlots(); i++) {
|
||||
tmp.put(i, ((PartFluidInterface) tile).getInternalFluid().getFluidInSlot(i));
|
||||
}
|
||||
for (int i = 0; i < ((PartFluidInterface) tile).getConfig().getSizeInventory(); i ++) {
|
||||
tmp.put(i + 100, AEFluidStack.create(ItemFluidPacket.getFluidStack(((PartFluidInterface) tile).getConfig().getStackInSlot( i ))));
|
||||
for (int i = 0; i < ((PartFluidInterface) tile).getConfig().getSizeInventory(); i++) {
|
||||
tmp.put(
|
||||
i + 100,
|
||||
AEFluidStack.create(ItemFluidPacket.getFluidStack(
|
||||
((PartFluidInterface) tile).getConfig().getStackInSlot(i))));
|
||||
}
|
||||
}
|
||||
|
||||
for( final Object g : this.crafters )
|
||||
{
|
||||
if( g instanceof EntityPlayer)
|
||||
{
|
||||
for (final Object g : this.crafters) {
|
||||
if (g instanceof EntityPlayer) {
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(tmp), (EntityPlayerMP) g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+2
-3
@@ -1,12 +1,12 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.PACKET;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
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) {
|
||||
@@ -14,5 +14,4 @@ public class ContainerFluidPacketDecoder extends AEBaseContainer {
|
||||
addSlotToContainer(new FCSlotRestrictedInput(PACKET.stack(), tile.getInventory(), 0, 80, 35, ipl));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
|
||||
}
|
||||
+23
-21
@@ -18,6 +18,10 @@ import com.glodblock.github.inventory.slot.SlotFluid;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import com.glodblock.github.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -26,11 +30,6 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ContainerFluidPatternEncoder extends AEBaseContainer implements PatternConsumer {
|
||||
|
||||
private final TileFluidPatternEncoder tile;
|
||||
@@ -47,9 +46,9 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
||||
addSlotToContainer(new SlotFluidConvertingFake(output, y, 113, 17 + y * 18));
|
||||
}
|
||||
addSlotToContainer(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, tile.getInventory(), 0, 138, 20, ipl));
|
||||
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, tile.getInventory(), 0, 138, 20, ipl));
|
||||
addSlotToContainer(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, tile.getInventory(), 1, 138, 50, ipl));
|
||||
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, tile.getInventory(), 1, 138, 50, ipl));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
|
||||
@@ -57,8 +56,15 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
||||
return tile;
|
||||
}
|
||||
|
||||
private static boolean isNotPattern(ItemStack stack) {
|
||||
return stack == null
|
||||
|| !(AEApi.instance().definitions().materials().blankPattern().isSameAs(stack)
|
||||
|| (stack.getItem() instanceof ItemFluidEncodedPattern));
|
||||
}
|
||||
|
||||
public boolean canEncodePattern() {
|
||||
if (isNotPattern(tile.getInventory().getStackInSlot(0)) && isNotPattern(tile.getInventory().getStackInSlot(1))) {
|
||||
if (isNotPattern(tile.getInventory().getStackInSlot(0))
|
||||
&& isNotPattern(tile.getInventory().getStackInSlot(1))) {
|
||||
return false;
|
||||
}
|
||||
find_input:
|
||||
@@ -78,11 +84,6 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isNotPattern(ItemStack stack) {
|
||||
return stack == null || !(AEApi.instance().definitions().materials().blankPattern().isSameAs(stack)
|
||||
|| (stack.getItem() instanceof ItemFluidEncodedPattern));
|
||||
}
|
||||
|
||||
public void encodePattern() {
|
||||
if (canEncodePattern()) {
|
||||
// if there is an encoded pattern, overwrite it; otherwise, consume a blank
|
||||
@@ -126,12 +127,13 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
||||
if (stack == null) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
((SlotFluidConvertingFake)slot).putConvertedStack(stack.copy());
|
||||
((SlotFluidConvertingFake) slot).putConvertedStack(stack.copy());
|
||||
}
|
||||
break;
|
||||
case PLACE_SINGLE:
|
||||
if (stack != null) {
|
||||
((SlotFluidConvertingFake)slot).putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||
((SlotFluidConvertingFake) slot)
|
||||
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||
}
|
||||
break;
|
||||
case SPLIT_OR_PLACE_SINGLE:
|
||||
@@ -140,13 +142,15 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
||||
if (stack == null) {
|
||||
slot.putStack(Util.copyStackWithSize(inSlot, Math.max(1, inSlot.stackSize - 1)));
|
||||
} else if (stack.isItemEqual(inSlot)) {
|
||||
slot.putStack(Util.copyStackWithSize(inSlot,
|
||||
Math.min(inSlot.getMaxStackSize(), inSlot.stackSize + 1)));
|
||||
slot.putStack(Util.copyStackWithSize(
|
||||
inSlot, Math.min(inSlot.getMaxStackSize(), inSlot.stackSize + 1)));
|
||||
} else {
|
||||
((SlotFluidConvertingFake)slot).putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||
((SlotFluidConvertingFake) slot)
|
||||
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||
}
|
||||
} else if (stack != null) {
|
||||
((SlotFluidConvertingFake)slot).putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||
((SlotFluidConvertingFake) slot)
|
||||
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -220,7 +224,5 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
||||
public IAEItemStack getAeStack() {
|
||||
return inv.getStack(getSlotIndex());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+25
-20
@@ -31,15 +31,27 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
|
||||
super(ip, monitorable);
|
||||
}
|
||||
|
||||
public void encodeAllItemAndMoveToInventory(){
|
||||
private static boolean isPattern(final ItemStack output) {
|
||||
if (output == null) {
|
||||
return false;
|
||||
}
|
||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
return true;
|
||||
}
|
||||
final IDefinitions defs = AEApi.instance().definitions();
|
||||
return defs.items().encodedPattern().isSameAs(output)
|
||||
|| defs.materials().blankPattern().isSameAs(output);
|
||||
}
|
||||
|
||||
public void encodeAllItemAndMoveToInventory() {
|
||||
encode();
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
if(output != null){
|
||||
if(this.patternSlotIN.getStack() != null) output.stackSize += this.patternSlotIN.getStack().stackSize;
|
||||
if (!getPlayerInv().addItemStackToInventory( output )){
|
||||
if (output != null) {
|
||||
if (this.patternSlotIN.getStack() != null) output.stackSize += this.patternSlotIN.getStack().stackSize;
|
||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
||||
getPlayerInv().player.entityDropItem(output, 0);
|
||||
}
|
||||
this.patternSlotOUT.putStack( null );
|
||||
this.patternSlotOUT.putStack(null);
|
||||
this.patternSlotIN.putStack(null);
|
||||
}
|
||||
}
|
||||
@@ -59,7 +71,7 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
|
||||
if (stack.stackSize == 1) {
|
||||
this.patternSlotIN.putStack(null);
|
||||
} else {
|
||||
stack.stackSize --;
|
||||
stack.stackSize--;
|
||||
}
|
||||
encodeFluidPattern();
|
||||
} else if (isPattern(stack)) {
|
||||
@@ -67,17 +79,6 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPattern(final ItemStack output) {
|
||||
if (output == null) {
|
||||
return false;
|
||||
}
|
||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
return true;
|
||||
}
|
||||
final IDefinitions defs = AEApi.instance().definitions();
|
||||
return defs.items().encodedPattern().isSameAs(output) || defs.materials().blankPattern().isSameAs(output);
|
||||
}
|
||||
|
||||
private boolean checkHasFluidPattern() {
|
||||
if (this.craftingMode) {
|
||||
return false;
|
||||
@@ -119,7 +120,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);
|
||||
// pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
|
||||
patternSlotOUT.putStack(pattern.writeToStack());
|
||||
}
|
||||
|
||||
@@ -174,7 +175,8 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
if ((slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs) && (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
|
||||
if ((slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs)
|
||||
&& (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
|
||||
FluidStack fluid = null;
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
@@ -204,7 +206,10 @@ public class ContainerFluidPatternTerminal extends FCBasePartContainer implement
|
||||
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)) {
|
||||
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);
|
||||
|
||||
+27
-21
@@ -30,15 +30,27 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
super(ip, monitorable);
|
||||
}
|
||||
|
||||
public void encodeAllItemAndMoveToInventory(){
|
||||
private static boolean isPattern(final ItemStack output) {
|
||||
if (output == null) {
|
||||
return false;
|
||||
}
|
||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
return true;
|
||||
}
|
||||
final IDefinitions defs = AEApi.instance().definitions();
|
||||
return defs.items().encodedPattern().isSameAs(output)
|
||||
|| defs.materials().blankPattern().isSameAs(output);
|
||||
}
|
||||
|
||||
public void encodeAllItemAndMoveToInventory() {
|
||||
encode();
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
if(output != null){
|
||||
if(this.patternSlotIN.getStack() != null) output.stackSize += this.patternSlotIN.getStack().stackSize;
|
||||
if (!getPlayerInv().addItemStackToInventory( output )){
|
||||
if (output != null) {
|
||||
if (this.patternSlotIN.getStack() != null) output.stackSize += this.patternSlotIN.getStack().stackSize;
|
||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
||||
getPlayerInv().player.entityDropItem(output, 0);
|
||||
}
|
||||
this.patternSlotOUT.putStack( null );
|
||||
this.patternSlotOUT.putStack(null);
|
||||
this.patternSlotIN.putStack(null);
|
||||
}
|
||||
}
|
||||
@@ -58,7 +70,7 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
if (stack.stackSize == 1) {
|
||||
this.patternSlotIN.putStack(null);
|
||||
} else {
|
||||
stack.stackSize --;
|
||||
stack.stackSize--;
|
||||
}
|
||||
encodeFluidPattern();
|
||||
} else if (isPattern(stack)) {
|
||||
@@ -66,17 +78,6 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPattern(final ItemStack output) {
|
||||
if (output == null) {
|
||||
return false;
|
||||
}
|
||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
return true;
|
||||
}
|
||||
final IDefinitions defs = AEApi.instance().definitions();
|
||||
return defs.items().encodedPattern().isSameAs(output) || defs.materials().blankPattern().isSameAs(output);
|
||||
}
|
||||
|
||||
private boolean checkHasFluidPattern() {
|
||||
boolean hasFluid = false, search = false;
|
||||
for (Slot craftingSlot : this.craftingSlots) {
|
||||
@@ -113,10 +114,10 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
private void encodeFluidPattern() {
|
||||
ItemStack patternStack = new ItemStack(ItemAndBlockHolder.PATTERN);
|
||||
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
||||
pattern.setCombine(this.combine ? 1:0);
|
||||
pattern.setCombine(this.combine ? 1 : 0);
|
||||
pattern.setInputs(collectInventory(craftingSlots));
|
||||
pattern.setOutputs(collectInventory(outputSlots));
|
||||
// pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
|
||||
// pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
|
||||
patternSlotOUT.putStack(pattern.writeToStack());
|
||||
}
|
||||
|
||||
@@ -167,7 +168,9 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
if ((slot instanceof OptionalSlotFake) && stack != null && (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
|
||||
if ((slot instanceof OptionalSlotFake)
|
||||
&& stack != null
|
||||
&& (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
|
||||
FluidStack fluid = null;
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
@@ -202,7 +205,10 @@ public class ContainerFluidPatternTerminalEx extends FCBasePartContainerEx imple
|
||||
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)) {
|
||||
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);
|
||||
|
||||
+6
-10
@@ -7,14 +7,13 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.TankDumpable;
|
||||
import com.glodblock.github.common.tile.TileIngredientBuffer;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ContainerIngredientBuffer extends AEBaseContainer implements TankDumpable {
|
||||
|
||||
private final TileIngredientBuffer tile;
|
||||
@@ -46,17 +45,14 @@ public class ContainerIngredientBuffer extends AEBaseContainer implements TankDu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
for (int i = 0; i < tile.getFluidInventory().getSlots(); i ++) {
|
||||
for (int i = 0; i < tile.getFluidInventory().getSlots(); i++) {
|
||||
tmp.put(i, tile.getFluidInventory().getFluidInSlot(i));
|
||||
}
|
||||
for( final Object g : this.crafters )
|
||||
{
|
||||
if( g instanceof EntityPlayer)
|
||||
{
|
||||
for (final Object g : this.crafters) {
|
||||
if (g instanceof EntityPlayer) {
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(tmp), (EntityPlayerMP) g);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-11
@@ -7,14 +7,13 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.TankDumpable;
|
||||
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ContainerLargeIngredientBuffer extends AEBaseContainer implements TankDumpable {
|
||||
|
||||
private final TileLargeIngredientBuffer tile;
|
||||
@@ -48,20 +47,16 @@ public class ContainerLargeIngredientBuffer extends AEBaseContainer implements T
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
for (int i = 0; i < tile.getFluidInventory().getSlots(); i ++) {
|
||||
for (int i = 0; i < tile.getFluidInventory().getSlots(); i++) {
|
||||
tmp.put(i, tile.getFluidInventory().getFluidInSlot(i));
|
||||
}
|
||||
for( final Object g : this.crafters )
|
||||
{
|
||||
if( g instanceof EntityPlayer)
|
||||
{
|
||||
for (final Object g : this.crafters) {
|
||||
if (g instanceof EntityPlayer) {
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(tmp), (EntityPlayerMP) g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,6 @@ 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];
|
||||
|
||||
+8
-6
@@ -9,15 +9,17 @@ public class ContainerOCPatternEditor extends AEBaseContainer {
|
||||
|
||||
public ContainerOCPatternEditor(InventoryPlayer ipl, TileOCPatternEditor tile) {
|
||||
super(ipl, tile);
|
||||
for (int i = 0; i < 4; i ++) {
|
||||
for (int j = 0; j < 4; j ++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
addSlotToContainer(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.PATTERN, tile.getInternalInventory(),
|
||||
j * 4 + i, 55 + i * 18, 17 + j * 18, ipl
|
||||
));
|
||||
SlotRestrictedInput.PlacableItemType.PATTERN,
|
||||
tile.getInternalInventory(),
|
||||
j * 4 + i,
|
||||
55 + i * 18,
|
||||
17 + j * 18,
|
||||
ipl));
|
||||
}
|
||||
}
|
||||
bindPlayerInventory(ipl, 0, 104);
|
||||
}
|
||||
|
||||
}
|
||||
+9
-15
@@ -10,36 +10,30 @@ import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerPatternValueAmount extends AEBaseContainer {
|
||||
|
||||
|
||||
private final Slot patternValue;
|
||||
private int valueIndex;
|
||||
|
||||
public ContainerPatternValueAmount(final InventoryPlayer ip, final ITerminalHost te )
|
||||
{
|
||||
super( ip, te );
|
||||
this.patternValue = new SlotInaccessible( new AppEngInternalInventory( null, 1 ), 0, 34, 53 );
|
||||
this.addSlotToContainer( patternValue );
|
||||
public ContainerPatternValueAmount(final InventoryPlayer ip, final ITerminalHost te) {
|
||||
super(ip, te);
|
||||
this.patternValue = new SlotInaccessible(new AppEngInternalInventory(null, 1), 0, 34, 53);
|
||||
this.addSlotToContainer(patternValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
this.verifyPermissions( SecurityPermissions.CRAFT, false );
|
||||
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
||||
}
|
||||
|
||||
public Slot getPatternValue()
|
||||
{
|
||||
public Slot getPatternValue() {
|
||||
return patternValue;
|
||||
}
|
||||
|
||||
public int getValueIndex()
|
||||
{
|
||||
public int getValueIndex() {
|
||||
return valueIndex;
|
||||
}
|
||||
|
||||
public void setValueIndex( int valueIndex )
|
||||
{
|
||||
public void setValueIndex(int valueIndex) {
|
||||
this.valueIndex = valueIndex;
|
||||
}
|
||||
}
|
||||
+68
-31
@@ -41,6 +41,11 @@ 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 java.io.IOException;
|
||||
import java.nio.BufferOverflowException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -53,22 +58,20 @@ 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> {
|
||||
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;
|
||||
@@ -77,8 +80,12 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -92,7 +99,7 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
if (this.monitor != null) {
|
||||
this.monitor.addListener(this, null);
|
||||
|
||||
// this.setCellInventory( this.monitor );
|
||||
// this.setCellInventory( this.monitor );
|
||||
|
||||
if (monitorable instanceof IPortableCell) {
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
@@ -118,7 +125,13 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
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] = 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]);
|
||||
}
|
||||
@@ -137,7 +150,9 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
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())) {
|
||||
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)));
|
||||
@@ -163,7 +178,8 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
this.clientCM.putSetting(set, sideLocal);
|
||||
for (final Object crafter : this.crafters) {
|
||||
try {
|
||||
NetworkHandler.instance.sendTo(new PacketValueConfig(set.name(), sideLocal.name()), (EntityPlayerMP) crafter);
|
||||
NetworkHandler.instance.sendTo(
|
||||
new PacketValueConfig(set.name(), sideLocal.name()), (EntityPlayerMP) crafter);
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
@@ -201,8 +217,7 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
|
||||
final boolean oldAccessible = this.canAccessViewCells;
|
||||
this.canAccessViewCells =
|
||||
this.host instanceof WirelessTerminalGuiObject
|
||||
|| this.hasAccess(SecurityPermissions.BUILD, false);
|
||||
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) {
|
||||
@@ -221,7 +236,8 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
} 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);
|
||||
this.setPowered(
|
||||
this.getPowerSource().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG) > 0.8);
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
// :P
|
||||
@@ -318,7 +334,8 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change, BaseActionSource actionSource) {
|
||||
public void postChange(
|
||||
IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change, BaseActionSource actionSource) {
|
||||
for (final IAEFluidStack is : change) {
|
||||
this.items.add(is);
|
||||
}
|
||||
@@ -352,26 +369,33 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
this.dropItem(is);
|
||||
}
|
||||
|
||||
public void postChange(Iterable<IAEFluidStack> change, ItemStack fluidContainer, EntityPlayer player, int slotIndex) {
|
||||
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
|
||||
// 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());
|
||||
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);
|
||||
((IFluidContainerItem) fillStack.right.getItem())
|
||||
.drain(
|
||||
fillStack.right,
|
||||
fillStack.left - (int) (tmp.getStackSize() % fillStack.left),
|
||||
true);
|
||||
this.dropItem(fillStack.right, 1);
|
||||
out.stackSize++;
|
||||
}
|
||||
@@ -380,34 +404,44 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
}
|
||||
} else if (!Util.FluidUtil.isEmpty(fluidContainer)) {
|
||||
// add fluid to ae network
|
||||
// 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());
|
||||
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)) {
|
||||
if (drainStack.left > aeFluidStack.getStackSize()
|
||||
&& FluidContainerRegistry.isContainer(drainStack.right)) {
|
||||
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
|
||||
this.host.getFluidInventory().extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
this.host
|
||||
.getFluidInventory()
|
||||
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
continue;
|
||||
}
|
||||
|
||||
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left)); // drop empty item
|
||||
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);
|
||||
((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());
|
||||
this.host
|
||||
.getFluidInventory()
|
||||
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
out.stackSize++;
|
||||
}
|
||||
}
|
||||
@@ -423,10 +457,13 @@ public class FCBaseFluidMonitorContain extends AEBaseContainer implements IConfi
|
||||
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);
|
||||
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);
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||
}
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
|
||||
|
||||
+143
-206
@@ -33,6 +33,9 @@ import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.network.SPacketMEInventoryUpdate;
|
||||
import java.io.IOException;
|
||||
import java.nio.BufferOverflowException;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -41,167 +44,142 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.nio.BufferOverflowException;
|
||||
|
||||
public class FCBaseMonitorContain extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack>
|
||||
{
|
||||
public class FCBaseMonitorContain extends AEBaseContainer
|
||||
implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack> {
|
||||
|
||||
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
||||
private final IMEMonitor<IAEItemStack> monitor;
|
||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().createItemList();
|
||||
private final IConfigManager clientCM;
|
||||
private final ITerminalHost host;
|
||||
@GuiSync( 99 )
|
||||
|
||||
@GuiSync(99)
|
||||
public boolean canAccessViewCells = false;
|
||||
@GuiSync( 98 )
|
||||
|
||||
@GuiSync(98)
|
||||
public boolean hasPower = false;
|
||||
|
||||
private IConfigManagerHost gui;
|
||||
private IConfigManager serverCM;
|
||||
private IGridNode networkNode;
|
||||
|
||||
public FCBaseMonitorContain(final InventoryPlayer ip, final ITerminalHost monitorable )
|
||||
{
|
||||
this( ip, monitorable, true );
|
||||
public FCBaseMonitorContain(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
this(ip, monitorable, true);
|
||||
}
|
||||
|
||||
protected FCBaseMonitorContain( final InventoryPlayer ip, final ITerminalHost monitorable, final boolean bindInventory )
|
||||
{
|
||||
super( ip, monitorable instanceof TileEntity ? (TileEntity) monitorable : null, monitorable instanceof IPart ? (IPart) monitorable : null );
|
||||
protected FCBaseMonitorContain(
|
||||
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 = 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 );
|
||||
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() )
|
||||
{
|
||||
if (Platform.isServer()) {
|
||||
this.serverCM = monitorable.getConfigManager();
|
||||
|
||||
this.monitor = monitorable.getItemInventory();
|
||||
if( this.monitor != null )
|
||||
{
|
||||
this.monitor.addListener( this, null );
|
||||
if (this.monitor != null) {
|
||||
this.monitor.addListener(this, null);
|
||||
|
||||
this.setCellInventory( this.monitor );
|
||||
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 )
|
||||
{
|
||||
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, (IEnergySource) g.getCache( IEnergyGrid.class ) ) );
|
||||
if (g != null) {
|
||||
this.setPowerSource(new ChannelPowerSrc(
|
||||
this.networkNode, (IEnergySource) g.getCache(IEnergyGrid.class)));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setValidContainer( false );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} 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 (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 );
|
||||
if (bindInventory) {
|
||||
this.bindPlayerInventory(ip, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public IGridNode getNetworkNode()
|
||||
{
|
||||
public IGridNode getNetworkNode() {
|
||||
return this.networkNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
if( this.monitor != this.host.getItemInventory() )
|
||||
{
|
||||
this.setValidContainer( false );
|
||||
public void detectAndSendChanges() {
|
||||
if (Platform.isServer()) {
|
||||
if (this.monitor != this.host.getItemInventory()) {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
|
||||
for( final Settings set : this.serverCM.getSettings() )
|
||||
{
|
||||
final Enum<?> sideLocal = this.serverCM.getSetting( set );
|
||||
final Enum<?> sideRemote = this.clientCM.getSetting( set );
|
||||
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 (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() )
|
||||
{
|
||||
if (!this.items.isEmpty()) {
|
||||
final IItemList<IAEItemStack> monitorCache = this.monitor.getStorageList();
|
||||
|
||||
final SPacketMEInventoryUpdate piu = new SPacketMEInventoryUpdate();
|
||||
|
||||
for( final IAEItemStack is : this.items )
|
||||
{
|
||||
final IAEItemStack send = monitorCache.findPrecise( is );
|
||||
if( send == null )
|
||||
{
|
||||
is.setStackSize( 0 );
|
||||
piu.appendItem( is );
|
||||
}
|
||||
else
|
||||
{
|
||||
piu.appendItem( send );
|
||||
for (final IAEItemStack is : this.items) {
|
||||
final IAEItemStack send = monitorCache.findPrecise(is);
|
||||
if (send == null) {
|
||||
is.setStackSize(0);
|
||||
piu.appendItem(is);
|
||||
} else {
|
||||
piu.appendItem(send);
|
||||
}
|
||||
}
|
||||
|
||||
if( !piu.isEmpty() )
|
||||
{
|
||||
if (!piu.isEmpty()) {
|
||||
this.items.resetStatus();
|
||||
|
||||
for( final Object c : this.crafters )
|
||||
{
|
||||
if( c instanceof EntityPlayer)
|
||||
{
|
||||
for (final Object c : this.crafters) {
|
||||
if (c instanceof EntityPlayer) {
|
||||
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
|
||||
}
|
||||
}
|
||||
@@ -212,15 +190,11 @@ public class FCBaseMonitorContain extends AEBaseContainer implements IConfigMana
|
||||
|
||||
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 );
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,180 +203,143 @@ public class FCBaseMonitorContain extends AEBaseContainer implements IConfigMana
|
||||
}
|
||||
}
|
||||
|
||||
protected void updatePowerStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
if( this.networkNode != null )
|
||||
{
|
||||
this.setPowered( this.networkNode.isActive() );
|
||||
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);
|
||||
}
|
||||
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 )
|
||||
{
|
||||
} 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 );
|
||||
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 );
|
||||
super.onUpdate(field, oldValue, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters( final ICrafting c )
|
||||
{
|
||||
super.addCraftingToCrafters( c );
|
||||
this.queueInventory( c );
|
||||
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 )
|
||||
{
|
||||
private void queueInventory(final ICrafting c) {
|
||||
if (Platform.isServer() && c instanceof EntityPlayer && this.monitor != null) {
|
||||
SPacketMEInventoryUpdate piu = new SPacketMEInventoryUpdate();
|
||||
final IItemList<IAEItemStack> monitorCache = this.monitor.getStorageList();
|
||||
|
||||
for( final IAEItemStack send : monitorCache )
|
||||
{
|
||||
try
|
||||
{
|
||||
piu.appendItem( send );
|
||||
}
|
||||
catch( final BufferOverflowException boe )
|
||||
{
|
||||
FluidCraft.proxy.netHandler.sendTo( piu, (EntityPlayerMP) c );
|
||||
for (final IAEItemStack send : monitorCache) {
|
||||
try {
|
||||
piu.appendItem(send);
|
||||
} catch (final BufferOverflowException boe) {
|
||||
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
|
||||
|
||||
piu = new SPacketMEInventoryUpdate();
|
||||
piu.appendItem( send );
|
||||
piu.appendItem(send);
|
||||
}
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendTo( piu, (EntityPlayerMP) c );
|
||||
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCraftingFromCrafters( final ICrafting c )
|
||||
{
|
||||
super.removeCraftingFromCrafters( c );
|
||||
public void removeCraftingFromCrafters(final ICrafting c) {
|
||||
super.removeCraftingFromCrafters(c);
|
||||
|
||||
if( this.crafters.isEmpty() && this.monitor != null )
|
||||
{
|
||||
this.monitor.removeListener( this );
|
||||
if (this.crafters.isEmpty() && this.monitor != null) {
|
||||
this.monitor.removeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed( final EntityPlayer player )
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
if( this.monitor != null )
|
||||
{
|
||||
this.monitor.removeListener( this );
|
||||
public void onContainerClosed(final EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
if (this.monitor != null) {
|
||||
this.monitor.removeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( final Object verificationToken )
|
||||
{
|
||||
public boolean isValid(final Object verificationToken) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final BaseActionSource source )
|
||||
{
|
||||
for( final IAEItemStack is : change )
|
||||
{
|
||||
this.items.add( is );
|
||||
public void postChange(
|
||||
final IBaseMonitor<IAEItemStack> monitor,
|
||||
final Iterable<IAEItemStack> change,
|
||||
final BaseActionSource source) {
|
||||
for (final IAEItemStack is : change) {
|
||||
this.items.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListUpdate()
|
||||
{
|
||||
for( final Object c : this.crafters )
|
||||
{
|
||||
if( c instanceof ICrafting )
|
||||
{
|
||||
public void onListUpdate() {
|
||||
for (final Object c : this.crafters) {
|
||||
if (c instanceof ICrafting) {
|
||||
final ICrafting cr = (ICrafting) c;
|
||||
this.queueInventory( cr );
|
||||
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 );
|
||||
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
|
||||
if (this.getGui() != null) {
|
||||
this.getGui().updateSetting(manager, settingName, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
public IConfigManager getConfigManager() {
|
||||
if (Platform.isServer()) {
|
||||
return this.serverCM;
|
||||
}
|
||||
return this.clientCM;
|
||||
}
|
||||
|
||||
public ItemStack[] getViewCells()
|
||||
{
|
||||
public ItemStack[] getViewCells() {
|
||||
final ItemStack[] list = new ItemStack[this.cellView.length];
|
||||
|
||||
for( int x = 0; x < this.cellView.length; x++ )
|
||||
{
|
||||
for (int x = 0; x < this.cellView.length; x++) {
|
||||
list[x] = this.cellView[x].getStack();
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public SlotRestrictedInput getCellViewSlot( final int index )
|
||||
{
|
||||
public SlotRestrictedInput getCellViewSlot(final int index) {
|
||||
return this.cellView[index];
|
||||
}
|
||||
|
||||
public boolean isPowered()
|
||||
{
|
||||
public boolean isPowered() {
|
||||
return this.hasPower;
|
||||
}
|
||||
|
||||
private void setPowered( final boolean isPowered )
|
||||
{
|
||||
private void setPowered(final boolean isPowered) {
|
||||
this.hasPower = isPowered;
|
||||
}
|
||||
|
||||
private IConfigManagerHost getGui()
|
||||
{
|
||||
private IConfigManagerHost getGui() {
|
||||
return this.gui;
|
||||
}
|
||||
|
||||
public void setGui( @Nonnull final IConfigManagerHost gui )
|
||||
{
|
||||
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
||||
this.gui = gui;
|
||||
}
|
||||
}
|
||||
+290
-313
@@ -25,6 +25,11 @@ import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -38,32 +43,30 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
||||
public class FCBasePartContainer extends FCBaseMonitorContain
|
||||
implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
||||
|
||||
private final PartFluidPatternTerminal patternTerminal;
|
||||
private final AppEngInternalInventory cOut = new AppEngInternalInventory( null, 1 );
|
||||
private final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
|
||||
private final IInventory crafting;
|
||||
protected final SlotFakeCraftingMatrix[] craftingSlots = new SlotFakeCraftingMatrix[9];
|
||||
protected final OptionalSlotFake[] outputSlots = new OptionalSlotFake[3];
|
||||
protected final SlotPatternTerm craftSlot;
|
||||
protected final SlotRestrictedInput patternSlotIN;
|
||||
protected final SlotRestrictedInput patternSlotOUT;
|
||||
|
||||
@GuiSync(97)
|
||||
public boolean craftingMode = true;
|
||||
|
||||
@GuiSync(96)
|
||||
public boolean substitute = false;
|
||||
|
||||
@GuiSync(95)
|
||||
public boolean combine = false;
|
||||
|
||||
@GuiSync(94)
|
||||
public boolean beSubstitute = false;
|
||||
|
||||
|
||||
public FCBasePartContainer(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
super(ip, monitorable, false);
|
||||
this.patternTerminal = (PartFluidPatternTerminal) monitorable;
|
||||
@@ -71,153 +74,228 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
final IInventory patternInv = this.getPatternTerminal().getInventoryByName("pattern");
|
||||
final IInventory output = this.getPatternTerminal().getInventoryByName("output");
|
||||
|
||||
this.crafting = this.getPatternTerminal().getInventoryByName( "crafting" );
|
||||
this.crafting = this.getPatternTerminal().getInventoryByName("crafting");
|
||||
|
||||
for( int y = 0; y < 3; y++ )
|
||||
{
|
||||
for( int x = 0; x < 3; x++ )
|
||||
{
|
||||
this.addSlotToContainer( this.craftingSlots[x + y * 3] = new SlotFakeCraftingMatrix( this.crafting, x + y * 3, 18 + x * 18, -76 + y * 18 ) );
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
this.addSlotToContainer(
|
||||
this.craftingSlots[x + y * 3] =
|
||||
new SlotFakeCraftingMatrix(this.crafting, x + y * 3, 18 + x * 18, -76 + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
this.addSlotToContainer( this.craftSlot = new SlotPatternTerm( ip.player, this.getActionSource(), this.getPowerSource(), monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this ) );
|
||||
this.craftSlot.setIIcon( -1 );
|
||||
this.addSlotToContainer(
|
||||
this.craftSlot = new SlotPatternTerm(
|
||||
ip.player,
|
||||
this.getActionSource(),
|
||||
this.getPowerSource(),
|
||||
monitorable,
|
||||
this.crafting,
|
||||
patternInv,
|
||||
this.cOut,
|
||||
110,
|
||||
-76 + 18,
|
||||
this,
|
||||
2,
|
||||
this));
|
||||
this.craftSlot.setIIcon(-1);
|
||||
|
||||
for( int y = 0; y < 3; y++ )
|
||||
{
|
||||
this.addSlotToContainer( this.outputSlots[y] = new SlotPatternOutputs( output, this, y, 110, -76 + y * 18, 0, 0, 1 ) );
|
||||
this.outputSlots[y].setRenderDisabled( false );
|
||||
for (int y = 0; y < 3; y++) {
|
||||
this.addSlotToContainer(
|
||||
this.outputSlots[y] = new SlotPatternOutputs(output, this, y, 110, -76 + y * 18, 0, 0, 1));
|
||||
this.outputSlots[y].setRenderDisabled(false);
|
||||
}
|
||||
|
||||
this.addSlotToContainer( this.patternSlotIN = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, this.getInventoryPlayer() ) );
|
||||
this.addSlotToContainer( this.patternSlotOUT = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34, this.getInventoryPlayer() ) );
|
||||
this.addSlotToContainer(
|
||||
this.patternSlotIN = new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN,
|
||||
patternInv,
|
||||
0,
|
||||
147,
|
||||
-72 - 9,
|
||||
this.getInventoryPlayer()));
|
||||
this.addSlotToContainer(
|
||||
this.patternSlotOUT = new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN,
|
||||
patternInv,
|
||||
1,
|
||||
147,
|
||||
-72 + 34,
|
||||
this.getInventoryPlayer()));
|
||||
|
||||
this.patternSlotOUT.setStackLimit( 1 );
|
||||
this.patternSlotOUT.setStackLimit(1);
|
||||
|
||||
this.bindPlayerInventory( ip, 0, 0 );
|
||||
this.bindPlayerInventory(ip, 0, 0);
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
|
||||
private void updateOrderOfOutputSlots()
|
||||
{
|
||||
if( !this.isCraftingMode() )
|
||||
{
|
||||
this.craftSlot.xDisplayPosition = -9000;
|
||||
static boolean canDoubleStacks(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots =
|
||||
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long emptyStots =
|
||||
enabledSlots.stream().filter(s -> s.getStack() == null).count();
|
||||
long fullSlots = enabledSlots.stream()
|
||||
.filter(s -> s.getStack() != null && s.getStack().stackSize * 2 > 127)
|
||||
.count();
|
||||
return fullSlots <= emptyStots && emptyStots < enabledSlots.size();
|
||||
}
|
||||
|
||||
for( int y = 0; y < 3; y++ )
|
||||
{
|
||||
this.outputSlots[y].xDisplayPosition = this.outputSlots[y].getX();
|
||||
static void doubleStacksInternal(SlotFake[] slots) {
|
||||
List<ItemStack> overFlowStacks = new ArrayList<>();
|
||||
List<SlotFake> enabledSlots =
|
||||
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
for (final Slot s : enabledSlots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st == null) continue;
|
||||
if (Util.isFluidPacket(st)) {
|
||||
FluidStack fluidStack = ItemFluidPacket.getFluidStack(st);
|
||||
if (fluidStack != null) {
|
||||
fluidStack = ItemFluidPacket.getFluidStack(st).copy();
|
||||
if (fluidStack.amount < Integer.MAX_VALUE / 2) fluidStack.amount *= 2;
|
||||
}
|
||||
s.putStack(ItemFluidPacket.newStack(fluidStack));
|
||||
} else if (st.stackSize * 2 > 127) {
|
||||
overFlowStacks.add(st.copy());
|
||||
} else {
|
||||
st.stackSize *= 2;
|
||||
s.putStack(st);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator<ItemStack> ow = overFlowStacks.iterator();
|
||||
for (final Slot s : enabledSlots) {
|
||||
if (!ow.hasNext()) break;
|
||||
if (s.getStack() != null) continue;
|
||||
s.putStack(ow.next());
|
||||
}
|
||||
assert !ow.hasNext();
|
||||
}
|
||||
|
||||
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) {
|
||||
List<SlotFake> enabledSlots =
|
||||
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long fluid = enabledSlots.stream()
|
||||
.filter(s -> Util.isFluidPacket(s.getStack()))
|
||||
.count();
|
||||
return fluid > 0;
|
||||
}
|
||||
|
||||
private void updateOrderOfOutputSlots() {
|
||||
if (!this.isCraftingMode()) {
|
||||
this.craftSlot.xDisplayPosition = -9000;
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
this.outputSlots[y].xDisplayPosition = this.outputSlots[y].getX();
|
||||
}
|
||||
} else {
|
||||
this.craftSlot.xDisplayPosition = this.craftSlot.getX();
|
||||
|
||||
for( int y = 0; y < 3; y++ )
|
||||
{
|
||||
for (int y = 0; y < 3; y++) {
|
||||
this.outputSlots[y].xDisplayPosition = -9000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStackInSlot( final int par1, final ItemStack par2ItemStack )
|
||||
{
|
||||
super.putStackInSlot( par1, par2ItemStack );
|
||||
public void putStackInSlot(final int par1, final ItemStack par2ItemStack) {
|
||||
super.putStackInSlot(par1, par2ItemStack);
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStacksInSlots( final ItemStack[] par1ArrayOfItemStack )
|
||||
{
|
||||
super.putStacksInSlots( par1ArrayOfItemStack );
|
||||
public void putStacksInSlots(final ItemStack[] par1ArrayOfItemStack) {
|
||||
super.putStacksInSlots(par1ArrayOfItemStack);
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
private ItemStack getAndUpdateOutput()
|
||||
{
|
||||
final InventoryCrafting ic = new InventoryCrafting( this, 3, 3 );
|
||||
private ItemStack getAndUpdateOutput() {
|
||||
final InventoryCrafting ic = new InventoryCrafting(this, 3, 3);
|
||||
|
||||
for( int x = 0; x < ic.getSizeInventory(); x++ )
|
||||
{
|
||||
ic.setInventorySlotContents( x, this.crafting.getStackInSlot( x ) );
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||
ic.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
|
||||
}
|
||||
|
||||
final ItemStack is = CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.worldObj );
|
||||
this.cOut.setInventorySlotContents( 0, is );
|
||||
final ItemStack is = CraftingManager.getInstance().findMatchingRecipe(ic, this.getPlayerInv().player.worldObj);
|
||||
this.cOut.setInventorySlotContents(0, is);
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges()
|
||||
{
|
||||
|
||||
}
|
||||
public void saveChanges() {}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
{
|
||||
public void onChangeInventory(
|
||||
final IInventory inv,
|
||||
final int slot,
|
||||
final InvOperation mc,
|
||||
final ItemStack removedStack,
|
||||
final ItemStack newStack) {}
|
||||
|
||||
}
|
||||
|
||||
public void encodeAndMoveToInventory()
|
||||
{
|
||||
public void encodeAndMoveToInventory() {
|
||||
encode();
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
if ( output != null )
|
||||
{
|
||||
if (!getPlayerInv().addItemStackToInventory( output )){
|
||||
if (output != null) {
|
||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
||||
getPlayerInv().player.entityDropItem(output, 0);
|
||||
}
|
||||
this.patternSlotOUT.putStack( null );
|
||||
this.patternSlotOUT.putStack(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void encode()
|
||||
{
|
||||
public void encode() {
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
|
||||
final ItemStack[] in = this.getInputs();
|
||||
final ItemStack[] out = this.getOutputs();
|
||||
|
||||
// if there is no input, this would be silly.
|
||||
if( in == null || out == null )
|
||||
{
|
||||
if (in == null || out == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// first check the output slots, should either be null, or a pattern
|
||||
if( output != null && !this.isPattern( output ) )
|
||||
{
|
||||
if (output != null && !this.isPattern(output)) {
|
||||
return;
|
||||
}// if nothing is there we should snag a new pattern.
|
||||
else if( output == null )
|
||||
{
|
||||
} // if nothing is there we should snag a new pattern.
|
||||
else if (output == null) {
|
||||
output = this.patternSlotIN.getStack();
|
||||
if (!this.isPattern( output ))
|
||||
{
|
||||
if (!this.isPattern(output)) {
|
||||
return; // no blanks.
|
||||
}
|
||||
|
||||
// remove one, and clear the input slot.
|
||||
output.stackSize--;
|
||||
if( output.stackSize == 0 )
|
||||
{
|
||||
this.patternSlotIN.putStack( null );
|
||||
if (output.stackSize == 0) {
|
||||
this.patternSlotIN.putStack(null);
|
||||
}
|
||||
|
||||
// add a new encoded pattern.
|
||||
for( final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
for (final ItemStack encodedPatternStack : AEApi.instance()
|
||||
.definitions()
|
||||
.items()
|
||||
.encodedPattern()
|
||||
.maybeStack(1)
|
||||
.asSet()) {
|
||||
output = encodedPatternStack;
|
||||
this.patternSlotOUT.putStack( output );
|
||||
this.patternSlotOUT.putStack(output);
|
||||
}
|
||||
} else if ( output.getItem() instanceof ItemFluidEncodedPattern ) {
|
||||
for( final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
} else if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
for (final ItemStack encodedPatternStack : AEApi.instance()
|
||||
.definitions()
|
||||
.items()
|
||||
.encodedPattern()
|
||||
.maybeStack(1)
|
||||
.asSet()) {
|
||||
output = encodedPatternStack;
|
||||
this.patternSlotOUT.putStack( output );
|
||||
this.patternSlotOUT.putStack(output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,86 +305,70 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
final NBTTagList tagIn = new NBTTagList();
|
||||
final NBTTagList tagOut = new NBTTagList();
|
||||
|
||||
for( final ItemStack i : in )
|
||||
{
|
||||
tagIn.appendTag( this.createItemTag( i ) );
|
||||
for (final ItemStack i : in) {
|
||||
tagIn.appendTag(this.createItemTag(i));
|
||||
}
|
||||
|
||||
for( final ItemStack i : out )
|
||||
{
|
||||
tagOut.appendTag( this.createItemTag( i ) );
|
||||
for (final ItemStack i : out) {
|
||||
tagOut.appendTag(this.createItemTag(i));
|
||||
}
|
||||
|
||||
encodedValue.setTag( "in", tagIn );
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setBoolean( "crafting", this.isCraftingMode() );
|
||||
encodedValue.setTag("in", tagIn);
|
||||
encodedValue.setTag("out", tagOut);
|
||||
encodedValue.setBoolean("crafting", this.isCraftingMode());
|
||||
encodedValue.setBoolean("substitute", this.isSubstitute());
|
||||
encodedValue.setBoolean("beSubstitute", this.canBeSubstitute());
|
||||
output.setTagCompound(encodedValue);
|
||||
}
|
||||
|
||||
private ItemStack[] getInputs()
|
||||
{
|
||||
private ItemStack[] getInputs() {
|
||||
final ItemStack[] input = new ItemStack[9];
|
||||
boolean hasValue = false;
|
||||
|
||||
for( int x = 0; x < this.craftingSlots.length; x++ )
|
||||
{
|
||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||
input[x] = this.craftingSlots[x].getStack();
|
||||
if( input[x] != null )
|
||||
{
|
||||
if (input[x] != null) {
|
||||
hasValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( hasValue )
|
||||
{
|
||||
if (hasValue) {
|
||||
return input;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ItemStack[] getOutputs()
|
||||
{
|
||||
if( this.isCraftingMode() )
|
||||
{
|
||||
private ItemStack[] getOutputs() {
|
||||
if (this.isCraftingMode()) {
|
||||
final ItemStack out = this.getAndUpdateOutput();
|
||||
|
||||
if( out != null && out.stackSize > 0 )
|
||||
{
|
||||
return new ItemStack[] { out };
|
||||
if (out != null && out.stackSize > 0) {
|
||||
return new ItemStack[] {out};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final List<ItemStack> list = new ArrayList<>( 3 );
|
||||
} else {
|
||||
final List<ItemStack> list = new ArrayList<>(3);
|
||||
boolean hasValue = false;
|
||||
|
||||
for( final OptionalSlotFake outputSlot : this.outputSlots )
|
||||
{
|
||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||
final ItemStack out = outputSlot.getStack();
|
||||
|
||||
if( out != null && out.stackSize > 0 )
|
||||
{
|
||||
list.add( out );
|
||||
if (out != null && out.stackSize > 0) {
|
||||
list.add(out);
|
||||
hasValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( hasValue )
|
||||
{
|
||||
return list.toArray( new ItemStack[list.size()] );
|
||||
if (hasValue) {
|
||||
return list.toArray(new ItemStack[list.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isPattern( final ItemStack output )
|
||||
{
|
||||
if( output == null )
|
||||
{
|
||||
private boolean isPattern(final ItemStack output) {
|
||||
if (output == null) {
|
||||
return false;
|
||||
}
|
||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
@@ -314,134 +376,127 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
}
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
|
||||
boolean isPattern = definitions.items().encodedPattern().isSameAs( output );
|
||||
isPattern |= definitions.materials().blankPattern().isSameAs( output );
|
||||
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
||||
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
||||
|
||||
return isPattern;
|
||||
}
|
||||
|
||||
private NBTBase createItemTag(final ItemStack i )
|
||||
{
|
||||
private NBTBase createItemTag(final ItemStack i) {
|
||||
final NBTTagCompound c = new NBTTagCompound();
|
||||
|
||||
if( i != null )
|
||||
{
|
||||
i.writeToNBT( c );
|
||||
if (i != null) {
|
||||
i.writeToNBT(c);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled( final int idx )
|
||||
{
|
||||
if( idx == 1 )
|
||||
{
|
||||
public boolean isSlotEnabled(final int idx) {
|
||||
if (idx == 1) {
|
||||
return Platform.isServer() ? !this.getPatternTerminal().isCraftingRecipe() : !this.isCraftingMode();
|
||||
}
|
||||
else if( idx == 2 )
|
||||
{
|
||||
} else if (idx == 2) {
|
||||
return Platform.isServer() ? this.getPatternTerminal().isCraftingRecipe() : this.isCraftingMode();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void craftOrGetItem( final PacketPatternSlot packetPatternSlot )
|
||||
{
|
||||
if( packetPatternSlot.slotItem != null && this.getCellInventory() != null )
|
||||
{
|
||||
public void craftOrGetItem(final PacketPatternSlot packetPatternSlot) {
|
||||
if (packetPatternSlot.slotItem != null && this.getCellInventory() != null) {
|
||||
final IAEItemStack out = packetPatternSlot.slotItem.copy();
|
||||
InventoryAdaptor inv = new AdaptorPlayerHand( this.getPlayerInv().player );
|
||||
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor( this.getPlayerInv().player, ForgeDirection.UNKNOWN );
|
||||
InventoryAdaptor inv = new AdaptorPlayerHand(this.getPlayerInv().player);
|
||||
final InventoryAdaptor playerInv =
|
||||
InventoryAdaptor.getAdaptor(this.getPlayerInv().player, ForgeDirection.UNKNOWN);
|
||||
|
||||
if( packetPatternSlot.shift )
|
||||
{
|
||||
if (packetPatternSlot.shift) {
|
||||
inv = playerInv;
|
||||
}
|
||||
|
||||
if( inv.simulateAdd( out.getItemStack() ) != null )
|
||||
{
|
||||
if (inv.simulateAdd(out.getItemStack()) != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final IAEItemStack extracted = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), out, this.getActionSource() );
|
||||
final IAEItemStack extracted = Platform.poweredExtraction(
|
||||
this.getPowerSource(), this.getCellInventory(), out, this.getActionSource());
|
||||
final EntityPlayer p = this.getPlayerInv().player;
|
||||
|
||||
if( extracted != null )
|
||||
{
|
||||
inv.addItems( extracted.getItemStack() );
|
||||
if( p instanceof EntityPlayerMP)
|
||||
{
|
||||
this.updateHeld( (EntityPlayerMP) p );
|
||||
if (extracted != null) {
|
||||
inv.addItems(extracted.getItemStack());
|
||||
if (p instanceof EntityPlayerMP) {
|
||||
this.updateHeld((EntityPlayerMP) p);
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
|
||||
final InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
final InventoryCrafting real = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
final InventoryCrafting ic = new InventoryCrafting(new ContainerNull(), 3, 3);
|
||||
final InventoryCrafting real = new InventoryCrafting(new ContainerNull(), 3, 3);
|
||||
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? null : packetPatternSlot.pattern[x].getItemStack() );
|
||||
for (int x = 0; x < 9; x++) {
|
||||
ic.setInventorySlotContents(
|
||||
x, packetPatternSlot.pattern[x] == null ? null : packetPatternSlot.pattern[x].getItemStack());
|
||||
}
|
||||
|
||||
final IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj );
|
||||
final IRecipe r = Platform.findMatchingRecipe(ic, p.worldObj);
|
||||
|
||||
if( r == null )
|
||||
{
|
||||
if (r == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal().getItemInventory();
|
||||
final IItemList<IAEItemStack> all = storage.getStorageList();
|
||||
|
||||
final ItemStack is = r.getCraftingResult( ic );
|
||||
final ItemStack is = r.getCraftingResult(ic);
|
||||
|
||||
for( int x = 0; x < ic.getSizeInventory(); x++ )
|
||||
{
|
||||
if( ic.getStackInSlot( x ) != null )
|
||||
{
|
||||
final ItemStack pulled = Platform.extractItemsByRecipe( this.getPowerSource(), this.getActionSource(), storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) );
|
||||
real.setInventorySlotContents( x, pulled );
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||
if (ic.getStackInSlot(x) != null) {
|
||||
final ItemStack pulled = Platform.extractItemsByRecipe(
|
||||
this.getPowerSource(),
|
||||
this.getActionSource(),
|
||||
storage,
|
||||
p.worldObj,
|
||||
r,
|
||||
is,
|
||||
ic,
|
||||
ic.getStackInSlot(x),
|
||||
x,
|
||||
all,
|
||||
Actionable.MODULATE,
|
||||
ItemViewCell.createFilter(this.getViewCells()));
|
||||
real.setInventorySlotContents(x, pulled);
|
||||
}
|
||||
}
|
||||
|
||||
final IRecipe rr = Platform.findMatchingRecipe( real, p.worldObj );
|
||||
final IRecipe rr = Platform.findMatchingRecipe(real, p.worldObj);
|
||||
|
||||
if( rr == r && Platform.isSameItemPrecise( rr.getCraftingResult( real ), is ) )
|
||||
{
|
||||
final SlotCrafting sc = new SlotCrafting( p, real, this.cOut, 0, 0, 0 );
|
||||
sc.onPickupFromSlot( p, is );
|
||||
if (rr == r && Platform.isSameItemPrecise(rr.getCraftingResult(real), is)) {
|
||||
final SlotCrafting sc = new SlotCrafting(p, real, this.cOut, 0, 0, 0);
|
||||
sc.onPickupFromSlot(p, is);
|
||||
|
||||
for( int x = 0; x < real.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack failed = playerInv.addItems( real.getStackInSlot( x ) );
|
||||
for (int x = 0; x < real.getSizeInventory(); x++) {
|
||||
final ItemStack failed = playerInv.addItems(real.getStackInSlot(x));
|
||||
|
||||
if( failed != null )
|
||||
{
|
||||
p.dropPlayerItemWithRandomChoice( failed, false );
|
||||
if (failed != null) {
|
||||
p.dropPlayerItemWithRandomChoice(failed, false);
|
||||
}
|
||||
}
|
||||
|
||||
inv.addItems( is );
|
||||
if( p instanceof EntityPlayerMP )
|
||||
{
|
||||
this.updateHeld( (EntityPlayerMP) p );
|
||||
inv.addItems(is);
|
||||
if (p instanceof EntityPlayerMP) {
|
||||
this.updateHeld((EntityPlayerMP) p);
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int x = 0; x < real.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack failed = real.getStackInSlot( x );
|
||||
if( failed != null )
|
||||
{
|
||||
this.getCellInventory().injectItems( AEItemStack.create( failed ), Actionable.MODULATE, new MachineSource( this.getPatternTerminal() ) );
|
||||
} else {
|
||||
for (int x = 0; x < real.getSizeInventory(); x++) {
|
||||
final ItemStack failed = real.getStackInSlot(x);
|
||||
if (failed != null) {
|
||||
this.getCellInventory()
|
||||
.injectItems(
|
||||
AEItemStack.create(failed),
|
||||
Actionable.MODULATE,
|
||||
new MachineSource(this.getPatternTerminal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -449,14 +504,11 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
if( this.isCraftingMode() != this.getPatternTerminal().isCraftingRecipe() )
|
||||
{
|
||||
this.setCraftingMode( this.getPatternTerminal().isCraftingRecipe() );
|
||||
if (Platform.isServer()) {
|
||||
if (this.isCraftingMode() != this.getPatternTerminal().isCraftingRecipe()) {
|
||||
this.setCraftingMode(this.getPatternTerminal().isCraftingRecipe());
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
|
||||
@@ -467,85 +519,46 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate( final String field, final Object oldValue, final Object newValue )
|
||||
{
|
||||
super.onUpdate( field, oldValue, newValue );
|
||||
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||
super.onUpdate(field, oldValue, newValue);
|
||||
|
||||
if( field.equals( "craftingMode" ) )
|
||||
{
|
||||
if (field.equals("craftingMode")) {
|
||||
this.getAndUpdateOutput();
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChange( final Slot s )
|
||||
{
|
||||
if( s == this.patternSlotOUT && Platform.isServer() )
|
||||
{
|
||||
for( final Object crafter : this.crafters )
|
||||
{
|
||||
public void onSlotChange(final Slot s) {
|
||||
if (s == this.patternSlotOUT && Platform.isServer()) {
|
||||
for (final Object crafter : this.crafters) {
|
||||
final ICrafting icrafting = (ICrafting) crafter;
|
||||
|
||||
for( final Object g : this.inventorySlots )
|
||||
{
|
||||
if( g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix )
|
||||
{
|
||||
for (final Object g : this.inventorySlots) {
|
||||
if (g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix) {
|
||||
final Slot sri = (Slot) g;
|
||||
icrafting.sendSlotContents( this, sri.slotNumber, sri.getStack() );
|
||||
icrafting.sendSlotContents(this, sri.slotNumber, sri.getStack());
|
||||
}
|
||||
}
|
||||
( (EntityPlayerMP) icrafting ).isChangingQuantityOnly = false;
|
||||
((EntityPlayerMP) icrafting).isChangingQuantityOnly = false;
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
for( final Slot s : this.craftingSlots )
|
||||
{
|
||||
s.putStack( null );
|
||||
public void clear() {
|
||||
for (final Slot s : this.craftingSlots) {
|
||||
s.putStack(null);
|
||||
}
|
||||
|
||||
for( final Slot s : this.outputSlots )
|
||||
{
|
||||
s.putStack( null );
|
||||
for (final Slot s : this.outputSlots) {
|
||||
s.putStack(null);
|
||||
}
|
||||
|
||||
this.detectAndSendChanges();
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName( final String name )
|
||||
{
|
||||
if( name.equals( "player" ) )
|
||||
{
|
||||
return this.getInventoryPlayer();
|
||||
}
|
||||
return this.getPatternTerminal().getInventoryByName( name );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useRealItems()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void toggleSubstitute()
|
||||
{
|
||||
this.substitute = !this.substitute;
|
||||
|
||||
this.detectAndSendChanges();
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
public boolean isCraftingMode()
|
||||
{
|
||||
return this.craftingMode;
|
||||
}
|
||||
|
||||
private void setCraftingMode(final boolean craftingMode) {
|
||||
this.craftingMode = craftingMode;
|
||||
}
|
||||
@@ -566,63 +579,28 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
this.substitute = substitute;
|
||||
}
|
||||
|
||||
static boolean canDoubleStacks(SlotFake[] slots)
|
||||
{
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long emptyStots = enabledSlots.stream().filter(s -> s.getStack() == null).count();
|
||||
long fullSlots = enabledSlots.stream().filter(s-> s.getStack() != null && s.getStack().stackSize * 2 > 127).count();
|
||||
return fullSlots <= emptyStots && emptyStots < enabledSlots.size();
|
||||
}
|
||||
|
||||
static void doubleStacksInternal(SlotFake[] slots)
|
||||
{
|
||||
List<ItemStack> overFlowStacks = new ArrayList<>();
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
for (final Slot s : enabledSlots)
|
||||
{
|
||||
ItemStack st = s.getStack();
|
||||
if (st == null)
|
||||
continue;
|
||||
if (Util.isFluidPacket(st)) {
|
||||
FluidStack fluidStack = ItemFluidPacket.getFluidStack(st);
|
||||
if (fluidStack != null) {
|
||||
fluidStack = ItemFluidPacket.getFluidStack(st).copy();
|
||||
if (fluidStack.amount < Integer.MAX_VALUE / 2)
|
||||
fluidStack.amount *= 2;
|
||||
}
|
||||
s.putStack(ItemFluidPacket.newStack(fluidStack));
|
||||
}
|
||||
else if (st.stackSize * 2 > 127)
|
||||
{
|
||||
overFlowStacks.add(st.copy());
|
||||
}
|
||||
else
|
||||
{
|
||||
st.stackSize *= 2;
|
||||
s.putStack(st);
|
||||
}
|
||||
@Override
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
if (name.equals("player")) {
|
||||
return this.getInventoryPlayer();
|
||||
}
|
||||
Iterator<ItemStack> ow = overFlowStacks.iterator();
|
||||
for (final Slot s : enabledSlots) {
|
||||
if (!ow.hasNext())
|
||||
break;
|
||||
if (s.getStack() != null)
|
||||
continue;
|
||||
s.putStack(ow.next());
|
||||
}
|
||||
assert !ow.hasNext();
|
||||
return this.getPatternTerminal().getInventoryByName(name);
|
||||
}
|
||||
|
||||
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;
|
||||
@Override
|
||||
public boolean useRealItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean containsFluid(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long fluid = enabledSlots.stream().filter(s -> Util.isFluidPacket(s.getStack())).count();
|
||||
return fluid > 0;
|
||||
public void toggleSubstitute() {
|
||||
this.substitute = !this.substitute;
|
||||
|
||||
this.detectAndSendChanges();
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
public boolean isCraftingMode() {
|
||||
return this.craftingMode;
|
||||
}
|
||||
|
||||
public void doubleStacks(boolean isShift) {
|
||||
@@ -638,5 +616,4 @@ public class FCBasePartContainer extends FCBaseMonitorContain implements IAEAppE
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+247
-226
@@ -16,6 +16,11 @@ import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -27,54 +32,20 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
||||
public class FCBasePartContainerEx extends FCBaseMonitorContain
|
||||
implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket {
|
||||
|
||||
private static final int CRAFTING_GRID_PAGES = 2;
|
||||
private static final int CRAFTING_GRID_WIDTH = 4;
|
||||
private static final int CRAFTING_GRID_HEIGHT = 4;
|
||||
private static final int CRAFTING_GRID_SLOTS = CRAFTING_GRID_WIDTH * CRAFTING_GRID_HEIGHT;
|
||||
|
||||
private static class ProcessingSlotFake extends OptionalSlotFake {
|
||||
|
||||
private static final int POSITION_SHIFT = 9000;
|
||||
private boolean hidden = false;
|
||||
|
||||
public ProcessingSlotFake(IInventory inv, IOptionalSlotHost containerBus, int idx, int x, int y, int offX, int offY, int groupNum) {
|
||||
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
|
||||
this.setRenderDisabled(false);
|
||||
}
|
||||
|
||||
public void setHidden(boolean hide) {
|
||||
if (this.hidden != hide) {
|
||||
this.hidden = hide;
|
||||
this.xDisplayPosition += (hide ? -1 : 1) * POSITION_SHIFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected final ProcessingSlotFake[] craftingSlots =
|
||||
new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
|
||||
private final PartFluidPatternTerminalEx patternTerminal;
|
||||
protected final ProcessingSlotFake[] craftingSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
protected final ProcessingSlotFake[] outputSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
protected final SlotRestrictedInput patternSlotIN;
|
||||
protected final SlotRestrictedInput patternSlotOUT;
|
||||
@GuiSync(96 + (17 - 9) + 11)
|
||||
public boolean combine = false;
|
||||
@GuiSync(96 + (17 - 9) + 12)
|
||||
public boolean substitute = false;
|
||||
@GuiSync(96 + (17 - 9) + 16)
|
||||
public boolean inverted;
|
||||
@GuiSync(96 + (17 - 9) + 17)
|
||||
public int activePage = 0;
|
||||
@GuiSync(96 + (17 - 9) + 13)
|
||||
public boolean prioritize = false;
|
||||
@GuiSync(96 + (17 - 9) + 14)
|
||||
public boolean beSubstitute = false;
|
||||
protected final ProcessingSlotFake[] outputSlots =
|
||||
new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
|
||||
public FCBasePartContainerEx(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
super(ip, monitorable, false);
|
||||
@@ -88,108 +59,218 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
|
||||
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||
this.addSlotToContainer(this.craftingSlots[x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(crafting, this, x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS, 15, -83, x, y, x + 4));
|
||||
this.addSlotToContainer(
|
||||
this.craftingSlots[x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS] =
|
||||
new ProcessingSlotFake(
|
||||
crafting,
|
||||
this,
|
||||
x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS,
|
||||
15,
|
||||
-83,
|
||||
x,
|
||||
y,
|
||||
x + 4));
|
||||
}
|
||||
}
|
||||
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||
this.addSlotToContainer(this.outputSlots[x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(output, this, x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS, 112, -83, -x, y, x));
|
||||
this.addSlotToContainer(
|
||||
this.outputSlots[x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS] =
|
||||
new ProcessingSlotFake(
|
||||
output,
|
||||
this,
|
||||
x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS,
|
||||
112,
|
||||
-83,
|
||||
-x,
|
||||
y,
|
||||
x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.addSlotToContainer( this.patternSlotIN = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, this.getInventoryPlayer() ) );
|
||||
this.addSlotToContainer( this.patternSlotOUT = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34, this.getInventoryPlayer() ) );
|
||||
this.addSlotToContainer(
|
||||
this.patternSlotIN = new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN,
|
||||
patternInv,
|
||||
0,
|
||||
147,
|
||||
-72 - 9,
|
||||
this.getInventoryPlayer()));
|
||||
this.addSlotToContainer(
|
||||
this.patternSlotOUT = new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN,
|
||||
patternInv,
|
||||
1,
|
||||
147,
|
||||
-72 + 34,
|
||||
this.getInventoryPlayer()));
|
||||
|
||||
this.patternSlotOUT.setStackLimit( 1 );
|
||||
this.patternSlotOUT.setStackLimit(1);
|
||||
|
||||
this.bindPlayerInventory( ip, 0, 0 );
|
||||
this.bindPlayerInventory(ip, 0, 0);
|
||||
}
|
||||
|
||||
protected final SlotRestrictedInput patternSlotIN;
|
||||
protected final SlotRestrictedInput patternSlotOUT;
|
||||
|
||||
@GuiSync(96 + (17 - 9) + 11)
|
||||
public boolean combine = false;
|
||||
|
||||
@GuiSync(96 + (17 - 9) + 12)
|
||||
public boolean substitute = false;
|
||||
|
||||
@GuiSync(96 + (17 - 9) + 16)
|
||||
public boolean inverted;
|
||||
|
||||
@GuiSync(96 + (17 - 9) + 17)
|
||||
public int activePage = 0;
|
||||
|
||||
@GuiSync(96 + (17 - 9) + 13)
|
||||
public boolean prioritize = false;
|
||||
|
||||
@GuiSync(96 + (17 - 9) + 14)
|
||||
public boolean beSubstitute = false;
|
||||
|
||||
static boolean canDoubleStacks(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots =
|
||||
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long emptyStots =
|
||||
enabledSlots.stream().filter(s -> s.getStack() == null).count();
|
||||
long fullSlots = enabledSlots.stream()
|
||||
.filter(s -> s.getStack() != null && s.getStack().stackSize * 2 > 127)
|
||||
.count();
|
||||
return fullSlots <= emptyStots;
|
||||
}
|
||||
|
||||
static void doubleStacksInternal(SlotFake[] slots) {
|
||||
List<ItemStack> overFlowStacks = new ArrayList<>();
|
||||
List<SlotFake> enabledSlots =
|
||||
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
for (final Slot s : enabledSlots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st == null) continue;
|
||||
if (Util.isFluidPacket(st)) {
|
||||
FluidStack fluidStack = ItemFluidPacket.getFluidStack(st);
|
||||
if (fluidStack != null) {
|
||||
fluidStack = ItemFluidPacket.getFluidStack(st).copy();
|
||||
if (fluidStack.amount < Integer.MAX_VALUE / 2) fluidStack.amount *= 2;
|
||||
}
|
||||
s.putStack(ItemFluidPacket.newStack(fluidStack));
|
||||
} else if (st.stackSize * 2 > 127) {
|
||||
overFlowStacks.add(st.copy());
|
||||
} else {
|
||||
st.stackSize *= 2;
|
||||
s.putStack(st);
|
||||
}
|
||||
}
|
||||
Iterator<ItemStack> ow = overFlowStacks.iterator();
|
||||
for (final Slot s : enabledSlots) {
|
||||
if (!ow.hasNext()) break;
|
||||
if (s.getStack() != null) continue;
|
||||
s.putStack(ow.next());
|
||||
}
|
||||
assert !ow.hasNext();
|
||||
}
|
||||
|
||||
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) {
|
||||
List<SlotFake> enabledSlots =
|
||||
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long fluid = enabledSlots.stream()
|
||||
.filter(s -> Util.isFluidPacket(s.getStack()))
|
||||
.count();
|
||||
return fluid > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges()
|
||||
{
|
||||
public void saveChanges() {}
|
||||
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
for( final Slot s : this.craftingSlots )
|
||||
{
|
||||
s.putStack( null );
|
||||
public void clear() {
|
||||
for (final Slot s : this.craftingSlots) {
|
||||
s.putStack(null);
|
||||
}
|
||||
|
||||
for( final Slot s : this.outputSlots )
|
||||
{
|
||||
s.putStack( null );
|
||||
for (final Slot s : this.outputSlots) {
|
||||
s.putStack(null);
|
||||
}
|
||||
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
{
|
||||
public void onChangeInventory(
|
||||
final IInventory inv,
|
||||
final int slot,
|
||||
final InvOperation mc,
|
||||
final ItemStack removedStack,
|
||||
final ItemStack newStack) {}
|
||||
|
||||
}
|
||||
|
||||
public void encodeAndMoveToInventory()
|
||||
{
|
||||
public void encodeAndMoveToInventory() {
|
||||
encode();
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
if ( output != null )
|
||||
{
|
||||
if (!getPlayerInv().addItemStackToInventory( output )){
|
||||
if (output != null) {
|
||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
||||
getPlayerInv().player.entityDropItem(output, 0);
|
||||
}
|
||||
this.patternSlotOUT.putStack( null );
|
||||
this.patternSlotOUT.putStack(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void encode()
|
||||
{
|
||||
public void encode() {
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
|
||||
final ItemStack[] in = this.getInputs();
|
||||
final ItemStack[] out = this.getOutputs();
|
||||
|
||||
// if there is no input, this would be silly.
|
||||
if( in == null || out == null )
|
||||
{
|
||||
if (in == null || out == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// first check the output slots, should either be null, or a pattern
|
||||
if( output != null && !this.isPattern( output ) )
|
||||
{
|
||||
if (output != null && !this.isPattern(output)) {
|
||||
return;
|
||||
}// if nothing is there we should snag a new pattern.
|
||||
else if( output == null )
|
||||
{
|
||||
} // if nothing is there we should snag a new pattern.
|
||||
else if (output == null) {
|
||||
output = this.patternSlotIN.getStack();
|
||||
if (!this.isPattern( output ))
|
||||
{
|
||||
if (!this.isPattern(output)) {
|
||||
return; // no blanks.
|
||||
}
|
||||
|
||||
// remove one, and clear the input slot.
|
||||
output.stackSize--;
|
||||
if( output.stackSize == 0 )
|
||||
{
|
||||
this.patternSlotIN.putStack( null );
|
||||
if (output.stackSize == 0) {
|
||||
this.patternSlotIN.putStack(null);
|
||||
}
|
||||
|
||||
// add a new encoded pattern.
|
||||
for( final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
for (final ItemStack encodedPatternStack : AEApi.instance()
|
||||
.definitions()
|
||||
.items()
|
||||
.encodedPattern()
|
||||
.maybeStack(1)
|
||||
.asSet()) {
|
||||
output = encodedPatternStack;
|
||||
this.patternSlotOUT.putStack( output );
|
||||
this.patternSlotOUT.putStack(output);
|
||||
}
|
||||
} else if ( output.getItem() instanceof ItemFluidEncodedPattern ) {
|
||||
for( final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
} else if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
for (final ItemStack encodedPatternStack : AEApi.instance()
|
||||
.definitions()
|
||||
.items()
|
||||
.encodedPattern()
|
||||
.maybeStack(1)
|
||||
.asSet()) {
|
||||
output = encodedPatternStack;
|
||||
this.patternSlotOUT.putStack( output );
|
||||
this.patternSlotOUT.putStack(output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,77 +280,65 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
final NBTTagList tagIn = new NBTTagList();
|
||||
final NBTTagList tagOut = new NBTTagList();
|
||||
|
||||
for( final ItemStack i : in )
|
||||
{
|
||||
tagIn.appendTag( this.createItemTag( i ) );
|
||||
for (final ItemStack i : in) {
|
||||
tagIn.appendTag(this.createItemTag(i));
|
||||
}
|
||||
|
||||
for( final ItemStack i : out )
|
||||
{
|
||||
tagOut.appendTag( this.createItemTag( i ) );
|
||||
for (final ItemStack i : out) {
|
||||
tagOut.appendTag(this.createItemTag(i));
|
||||
}
|
||||
|
||||
encodedValue.setTag( "in", tagIn );
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setTag("in", tagIn);
|
||||
encodedValue.setTag("out", tagOut);
|
||||
encodedValue.setBoolean("substitute", this.isSubstitute());
|
||||
encodedValue.setBoolean("beSubstitute", this.canBeSubstitute());
|
||||
encodedValue.setTag("in", tagIn);
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setBoolean( "prioritize", this.isPrioritize() );
|
||||
encodedValue.setTag("out", tagOut);
|
||||
encodedValue.setBoolean("prioritize", this.isPrioritize());
|
||||
|
||||
output.setTagCompound( encodedValue );
|
||||
output.setTagCompound(encodedValue);
|
||||
}
|
||||
|
||||
private ItemStack[] getInputs()
|
||||
{
|
||||
private ItemStack[] getInputs() {
|
||||
final ItemStack[] input = new ItemStack[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
boolean hasValue = false;
|
||||
|
||||
for( int x = 0; x < this.craftingSlots.length; x++ )
|
||||
{
|
||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||
input[x] = this.craftingSlots[x].getStack();
|
||||
if( input[x] != null )
|
||||
{
|
||||
if (input[x] != null) {
|
||||
hasValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( hasValue )
|
||||
{
|
||||
if (hasValue) {
|
||||
return input;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ItemStack[] getOutputs()
|
||||
{
|
||||
final List<ItemStack> list = new ArrayList<>( CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES );
|
||||
private ItemStack[] getOutputs() {
|
||||
final List<ItemStack> list = new ArrayList<>(CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES);
|
||||
boolean hasValue = false;
|
||||
|
||||
for( final OptionalSlotFake outputSlot : this.outputSlots )
|
||||
{
|
||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||
final ItemStack out = outputSlot.getStack();
|
||||
|
||||
if( out != null && out.stackSize > 0 )
|
||||
{
|
||||
list.add( out );
|
||||
if (out != null && out.stackSize > 0) {
|
||||
list.add(out);
|
||||
hasValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( hasValue )
|
||||
{
|
||||
if (hasValue) {
|
||||
return list.toArray(new ItemStack[0]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isPattern( final ItemStack output )
|
||||
{
|
||||
if( output == null )
|
||||
{
|
||||
private boolean isPattern(final ItemStack output) {
|
||||
if (output == null) {
|
||||
return false;
|
||||
}
|
||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
@@ -277,45 +346,38 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
}
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
|
||||
boolean isPattern = definitions.items().encodedPattern().isSameAs( output );
|
||||
isPattern |= definitions.materials().blankPattern().isSameAs( output );
|
||||
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
||||
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
||||
|
||||
return isPattern;
|
||||
}
|
||||
|
||||
private NBTBase createItemTag(final ItemStack i )
|
||||
{
|
||||
private NBTBase createItemTag(final ItemStack i) {
|
||||
final NBTTagCompound c = new NBTTagCompound();
|
||||
|
||||
if( i != null )
|
||||
{
|
||||
i.writeToNBT( c );
|
||||
if (i != null) {
|
||||
i.writeToNBT(c);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled( final int idx )
|
||||
{
|
||||
public boolean isSlotEnabled(final int idx) {
|
||||
if (idx < 4) // outputs
|
||||
{
|
||||
return inverted || idx == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return !inverted || idx == 4;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
if (Platform.isServer()) {
|
||||
this.substitute = this.patternTerminal.isSubstitution();
|
||||
this.combine = this.patternTerminal.shouldCombine(); //Check out
|
||||
this.combine = this.patternTerminal.shouldCombine(); // Check out
|
||||
this.beSubstitute = this.patternTerminal.canBeSubstitute();
|
||||
this.prioritize = this.patternTerminal.isPrioritize();
|
||||
if (inverted != patternTerminal.isInverted() || activePage != patternTerminal.getActivePage()) {
|
||||
@@ -326,13 +388,14 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
}
|
||||
}
|
||||
|
||||
private void offsetSlots()
|
||||
{
|
||||
private void offsetSlots() {
|
||||
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
|
||||
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||
this.craftingSlots[x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS].setHidden(page != activePage || x > 0 && inverted);
|
||||
this.outputSlots[x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS].setHidden(page != activePage || x > 0 && !inverted);
|
||||
this.craftingSlots[x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS].setHidden(
|
||||
page != activePage || x > 0 && inverted);
|
||||
this.outputSlots[x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS].setHidden(
|
||||
page != activePage || x > 0 && !inverted);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -340,127 +403,86 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
|
||||
@Override
|
||||
public void onUpdate(String field, Object oldValue, Object newValue) {
|
||||
super.onUpdate( field, oldValue, newValue );
|
||||
super.onUpdate(field, oldValue, newValue);
|
||||
|
||||
if (field.equals( "inverted" ) || field.equals( "activePage" )) {
|
||||
if (field.equals("inverted") || field.equals("activePage")) {
|
||||
offsetSlots();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChange( final Slot s )
|
||||
{
|
||||
if( s == this.patternSlotOUT && Platform.isServer() )
|
||||
{
|
||||
public void onSlotChange(final Slot s) {
|
||||
if (s == this.patternSlotOUT && Platform.isServer()) {
|
||||
inverted = patternTerminal.isInverted();
|
||||
|
||||
for( final Object crafter : this.crafters )
|
||||
{
|
||||
for (final Object crafter : this.crafters) {
|
||||
final ICrafting icrafting = (ICrafting) crafter;
|
||||
|
||||
for( final Object g : this.inventorySlots )
|
||||
{
|
||||
if( g instanceof OptionalSlotFake )
|
||||
{
|
||||
for (final Object g : this.inventorySlots) {
|
||||
if (g instanceof OptionalSlotFake) {
|
||||
final Slot sri = (Slot) g;
|
||||
icrafting.sendSlotContents( this, sri.slotNumber, sri.getStack() );
|
||||
icrafting.sendSlotContents(this, sri.slotNumber, sri.getStack());
|
||||
}
|
||||
}
|
||||
( (EntityPlayerMP) icrafting ).isChangingQuantityOnly = false;
|
||||
((EntityPlayerMP) icrafting).isChangingQuantityOnly = false;
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName( final String name )
|
||||
{
|
||||
if( name.equals( "player" ) )
|
||||
{
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
if (name.equals("player")) {
|
||||
return this.getInventoryPlayer();
|
||||
}
|
||||
return this.getPatternTerminal().getInventoryByName( name );
|
||||
return this.getPatternTerminal().getInventoryByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useRealItems()
|
||||
{
|
||||
public boolean useRealItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public PartFluidPatternTerminalEx getPatternTerminal()
|
||||
{
|
||||
public PartFluidPatternTerminalEx getPatternTerminal() {
|
||||
return this.patternTerminal;
|
||||
}
|
||||
|
||||
private boolean isSubstitute()
|
||||
{
|
||||
private boolean isSubstitute() {
|
||||
return this.substitute;
|
||||
}
|
||||
|
||||
private boolean isPrioritize() { return this.prioritize; }
|
||||
|
||||
static boolean canDoubleStacks(SlotFake[] slots)
|
||||
{
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long emptyStots = enabledSlots.stream().filter(s -> s.getStack() == null).count();
|
||||
long fullSlots = enabledSlots.stream().filter(s-> s.getStack() != null && s.getStack().stackSize * 2 > 127).count();
|
||||
return fullSlots <= emptyStots;
|
||||
}
|
||||
|
||||
static void doubleStacksInternal(SlotFake[] slots)
|
||||
{
|
||||
List<ItemStack> overFlowStacks = new ArrayList<>();
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
for (final Slot s : enabledSlots)
|
||||
{
|
||||
ItemStack st = s.getStack();
|
||||
if (st == null)
|
||||
continue;
|
||||
if (Util.isFluidPacket(st)) {
|
||||
FluidStack fluidStack = ItemFluidPacket.getFluidStack(st);
|
||||
if (fluidStack != null) {
|
||||
fluidStack = ItemFluidPacket.getFluidStack(st).copy();
|
||||
if (fluidStack.amount < Integer.MAX_VALUE / 2)
|
||||
fluidStack.amount *= 2;
|
||||
}
|
||||
s.putStack(ItemFluidPacket.newStack(fluidStack));
|
||||
}
|
||||
else if (st.stackSize * 2 > 127)
|
||||
{
|
||||
overFlowStacks.add(st.copy());
|
||||
}
|
||||
else
|
||||
{
|
||||
st.stackSize *= 2;
|
||||
s.putStack(st);
|
||||
}
|
||||
}
|
||||
Iterator<ItemStack> ow = overFlowStacks.iterator();
|
||||
for (final Slot s : enabledSlots) {
|
||||
if (!ow.hasNext())
|
||||
break;
|
||||
if (s.getStack() != null)
|
||||
continue;
|
||||
s.putStack(ow.next());
|
||||
}
|
||||
assert !ow.hasNext();
|
||||
}
|
||||
|
||||
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 isPrioritize() {
|
||||
return this.prioritize;
|
||||
}
|
||||
|
||||
private boolean canBeSubstitute() {
|
||||
return this.beSubstitute;
|
||||
}
|
||||
|
||||
static boolean containsFluid(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long fluid = enabledSlots.stream().filter(s -> Util.isFluidPacket(s.getStack())).count();
|
||||
return fluid > 0;
|
||||
private static class ProcessingSlotFake extends OptionalSlotFake {
|
||||
|
||||
private static final int POSITION_SHIFT = 9000;
|
||||
private boolean hidden = false;
|
||||
|
||||
public ProcessingSlotFake(
|
||||
IInventory inv,
|
||||
IOptionalSlotHost containerBus,
|
||||
int idx,
|
||||
int x,
|
||||
int y,
|
||||
int offX,
|
||||
int offY,
|
||||
int groupNum) {
|
||||
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
|
||||
this.setRenderDisabled(false);
|
||||
}
|
||||
|
||||
public void setHidden(boolean hide) {
|
||||
if (this.hidden != hide) {
|
||||
this.hidden = hide;
|
||||
this.xDisplayPosition += (hide ? -1 : 1) * POSITION_SHIFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doubleStacks(boolean isShift) {
|
||||
@@ -484,5 +506,4 @@ public class FCBasePartContainerEx extends FCBaseMonitorContain implements IAEAp
|
||||
public int getActivePage() {
|
||||
return this.activePage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,6 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
|
||||
import akka.actor.Status;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public enum FluidPrioritization {
|
||||
ENABLED,
|
||||
DISABLED;
|
||||
|
||||
}
|
||||
@@ -32,16 +32,14 @@ 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;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class FluidRepo extends ItemRepo {
|
||||
|
||||
@@ -117,7 +115,7 @@ public class FluidRepo extends ItemRepo {
|
||||
|
||||
this.innerSearch = this.searchString;
|
||||
final boolean terminalSearchToolTips =
|
||||
AEConfig.instance.settings.getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
|
||||
AEConfig.instance.settings.getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
|
||||
// boolean terminalSearchMods = Configuration.INSTANCE.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
|
||||
|
||||
boolean searchMod = false;
|
||||
@@ -159,8 +157,8 @@ public class FluidRepo extends ItemRepo {
|
||||
}
|
||||
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
|
||||
if (searchMod) {
|
||||
if (m.matcher(Util.getFluidModID(fluid).toLowerCase()).find() ||
|
||||
m.matcher(Util.getFluidModName(fluid).toLowerCase()).find()) {
|
||||
if (m.matcher(Util.getFluidModID(fluid).toLowerCase()).find()
|
||||
|| m.matcher(Util.getFluidModName(fluid).toLowerCase()).find()) {
|
||||
this.view.add(is);
|
||||
}
|
||||
} else {
|
||||
@@ -200,7 +198,7 @@ public class FluidRepo extends ItemRepo {
|
||||
try {
|
||||
if (this.NEIWord == null || !this.NEIWord.equals(filter)) {
|
||||
final Class c =
|
||||
ReflectionHelper.getClass(this.getClass().getClassLoader(), "codechicken.nei.LayoutManager");
|
||||
ReflectionHelper.getClass(this.getClass().getClassLoader(), "codechicken.nei.LayoutManager");
|
||||
final Field fldSearchField = c.getField("searchField");
|
||||
final Object searchField = fldSearchField.get(c);
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -18,9 +20,6 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ItemDropRender implements IItemRenderer {
|
||||
|
||||
@@ -62,7 +61,15 @@ public class ItemDropRender implements IItemRenderer {
|
||||
if (type.equals(ItemRenderType.INVENTORY)) {
|
||||
RenderUtil.renderItemIcon(shape, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
|
||||
} else {
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, shape.getMaxU(), shape.getMinV(), shape.getMinU(), shape.getMaxV(), shape.getIconWidth(), shape.getIconHeight(), 0.0625F);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
Tessellator.instance,
|
||||
shape.getMaxU(),
|
||||
shape.getMinV(),
|
||||
shape.getMinU(),
|
||||
shape.getMaxV(),
|
||||
shape.getIconWidth(),
|
||||
shape.getIconHeight(),
|
||||
0.0625F);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
@@ -84,8 +91,9 @@ public class ItemDropRender implements IItemRenderer {
|
||||
if (colour == 0xFFFFFF) {
|
||||
TextureAtlasSprite sprite;
|
||||
try {
|
||||
sprite = Minecraft.getMinecraft().getTextureMapBlocks()
|
||||
.getTextureExtry(fluid.getStillIcon().getIconName());
|
||||
sprite = Minecraft.getMinecraft()
|
||||
.getTextureMapBlocks()
|
||||
.getTextureExtry(fluid.getStillIcon().getIconName());
|
||||
} catch (NullPointerException e) {
|
||||
colourCache.put(fluid.getName(), colour);
|
||||
return colour;
|
||||
|
||||
@@ -34,8 +34,7 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemFluidPacket))
|
||||
return;
|
||||
if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemFluidPacket)) return;
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
@@ -46,7 +45,9 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
if (fluid != null) {
|
||||
RGB = fluid.getFluid().getColor(fluid);
|
||||
}
|
||||
IIcon icon = fluid == null ? FluidRegistry.WATER.getStillIcon() : fluid.getFluid().getStillIcon();
|
||||
IIcon icon = fluid == null
|
||||
? FluidRegistry.WATER.getStillIcon()
|
||||
: fluid.getFluid().getStillIcon();
|
||||
|
||||
if (RGB != 0xFFFFFF) {
|
||||
GL11.glColor3f((RGB >> 16 & 0xFF) / 255.0F, (RGB >> 8 & 0xFF) / 255.0F, (RGB & 0xFF) / 255.0F);
|
||||
@@ -55,11 +56,18 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
if (type.equals(ItemRenderType.INVENTORY)) {
|
||||
RenderUtil.renderItemIcon(icon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
|
||||
} else {
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
Tessellator.instance,
|
||||
icon.getMaxU(),
|
||||
icon.getMinV(),
|
||||
icon.getMinU(),
|
||||
icon.getMaxV(),
|
||||
icon.getIconWidth(),
|
||||
icon.getIconHeight(),
|
||||
0.0625F);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,29 +11,32 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RenderBlockFluidInterface extends BaseBlockRender<BlockFluidInterface, TileFluidInterface>
|
||||
{
|
||||
public class RenderBlockFluidInterface extends BaseBlockRender<BlockFluidInterface, TileFluidInterface> {
|
||||
|
||||
public RenderBlockFluidInterface()
|
||||
{
|
||||
super( false, 20 );
|
||||
public RenderBlockFluidInterface() {
|
||||
super(false, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(final BlockFluidInterface block, final IBlockAccess world, final int x, final int y, final int z, final RenderBlocks renderer )
|
||||
{
|
||||
final TileInterface ti = block.getTileEntity( world, x, y, z );
|
||||
public boolean renderInWorld(
|
||||
final BlockFluidInterface block,
|
||||
final IBlockAccess world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final RenderBlocks renderer) {
|
||||
final TileInterface ti = block.getTileEntity(world, x, y, z);
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
|
||||
if( ti != null && ti.getForward() != ForgeDirection.UNKNOWN )
|
||||
{
|
||||
if (ti != null && ti.getForward() != ForgeDirection.UNKNOWN) {
|
||||
final IIcon side = FCPartsTexture.BlockFluidInterfaceAlternate_Arrow.getIcon();
|
||||
info.setTemporaryRenderIcons( FCPartsTexture.BlockInterfaceAlternate.getIcon(), block.getIcon( 0, 0 ), side, side, side, side );
|
||||
info.setTemporaryRenderIcons(
|
||||
FCPartsTexture.BlockInterfaceAlternate.getIcon(), block.getIcon(0, 0), side, side, side, side);
|
||||
}
|
||||
|
||||
final boolean fz = super.renderInWorld( block, world, x, y, z, renderer );
|
||||
final boolean fz = super.renderInWorld(block, world, x, y, z, renderer);
|
||||
|
||||
info.setTemporaryRenderIcon( null );
|
||||
info.setTemporaryRenderIcon(null);
|
||||
|
||||
return fz;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,14 @@ public class RenderBlockLevelMaintainer extends BaseBlockRender<BlockLevelMainta
|
||||
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) {
|
||||
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();
|
||||
|
||||
|
||||
@@ -9,12 +9,20 @@ 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"), BlockLevelMaintainer("level_maintainer"), BlockLevelMaintainer_Active("level_maintainer_active");
|
||||
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"),
|
||||
BlockLevelMaintainer("level_maintainer"),
|
||||
BlockLevelMaintainer_Active("level_maintainer_active");
|
||||
|
||||
private final String name;
|
||||
public net.minecraft.util.IIcon IIcon;
|
||||
@@ -27,24 +35,21 @@ public enum FCPartsTexture {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public static IIcon getMissing()
|
||||
{
|
||||
return ( (TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture( TextureMap.locationBlocksTexture ) ).getAtlasSprite( "missingno" );
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getMissing() {
|
||||
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture))
|
||||
.getAtlasSprite("missingno");
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public IIcon getIcon()
|
||||
{
|
||||
public IIcon getIcon() {
|
||||
return this.IIcon;
|
||||
}
|
||||
|
||||
public void registerIcon( final TextureMap map )
|
||||
{
|
||||
this.IIcon = map.registerIcon( NameConst.RES_KEY + this.name );
|
||||
public void registerIcon(final TextureMap map) {
|
||||
this.IIcon = map.registerIcon(NameConst.RES_KEY + this.name);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.glodblock.github.common;
|
||||
|
||||
import cpw.mods.fml.relauncher.FMLInjectionData;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class Config {
|
||||
|
||||
private static final Configuration Config = new Configuration(new File(new File((File) FMLInjectionData.data()[6], "config"), "ae2fc.cfg"));
|
||||
private static final Configuration Config =
|
||||
new Configuration(new File(new File((File) FMLInjectionData.data()[6], "config"), "ae2fc.cfg"));
|
||||
|
||||
public static boolean fluidCells;
|
||||
public static boolean noFluidPacket;
|
||||
@@ -21,14 +21,30 @@ public class Config {
|
||||
}
|
||||
|
||||
private static void loadProperty() {
|
||||
fluidCells = Config.getBoolean("Enable Fluid Storage Cell", "Fluid Craft for AE2", true, "Enable this to generate the fluid storage cells. If you are playing with EC2, you can turn it off.");
|
||||
noFluidPacket = Config.getBoolean("No Fluid Packet", "Fluid Craft for AE2", false, "Enable this to make normal ME Interface can emit fluid with fluid pattern, like the ME Dual Interface.");
|
||||
fluidIOBus = Config.getBoolean("Enable AE2FC's Fluid I/O Bus", "Fluid Craft for AE2", true, "Enable this to add Fluid Import/Export Bus like EC2's one.");
|
||||
removeRecipe = Config.getBoolean("Disable all recipes", "Fluid Craft for AE2", false, "Disable all recipes, for quick tweaker.");
|
||||
blacklistEssentiaGas = Config.getBoolean("Blacklist Essentia Gas", "Fluid Craft for AE2", true, "Blacklist Essentia Gas from Thaumic Energistics, so they won't be stored in Fluid Storage Cells.");
|
||||
fluidCells = Config.getBoolean(
|
||||
"Enable Fluid Storage Cell",
|
||||
"Fluid Craft for AE2",
|
||||
true,
|
||||
"Enable this to generate the fluid storage cells. If you are playing with EC2, you can turn it off.");
|
||||
noFluidPacket = Config.getBoolean(
|
||||
"No Fluid Packet",
|
||||
"Fluid Craft for AE2",
|
||||
false,
|
||||
"Enable this to make normal ME Interface can emit fluid with fluid pattern, like the ME Dual Interface.");
|
||||
fluidIOBus = Config.getBoolean(
|
||||
"Enable AE2FC's Fluid I/O Bus",
|
||||
"Fluid Craft for AE2",
|
||||
true,
|
||||
"Enable this to add Fluid Import/Export Bus like EC2's one.");
|
||||
removeRecipe = Config.getBoolean(
|
||||
"Disable all recipes", "Fluid Craft for AE2", false, "Disable all recipes, for quick tweaker.");
|
||||
blacklistEssentiaGas = Config.getBoolean(
|
||||
"Blacklist Essentia Gas",
|
||||
"Fluid Craft for AE2",
|
||||
true,
|
||||
"Blacklist Essentia Gas from Thaumic Energistics, so they won't be stored in Fluid Storage Cells.");
|
||||
|
||||
if (Config.hasChanged())
|
||||
Config.save();
|
||||
if (Config.hasChanged()) Config.save();
|
||||
}
|
||||
|
||||
private static void loadCategory() {
|
||||
|
||||
@@ -31,5 +31,4 @@ public class BlockFluidDiscretizer extends FCBaseBlock {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ 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 java.util.EnumSet;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,8 +23,6 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public class BlockFluidInterface extends FCBaseBlock {
|
||||
|
||||
public BlockFluidInterface() {
|
||||
@@ -31,29 +30,34 @@ public class BlockFluidInterface extends FCBaseBlock {
|
||||
setFullBlock(true);
|
||||
setOpaque(true);
|
||||
setTileEntity(TileFluidInterface.class);
|
||||
setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
setFeature(EnumSet.of(AEFeature.Core));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
protected RenderBlockFluidInterface getRenderer()
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlockFluidInterface getRenderer() {
|
||||
return new RenderBlockFluidInterface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int facing, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
public boolean onActivated(
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final EntityPlayer player,
|
||||
final int facing,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
final TileInterface tg = this.getTileEntity( world, x, y, z );
|
||||
if( tg != null )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.DUAL_INTERFACE);
|
||||
final TileInterface tg = this.getTileEntity(world, x, y, z);
|
||||
if (tg != null) {
|
||||
if (Platform.isServer()) {
|
||||
InventoryHandler.openGui(
|
||||
player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.DUAL_INTERFACE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -61,17 +65,14 @@ public class BlockFluidInterface extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCustomRotation()
|
||||
{
|
||||
protected boolean hasCustomRotation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customRotateBlock(final IOrientable rotatable, final ForgeDirection axis )
|
||||
{
|
||||
if( rotatable instanceof TileInterface )
|
||||
{
|
||||
( (TileInterface) rotatable ).setSide( axis );
|
||||
protected void customRotateBlock(final IOrientable rotatable, final ForgeDirection axis) {
|
||||
if (rotatable instanceof TileInterface) {
|
||||
((TileInterface) rotatable).setSide(axis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,5 +90,4 @@ public class BlockFluidInterface extends FCBaseBlock {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,14 +24,20 @@ public class BlockFluidPacketDecoder extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
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;
|
||||
}
|
||||
TileFluidPacketDecoder tile = getTileEntity(world, x, y, z);
|
||||
if (tile != null) {
|
||||
if (!world.isRemote) {
|
||||
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.FLUID_PACKET_DECODER);
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
world,
|
||||
new BlockPos(x, y, z),
|
||||
EnumFacing.getFront(facing),
|
||||
GuiType.FLUID_PACKET_DECODER);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -52,5 +58,4 @@ public class BlockFluidPacketDecoder extends FCBaseBlock {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,14 +24,20 @@ public class BlockFluidPatternEncoder extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
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;
|
||||
}
|
||||
TileFluidPatternEncoder tile = getTileEntity(world, x, y, z);
|
||||
if (tile != null) {
|
||||
if (!world.isRemote) {
|
||||
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.FLUID_PATTERN_ENCODER);
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
world,
|
||||
new BlockPos(x, y, z),
|
||||
EnumFacing.getFront(facing),
|
||||
GuiType.FLUID_PATTERN_ENCODER);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -52,5 +58,4 @@ public class BlockFluidPatternEncoder extends FCBaseBlock {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,14 +25,16 @@ public class BlockIngredientBuffer extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
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;
|
||||
}
|
||||
TileIngredientBuffer tile = getTileEntity(world, x, y, z);
|
||||
if (tile != null) {
|
||||
if (!world.isRemote) {
|
||||
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.INGREDIENT_BUFFER);
|
||||
InventoryHandler.openGui(
|
||||
player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.INGREDIENT_BUFFER);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -53,5 +55,4 @@ public class BlockIngredientBuffer extends FCBaseBlock {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,14 +25,20 @@ public class BlockLargeIngredientBuffer extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
TileLargeIngredientBuffer tile = getTileEntity(world, x, y, z);
|
||||
if (tile != null) {
|
||||
if (!world.isRemote) {
|
||||
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.LARGE_INGREDIENT_BUFFER);
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
world,
|
||||
new BlockPos(x, y, z),
|
||||
EnumFacing.getFront(facing),
|
||||
GuiType.LARGE_INGREDIENT_BUFFER);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -53,5 +59,4 @@ public class BlockLargeIngredientBuffer extends FCBaseBlock {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,7 +44,8 @@ public class BlockLevelMaintainer extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
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;
|
||||
}
|
||||
@@ -52,7 +53,12 @@ public class BlockLevelMaintainer extends FCBaseBlock {
|
||||
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);
|
||||
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."));
|
||||
}
|
||||
|
||||
@@ -25,14 +25,16 @@ public class BlockOCPatternEditor extends FCBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
|
||||
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;
|
||||
}
|
||||
TileOCPatternEditor tile = getTileEntity(world, x, y, z);
|
||||
if (tile != null) {
|
||||
if (!world.isRemote) {
|
||||
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.OC_PATTERN_EDITOR);
|
||||
InventoryHandler.openGui(
|
||||
player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.OC_PATTERN_EDITOR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -56,5 +58,4 @@ public class BlockOCPatternEditor extends FCBaseBlock {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,11 +3,10 @@ package com.glodblock.github.common.block;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public class FCBaseBlock extends AEBaseTileBlock {
|
||||
|
||||
public FCBaseBlock(Material mat, String name) {
|
||||
@@ -17,7 +16,7 @@ public class FCBaseBlock extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTileEntity( final Class<? extends TileEntity> clazz ) {
|
||||
public void setTileEntity(final Class<? extends TileEntity> clazz) {
|
||||
super.setTileEntity(clazz);
|
||||
}
|
||||
|
||||
@@ -30,8 +29,7 @@ public class FCBaseBlock extends AEBaseTileBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFeature( final EnumSet<AEFeature> f ) {
|
||||
public void setFeature(final EnumSet<AEFeature> f) {
|
||||
super.setFeature(f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,9 @@ import com.google.common.base.Optional;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -42,29 +45,22 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFluidCell
|
||||
{
|
||||
public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFluidCell {
|
||||
private final CellType component;
|
||||
private final int totalBytes;
|
||||
private final int perType;
|
||||
private final double idleDrain;
|
||||
private final static HashMap<Integer, IIcon> icon = new HashMap<>();
|
||||
private static final HashMap<Integer, IIcon> icon = new HashMap<>();
|
||||
|
||||
public ItemBasicFluidStorageCell( final CellType whichCell, final int kilobytes )
|
||||
{
|
||||
super( Optional.of( kilobytes + "k" ) );
|
||||
public ItemBasicFluidStorageCell(final CellType whichCell, final int kilobytes) {
|
||||
super(Optional.of(kilobytes + "k"));
|
||||
setUnlocalizedName(NameConst.ITEM_FLUID_STORAGE + kilobytes);
|
||||
this.setFeature( EnumSet.of( AEFeature.StorageCells ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
this.setFeature(EnumSet.of(AEFeature.StorageCells));
|
||||
this.setMaxStackSize(1);
|
||||
this.totalBytes = kilobytes * 1024;
|
||||
this.component = whichCell;
|
||||
|
||||
switch( this.component )
|
||||
{
|
||||
switch (this.component) {
|
||||
case Cell1kPart:
|
||||
this.idleDrain = 0.5;
|
||||
this.perType = 8;
|
||||
@@ -111,7 +107,10 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icon.put(this.totalBytes / 1024, iconRegister.registerIcon(NameConst.RES_KEY + NameConst.ITEM_FLUID_STORAGE + "." + this.totalBytes / 1024));
|
||||
icon.put(
|
||||
this.totalBytes / 1024,
|
||||
iconRegister.registerIcon(
|
||||
NameConst.RES_KEY + NameConst.ITEM_FLUID_STORAGE + "." + this.totalBytes / 1024));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,31 +121,34 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.FLUIDS );
|
||||
public void addCheckedInformation(
|
||||
final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo) {
|
||||
final IMEInventoryHandler<?> inventory =
|
||||
AEApi.instance().registries().cell().getCellInventory(stack, null, StorageChannel.FLUIDS);
|
||||
|
||||
if( inventory instanceof IFluidCellInventoryHandler)
|
||||
{
|
||||
if (inventory instanceof IFluidCellInventoryHandler) {
|
||||
final IFluidCellInventoryHandler handler = (IFluidCellInventoryHandler) inventory;
|
||||
final IFluidCellInventory cellInventory = handler.getCellInv();
|
||||
|
||||
if( cellInventory != null )
|
||||
{
|
||||
lines.add( cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cellInventory.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
|
||||
if (cellInventory != null) {
|
||||
lines.add(cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + ' '
|
||||
+ cellInventory.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal());
|
||||
|
||||
lines.add( cellInventory.getStoredFluidTypes() + " " + GuiText.Of.getLocal() + ' ' + cellInventory.getTotalFluidTypes() + ' ' + GuiText.Types.getLocal() );
|
||||
lines.add(cellInventory.getStoredFluidTypes() + " " + GuiText.Of.getLocal() + ' '
|
||||
+ cellInventory.getTotalFluidTypes() + ' ' + GuiText.Types.getLocal());
|
||||
|
||||
if( handler.isPreformatted() )
|
||||
{
|
||||
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded).getLocal();
|
||||
if (handler.isPreformatted()) {
|
||||
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST
|
||||
? GuiText.Included
|
||||
: GuiText.Excluded)
|
||||
.getLocal();
|
||||
lines.add(GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal());
|
||||
|
||||
if (GuiScreen.isShiftKeyDown())
|
||||
{
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
lines.add(GuiText.Filter.getLocal() + ": ");
|
||||
for (IAEFluidStack aeFluidStack : handler.getPartitionInv()) {
|
||||
if (aeFluidStack != null) lines.add(" " + aeFluidStack.getFluidStack().getLocalizedName());
|
||||
if (aeFluidStack != null)
|
||||
lines.add(" " + aeFluidStack.getFluidStack().getLocalizedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,14 +157,12 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes( final ItemStack cellItem )
|
||||
{
|
||||
public int getBytes(final ItemStack cellItem) {
|
||||
return this.totalBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType( final ItemStack cellItem )
|
||||
{
|
||||
public int getBytesPerType(final ItemStack cellItem) {
|
||||
return this.perType;
|
||||
}
|
||||
|
||||
@@ -175,131 +175,113 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes( final ItemStack cellItem )
|
||||
{
|
||||
public int getTotalTypes(final ItemStack cellItem) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storableInStorageCell()
|
||||
{
|
||||
public boolean storableInStorageCell() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCell( final ItemStack i )
|
||||
{
|
||||
public boolean isStorageCell(final ItemStack i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain()
|
||||
{
|
||||
public double getIdleDrain() {
|
||||
return this.idleDrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable( final ItemStack is )
|
||||
{
|
||||
public boolean isEditable(final ItemStack is) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(final ItemStack is )
|
||||
{
|
||||
return new CellUpgrades( is, 0 );
|
||||
public IInventory getUpgradesInventory(final ItemStack is) {
|
||||
return new CellUpgrades(is, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory( final ItemStack is )
|
||||
{
|
||||
return new CellConfig( is );
|
||||
public IInventory getConfigInventory(final ItemStack is) {
|
||||
return new CellConfig(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode(final ItemStack is )
|
||||
{
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
public FuzzyMode getFuzzyMode(final ItemStack is) {
|
||||
final String fz = Platform.openNbtData(is).getString("FuzzyMode");
|
||||
try {
|
||||
return FuzzyMode.valueOf(fz);
|
||||
} catch (final Throwable t) {
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
public void setFuzzyMode(final ItemStack is, final FuzzyMode fzMode) {
|
||||
Platform.openNbtData(is).setString("FuzzyMode", fzMode.name());
|
||||
}
|
||||
|
||||
public String getOreFilter(ItemStack is) {
|
||||
return Platform.openNbtData( is ).getString( "OreFilter" );
|
||||
return Platform.openNbtData(is).getString("OreFilter");
|
||||
}
|
||||
|
||||
public void setOreFilter(ItemStack is, String filter) {
|
||||
Platform.openNbtData( is ).setString("OreFilter", filter);
|
||||
Platform.openNbtData(is).setString("OreFilter", filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player )
|
||||
{
|
||||
this.disassembleDrive( stack, world, player );
|
||||
public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
this.disassembleDrive(stack, world, player);
|
||||
return stack;
|
||||
}
|
||||
|
||||
private boolean disassembleDrive( final ItemStack stack, final World world, final EntityPlayer player )
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
private boolean disassembleDrive(final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
if (Platform.isClient()) {
|
||||
return false;
|
||||
}
|
||||
final InventoryPlayer playerInventory = player.inventory;
|
||||
final IMEInventoryHandler<?> inv = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.FLUIDS );
|
||||
if( inv != null && playerInventory.getCurrentItem() == stack )
|
||||
{
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
|
||||
final IItemList<IAEFluidStack> list = inv.getAvailableItems( StorageChannel.FLUIDS.createList() );
|
||||
if( list.isEmpty() && ia != null )
|
||||
{
|
||||
playerInventory.setInventorySlotContents( playerInventory.currentItem, null );
|
||||
final IMEInventoryHandler<?> inv =
|
||||
AEApi.instance().registries().cell().getCellInventory(stack, null, StorageChannel.FLUIDS);
|
||||
if (inv != null && playerInventory.getCurrentItem() == stack) {
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
|
||||
final IItemList<IAEFluidStack> list = inv.getAvailableItems(StorageChannel.FLUIDS.createList());
|
||||
if (list.isEmpty() && ia != null) {
|
||||
playerInventory.setInventorySlotContents(playerInventory.currentItem, null);
|
||||
|
||||
// drop core
|
||||
final ItemStack extraB = ia.addItems( this.component.stack( 1 ) );
|
||||
if( extraB != null )
|
||||
{
|
||||
player.dropPlayerItemWithRandomChoice( extraB, false );
|
||||
final ItemStack extraB = ia.addItems(this.component.stack(1));
|
||||
if (extraB != null) {
|
||||
player.dropPlayerItemWithRandomChoice(extraB, false);
|
||||
}
|
||||
|
||||
// drop upgrades
|
||||
final IInventory upgradesInventory = this.getUpgradesInventory( stack );
|
||||
for( int upgradeIndex = 0; upgradeIndex < upgradesInventory.getSizeInventory(); upgradeIndex++ )
|
||||
{
|
||||
final ItemStack upgradeStack = upgradesInventory.getStackInSlot( upgradeIndex );
|
||||
final ItemStack leftStack = ia.addItems( upgradeStack );
|
||||
if( leftStack != null && upgradeStack.getItem() instanceof IUpgradeModule)
|
||||
{
|
||||
player.dropPlayerItemWithRandomChoice( upgradeStack, false );
|
||||
final IInventory upgradesInventory = this.getUpgradesInventory(stack);
|
||||
for (int upgradeIndex = 0; upgradeIndex < upgradesInventory.getSizeInventory(); upgradeIndex++) {
|
||||
final ItemStack upgradeStack = upgradesInventory.getStackInSlot(upgradeIndex);
|
||||
final ItemStack leftStack = ia.addItems(upgradeStack);
|
||||
if (leftStack != null && upgradeStack.getItem() instanceof IUpgradeModule) {
|
||||
player.dropPlayerItemWithRandomChoice(upgradeStack, false);
|
||||
}
|
||||
}
|
||||
|
||||
// drop empty storage cell case
|
||||
for( final ItemStack storageCellStack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
final ItemStack extraA = ia.addItems( storageCellStack );
|
||||
if( extraA != null )
|
||||
{
|
||||
player.dropPlayerItemWithRandomChoice( extraA, false );
|
||||
for (final ItemStack storageCellStack : AEApi.instance()
|
||||
.definitions()
|
||||
.materials()
|
||||
.emptyStorageCell()
|
||||
.maybeStack(1)
|
||||
.asSet()) {
|
||||
final ItemStack extraA = ia.addItems(storageCellStack);
|
||||
if (extraA != null) {
|
||||
player.dropPlayerItemWithRandomChoice(extraA, false);
|
||||
}
|
||||
}
|
||||
|
||||
if( player.inventoryContainer != null )
|
||||
{
|
||||
if (player.inventoryContainer != null) {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@@ -311,34 +293,44 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( ForgeEventFactory.onItemUseStart( player, stack, 1 ) <= 0 )
|
||||
return true;
|
||||
public boolean onItemUseFirst(
|
||||
final ItemStack stack,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final int x,
|
||||
final int y,
|
||||
final int z,
|
||||
final int side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ) {
|
||||
if (ForgeEventFactory.onItemUseStart(player, stack, 1) <= 0) return true;
|
||||
|
||||
return this.disassembleDrive( stack, world, player );
|
||||
return this.disassembleDrive(stack, world, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem( final ItemStack itemStack )
|
||||
{
|
||||
for( final ItemStack stack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
public ItemStack getContainerItem(final ItemStack itemStack) {
|
||||
for (final ItemStack stack : AEApi.instance()
|
||||
.definitions()
|
||||
.materials()
|
||||
.emptyStorageCell()
|
||||
.maybeStack(1)
|
||||
.asSet()) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
throw new MissingDefinition( "Tried to use empty storage cells while basic storage cells are defined." );
|
||||
throw new MissingDefinition("Tried to use empty storage cells while basic storage cells are defined.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem( final ItemStack stack )
|
||||
{
|
||||
return AEConfig.instance.isFeatureEnabled( AEFeature.EnableDisassemblyCrafting );
|
||||
public boolean hasContainerItem(final ItemStack stack) {
|
||||
return AEConfig.instance.isFeatureEnabled(AEFeature.EnableDisassemblyCrafting);
|
||||
}
|
||||
|
||||
public ItemBasicFluidStorageCell register() {
|
||||
if (!Config.fluidCells) return null;
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_STORAGE + this.totalBytes / 1024 , FluidCraft.MODID);
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_STORAGE + this.totalBytes / 1024, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
@@ -350,5 +342,4 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,8 @@ 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 java.util.HashMap;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -14,13 +16,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemBasicFluidStoragePart extends Item {
|
||||
|
||||
public static final int types = 7;
|
||||
private final static HashMap<Integer, IIcon> icon = new HashMap<>();
|
||||
private static final HashMap<Integer, IIcon> icon = new HashMap<>();
|
||||
|
||||
public ItemBasicFluidStoragePart() {
|
||||
super();
|
||||
@@ -46,7 +45,7 @@ public class ItemBasicFluidStoragePart extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
for (int i = 0; i < types; i ++) {
|
||||
for (int i = 0; i < types; i++) {
|
||||
icon.put(i, iconRegister.registerIcon(NameConst.RES_KEY + NameConst.ITEM_FLUID_PART + "." + i));
|
||||
}
|
||||
}
|
||||
@@ -63,5 +62,4 @@ public class ItemBasicFluidStoragePart extends Item {
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,9 @@ 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 java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -24,10 +27,6 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ItemFluidDrop extends Item {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -49,7 +48,8 @@ public class ItemFluidDrop extends Item {
|
||||
if (ItemFluidPacket.isDisplay(stack)) {
|
||||
return fluid != null ? fluid.getLocalizedName() : StatCollector.translateToLocalFormatted("error.unknown");
|
||||
}
|
||||
return StatCollector.translateToLocalFormatted("item.fluid_drop.name", fluid == null ? "???" : fluid.getLocalizedName());
|
||||
return StatCollector.translateToLocalFormatted(
|
||||
"item.fluid_drop.name", fluid == null ? "???" : fluid.getLocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,5 +173,4 @@ public class ItemFluidDrop extends Item {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_DROP, FluidCraft.MODID);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +1,16 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemFluidEncodedPattern extends ItemEncodedPattern {
|
||||
|
||||
@@ -34,14 +32,16 @@ public class ItemFluidEncodedPattern extends ItemEncodedPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
public void addCheckedInformation(
|
||||
final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo) {
|
||||
NBTTagCompound data = stack.getTagCompound();
|
||||
final boolean combine = data.getBoolean("combine");
|
||||
final boolean prio = data.getBoolean("prioritize");
|
||||
super.addCheckedInformation(stack, player, lines, displayMoreInfo);
|
||||
// lines.add(String.format("%s: %s",combine ? StatCollector.translateToLocal(NameConst.TT_KEY+"combine"):StatCollector.translateToLocal(NameConst.TT_KEY+"not_combine"),combine ? GuiText.Yes.getLocal() : GuiText.No.getLocal()));
|
||||
// lines.add(String.format("%s: %s",prio ? StatCollector.translateToLocal(NameConst.TT_KEY+"prio"):StatCollector.translateToLocal(NameConst.TT_KEY+"not_prio"),prio ? GuiText.Yes.getLocal() : GuiText.No.getLocal()));
|
||||
// lines.add(String.format("%s: %s",combine ?
|
||||
// StatCollector.translateToLocal(NameConst.TT_KEY+"combine"):StatCollector.translateToLocal(NameConst.TT_KEY+"not_combine"),combine ? GuiText.Yes.getLocal() : GuiText.No.getLocal()));
|
||||
// lines.add(String.format("%s: %s",prio ?
|
||||
// StatCollector.translateToLocal(NameConst.TT_KEY+"prio"):StatCollector.translateToLocal(NameConst.TT_KEY+"not_prio"),prio ? GuiText.Yes.getLocal() : GuiText.No.getLocal()));
|
||||
}
|
||||
|
||||
public ItemStack stack() {
|
||||
|
||||
@@ -10,14 +10,13 @@ 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 javax.annotation.Nullable;
|
||||
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.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemFluidExportBus extends Item implements IPartItem {
|
||||
|
||||
public ItemFluidExportBus() {
|
||||
@@ -33,7 +32,17 @@ public class ItemFluidExportBus extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -45,8 +54,7 @@ public class ItemFluidExportBus extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {
|
||||
}
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -61,6 +69,4 @@ public class ItemFluidExportBus extends Item implements IPartItem {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,14 +10,13 @@ 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 javax.annotation.Nullable;
|
||||
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.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemFluidImportBus extends Item implements IPartItem {
|
||||
|
||||
public ItemFluidImportBus() {
|
||||
@@ -33,7 +32,17 @@ public class ItemFluidImportBus extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -45,8 +54,7 @@ public class ItemFluidImportBus extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {
|
||||
}
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -61,5 +69,4 @@ public class ItemFluidImportBus extends Item implements IPartItem {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,9 @@ 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 java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -20,10 +23,6 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ItemFluidPacket extends Item {
|
||||
|
||||
public ItemFluidPacket() {
|
||||
@@ -31,6 +30,15 @@ public class ItemFluidPacket extends Item {
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
public static FluidStack getFluidStack(ItemStack stack) {
|
||||
if (stack == null || !stack.hasTagCompound()) {
|
||||
return null;
|
||||
}
|
||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(
|
||||
Objects.requireNonNull(stack.getTagCompound()).getCompoundTag("FluidStack"));
|
||||
return (fluid != null && fluid.amount > 0) ? fluid : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
FluidStack fluid = getFluidStack(stack);
|
||||
@@ -38,23 +46,9 @@ public class ItemFluidPacket extends Item {
|
||||
if (display) {
|
||||
return fluid != null ? fluid.getLocalizedName() : super.getItemStackDisplayName(stack);
|
||||
}
|
||||
return fluid != null ? String.format("%s, %,d mB", fluid.getLocalizedName(), fluid.amount)
|
||||
: super.getItemStackDisplayName(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean flags) {
|
||||
FluidStack fluid = getFluidStack(stack);
|
||||
boolean display = isDisplay(stack);
|
||||
if (display) return;
|
||||
if (fluid != null) {
|
||||
for (String line : StatCollector.translateToLocalFormatted(NameConst.TT_FLUID_PACKET).split("\\\\n")) {
|
||||
tooltip.add(EnumChatFormatting.GRAY + line);
|
||||
}
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted(NameConst.TT_INVALID_FLUID));
|
||||
}
|
||||
return fluid != null
|
||||
? String.format("%s, %,d mB", fluid.getLocalizedName(), fluid.amount)
|
||||
: super.getItemStackDisplayName(stack);
|
||||
}
|
||||
|
||||
public static boolean isDisplay(ItemStack stack) {
|
||||
@@ -64,12 +58,20 @@ public class ItemFluidPacket extends Item {
|
||||
return stack.getTagCompound().getBoolean("DisplayOnly");
|
||||
}
|
||||
|
||||
public static FluidStack getFluidStack(ItemStack stack) {
|
||||
if (stack == null || !stack.hasTagCompound()) {
|
||||
return null;
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean flags) {
|
||||
FluidStack fluid = getFluidStack(stack);
|
||||
boolean display = isDisplay(stack);
|
||||
if (display) return;
|
||||
if (fluid != null) {
|
||||
for (String line : StatCollector.translateToLocalFormatted(NameConst.TT_FLUID_PACKET)
|
||||
.split("\\\\n")) {
|
||||
tooltip.add(EnumChatFormatting.GRAY + line);
|
||||
}
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted(NameConst.TT_INVALID_FLUID));
|
||||
}
|
||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(Objects.requireNonNull(stack.getTagCompound()).getCompoundTag("FluidStack"));
|
||||
return (fluid != null && fluid.amount > 0) ? fluid : null;
|
||||
}
|
||||
|
||||
public static FluidStack getFluidStack(@Nullable IAEItemStack stack) {
|
||||
@@ -117,8 +119,7 @@ public class ItemFluidPacket extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister aIconRegister) {
|
||||
}
|
||||
public void registerIcons(IIconRegister aIconRegister) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int p_77617_1_) {
|
||||
|
||||
@@ -9,14 +9,13 @@ 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 javax.annotation.Nullable;
|
||||
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.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemPartFluidInterface extends Item implements IPartItem {
|
||||
|
||||
public ItemPartFluidInterface() {
|
||||
@@ -32,7 +31,17 @@ public class ItemPartFluidInterface extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -43,8 +52,7 @@ public class ItemPartFluidInterface extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {
|
||||
}
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -59,5 +67,4 @@ public class ItemPartFluidInterface extends Item implements IPartItem {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,14 +9,13 @@ 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 javax.annotation.Nullable;
|
||||
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.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemPartFluidPatternTerminal extends Item implements IPartItem {
|
||||
|
||||
public ItemPartFluidPatternTerminal() {
|
||||
@@ -32,7 +31,17 @@ public class ItemPartFluidPatternTerminal extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -43,8 +52,7 @@ public class ItemPartFluidPatternTerminal extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {
|
||||
}
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -59,5 +67,4 @@ public class ItemPartFluidPatternTerminal extends Item implements IPartItem {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,14 +9,13 @@ 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 javax.annotation.Nullable;
|
||||
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.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemPartFluidPatternTerminalEx extends Item implements IPartItem {
|
||||
|
||||
public ItemPartFluidPatternTerminalEx() {
|
||||
@@ -32,7 +31,17 @@ public class ItemPartFluidPatternTerminalEx extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -43,8 +52,7 @@ public class ItemPartFluidPatternTerminalEx extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {
|
||||
}
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -59,5 +67,4 @@ public class ItemPartFluidPatternTerminalEx extends Item implements IPartItem {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
@@ -9,6 +11,8 @@ 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 java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -16,12 +20,6 @@ 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);
|
||||
@@ -36,7 +34,17 @@ public class ItemPartFluidTerminal extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -54,8 +62,7 @@ public class ItemPartFluidTerminal extends Item implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {
|
||||
}
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -70,5 +77,4 @@ public class ItemPartFluidTerminal extends Item implements IPartItem {
|
||||
public ItemStack stack() {
|
||||
return new ItemStack(this, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,8 @@ import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -43,10 +45,8 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class FCBasePart extends AEBasePart implements IPowerChannelState, ITerminalHost, IConfigManagerHost, IViewCellStorage, IAEAppEngInventory {
|
||||
public abstract class FCBasePart extends AEBasePart
|
||||
implements IPowerChannelState, ITerminalHost, IConfigManagerHost, IViewCellStorage, IAEAppEngInventory {
|
||||
|
||||
protected static final int POWERED_FLAG = 4;
|
||||
protected static final int CHANNEL_FLAG = 16;
|
||||
@@ -56,172 +56,140 @@ public abstract class FCBasePart extends AEBasePart implements IPowerChannelStat
|
||||
private int clientFlags = 0; // sent as byte.
|
||||
private float opacity = -1;
|
||||
|
||||
private final IConfigManager cm = new ConfigManager( this );
|
||||
private final AppEngInternalInventory viewCell = new AppEngInternalInventory( this, 5 );
|
||||
private final IConfigManager cm = new ConfigManager(this);
|
||||
private final AppEngInternalInventory viewCell = new AppEngInternalInventory(this, 5);
|
||||
|
||||
public FCBasePart( final ItemStack is )
|
||||
{
|
||||
this( is, false );
|
||||
public FCBasePart(final ItemStack is) {
|
||||
this(is, false);
|
||||
}
|
||||
|
||||
protected FCBasePart( final ItemStack is, final boolean requireChannel )
|
||||
{
|
||||
super( is );
|
||||
protected FCBasePart(final ItemStack is, final boolean requireChannel) {
|
||||
super(is);
|
||||
|
||||
if( requireChannel )
|
||||
{
|
||||
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
this.getProxy().setIdlePowerUsage( 1.0 / 2.0 );
|
||||
if (requireChannel) {
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.getProxy().setIdlePowerUsage(1.0 / 2.0);
|
||||
} else {
|
||||
this.getProxy().setIdlePowerUsage(1.0 / 16.0); // lights drain a little bit.
|
||||
}
|
||||
else
|
||||
{
|
||||
this.getProxy().setIdlePowerUsage( 1.0 / 16.0 ); // lights drain a little bit.
|
||||
}
|
||||
this.cm.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||
this.cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||
this.cm.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||
this.cm.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
this.cm.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
this.cm.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public final void bootingRender( final MENetworkBootingStatusChange c )
|
||||
{
|
||||
if( !this.isLightSource() )
|
||||
{
|
||||
public final void bootingRender(final MENetworkBootingStatusChange c) {
|
||||
if (!this.isLightSource()) {
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public final void powerRender( final MENetworkPowerStatusChange c )
|
||||
{
|
||||
public final void powerRender(final MENetworkPowerStatusChange c) {
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void getBoxes( final IPartCollisionHelper bch )
|
||||
{
|
||||
bch.addBox( 2, 2, 14, 14, 14, 16 );
|
||||
bch.addBox( 4, 4, 13, 12, 12, 14 );
|
||||
public final void getBoxes(final IPartCollisionHelper bch) {
|
||||
bch.addBox(2, 2, 14, 14, 14, 16);
|
||||
bch.addBox(4, 4, 13, 12, 12, 14);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
public void onNeighborChanged() {
|
||||
this.opacity = -1;
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched )
|
||||
{
|
||||
super.getDrops( drops, wrenched );
|
||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
||||
super.getDrops(drops, wrenched);
|
||||
|
||||
for( final ItemStack is : this.viewCell )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
drops.add( is );
|
||||
for (final ItemStack is : this.viewCell) {
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
public IConfigManager getConfigManager() {
|
||||
return this.cm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
if( data.hasKey( "opacity" ) )
|
||||
{
|
||||
this.opacity = data.getFloat( "opacity" );
|
||||
public void readFromNBT(final NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
if (data.hasKey("opacity")) {
|
||||
this.opacity = data.getFloat("opacity");
|
||||
}
|
||||
this.spin = data.getByte( "spin" );
|
||||
this.cm.readFromNBT( data );
|
||||
this.viewCell.readFromNBT( data, "viewCell" );
|
||||
this.spin = data.getByte("spin");
|
||||
this.cm.readFromNBT(data);
|
||||
this.viewCell.readFromNBT(data, "viewCell");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
data.setFloat( "opacity", this.opacity );
|
||||
data.setByte( "spin", this.getSpin() );
|
||||
this.cm.writeToNBT( data );
|
||||
this.viewCell.writeToNBT( data, "viewCell" );
|
||||
public void writeToNBT(final NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
data.setFloat("opacity", this.opacity);
|
||||
data.setByte("spin", this.getSpin());
|
||||
this.cm.writeToNBT(data);
|
||||
this.viewCell.writeToNBT(data, "viewCell");
|
||||
}
|
||||
|
||||
public GuiBridge getGui(final EntityPlayer player )
|
||||
{
|
||||
public GuiBridge getGui(final EntityPlayer player) {
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToStream( final ByteBuf data ) throws IOException
|
||||
{
|
||||
super.writeToStream( data );
|
||||
public void writeToStream(final ByteBuf data) throws IOException {
|
||||
super.writeToStream(data);
|
||||
this.clientFlags = this.getSpin() & 3;
|
||||
|
||||
try
|
||||
{
|
||||
if( this.getProxy().getEnergy().isNetworkPowered() )
|
||||
{
|
||||
try {
|
||||
if (this.getProxy().getEnergy().isNetworkPowered()) {
|
||||
this.clientFlags = this.getClientFlags() | FCBasePart.POWERED_FLAG;
|
||||
}
|
||||
|
||||
if( this.getProxy().getPath().isNetworkBooting() )
|
||||
{
|
||||
if (this.getProxy().getPath().isNetworkBooting()) {
|
||||
this.clientFlags = this.getClientFlags() | FCBasePart.BOOTING_FLAG;
|
||||
}
|
||||
|
||||
if( this.getProxy().getNode().meetsChannelRequirements() )
|
||||
{
|
||||
if (this.getProxy().getNode().meetsChannelRequirements()) {
|
||||
this.clientFlags = this.getClientFlags() | FCBasePart.CHANNEL_FLAG;
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
} catch (final GridAccessException e) {
|
||||
// um.. nothing.
|
||||
}
|
||||
|
||||
data.writeByte( (byte) this.getClientFlags() );
|
||||
data.writeByte((byte) this.getClientFlags());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readFromStream( final ByteBuf data ) throws IOException
|
||||
{
|
||||
super.readFromStream( data );
|
||||
public boolean readFromStream(final ByteBuf data) throws IOException {
|
||||
super.readFromStream(data);
|
||||
final int oldFlags = this.getClientFlags();
|
||||
this.clientFlags = data.readByte();
|
||||
this.spin = (byte) ( this.getClientFlags() & 3 );
|
||||
this.spin = (byte) (this.getClientFlags() & 3);
|
||||
return this.getClientFlags() != oldFlags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getLightLevel()
|
||||
{
|
||||
return this.blockLight( this.isPowered() ? ( this.isLightSource() ? 15 : 9 ) : 0 );
|
||||
public final int getLightLevel() {
|
||||
return this.blockLight(this.isPowered() ? (this.isLightSource() ? 15 : 9) : 0);
|
||||
}
|
||||
|
||||
public boolean onPartActivate0(final EntityPlayer player, final Vec3 pos )
|
||||
{
|
||||
public boolean onPartActivate0(final EntityPlayer player, final Vec3 pos) {
|
||||
final TileEntity te = this.getTile();
|
||||
|
||||
if( !player.isSneaking() && Platform.isWrench( player, player.inventory.getCurrentItem(), te.xCoord, te.yCoord, te.zCoord ) )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
if( this.getSpin() > 3 )
|
||||
{
|
||||
if (!player.isSneaking()
|
||||
&& Platform.isWrench(player, player.inventory.getCurrentItem(), te.xCoord, te.yCoord, te.zCoord)) {
|
||||
if (Platform.isServer()) {
|
||||
if (this.getSpin() > 3) {
|
||||
this.spin = 0;
|
||||
}
|
||||
|
||||
switch( this.getSpin() )
|
||||
{
|
||||
switch (this.getSpin()) {
|
||||
case 0:
|
||||
this.spin = 1;
|
||||
break;
|
||||
@@ -240,26 +208,20 @@ public abstract class FCBasePart extends AEBasePart implements IPowerChannelStat
|
||||
this.saveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.onPartActivate( player, pos );
|
||||
} else {
|
||||
return super.onPartActivate(player, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate( final EntityPlayer player, final Vec3 pos )
|
||||
{
|
||||
if( !onPartActivate0( player, pos ) )
|
||||
{
|
||||
if( !player.isSneaking() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos) {
|
||||
if (!onPartActivate0(player, pos)) {
|
||||
if (!player.isSneaking()) {
|
||||
if (Platform.isClient()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.getSide(), this.getGui( player ) );
|
||||
Platform.openGUI(player, this.getHost().getTile(), this.getSide(), this.getGui(player));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -268,213 +230,206 @@ public abstract class FCBasePart extends AEBasePart implements IPowerChannelStat
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPlacement( final EntityPlayer player, final ItemStack held, final ForgeDirection side )
|
||||
{
|
||||
super.onPlacement( player, held, side );
|
||||
public final void onPlacement(final EntityPlayer player, final ItemStack held, final ForgeDirection side) {
|
||||
super.onPlacement(player, held, side);
|
||||
|
||||
final byte rotation = (byte) ( MathHelper.floor_double( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
|
||||
if( side == ForgeDirection.UP )
|
||||
{
|
||||
final byte rotation = (byte) (MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 2.5D) & 3);
|
||||
if (side == ForgeDirection.UP) {
|
||||
this.spin = rotation;
|
||||
}
|
||||
else if( side == ForgeDirection.DOWN )
|
||||
{
|
||||
} else if (side == ForgeDirection.DOWN) {
|
||||
this.spin = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
private int blockLight(final int emit )
|
||||
{
|
||||
if( this.opacity < 0 )
|
||||
{
|
||||
private int blockLight(final int emit) {
|
||||
if (this.opacity < 0) {
|
||||
final TileEntity te = this.getTile();
|
||||
this.opacity = 255 - te.getWorldObj().getBlockLightOpacity( te.xCoord + this.getSide().offsetX, te.yCoord + this.getSide().offsetY, te.zCoord + this.getSide().offsetZ );
|
||||
this.opacity = 255
|
||||
- te.getWorldObj()
|
||||
.getBlockLightOpacity(
|
||||
te.xCoord + this.getSide().offsetX,
|
||||
te.yCoord + this.getSide().offsetY,
|
||||
te.zCoord + this.getSide().offsetZ);
|
||||
}
|
||||
|
||||
return (int) ( emit * ( this.opacity / 255.0f ) );
|
||||
return (int) (emit * (this.opacity / 255.0f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isPowered()
|
||||
{
|
||||
try
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
public final boolean isPowered() {
|
||||
try {
|
||||
if (Platform.isServer()) {
|
||||
return this.getProxy().getEnergy().isNetworkPowered();
|
||||
} else {
|
||||
return ((this.getClientFlags() & FCBasePart.POWERED_FLAG) == FCBasePart.POWERED_FLAG);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( ( this.getClientFlags() & FCBasePart.POWERED_FLAG ) == FCBasePart.POWERED_FLAG );
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
} catch (final GridAccessException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory()
|
||||
{
|
||||
try
|
||||
{
|
||||
public IMEMonitor<IAEItemStack> getItemInventory() {
|
||||
try {
|
||||
return this.getProxy().getStorage().getItemInventory();
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
} catch (final GridAccessException e) {
|
||||
// err nope?
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory()
|
||||
{
|
||||
try
|
||||
{
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory() {
|
||||
try {
|
||||
return this.getProxy().getStorage().getFluidInventory();
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
} catch (final GridAccessException e) {
|
||||
// err nope?
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
|
||||
{
|
||||
|
||||
}
|
||||
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {}
|
||||
|
||||
@Override
|
||||
public IInventory getViewCellStorage()
|
||||
{
|
||||
public IInventory getViewCellStorage() {
|
||||
return this.viewCell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
{
|
||||
public void onChangeInventory(
|
||||
final IInventory inv,
|
||||
final int slot,
|
||||
final InvOperation mc,
|
||||
final ItemStack removedStack,
|
||||
final ItemStack newStack) {
|
||||
this.getHost().markForSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isActive()
|
||||
{
|
||||
if( !this.isLightSource() )
|
||||
{
|
||||
return ( ( this.getClientFlags() & ( FCBasePart.CHANNEL_FLAG | FCBasePart.POWERED_FLAG ) ) == ( FCBasePart.CHANNEL_FLAG | FCBasePart.POWERED_FLAG ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
public final boolean isActive() {
|
||||
if (!this.isLightSource()) {
|
||||
return ((this.getClientFlags() & (FCBasePart.CHANNEL_FLAG | FCBasePart.POWERED_FLAG))
|
||||
== (FCBasePart.CHANNEL_FLAG | FCBasePart.POWERED_FLAG));
|
||||
} else {
|
||||
return this.isPowered();
|
||||
}
|
||||
}
|
||||
|
||||
public final int getClientFlags()
|
||||
{
|
||||
public final int getClientFlags() {
|
||||
return this.clientFlags;
|
||||
}
|
||||
|
||||
public final byte getSpin()
|
||||
{
|
||||
public final byte getSpin() {
|
||||
return this.spin;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer )
|
||||
{
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
rh.setBounds(2, 2, 14, 14, 14, 16);
|
||||
|
||||
final IIcon sideTexture = CableBusTextures.PartMonitorSides.getIcon();
|
||||
final IIcon backTexture = CableBusTextures.PartMonitorBack.getIcon();
|
||||
|
||||
rh.setTexture( sideTexture, sideTexture, backTexture, FCPartsTexture.PartTerminalBroad.getIcon(), sideTexture, sideTexture );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setTexture(
|
||||
sideTexture,
|
||||
sideTexture,
|
||||
backTexture,
|
||||
FCPartsTexture.PartTerminalBroad.getIcon(),
|
||||
sideTexture,
|
||||
sideTexture);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setInvColor( this.getColor().whiteVariant );
|
||||
rh.renderInventoryFace( this.getFrontBright().getIcon(), ForgeDirection.SOUTH, renderer );
|
||||
rh.setInvColor(this.getColor().whiteVariant);
|
||||
rh.renderInventoryFace(this.getFrontBright().getIcon(), ForgeDirection.SOUTH, renderer);
|
||||
|
||||
rh.setInvColor( this.getColor().mediumVariant );
|
||||
rh.renderInventoryFace( this.getFrontDark().getIcon(), ForgeDirection.SOUTH, renderer );
|
||||
rh.setInvColor(this.getColor().mediumVariant);
|
||||
rh.renderInventoryFace(this.getFrontDark().getIcon(), ForgeDirection.SOUTH, renderer);
|
||||
|
||||
rh.setInvColor( this.getColor().blackVariant );
|
||||
rh.renderInventoryFace( this.getFrontColored().getIcon(), ForgeDirection.SOUTH, renderer );
|
||||
rh.setInvColor(this.getColor().blackVariant);
|
||||
rh.renderInventoryFace(this.getFrontColored().getIcon(), ForgeDirection.SOUTH, renderer);
|
||||
|
||||
rh.setBounds( 4, 4, 13, 12, 12, 14 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(4, 4, 13, 12, 12, 14);
|
||||
rh.renderInventoryBox(renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( final int x, final int y, final int z, final IPartRenderHelper rh, final RenderBlocks renderer )
|
||||
{
|
||||
this.setRenderCache( rh.useSimplifiedRendering( x, y, z, this, this.getRenderCache() ) );
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(
|
||||
final int x, final int y, final int z, final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
this.setRenderCache(rh.useSimplifiedRendering(x, y, z, this, this.getRenderCache()));
|
||||
|
||||
final IIcon sideTexture = CableBusTextures.PartMonitorSides.getIcon();
|
||||
final IIcon backTexture = CableBusTextures.PartMonitorBack.getIcon();
|
||||
|
||||
rh.setTexture( sideTexture, sideTexture, backTexture, FCPartsTexture.PartTerminalBroad.getIcon(), sideTexture, sideTexture );
|
||||
rh.setTexture(
|
||||
sideTexture,
|
||||
sideTexture,
|
||||
backTexture,
|
||||
FCPartsTexture.PartTerminalBroad.getIcon(),
|
||||
sideTexture,
|
||||
sideTexture);
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(2, 2, 14, 14, 14, 16);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
if( this.getLightLevel() > 0 )
|
||||
{
|
||||
if (this.getLightLevel() > 0) {
|
||||
final int l = 13;
|
||||
Tessellator.instance.setBrightness( l << 20 | l << 4 );
|
||||
Tessellator.instance.setBrightness(l << 20 | l << 4);
|
||||
}
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = this.getSpin();
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth =
|
||||
renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = this.getSpin();
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getColor().whiteVariant );
|
||||
rh.renderFace( x, y, z, this.getFrontBright().getIcon(), ForgeDirection.SOUTH, renderer );
|
||||
Tessellator.instance.setColorOpaque_I(this.getColor().whiteVariant);
|
||||
rh.renderFace(x, y, z, this.getFrontBright().getIcon(), ForgeDirection.SOUTH, renderer);
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getColor().mediumVariant );
|
||||
rh.renderFace( x, y, z, this.getFrontDark().getIcon(), ForgeDirection.SOUTH, renderer );
|
||||
Tessellator.instance.setColorOpaque_I(this.getColor().mediumVariant);
|
||||
rh.renderFace(x, y, z, this.getFrontDark().getIcon(), ForgeDirection.SOUTH, renderer);
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getColor().blackVariant );
|
||||
rh.renderFace( x, y, z, this.getFrontColored().getIcon(), ForgeDirection.SOUTH, renderer );
|
||||
Tessellator.instance.setColorOpaque_I(this.getColor().blackVariant);
|
||||
rh.renderFace(x, y, z, this.getFrontColored().getIcon(), ForgeDirection.SOUTH, renderer);
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast =
|
||||
renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
|
||||
final IIcon sideStatusTexture = CableBusTextures.PartMonitorSidesStatus.getIcon();
|
||||
|
||||
rh.setTexture( sideStatusTexture, sideStatusTexture, backTexture, this.getItemStack().getIconIndex(), sideStatusTexture, sideStatusTexture );
|
||||
rh.setTexture(
|
||||
sideStatusTexture,
|
||||
sideStatusTexture,
|
||||
backTexture,
|
||||
this.getItemStack().getIconIndex(),
|
||||
sideStatusTexture,
|
||||
sideStatusTexture);
|
||||
|
||||
rh.setBounds( 4, 4, 13, 12, 12, 14 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(4, 4, 13, 12, 12, 14);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
final boolean hasChan = ( this.getClientFlags() & ( FCBasePart.POWERED_FLAG | FCBasePart.CHANNEL_FLAG ) ) == ( FCBasePart.POWERED_FLAG | FCBasePart.CHANNEL_FLAG );
|
||||
final boolean hasPower = ( this.getClientFlags() & FCBasePart.POWERED_FLAG ) == FCBasePart.POWERED_FLAG;
|
||||
final boolean hasChan = (this.getClientFlags() & (FCBasePart.POWERED_FLAG | FCBasePart.CHANNEL_FLAG))
|
||||
== (FCBasePart.POWERED_FLAG | FCBasePart.CHANNEL_FLAG);
|
||||
final boolean hasPower = (this.getClientFlags() & FCBasePart.POWERED_FLAG) == FCBasePart.POWERED_FLAG;
|
||||
|
||||
if( hasChan )
|
||||
{
|
||||
if (hasChan) {
|
||||
final int l = 14;
|
||||
Tessellator.instance.setBrightness( l << 20 | l << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( this.getColor().blackVariant );
|
||||
}
|
||||
else if( hasPower )
|
||||
{
|
||||
Tessellator.instance.setBrightness(l << 20 | l << 4);
|
||||
Tessellator.instance.setColorOpaque_I(this.getColor().blackVariant);
|
||||
} else if (hasPower) {
|
||||
final int l = 9;
|
||||
Tessellator.instance.setBrightness( l << 20 | l << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( this.getColor().whiteVariant );
|
||||
}
|
||||
else
|
||||
{
|
||||
Tessellator.instance.setBrightness( 0 );
|
||||
Tessellator.instance.setColorOpaque_I( 0x000000 );
|
||||
Tessellator.instance.setBrightness(l << 20 | l << 4);
|
||||
Tessellator.instance.setColorOpaque_I(this.getColor().whiteVariant);
|
||||
} else {
|
||||
Tessellator.instance.setBrightness(0);
|
||||
Tessellator.instance.setColorOpaque_I(0x000000);
|
||||
}
|
||||
|
||||
final IIcon sideStatusLightTexture = CableBusTextures.PartMonitorSidesStatusLights.getIcon();
|
||||
|
||||
rh.renderFace( x, y, z, sideStatusLightTexture, ForgeDirection.EAST, renderer );
|
||||
rh.renderFace( x, y, z, sideStatusLightTexture, ForgeDirection.WEST, renderer );
|
||||
rh.renderFace( x, y, z, sideStatusLightTexture, ForgeDirection.UP, renderer );
|
||||
rh.renderFace( x, y, z, sideStatusLightTexture, ForgeDirection.DOWN, renderer );
|
||||
rh.renderFace(x, y, z, sideStatusLightTexture, ForgeDirection.EAST, renderer);
|
||||
rh.renderFace(x, y, z, sideStatusLightTexture, ForgeDirection.WEST, renderer);
|
||||
rh.renderFace(x, y, z, sideStatusLightTexture, ForgeDirection.UP, renderer);
|
||||
rh.renderFace(x, y, z, sideStatusLightTexture, ForgeDirection.DOWN, renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -503,5 +458,4 @@ public abstract class FCBasePart extends AEBasePart implements IPowerChannelStat
|
||||
* light source 9.
|
||||
*/
|
||||
public abstract boolean isLightSource();
|
||||
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.FluidConvertingInventoryAdaptor;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -40,16 +39,15 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
public class PartFluidExportBus extends PartSharedFluidBus implements ICraftingRequester {
|
||||
|
||||
private final BaseActionSource source;
|
||||
private final MultiCraftingTracker craftingTracker = new MultiCraftingTracker( this, 9 );
|
||||
private final MultiCraftingTracker craftingTracker = new MultiCraftingTracker(this, 9);
|
||||
|
||||
public PartFluidExportBus( ItemStack is )
|
||||
{
|
||||
super( is );
|
||||
this.getConfigManager().registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
this.getConfigManager().registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
this.getConfigManager().registerSetting( Settings.CRAFT_ONLY, YesNo.NO );
|
||||
this.getConfigManager().registerSetting( Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT );
|
||||
this.source = new MachineSource( this );
|
||||
public PartFluidExportBus(ItemStack is) {
|
||||
super(is);
|
||||
this.getConfigManager().registerSetting(Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
|
||||
this.getConfigManager().registerSetting(Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL);
|
||||
this.getConfigManager().registerSetting(Settings.CRAFT_ONLY, YesNo.NO);
|
||||
this.getConfigManager().registerSetting(Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT);
|
||||
this.source = new MachineSource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,83 +56,87 @@ public class PartFluidExportBus extends PartSharedFluidBus implements ICraftingR
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest( IGridNode node )
|
||||
{
|
||||
return new TickingRequest( 5, 40, this.isSleeping(), false );
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
return new TickingRequest(5, 40, this.isSleeping(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall )
|
||||
{
|
||||
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
|
||||
return this.canDoBusWork() ? this.doBusWork() : TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDoBusWork()
|
||||
{
|
||||
protected boolean canDoBusWork() {
|
||||
return this.getProxy().isActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TickRateModulation doBusWork()
|
||||
{
|
||||
if( !this.canDoBusWork() )
|
||||
{
|
||||
protected TickRateModulation doBusWork() {
|
||||
if (!this.canDoBusWork()) {
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
final TileEntity te = this.getConnectedTE();
|
||||
|
||||
if(te instanceof IFluidHandler)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (te instanceof IFluidHandler) {
|
||||
try {
|
||||
final InventoryAdaptor destination = this.getHandler(te);
|
||||
final ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
final IFluidHandler fh = (IFluidHandler) te;
|
||||
final IMEMonitor<IAEFluidStack> inv = this.getProxy().getStorage().getFluidInventory();
|
||||
final IMEMonitor<IAEFluidStack> inv =
|
||||
this.getProxy().getStorage().getFluidInventory();
|
||||
|
||||
for( int i = 0; i < this.getInventoryByName("config").getSizeInventory(); i++ )
|
||||
{
|
||||
IAEFluidStack fluid = AEFluidStack.create(ItemFluidPacket.getFluidStack(this.getInventoryByName("config").getStackInSlot(i)));
|
||||
if( fluid != null )
|
||||
{
|
||||
for (int i = 0; i < this.getInventoryByName("config").getSizeInventory(); i++) {
|
||||
IAEFluidStack fluid = AEFluidStack.create(ItemFluidPacket.getFluidStack(
|
||||
this.getInventoryByName("config").getStackInSlot(i)));
|
||||
if (fluid != null) {
|
||||
boolean isAllowed = true;
|
||||
|
||||
final IAEFluidStack toExtract = fluid.copy();
|
||||
|
||||
toExtract.setStackSize( this.calculateAmountToSend() );
|
||||
toExtract.setStackSize(this.calculateAmountToSend());
|
||||
|
||||
if( this.craftOnly() )
|
||||
{
|
||||
isAllowed = this.craftingTracker.handleCrafting( i, toExtract.getStackSize(), ItemFluidDrop.newAeStack(toExtract), destination, this.getTile().getWorldObj(), this.getProxy().getGrid(), cg, this.source );
|
||||
if (this.craftOnly()) {
|
||||
isAllowed = this.craftingTracker.handleCrafting(
|
||||
i,
|
||||
toExtract.getStackSize(),
|
||||
ItemFluidDrop.newAeStack(toExtract),
|
||||
destination,
|
||||
this.getTile().getWorldObj(),
|
||||
this.getProxy().getGrid(),
|
||||
cg,
|
||||
this.source);
|
||||
}
|
||||
|
||||
final IAEFluidStack out = inv.extractItems( toExtract, Actionable.SIMULATE, this.source );
|
||||
final IAEFluidStack out = inv.extractItems(toExtract, Actionable.SIMULATE, this.source);
|
||||
|
||||
if( out != null && isAllowed )
|
||||
{
|
||||
int wasInserted = fh.fill( this.getSide().getOpposite(), out.getFluidStack(), true );
|
||||
if (out != null && isAllowed) {
|
||||
int wasInserted = fh.fill(this.getSide().getOpposite(), out.getFluidStack(), true);
|
||||
|
||||
if( wasInserted > 0 )
|
||||
{
|
||||
toExtract.setStackSize( wasInserted );
|
||||
inv.extractItems( toExtract, Actionable.MODULATE, this.source );
|
||||
if (wasInserted > 0) {
|
||||
toExtract.setStackSize(wasInserted);
|
||||
inv.extractItems(toExtract, Actionable.MODULATE, this.source);
|
||||
|
||||
return TickRateModulation.FASTER;
|
||||
}
|
||||
}
|
||||
|
||||
if( this.isCraftingEnabled() ) {
|
||||
this.craftingTracker.handleCrafting( i, toExtract.getStackSize(), ItemFluidDrop.newAeStack(toExtract), destination, this.getTile().getWorldObj(), this.getProxy().getGrid(), cg, this.source );
|
||||
if (this.isCraftingEnabled()) {
|
||||
this.craftingTracker.handleCrafting(
|
||||
i,
|
||||
toExtract.getStackSize(),
|
||||
ItemFluidDrop.newAeStack(toExtract),
|
||||
destination,
|
||||
this.getTile().getWorldObj(),
|
||||
this.getProxy().getGrid(),
|
||||
cg,
|
||||
this.source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TickRateModulation.SLOWER;
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
} catch (GridAccessException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
@@ -143,67 +145,81 @@ public class PartFluidExportBus extends PartSharedFluidBus implements ICraftingR
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes( final IPartCollisionHelper bch )
|
||||
{
|
||||
bch.addBox( 4, 4, 12, 12, 12, 14 );
|
||||
bch.addBox( 5, 5, 14, 11, 11, 15 );
|
||||
bch.addBox( 6, 6, 15, 10, 10, 16 );
|
||||
bch.addBox( 6, 6, 11, 10, 10, 12 );
|
||||
public void getBoxes(final IPartCollisionHelper bch) {
|
||||
bch.addBox(4, 4, 12, 12, 12, 14);
|
||||
bch.addBox(5, 5, 14, 11, 11, 15);
|
||||
bch.addBox(6, 6, 15, 10, 10, 16);
|
||||
bch.addBox(6, 6, 11, 10, 10, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer )
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.getFaceIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon());
|
||||
|
||||
rh.setBounds( 4, 4, 12, 12, 12, 14 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(4, 4, 12, 12, 12, 14);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds( 5, 5, 14, 11, 11, 15 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(5, 5, 14, 11, 11, 15);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds( 6, 6, 15, 10, 10, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(6, 6, 15, 10, 10, 16);
|
||||
rh.renderInventoryBox(renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( final int x, final int y, final int z, final IPartRenderHelper rh, final RenderBlocks renderer )
|
||||
{
|
||||
this.setRenderCache( rh.useSimplifiedRendering( x, y, z, this, this.getRenderCache() ) );
|
||||
rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.getFaceIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(
|
||||
final int x, final int y, final int z, final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
this.setRenderCache(rh.useSimplifiedRendering(x, y, z, this, this.getRenderCache()));
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon(),
|
||||
CableBusTextures.PartExportSides.getIcon());
|
||||
|
||||
rh.setBounds( 4, 4, 12, 12, 12, 14 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(4, 4, 12, 12, 12, 14);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setBounds( 5, 5, 14, 11, 11, 15 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(5, 5, 14, 11, 11, 15);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setBounds( 6, 6, 15, 10, 10, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(6, 6, 15, 10, 10, 16);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.getFaceIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon());
|
||||
|
||||
rh.setBounds( 6, 6, 11, 10, 10, 12 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(6, 6, 11, 10, 10, 12);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights(x, y, z, rh, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneMode getRSMode()
|
||||
{
|
||||
return (RedstoneMode) this.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
public RedstoneMode getRSMode() {
|
||||
return (RedstoneMode) this.getConfigManager().getSetting(Settings.REDSTONE_CONTROLLED);
|
||||
}
|
||||
|
||||
private boolean craftOnly() {
|
||||
return this.getConfigManager().getSetting(Settings.CRAFT_ONLY) == YesNo.YES;
|
||||
}
|
||||
|
||||
private boolean isCraftingEnabled()
|
||||
{
|
||||
return this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0;
|
||||
private boolean isCraftingEnabled() {
|
||||
return this.getInstalledUpgrades(Upgrades.CRAFTING) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,42 +228,37 @@ public class PartFluidExportBus extends PartSharedFluidBus implements ICraftingR
|
||||
}
|
||||
|
||||
protected InventoryAdaptor getHandler(TileEntity target) {
|
||||
return target != null ? FluidConvertingInventoryAdaptor.wrap(target, Util.from(this.getSide().getOpposite())) : null;
|
||||
return target != null
|
||||
? FluidConvertingInventoryAdaptor.wrap(
|
||||
target, Util.from(this.getSide().getOpposite()))
|
||||
: null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) {
|
||||
final InventoryAdaptor d = this.getHandler(getConnectedTE());
|
||||
|
||||
try
|
||||
{
|
||||
if( d != null && this.getProxy().isActive() )
|
||||
{
|
||||
try {
|
||||
if (d != null && this.getProxy().isActive()) {
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final double power = Math.ceil(items.getStackSize() / 1000D);
|
||||
|
||||
if( energy.extractAEPower( power, mode, PowerMultiplier.CONFIG ) > power - 0.01 )
|
||||
{
|
||||
if (energy.extractAEPower(power, mode, PowerMultiplier.CONFIG) > power - 0.01) {
|
||||
ItemStack inputStack = items.getItemStack();
|
||||
|
||||
ItemStack remaining;
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
remaining = d.simulateAdd( inputStack );
|
||||
}
|
||||
else
|
||||
{
|
||||
remaining = d.addItems( inputStack );
|
||||
if (mode == Actionable.SIMULATE) {
|
||||
remaining = d.simulateAdd(inputStack);
|
||||
} else {
|
||||
remaining = d.addItems(inputStack);
|
||||
}
|
||||
|
||||
return AEItemStack.create( remaining );
|
||||
return AEItemStack.create(remaining);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
} catch (final GridAccessException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
|
||||
return items;
|
||||
@@ -255,6 +266,6 @@ public class PartFluidExportBus extends PartSharedFluidBus implements ICraftingR
|
||||
|
||||
@Override
|
||||
public void jobStateChange(ICraftingLink link) {
|
||||
this.craftingTracker.jobStateChange( link );
|
||||
this.craftingTracker.jobStateChange(link);
|
||||
}
|
||||
}
|
||||
@@ -29,14 +29,13 @@ public class PartFluidImportBus extends PartSharedFluidBus {
|
||||
|
||||
private final BaseActionSource source;
|
||||
|
||||
public PartFluidImportBus( ItemStack is )
|
||||
{
|
||||
super( is );
|
||||
this.getConfigManager().registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
this.getConfigManager().registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
this.getConfigManager().registerSetting( Settings.CRAFT_ONLY, YesNo.NO );
|
||||
this.getConfigManager().registerSetting( Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT );
|
||||
this.source = new MachineSource( this );
|
||||
public PartFluidImportBus(ItemStack is) {
|
||||
super(is);
|
||||
this.getConfigManager().registerSetting(Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
|
||||
this.getConfigManager().registerSetting(Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL);
|
||||
this.getConfigManager().registerSetting(Settings.CRAFT_ONLY, YesNo.NO);
|
||||
this.getConfigManager().registerSetting(Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT);
|
||||
this.source = new MachineSource(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,33 +44,28 @@ public class PartFluidImportBus extends PartSharedFluidBus {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest( IGridNode node )
|
||||
{
|
||||
return new TickingRequest( 5, 40, this.isSleeping(), false );
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
return new TickingRequest(5, 40, this.isSleeping(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall )
|
||||
{
|
||||
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
|
||||
return this.canDoBusWork() ? this.doBusWork() : TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TickRateModulation doBusWork()
|
||||
{
|
||||
if( !this.canDoBusWork() )
|
||||
{
|
||||
protected TickRateModulation doBusWork() {
|
||||
if (!this.canDoBusWork()) {
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
|
||||
final TileEntity te = this.getConnectedTE();
|
||||
|
||||
if(te instanceof IFluidHandler)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (te instanceof IFluidHandler) {
|
||||
try {
|
||||
final IFluidHandler fh = (IFluidHandler) te;
|
||||
final IMEMonitor<IAEFluidStack> inv = this.getProxy().getStorage().getFluidInventory();
|
||||
final IMEMonitor<IAEFluidStack> inv =
|
||||
this.getProxy().getStorage().getFluidInventory();
|
||||
|
||||
int maxDrain = this.calculateAmountToSend();
|
||||
boolean drained = false;
|
||||
@@ -89,7 +83,8 @@ public class PartFluidImportBus extends PartSharedFluidBus {
|
||||
|
||||
final AEFluidStack aeFluidStack = AEFluidStack.create(fluidStack);
|
||||
if (aeFluidStack != null) {
|
||||
final IAEFluidStack notInserted = inv.injectItems(aeFluidStack, Actionable.MODULATE, this.source);
|
||||
final IAEFluidStack notInserted =
|
||||
inv.injectItems(aeFluidStack, Actionable.MODULATE, this.source);
|
||||
|
||||
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||
aeFluidStack.decStackSize(notInserted.getStackSize());
|
||||
@@ -102,9 +97,7 @@ public class PartFluidImportBus extends PartSharedFluidBus {
|
||||
}
|
||||
|
||||
return drained ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
catch(GridAccessException e )
|
||||
{
|
||||
} catch (GridAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -113,31 +106,26 @@ public class PartFluidImportBus extends PartSharedFluidBus {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDoBusWork()
|
||||
{
|
||||
protected boolean canDoBusWork() {
|
||||
return this.getProxy().isActive();
|
||||
}
|
||||
|
||||
private boolean isInFilter( FluidStack fluid )
|
||||
{
|
||||
for( int i = 0; i < this.getInventoryByName("config").getSizeInventory(); i++ )
|
||||
{
|
||||
final IAEFluidStack stack = AEFluidStack.create(ItemFluidPacket.getFluidStack(this.getInventoryByName("config").getStackInSlot(i)));
|
||||
if( stack != null && stack.getFluidStack().equals( fluid ) )
|
||||
{
|
||||
private boolean isInFilter(FluidStack fluid) {
|
||||
for (int i = 0; i < this.getInventoryByName("config").getSizeInventory(); i++) {
|
||||
final IAEFluidStack stack = AEFluidStack.create(ItemFluidPacket.getFluidStack(
|
||||
this.getInventoryByName("config").getStackInSlot(i)));
|
||||
if (stack != null && stack.getFluidStack().equals(fluid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean filterEnabled()
|
||||
{
|
||||
for( int i = 0; i < this.getInventoryByName("config").getSizeInventory(); i++ )
|
||||
{
|
||||
final IAEFluidStack stack = AEFluidStack.create(ItemFluidPacket.getFluidStack(this.getInventoryByName("config").getStackInSlot(i)));
|
||||
if( stack != null )
|
||||
{
|
||||
private boolean filterEnabled() {
|
||||
for (int i = 0; i < this.getInventoryByName("config").getSizeInventory(); i++) {
|
||||
final IAEFluidStack stack = AEFluidStack.create(ItemFluidPacket.getFluidStack(
|
||||
this.getInventoryByName("config").getStackInSlot(i)));
|
||||
if (stack != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -145,56 +133,70 @@ public class PartFluidImportBus extends PartSharedFluidBus {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneMode getRSMode()
|
||||
{
|
||||
return (RedstoneMode) this.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
public RedstoneMode getRSMode() {
|
||||
return (RedstoneMode) this.getConfigManager().getSetting(Settings.REDSTONE_CONTROLLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes( final IPartCollisionHelper bch )
|
||||
{
|
||||
bch.addBox( 6, 6, 11, 10, 10, 13 );
|
||||
bch.addBox( 5, 5, 13, 11, 11, 14 );
|
||||
bch.addBox( 4, 4, 14, 12, 12, 16 );
|
||||
public void getBoxes(final IPartCollisionHelper bch) {
|
||||
bch.addBox(6, 6, 11, 10, 10, 13);
|
||||
bch.addBox(5, 5, 13, 11, 11, 14);
|
||||
bch.addBox(4, 4, 14, 12, 12, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer )
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.getFaceIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon());
|
||||
|
||||
rh.setBounds( 3, 3, 15, 13, 13, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(3, 3, 15, 13, 13, 16);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds( 4, 4, 14, 12, 12, 15 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(4, 4, 14, 12, 12, 15);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds( 5, 5, 13, 11, 11, 14 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(5, 5, 13, 11, 11, 14);
|
||||
rh.renderInventoryBox(renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( final int x, final int y, final int z, final IPartRenderHelper rh, final RenderBlocks renderer )
|
||||
{
|
||||
this.setRenderCache( rh.useSimplifiedRendering( x, y, z, this, this.getRenderCache() ) );
|
||||
rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.getFaceIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(
|
||||
final int x, final int y, final int z, final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
this.setRenderCache(rh.useSimplifiedRendering(x, y, z, this, this.getRenderCache()));
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon(),
|
||||
CableBusTextures.PartImportSides.getIcon());
|
||||
|
||||
rh.setBounds( 4, 4, 14, 12, 12, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(4, 4, 14, 12, 12, 16);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setBounds( 5, 5, 13, 11, 11, 14 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(5, 5, 13, 11, 11, 14);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setBounds( 6, 6, 12, 10, 10, 13 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.getFaceIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
rh.setBounds(6, 6, 12, 10, 10, 13);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
this.getFaceIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon());
|
||||
|
||||
rh.setBounds( 6, 6, 11, 10, 10, 12 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(6, 6, 11, 10, 10, 12);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights(x, y, z, rh, renderer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,6 +35,8 @@ import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -46,13 +48,10 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PartFluidInterface extends PartInterface implements IFluidHandler, IAEFluidInventory {
|
||||
|
||||
private final BaseActionSource ownActionSource = new MachineSource(this);
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 6 );
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
|
||||
private final DualityFluidInterface fluidDuality = new DualityFluidInterface(this.getProxy(), this);
|
||||
|
||||
public PartFluidInterface(ItemStack is) {
|
||||
@@ -60,42 +59,65 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic(final int x, final int y, final int z, final IPartRenderHelper rh, final RenderBlocks renderer )
|
||||
{
|
||||
this.setRenderCache( rh.useSimplifiedRendering( x, y, z, this, this.getRenderCache() ) );
|
||||
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), FCPartsTexture.BlockInterface_Face.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(
|
||||
final int x, final int y, final int z, final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
this.setRenderCache(rh.useSimplifiedRendering(x, y, z, this, this.getRenderCache()));
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartMonitorSides.getIcon(),
|
||||
CableBusTextures.PartMonitorSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
FCPartsTexture.BlockInterface_Face.getIcon(),
|
||||
CableBusTextures.PartMonitorSides.getIcon(),
|
||||
CableBusTextures.PartMonitorSides.getIcon());
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(2, 2, 14, 14, 14, 16);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), FCPartsTexture.BlockInterface_Face.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartMonitorSides.getIcon(),
|
||||
CableBusTextures.PartMonitorSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
FCPartsTexture.BlockInterface_Face.getIcon(),
|
||||
CableBusTextures.PartMonitorSides.getIcon(),
|
||||
CableBusTextures.PartMonitorSides.getIcon());
|
||||
|
||||
rh.setBounds( 5, 5, 12, 11, 11, 13 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(5, 5, 12, 11, 11, 13);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), FCPartsTexture.BlockInterface_Face.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
FCPartsTexture.BlockInterface_Face.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon());
|
||||
|
||||
rh.setBounds( 5, 5, 13, 11, 11, 14 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setBounds(5, 5, 13, 11, 11, 14);
|
||||
rh.renderBlock(x, y, z, renderer);
|
||||
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights(x, y, z, rh, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( final IPartRenderHelper rh, final RenderBlocks renderer )
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), FCPartsTexture.BlockInterface_Face.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(final IPartRenderHelper rh, final RenderBlocks renderer) {
|
||||
rh.setTexture(
|
||||
CableBusTextures.PartMonitorSides.getIcon(),
|
||||
CableBusTextures.PartMonitorSides.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(),
|
||||
FCPartsTexture.BlockInterface_Face.getIcon(),
|
||||
CableBusTextures.PartMonitorSides.getIcon(),
|
||||
CableBusTextures.PartMonitorSides.getIcon());
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(2, 2, 14, 14, 14, 16);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds( 5, 5, 12, 11, 11, 13 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(5, 5, 12, 11, 11, 13);
|
||||
rh.renderInventoryBox(renderer);
|
||||
|
||||
rh.setBounds( 5, 5, 13, 11, 11, 14 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setBounds(5, 5, 13, 11, 11, 14);
|
||||
rh.renderInventoryBox(renderer);
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -123,12 +145,11 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory getConfig() {
|
||||
for (int i = 0; i < fluidDuality.getConfig().getSlots(); i ++) {
|
||||
for (int i = 0; i < fluidDuality.getConfig().getSlots(); i++) {
|
||||
IAEFluidStack fluid = fluidDuality.getConfig().getFluidInSlot(i);
|
||||
if (fluid == null) {
|
||||
config.setInventorySlotContents(i, null);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
config.setInventorySlotContents(i, ItemFluidPacket.newDisplayStack(fluid.getFluidStack()));
|
||||
}
|
||||
}
|
||||
@@ -140,7 +161,7 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
super.writeToStream(data);
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
ByteBufUtils.writeItemStack(data, config.getStackInSlot(i));
|
||||
for (int j = 0; j < config.getSizeInventory(); j ++) {
|
||||
for (int j = 0; j < config.getSizeInventory(); j++) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(config.getStackInSlot(j));
|
||||
fluidDuality.getConfig().setFluidInSlot(j, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
@@ -170,7 +191,7 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
config.setInventorySlotContents(i, stack);
|
||||
changed = true;
|
||||
}
|
||||
for (int j = 0; j < config.getSizeInventory(); j ++) {
|
||||
for (int j = 0; j < config.getSizeInventory(); j++) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(config.getStackInSlot(j));
|
||||
fluidDuality.getConfig().setFluidInSlot(j, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
@@ -195,10 +216,10 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( NBTTagCompound data ) {
|
||||
super.readFromNBT( data );
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
config.readFromNBT(data, "ConfigInv");
|
||||
for (int i = 0; i < config.getSizeInventory(); i ++) {
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(config.getStackInSlot(i));
|
||||
fluidDuality.getConfig().setFluidInSlot(i, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
@@ -206,21 +227,23 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( NBTTagCompound data ) {
|
||||
public void writeToNBT(NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
config.writeToNBT(data, "ConfigInv");
|
||||
getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades( final Upgrades u )
|
||||
{
|
||||
return getInterfaceDuality().getInstalledUpgrades( u );
|
||||
public int getInstalledUpgrades(final Upgrades u) {
|
||||
return getInterfaceDuality().getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
private IMEMonitor<IAEFluidStack> getFluidGrid() {
|
||||
try {
|
||||
return getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
return getProxy()
|
||||
.getGrid()
|
||||
.<IStorageGrid>getCache(IStorageGrid.class)
|
||||
.getFluidInventory();
|
||||
} catch (GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
@@ -238,8 +261,7 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
|
||||
IEnergyGrid energyGrid = getEnergyGrid();
|
||||
if (energyGrid == null || fluidGrid == null || resource == null)
|
||||
return 0;
|
||||
if (energyGrid == null || fluidGrid == null || resource == null) return 0;
|
||||
int ori = resource.amount;
|
||||
IAEFluidStack remove;
|
||||
if (doFill) {
|
||||
@@ -276,15 +298,17 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos)
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
InventoryHandler.openGui(player, this.getHost().getTile().getWorldObj(), new BlockPos(this.getHost().getTile()), Objects.requireNonNull(Util.from(this.getSide())), GuiType.DUAL_INTERFACE_PART);
|
||||
if (Platform.isServer()) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
this.getHost().getTile().getWorldObj(),
|
||||
new BlockPos(this.getHost().getTile()),
|
||||
Objects.requireNonNull(Util.from(this.getSide())),
|
||||
GuiType.DUAL_INTERFACE_PART);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -298,7 +322,8 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
|
||||
public void setConfig(int id, IAEFluidStack fluid) {
|
||||
if (id >= 0 && id < 6) {
|
||||
config.setInventorySlotContents(id, ItemFluidPacket.newDisplayStack(fluid == null ? null : fluid.getFluidStack()));
|
||||
config.setInventorySlotContents(
|
||||
id, ItemFluidPacket.newDisplayStack(fluid == null ? null : fluid.getFluidStack()));
|
||||
fluidDuality.getConfig().setFluidInSlot(id, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
}
|
||||
@@ -310,15 +335,14 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest( final IGridNode node )
|
||||
{
|
||||
public TickingRequest getTickingRequest(final IGridNode node) {
|
||||
TickingRequest item = super.getTickingRequest(node);
|
||||
TickingRequest fluid = fluidDuality.getTickingRequest(node);
|
||||
return new TickingRequest(
|
||||
Math.min(item.minTickRate, fluid.minTickRate),
|
||||
Math.max(item.maxTickRate, fluid.maxTickRate),
|
||||
item.isSleeping && fluid.isSleeping,
|
||||
true);
|
||||
Math.min(item.minTickRate, fluid.minTickRate),
|
||||
Math.max(item.maxTickRate, fluid.maxTickRate),
|
||||
item.isSleeping && fluid.isSleeping,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -331,5 +355,4 @@ public class PartFluidInterface extends PartInterface implements IFluidHandler,
|
||||
return fluid;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,6 +17,8 @@ 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 java.util.List;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,18 +27,15 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PartFluidPatternTerminal extends FCBasePart {
|
||||
|
||||
private static final FCPartsTexture FRONT_BRIGHT_ICON = FCPartsTexture.PartFluidPatternTerminal_Bright;
|
||||
private static final FCPartsTexture FRONT_DARK_ICON = FCPartsTexture.PartFluidPatternTerminal_Colored;
|
||||
private static final FCPartsTexture FRONT_COLORED_ICON = FCPartsTexture.PartFluidPatternTerminal_Dark;
|
||||
|
||||
private final AppEngInternalInventory crafting = new BiggerAppEngInventory( this, 9 );
|
||||
private final AppEngInternalInventory output = new BiggerAppEngInventory( this, 3 );
|
||||
private final AppEngInternalInventory pattern = new AppEngInternalInventory( this, 2 );
|
||||
private final AppEngInternalInventory crafting = new BiggerAppEngInventory(this, 9);
|
||||
private final AppEngInternalInventory output = new BiggerAppEngInventory(this, 3);
|
||||
private final AppEngInternalInventory pattern = new AppEngInternalInventory(this, 2);
|
||||
|
||||
private boolean craftingMode = true;
|
||||
private boolean substitute = false;
|
||||
@@ -48,29 +47,31 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched )
|
||||
{
|
||||
for( final ItemStack is : this.pattern )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
drops.add( is );
|
||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
||||
for (final ItemStack is : this.pattern) {
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate( final EntityPlayer player, final Vec3 pos ) {
|
||||
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_PATTERN_TERMINAL);
|
||||
}
|
||||
else {
|
||||
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_PATTERN_TERMINAL);
|
||||
} else {
|
||||
player.addChatComponentMessage(new ChatComponentText("You don't have permission to view."));
|
||||
}
|
||||
}
|
||||
@@ -78,69 +79,69 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
this.setCraftingRecipe( data.getBoolean( "craftingMode" ) );
|
||||
this.setSubstitution( data.getBoolean( "substitute" ) );
|
||||
public void readFromNBT(final NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
this.setCraftingRecipe(data.getBoolean("craftingMode"));
|
||||
this.setSubstitution(data.getBoolean("substitute"));
|
||||
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" );
|
||||
this.output.readFromNBT(data, "outputList");
|
||||
this.crafting.readFromNBT(data, "craftingGrid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
data.setBoolean( "craftingMode", this.craftingMode );
|
||||
data.setBoolean( "substitute", this.substitute );
|
||||
public void writeToNBT(final NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
data.setBoolean("craftingMode", this.craftingMode);
|
||||
data.setBoolean("substitute", this.substitute);
|
||||
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" );
|
||||
this.output.writeToNBT(data, "outputList");
|
||||
this.crafting.writeToNBT(data, "craftingGrid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiBridge getGui(final EntityPlayer p )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
if (this.getHost().getTile() != null) {
|
||||
x = this.getTile().xCoord;
|
||||
y = this.getTile().yCoord;
|
||||
z = this.getTile().zCoord;
|
||||
}
|
||||
|
||||
if( GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) )
|
||||
{
|
||||
if (GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions(this.getHost().getTile(), x, y, z, this.getSide(), p)) {
|
||||
return GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
}
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
{
|
||||
public void onChangeInventory(
|
||||
final IInventory inv,
|
||||
final int slot,
|
||||
final InvOperation mc,
|
||||
final ItemStack removedStack,
|
||||
final ItemStack newStack) {
|
||||
if (inv == this.pattern && slot == 1) {
|
||||
final ItemStack is = inv.getStackInSlot(1);
|
||||
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
|
||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern.getPatternForItem(is, this.getHost().getTile().getWorldObj());
|
||||
final ICraftingPatternDetails details =
|
||||
pattern.getPatternForItem(is, this.getHost().getTile().getWorldObj());
|
||||
if (details != null) {
|
||||
final IAEItemStack[] inItems = details.getInputs();
|
||||
final IAEItemStack[] outItems = details.getOutputs();
|
||||
|
||||
this.setCraftingRecipe(details.isCraftable());
|
||||
this.setSubstitution(details.canSubstitute());
|
||||
if(newStack != null){
|
||||
if (newStack != null) {
|
||||
NBTTagCompound data = newStack.getTagCompound();
|
||||
this.setCombineMode(data.getInteger("combine") == 1);
|
||||
// this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
// this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
}
|
||||
for (int i = 0; i < this.crafting.getSizeInventory(); i++) {
|
||||
this.crafting.setInventorySlotContents(i, null);
|
||||
@@ -154,10 +155,10 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
if (inItems[i] != null) {
|
||||
final IAEItemStack item = inItems[i];
|
||||
if (item != null && item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
ItemStack packet =
|
||||
ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.crafting.setInventorySlotContents(i, packet);
|
||||
} else
|
||||
this.crafting.setInventorySlotContents(i, item == null ? null : item.getItemStack());
|
||||
} else this.crafting.setInventorySlotContents(i, item == null ? null : item.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,10 +166,10 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
if (outItems[i] != null) {
|
||||
final IAEItemStack item = outItems[i];
|
||||
if (item != null && item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
ItemStack packet =
|
||||
ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.output.setInventorySlotContents(i, packet);
|
||||
} else
|
||||
this.output.setInventorySlotContents(i, item == null ? null : item.getItemStack());
|
||||
} else this.output.setInventorySlotContents(i, item == null ? null : item.getItemStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,39 +178,31 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
this.getHost().markForSave();
|
||||
}
|
||||
|
||||
private void fixCraftingRecipes()
|
||||
{
|
||||
if( this.craftingMode )
|
||||
{
|
||||
for( int x = 0; x < this.crafting.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack is = this.crafting.getStackInSlot( x );
|
||||
if( is != null )
|
||||
{
|
||||
private void fixCraftingRecipes() {
|
||||
if (this.craftingMode) {
|
||||
for (int x = 0; x < this.crafting.getSizeInventory(); x++) {
|
||||
final ItemStack is = this.crafting.getStackInSlot(x);
|
||||
if (is != null) {
|
||||
is.stackSize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCraftingRecipe()
|
||||
{
|
||||
public boolean isCraftingRecipe() {
|
||||
return this.craftingMode;
|
||||
}
|
||||
|
||||
public void setCraftingRecipe( final boolean craftingMode )
|
||||
{
|
||||
public void setCraftingRecipe(final boolean craftingMode) {
|
||||
this.craftingMode = craftingMode;
|
||||
this.fixCraftingRecipes();
|
||||
}
|
||||
|
||||
public boolean isSubstitution()
|
||||
{
|
||||
public boolean isSubstitution() {
|
||||
return this.substitute;
|
||||
}
|
||||
|
||||
public boolean shouldCombine()
|
||||
{
|
||||
public boolean shouldCombine() {
|
||||
return this.combine;
|
||||
}
|
||||
|
||||
@@ -245,24 +238,20 @@ public class PartFluidPatternTerminal extends FCBasePart {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName( final String name )
|
||||
{
|
||||
if( name.equals( "crafting" ) )
|
||||
{
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
if (name.equals("crafting")) {
|
||||
return this.crafting;
|
||||
}
|
||||
|
||||
if( name.equals( "output" ) )
|
||||
{
|
||||
if (name.equals("output")) {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
if( name.equals( "pattern" ) )
|
||||
{
|
||||
if (name.equals("pattern")) {
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
return super.getInventoryByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,8 @@ 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 java.util.List;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,18 +27,15 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
|
||||
private static final FCPartsTexture FRONT_BRIGHT_ICON = FCPartsTexture.PartFluidPatternTerminal_Bright;
|
||||
private static final FCPartsTexture FRONT_DARK_ICON = FCPartsTexture.PartFluidPatternTerminal_Colored;
|
||||
private static final FCPartsTexture FRONT_COLORED_ICON = FCPartsTexture.PartFluidPatternTerminal_Dark;
|
||||
|
||||
private final AppEngInternalInventory crafting = new BiggerAppEngInventory( this, 32 );
|
||||
private final AppEngInternalInventory output = new BiggerAppEngInventory( this, 32 );
|
||||
private final AppEngInternalInventory pattern = new AppEngInternalInventory( this, 2 );
|
||||
private final AppEngInternalInventory crafting = new BiggerAppEngInventory(this, 32);
|
||||
private final AppEngInternalInventory output = new BiggerAppEngInventory(this, 32);
|
||||
private final AppEngInternalInventory pattern = new AppEngInternalInventory(this, 2);
|
||||
|
||||
private boolean substitute = false;
|
||||
private boolean combine = false;
|
||||
@@ -50,29 +49,31 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched )
|
||||
{
|
||||
for( final ItemStack is : this.pattern )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
drops.add( is );
|
||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
||||
for (final ItemStack is : this.pattern) {
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos ) {
|
||||
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_PATTERN_TERMINAL_EX);
|
||||
}
|
||||
else {
|
||||
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_PATTERN_TERMINAL_EX);
|
||||
} else {
|
||||
player.addChatComponentMessage(new ChatComponentText("You don't have permission to view."));
|
||||
}
|
||||
}
|
||||
@@ -80,68 +81,68 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
public void readFromNBT(final NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
|
||||
this.setSubstitution( data.getBoolean( "substitute" ) );
|
||||
this.setCombineMode( data.getBoolean("combine") );
|
||||
this.pattern.readFromNBT( data, "pattern" );
|
||||
this.output.readFromNBT( data, "outputList" );
|
||||
this.setSubstitution(data.getBoolean("substitute"));
|
||||
this.setCombineMode(data.getBoolean("combine"));
|
||||
this.pattern.readFromNBT(data, "pattern");
|
||||
this.output.readFromNBT(data, "outputList");
|
||||
this.crafting.readFromNBT(data, "craftingGrid");
|
||||
this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
this.setSubstitution(data.getBoolean("substitute"));
|
||||
this.setPrioritization( data.getBoolean( "priorization") );
|
||||
this.setInverted( data.getBoolean( "inverted" ) );
|
||||
this.setActivePage( data.getInteger( "activePage" ) );
|
||||
this.setPrioritization(data.getBoolean("priorization"));
|
||||
this.setInverted(data.getBoolean("inverted"));
|
||||
this.setActivePage(data.getInteger("activePage"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( final NBTTagCompound data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
public void writeToNBT(final NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
|
||||
data.setBoolean( "substitute", this.substitute );
|
||||
data.setBoolean( "combine", this.combine );
|
||||
this.pattern.writeToNBT( data, "pattern" );
|
||||
this.output.writeToNBT( data, "outputList" );
|
||||
data.setBoolean("substitute", this.substitute);
|
||||
data.setBoolean("combine", this.combine);
|
||||
this.pattern.writeToNBT(data, "pattern");
|
||||
this.output.writeToNBT(data, "outputList");
|
||||
this.crafting.writeToNBT(data, "craftingGrid");
|
||||
data.setBoolean("beSubstitute", this.beSubstitute);
|
||||
data.setBoolean("priorization", this.prioritize);
|
||||
data.setBoolean( "substitute", this.substitute );
|
||||
data.setBoolean( "inverted", this.inverted );
|
||||
data.setInteger( "activePage", this.activePage );
|
||||
data.setBoolean("substitute", this.substitute);
|
||||
data.setBoolean("inverted", this.inverted);
|
||||
data.setInteger("activePage", this.activePage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiBridge getGui(final EntityPlayer p )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
if (this.getHost().getTile() != null) {
|
||||
x = this.getTile().xCoord;
|
||||
y = this.getTile().yCoord;
|
||||
z = this.getTile().zCoord;
|
||||
}
|
||||
|
||||
if( GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) )
|
||||
{
|
||||
if (GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions(this.getHost().getTile(), x, y, z, this.getSide(), p)) {
|
||||
return GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
}
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
{
|
||||
public void onChangeInventory(
|
||||
final IInventory inv,
|
||||
final int slot,
|
||||
final InvOperation mc,
|
||||
final ItemStack removedStack,
|
||||
final ItemStack newStack) {
|
||||
if (inv == this.pattern && slot == 1) {
|
||||
final ItemStack is = inv.getStackInSlot(1);
|
||||
|
||||
if (is != null && is.getItem() instanceof ICraftingPatternItem) {
|
||||
final ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
|
||||
final ICraftingPatternDetails details = pattern.getPatternForItem(is, this.getHost().getTile().getWorldObj());
|
||||
final ICraftingPatternDetails details =
|
||||
pattern.getPatternForItem(is, this.getHost().getTile().getWorldObj());
|
||||
|
||||
if (details != null) {
|
||||
final IAEItemStack[] inItems = details.getInputs();
|
||||
@@ -162,10 +163,10 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
}
|
||||
|
||||
this.setSubstitution(details.canSubstitute());
|
||||
if(newStack != null){
|
||||
if (newStack != null) {
|
||||
NBTTagCompound data = newStack.getTagCompound();
|
||||
this.setCombineMode(data.getInteger("combine") == 1);
|
||||
// this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
// this.setBeSubstitute(data.getBoolean("beSubstitute"));
|
||||
}
|
||||
this.setInverted(inputsCount <= 8 && outputCount > 8);
|
||||
this.setActivePage(0);
|
||||
@@ -182,7 +183,8 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
final IAEItemStack item = inItems[i];
|
||||
if (item != null) {
|
||||
if (item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
ItemStack packet =
|
||||
ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.crafting.setInventorySlotContents(i, packet);
|
||||
} else this.crafting.setInventorySlotContents(i, item.getItemStack());
|
||||
}
|
||||
@@ -193,7 +195,8 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
final IAEItemStack item = outItems[i];
|
||||
if (item != null) {
|
||||
if (item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
ItemStack packet =
|
||||
ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.output.setInventorySlotContents(i, packet);
|
||||
} else this.output.setInventorySlotContents(i, item.getItemStack());
|
||||
}
|
||||
@@ -203,10 +206,10 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
final IAEItemStack item = outItems[i];
|
||||
if (item != null) {
|
||||
if (item.getItem() instanceof ItemFluidDrop) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
ItemStack packet =
|
||||
ItemFluidPacket.newStack(ItemFluidDrop.getFluidStack(item.getItemStack()));
|
||||
this.output.setInventorySlotContents(i >= 4 ? 12 + i : i, packet);
|
||||
} else
|
||||
this.output.setInventorySlotContents(i >= 4 ? 12 + i : i, item.getItemStack());
|
||||
} else this.output.setInventorySlotContents(i >= 4 ? 12 + i : i, item.getItemStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,13 +219,11 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
this.getHost().markForSave();
|
||||
}
|
||||
|
||||
public boolean shouldCombine()
|
||||
{
|
||||
public boolean shouldCombine() {
|
||||
return this.combine;
|
||||
}
|
||||
|
||||
public void setCombineMode(boolean shouldCombine)
|
||||
{
|
||||
public void setCombineMode(boolean shouldCombine) {
|
||||
this.combine = shouldCombine;
|
||||
}
|
||||
|
||||
@@ -256,7 +257,7 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
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];
|
||||
@@ -266,24 +267,20 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName( final String name )
|
||||
{
|
||||
if( name.equals( "crafting" ) )
|
||||
{
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
if (name.equals("crafting")) {
|
||||
return this.crafting;
|
||||
}
|
||||
|
||||
if( name.equals( "output" ) )
|
||||
{
|
||||
if (name.equals("output")) {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
if( name.equals( "pattern" ) )
|
||||
{
|
||||
if (name.equals("pattern")) {
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
return super.getInventoryByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -321,5 +318,4 @@ public class PartFluidPatternTerminalEx extends FCBasePart {
|
||||
public void setActivePage(int activePage) {
|
||||
this.activePage = activePage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,14 +9,13 @@ 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 java.util.Objects;
|
||||
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;
|
||||
@@ -59,8 +58,14 @@ public class PartFluidTerminal extends FCBasePart {
|
||||
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);
|
||||
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."));
|
||||
}
|
||||
@@ -84,5 +89,4 @@ public class PartFluidTerminal extends FCBasePart {
|
||||
}
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ 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 java.util.Objects;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,96 +26,79 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Objects;
|
||||
public abstract class PartSharedFluidBus extends PartUpgradeable implements IGridTickable {
|
||||
|
||||
public abstract class PartSharedFluidBus extends PartUpgradeable implements IGridTickable
|
||||
{
|
||||
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 9 );
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 9);
|
||||
private boolean lastRedstone;
|
||||
|
||||
public PartSharedFluidBus( ItemStack is )
|
||||
{
|
||||
super( is );
|
||||
public PartSharedFluidBus(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
public abstract IIcon getFaceIcon();
|
||||
|
||||
@Override
|
||||
public void upgradesChanged()
|
||||
{
|
||||
public void upgradesChanged() {
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
public void onNeighborChanged() {
|
||||
this.updateState();
|
||||
if( this.lastRedstone != this.getHost().hasRedstone( this.getSide() ) )
|
||||
{
|
||||
if (this.lastRedstone != this.getHost().hasRedstone(this.getSide())) {
|
||||
this.lastRedstone = !this.lastRedstone;
|
||||
if( this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE )
|
||||
{
|
||||
if (this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE) {
|
||||
this.doBusWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
try
|
||||
{
|
||||
if( !this.isSleeping() )
|
||||
{
|
||||
this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
|
||||
private void updateState() {
|
||||
try {
|
||||
if (!this.isSleeping()) {
|
||||
this.getProxy().getTick().wakeDevice(this.getProxy().getNode());
|
||||
} else {
|
||||
this.getProxy().getTick().sleepDevice(this.getProxy().getNode());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.getProxy().getTick().sleepDevice( this.getProxy().getNode() );
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos)
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos) {
|
||||
if (player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
InventoryHandler.openGui(player, this.getHost().getTile().getWorldObj(), new BlockPos(this.getHost().getTile()), Objects.requireNonNull(Util.from(this.getSide())), GuiType.FLUID_BUS_IO);
|
||||
if (Platform.isServer()) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
this.getHost().getTile().getWorldObj(),
|
||||
new BlockPos(this.getHost().getTile()),
|
||||
Objects.requireNonNull(Util.from(this.getSide())),
|
||||
GuiType.FLUID_BUS_IO);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes( IPartCollisionHelper bch )
|
||||
{
|
||||
bch.addBox( 6, 6, 11, 10, 10, 13 );
|
||||
bch.addBox( 5, 5, 13, 11, 11, 14 );
|
||||
bch.addBox( 4, 4, 14, 12, 12, 16 );
|
||||
public void getBoxes(IPartCollisionHelper bch) {
|
||||
bch.addBox(6, 6, 11, 10, 10, 13);
|
||||
bch.addBox(5, 5, 13, 11, 11, 14);
|
||||
bch.addBox(4, 4, 14, 12, 12, 16);
|
||||
}
|
||||
|
||||
protected TileEntity getConnectedTE()
|
||||
{
|
||||
protected TileEntity getConnectedTE() {
|
||||
TileEntity self = this.getHost().getTile();
|
||||
return this.getTileEntity( self, (new BlockPos(self)).getOffSet( this.getSide() ) );
|
||||
return this.getTileEntity(self, (new BlockPos(self)).getOffSet(this.getSide()));
|
||||
}
|
||||
|
||||
private TileEntity getTileEntity( final TileEntity self, final BlockPos pos )
|
||||
{
|
||||
private TileEntity getTileEntity(final TileEntity self, final BlockPos pos) {
|
||||
final World w = self.getWorldObj();
|
||||
|
||||
if( w.getChunkProvider().chunkExists( pos.getX() >> 4, pos.getZ() >> 4 ) )
|
||||
{
|
||||
return w.getTileEntity( pos.getX(), pos.getY(), pos.getZ() );
|
||||
if (w.getChunkProvider().chunkExists(pos.getX() >> 4, pos.getZ() >> 4)) {
|
||||
return w.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -133,22 +117,20 @@ public abstract class PartSharedFluidBus extends PartUpgradeable implements IGri
|
||||
amount = amount * 8;
|
||||
case 0:
|
||||
default:
|
||||
return (int) Math.floor( amount );
|
||||
return (int) Math.floor(amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( NBTTagCompound extra )
|
||||
{
|
||||
super.readFromNBT( extra );
|
||||
this.config.readFromNBT( extra, "config" );
|
||||
public void readFromNBT(NBTTagCompound extra) {
|
||||
super.readFromNBT(extra);
|
||||
this.config.readFromNBT(extra, "config");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( NBTTagCompound extra )
|
||||
{
|
||||
super.writeToNBT( extra );
|
||||
this.config.writeToNBT( extra, "config" );
|
||||
public void writeToNBT(NBTTagCompound extra) {
|
||||
super.writeToNBT(extra);
|
||||
this.config.writeToNBT(extra, "config");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,8 +146,7 @@ public abstract class PartSharedFluidBus extends PartUpgradeable implements IGri
|
||||
this.config.setInventorySlotContents(id, tmp);
|
||||
}
|
||||
|
||||
protected StorageChannel getChannel()
|
||||
{
|
||||
protected StorageChannel getChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
}
|
||||
|
||||
@@ -174,9 +155,7 @@ public abstract class PartSharedFluidBus extends PartUpgradeable implements IGri
|
||||
protected abstract boolean canDoBusWork();
|
||||
|
||||
@Override
|
||||
public int cableConnectionRenderTo()
|
||||
{
|
||||
public int cableConnectionRenderTo() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +1,49 @@
|
||||
package com.glodblock.github.common.storage;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public enum CellType {
|
||||
|
||||
Cell1kPart( 0, AEFeature.StorageCells ),
|
||||
Cell4kPart( 1, AEFeature.StorageCells ),
|
||||
Cell16kPart( 2, AEFeature.StorageCells ),
|
||||
Cell64kPart( 3, AEFeature.StorageCells ),
|
||||
Cell256kPart( 4, AEFeature.StorageCells ),
|
||||
Cell1024kPart( 5, AEFeature.StorageCells ),
|
||||
Cell4096kPart( 6, AEFeature.StorageCells );
|
||||
Cell1kPart(0, AEFeature.StorageCells),
|
||||
Cell4kPart(1, AEFeature.StorageCells),
|
||||
Cell16kPart(2, AEFeature.StorageCells),
|
||||
Cell64kPart(3, AEFeature.StorageCells),
|
||||
Cell256kPart(4, AEFeature.StorageCells),
|
||||
Cell1024kPart(5, AEFeature.StorageCells),
|
||||
Cell4096kPart(6, AEFeature.StorageCells);
|
||||
|
||||
private final EnumSet<AEFeature> features;
|
||||
private int damageValue;
|
||||
private Item itemInstance;
|
||||
|
||||
CellType( final int metaValue, final AEFeature part )
|
||||
{
|
||||
this.setDamageValue( metaValue );
|
||||
this.features = EnumSet.of( part );
|
||||
CellType(final int metaValue, final AEFeature part) {
|
||||
this.setDamageValue(metaValue);
|
||||
this.features = EnumSet.of(part);
|
||||
}
|
||||
|
||||
void setDamageValue( final int damageValue )
|
||||
{
|
||||
this.damageValue = damageValue;
|
||||
}
|
||||
|
||||
public int getDamageValue()
|
||||
{
|
||||
public int getDamageValue() {
|
||||
return this.damageValue;
|
||||
}
|
||||
|
||||
EnumSet<AEFeature> getFeature()
|
||||
{
|
||||
void setDamageValue(final int damageValue) {
|
||||
this.damageValue = damageValue;
|
||||
}
|
||||
|
||||
EnumSet<AEFeature> getFeature() {
|
||||
return this.features;
|
||||
}
|
||||
|
||||
public ItemStack stack(final int size )
|
||||
{
|
||||
return new ItemStack( this.getItemInstance(), size, this.getDamageValue() );
|
||||
public ItemStack stack(final int size) {
|
||||
return new ItemStack(this.getItemInstance(), size, this.getDamageValue());
|
||||
}
|
||||
|
||||
public Item getItemInstance()
|
||||
{
|
||||
public Item getItemInstance() {
|
||||
return this.itemInstance;
|
||||
}
|
||||
|
||||
public void setItemInstance( final Item itemInstance )
|
||||
{
|
||||
public void setItemInstance(final Item itemInstance) {
|
||||
this.itemInstance = itemInstance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,64 +12,63 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class FluidCellHandler implements ICellHandler
|
||||
{
|
||||
public class FluidCellHandler implements ICellHandler {
|
||||
|
||||
@Override
|
||||
public boolean isCell( final ItemStack is )
|
||||
{
|
||||
return FluidCellInventory.isCell( is );
|
||||
public boolean isCell(final ItemStack is) {
|
||||
return FluidCellInventory.isCell(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(final ItemStack is, final ISaveProvider container, final StorageChannel channel )
|
||||
{
|
||||
if( channel == StorageChannel.FLUIDS )
|
||||
{
|
||||
return FluidCellInventory.getCell( is, container );
|
||||
public IMEInventoryHandler getCellInventory(
|
||||
final ItemStack is, final ISaveProvider container, final StorageChannel channel) {
|
||||
if (channel == StorageChannel.FLUIDS) {
|
||||
return FluidCellInventory.getCell(is, container);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Light()
|
||||
{
|
||||
public IIcon getTopTexture_Light() {
|
||||
return ExtraBlockTextures.BlockMEChestItems_Light.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Medium()
|
||||
{
|
||||
public IIcon getTopTexture_Medium() {
|
||||
return ExtraBlockTextures.BlockMEChestItems_Medium.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTopTexture_Dark()
|
||||
{
|
||||
public IIcon getTopTexture_Dark() {
|
||||
return ExtraBlockTextures.BlockMEChestItems_Dark.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui(final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final StorageChannel chan )
|
||||
{
|
||||
public void openChestGui(
|
||||
final EntityPlayer player,
|
||||
final IChestOrDrive chest,
|
||||
final ICellHandler cellHandler,
|
||||
final IMEInventoryHandler inv,
|
||||
final ItemStack is,
|
||||
final StorageChannel chan) {
|
||||
if (ModAndClassUtil.EC2) {
|
||||
if (chan == StorageChannel.FLUIDS) {
|
||||
IStorageMonitorable monitorable = null;
|
||||
if (chest != null) {
|
||||
monitorable = ((IMEChest)chest).getMonitorable(ForgeDirection.UNKNOWN, new PlayerSource(player, chest));
|
||||
monitorable =
|
||||
((IMEChest) chest).getMonitorable(ForgeDirection.UNKNOWN, new PlayerSource(player, chest));
|
||||
}
|
||||
if (monitorable != null) {
|
||||
GuiHandler.launchGui(GuiHandler.getGuiId(0), player, new Object[]{monitorable.getFluidInventory()});
|
||||
GuiHandler.launchGui(
|
||||
GuiHandler.getGuiId(0), player, new Object[] {monitorable.getFluidInventory()});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusForCell( final ItemStack is, final IMEInventory handler )
|
||||
{
|
||||
if( handler instanceof FluidCellInventoryHandler)
|
||||
{
|
||||
public int getStatusForCell(final ItemStack is, final IMEInventory handler) {
|
||||
if (handler instanceof FluidCellInventoryHandler) {
|
||||
final FluidCellInventoryHandler ci = (FluidCellInventoryHandler) handler;
|
||||
return ci.getStatusForCell();
|
||||
}
|
||||
@@ -77,9 +76,8 @@ public class FluidCellHandler implements ICellHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public double cellIdleDrain( final ItemStack is, final IMEInventory handler )
|
||||
{
|
||||
final IFluidCellInventory inv = ( (IFluidCellInventoryHandler) handler ).getCellInv();
|
||||
public double cellIdleDrain(final ItemStack is, final IMEInventory handler) {
|
||||
final IFluidCellInventory inv = ((IFluidCellInventoryHandler) handler).getCellInv();
|
||||
return inv.getIdleDrain();
|
||||
}
|
||||
}
|
||||
@@ -29,30 +29,27 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
private static String[] fluidSlotCount;
|
||||
private final ItemStack cellItem;
|
||||
private final ISaveProvider container;
|
||||
private final static int MAX_TYPE = 1;
|
||||
private static final int MAX_TYPE = 1;
|
||||
private long storedFluidCount;
|
||||
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 {
|
||||
public FluidCellInventory(final ItemStack o, final ISaveProvider container) throws AppEngException {
|
||||
|
||||
if( fluidSlots == null )
|
||||
{
|
||||
if (fluidSlots == null) {
|
||||
fluidSlots = new String[MAX_TYPE];
|
||||
fluidSlotCount = new String[MAX_TYPE];
|
||||
|
||||
for( int x = 0; x < MAX_TYPE; x++ )
|
||||
{
|
||||
for (int x = 0; x < MAX_TYPE; x++) {
|
||||
fluidSlots[x] = FLUID_SLOT + x;
|
||||
fluidSlotCount[x] = FLUID_SLOT_COUNT + x;
|
||||
}
|
||||
}
|
||||
|
||||
if( o == null )
|
||||
{
|
||||
throw new AppEngException( "ItemStack was used as a cell, but was not a cell!" );
|
||||
if (o == null) {
|
||||
throw new AppEngException("ItemStack was used as a cell, but was not a cell!");
|
||||
}
|
||||
|
||||
this.cellType = null;
|
||||
@@ -60,52 +57,42 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
final Item type = this.cellItem.getItem();
|
||||
|
||||
if( type instanceof IStorageFluidCell)
|
||||
{
|
||||
if (type instanceof IStorageFluidCell) {
|
||||
this.cellType = (IStorageFluidCell) this.cellItem.getItem();
|
||||
}
|
||||
|
||||
if( this.cellType == null )
|
||||
{
|
||||
throw new AppEngException( "ItemStack was used as a cell, but was not a cell!" );
|
||||
if (this.cellType == null) {
|
||||
throw new AppEngException("ItemStack was used as a cell, but was not a cell!");
|
||||
}
|
||||
|
||||
if( !this.cellType.isStorageCell( this.cellItem ) )
|
||||
{
|
||||
throw new AppEngException( "ItemStack was used as a cell, but was not a cell!" );
|
||||
if (!this.cellType.isStorageCell(this.cellItem)) {
|
||||
throw new AppEngException("ItemStack was used as a cell, but was not a cell!");
|
||||
}
|
||||
|
||||
this.container = container;
|
||||
this.tagCompound = Platform.openNbtData( o );
|
||||
this.storedFluids = this.tagCompound.getShort( FLUID_TYPE_TAG );
|
||||
this.storedFluidCount = this.tagCompound.getLong( FLUID_COUNT_TAG );
|
||||
this.tagCompound = Platform.openNbtData(o);
|
||||
this.storedFluids = this.tagCompound.getShort(FLUID_TYPE_TAG);
|
||||
this.storedFluidCount = this.tagCompound.getLong(FLUID_COUNT_TAG);
|
||||
this.cellItems = null;
|
||||
}
|
||||
|
||||
public static IMEInventoryHandler<IAEFluidStack> getCell(final ItemStack o, final ISaveProvider container2 )
|
||||
{
|
||||
try
|
||||
{
|
||||
return new FluidCellInventoryHandler( new FluidCellInventory( o, container2 ) );
|
||||
}
|
||||
catch( final AppEngException e )
|
||||
{
|
||||
public static IMEInventoryHandler<IAEFluidStack> getCell(final ItemStack o, final ISaveProvider container2) {
|
||||
try {
|
||||
return new FluidCellInventoryHandler(new FluidCellInventory(o, container2));
|
||||
} catch (final AppEngException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCell( final ItemStack itemStack )
|
||||
{
|
||||
if( itemStack == null )
|
||||
{
|
||||
public static boolean isCell(final ItemStack itemStack) {
|
||||
if (itemStack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Item type = itemStack.getItem();
|
||||
|
||||
if( type instanceof IStorageFluidCell)
|
||||
{
|
||||
return ( (IStorageFluidCell) type ).isStorageCell( itemStack );
|
||||
if (type instanceof IStorageFluidCell) {
|
||||
return ((IStorageFluidCell) type).isStorageCell(itemStack);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -123,12 +110,12 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory() {
|
||||
return this.cellType.getConfigInventory( this.cellItem );
|
||||
return this.cellType.getConfigInventory(this.cellItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType() {
|
||||
return this.cellType.getBytesPerType( this.cellItem );
|
||||
return this.cellType.getBytesPerType(this.cellItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,7 +125,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
@Override
|
||||
public long getTotalBytes() {
|
||||
return this.cellType.getBytes( this.cellItem );
|
||||
return this.cellType.getBytes(this.cellItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,26 +172,21 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
@Override
|
||||
public int getUnusedFluidCount() {
|
||||
return (int) (this.getStoredFluidCount() % singleByteAmount);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusForCell() {
|
||||
if( this.canHoldNewFluid() )
|
||||
{
|
||||
if (this.canHoldNewFluid()) {
|
||||
return 1;
|
||||
}
|
||||
if( this.getRemainingFluidCount() > 0 )
|
||||
{
|
||||
if (this.getRemainingFluidCount() > 0) {
|
||||
return 2;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
private void loadCellItems()
|
||||
{
|
||||
if( this.cellItems == null )
|
||||
{
|
||||
private void loadCellItems() {
|
||||
if (this.cellItems == null) {
|
||||
this.cellItems = AEApi.instance().storage().createFluidList();
|
||||
}
|
||||
|
||||
@@ -212,67 +194,56 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
final int types = (int) this.getStoredFluidTypes();
|
||||
|
||||
for( int x = 0; x < types; x++ )
|
||||
{
|
||||
final FluidStack t = FluidStack.loadFluidStackFromNBT( this.tagCompound.getCompoundTag( fluidSlots[x] ) );
|
||||
final AEFluidStack aet = AEFluidStack.create( t );
|
||||
for (int x = 0; x < types; x++) {
|
||||
final FluidStack t = FluidStack.loadFluidStackFromNBT(this.tagCompound.getCompoundTag(fluidSlots[x]));
|
||||
final AEFluidStack aet = AEFluidStack.create(t);
|
||||
|
||||
if( aet != null )
|
||||
{
|
||||
aet.setStackSize( this.tagCompound.getLong( fluidSlotCount[x] ) );
|
||||
if (aet != null) {
|
||||
aet.setStackSize(this.tagCompound.getLong(fluidSlotCount[x]));
|
||||
|
||||
if( aet.getStackSize() > 0 )
|
||||
{
|
||||
this.cellItems.add( aet );
|
||||
if (aet.getStackSize() > 0) {
|
||||
this.cellItems.add(aet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IItemList<IAEFluidStack> getCellItems()
|
||||
{
|
||||
if( this.cellItems == null )
|
||||
{
|
||||
private IItemList<IAEFluidStack> getCellItems() {
|
||||
if (this.cellItems == null) {
|
||||
this.loadCellItems();
|
||||
}
|
||||
|
||||
return this.cellItems;
|
||||
}
|
||||
|
||||
private void updateFluidCount( final long delta )
|
||||
{
|
||||
private void updateFluidCount(final long delta) {
|
||||
this.storedFluidCount += delta;
|
||||
this.tagCompound.setLong( FLUID_COUNT_TAG, this.storedFluidCount );
|
||||
this.tagCompound.setLong(FLUID_COUNT_TAG, this.storedFluidCount);
|
||||
}
|
||||
|
||||
private void saveChanges()
|
||||
{
|
||||
private void saveChanges() {
|
||||
long itemCount = 0;
|
||||
|
||||
int x = 0;
|
||||
|
||||
for( final IAEFluidStack v : this.cellItems )
|
||||
{
|
||||
for (final IAEFluidStack v : this.cellItems) {
|
||||
itemCount += v.getStackSize();
|
||||
|
||||
final NBTBase c = this.tagCompound.getTag( fluidSlots[x] );
|
||||
final NBTBase c = this.tagCompound.getTag(fluidSlots[x]);
|
||||
|
||||
if( c instanceof NBTTagCompound )
|
||||
{
|
||||
v.writeToNBT( (NBTTagCompound) c );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (c instanceof NBTTagCompound) {
|
||||
v.writeToNBT((NBTTagCompound) c);
|
||||
} else {
|
||||
final NBTTagCompound g = new NBTTagCompound();
|
||||
v.writeToNBT( g );
|
||||
this.tagCompound.setTag( fluidSlots[x], g );
|
||||
v.writeToNBT(g);
|
||||
this.tagCompound.setTag(fluidSlots[x], g);
|
||||
}
|
||||
|
||||
/*
|
||||
* NBTBase tagSlotCount = tagCompound.getTag( itemSlotCount[x] ); if ( tagSlotCount instanceof
|
||||
* NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else
|
||||
*/
|
||||
this.tagCompound.setLong( fluidSlotCount[x], v.getStackSize() );
|
||||
this.tagCompound.setLong(fluidSlotCount[x], v.getStackSize());
|
||||
|
||||
x++;
|
||||
}
|
||||
@@ -287,13 +258,10 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
*/
|
||||
this.storedFluids = (short) this.cellItems.size();
|
||||
|
||||
if( this.cellItems.isEmpty() )
|
||||
{
|
||||
this.tagCompound.removeTag( FLUID_TYPE_TAG );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.tagCompound.setShort( FLUID_TYPE_TAG, this.storedFluids );
|
||||
if (this.cellItems.isEmpty()) {
|
||||
this.tagCompound.removeTag(FLUID_TYPE_TAG);
|
||||
} else {
|
||||
this.tagCompound.setShort(FLUID_TYPE_TAG, this.storedFluids);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -301,75 +269,61 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
*/
|
||||
this.storedFluidCount = itemCount;
|
||||
|
||||
if( itemCount == 0 )
|
||||
{
|
||||
this.tagCompound.removeTag( FLUID_COUNT_TAG );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.tagCompound.setLong( FLUID_COUNT_TAG, itemCount );
|
||||
if (itemCount == 0) {
|
||||
this.tagCompound.removeTag(FLUID_COUNT_TAG);
|
||||
} else {
|
||||
this.tagCompound.setLong(FLUID_COUNT_TAG, itemCount);
|
||||
}
|
||||
|
||||
// clean any old crusty stuff...
|
||||
for( ; x < oldStoredItems && x < MAX_TYPE; x++ )
|
||||
{
|
||||
this.tagCompound.removeTag( fluidSlots[x] );
|
||||
this.tagCompound.removeTag( fluidSlotCount[x] );
|
||||
for (; x < oldStoredItems && x < MAX_TYPE; x++) {
|
||||
this.tagCompound.removeTag(fluidSlots[x]);
|
||||
this.tagCompound.removeTag(fluidSlotCount[x]);
|
||||
}
|
||||
|
||||
if( this.container != null )
|
||||
{
|
||||
this.container.saveChanges( this );
|
||||
if (this.container != null) {
|
||||
this.container.saveChanges(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack injectItems(IAEFluidStack input, Actionable mode, BaseActionSource src) {
|
||||
if( input == null )
|
||||
{
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if( input.getStackSize() == 0 )
|
||||
{
|
||||
if (input.getStackSize() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(this.cellType.isBlackListed( this.cellItem, input ))
|
||||
{
|
||||
if (this.cellType.isBlackListed(this.cellItem, input)) {
|
||||
return input;
|
||||
}
|
||||
|
||||
final IAEFluidStack l = this.getCellItems().findPrecise( input );
|
||||
final IAEFluidStack l = this.getCellItems().findPrecise(input);
|
||||
|
||||
if( l != null )
|
||||
{
|
||||
final long remainingItemSlots = this.getRemainingFluidCount() - (long) this.getBytesPerType() * singleByteAmount;
|
||||
if (l != null) {
|
||||
final long remainingItemSlots =
|
||||
this.getRemainingFluidCount() - (long) this.getBytesPerType() * singleByteAmount;
|
||||
|
||||
if( remainingItemSlots < 0 )
|
||||
{
|
||||
if (remainingItemSlots < 0) {
|
||||
return input;
|
||||
}
|
||||
|
||||
if( input.getStackSize() > remainingItemSlots )
|
||||
{
|
||||
if (input.getStackSize() > remainingItemSlots) {
|
||||
final IAEFluidStack r = input.copy();
|
||||
r.setStackSize( r.getStackSize() - remainingItemSlots );
|
||||
r.setStackSize(r.getStackSize() - remainingItemSlots);
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
l.setStackSize( l.getStackSize() + remainingItemSlots );
|
||||
this.updateFluidCount( remainingItemSlots );
|
||||
if (mode == Actionable.MODULATE) {
|
||||
l.setStackSize(l.getStackSize() + remainingItemSlots);
|
||||
this.updateFluidCount(remainingItemSlots);
|
||||
this.saveChanges();
|
||||
}
|
||||
return r;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
l.setStackSize( l.getStackSize() + input.getStackSize() );
|
||||
this.updateFluidCount( input.getStackSize() );
|
||||
} else {
|
||||
if (mode == Actionable.MODULATE) {
|
||||
l.setStackSize(l.getStackSize() + input.getStackSize());
|
||||
this.updateFluidCount(input.getStackSize());
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
@@ -377,14 +331,13 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
}
|
||||
}
|
||||
|
||||
if( this.canHoldNewFluid() ) // room for new type, and for at least one item!
|
||||
if (this.canHoldNewFluid()) // room for new type, and for at least one item!
|
||||
{
|
||||
final long remainingItemCount = this.getRemainingFluidCount() - ((long) this.getBytesPerType() * singleByteAmount);
|
||||
final long remainingItemCount =
|
||||
this.getRemainingFluidCount() - ((long) this.getBytesPerType() * singleByteAmount);
|
||||
|
||||
if( remainingItemCount > 0 )
|
||||
{
|
||||
if( input.getStackSize() > remainingItemCount )
|
||||
{
|
||||
if (remainingItemCount > 0) {
|
||||
if (input.getStackSize() > remainingItemCount) {
|
||||
final IAEFluidStack toReturn = input.copy();
|
||||
toReturn.decStackSize(remainingItemCount);
|
||||
|
||||
@@ -401,10 +354,9 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
this.updateFluidCount( input.getStackSize() );
|
||||
this.cellItems.add( input );
|
||||
if (mode == Actionable.MODULATE) {
|
||||
this.updateFluidCount(input.getStackSize());
|
||||
this.cellItems.add(input);
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
@@ -417,8 +369,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
@Override
|
||||
public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseActionSource src) {
|
||||
if( request == null )
|
||||
{
|
||||
if (request == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -426,31 +377,25 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
IAEFluidStack results = null;
|
||||
|
||||
final IAEFluidStack l = this.getCellItems().findPrecise( request );
|
||||
final IAEFluidStack l = this.getCellItems().findPrecise(request);
|
||||
|
||||
if( l != null )
|
||||
{
|
||||
if (l != null) {
|
||||
results = l.copy();
|
||||
|
||||
if( l.getStackSize() <= size )
|
||||
{
|
||||
results.setStackSize( l.getStackSize() );
|
||||
if (l.getStackSize() <= size) {
|
||||
results.setStackSize(l.getStackSize());
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
this.updateFluidCount( -l.getStackSize() );
|
||||
l.setStackSize( 0 );
|
||||
if (mode == Actionable.MODULATE) {
|
||||
this.updateFluidCount(-l.getStackSize());
|
||||
l.setStackSize(0);
|
||||
this.saveChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
results.setStackSize( size );
|
||||
} else {
|
||||
results.setStackSize(size);
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
l.setStackSize( l.getStackSize() - size );
|
||||
this.updateFluidCount( -size );
|
||||
if (mode == Actionable.MODULATE) {
|
||||
l.setStackSize(l.getStackSize() - size);
|
||||
this.updateFluidCount(-size);
|
||||
this.saveChanges();
|
||||
}
|
||||
}
|
||||
@@ -461,9 +406,8 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
@Override
|
||||
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out) {
|
||||
for( final IAEFluidStack i : this.getCellItems() )
|
||||
{
|
||||
out.add( i );
|
||||
for (final IAEFluidStack i : this.getCellItems()) {
|
||||
out.add(i);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
@@ -17,17 +17,16 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack> implements IFluidCellInventoryHandler {
|
||||
|
||||
FluidCellInventoryHandler( final IMEInventory<IAEFluidStack> c )
|
||||
{
|
||||
super( c, StorageChannel.FLUIDS );
|
||||
FluidCellInventoryHandler(final IMEInventory<IAEFluidStack> c) {
|
||||
super(c, StorageChannel.FLUIDS);
|
||||
|
||||
final IFluidCellInventory ci = this.getCellInv();
|
||||
|
||||
if( ci != null )
|
||||
{
|
||||
if (ci != null) {
|
||||
final IInventory config = ci.getConfigInventory();
|
||||
|
||||
final IItemList<IAEFluidStack> priorityList = AEApi.instance().storage().createFluidList();
|
||||
final IItemList<IAEFluidStack> priorityList =
|
||||
AEApi.instance().storage().createFluidList();
|
||||
for (int x = 0; x < config.getSizeInventory(); x++) {
|
||||
final ItemStack is = config.getStackInSlot(x);
|
||||
if (is != null && Util.getFluidFromItem(is) != null) {
|
||||
@@ -42,16 +41,14 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidCellInventory getCellInv()
|
||||
{
|
||||
public IFluidCellInventory getCellInv() {
|
||||
Object o = this.getInternal();
|
||||
|
||||
if( o instanceof MEPassThrough)
|
||||
{
|
||||
o = Ae2Reflect.getInternal( (MEPassThrough) o );
|
||||
if (o instanceof MEPassThrough) {
|
||||
o = Ae2Reflect.getInternal((MEPassThrough) o);
|
||||
}
|
||||
|
||||
return (IFluidCellInventory) ( o instanceof IFluidCellInventory ? o : null );
|
||||
return (IFluidCellInventory) (o instanceof IFluidCellInventory ? o : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,23 +57,19 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreformatted()
|
||||
{
|
||||
public boolean isPreformatted() {
|
||||
return !Ae2Reflect.getPartitionList(this).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IncludeExclude getIncludeExcludeMode()
|
||||
{
|
||||
public IncludeExclude getIncludeExcludeMode() {
|
||||
return IncludeExclude.WHITELIST;
|
||||
}
|
||||
|
||||
public int getStatusForCell()
|
||||
{
|
||||
public int getStatusForCell() {
|
||||
int val = this.getCellInv().getStatusForCell();
|
||||
|
||||
if( val == 1 && this.isPreformatted() )
|
||||
{
|
||||
if (val == 1 && this.isPreformatted()) {
|
||||
val = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ import appeng.api.storage.data.IAEFluidStack;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IFluidCellInventory extends IMEInventory<IAEFluidStack>
|
||||
{
|
||||
public interface IFluidCellInventory extends IMEInventory<IAEFluidStack> {
|
||||
|
||||
/**
|
||||
* @return the item stack of this storage cell.
|
||||
|
||||
@@ -12,5 +12,4 @@ public interface IFluidCellInventoryHandler {
|
||||
boolean isPreformatted();
|
||||
|
||||
IncludeExclude getIncludeExcludeMode();
|
||||
|
||||
}
|
||||
@@ -6,18 +6,17 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IStorageFluidCell extends ICellWorkbenchItem {
|
||||
|
||||
int getBytes( ItemStack cellItem );
|
||||
int getBytes(ItemStack cellItem);
|
||||
|
||||
int getBytesPerType( ItemStack cellItem );
|
||||
int getBytesPerType(ItemStack cellItem);
|
||||
|
||||
boolean isBlackListed( ItemStack cellItem, IAEFluidStack requestedAddition );
|
||||
boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition);
|
||||
|
||||
boolean storableInStorageCell();
|
||||
|
||||
boolean isStorageCell( ItemStack i );
|
||||
boolean isStorageCell(ItemStack i);
|
||||
|
||||
double getIdleDrain();
|
||||
|
||||
int getTotalTypes( ItemStack cellItem );
|
||||
|
||||
int getTotalTypes(ItemStack cellItem);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ public class FluidCraftingTabs extends CreativeTabs {
|
||||
|
||||
public static final FluidCraftingTabs INSTANCE = new FluidCraftingTabs(FluidCraft.MODID);
|
||||
|
||||
public FluidCraftingTabs(String name){
|
||||
public FluidCraftingTabs(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.storage.MEInventoryHandler;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -41,7 +40,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
@Override
|
||||
public boolean canBeRotated() {
|
||||
return false;
|
||||
//based
|
||||
// based
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,12 +63,12 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
|
||||
@Override
|
||||
public void setPriority(int newValue) {
|
||||
//do nothing
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blinkCell(int slot) {
|
||||
//do nothing
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,7 +86,10 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
|
||||
private IMEMonitor<IAEFluidStack> getFluidGrid() {
|
||||
try {
|
||||
return getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
return getProxy()
|
||||
.getGrid()
|
||||
.<IStorageGrid>getCache(IStorageGrid.class)
|
||||
.getFluidInventory();
|
||||
} catch (GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
@@ -128,7 +130,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
updateState();
|
||||
}
|
||||
|
||||
private class FluidDiscretizingInventory implements IMEInventory<IAEItemStack>, IMEMonitorHandlerReceiver<IAEFluidStack> {
|
||||
private class FluidDiscretizingInventory
|
||||
implements IMEInventory<IAEItemStack>, IMEMonitorHandlerReceiver<IAEFluidStack> {
|
||||
|
||||
private final MEInventoryHandler<IAEItemStack> invHandler = new MEInventoryHandler<>(this, getChannel());
|
||||
private List<IAEItemStack> itemCache = null;
|
||||
@@ -153,8 +156,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
}
|
||||
if (type == Actionable.SIMULATE) {
|
||||
return ItemFluidDrop.newAeStack(fluidGrid.injectItems(fluidStack.copy(), Actionable.SIMULATE, src));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return ItemFluidDrop.newAeStack(fluidGrid.injectItems(fluidStack.copy(), Actionable.MODULATE, src));
|
||||
}
|
||||
}
|
||||
@@ -175,8 +177,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
}
|
||||
if (mode == Actionable.SIMULATE) {
|
||||
return ItemFluidDrop.newAeStack(fluidGrid.extractItems(fluidStack.copy(), Actionable.SIMULATE, src));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return ItemFluidDrop.newAeStack(fluidGrid.extractItems(fluidStack.copy(), Actionable.MODULATE, src));
|
||||
}
|
||||
}
|
||||
@@ -213,7 +214,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change, BaseActionSource actionSource) {
|
||||
public void postChange(
|
||||
IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change, BaseActionSource actionSource) {
|
||||
itemCache = null;
|
||||
try {
|
||||
List<IAEItemStack> mappedChanges = new ArrayList<>();
|
||||
@@ -223,8 +225,10 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
mappedChanges.add(itemStack);
|
||||
}
|
||||
}
|
||||
getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class)
|
||||
.postAlterationOfStoredItems(getChannel(), mappedChanges, ownActionSource);
|
||||
getProxy()
|
||||
.getGrid()
|
||||
.<IStorageGrid>getCache(IStorageGrid.class)
|
||||
.postAlterationOfStoredItems(getChannel(), mappedChanges, ownActionSource);
|
||||
} catch (GridAccessException e) {
|
||||
// NO-OP
|
||||
}
|
||||
@@ -254,8 +258,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
return null;
|
||||
}
|
||||
if (craftingGrid instanceof CraftingGridCache) {
|
||||
IAEStack remaining = ((CraftingGridCache)craftingGrid).injectItems(
|
||||
ItemFluidDrop.newAeStack(input), type, ownActionSource);
|
||||
IAEStack remaining = ((CraftingGridCache) craftingGrid)
|
||||
.injectItems(ItemFluidDrop.newAeStack(input), type, ownActionSource);
|
||||
if (remaining instanceof IAEItemStack) {
|
||||
return ItemFluidDrop.getAeFluidStack((IAEItemStack) remaining);
|
||||
}
|
||||
@@ -277,7 +281,5 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
public StorageChannel getChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,8 @@ import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -32,19 +34,11 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TileFluidInterface extends TileInterface implements IFluidHandler, IAEFluidInventory
|
||||
{
|
||||
|
||||
public TileFluidInterface() {
|
||||
super.getInterfaceDuality().getConfigManager()
|
||||
.registerSetting(Settings.SIDELESS_MODE, SidelessMode.SIDELESS);
|
||||
}
|
||||
public class TileFluidInterface extends TileInterface implements IFluidHandler, IAEFluidInventory {
|
||||
|
||||
private final DualityFluidInterface fluidDuality = new DualityFluidInterface(this.getProxy(), this) {
|
||||
private final IConfigManager dualityConfigManager = getInterfaceDuality().getConfigManager();
|
||||
private final IConfigManager dualityConfigManager =
|
||||
getInterfaceDuality().getConfigManager();
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
@@ -56,6 +50,11 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
return this.getTanks().drain(from.ordinal(), maxDrain, doDrain);
|
||||
}
|
||||
};
|
||||
|
||||
public TileFluidInterface() {
|
||||
super.getInterfaceDuality().getConfigManager().registerSetting(Settings.SIDELESS_MODE, SidelessMode.SIDELESS);
|
||||
}
|
||||
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -85,12 +84,11 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory getConfig() {
|
||||
for (int i = 0; i < fluidDuality.getConfig().getSlots(); i ++) {
|
||||
for (int i = 0; i < fluidDuality.getConfig().getSlots(); i++) {
|
||||
IAEFluidStack fluid = fluidDuality.getConfig().getFluidInSlot(i);
|
||||
if (fluid == null) {
|
||||
config.setInventorySlotContents(i, null);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
config.setInventorySlotContents(i, ItemFluidPacket.newDisplayStack(fluid.getFluidStack()));
|
||||
}
|
||||
}
|
||||
@@ -102,10 +100,10 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
TickingRequest item = super.getTickingRequest(node);
|
||||
TickingRequest fluid = fluidDuality.getTickingRequest(node);
|
||||
return new TickingRequest(
|
||||
Math.min(item.minTickRate, fluid.minTickRate),
|
||||
Math.max(item.maxTickRate, fluid.maxTickRate),
|
||||
item.isSleeping && fluid.isSleeping,
|
||||
true);
|
||||
Math.min(item.minTickRate, fluid.minTickRate),
|
||||
Math.max(item.maxTickRate, fluid.maxTickRate),
|
||||
item.isSleeping && fluid.isSleeping,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,11 +117,11 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_WRITE )
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
protected void writeToStream(ByteBuf data) throws IOException {
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
ByteBufUtils.writeItemStack(data, config.getStackInSlot(i));
|
||||
for (int j = 0; j < config.getSizeInventory(); j ++) {
|
||||
for (int j = 0; j < config.getSizeInventory(); j++) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(config.getStackInSlot(j));
|
||||
fluidDuality.getConfig().setFluidInSlot(j, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
@@ -143,7 +141,7 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_READ )
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
protected boolean readFromStream(ByteBuf data) throws IOException {
|
||||
boolean changed = false;
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
@@ -152,7 +150,7 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
config.setInventorySlotContents(i, stack);
|
||||
changed = true;
|
||||
}
|
||||
for (int j = 0; j < config.getSizeInventory(); j ++) {
|
||||
for (int j = 0; j < config.getSizeInventory(); j++) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(config.getStackInSlot(j));
|
||||
fluidDuality.getConfig().setFluidInSlot(j, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
@@ -176,17 +174,17 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
return changed;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
config.readFromNBT(data, "ConfigInv");
|
||||
for (int i = 0; i < config.getSizeInventory(); i ++) {
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(config.getStackInSlot(i));
|
||||
fluidDuality.getConfig().setFluidInSlot(i, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
getInternalFluid().readFromNBT(data, "FluidInv");
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
config.writeToNBT(data, "ConfigInv");
|
||||
getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
@@ -194,8 +192,7 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ItemStack getItemFromTile( final Object obj )
|
||||
{
|
||||
protected ItemStack getItemFromTile(final Object obj) {
|
||||
if (obj instanceof TileFluidInterface) {
|
||||
return ItemAndBlockHolder.INTERFACE.stack();
|
||||
}
|
||||
@@ -203,9 +200,8 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades( final Upgrades u )
|
||||
{
|
||||
return getInterfaceDuality().getInstalledUpgrades( u );
|
||||
public int getInstalledUpgrades(final Upgrades u) {
|
||||
return getInterfaceDuality().getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -247,7 +243,8 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
|
||||
public void setConfig(int id, IAEFluidStack fluid) {
|
||||
if (id >= 0 && id < 6) {
|
||||
config.setInventorySlotContents(id, ItemFluidPacket.newDisplayStack(fluid == null ? null : fluid.getFluidStack()));
|
||||
config.setInventorySlotContents(
|
||||
id, ItemFluidPacket.newDisplayStack(fluid == null ? null : fluid.getFluidStack()));
|
||||
fluidDuality.getConfig().setFluidInSlot(id, fluidDuality.getStandardFluid(fluid));
|
||||
}
|
||||
}
|
||||
@@ -257,5 +254,4 @@ public class TileFluidInterface extends TileInterface implements IFluidHandler,
|
||||
getInternalFluid().setFluidInSlot(id, fluid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,7 +66,8 @@ public class TileFluidPacketDecoder extends AENetworkTile implements IGridTickab
|
||||
}
|
||||
IAEFluidStack aeFluid = AEFluidStack.create(fluid.copy());
|
||||
IEnergyGrid energyGrid = node.getGrid().getCache(IEnergyGrid.class);
|
||||
IMEMonitor<IAEFluidStack> fluidGrid = node.getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
IMEMonitor<IAEFluidStack> fluidGrid =
|
||||
node.getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
IAEFluidStack remaining = Platform.poweredInsert(energyGrid, fluidGrid, aeFluid, ownActionSource);
|
||||
if (remaining != null) {
|
||||
if (remaining.getStackSize() == aeFluid.getStackSize()) {
|
||||
@@ -82,7 +83,8 @@ public class TileFluidPacketDecoder extends AENetworkTile implements IGridTickab
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
public void onChangeInventory(
|
||||
IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
try {
|
||||
getProxy().getTick().alertDevice(getProxy().getNode());
|
||||
} catch (GridAccessException e) {
|
||||
@@ -90,13 +92,13 @@ public class TileFluidPacketDecoder extends AENetworkTile implements IGridTickab
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
inventory.writeToNBT(data, "Inventory");
|
||||
return data;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
inventory.readFromNBT(data, "Inventory");
|
||||
}
|
||||
|
||||
@@ -10,17 +10,17 @@ import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import com.glodblock.github.inventory.AeStackInventory;
|
||||
import com.glodblock.github.inventory.AeStackInventoryImpl;
|
||||
import java.util.List;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileFluidPatternEncoder extends AEBaseTile implements IAEAppEngInventory {
|
||||
|
||||
private final AppEngInternalInventory patternInv = new AppEngInternalInventory(this, 2);
|
||||
private final AeStackInventoryImpl<IAEItemStack> crafting = new AeStackInventoryImpl<>(StorageChannel.ITEMS, 9, this);
|
||||
private final AeStackInventoryImpl<IAEItemStack> crafting =
|
||||
new AeStackInventoryImpl<>(StorageChannel.ITEMS, 9, this);
|
||||
private final AeStackInventoryImpl<IAEItemStack> output = new AeStackInventoryImpl<>(StorageChannel.ITEMS, 3, this);
|
||||
|
||||
public IInventory getInventory() {
|
||||
@@ -41,7 +41,7 @@ public class TileFluidPatternEncoder extends AEBaseTile implements IAEAppEngInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final World w, final int x, final int y, final int z, final List<ItemStack> drops ) {
|
||||
public void getDrops(final World w, final int x, final int y, final int z, final List<ItemStack> drops) {
|
||||
for (ItemStack stack : patternInv) {
|
||||
if (stack != null) {
|
||||
drops.add(stack);
|
||||
@@ -49,14 +49,14 @@ public class TileFluidPatternEncoder extends AEBaseTile implements IAEAppEngInve
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
patternInv.readFromNBT(data, "Inventory");
|
||||
crafting.readFromNbt(data, "CraftingSlots");
|
||||
output.readFromNbt(data, "OutputSlots");
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
patternInv.writeToNBT(data, "Inventory");
|
||||
crafting.writeToNbt(data, "CraftingSlots");
|
||||
@@ -65,8 +65,6 @@ public class TileFluidPatternEncoder extends AEBaseTile implements IAEAppEngInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
|
||||
}
|
||||
|
||||
public void onChangeInventory(
|
||||
IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -21,9 +23,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TileIngredientBuffer extends AEBaseInvTile implements IAEFluidInventory, IFluidHandler {
|
||||
|
||||
private final AppEngInternalInventory invItems = new AppEngInternalInventory(this, 9);
|
||||
@@ -51,7 +50,7 @@ public class TileIngredientBuffer extends AEBaseInvTile implements IAEFluidInven
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
return new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +84,7 @@ public class TileIngredientBuffer extends AEBaseInvTile implements IAEFluidInven
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.NETWORK_READ )
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
protected boolean readFromStream(ByteBuf data) throws IOException {
|
||||
boolean changed = false;
|
||||
for (int i = 0; i < invItems.getSizeInventory(); i++) {
|
||||
@@ -114,13 +113,13 @@ public class TileIngredientBuffer extends AEBaseInvTile implements IAEFluidInven
|
||||
return changed;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
invItems.readFromNBT(data, "ItemInv");
|
||||
invFluids.readFromNBT(data, "FluidInv");
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
invItems.writeToNBT(data, "ItemInv");
|
||||
invFluids.writeToNBT(data, "FluidInv");
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -21,9 +23,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TileLargeIngredientBuffer extends AEBaseInvTile implements IAEFluidInventory, IFluidHandler {
|
||||
|
||||
private final AppEngInternalInventory invItems = new AppEngInternalInventory(this, 27);
|
||||
@@ -51,7 +50,9 @@ public class TileLargeIngredientBuffer extends AEBaseInvTile implements IAEFluid
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
|
||||
return new int[] {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,13 +40,13 @@ import com.glodblock.github.inventory.AeStackInventory;
|
||||
import com.glodblock.github.inventory.AeStackInventoryImpl;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.concurrent.Future;
|
||||
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 class TileLevelMaintainer extends AENetworkTile
|
||||
implements IAEAppEngInventory, IGridTickable, ICraftingRequester, IPowerChannelState {
|
||||
|
||||
public static final int REQ_COUNT = 5;
|
||||
public final InventoryRequest requests = new InventoryRequest(this);
|
||||
@@ -74,10 +74,14 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
try {
|
||||
if (this.getProxy().isActive()) {
|
||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||
final double power = Math.ceil(ItemFluidDrop.isFluidStack(items) ? items.getStackSize() / 1000D : items.getStackSize());
|
||||
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);
|
||||
IAEFluidStack notInserted = this.getProxy()
|
||||
.getStorage()
|
||||
.getFluidInventory()
|
||||
.injectItems(ItemFluidDrop.getAeFluidStack(items), mode, this.source);
|
||||
items.setStackSize(notInserted.getStackSize());
|
||||
return items;
|
||||
} else {
|
||||
@@ -90,6 +94,7 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(ICraftingLink link) {
|
||||
if (this.requests.getLinks() != null) {
|
||||
@@ -120,15 +125,17 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
try {
|
||||
ICraftingGrid cg = this.getProxy().getCrafting();
|
||||
IGrid grid = this.getProxy().getGrid();
|
||||
final IItemList<IAEItemStack> inv = this.getProxy().getStorage().getItemInventory().getStorageList();
|
||||
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;
|
||||
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) {
|
||||
@@ -162,7 +169,8 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
public void onChangeInventory(
|
||||
IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
|
||||
try {
|
||||
getProxy().getTick().alertDevice(getProxy().getNode());
|
||||
} catch (GridAccessException e) {
|
||||
@@ -175,9 +183,7 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gridChanged() {
|
||||
|
||||
}
|
||||
public void gridChanged() {}
|
||||
|
||||
@Override
|
||||
public boolean isPowered() {
|
||||
@@ -279,8 +285,8 @@ public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInven
|
||||
|
||||
try {
|
||||
newState = this.getProxy().isActive()
|
||||
&& this.getProxy().getEnergy().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG)
|
||||
> 0.0001;
|
||||
&& this.getProxy().getEnergy().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG)
|
||||
> 0.0001;
|
||||
} catch (final GridAccessException ignored) {
|
||||
|
||||
}
|
||||
|
||||
@@ -24,12 +24,11 @@ public class TileOCPatternEditor extends AEBaseInvTile {
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
return new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( final int i, final ItemStack itemstack ) {
|
||||
public boolean isItemValidForSlot(final int i, final ItemStack itemstack) {
|
||||
return itemstack == null || itemstack.getItem() instanceof ItemEncodedPattern;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,10 +45,9 @@ public class FCClassTransformer implements IClassTransformer {
|
||||
public interface Transform {
|
||||
|
||||
byte[] transformClass(byte[] code);
|
||||
|
||||
}
|
||||
|
||||
public static abstract class ClassMapper implements Transform {
|
||||
public abstract static class ClassMapper implements Transform {
|
||||
|
||||
@Override
|
||||
public byte[] transformClass(byte[] code) {
|
||||
@@ -63,6 +62,5 @@ public class FCClassTransformer implements IClassTransformer {
|
||||
}
|
||||
|
||||
protected abstract ClassVisitor getClassMapper(ClassVisitor downstream);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.glodblock.github.coremod;
|
||||
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@IFMLLoadingPlugin.Name("FluidCraftCore")
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@@ -12,7 +11,7 @@ public class FluidCraftCore implements IFMLLoadingPlugin {
|
||||
|
||||
@Override
|
||||
public String[] getASMTransformerClass() {
|
||||
return new String[] { FluidCraftCore.class.getPackage().getName() + ".FCClassTransformer" };
|
||||
return new String[] {FluidCraftCore.class.getPackage().getName() + ".FCClassTransformer"};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -37,5 +36,4 @@ public class FluidCraftCore implements IFMLLoadingPlugin {
|
||||
public String getAccessTransformerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,9 @@ import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.SetBackedMachineSet;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -36,14 +39,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class CoreModHooks {
|
||||
|
||||
public static InventoryCrafting wrapCraftingBuffer(InventoryCrafting inv) {
|
||||
return new FluidConvertingInventoryCrafting(inv.eventHandler, inv.inventoryWidth, inv.getSizeInventory()/inv.inventoryWidth);
|
||||
return new FluidConvertingInventoryCrafting(
|
||||
inv.eventHandler, inv.inventoryWidth, inv.getSizeInventory() / inv.inventoryWidth);
|
||||
}
|
||||
|
||||
public static IAEItemStack wrapFluidPacketStack(IAEItemStack stack) {
|
||||
@@ -61,8 +61,7 @@ public class CoreModHooks {
|
||||
if (stack != null && stack.getItem() instanceof ItemFluidPacket) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
|
||||
return ItemFluidDrop.newStack(fluid);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +73,8 @@ public class CoreModHooks {
|
||||
|
||||
public static long getCraftingByteCost(IAEItemStack stack) {
|
||||
return stack.getItem() instanceof ItemFluidDrop
|
||||
? (long) Math.ceil(stack.getStackSize() / 1000D) : stack.getStackSize();
|
||||
? (long) Math.ceil(stack.getStackSize() / 1000D)
|
||||
: stack.getStackSize();
|
||||
}
|
||||
|
||||
public static long getFluidDropsByteCost(long totalBytes, long originByte, IAEItemStack stack) {
|
||||
@@ -109,7 +109,7 @@ public class CoreModHooks {
|
||||
} else if (b.isEmpty()) {
|
||||
return a;
|
||||
} else if (a instanceof MachineSet && b instanceof MachineSet) {
|
||||
return new SetBackedMachineSet(TileInterface.class, Sets.union((MachineSet)a, (MachineSet)b));
|
||||
return new SetBackedMachineSet(TileInterface.class, Sets.union((MachineSet) a, (MachineSet) b));
|
||||
} else {
|
||||
Set<IGridNode> union = new HashSet<>();
|
||||
a.forEach(union::add);
|
||||
@@ -122,36 +122,31 @@ public class CoreModHooks {
|
||||
if (aeStack.getItemStack() != null && aeStack.getItemStack().getItem() instanceof ItemFluidDrop) {
|
||||
FluidStack fluid = ItemFluidDrop.getFluidStack(aeStack.getItemStack());
|
||||
return ItemFluidPacket.newDisplayStack(fluid);
|
||||
}
|
||||
else return aeStack.getItemStack();
|
||||
} else return aeStack.getItemStack();
|
||||
}
|
||||
|
||||
public static long getFluidSize(IAEItemStack aeStack) {
|
||||
if (aeStack.getItemStack() != null && aeStack.getItemStack().getItem() instanceof ItemFluidDrop) {
|
||||
return (long) Math.max(aeStack.getStackSize() / 1000D, 1);
|
||||
}
|
||||
else return aeStack.getStackSize();
|
||||
} else return aeStack.getStackSize();
|
||||
}
|
||||
|
||||
public static void storeFluidItem(CraftingCPUCluster instance) {
|
||||
final IGrid g = Ae2Reflect.getGrid(instance);
|
||||
|
||||
if( g == null )
|
||||
{
|
||||
if (g == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final IStorageGrid sg = g.getCache( IStorageGrid.class );
|
||||
final IStorageGrid sg = g.getCache(IStorageGrid.class);
|
||||
final IMEInventory<IAEItemStack> ii = sg.getItemInventory();
|
||||
final IMEInventory<IAEFluidStack> jj = sg.getFluidInventory();
|
||||
final MECraftingInventory inventory = Ae2Reflect.getCPUInventory(instance);
|
||||
|
||||
for( IAEItemStack is : inventory.getItemList() )
|
||||
{
|
||||
is = inventory.extractItems( is.copy(), Actionable.MODULATE, Ae2Reflect.getCPUSource(instance) );
|
||||
for (IAEItemStack is : inventory.getItemList()) {
|
||||
is = inventory.extractItems(is.copy(), Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
|
||||
|
||||
if( is != null )
|
||||
{
|
||||
if (is != null) {
|
||||
Ae2Reflect.postCPUChange(instance, is, Ae2Reflect.getCPUSource(instance));
|
||||
if (is.getItem() instanceof ItemFluidDrop) {
|
||||
IAEFluidStack fluidDrop = ItemFluidDrop.getAeFluidStack(is);
|
||||
@@ -166,14 +161,12 @@ public class CoreModHooks {
|
||||
}
|
||||
}
|
||||
|
||||
if( is != null )
|
||||
{
|
||||
inventory.injectItems( is, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance) );
|
||||
if (is != null) {
|
||||
inventory.injectItems(is, Actionable.MODULATE, Ae2Reflect.getCPUSource(instance));
|
||||
}
|
||||
}
|
||||
|
||||
if( inventory.getItemList().isEmpty() )
|
||||
{
|
||||
if (inventory.getItemList().isEmpty()) {
|
||||
Ae2Reflect.setCPUInventory(instance, new MECraftingInventory());
|
||||
}
|
||||
|
||||
@@ -201,6 +194,8 @@ public class CoreModHooks {
|
||||
}
|
||||
|
||||
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);
|
||||
return chan == StorageChannel.FLUIDS
|
||||
? Math.min(possible, itemsToMove * FluidCellInventory.singleByteAmount)
|
||||
: Math.min(possible, itemsToMove);
|
||||
}
|
||||
}
|
||||
+10
-9
@@ -27,11 +27,11 @@ public class ContainerInterfaceTerminalTransformer extends FCClassTransformer.Cl
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
if (name.equals("detectAndSendChanges") || name.equals("func_75142_b") || name.equals("regenList")) {
|
||||
return new TransformDetectAndSendChanges(api, super.visitMethod(access, name, desc, signature, exceptions));
|
||||
return new TransformDetectAndSendChanges(
|
||||
api, super.visitMethod(access, name, desc, signature, exceptions));
|
||||
}
|
||||
return super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class TransformDetectAndSendChanges extends MethodVisitor {
|
||||
@@ -43,16 +43,17 @@ public class ContainerInterfaceTerminalTransformer extends FCClassTransformer.Cl
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
if (opcode == Opcodes.INVOKEINTERFACE
|
||||
&& owner.equals("appeng/api/networking/IGrid") && name.equals("getMachines")) {
|
||||
super.visitMethodInsn(Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"getMachines",
|
||||
"(Lappeng/api/networking/IGrid;Ljava/lang/Class;)Lappeng/api/networking/IMachineSet;",
|
||||
false);
|
||||
&& owner.equals("appeng/api/networking/IGrid")
|
||||
&& name.equals("getMachines")) {
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"getMachines",
|
||||
"(Lappeng/api/networking/IGrid;Ljava/lang/Class;)Lappeng/api/networking/IMachineSet;",
|
||||
false);
|
||||
} else {
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loaded 100 of 191 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user