mirror of
https://github.com/GTNewHorizons/ThaumicEnergistics.git
synced 2026-10-25 20:32:27 +00:00
Stack Overflow Fix
Fixed #223: Removed recursive call causing stack overflow. Aspect registration is more robust when dealing with AE Api changes. Removed unneeded GL calls from storage monitor. E.V.C. produces light when active.
This commit is contained in:
1 parent
a17f24cbf1
commit
4449194413
14 files changed
+366
-211
No files matched your search
+7
-1
@@ -1,4 +1,10 @@
|
||||
7/23/2015 0.8.10.8
|
||||
7/30/2015 0.8.10.9
|
||||
Fixed #223: Removed recursive call causing stack overflow.
|
||||
Aspect registration is more robust when dealing with AE Api changes.
|
||||
Removed unneeded GL calls from storage monitor.
|
||||
E.V.C. produces light when active.
|
||||
|
||||
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.
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ buildscript {
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "0.8.10.8"
|
||||
version = "0.8.10.9"
|
||||
group= "thaumicenergistics" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "thaumicenergistics"
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ThaumicEnergistics
|
||||
/**
|
||||
* Current version of the mod.
|
||||
*/
|
||||
public static final String VERSION = "0.8.10.8"; // Note: don't forget to change the build.gradle file as well
|
||||
public static final String VERSION = "0.8.10.9"; // Note: don't forget to change the build.gradle file as well
|
||||
|
||||
/**
|
||||
* Singleton instance
|
||||
|
||||
@@ -210,6 +210,23 @@ public class BlockEssentiaVibrationChamber
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Bright when active, dark when not.
|
||||
*/
|
||||
@Override
|
||||
public int getLightValue( final IBlockAccess world, final int x, final int y, final int z )
|
||||
{
|
||||
// Get the chamber
|
||||
TileEssentiaVibrationChamber chamber = this.getEVCTile( world, x, y, z );
|
||||
if( chamber != null )
|
||||
{
|
||||
// Return bright if chamber
|
||||
return( chamber.getProcessingAspect() != null ? 12 : 0 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the unlocalized name of the block.
|
||||
*/
|
||||
|
||||
@@ -560,6 +560,22 @@ public class GuiEssentiaCellTerminal
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected 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();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onScrollbarMoved()
|
||||
{
|
||||
@@ -720,22 +736,6 @@ 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.
|
||||
*
|
||||
|
||||
@@ -250,6 +250,22 @@ public class GuiEssentiaCellWorkbench
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected 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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
@@ -287,22 +303,6 @@ 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.
|
||||
*/
|
||||
|
||||
@@ -314,6 +314,27 @@ public class GuiEssentiaIO
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is pressed
|
||||
*/
|
||||
@Override
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getConfigState()
|
||||
{
|
||||
@@ -366,30 +387,6 @@ 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.
|
||||
*
|
||||
|
||||
@@ -310,6 +310,38 @@ public class GuiEssentiaLevelEmitter
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected 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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
@@ -399,38 +431,6 @@ 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.
|
||||
*/
|
||||
|
||||
@@ -265,40 +265,11 @@ public class GuiEssentiaStorageBus
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
// Create the widgets
|
||||
for( int row = 0; row < GuiEssentiaStorageBus.ROWS; row++ )
|
||||
{
|
||||
for( int column = 0; column < GuiEssentiaStorageBus.COLUMNS; column++ )
|
||||
{
|
||||
this.aspectWidgetList.add( new WidgetAspectSlot( this, this.player, this.storageBus,
|
||||
( row * GuiEssentiaStorageBus.COLUMNS ) + column, GuiEssentiaStorageBus.WIDGET_X_POS +
|
||||
( AbstractWidget.WIDGET_SIZE * column ), GuiEssentiaStorageBus.WIDGET_Y_POS +
|
||||
( AbstractWidget.WIDGET_SIZE * row ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Create the priority tab button
|
||||
this.buttonList.add( new GuiButtonAETab( GuiEssentiaStorageBus.BUTTON_PRIORITY_ID, this.guiLeft +
|
||||
GuiEssentiaStorageBus.BUTTON_PRIORITY_X_POSITION, this.guiTop, AEStateIconsEnum.WRENCH, "gui.appliedenergistics2.Priority" ) );
|
||||
|
||||
// Create the allow void button
|
||||
this.buttonList.add( new GuiButtonAllowVoid( GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID, this.guiLeft +
|
||||
GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_X_POS, this.guiTop + GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_Y_POS ) );
|
||||
|
||||
// Request an update
|
||||
new PacketServerEssentiaStorageBus().createRequestFullUpdate( this.player, this.storageBus ).sendPacketToServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
public void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
protected void onButtonClicked( final GuiButton button, final int mouseButton )
|
||||
{
|
||||
// Was the priority button clicked?
|
||||
if( button.id == GuiEssentiaStorageBus.BUTTON_PRIORITY_ID )
|
||||
@@ -328,6 +299,35 @@ public class GuiEssentiaStorageBus
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
// Create the widgets
|
||||
for( int row = 0; row < GuiEssentiaStorageBus.ROWS; row++ )
|
||||
{
|
||||
for( int column = 0; column < GuiEssentiaStorageBus.COLUMNS; column++ )
|
||||
{
|
||||
this.aspectWidgetList.add( new WidgetAspectSlot( this, this.player, this.storageBus,
|
||||
( row * GuiEssentiaStorageBus.COLUMNS ) + column, GuiEssentiaStorageBus.WIDGET_X_POS +
|
||||
( AbstractWidget.WIDGET_SIZE * column ), GuiEssentiaStorageBus.WIDGET_Y_POS +
|
||||
( AbstractWidget.WIDGET_SIZE * row ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Create the priority tab button
|
||||
this.buttonList.add( new GuiButtonAETab( GuiEssentiaStorageBus.BUTTON_PRIORITY_ID, this.guiLeft +
|
||||
GuiEssentiaStorageBus.BUTTON_PRIORITY_X_POSITION, this.guiTop, AEStateIconsEnum.WRENCH, "gui.appliedenergistics2.Priority" ) );
|
||||
|
||||
// Create the allow void button
|
||||
this.buttonList.add( new GuiButtonAllowVoid( GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID, this.guiLeft +
|
||||
GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_X_POS, this.guiTop + GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_Y_POS ) );
|
||||
|
||||
// Request an update
|
||||
new PacketServerEssentiaStorageBus().createRequestFullUpdate( this.player, this.storageBus ).sendPacketToServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server has sent a change to void mode.
|
||||
*
|
||||
|
||||
@@ -296,6 +296,41 @@ public class GuiPriority
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is clicked.
|
||||
*/
|
||||
@Override
|
||||
protected 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
@@ -353,41 +388,6 @@ 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.
|
||||
*/
|
||||
|
||||
@@ -73,7 +73,7 @@ public final class IntegrationCore
|
||||
{
|
||||
|
||||
// Log failure
|
||||
ThELog.warning( "Skipping integrating with %s", modID );
|
||||
ThELog.warning( "Skipping integration with %s", modID );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ public class AEPartEssentiaStorageMonitor
|
||||
private void renderScreen( final Tessellator tessellator, final AspectStack aspectStack )
|
||||
{
|
||||
// Push the OpenGL attributes
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
//GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
// Get the side
|
||||
ForgeDirection side = this.getSide();
|
||||
@@ -405,7 +405,7 @@ public class AEPartEssentiaStorageMonitor
|
||||
}
|
||||
|
||||
// Push the OpenGL matrix
|
||||
GL11.glPushMatrix();
|
||||
//GL11.glPushMatrix();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -425,10 +425,10 @@ public class AEPartEssentiaStorageMonitor
|
||||
}
|
||||
|
||||
// Pop the OpenGL matrix
|
||||
GL11.glPopMatrix();
|
||||
//GL11.glPopMatrix();
|
||||
|
||||
// Move below the screen image
|
||||
GL11.glTranslatef( 0.0f, 0.14f, -0.24f );
|
||||
GL11.glTranslatef( 0.2f, 0.4f, -0.25f );
|
||||
GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
|
||||
|
||||
// Convert the amount to a string
|
||||
@@ -444,7 +444,7 @@ public class AEPartEssentiaStorageMonitor
|
||||
fr.drawString( renderedStackSize, 0, 0, 0 );
|
||||
|
||||
// Pop the OpenGL attributes
|
||||
GL11.glPopAttrib();
|
||||
//GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package thaumicenergistics.registries;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -14,13 +15,17 @@ import thaumicenergistics.api.IThEItems;
|
||||
import thaumicenergistics.api.ThEApi;
|
||||
import thaumicenergistics.util.ThELog;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.api.features.IGrinderRegistry;
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.features.IInscriberRegistry;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.core.features.registries.entries.InscriberRecipe;
|
||||
@@ -273,14 +278,48 @@ public class AEAspectRegister
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the aspects for the item via recipe => ingredients
|
||||
* Attempts to build the aspects for the item via recipe => ingredients
|
||||
*/
|
||||
private void buildAspects()
|
||||
{
|
||||
// Grinder recipes
|
||||
for( IGrinderEntry recipe : AEAspectRegister.this.GRINDER_RECIPES )
|
||||
if( AEAspectRegister.this.GRINDER_RECIPES != null )
|
||||
{
|
||||
try
|
||||
if( this.buildAspectsFromGrinder() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Inscriber recipes
|
||||
if( AEAspectRegister.this.INSCRIBER_RECIPES != null )
|
||||
{
|
||||
if( this.buildAspectsFromInscriber() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Regular crafting recipes
|
||||
if( AEAspectRegister.this.NORMAL_RECIPES != null )
|
||||
{
|
||||
if( this.buildAspectsFromNormal() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to build the aspects for the item via grinder recipes.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean buildAspectsFromGrinder()
|
||||
{
|
||||
try
|
||||
{
|
||||
for( IGrinderEntry recipe : AEAspectRegister.this.GRINDER_RECIPES )
|
||||
{
|
||||
ItemStack recipeOutput = recipe.getOutput();
|
||||
|
||||
@@ -294,48 +333,63 @@ public class AEAspectRegister
|
||||
{
|
||||
if( this.isRecipeUsable( recipe ) )
|
||||
{
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
}
|
||||
|
||||
// Inscriber recipes
|
||||
if( AEAspectRegister.this.INSCRIBER_RECIPES != null )
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to build the aspects for the item via inscriber recipes.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean buildAspectsFromInscriber()
|
||||
{
|
||||
try
|
||||
{
|
||||
for( IInscriberRecipe recipe : AEAspectRegister.this.INSCRIBER_RECIPES )
|
||||
{
|
||||
try
|
||||
ItemStack recipeOutput = recipe.getOutput();
|
||||
|
||||
// Skip null items
|
||||
if( recipeOutput == null || recipeOutput.getItem() == null )
|
||||
{
|
||||
ItemStack recipeOutput = recipe.getOutput();
|
||||
|
||||
// Skip null items
|
||||
if( recipeOutput == null || recipeOutput.getItem() == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( this.areStacksEqualIgnoreAmount( recipeOutput, this.itemStack ) )
|
||||
{
|
||||
if( this.isRecipeUsable( recipe ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
catch( Exception e )
|
||||
|
||||
if( this.areStacksEqualIgnoreAmount( recipeOutput, this.itemStack ) )
|
||||
{
|
||||
if( this.isRecipeUsable( recipe ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Regular crafting recipes
|
||||
for( IRecipe recipe : AEAspectRegister.this.NORMAL_RECIPES )
|
||||
catch( Exception e )
|
||||
{
|
||||
try
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to build the aspects for the item via normal recipes.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean buildAspectsFromNormal()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
for( IRecipe recipe : AEAspectRegister.this.NORMAL_RECIPES )
|
||||
{
|
||||
// Get the recipe's result
|
||||
ItemStack recipeOutput = recipe.getRecipeOutput();
|
||||
@@ -354,14 +408,16 @@ public class AEAspectRegister
|
||||
|
||||
if( this.isRecipeUsable( recipe ) )
|
||||
{
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -816,9 +872,9 @@ public class AEAspectRegister
|
||||
/**
|
||||
* Recipe caches
|
||||
*/
|
||||
List<IRecipe> NORMAL_RECIPES;
|
||||
List<IGrinderEntry> GRINDER_RECIPES;
|
||||
List<IInscriberRecipe> INSCRIBER_RECIPES;
|
||||
List<IRecipe> NORMAL_RECIPES = null;
|
||||
List<IGrinderEntry> GRINDER_RECIPES = null;
|
||||
List<IInscriberRecipe> INSCRIBER_RECIPES = null;
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
@@ -828,6 +884,74 @@ public class AEAspectRegister
|
||||
|
||||
}
|
||||
|
||||
private boolean getGrinderRecipes()
|
||||
{
|
||||
// Get the AE Api instance
|
||||
IAppEngApi aeApi = AEApi.instance();
|
||||
|
||||
try
|
||||
{
|
||||
// Get registries method signature
|
||||
Method mRegistries = IAppEngApi.class.getDeclaredMethod( "registries" );
|
||||
|
||||
// Get the registries
|
||||
IRegistryContainer aeRegistries = (IRegistryContainer)mRegistries.invoke( aeApi );
|
||||
|
||||
// Get grinder method signature
|
||||
Method mGrinder = IRegistryContainer.class.getDeclaredMethod( "grinderQQ" );
|
||||
|
||||
// Get the grinder registry
|
||||
IGrinderRegistry aeGrinderRegistry = (IGrinderRegistry)mGrinder.invoke( aeRegistries );
|
||||
|
||||
// Get the recipe method signature
|
||||
Method mRecipes = IGrinderRegistry.class.getDeclaredMethod( "getRecipes" );
|
||||
|
||||
// Get the recipes
|
||||
this.GRINDER_RECIPES = (List<IGrinderEntry>)mRecipes.invoke( aeGrinderRegistry );
|
||||
|
||||
return true;
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean getInscriberRecipes()
|
||||
{
|
||||
// Get the AE Api instance
|
||||
IAppEngApi aeApi = AEApi.instance();
|
||||
|
||||
try
|
||||
{
|
||||
// Get registries method signature
|
||||
Method mRegistries = IAppEngApi.class.getDeclaredMethod( "registries" );
|
||||
|
||||
// Get the registries
|
||||
IRegistryContainer aeRegistries = (IRegistryContainer)mRegistries.invoke( aeApi );
|
||||
|
||||
// Get inscriber method signature
|
||||
Method mInscriber = IRegistryContainer.class.getDeclaredMethod( "inscriberQQ" );
|
||||
|
||||
// Get the grinder registry
|
||||
IInscriberRegistry aeInscriberRegistry = (IInscriberRegistry)mInscriber.invoke( aeRegistries );
|
||||
|
||||
// Get the recipe method signature
|
||||
Method mRecipes = IInscriberRegistry.class.getDeclaredMethod( "getRecipes" );
|
||||
|
||||
// Get the recipes
|
||||
this.INSCRIBER_RECIPES = (List<IInscriberRecipe>)mRecipes.invoke( aeInscriberRegistry );
|
||||
|
||||
return true;
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the base items from AE. Those without a usable crafting
|
||||
* ancestry, world crafted, or multi-part.
|
||||
@@ -1132,12 +1256,20 @@ public class AEAspectRegister
|
||||
// Log
|
||||
long sectionStartTime = ThELog.beginSection( "AE Scanables" );
|
||||
|
||||
// Get the current recipes
|
||||
// Get the normal recipes
|
||||
this.NORMAL_RECIPES = CraftingManager.getInstance().getRecipeList();
|
||||
this.GRINDER_RECIPES = AEApi.instance().registries().grinder().getRecipes();
|
||||
|
||||
// Get the grinder recipes
|
||||
if( !this.getGrinderRecipes() )
|
||||
{
|
||||
ThELog.warning( "Unable to load AE2 Grinder recipes, aspect registration will be incomplete" );
|
||||
}
|
||||
|
||||
// Get the inscriber recipes
|
||||
this.INSCRIBER_RECIPES = AEApi.instance().registries().inscriber().getRecipes();
|
||||
if( !this.getInscriberRecipes() )
|
||||
{
|
||||
ThELog.warning( "Unable to load AE2 Inscriber recipes, aspect registration will be incomplete" );
|
||||
}
|
||||
|
||||
// Build the list of items to give aspects to
|
||||
this.getItemsFromAERegistryClass( AEApi.instance().definitions().materials() );
|
||||
@@ -1172,7 +1304,7 @@ public class AEAspectRegister
|
||||
}
|
||||
}
|
||||
|
||||
// Finally register my cells
|
||||
// Finally register my items
|
||||
this.registerThEItems();
|
||||
|
||||
// Cleanup
|
||||
|
||||
@@ -61,10 +61,13 @@ public abstract class TileEVCBase
|
||||
}
|
||||
|
||||
/**
|
||||
* 1-100: Ignis, 100-200: Potentia
|
||||
* Add essentia to the EVC.
|
||||
*
|
||||
* @param aspect
|
||||
* @param amount
|
||||
* @param mode
|
||||
* @return
|
||||
*/
|
||||
//protected int suctionRotationTimer = 1;
|
||||
|
||||
protected abstract int addEssentia( final Aspect aspect, final int amount, final Actionable mode );
|
||||
|
||||
@Override
|
||||
@@ -72,7 +75,6 @@ public abstract class TileEVCBase
|
||||
{
|
||||
// Return the itemstack that visually represents this tile
|
||||
return ThEApi.instance().blocks().EssentiaVibrationChamber.getStack();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,7 +288,7 @@ public abstract class TileEVCBase
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void onNBTLoad( final NBTTagCompound data )
|
||||
public final void onNBTLoad( final NBTTagCompound data )
|
||||
{
|
||||
// Is there essentia stored?
|
||||
if( data.hasKey( TileEVCBase.NBTKEY_STORED ) )
|
||||
@@ -300,7 +302,7 @@ public abstract class TileEVCBase
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void onNBTSave( final NBTTagCompound data )
|
||||
public final void onNBTSave( final NBTTagCompound data )
|
||||
{
|
||||
// Save storage
|
||||
if( this.hasStoredEssentia() )
|
||||
@@ -319,7 +321,7 @@ public abstract class TileEVCBase
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean onNetworkRead( final ByteBuf stream )
|
||||
public final boolean onNetworkRead( final ByteBuf stream )
|
||||
{
|
||||
// Anything stored?
|
||||
if( stream.readBoolean() )
|
||||
@@ -349,7 +351,7 @@ public abstract class TileEVCBase
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void onNetworkWrite( final ByteBuf stream ) throws IOException
|
||||
public final void onNetworkWrite( final ByteBuf stream ) throws IOException
|
||||
{
|
||||
// Is there anything stored?
|
||||
boolean hasStored = this.storedEssentia != null;
|
||||
@@ -374,6 +376,7 @@ public abstract class TileEVCBase
|
||||
@Override
|
||||
public void onReady()
|
||||
{
|
||||
// Call super
|
||||
super.onReady();
|
||||
|
||||
// Ignored on client side
|
||||
|
||||
Reference in new issue
Block a user