mirror of
https://github.com/GTNewHorizons/ThaumicEnergistics.git
synced 2026-10-25 20:32:27 +00:00
A.C.T. Crafting job support
Fixes #112 - A.C.T can now issue crafting jobs!
This commit is contained in:
1 parent
50f2c52da4
commit
a2ae38edda
14 files changed
+687
-135
No files matched your search
+4
-1
@@ -1,4 +1,7 @@
|
||||
12/24/2015 0.9.0.4 - Alpha
|
||||
12/27/2015 0.9.0.4 - Alpha
|
||||
Fixes #112 - A.C.T can now issue crafting jobs!
|
||||
|
||||
12/24/2015 0.9.0.4 - Alpha
|
||||
Dependency Updated: Forge 10.13.4.1558
|
||||
Dependency Updated: AE2-rv3-beta-1
|
||||
Merged pull request #255 - Keridos
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package thaumicenergistics.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
|
||||
public interface ICraftingIssuerTerminalHost
|
||||
extends ITerminalHost
|
||||
{
|
||||
/**
|
||||
* Gets the icon for this terminal.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ItemStack getIcon();
|
||||
|
||||
/**
|
||||
* Launches the terminal's GUI.
|
||||
* Used to return to the gui after crafting is confirmed or canceled.
|
||||
*/
|
||||
public void launchGUI( EntityPlayer player );
|
||||
}
|
||||
+50
-32
@@ -1,5 +1,32 @@
|
||||
package thaumicenergistics.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.IArcaneRecipe;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumicenergistics.container.slot.SlotArcaneCraftingResult;
|
||||
import thaumicenergistics.container.slot.SlotArmor;
|
||||
import thaumicenergistics.container.slot.SlotRestrictive;
|
||||
import thaumicenergistics.gui.GuiArcaneCraftingTerminal;
|
||||
import thaumicenergistics.gui.ThEGuiHandler;
|
||||
import thaumicenergistics.integration.tc.ArcaneRecipeHelper;
|
||||
import thaumicenergistics.network.packet.client.PacketClientArcaneCraftingTerminal;
|
||||
import thaumicenergistics.parts.AEPartArcaneCraftingTerminal;
|
||||
import thaumicenergistics.util.EffectiveSide;
|
||||
import thaumicenergistics.util.GuiHelper;
|
||||
import thaumicenergistics.util.ThEUtils;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.SortDir;
|
||||
@@ -12,37 +39,10 @@ import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.IArcaneRecipe;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumicenergistics.container.slot.SlotArcaneCraftingResult;
|
||||
import thaumicenergistics.container.slot.SlotArmor;
|
||||
import thaumicenergistics.container.slot.SlotRestrictive;
|
||||
import thaumicenergistics.gui.GuiArcaneCraftingTerminal;
|
||||
import thaumicenergistics.integration.tc.ArcaneRecipeHelper;
|
||||
import thaumicenergistics.network.packet.client.PacketClientArcaneCraftingTerminal;
|
||||
import thaumicenergistics.parts.AEPartArcaneCraftingTerminal;
|
||||
import thaumicenergistics.util.EffectiveSide;
|
||||
import thaumicenergistics.util.GuiHelper;
|
||||
import thaumicenergistics.util.ThEUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ContainerPartArcaneCraftingTerminal
|
||||
extends ContainerWithPlayerInventory
|
||||
@@ -918,16 +918,34 @@ public class ContainerPartArcaneCraftingTerminal
|
||||
*/
|
||||
public void onClientRequestAutoCraft( final EntityPlayer player, final IAEItemStack result )
|
||||
{
|
||||
Platform.openGUI( player, this.arcaneCraftingTerminalPart.getHostTile(), this.arcaneCraftingTerminalPart.getSide(),
|
||||
GuiBridge.GUI_CRAFTING_AMOUNT );
|
||||
// Get the host tile
|
||||
TileEntity te = this.arcaneCraftingTerminalPart.getHostTile();
|
||||
|
||||
// Get the sided GUI ID
|
||||
int sidedID = ThEGuiHandler.generateSidedID( ThEGuiHandler.AUTO_CRAFTING_AMOUNT, this.arcaneCraftingTerminalPart.getSide() );
|
||||
|
||||
// Launch the GUI
|
||||
ThEGuiHandler.launchGui( sidedID, player, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord );
|
||||
|
||||
// Setup the amount container
|
||||
if( player.openContainer instanceof ContainerCraftAmount )
|
||||
{
|
||||
// Get the container
|
||||
ContainerCraftAmount cca = (ContainerCraftAmount)this.player.openContainer;
|
||||
|
||||
cca.getCraftingItem().putStack( result.getItemStack() );
|
||||
cca.setItemToCraft(result);
|
||||
// Create the open context
|
||||
cca.setOpenContext( new ContainerOpenContext( te ) );
|
||||
cca.getOpenContext().setWorld( te.getWorldObj() );
|
||||
cca.getOpenContext().setX( te.xCoord );
|
||||
cca.getOpenContext().setY( te.yCoord );
|
||||
cca.getOpenContext().setZ( te.zCoord );
|
||||
cca.getOpenContext().setSide( this.arcaneCraftingTerminalPart.getSide() );
|
||||
|
||||
// Set the item
|
||||
cca.getCraftingItem().putStack( result.getItemStack() );
|
||||
cca.setItemToCraft( result );
|
||||
|
||||
// Issue update
|
||||
cca.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
package thaumicenergistics.gui;
|
||||
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
@@ -24,7 +16,13 @@ import thaumcraft.common.config.Config;
|
||||
import thaumicenergistics.container.ContainerPartArcaneCraftingTerminal;
|
||||
import thaumicenergistics.container.ContainerPartArcaneCraftingTerminal.ArcaneCrafingCost;
|
||||
import thaumicenergistics.gui.abstraction.AbstractGuiConstantsACT;
|
||||
import thaumicenergistics.gui.buttons.*;
|
||||
import thaumicenergistics.gui.buttons.GuiButtonClearCraftingGrid;
|
||||
import thaumicenergistics.gui.buttons.GuiButtonSearchMode;
|
||||
import thaumicenergistics.gui.buttons.GuiButtonSortingDirection;
|
||||
import thaumicenergistics.gui.buttons.GuiButtonSortingMode;
|
||||
import thaumicenergistics.gui.buttons.GuiButtonSwapArmor;
|
||||
import thaumicenergistics.gui.buttons.GuiButtonTerminalStyle;
|
||||
import thaumicenergistics.gui.buttons.GuiButtonViewType;
|
||||
import thaumicenergistics.gui.widget.AbstractWidget;
|
||||
import thaumicenergistics.gui.widget.WidgetAEItem;
|
||||
import thaumicenergistics.integration.tc.MEItemAspectBridgeContainer;
|
||||
@@ -34,9 +32,21 @@ import thaumicenergistics.registries.ThEStrings;
|
||||
import thaumicenergistics.texture.AEStateIconsEnum;
|
||||
import thaumicenergistics.texture.GuiTextureManager;
|
||||
import thaumicenergistics.util.GuiHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Gui for the Arcane Crafting Terminal
|
||||
@@ -232,7 +242,7 @@ public class GuiArcaneCraftingTerminal
|
||||
this.searchField.setText( "" );
|
||||
|
||||
// Update the repo
|
||||
this.repo.setSearchString("");
|
||||
this.repo.setSearchString( "" );
|
||||
|
||||
// Repo needs update
|
||||
this.viewNeedsUpdate = true;
|
||||
@@ -429,12 +439,11 @@ public class GuiArcaneCraftingTerminal
|
||||
if( widgetStack != null )
|
||||
{
|
||||
// Should the item be crafted?
|
||||
if( widgetStack.getStackSize() == 0 )
|
||||
if( ( widgetStack.getStackSize() == 0 ) || ( mouseButton == GuiHelper.MOUSE_BUTTON_WHEEL ) )
|
||||
{
|
||||
if( widgetStack.isCraftable() )
|
||||
if( ( widgetStack.isCraftable() ) && ( mouseButton != GuiHelper.MOUSE_BUTTON_RIGHT ) )
|
||||
{
|
||||
// TODO: Get with the AE2 team to see if I can get this working.
|
||||
//new PacketServerArcaneCraftingTerminal().createRequestAutoCraft( this.player, widgetStack ).sendPacketToServer();
|
||||
new PacketServerArcaneCraftingTerminal().createRequestAutoCraft( this.player, widgetStack ).sendPacketToServer();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -547,13 +556,6 @@ public class GuiArcaneCraftingTerminal
|
||||
// Did we get a stack?
|
||||
if( stack != null )
|
||||
{
|
||||
// TODO: Prevent craftable items from being shown until AE2 team accepts pull request.
|
||||
if( stack.getStackSize() == 0 )
|
||||
{
|
||||
index-- ;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set the item
|
||||
this.itemWidgets.get( index ).setItemStack( stack );
|
||||
if( this.meAspectBridge != null )
|
||||
@@ -803,7 +805,7 @@ public class GuiArcaneCraftingTerminal
|
||||
if( !newSearch.equals( this.repo.getSearchString() ) )
|
||||
{
|
||||
// Set the search string
|
||||
this.repo.setSearchString(newSearch);
|
||||
this.repo.setSearchString( newSearch );
|
||||
|
||||
// Repo needs update
|
||||
this.viewNeedsUpdate = true;
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package thaumicenergistics.gui;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumicenergistics.api.ICraftingIssuerTerminalHost;
|
||||
import thaumicenergistics.network.packet.server.PacketServerConfirmCraftingJob;
|
||||
import appeng.client.gui.implementations.GuiCraftAmount;
|
||||
import appeng.client.gui.widgets.GuiNumberBox;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiCraftAmountBridge
|
||||
extends GuiCraftAmount
|
||||
{
|
||||
/**
|
||||
* AE Part that is issued the crafting request.
|
||||
*/
|
||||
protected ICraftingIssuerTerminalHost terminalHost;
|
||||
|
||||
/**
|
||||
* Button that returns to the terminal's GUI.
|
||||
*/
|
||||
protected GuiTabButton buttonReturnToTerminalHost;
|
||||
|
||||
/**
|
||||
* The player that is using the GUI.
|
||||
*/
|
||||
protected EntityPlayer player;
|
||||
|
||||
/**
|
||||
* The next button.
|
||||
*/
|
||||
protected GuiButton buttonNext;
|
||||
|
||||
/**
|
||||
* The amount-to-craft text box.
|
||||
*/
|
||||
protected GuiNumberBox amountToCraft;
|
||||
|
||||
public GuiCraftAmountBridge( final EntityPlayer player, final ICraftingIssuerTerminalHost te )
|
||||
{
|
||||
// Call super
|
||||
super( player.inventory, te );
|
||||
|
||||
// Set the terminal host
|
||||
this.terminalHost = te;
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
if( btn == this.buttonReturnToTerminalHost )
|
||||
{
|
||||
// Change back to terminal GUI
|
||||
this.terminalHost.launchGUI( this.player );
|
||||
}
|
||||
else if( btn == this.buttonNext )
|
||||
{
|
||||
try
|
||||
{
|
||||
// Parse the amount
|
||||
long amount = Long.parseLong( this.amountToCraft.getText() );
|
||||
|
||||
// Ask server to show confirm gui
|
||||
new PacketServerConfirmCraftingJob().createRequestConfirmAutoCraft( this.player, amount, isShiftKeyDown() ).sendPacketToServer();
|
||||
}
|
||||
catch( final NumberFormatException e )
|
||||
{
|
||||
// Reset amount to 1
|
||||
this.amountToCraft.setText( "1" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Call super
|
||||
super.actionPerformed( btn );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Get the icon of the terminal
|
||||
ItemStack myIcon = this.terminalHost.getIcon();
|
||||
|
||||
// Create the return button
|
||||
this.buttonReturnToTerminalHost = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender );
|
||||
this.buttonList.add( this.buttonReturnToTerminalHost );
|
||||
|
||||
// Get the next button
|
||||
for( Object buttonObj : this.buttonList )
|
||||
{
|
||||
if( buttonObj instanceof GuiButton )
|
||||
{
|
||||
GuiButton button = (GuiButton)buttonObj;
|
||||
if( button.displayString == GuiText.Next.getLocal() )
|
||||
{
|
||||
this.buttonNext = button;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the amount to craft
|
||||
Field atcField;
|
||||
try
|
||||
{
|
||||
atcField = GuiCraftAmount.class.getDeclaredField( "amountToCraft" );
|
||||
atcField.setAccessible( true );
|
||||
this.amountToCraft = (GuiNumberBox)atcField.get( this );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package thaumicenergistics.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import thaumicenergistics.api.ICraftingIssuerTerminalHost;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiCraftConfirmBridge
|
||||
extends GuiCraftConfirm
|
||||
{
|
||||
|
||||
/**
|
||||
* Cancel button.
|
||||
*/
|
||||
protected GuiButton buttonCancel;
|
||||
|
||||
/**
|
||||
* Player using this GUI
|
||||
*/
|
||||
protected EntityPlayer player;
|
||||
|
||||
/**
|
||||
* Host part.
|
||||
*/
|
||||
protected ICraftingIssuerTerminalHost host;
|
||||
|
||||
public GuiCraftConfirmBridge( final EntityPlayer player, final ICraftingIssuerTerminalHost terminalHost )
|
||||
{
|
||||
// Call super
|
||||
super( player.inventory, terminalHost );
|
||||
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the host
|
||||
this.host = terminalHost;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
// Sanity check
|
||||
if( btn == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.actionPerformed( btn );
|
||||
|
||||
// Cancel button or start button?
|
||||
if( ( btn == this.buttonCancel ) || ( btn.displayString == GuiText.Start.getLocal() ) )
|
||||
{
|
||||
this.host.launchGUI( this.player );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
// Call super
|
||||
super.initGui();
|
||||
|
||||
// Locate and remove the null cancel button
|
||||
for( int i = 0; i < this.buttonList.size(); ++i )
|
||||
{
|
||||
// Get the button
|
||||
Object btn = this.buttonList.get( i );
|
||||
|
||||
// Is it null?
|
||||
if( btn == null )
|
||||
{
|
||||
// Remove it and move i back 1
|
||||
this.buttonList.remove( i-- );
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new cancel button
|
||||
this.buttonList.add( this.buttonCancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal() ) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -281,8 +281,8 @@ public class GuiEssentiaStorageBus
|
||||
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();
|
||||
new PacketServerChangeGui().createChangeGuiRequest( ThEGuiHandler.generateSidedID( ThEGuiHandler.PRIORITY_ID, side ), this.player,
|
||||
host.getWorldObj(), host.xCoord, host.yCoord, host.zCoord ).sendPacketToServer();
|
||||
|
||||
}
|
||||
else if( button.id == GuiEssentiaStorageBus.BUTTON_ALLOW_VOID_ID )
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumicenergistics.ThaumicEnergistics;
|
||||
import thaumicenergistics.api.ICraftingIssuerTerminalHost;
|
||||
import thaumicenergistics.container.ContainerArcaneAssembler;
|
||||
import thaumicenergistics.container.ContainerEssentiaCell;
|
||||
import thaumicenergistics.container.ContainerEssentiaCellWorkbench;
|
||||
@@ -13,7 +14,10 @@ import thaumicenergistics.container.ContainerPriority;
|
||||
import thaumicenergistics.container.ContainerWirelessEssentiaTerminal;
|
||||
import thaumicenergistics.inventory.HandlerWirelessEssentiaTerminal;
|
||||
import thaumicenergistics.parts.AbstractAEPartBase;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
@@ -23,43 +27,56 @@ public class ThEGuiHandler
|
||||
// ID's between 0 and this number indicate that they are AE parts
|
||||
private static final int DIRECTION_OFFSET = ForgeDirection.values().length;
|
||||
|
||||
// ID's should increase in values of 10
|
||||
// ID's must increase in values of 10
|
||||
private static final int ID_STEP_VALUE = 10;
|
||||
|
||||
/**
|
||||
* Singular ID of the essentia cell gui
|
||||
*/
|
||||
public static final int ESSENTIA_CELL_ID = 10;
|
||||
public static final int ESSENTIA_CELL_ID = ID_STEP_VALUE * 1;
|
||||
|
||||
/**
|
||||
* Base ID of the priority gui.
|
||||
* Add the ForgeDirection's side ordinal to this value.
|
||||
*/
|
||||
private static final int PRIORITY_ID = 20;
|
||||
public static final int PRIORITY_ID = ID_STEP_VALUE * 2;
|
||||
|
||||
/**
|
||||
* ID of the essentia cell workbench
|
||||
*/
|
||||
public static final int CELL_WORKBENCH_ID = 30;
|
||||
public static final int CELL_WORKBENCH_ID = ID_STEP_VALUE * 3;
|
||||
|
||||
/**
|
||||
* ID of the wireless terminal gui.
|
||||
*/
|
||||
public static final int WIRELESS_TERMINAL_ID = 40;
|
||||
public static final int WIRELESS_TERMINAL_ID = ID_STEP_VALUE * 4;
|
||||
|
||||
/**
|
||||
* ID of the arcane assembler gui.
|
||||
*/
|
||||
public static final int ARCANE_ASSEMBLER_ID = 50;
|
||||
public static final int ARCANE_ASSEMBLER_ID = ID_STEP_VALUE * 5;
|
||||
|
||||
/**
|
||||
* ID of the knowledge inscriber gui.
|
||||
*/
|
||||
public static final int KNOWLEDGE_INSCRIBER = 60;
|
||||
public static final int KNOWLEDGE_INSCRIBER = ID_STEP_VALUE * 6;
|
||||
|
||||
/**
|
||||
* ID of the knowledge inscriber gui.
|
||||
*/
|
||||
public static final int ESSENTIA_VIBRATION_CHAMBER = 70;
|
||||
public static final int ESSENTIA_VIBRATION_CHAMBER = ID_STEP_VALUE * 7;
|
||||
|
||||
/**
|
||||
* ID of the auto crafting amount bridge.
|
||||
* Add the ForgeDirection's side ordinal to this value.
|
||||
*/
|
||||
public static final int AUTO_CRAFTING_AMOUNT = ID_STEP_VALUE * 8;
|
||||
|
||||
/**
|
||||
* ID of the auto crafting confirm bridge.
|
||||
* Add the ForgeDirection's side ordinal to this value.
|
||||
*/
|
||||
public static final int AUTO_CRAFTING_CONFIRM = ID_STEP_VALUE * 9;
|
||||
|
||||
/**
|
||||
* Extra data used for some GUI calls.
|
||||
@@ -76,7 +93,7 @@ public class ThEGuiHandler
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
private static AbstractAEPartBase getPart( final ForgeDirection tileSide, final World world, final int x, final int y, final int z )
|
||||
private static IPart getPart( final ForgeDirection tileSide, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Get the host at the specified position
|
||||
IPartHost partHost = (IPartHost)( world.getTileEntity( x, y, z ) );
|
||||
@@ -88,7 +105,23 @@ public class ThEGuiHandler
|
||||
}
|
||||
|
||||
// Get the part from the host
|
||||
return (AbstractAEPartBase)( partHost.getPart( tileSide ) );
|
||||
return( partHost.getPart( tileSide ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sided part for the GUI ID.
|
||||
*
|
||||
* @param ID
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
private static IPart getPartFromSidedID( final int ID, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation( ID % ThEGuiHandler.ID_STEP_VALUE );
|
||||
return ThEGuiHandler.getPart( side, world, x, y, z );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +140,7 @@ public class ThEGuiHandler
|
||||
final int z, final boolean isServerSide )
|
||||
{
|
||||
// Get the part
|
||||
AbstractAEPartBase part = ThEGuiHandler.getPart( tileSide, world, x, y, z );
|
||||
AbstractAEPartBase part = (AbstractAEPartBase)ThEGuiHandler.getPart( tileSide, world, x, y, z );
|
||||
|
||||
// Ensure we got the part
|
||||
if( part == null )
|
||||
@@ -127,14 +160,28 @@ public class ThEGuiHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to properly generate a priority gui ID
|
||||
* Returns true if the specified ID is within the base range.
|
||||
*
|
||||
* @param BaseID
|
||||
* @param ID
|
||||
* @return
|
||||
*/
|
||||
private static boolean isIDInRange( final int ID, final int BaseID )
|
||||
{
|
||||
return( ( ID >= BaseID ) && ( ID < ( BaseID + ThEGuiHandler.ID_STEP_VALUE ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to properly generate a GUI ID that
|
||||
* includes a forge direction.
|
||||
*
|
||||
* @param ID
|
||||
* @param side
|
||||
* @return
|
||||
*/
|
||||
public static int generatePriorityID( final ForgeDirection side )
|
||||
public static int generateSidedID( final int ID, final ForgeDirection side )
|
||||
{
|
||||
return ThEGuiHandler.PRIORITY_ID + side.ordinal();
|
||||
return ID + side.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,36 +253,14 @@ public class ThEGuiHandler
|
||||
// This is not an AE part, adjust the ID
|
||||
ID -= ThEGuiHandler.DIRECTION_OFFSET;
|
||||
|
||||
// Is this the essentia cell?
|
||||
if( ID == ThEGuiHandler.ESSENTIA_CELL_ID )
|
||||
{
|
||||
return GuiEssentiaCellTerminal.NewEssentiaCellGui( player, world, x, y, z );
|
||||
}
|
||||
|
||||
// Is this the priority window?
|
||||
if( ( ID >= ThEGuiHandler.PRIORITY_ID ) && ( ID < ThEGuiHandler.CELL_WORKBENCH_ID ) )
|
||||
{
|
||||
// Get the side
|
||||
side = ForgeDirection.getOrientation( ID - ThEGuiHandler.PRIORITY_ID );
|
||||
|
||||
// Get the part
|
||||
AbstractAEPartBase part = ThEGuiHandler.getPart( side, world, x, y, z );
|
||||
|
||||
// Ensure we got the part, and that it implements IPriortyHost
|
||||
if( ( part == null ) || !( part instanceof IPriorityHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the gui
|
||||
return new GuiPriority( (IPriorityHost)part, player );
|
||||
|
||||
}
|
||||
|
||||
// Check basic ID's
|
||||
switch ( ID )
|
||||
{
|
||||
// Is this the essentia cell?
|
||||
case ThEGuiHandler.ESSENTIA_CELL_ID:
|
||||
return GuiEssentiaCellTerminal.NewEssentiaCellGui( player, world, x, y, z );
|
||||
|
||||
// Is this the cell workbench?
|
||||
// Is this the cell workbench?
|
||||
case ThEGuiHandler.CELL_WORKBENCH_ID:
|
||||
return new GuiEssentiaCellWorkbench( player, world, x, y, z );
|
||||
|
||||
@@ -256,6 +281,54 @@ public class ThEGuiHandler
|
||||
return new GuiEssentiaVibrationChamber( player, world, x, y, z );
|
||||
}
|
||||
|
||||
// Is this the priority window?
|
||||
if( ThEGuiHandler.isIDInRange( ID, ThEGuiHandler.PRIORITY_ID ) )
|
||||
{
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID( ID, world, x, y, z );
|
||||
|
||||
// Ensure we got the part, and that it implements IPriortyHost
|
||||
if( ( part == null ) || !( part instanceof IPriorityHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the gui
|
||||
return new GuiPriority( (IPriorityHost)part, player );
|
||||
}
|
||||
|
||||
// AE2 Autocrafting Amount?
|
||||
if( ThEGuiHandler.isIDInRange( ID, ThEGuiHandler.AUTO_CRAFTING_AMOUNT ) )
|
||||
{
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID( ID, world, x, y, z );
|
||||
|
||||
// Ensure the part, and that it implements ICraftingIssuerTerminalHost
|
||||
if( ( part == null ) || !( part instanceof ICraftingIssuerTerminalHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the gui
|
||||
return new GuiCraftAmountBridge( player, (ICraftingIssuerTerminalHost)part );
|
||||
}
|
||||
|
||||
// AE2 Autocrafting Confirm?
|
||||
if( ThEGuiHandler.isIDInRange( ID, ThEGuiHandler.AUTO_CRAFTING_CONFIRM ) )
|
||||
{
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID( ID, world, x, y, z );
|
||||
|
||||
// Ensure the part, and that it implements ICraftingIssuerTerminalHost
|
||||
if( ( part == null ) || !( part instanceof ICraftingIssuerTerminalHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the gui
|
||||
return new GuiCraftConfirmBridge( player, (ICraftingIssuerTerminalHost)part );
|
||||
}
|
||||
|
||||
// No matching GUI element found
|
||||
return null;
|
||||
|
||||
@@ -277,36 +350,13 @@ public class ThEGuiHandler
|
||||
// This is not an AE part, adjust the ID
|
||||
ID -= ThEGuiHandler.DIRECTION_OFFSET;
|
||||
|
||||
// Is this the essentia cell?
|
||||
if( ID == ThEGuiHandler.ESSENTIA_CELL_ID )
|
||||
{
|
||||
return new ContainerEssentiaCell( player, world, x, y, z );
|
||||
}
|
||||
|
||||
// Is this the priority window?
|
||||
if( ( ID >= ThEGuiHandler.PRIORITY_ID ) && ( ID < ThEGuiHandler.CELL_WORKBENCH_ID ) )
|
||||
{
|
||||
// Get the side
|
||||
side = ForgeDirection.getOrientation( ID - ThEGuiHandler.PRIORITY_ID );
|
||||
|
||||
// Get the part
|
||||
AbstractAEPartBase part = ThEGuiHandler.getPart( side, world, x, y, z );
|
||||
|
||||
// Ensure we got the part, and that it implements IPriortyHost
|
||||
if( ( part == null ) || !( part instanceof IPriorityHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the container
|
||||
return new ContainerPriority( (IPriorityHost)part, player );
|
||||
|
||||
}
|
||||
|
||||
switch ( ID )
|
||||
{
|
||||
// Is this the essentia cell?
|
||||
case ThEGuiHandler.ESSENTIA_CELL_ID:
|
||||
return new ContainerEssentiaCell( player, world, x, y, z );
|
||||
|
||||
// Is this the cell workbench?
|
||||
// Is this the cell workbench?
|
||||
case ThEGuiHandler.CELL_WORKBENCH_ID:
|
||||
return new ContainerEssentiaCellWorkbench( player, world, x, y, z );
|
||||
|
||||
@@ -329,6 +379,57 @@ public class ThEGuiHandler
|
||||
|
||||
}
|
||||
|
||||
// Is this the priority window?
|
||||
if( ThEGuiHandler.isIDInRange( ID, ThEGuiHandler.PRIORITY_ID ) )
|
||||
{
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID( ID, world, x, y, z );
|
||||
|
||||
// Ensure we got the part, and that it implements IPriortyHost
|
||||
if( ( part == null ) || !( part instanceof IPriorityHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the container
|
||||
return new ContainerPriority( (IPriorityHost)part, player );
|
||||
|
||||
}
|
||||
|
||||
// AE2 Autocrafting Amount?
|
||||
if( ThEGuiHandler.isIDInRange( ID, ThEGuiHandler.AUTO_CRAFTING_AMOUNT ) )
|
||||
{
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID( ID, world, x, y, z );
|
||||
|
||||
// Ensure the part, and that it implements ICraftingIssuerTerminalHost
|
||||
if( ( part == null ) || !( part instanceof ICraftingIssuerTerminalHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the container
|
||||
return new ContainerCraftAmount( player.inventory, (ICraftingIssuerTerminalHost)part );
|
||||
|
||||
}
|
||||
|
||||
// AE2 Autocrafting Confirm?
|
||||
if( ThEGuiHandler.isIDInRange( ID, ThEGuiHandler.AUTO_CRAFTING_CONFIRM ) )
|
||||
{
|
||||
// Get the part
|
||||
IPart part = ThEGuiHandler.getPartFromSidedID( ID, world, x, y, z );
|
||||
|
||||
// Ensure the part, and that it implements ICraftingIssuerTerminalHost
|
||||
if( ( part == null ) || !( part instanceof ICraftingIssuerTerminalHost ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the container
|
||||
return new ContainerCraftConfirm( player.inventory, (ICraftingIssuerTerminalHost)part );
|
||||
|
||||
}
|
||||
|
||||
// No matching GUI element found
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ public class HandlerWirelessEssentiaTerminal
|
||||
|
||||
public PowerRedirector()
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,7 +31,8 @@ import appeng.core.CommonHelper;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.parts.PartPlacement.PlaceType;
|
||||
|
||||
public class ItemFocusAEWrench extends ItemFocusBasic
|
||||
public class ItemFocusAEWrench
|
||||
extends ItemFocusBasic
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -204,13 +205,20 @@ public class ItemFocusAEWrench extends ItemFocusBasic
|
||||
// Get the tile
|
||||
TileEntity te = world.getTileEntity( position.blockX, position.blockY, position.blockZ );
|
||||
|
||||
// Is there a valid tile entity?
|
||||
if( te == null )
|
||||
{
|
||||
// Nothing to do here.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is the entity a pedestal?
|
||||
if( te instanceof TilePedestal )
|
||||
{
|
||||
// Ignore pedestals
|
||||
return false;
|
||||
}
|
||||
else if( te != null && te.getClass().getName().equals( "cofh.thermalexpansion.block.cache.TileCache" ) && action != Action.LEFT_CLICK_BLOCK )
|
||||
else if( te.getClass().getName().equals( "cofh.thermalexpansion.block.cache.TileCache" ) && action != Action.LEFT_CLICK_BLOCK )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import thaumicenergistics.network.handlers.HandlerClientKnowledgeInscriber;
|
||||
import thaumicenergistics.network.handlers.HandlerClientPriority;
|
||||
import thaumicenergistics.network.handlers.HandlerServerAspectSlot;
|
||||
import thaumicenergistics.network.handlers.HandlerServerChangeGui;
|
||||
import thaumicenergistics.network.handlers.HandlerServerConfirmCrafting;
|
||||
import thaumicenergistics.network.handlers.HandlerServerEssentiaCellTerminal;
|
||||
import thaumicenergistics.network.handlers.HandlerServerEssentiaCellWorkbench;
|
||||
import thaumicenergistics.network.handlers.HandlerServerKnowledgeInscriber;
|
||||
@@ -38,6 +39,7 @@ import thaumicenergistics.network.packet.client.PacketClientPriority;
|
||||
import thaumicenergistics.network.packet.server.PacketServerArcaneCraftingTerminal;
|
||||
import thaumicenergistics.network.packet.server.PacketServerAspectSlot;
|
||||
import thaumicenergistics.network.packet.server.PacketServerChangeGui;
|
||||
import thaumicenergistics.network.packet.server.PacketServerConfirmCraftingJob;
|
||||
import thaumicenergistics.network.packet.server.PacketServerEssentiaCellTerminal;
|
||||
import thaumicenergistics.network.packet.server.PacketServerEssentiaCellWorkbench;
|
||||
import thaumicenergistics.network.packet.server.PacketServerEssentiaEmitter;
|
||||
@@ -107,6 +109,9 @@ public class ChannelHandler
|
||||
// Essentia Vibration Chamber
|
||||
wrapper.registerMessage( HandlerClientEssentiaVibrationChamber.class, PacketClientEssentiaVibrationChamber.class, discriminator++ ,
|
||||
Side.CLIENT );
|
||||
|
||||
// Confirm crafting
|
||||
wrapper.registerMessage( HandlerServerConfirmCrafting.class, PacketServerConfirmCraftingJob.class, discriminator++ , Side.SERVER );
|
||||
}
|
||||
|
||||
public static void sendPacketToAllAround( final AbstractPacket packet, final int dimension, final double x, final double y, final double z,
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package thaumicenergistics.network.handlers;
|
||||
|
||||
import thaumicenergistics.network.packet.server.PacketServerConfirmCraftingJob;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
public class HandlerServerConfirmCrafting
|
||||
implements IMessageHandler<PacketServerConfirmCraftingJob, IMessage>
|
||||
{
|
||||
|
||||
@Override
|
||||
public IMessage onMessage( final PacketServerConfirmCraftingJob message, final MessageContext ctx )
|
||||
{
|
||||
message.execute();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
package thaumicenergistics.network.packet.server;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.concurrent.Future;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumicenergistics.gui.ThEGuiHandler;
|
||||
import thaumicenergistics.network.packet.AbstractServerPacket;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.core.AELog;
|
||||
|
||||
public class PacketServerConfirmCraftingJob
|
||||
extends AbstractServerPacket
|
||||
{
|
||||
private static final byte MODE_REQUEST_CONFIRM = 1;
|
||||
|
||||
private long amount;
|
||||
private boolean heldShift;
|
||||
|
||||
@Override
|
||||
protected void readData( final ByteBuf stream )
|
||||
{
|
||||
// Read amount
|
||||
this.amount = stream.readLong();
|
||||
|
||||
// Read shift
|
||||
this.heldShift = stream.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeData( final ByteBuf stream )
|
||||
{
|
||||
// Write amount
|
||||
stream.writeLong( this.amount );
|
||||
|
||||
// Write shift
|
||||
stream.writeBoolean( this.heldShift );
|
||||
}
|
||||
|
||||
public PacketServerConfirmCraftingJob createRequestConfirmAutoCraft( final EntityPlayer player, final long amount, final boolean isShiftHeld )
|
||||
{
|
||||
// Set the player
|
||||
this.player = player;
|
||||
|
||||
// Set the mode
|
||||
this.mode = PacketServerConfirmCraftingJob.MODE_REQUEST_CONFIRM;
|
||||
|
||||
// Set amount
|
||||
this.amount = amount;
|
||||
|
||||
// Set shift
|
||||
this.heldShift = isShiftHeld;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute()
|
||||
{
|
||||
// Sanity check.
|
||||
if( this.mode != PacketServerConfirmCraftingJob.MODE_REQUEST_CONFIRM )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: The code from here down was copied from "PacketCraftRequest" from AE2
|
||||
// The only change is which GUI is launched.
|
||||
|
||||
if( this.player.openContainer instanceof ContainerCraftAmount )
|
||||
{
|
||||
final ContainerCraftAmount cca = (ContainerCraftAmount)this.player.openContainer;
|
||||
final Object target = cca.getTarget();
|
||||
if( target instanceof IGridHost )
|
||||
{
|
||||
final IGridHost gh = (IGridHost)target;
|
||||
final IGridNode gn = gh.getGridNode( ForgeDirection.UNKNOWN );
|
||||
if( gn == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final IGrid g = gn.getGrid();
|
||||
if( g == null || cca.getItemToCraft() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cca.getItemToCraft().setStackSize( this.amount );
|
||||
|
||||
Future<ICraftingJob> futureJob = null;
|
||||
try
|
||||
{
|
||||
final ICraftingGrid cg = g.getCache( ICraftingGrid.class );
|
||||
futureJob = cg.beginCraftingJob( cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.getItemToCraft(), null );
|
||||
|
||||
final ContainerOpenContext context = cca.getOpenContext();
|
||||
if( context != null )
|
||||
{
|
||||
final TileEntity te = context.getTile();
|
||||
|
||||
// Begin Thaumic Energistics Changes ===============================
|
||||
int GUI_ID = ThEGuiHandler.generateSidedID( ThEGuiHandler.AUTO_CRAFTING_CONFIRM, context.getSide() );
|
||||
|
||||
ThEGuiHandler.launchGui( GUI_ID, this.player, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord );
|
||||
// End Thaumic Energistics Changes ===============================
|
||||
|
||||
if( this.player.openContainer instanceof ContainerCraftConfirm )
|
||||
{
|
||||
final ContainerCraftConfirm ccc = (ContainerCraftConfirm)this.player.openContainer;
|
||||
ccc.setAutoStart( this.heldShift );
|
||||
ccc.setJob( futureJob );
|
||||
cca.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final Throwable e )
|
||||
{
|
||||
if( futureJob != null )
|
||||
{
|
||||
futureJob.cancel( true );
|
||||
}
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
@@ -17,13 +18,17 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumicenergistics.ThaumicEnergistics;
|
||||
import thaumicenergistics.api.ICraftingIssuerTerminalHost;
|
||||
import thaumicenergistics.container.ContainerPartArcaneCraftingTerminal;
|
||||
import thaumicenergistics.gui.GuiArcaneCraftingTerminal;
|
||||
import thaumicenergistics.gui.ThEGuiHandler;
|
||||
import thaumicenergistics.integration.tc.DigiVisSourceData;
|
||||
import thaumicenergistics.integration.tc.IDigiVisSource;
|
||||
import thaumicenergistics.network.packet.server.PacketServerChangeGui;
|
||||
import thaumicenergistics.registries.AEPartsEnum;
|
||||
import thaumicenergistics.registries.EnumCache;
|
||||
import thaumicenergistics.texture.BlockTextureManager;
|
||||
import thaumicenergistics.util.EffectiveSide;
|
||||
import thaumicenergistics.util.ThEUtils;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.SortDir;
|
||||
@@ -39,7 +44,6 @@ import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -50,7 +54,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class AEPartArcaneCraftingTerminal
|
||||
extends AbstractAEPartRotateable
|
||||
implements IInventory, IGridTickable, ITerminalHost
|
||||
implements IInventory, IGridTickable, ICraftingIssuerTerminalHost
|
||||
{
|
||||
/**
|
||||
* Number of slots in the internal inventory
|
||||
@@ -351,6 +355,12 @@ public class AEPartArcaneCraftingTerminal
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIcon()
|
||||
{
|
||||
return this.associatedItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines how much power the part takes for just
|
||||
* existing.
|
||||
@@ -548,6 +558,25 @@ public class AEPartArcaneCraftingTerminal
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launchGUI( final EntityPlayer player )
|
||||
{
|
||||
TileEntity host = this.getHostTile();
|
||||
|
||||
// Is this server side?
|
||||
if( EffectiveSide.isServerSide() )
|
||||
{
|
||||
// Launch the gui
|
||||
ThEGuiHandler.launchGui( this, player, host.getWorldObj(), host.xCoord, host.yCoord, host.zCoord );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ask the server to change the GUI
|
||||
new PacketServerChangeGui().createChangeGuiRequest( this, player, host.getWorldObj(), host.xCoord, host.yCoord, host.zCoord )
|
||||
.sendPacketToServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures the inventory is saved.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user