-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
389 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/main/java/com/glodblock/github/client/gui/GuiItemAmountChange.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.glodblock.github.client.gui; | ||
|
||
import appeng.api.storage.ITerminalHost; | ||
import appeng.core.localization.GuiText; | ||
import com.glodblock.github.FluidCraft; | ||
import com.glodblock.github.client.gui.container.ContainerItemAmountChange; | ||
import com.glodblock.github.network.CPacketPatternValueSet; | ||
import com.glodblock.github.network.CPacketSwitchGuis; | ||
import net.minecraft.client.gui.GuiButton; | ||
import net.minecraft.client.resources.I18n; | ||
import net.minecraft.entity.player.InventoryPlayer; | ||
|
||
public class GuiItemAmountChange extends GuiFluidCraftAmount { | ||
|
||
public GuiItemAmountChange(final InventoryPlayer inventoryPlayer, final ITerminalHost te) | ||
{ | ||
super(new ContainerItemAmountChange(inventoryPlayer, te)); | ||
} | ||
|
||
@Override | ||
public void initGui() | ||
{ | ||
super.initGui(); | ||
this.next.displayString = I18n.format("ae2fc.gui.set"); | ||
} | ||
|
||
@Override | ||
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) | ||
{ | ||
super.drawBG(offsetX, offsetY, mouseX, mouseY); | ||
this.next.displayString = I18n.format("ae2fc.gui.set"); | ||
} | ||
|
||
@Override | ||
protected void actionPerformed( final GuiButton btn ) { | ||
try | ||
{ | ||
if( btn == this.originalGuiBtn ) | ||
{ | ||
FluidCraft.proxy.netHandler.sendToServer( new CPacketSwitchGuis( this.originalGui ) ); | ||
} | ||
|
||
if( btn == this.next ) | ||
{ | ||
FluidCraft.proxy.netHandler.sendToServer( new CPacketPatternValueSet(this.originalGui, Integer.parseInt(this.amountToCraft.getText()), ((ContainerItemAmountChange) this.inventorySlots).getValueIndex())); | ||
} | ||
} | ||
catch( final NumberFormatException e ) | ||
{ | ||
// nope.. | ||
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; | ||
|
||
if( isPlus || isMinus ) | ||
{ | ||
this.addQty( this.getQty( btn ) ); | ||
} | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/com/glodblock/github/client/gui/container/ContainerItemAmountChange.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.glodblock.github.client.gui.container; | ||
|
||
import appeng.api.config.SecurityPermissions; | ||
import appeng.api.storage.ITerminalHost; | ||
import appeng.container.AEBaseContainer; | ||
import appeng.container.guisync.GuiSync; | ||
import appeng.container.slot.SlotInaccessible; | ||
import appeng.tile.inventory.AppEngInternalInventory; | ||
import net.minecraft.entity.player.InventoryPlayer; | ||
import net.minecraft.inventory.Slot; | ||
|
||
public class ContainerItemAmountChange extends AEBaseContainer { | ||
|
||
private final Slot patternValue; | ||
@GuiSync(11) | ||
public int valueIndex; | ||
|
||
public ContainerItemAmountChange(final InventoryPlayer ip, final ITerminalHost te ) | ||
{ | ||
super( ip, te ); | ||
this.patternValue = new SlotInaccessible( new AppEngInternalInventory( null, 1 ), 0, 34, 53 ); | ||
this.addSlotToContainer( patternValue ); | ||
} | ||
|
||
@Override | ||
public void detectAndSendChanges() | ||
{ | ||
super.detectAndSendChanges(); | ||
this.verifyPermissions( SecurityPermissions.CRAFT, false ); | ||
} | ||
|
||
public Slot getPatternValue() | ||
{ | ||
return patternValue; | ||
} | ||
|
||
public int getValueIndex() | ||
{ | ||
return valueIndex; | ||
} | ||
|
||
public void setValueIndex( int valueIndex ) | ||
{ | ||
this.valueIndex = valueIndex; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.