mirror of
https://github.com/GTNewHorizons/ThaumicEnergistics.git
synced 2026-10-26 14:33:46 +00:00
Cleanup and Assembler fix
Fixes #219: ACT buttons can be right-clicked to go backwards. Cleaned up some GUI code. Really fixed #216.
This commit is contained in:
1 parent
b7a3b50835
commit
a17f24cbf1
16 files changed
+642
-483
No files matched your search
+6
-1
@@ -1,4 +1,9 @@
|
||||
7/22/2015 0.8.10.8
|
||||
7/23/2015 0.8.10.8
|
||||
Fixes #219: ACT buttons can be right-clicked to go backwards.
|
||||
Cleaned up some GUI code.
|
||||
Really fixed #216.
|
||||
|
||||
7/22/2015 0.8.10.8
|
||||
Added E.V.C GUI.
|
||||
API Change: Tile whitelist now requires capacity, and includes a dual add method.
|
||||
Fixes #216: Arcane crafting patterns can no longer substitute items, must match exactly.
|
||||
|
||||
@@ -144,7 +144,7 @@ public class GuiArcaneAssembler
|
||||
this.drawVisBar( this.progressAspect, ( (ContainerArcaneAssembler)this.inventorySlots ).assembler.getPercentComplete() );
|
||||
|
||||
// Call super
|
||||
super.drawGuiContainerBackgroundLayer( alpha, mouseX, mouseY );
|
||||
super.drawAEToolAndUpgradeSlots( alpha, mouseX, mouseY );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -194,6 +194,109 @@ public class GuiArcaneCraftingTerminal
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the click was a region deposit.
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @return True if click was handled.
|
||||
*/
|
||||
private boolean clickHandler_RegionDeposit( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Is the player holding the space key?
|
||||
if( Keyboard.isKeyDown( Keyboard.KEY_SPACE ) )
|
||||
{
|
||||
// Get the slot the mouse is over
|
||||
Slot slotClicked = this.getSlotAtPosition( mouseX, mouseY );
|
||||
|
||||
// Was there a slot under the mouse?
|
||||
if( slotClicked != null )
|
||||
{
|
||||
// Ask the server to move the inventory
|
||||
new PacketServerArcaneCraftingTerminal().createRequestDepositRegion( this.player, slotClicked.slotNumber ).sendPacketToServer();
|
||||
|
||||
// Do not pass to super
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the click was inside the search box.
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @param mouseButton
|
||||
* @return True if click was handled.
|
||||
*/
|
||||
private boolean clickHandler_SearchBox( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Was the mouse right-clicked over the search field?
|
||||
if( ( mouseButton == GuiHelper.MOUSE_BUTTON_RIGHT ) &&
|
||||
GuiHelper.INSTANCE.isPointInGuiRegion( AbstractGuiConstantsACT.SEARCH_POS_Y, AbstractGuiConstantsACT.SEARCH_POS_X,
|
||||
AbstractGuiConstantsACT.SEARCH_HEIGHT, AbstractGuiConstantsACT.SEARCH_WIDTH, mouseX, mouseY, this.guiLeft, this.guiTop ) )
|
||||
{
|
||||
// Clear the search field
|
||||
this.searchField.setText( "" );
|
||||
|
||||
// Update the repo
|
||||
this.repo.searchString = "";
|
||||
|
||||
// Repo needs update
|
||||
this.viewNeedsUpdate = true;
|
||||
|
||||
// Inform search field.
|
||||
this.searchField.mouseClicked( mouseX - this.guiLeft, mouseY - this.guiTop, mouseButton );
|
||||
|
||||
// Do not pass to super
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the click was inside the widgets.
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @param mouseButton
|
||||
* @return True if click was handled.
|
||||
*/
|
||||
private boolean clickHandler_Widgets( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Was the click inside the ME grid?
|
||||
if( GuiHelper.INSTANCE.isPointInGuiRegion( AbstractGuiConstantsACT.ME_ITEM_POS_Y, AbstractGuiConstantsACT.ME_ITEM_POS_X,
|
||||
this.numberOfWidgetRows * AbstractGuiConstantsACT.ME_ROW_HEIGHT, AbstractGuiConstantsACT.ME_GRID_WIDTH, mouseX, mouseY, this.guiLeft,
|
||||
this.guiTop ) )
|
||||
{
|
||||
// Click + empty hand is extract
|
||||
boolean doExtract = ( this.player.inventory.getItemStack() == null );
|
||||
|
||||
// Shift+Right click is extract
|
||||
doExtract |= ( Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) && ( mouseButton == GuiHelper.MOUSE_BUTTON_RIGHT ) );
|
||||
|
||||
// Extracting?
|
||||
if( doExtract )
|
||||
{
|
||||
// Search for the widget the mouse is over, and send extract request.
|
||||
this.sendItemWidgetClicked( mouseX, mouseY, mouseButton );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inform the server the user would like to deposit the currently held item into the ME network.
|
||||
new PacketServerArcaneCraftingTerminal().createRequestDeposit( this.player, mouseButton ).sendPacketToServer();
|
||||
}
|
||||
|
||||
// Do not pass to super
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts or inserts an item to/from the player held stack based on the
|
||||
* direction the mouse wheel was scrolled.
|
||||
@@ -729,71 +832,25 @@ public class GuiArcaneCraftingTerminal
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Was the click inside the ME grid?
|
||||
if( GuiHelper.INSTANCE.isPointInGuiRegion( AbstractGuiConstantsACT.ME_ITEM_POS_Y, AbstractGuiConstantsACT.ME_ITEM_POS_X,
|
||||
this.numberOfWidgetRows * AbstractGuiConstantsACT.ME_ROW_HEIGHT, AbstractGuiConstantsACT.ME_GRID_WIDTH, mouseX, mouseY, this.guiLeft,
|
||||
this.guiTop ) )
|
||||
// Handled by the widget area?
|
||||
if( clickHandler_Widgets( mouseX, mouseY, mouseButton ) )
|
||||
{
|
||||
// Click + empty hand is extract
|
||||
boolean doExtract = ( this.player.inventory.getItemStack() == null );
|
||||
|
||||
// Shift+Right click is extract
|
||||
doExtract |= ( Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) && ( mouseButton == GuiHelper.MOUSE_BUTTON_RIGHT ) );
|
||||
|
||||
// Extracting?
|
||||
if( doExtract )
|
||||
{
|
||||
// Search for the widget the mouse is over, and send extract request.
|
||||
this.sendItemWidgetClicked( mouseX, mouseY, mouseButton );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inform the server the user would like to deposit the currently held item into the ME network.
|
||||
new PacketServerArcaneCraftingTerminal().createRequestDeposit( this.player, mouseButton ).sendPacketToServer();
|
||||
}
|
||||
|
||||
// Do not pass to super
|
||||
return;
|
||||
}
|
||||
|
||||
// Is the player holding the space key?
|
||||
if( Keyboard.isKeyDown( Keyboard.KEY_SPACE ) )
|
||||
// Handled by region deposit?
|
||||
if( clickHandler_RegionDeposit( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the slot the mouse is over
|
||||
Slot slotClicked = this.getSlotAtPosition( mouseX, mouseY );
|
||||
|
||||
// Was there a slot under the mouse?
|
||||
if( slotClicked != null )
|
||||
{
|
||||
// Ask the server to move the inventory
|
||||
new PacketServerArcaneCraftingTerminal().createRequestDepositRegion( this.player, slotClicked.slotNumber ).sendPacketToServer();
|
||||
|
||||
// Do not pass to super
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Was the mouse right-clicked over the search field?
|
||||
if( ( mouseButton == GuiHelper.MOUSE_BUTTON_RIGHT ) &&
|
||||
GuiHelper.INSTANCE.isPointInGuiRegion( AbstractGuiConstantsACT.SEARCH_POS_Y, AbstractGuiConstantsACT.SEARCH_POS_X,
|
||||
AbstractGuiConstantsACT.SEARCH_HEIGHT, AbstractGuiConstantsACT.SEARCH_WIDTH, mouseX, mouseY, this.guiLeft, this.guiTop ) )
|
||||
{
|
||||
// Clear the search field
|
||||
this.searchField.setText( "" );
|
||||
|
||||
// Update the repo
|
||||
this.repo.searchString = "";
|
||||
|
||||
// Repo needs update
|
||||
this.viewNeedsUpdate = true;
|
||||
|
||||
// Inform search field.
|
||||
this.searchField.mouseClicked( mouseX - this.guiLeft, mouseY - this.guiTop, mouseButton );
|
||||
|
||||
// Do not pass to super
|
||||
return;
|
||||
}
|
||||
|
||||
// Handled by search box?
|
||||
if( clickHandler_SearchBox( mouseX, mouseY, mouseButton ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get search mode
|
||||
SearchBoxMode searchBoxMode = (SearchBoxMode)AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||
|
||||
// Inform search field of click if auto mode is not on
|
||||
@@ -807,24 +864,29 @@ public class GuiArcaneCraftingTerminal
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onScrollbarMoved()
|
||||
{
|
||||
// Update the widgets
|
||||
this.updateMEWidgets();
|
||||
|
||||
// Clear the tooltip
|
||||
this.tooltip.clear();
|
||||
this.lastTooltipUpdateTime = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed( final GuiButton button )
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
boolean sortingChanged = false;
|
||||
|
||||
boolean wasLeftClick = true;
|
||||
|
||||
// Which button was clicked?
|
||||
switch ( mouseButton )
|
||||
{
|
||||
case GuiHelper.MOUSE_BUTTON_LEFT:
|
||||
// Already true
|
||||
break;
|
||||
|
||||
case GuiHelper.MOUSE_BUTTON_RIGHT:
|
||||
// Set to false
|
||||
wasLeftClick = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Don't handle any other buttons
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( button.id )
|
||||
{
|
||||
// Clear grid
|
||||
@@ -838,18 +900,18 @@ public class GuiArcaneCraftingTerminal
|
||||
switch ( this.sortingOrder )
|
||||
{
|
||||
case AMOUNT:
|
||||
this.sortingOrder = SortOrder.MOD;
|
||||
this.sortingOrder = ( wasLeftClick ? SortOrder.MOD : SortOrder.NAME );
|
||||
break;
|
||||
|
||||
case INVTWEAKS:
|
||||
break;
|
||||
|
||||
case MOD:
|
||||
this.sortingOrder = SortOrder.NAME;
|
||||
this.sortingOrder = ( wasLeftClick ? SortOrder.NAME : SortOrder.AMOUNT );
|
||||
break;
|
||||
|
||||
case NAME:
|
||||
this.sortingOrder = SortOrder.AMOUNT;
|
||||
this.sortingOrder = ( wasLeftClick ? SortOrder.AMOUNT : SortOrder.MOD );
|
||||
break;
|
||||
}
|
||||
sortingChanged = true;
|
||||
@@ -873,20 +935,10 @@ public class GuiArcaneCraftingTerminal
|
||||
|
||||
// View type
|
||||
case AbstractGuiConstantsACT.BUTTON_VIEW_TYPE_ID:
|
||||
switch ( this.viewMode )
|
||||
{
|
||||
case ALL:
|
||||
this.viewMode = ViewItems.STORED;
|
||||
break;
|
||||
|
||||
case STORED:
|
||||
this.viewMode = ViewItems.CRAFTABLE;
|
||||
break;
|
||||
// Rotate view mode
|
||||
this.viewMode = Platform.rotateEnum( this.viewMode, !wasLeftClick, Settings.VIEW_MODE.getPossibleValues() );
|
||||
|
||||
case CRAFTABLE:
|
||||
this.viewMode = ViewItems.ALL;
|
||||
break;
|
||||
}
|
||||
sortingChanged = true;
|
||||
break;
|
||||
|
||||
@@ -926,7 +978,7 @@ public class GuiArcaneCraftingTerminal
|
||||
case AbstractGuiConstantsACT.BUTTON_SEARCH_MODE_ID:
|
||||
// Rotate search mode
|
||||
SearchBoxMode searchBoxMode = (SearchBoxMode)AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||
searchBoxMode = Platform.rotateEnum( searchBoxMode, false, Settings.SEARCH_MODE.getPossibleValues() );
|
||||
searchBoxMode = Platform.rotateEnum( searchBoxMode, !wasLeftClick, Settings.SEARCH_MODE.getPossibleValues() );
|
||||
|
||||
// Set focus
|
||||
this.searchField.setFocused( ( searchBoxMode == SearchBoxMode.AUTOSEARCH ) || ( searchBoxMode == SearchBoxMode.NEI_AUTOSEARCH ) );
|
||||
@@ -959,6 +1011,17 @@ public class GuiArcaneCraftingTerminal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onScrollbarMoved()
|
||||
{
|
||||
// Update the widgets
|
||||
this.updateMEWidgets();
|
||||
|
||||
// Clear the tooltip
|
||||
this.tooltip.clear();
|
||||
this.lastTooltipUpdateTime = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws all screen elements, specifically calling on TC to draw the aspects
|
||||
* of whatever the mouse is over.
|
||||
|
||||
@@ -566,22 +566,6 @@ public class GuiEssentiaCellTerminal
|
||||
this.currentScroll = this.scrollBar.getCurrentScroll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed( final GuiButton button )
|
||||
{
|
||||
// Is the button the sort mode button?
|
||||
if( button.id == GuiEssentiaCellTerminal.SORT_MODE_BUTTON_ID )
|
||||
{
|
||||
// Request update from server
|
||||
new PacketServerEssentiaCellTerminal().createRequestChangeSortMode( this.player,
|
||||
( this.sortMode == ComparatorMode.MODE_ALPHABETIC ? ComparatorMode.MODE_AMOUNT : ComparatorMode.MODE_ALPHABETIC ) )
|
||||
.sendPacketToServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the widgets
|
||||
*
|
||||
@@ -736,6 +720,22 @@ public class GuiEssentiaCellTerminal
|
||||
GuiEssentiaCellTerminal.SORT_MODE_BUTTON_SIZE, GuiEssentiaCellTerminal.SORT_MODE_BUTTON_SIZE ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Is the button the sort mode button?
|
||||
if( button.id == GuiEssentiaCellTerminal.SORT_MODE_BUTTON_ID )
|
||||
{
|
||||
// Request update from server
|
||||
new PacketServerEssentiaCellTerminal().createRequestChangeSortMode( this.player,
|
||||
( this.sortMode == ComparatorMode.MODE_ALPHABETIC ? ComparatorMode.MODE_AMOUNT : ComparatorMode.MODE_ALPHABETIC ) )
|
||||
.sendPacketToServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server sends a full list of network aspects.
|
||||
*
|
||||
|
||||
@@ -162,6 +162,52 @@ public class GuiEssentiaCellWorkbench
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiEssentiaCellWorkbench.TITLE_POS_X, GuiEssentiaCellWorkbench.TITLE_POS_Y, 0 );
|
||||
|
||||
// Draw the widgets
|
||||
SimpleAspectWidget widgetUnderMouse = null, currentWidget;
|
||||
for( int index = 0; index < GuiEssentiaCellWorkbench.NUMBER_OF_WIDGETS; index++ )
|
||||
{
|
||||
// Get the widget
|
||||
currentWidget = this.partitionWidgets[index];
|
||||
|
||||
// Draw the widget
|
||||
currentWidget.drawWidget();
|
||||
|
||||
// Is the mouse over it?
|
||||
if( ( widgetUnderMouse == null ) && ( currentWidget.isMouseOverWidget( mouseX, mouseY ) ) )
|
||||
{
|
||||
// Mark this widget as the one under the mouse
|
||||
widgetUnderMouse = currentWidget;
|
||||
}
|
||||
}
|
||||
|
||||
// Is there a widget under the mouse?
|
||||
if( widgetUnderMouse != null )
|
||||
{
|
||||
// Get the widgets tooltip
|
||||
widgetUnderMouse.getTooltip( this.tooltip );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add tooltip from buttons
|
||||
this.addTooltipFromButtons( mouseX, mouseY );
|
||||
}
|
||||
|
||||
// Draw the tooltip
|
||||
if( this.tooltip.size() > 0 )
|
||||
{
|
||||
this.drawTooltip( mouseX - this.guiLeft, mouseY - this.guiTop, true );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
@@ -204,74 +250,6 @@ public class GuiEssentiaCellWorkbench
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed( final GuiButton button )
|
||||
{
|
||||
// Ensure there is a button
|
||||
if( button == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Which button was clicked?
|
||||
switch ( button.id )
|
||||
{
|
||||
case GuiEssentiaCellWorkbench.BUTTON_CLEAR_ID:
|
||||
new PacketServerEssentiaCellWorkbench().createRequestClearPartitioning( this.player, this.workbench ).sendPacketToServer();
|
||||
break;
|
||||
|
||||
case GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_ID:
|
||||
new PacketServerEssentiaCellWorkbench().createRequestPartitionToContents( this.player, this.workbench ).sendPacketToServer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiEssentiaCellWorkbench.TITLE_POS_X, GuiEssentiaCellWorkbench.TITLE_POS_Y, 0 );
|
||||
|
||||
// Draw the widgets
|
||||
SimpleAspectWidget widgetUnderMouse = null, currentWidget;
|
||||
for( int index = 0; index < GuiEssentiaCellWorkbench.NUMBER_OF_WIDGETS; index++ )
|
||||
{
|
||||
// Get the widget
|
||||
currentWidget = this.partitionWidgets[index];
|
||||
|
||||
// Draw the widget
|
||||
currentWidget.drawWidget();
|
||||
|
||||
// Is the mouse over it?
|
||||
if( ( widgetUnderMouse == null ) && ( currentWidget.isMouseOverWidget( mouseX, mouseY ) ) )
|
||||
{
|
||||
// Mark this widget as the one under the mouse
|
||||
widgetUnderMouse = currentWidget;
|
||||
}
|
||||
}
|
||||
|
||||
// Is there a widget under the mouse?
|
||||
if( widgetUnderMouse != null )
|
||||
{
|
||||
// Get the widgets tooltip
|
||||
widgetUnderMouse.getTooltip( this.tooltip );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add tooltip from buttons
|
||||
this.addTooltipFromButtons( mouseX, mouseY );
|
||||
}
|
||||
|
||||
// Draw the tooltip
|
||||
if( this.tooltip.size() > 0 )
|
||||
{
|
||||
this.drawTooltip( mouseX - this.guiLeft, mouseY - this.guiTop, true );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
@@ -309,6 +287,22 @@ public class GuiEssentiaCellWorkbench
|
||||
new PacketServerEssentiaCellWorkbench().createRequestGetPartitionList( this.player, this.workbench ).sendPacketToServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Which button was clicked?
|
||||
switch ( button.id )
|
||||
{
|
||||
case GuiEssentiaCellWorkbench.BUTTON_CLEAR_ID:
|
||||
new PacketServerEssentiaCellWorkbench().createRequestClearPartitioning( this.player, this.workbench ).sendPacketToServer();
|
||||
break;
|
||||
|
||||
case GuiEssentiaCellWorkbench.BUTTON_PARTITION_CURRENT_ID:
|
||||
new PacketServerEssentiaCellWorkbench().createRequestPartitionToContents( this.player, this.workbench ).sendPacketToServer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the partition widgets to show the aspects in the specified list.
|
||||
*/
|
||||
|
||||
@@ -227,74 +227,11 @@ public class GuiEssentiaIO
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.drawGuiContainerBackgroundLayer( alpha, mouseX, mouseY );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
|
||||
// Loop over all widgets
|
||||
for( WidgetAspectSlot aspectSlot : this.aspectSlotList )
|
||||
{
|
||||
// Is the mouse over this widget?
|
||||
if( aspectSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( this.player.inventory.getItemStack() );
|
||||
|
||||
// Is there an aspect?
|
||||
if( itemAspect != null )
|
||||
{
|
||||
// Are we already filtering for this aspect?
|
||||
if( this.filteredAspects.contains( itemAspect ) )
|
||||
{
|
||||
// Ignore
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Inform the slot it was clicked
|
||||
aspectSlot.mouseClicked( itemAspect );
|
||||
|
||||
// Stop searching
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is pressed
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed( final GuiButton button )
|
||||
{
|
||||
// Call super
|
||||
super.actionPerformed( button );
|
||||
|
||||
// Was the clicked button the redstone mode button?
|
||||
if( button.id == GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_ID )
|
||||
{
|
||||
new PacketServerEssentiaIOBus().createRequestChangeRedstoneMode( this.player, this.part ).sendPacketToServer();
|
||||
}
|
||||
// Void button?
|
||||
else if( button.id == GuiEssentiaIO.ALLOW_VOID_BUTTON_ID )
|
||||
{
|
||||
if( this.part instanceof AEPartEssentiaExportBus )
|
||||
{
|
||||
new PacketServerEssentiaIOBus().createRequestChangeVoidMode( this.player, (AEPartEssentiaExportBus)this.part ).sendPacketToServer();
|
||||
}
|
||||
}
|
||||
super.drawAEToolAndUpgradeSlots( alpha, mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Call super
|
||||
super.drawGuiContainerForegroundLayer( mouseX, mouseY );
|
||||
@@ -338,6 +275,45 @@ public class GuiEssentiaIO
|
||||
this.drawTooltip( mouseX - this.guiLeft, mouseY - this.guiTop, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
|
||||
// Loop over all widgets
|
||||
for( WidgetAspectSlot aspectSlot : this.aspectSlotList )
|
||||
{
|
||||
// Is the mouse over this widget?
|
||||
if( aspectSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( this.player.inventory.getItemStack() );
|
||||
|
||||
// Is there an aspect?
|
||||
if( itemAspect != null )
|
||||
{
|
||||
// Are we already filtering for this aspect?
|
||||
if( this.filteredAspects.contains( itemAspect ) )
|
||||
{
|
||||
// Ignore
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Inform the slot it was clicked
|
||||
aspectSlot.mouseClicked( itemAspect );
|
||||
|
||||
// Stop searching
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getConfigState()
|
||||
{
|
||||
@@ -390,6 +366,30 @@ public class GuiEssentiaIO
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is pressed
|
||||
*/
|
||||
@Override
|
||||
public void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.actionPerformed( button );
|
||||
|
||||
// Was the clicked button the redstone mode button?
|
||||
if( button.id == GuiEssentiaIO.REDSTONE_CONTROL_BUTTON_ID )
|
||||
{
|
||||
new PacketServerEssentiaIOBus().createRequestChangeRedstoneMode( this.player, this.part ).sendPacketToServer();
|
||||
}
|
||||
// Void button?
|
||||
else if( button.id == GuiEssentiaIO.ALLOW_VOID_BUTTON_ID )
|
||||
{
|
||||
if( this.part instanceof AEPartEssentiaExportBus )
|
||||
{
|
||||
new PacketServerEssentiaIOBus().createRequestChangeVoidMode( this.player, (AEPartEssentiaExportBus)this.part ).sendPacketToServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server sends a filter size update.
|
||||
*
|
||||
|
||||
@@ -223,6 +223,45 @@ public class GuiEssentiaLevelEmitter
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, GuiEssentiaLevelEmitter.GUI_WIDTH, GuiEssentiaLevelEmitter.GUI_HEIGHT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( AEPartsEnum.EssentiaLevelEmitter.getLocalizedName(), GuiEssentiaLevelEmitter.TITLE_POS_X,
|
||||
GuiEssentiaLevelEmitter.TITLE_POS_Y, 0 );
|
||||
|
||||
// Draw underlay when mouse is over slot.
|
||||
if( this.aspectFilterSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Draw underlay
|
||||
this.aspectFilterSlot.drawMouseHoverUnderlay();
|
||||
|
||||
// Get tooltip
|
||||
this.aspectFilterSlot.getTooltip( this.tooltip );
|
||||
}
|
||||
|
||||
// Draw the filter widget
|
||||
this.aspectFilterSlot.drawWidget();
|
||||
|
||||
// Draw the text field
|
||||
this.amountField.drawTextBox();
|
||||
|
||||
if( this.tooltip.size() == 0 )
|
||||
{
|
||||
// Add the tooltip from the buttons
|
||||
this.addTooltipFromButtons( mouseX, mouseY );
|
||||
}
|
||||
|
||||
if( this.tooltip.size() > 0 )
|
||||
{
|
||||
// Draw the tooltip
|
||||
this.drawTooltip( mouseX - this.guiLeft, mouseY - this.guiTop, true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player types a key
|
||||
*/
|
||||
@@ -271,77 +310,6 @@ public class GuiEssentiaLevelEmitter
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed( final GuiButton button )
|
||||
{
|
||||
// Get the index of the button that was clicked
|
||||
int index = button.id;
|
||||
|
||||
// Was one of the amount buttons pressed?
|
||||
if( ( index >= 0 ) && ( index < GuiEssentiaLevelEmitter.BUTTON_LABELS.length ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
// Read the adjustment
|
||||
int adjustment = Integer.parseInt( button.displayString );
|
||||
|
||||
// Update the server
|
||||
new PacketServerEssentiaEmitter().createWantedAmountAdjustment( adjustment, this.part, this.player ).sendPacketToServer();
|
||||
}
|
||||
catch( NumberFormatException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
// Was the redstone mode button pressed?
|
||||
else if( index == GuiEssentiaLevelEmitter.REDSTONE_MODE_BUTTON_INDEX )
|
||||
{
|
||||
// Update the server
|
||||
new PacketServerEssentiaEmitter().createRedstoneModeToggle( this.part, this.player ).sendPacketToServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( AEPartsEnum.EssentiaLevelEmitter.getLocalizedName(), GuiEssentiaLevelEmitter.TITLE_POS_X,
|
||||
GuiEssentiaLevelEmitter.TITLE_POS_Y, 0 );
|
||||
|
||||
// Draw underlay when mouse is over slot.
|
||||
if( this.aspectFilterSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Draw underlay
|
||||
this.aspectFilterSlot.drawMouseHoverUnderlay();
|
||||
|
||||
// Get tooltip
|
||||
this.aspectFilterSlot.getTooltip( this.tooltip );
|
||||
}
|
||||
|
||||
// Draw the filter widget
|
||||
this.aspectFilterSlot.drawWidget();
|
||||
|
||||
// Draw the text field
|
||||
this.amountField.drawTextBox();
|
||||
|
||||
if( this.tooltip.size() == 0 )
|
||||
{
|
||||
// Add the tooltip from the buttons
|
||||
this.addTooltipFromButtons( mouseX, mouseY );
|
||||
}
|
||||
|
||||
if( this.tooltip.size() > 0 )
|
||||
{
|
||||
// Draw the tooltip
|
||||
this.drawTooltip( mouseX - this.guiLeft, mouseY - this.guiTop, true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
@@ -431,6 +399,38 @@ public class GuiEssentiaLevelEmitter
|
||||
new PacketServerEssentiaEmitter().createUpdateRequest( this.part, this.player ).sendPacketToServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Get the index of the button that was clicked
|
||||
int index = button.id;
|
||||
|
||||
// Was one of the amount buttons pressed?
|
||||
if( ( index >= 0 ) && ( index < GuiEssentiaLevelEmitter.BUTTON_LABELS.length ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
// Read the adjustment
|
||||
int adjustment = Integer.parseInt( button.displayString );
|
||||
|
||||
// Update the server
|
||||
new PacketServerEssentiaEmitter().createWantedAmountAdjustment( adjustment, this.part, this.player ).sendPacketToServer();
|
||||
}
|
||||
catch( NumberFormatException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
// Was the redstone mode button pressed?
|
||||
else if( index == GuiEssentiaLevelEmitter.REDSTONE_MODE_BUTTON_INDEX )
|
||||
{
|
||||
// Update the server
|
||||
new PacketServerEssentiaEmitter().createRedstoneModeToggle( this.part, this.player ).sendPacketToServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the gui is closing.
|
||||
*/
|
||||
|
||||
@@ -186,78 +186,12 @@ public class GuiEssentiaStorageBus
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.drawGuiContainerBackgroundLayer( alpha, mouseX, mouseY );
|
||||
super.drawAEToolAndUpgradeSlots( alpha, mouseX, mouseY );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
|
||||
for( WidgetAspectSlot aspectSlot : this.aspectWidgetList )
|
||||
{
|
||||
if( aspectSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( this.player.inventory.getItemStack() );
|
||||
|
||||
// Is there an aspect?
|
||||
if( itemAspect != null )
|
||||
{
|
||||
// Are we already filtering for this aspect?
|
||||
if( this.filteredAspects.contains( itemAspect ) )
|
||||
{
|
||||
// Ignore
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
aspectSlot.mouseClicked( itemAspect );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed( final GuiButton button )
|
||||
{
|
||||
// Was the priority button clicked?
|
||||
if( button.id == GuiEssentiaStorageBus.BUTTON_PRIORITY_ID )
|
||||
{
|
||||
// Get the storage buses host
|
||||
TileEntity host = this.storageBus.getHostTile();
|
||||
|
||||
// Get the side the storage bus is attached to
|
||||
ForgeDirection side = this.storageBus.getSide();
|
||||
|
||||
// Ask the server to change to the priority gui
|
||||
new PacketServerChangeGui().createChangeGuiRequest( ThEGuiHandler.generatePriorityID( side ), this.player, host.getWorldObj(),
|
||||
host.xCoord, host.yCoord, host.zCoord ).sendPacketToServer();
|
||||
|
||||
}
|
||||
else if( button.id == GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID )
|
||||
{
|
||||
// Toggle the mode
|
||||
this.isVoidAllowed = !this.isVoidAllowed;
|
||||
|
||||
// Update the button
|
||||
( (GuiButtonAllowVoid)this.buttonList.get( GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID ) ).isVoidAllowed = this.isVoidAllowed;
|
||||
|
||||
// Update the server
|
||||
new PacketServerEssentiaStorageBus().createRequestSetVoidAllowed( this.player, this.storageBus, this.isVoidAllowed ).sendPacketToServer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Call super
|
||||
super.drawGuiContainerForegroundLayer( mouseX, mouseY );
|
||||
@@ -299,6 +233,38 @@ public class GuiEssentiaStorageBus
|
||||
this.drawTooltip( mouseX - this.guiLeft, mouseY - this.guiTop, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
|
||||
for( WidgetAspectSlot aspectSlot : this.aspectWidgetList )
|
||||
{
|
||||
if( aspectSlot.isMouseOverWidget( mouseX, mouseY ) )
|
||||
{
|
||||
// Get the aspect of the currently held item
|
||||
Aspect itemAspect = EssentiaItemContainerHelper.INSTANCE.getFilterAspectFromItem( this.player.inventory.getItemStack() );
|
||||
|
||||
// Is there an aspect?
|
||||
if( itemAspect != null )
|
||||
{
|
||||
// Are we already filtering for this aspect?
|
||||
if( this.filteredAspects.contains( itemAspect ) )
|
||||
{
|
||||
// Ignore
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
aspectSlot.mouseClicked( itemAspect );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
@@ -328,6 +294,40 @@ public class GuiEssentiaStorageBus
|
||||
new PacketServerEssentiaStorageBus().createRequestFullUpdate( this.player, this.storageBus ).sendPacketToServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Was the priority button clicked?
|
||||
if( button.id == GuiEssentiaStorageBus.BUTTON_PRIORITY_ID )
|
||||
{
|
||||
// Get the storage buses host
|
||||
TileEntity host = this.storageBus.getHostTile();
|
||||
|
||||
// Get the side the storage bus is attached to
|
||||
ForgeDirection side = this.storageBus.getSide();
|
||||
|
||||
// Ask the server to change to the priority gui
|
||||
new PacketServerChangeGui().createChangeGuiRequest( ThEGuiHandler.generatePriorityID( side ), this.player, host.getWorldObj(),
|
||||
host.xCoord, host.yCoord, host.zCoord ).sendPacketToServer();
|
||||
|
||||
}
|
||||
else if( button.id == GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID )
|
||||
{
|
||||
// Toggle the mode
|
||||
this.isVoidAllowed = !this.isVoidAllowed;
|
||||
|
||||
// Update the button
|
||||
( (GuiButtonAllowVoid)this.buttonList.get( GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID ) ).isVoidAllowed = this.isVoidAllowed;
|
||||
|
||||
// Update the server
|
||||
new PacketServerEssentiaStorageBus().createRequestSetVoidAllowed( this.player, this.storageBus, this.isVoidAllowed ).sendPacketToServer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server has sent a change to void mode.
|
||||
*
|
||||
|
||||
@@ -71,17 +71,6 @@ public class GuiKnowledgeInscriber
|
||||
this.title = ThEStrings.Block_KnowledgeInscriber.getLocalized();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton button )
|
||||
{
|
||||
// Was the clicked button the save button?
|
||||
if( button == this.saveButton )
|
||||
{
|
||||
// Send the request to the server
|
||||
new PacketServerKnowledgeInscriber().createRequestSaveDelete( this.player ).sendPacketToServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw background
|
||||
*/
|
||||
@@ -120,7 +109,7 @@ public class GuiKnowledgeInscriber
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiKnowledgeInscriber.TITLE_POS_X, GuiKnowledgeInscriber.TITLE_POS_Y, 0 );
|
||||
@@ -133,6 +122,17 @@ public class GuiKnowledgeInscriber
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Was the clicked button the save button?
|
||||
if( button == this.saveButton )
|
||||
{
|
||||
// Send the request to the server
|
||||
new PacketServerKnowledgeInscriber().createRequestSaveDelete( this.player ).sendPacketToServer();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
|
||||
@@ -240,6 +240,26 @@ public class GuiPriority
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiPriority.TITLE_POS_X, GuiPriority.TITLE_POS_Y, 0 );
|
||||
|
||||
// Draw the text field
|
||||
this.amountField.drawTextBox();
|
||||
|
||||
// Get the tooltip from the buttons
|
||||
if( this.addTooltipFromButtons( mouseX, mouseY ) )
|
||||
{
|
||||
// Draw the tooltip
|
||||
this.drawTooltip( mouseX - this.guiLeft, mouseY - this.guiTop, true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player types a key
|
||||
*/
|
||||
@@ -276,61 +296,6 @@ public class GuiPriority
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed( final GuiButton button )
|
||||
{
|
||||
// Was the priority button clicked?
|
||||
if( button.id == GuiPriority.PART_SWITCH_BUTTON_ID )
|
||||
{
|
||||
// Get the storage buses host
|
||||
TileEntity host = this.part.getHostTile();
|
||||
|
||||
// Ask the server to change to the priority gui
|
||||
new PacketServerChangeGui().createChangeGuiRequest( this.part, this.player, host.getWorldObj(), host.xCoord, host.yCoord, host.zCoord )
|
||||
.sendPacketToServer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Assume it was an adjustment button
|
||||
try
|
||||
{
|
||||
// Get the definition
|
||||
AdjustmentButtonDef abDef = GuiPriority.ADJUSTMENT_BUTTONS[button.id - GuiPriority.ADJUSTMENT_BUTTONS_ID];
|
||||
|
||||
// Send the adjustment to the server
|
||||
new PacketServerPriority().createRequestAdjustPriority( abDef.amount, this.player ).sendPacketToServer();
|
||||
}
|
||||
catch( IndexOutOfBoundsException e )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground
|
||||
*/
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, GuiPriority.TITLE_POS_X, GuiPriority.TITLE_POS_Y, 0 );
|
||||
|
||||
// Draw the text field
|
||||
this.amountField.drawTextBox();
|
||||
|
||||
// Get the tooltip from the buttons
|
||||
if( this.addTooltipFromButtons( mouseX, mouseY ) )
|
||||
{
|
||||
// Draw the tooltip
|
||||
this.drawTooltip( mouseX - this.guiLeft, mouseY - this.guiTop, true );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
@@ -388,6 +353,41 @@ public class GuiPriority
|
||||
new PacketServerPriority().createRequestPriority( this.player ).sendPacketToServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Was the priority button clicked?
|
||||
if( button.id == GuiPriority.PART_SWITCH_BUTTON_ID )
|
||||
{
|
||||
// Get the storage buses host
|
||||
TileEntity host = this.part.getHostTile();
|
||||
|
||||
// Ask the server to change to the priority gui
|
||||
new PacketServerChangeGui().createChangeGuiRequest( this.part, this.player, host.getWorldObj(), host.xCoord, host.yCoord, host.zCoord )
|
||||
.sendPacketToServer();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Assume it was an adjustment button
|
||||
try
|
||||
{
|
||||
// Get the definition
|
||||
AdjustmentButtonDef abDef = GuiPriority.ADJUSTMENT_BUTTONS[button.id - GuiPriority.ADJUSTMENT_BUTTONS_ID];
|
||||
|
||||
// Send the adjustment to the server
|
||||
new PacketServerPriority().createRequestAdjustPriority( abDef.amount, this.player ).sendPacketToServer();
|
||||
}
|
||||
catch( IndexOutOfBoundsException e )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the gui is closing.
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@ package thaumicenergistics.gui.abstraction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
@@ -81,13 +81,6 @@ public abstract class AbstractGuiBase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache the font renderer
|
||||
*
|
||||
* @param container
|
||||
*/
|
||||
private static final FontRenderer FONT_RENDERER = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
/**
|
||||
* Tooltip offset from the mouse.
|
||||
*/
|
||||
@@ -133,10 +126,10 @@ public abstract class AbstractGuiBase
|
||||
*/
|
||||
private static final int TOOLTIP_BORDER_SIZE = 3;
|
||||
|
||||
private static int upgradeU = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getU();
|
||||
private static int upgradeV = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getV();
|
||||
private static int upgradeWidth = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getWidth();
|
||||
private static int upgradeHeight = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getHeight();
|
||||
private static final int upgradeU = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getU();
|
||||
private static final int upgradeV = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getV();
|
||||
private static final int upgradeWidth = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getWidth();
|
||||
private static final int upgradeHeight = AEStateIconsEnum.UPGRADE_CARD_BACKGROUND.getHeight();
|
||||
|
||||
/**
|
||||
* Lines to draw when drawTooltip is called.
|
||||
@@ -202,6 +195,55 @@ public abstract class AbstractGuiBase
|
||||
this.drawGradientRect( bounds.L, bounds.B, bounds.R, bounds.B + 1, colorStart, colorEnd );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified point is within the bounds of the specified slot.
|
||||
*
|
||||
* @param slot
|
||||
* @param x
|
||||
* @param y
|
||||
* @return True if the point is within the slot, false otherwise.
|
||||
*/
|
||||
private final boolean isPointWithinSlot( final Slot slot, final int x, final int y )
|
||||
{
|
||||
return GuiHelper.INSTANCE.isPointInGuiRegion( slot.yDisplayPosition, slot.xDisplayPosition, 16, 16, x, y, this.guiLeft, this.guiTop );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a not-left-click was on a button.<BR>
|
||||
* Left click is handled by GuiScreen.mouseClicked()
|
||||
*
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
* @return True if click was handled.
|
||||
*/
|
||||
private final boolean nonLeftClickHandler_Buttons( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
if( mouseButton != GuiHelper.MOUSE_BUTTON_LEFT )
|
||||
{
|
||||
// Mouse over button?
|
||||
for( Object buttonObj : this.buttonList )
|
||||
{
|
||||
// Cast
|
||||
GuiButton button = (GuiButton)buttonObj;
|
||||
|
||||
// Was mouse over the button?
|
||||
if( button.mousePressed( this.mc, mouseX, mouseY ) )
|
||||
{
|
||||
// Play clicky sound
|
||||
button.func_146113_a( this.mc.getSoundHandler() );
|
||||
|
||||
// Call button click event
|
||||
this.onButtonClicked( button, mouseButton );
|
||||
|
||||
// Handled
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds to the tooltip based on which button the mouse is over.
|
||||
*
|
||||
@@ -209,7 +251,7 @@ public abstract class AbstractGuiBase
|
||||
* @param mouseY
|
||||
* @return True when a tooltip was added, false otherwise.
|
||||
*/
|
||||
protected boolean addTooltipFromButtons( final int mouseX, final int mouseY )
|
||||
protected final boolean addTooltipFromButtons( final int mouseX, final int mouseY )
|
||||
{
|
||||
// Is the mouse over any buttons?
|
||||
for( Object obj : this.buttonList )
|
||||
@@ -235,8 +277,14 @@ public abstract class AbstractGuiBase
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer( final float alpha, final int mouseX, final int mouseY )
|
||||
/**
|
||||
* Draws the slot backgrounds for the network tool and upgrade slots.
|
||||
*
|
||||
* @param alpha
|
||||
* @param mouseX
|
||||
* @param mouseY
|
||||
*/
|
||||
protected final void drawAEToolAndUpgradeSlots( final float alpha, final int mouseX, final int mouseY )
|
||||
{
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture( AEStateIconsEnum.AE_STATES_TEXTURE );
|
||||
|
||||
@@ -291,7 +339,7 @@ public abstract class AbstractGuiBase
|
||||
for( String string : this.tooltip )
|
||||
{
|
||||
// Get the length of the string
|
||||
int stringLen = AbstractGuiBase.FONT_RENDERER.getStringWidth( string );
|
||||
int stringLen = this.mc.fontRenderer.getStringWidth( string );
|
||||
|
||||
// Is it larger than the previous length?
|
||||
if( stringLen > maxStringLength_px )
|
||||
@@ -338,7 +386,7 @@ public abstract class AbstractGuiBase
|
||||
String line = this.tooltip.get( index );
|
||||
|
||||
// Draw the line
|
||||
FONT_RENDERER.drawStringWithShadow( line, posX, posY, -1 );
|
||||
this.mc.fontRenderer.drawStringWithShadow( line, posX, posY, -1 );
|
||||
|
||||
// Is this the first line?
|
||||
if( index == 0 )
|
||||
@@ -378,7 +426,7 @@ public abstract class AbstractGuiBase
|
||||
* @param y
|
||||
* @return Slot the point is within, null if point is within no slots.
|
||||
*/
|
||||
protected Slot getSlotAtPosition( final int x, final int y )
|
||||
protected final Slot getSlotAtPosition( final int x, final int y )
|
||||
{
|
||||
// Loop over all slots
|
||||
for( int i = 0; i < this.inventorySlots.inventorySlots.size(); i++ )
|
||||
@@ -398,26 +446,19 @@ public abstract class AbstractGuiBase
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified point is within the bounds of the specified slot.
|
||||
*
|
||||
* @param slot
|
||||
* @param x
|
||||
* @param y
|
||||
* @return True if the point is within the slot, false otherwise.
|
||||
*/
|
||||
protected boolean isPointWithinSlot( final Slot slot, final int x, final int y )
|
||||
{
|
||||
return GuiHelper.INSTANCE.isPointInGuiRegion( slot.yDisplayPosition, slot.xDisplayPosition, 16, 16, x, y, this.guiLeft, this.guiTop );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Is our container one that could have a network tool?
|
||||
|
||||
if( nonLeftClickHandler_Buttons( mouseX, mouseY, mouseButton ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Is this container one that could have a network tool?
|
||||
if( this.inventorySlots instanceof ContainerWithNetworkTool )
|
||||
{
|
||||
// Do we have a network tool?
|
||||
@@ -436,10 +477,32 @@ public abstract class AbstractGuiBase
|
||||
}
|
||||
}
|
||||
|
||||
// Call super
|
||||
// Pass to super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked. Includes which button was pressed.
|
||||
*
|
||||
* @param button
|
||||
* @param mouseButton
|
||||
*/
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is left-clicked<BR>
|
||||
* Note: Do not override, use {@link #onButtonClicked(GuiButton, int) onButtonClicked} instead.
|
||||
*
|
||||
* @see #onButtonClicked(GuiButton, int )
|
||||
*/
|
||||
@Override
|
||||
public final void actionPerformed( final GuiButton button )
|
||||
{
|
||||
this.onButtonClicked( button, GuiHelper.MOUSE_BUTTON_LEFT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the starting X position for the Gui.
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import appeng.api.AEApi;
|
||||
@@ -98,7 +98,6 @@ public class ArcaneCraftingPattern
|
||||
@Override
|
||||
public boolean canSubstitute()
|
||||
{
|
||||
// This needs to be precise Issue #216
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -188,24 +187,48 @@ public class ArcaneCraftingPattern
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidItemForSlot( final int slotIndex, final ItemStack repStack, final World world )
|
||||
public boolean isValidItemForSlot( final int slotIndex, final ItemStack input, final World world )
|
||||
{
|
||||
// Get the item currently in the slot
|
||||
IAEItemStack ingStack = this.ingredients[slotIndex];
|
||||
|
||||
// Ensure nothing is null
|
||||
if( ( ingStack == null ) || ( ingStack.getItem() == null ) || ( repStack == null ) || ( repStack.getItem() == null ) )
|
||||
if( ( ingStack == null ) || ( ingStack.getItem() == null ) || ( input == null ) || ( input.getItem() == null ) )
|
||||
{
|
||||
// Null detected
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack target = ingStack.getItemStack();
|
||||
|
||||
// Does the item directly match?
|
||||
if( ItemStack.areItemStacksEqual( ingStack.getItemStack(), repStack ) )
|
||||
if( ItemStack.areItemStacksEqual( target, input ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Do the items match?
|
||||
if( target.getItem() != input.getItem() )
|
||||
{
|
||||
// Mismatched items
|
||||
return false;
|
||||
}
|
||||
|
||||
// NBT data present?
|
||||
if( target.hasTagCompound() )
|
||||
{
|
||||
// Do the tags match?
|
||||
if( !ThaumcraftApiHelper.areItemStackTagsEqualForCrafting( input, target ) )
|
||||
{
|
||||
// Tags do not match
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Finally check item damage (32767 is some magic number from thaumcraft)
|
||||
return( ( target.getItemDamage() == 32767 ) || ( target.getItemDamage() == input.getItemDamage() ) );
|
||||
|
||||
/* Issue #216 - Do not use replacements.
|
||||
// Does the item via ore dictionary fast match?
|
||||
if( OreDictionary.itemMatches( ingStack.getItemStack(), repStack, false ) )
|
||||
{
|
||||
@@ -227,6 +250,7 @@ public class ArcaneCraftingPattern
|
||||
}
|
||||
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.7 KiB |
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 4
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.8 KiB |
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 4
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user