diff --git a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java index 9b7ac447f..1a9c3e97c 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java @@ -105,13 +105,35 @@ public class GuiPatternTerm extends GuiMEMonitorable NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.MultiplyByTwo", "1" ) ); } + if( this.x3Btn == btn ) + { + NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.MultiplyByThree", "1" ) ); + } + if( this.divTwoBtn == btn ) + { + NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.DivideByTwo", "1" ) ); + } + if( this.divThreeBtn == btn ) + { + NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.DivideByThree", "1" ) ); + } + if( this.plusOneBtn == btn ) + { + NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.IncreaseByOne", "1" ) ); + } + if( this.minusOneBtn == btn ) + { + NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.DecreaseByOne", "1" ) ); + } - - + if( this.maxCountBtn == btn ) + { + NetworkHandler.instance().sendToServer( new PacketValueConfig( "PatternTerminal.MaximizeCount", "1" ) ); + } if( this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn ) { @@ -151,33 +173,33 @@ public class GuiPatternTerm extends GuiMEMonitorable this.clearBtn.setHalfSize( true ); this.buttonList.add( this.clearBtn ); - this.x2Btn = new GuiImgButton( this.guiLeft + 106, this.guiTop + this.ySize - 152, Settings.ACTIONS, ActionItems.MULTIPLY_BY_TWO ); + this.x3Btn = new GuiImgButton( this.guiLeft + 128, this.guiTop + this.ySize - 158, Settings.ACTIONS, ActionItems.MULTIPLY_BY_THREE ); + this.x3Btn.setHalfSize( true ); + this.buttonList.add( this.x3Btn ); + + this.x2Btn = new GuiImgButton( this.guiLeft + 128, this.guiTop + this.ySize - 148, Settings.ACTIONS, ActionItems.MULTIPLY_BY_TWO ); this.x2Btn.setHalfSize( true ); this.buttonList.add( this.x2Btn ); - 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.plusOneBtn = new GuiImgButton( this.guiLeft + 128, this.guiTop + this.ySize - 138, Settings.ACTIONS, ActionItems.INCREASE_BY_ONE ); + this.plusOneBtn.setHalfSize( true ); + this.buttonList.add( this.plusOneBtn ); - 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.divThreeBtn = new GuiImgButton( this.guiLeft + 100, this.guiTop + this.ySize - 158, Settings.ACTIONS, ActionItems.DIVIDE_BY_THREE ); + this.divThreeBtn.setHalfSize( true ); + this.buttonList.add( this.divThreeBtn ); - 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.divTwoBtn = new GuiImgButton( this.guiLeft + 100, this.guiTop + this.ySize - 148, Settings.ACTIONS, ActionItems.DIVIDE_BY_TWO ); + this.divTwoBtn.setHalfSize( true ); + this.buttonList.add( this.divTwoBtn ); - 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.minusOneBtn = new GuiImgButton( this.guiLeft + 100, this.guiTop + this.ySize - 138, Settings.ACTIONS, ActionItems.DECREASE_BY_ONE ); + this.minusOneBtn.setHalfSize( true ); + this.buttonList.add( this.minusOneBtn ); - 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.maxCountBtn = new GuiImgButton( this.guiLeft + 128, this.guiTop + this.ySize - 108, Settings.ACTIONS, ActionItems.MAX_COUNT ); + this.maxCountBtn.setHalfSize( true ); + this.buttonList.add( this.maxCountBtn ); this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE ); this.buttonList.add( this.encodeBtn ); @@ -190,6 +212,13 @@ public class GuiPatternTerm extends GuiMEMonitorable { this.tabCraftButton.visible = true; this.tabProcessButton.visible = false; + this.x2Btn.visible = false; + this.x3Btn.visible = false; + this.divTwoBtn.visible = false; + this.divThreeBtn.visible = false; + this.plusOneBtn.visible = false; + this.minusOneBtn.visible = false; + this.maxCountBtn.visible = false; if( this.container.substitute ) { @@ -208,6 +237,13 @@ public class GuiPatternTerm extends GuiMEMonitorable this.tabProcessButton.visible = true; this.substitutionsEnabledBtn.visible = false; this.substitutionsDisabledBtn.visible = false; + this.x2Btn.visible = true; + this.x3Btn.visible = true; + this.divTwoBtn.visible = true; + this.divThreeBtn.visible = true; + this.plusOneBtn.visible = true; + this.minusOneBtn.visible = true; + this.maxCountBtn.visible = true; } super.drawFG( offsetX, offsetY, mouseX, mouseY ); diff --git a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java index f0aa390a2..71023ebe5 100644 --- a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java @@ -272,69 +272,207 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA public void multiply(int multiple) { ItemStack[] input = new ItemStack[9]; - ItemStack[] output = new ItemStack[3]; - - input = getInputs(); - output = getOutputs(); boolean canMultiplyInputs = true; boolean canMultiplyOutputs = true; for( int x = 0; x < this.craftingSlots.length; x++ ) { input[x] = this.craftingSlots[x].getStack(); - if( input[x].getCount() * multiple > 64 ) + if( !input[x].isEmpty() && input[x].getCount() * multiple > 64 ) { canMultiplyInputs = false; } } - - if( this.isCraftingMode() ) + for( final OptionalSlotFake outputSlot : this.outputSlots ) { - output[0] = this.outputSlots[0].getStack(); - if( output[0].getCount() * multiple > 64 ) + final ItemStack out = outputSlot.getStack(); + if( !out.isEmpty() && out.getCount() * multiple > 64 ) { canMultiplyOutputs = false; } } - - else - { - int outSlot=0; - for( final OptionalSlotFake outputSlot : this.outputSlots ) - { - final ItemStack out = outputSlot.getStack(); - if( out.getCount() * multiple > 64 ) - { - canMultiplyOutputs = false; - } - outSlot++; - } - } - if( canMultiplyInputs && canMultiplyOutputs ) { - for( int x = 0; x < this.craftingSlots.length; x++ ) + for( SlotFakeCraftingMatrix craftingSlot : this.craftingSlots ) { - ItemStack stack = this.craftingSlots[x].getStack(); - this.craftingSlots[x].getStack().setCount( stack.getCount() * multiple ); + ItemStack stack = craftingSlot.getStack(); + if( !stack.isEmpty() ) + craftingSlot.getStack().setCount( stack.getCount() * multiple ); } - - if( this.isCraftingMode() ) + for( OptionalSlotFake outputSlot : this.outputSlots ) { - ItemStack stackOut = this.craftingSlots[0].getStack(); - - this.outputSlots[0].getStack().setCount( stackOut.getCount() * multiple); - } - else - { - for( int x = 0; x < this.outputSlots.length; x++ ) - { - ItemStack stack = this.outputSlots[x].getStack(); - this.outputSlots[x].getStack().setCount( stack.getCount() * multiple ); - } + ItemStack stack = outputSlot.getStack(); + if( !stack.isEmpty() ) + outputSlot.getStack().setCount( stack.getCount() * multiple ); } } + } + public void divide(int divide) + { + ItemStack[] input = new ItemStack[9]; + boolean canDivideInputs = true; + boolean canDivideOutputs = true; + + for( int x = 0; x < this.craftingSlots.length; x++ ) + { + input[x] = this.craftingSlots[x].getStack(); + if( !input[x].isEmpty() && input[x].getCount() % divide != 0 ) + { + canDivideInputs = false; + } + } + for( final OptionalSlotFake outputSlot : this.outputSlots ) + { + final ItemStack out = outputSlot.getStack(); + if( !out.isEmpty() && out.getCount() % divide != 0 ) + { + canDivideOutputs = false; + } + } + if( canDivideInputs && canDivideOutputs ) + { + for( SlotFakeCraftingMatrix craftingSlot : this.craftingSlots ) + { + ItemStack stack = craftingSlot.getStack(); + if( !stack.isEmpty() ) + craftingSlot.getStack().setCount( stack.getCount() / divide ); + } + for( OptionalSlotFake outputSlot : this.outputSlots ) + { + ItemStack stack = outputSlot.getStack(); + if( !stack.isEmpty() ) + outputSlot.getStack().setCount( stack.getCount() / divide ); + } + } + } + + public void increase(int increase) + { + ItemStack[] input = new ItemStack[9]; + boolean canIncreaseInputs = true; + boolean canIncreaseOutputs = true; + + for( int x = 0; x < this.craftingSlots.length; x++ ) + { + input[x] = this.craftingSlots[x].getStack(); + if( !input[x].isEmpty() && input[x].getCount() + increase > 64 ) + { + canIncreaseInputs = false; + } + } + for( final OptionalSlotFake outputSlot : this.outputSlots ) + { + final ItemStack out = outputSlot.getStack(); + if( !out.isEmpty() && out.getCount() + increase > 64 ) + { + canIncreaseOutputs = false; + } + } + if( canIncreaseInputs && canIncreaseOutputs ) + { + for( SlotFakeCraftingMatrix craftingSlot : this.craftingSlots ) + { + ItemStack stack = craftingSlot.getStack(); + if( !stack.isEmpty() ) + craftingSlot.getStack().setCount( stack.getCount() + increase ); + } + for( OptionalSlotFake outputSlot : this.outputSlots ) + { + ItemStack stack = outputSlot.getStack(); + if( !stack.isEmpty() ) + outputSlot.getStack().setCount( stack.getCount() + increase ); + } + } + } + + public void decrease(int decrease) + { + ItemStack[] input = new ItemStack[9]; + boolean canDecreaseInputs = true; + boolean canDecreaseOutputs = true; + + for( int x = 0; x < this.craftingSlots.length; x++ ) + { + input[x] = this.craftingSlots[x].getStack(); + if( !input[x].isEmpty() && input[x].getCount() - decrease < 1 ) + { + canDecreaseInputs = false; + } + } + for( final OptionalSlotFake outputSlot : this.outputSlots ) + { + final ItemStack out = outputSlot.getStack(); + if( !out.isEmpty() && out.getCount() - decrease < 1 ) + { + canDecreaseOutputs = false; + } + } + if( canDecreaseInputs && canDecreaseOutputs ) + { + for( SlotFakeCraftingMatrix craftingSlot : this.craftingSlots ) + { + ItemStack stack = craftingSlot.getStack(); + if( !stack.isEmpty() ) + craftingSlot.getStack().setCount( stack.getCount() - decrease ); + } + for( OptionalSlotFake outputSlot : this.outputSlots ) + { + ItemStack stack = outputSlot.getStack(); + if( !stack.isEmpty() ) + outputSlot.getStack().setCount( stack.getCount() - decrease ); + } + } + } + + public void maximizeCount() + { + ItemStack[] input = new ItemStack[9]; + boolean canGrowInputs = true; + boolean canGrowOutputs = true; + int maxInputStackGrowth = 0; + int maxOutputStackGrowth = 0; + + + for( int x = 0; x < this.craftingSlots.length; x++ ) + { + input[x] = this.craftingSlots[x].getStack(); + if( !input[x].isEmpty() && 64 - input[x].getCount() > maxInputStackGrowth ) + { + maxInputStackGrowth = 64 - input[x].getCount(); + } + if( !input[x].isEmpty() && input[x].getCount() + maxInputStackGrowth > 64 ) + { + canGrowInputs = false; + } + } + for( final OptionalSlotFake outputSlot : this.outputSlots ) + { + final ItemStack out = outputSlot.getStack(); + { + maxOutputStackGrowth = 64 - out.getCount(); + } + if( !out.isEmpty() && out.getCount() + maxOutputStackGrowth > 64 ) + { + canGrowOutputs = false; + } + } + if( canGrowInputs && canGrowOutputs ) + { + int maxStackGrowth = Math.min(maxInputStackGrowth,maxOutputStackGrowth); + for( SlotFakeCraftingMatrix craftingSlot : this.craftingSlots ) + { + ItemStack stack = craftingSlot.getStack(); + if( !stack.isEmpty() ) + craftingSlot.getStack().setCount( stack.getCount() + maxStackGrowth ); + } + for( OptionalSlotFake outputSlot : this.outputSlots ) + { + ItemStack stack = outputSlot.getStack(); + if( !stack.isEmpty() ) + outputSlot.getStack().setCount( stack.getCount() + maxStackGrowth ); + } + } } private ItemStack[] getInputs() diff --git a/src/main/java/appeng/core/sync/packets/PacketValueConfig.java b/src/main/java/appeng/core/sync/packets/PacketValueConfig.java index 2d54c3d93..08648d22f 100644 --- a/src/main/java/appeng/core/sync/packets/PacketValueConfig.java +++ b/src/main/java/appeng/core/sync/packets/PacketValueConfig.java @@ -185,10 +185,30 @@ public class PacketValueConfig extends AppEngPacket { cpt.multiply(2); } - - - - + else if( this.Name.equals( "PatternTerminal.MultiplyByThree" ) ) + { + cpt.multiply(3); + } + else if( this.Name.equals( "PatternTerminal.DivideByTwo" ) ) + { + cpt.divide(2); + } + else if( this.Name.equals( "PatternTerminal.DivideByThree" ) ) + { + cpt.divide(3); + } + else if( this.Name.equals( "PatternTerminal.IncreaseByOne" ) ) + { + cpt.increase(1); + } + else if( this.Name.equals( "PatternTerminal.DecreaseByOne" ) ) + { + cpt.decrease(1); + } + else if( this.Name.equals( "PatternTerminal.MaximizeCount" ) ) + { + cpt.maximizeCount(); + } else if( this.Name.equals( "PatternTerminal.Substitute" ) ) { cpt.getPatternTerminal().setSubstitution( this.Value.equals( "1" ) ); diff --git a/src/main/resources/assets/appliedenergistics2/lang/en_us.lang b/src/main/resources/assets/appliedenergistics2/lang/en_us.lang index 2e406ce05..8cb9956e7 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/en_us.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/en_us.lang @@ -349,6 +349,20 @@ gui.tooltips.appliedenergistics2.FilterModeClear=Clear on each opening. gui.tooltips.appliedenergistics2.ItemsStored=Items Stored: %s gui.tooltips.appliedenergistics2.ItemsRequestable=Items Requestable: %s gui.tooltips.appliedenergistics2.P2PFrequency=Frequency: %s +gui.tooltips.appliedenergistics2.MultiplyByTwo=Double the items set +gui.tooltips.appliedenergistics2.MultiplyByTwoDesc=Will try to double the items set in the crafting slots +gui.tooltips.appliedenergistics2.MultiplyByThree=Tripe the items set +gui.tooltips.appliedenergistics2.MultiplyByThreeDesc=Will try to triple the items set in the crafting slots +gui.tooltips.appliedenergistics2.IncreaseByOne=Add one +gui.tooltips.appliedenergistics2.IncreaseByOneDesc=Will try to add increase the items set in the crafting slots by one. DOES NOT MAINTAIN INGREDIENT RATIO +gui.tooltips.appliedenergistics2.DivideByTwo=Divide items set by two +gui.tooltips.appliedenergistics2.DivideByTwoDesc=Will try to divide by 2 the items set in the crafting slots +gui.tooltips.appliedenergistics2.DivideByThree=Divide items set by three +gui.tooltips.appliedenergistics2.DivideByThreeDesc=Will try to divide by 3 the items set in the crafting slots +gui.tooltips.appliedenergistics2.DecreaseByOne=Decrease one +gui.tooltips.appliedenergistics2.DecreaseByOneDesc=Will try to add decrease the items set in the crafting slots by one DOES NOT MAINTAIN INGREDIENT RATIO +gui.tooltips.appliedenergistics2.MaxCount=Maximize slot count +gui.tooltips.appliedenergistics2.MaxCountDesc=Will maximize the output maintaing the input ratio of the items set in the crafting slots // Units gui.appliedenergistics2.units.appliedenergstics=AE diff --git a/src/main/resources/assets/appliedenergistics2/textures/guis/states.png b/src/main/resources/assets/appliedenergistics2/textures/guis/states.png index e21fd6801..6afe646bc 100644 Binary files a/src/main/resources/assets/appliedenergistics2/textures/guis/states.png and b/src/main/resources/assets/appliedenergistics2/textures/guis/states.png differ