mirror of
https://github.com/GTNewHorizons/WirelessCraftingTerminal.git
synced 2026-11-13 00:47:32 +00:00
Use AE2 crafting status screen instead of a copy of the old one
This commit is contained in:
1 parent
3aa59a3cba
commit
506cf78f4e
9 files changed
+13
-1013
No files matched your search
+3
-3
@@ -1,10 +1,10 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-82-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-83-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
|
||||
compile("curse.maven:cofh-core-69162:2388751")
|
||||
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.6-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:NotEnoughItems:2.2.12-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev")
|
||||
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.27:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:EnderIO:2.3.1.32:dev") { transitive = false }
|
||||
}
|
||||
+1
-1
@@ -19,7 +19,7 @@ forgeVersion = 10.13.4.1614
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
developmentEnvironmentUserName = "Developer"
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Define a source file of your project with:
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
|
||||
@@ -1,476 +0,0 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiScrollbar;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftingCPU;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
|
||||
|
||||
|
||||
public class GuiCraftingCPU extends WCTBaseGui implements ISortSource
|
||||
{
|
||||
private static final int GUI_HEIGHT = 184;
|
||||
private static final int GUI_WIDTH = 238;
|
||||
|
||||
private static final int DISPLAYED_ROWS = 6;
|
||||
|
||||
private static final int TEXT_COLOR = 0x404040;
|
||||
private static final int BACKGROUND_ALPHA = 0x5A000000;
|
||||
|
||||
private static final int SECTION_LENGTH = 67;
|
||||
|
||||
private static final int SCROLLBAR_TOP = 19;
|
||||
private static final int SCROLLBAR_LEFT = 218;
|
||||
private static final int SCROLLBAR_HEIGHT = 137;
|
||||
|
||||
private static final int CANCEL_LEFT_OFFSET = 163;
|
||||
private static final int CANCEL_TOP_OFFSET = 25;
|
||||
private static final int CANCEL_HEIGHT = 20;
|
||||
private static final int CANCEL_WIDTH = 50;
|
||||
|
||||
private static final int TITLE_TOP_OFFSET = 7;
|
||||
private static final int TITLE_LEFT_OFFSET = 8;
|
||||
|
||||
private static final int ITEMSTACK_LEFT_OFFSET = 9;
|
||||
private static final int ITEMSTACK_TOP_OFFSET = 22;
|
||||
|
||||
private final ContainerCraftingCPU craftingCpu;
|
||||
|
||||
private IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||
private IItemList<IAEItemStack> active = AEApi.instance().storage().createItemList();
|
||||
private IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
|
||||
|
||||
private List<IAEItemStack> visual = new ArrayList<IAEItemStack>();
|
||||
private GuiButton cancel;
|
||||
private int tooltip = -1;
|
||||
|
||||
public GuiCraftingCPU( final InventoryPlayer inventoryPlayer, final Object te )
|
||||
{
|
||||
this( new ContainerCraftingCPU( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
protected GuiCraftingCPU( final ContainerCraftingCPU container )
|
||||
{
|
||||
super( container );
|
||||
this.craftingCpu = container;
|
||||
this.ySize = GUI_HEIGHT;
|
||||
this.xSize = GUI_WIDTH;
|
||||
|
||||
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||
this.setScrollBar( scrollbar );
|
||||
}
|
||||
|
||||
public void clearItems()
|
||||
{
|
||||
this.storage = AEApi.instance().storage().createItemList();
|
||||
this.active = AEApi.instance().storage().createItemList();
|
||||
this.pending = AEApi.instance().storage().createItemList();
|
||||
this.visual = new ArrayList<IAEItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed( final GuiButton btn )
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
if( this.cancel == btn )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileCrafting.Cancel", "Cancel" ) );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
WCTLog.debug( e.getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.setScrollBar();
|
||||
this.cancel = new GuiButton( 0, this.guiLeft + CANCEL_LEFT_OFFSET, this.guiTop + this.ySize - CANCEL_TOP_OFFSET, CANCEL_WIDTH, CANCEL_HEIGHT, GuiText.Cancel.getLocal() );
|
||||
this.buttonList.add( this.cancel );
|
||||
}
|
||||
|
||||
private void setScrollBar()
|
||||
{
|
||||
final int size = this.visual.size();
|
||||
|
||||
this.getScrollBar().setTop( SCROLLBAR_TOP ).setLeft( SCROLLBAR_LEFT ).setHeight( SCROLLBAR_HEIGHT );
|
||||
this.getScrollBar().setRange( 0, ( size + 2 ) / 3 - DISPLAYED_ROWS, 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float btn )
|
||||
{
|
||||
this.cancel.enabled = !this.visual.isEmpty();
|
||||
|
||||
final int gx = ( this.width - this.xSize ) / 2;
|
||||
final int gy = ( this.height - this.ySize ) / 2;
|
||||
|
||||
this.tooltip = -1;
|
||||
|
||||
final int offY = 23;
|
||||
int y = 0;
|
||||
int x = 0;
|
||||
for( int z = 0; z <= 4 * 5; z++ )
|
||||
{
|
||||
final int minX = gx + 9 + x * 67;
|
||||
final int minY = gy + 22 + y * offY;
|
||||
|
||||
if( minX < mouseX && minX + 67 > mouseX )
|
||||
{
|
||||
if( minY < mouseY && minY + offY - 2 > mouseY )
|
||||
{
|
||||
this.tooltip = z;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
x++;
|
||||
|
||||
if( x > 2 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen( mouseX, mouseY, btn );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
String title = this.getGuiDisplayName( GuiText.CraftingStatus.getLocal() );
|
||||
|
||||
if( this.craftingCpu.getEstimatedTime() > 0 && !this.visual.isEmpty() )
|
||||
{
|
||||
final long etaInMilliseconds = TimeUnit.MILLISECONDS.convert( this.craftingCpu.getEstimatedTime(), TimeUnit.NANOSECONDS );
|
||||
final String etaTimeText = DurationFormatUtils.formatDuration( etaInMilliseconds, GuiText.ETAFormat.getLocal() );
|
||||
title += " - " + etaTimeText;
|
||||
}
|
||||
|
||||
this.fontRendererObj.drawString( title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR );
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
final int viewStart = this.getScrollBar().getCurrentScroll() * 3;
|
||||
final int viewEnd = viewStart + 3 * 6;
|
||||
|
||||
String dspToolTip = "";
|
||||
final List<String> lineList = new LinkedList<String>();
|
||||
int toolPosX = 0;
|
||||
int toolPosY = 0;
|
||||
|
||||
final int offY = 23;
|
||||
|
||||
final ReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
|
||||
for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ )
|
||||
{
|
||||
final IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z );
|
||||
if( refStack != null )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( 0.5, 0.5, 0.5 );
|
||||
|
||||
final IAEItemStack stored = this.storage.findPrecise( refStack );
|
||||
final IAEItemStack activeStack = this.active.findPrecise( refStack );
|
||||
final IAEItemStack pendingStack = this.pending.findPrecise( refStack );
|
||||
|
||||
int lines = 0;
|
||||
|
||||
if( stored != null && stored.getStackSize() > 0 )
|
||||
{
|
||||
lines++;
|
||||
}
|
||||
boolean active = false;
|
||||
if( activeStack != null && activeStack.getStackSize() > 0 )
|
||||
{
|
||||
lines++;
|
||||
active = true;
|
||||
}
|
||||
boolean scheduled = false;
|
||||
if( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
{
|
||||
lines++;
|
||||
scheduled = true;
|
||||
}
|
||||
|
||||
if( AEConfig.instance.useColoredCraftingStatus && ( active || scheduled ) )
|
||||
{
|
||||
final int bgColor = ( active ? AEColor.Green.blackVariant : AEColor.Yellow.blackVariant ) | BACKGROUND_ALPHA;
|
||||
final int startX = ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET ) * 2;
|
||||
final int startY = ( ( y * offY + ITEMSTACK_TOP_OFFSET ) - 3 ) * 2;
|
||||
drawRect( startX, startY, startX + ( SECTION_LENGTH * 2 ), startY + ( offY * 2 ) - 2, bgColor );
|
||||
}
|
||||
|
||||
final int negY = ( ( lines - 1 ) * 5 ) / 2;
|
||||
int downY = 0;
|
||||
|
||||
if( stored != null && stored.getStackSize() > 0 )
|
||||
{
|
||||
final String str = GuiText.Stored.getLocal() + ": " + converter.toWideReadableForm( stored.getStackSize() );
|
||||
final int w = 4 + this.fontRendererObj.getStringWidth( str );
|
||||
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR );
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
lineList.add( GuiText.Stored.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
|
||||
}
|
||||
|
||||
downY += 5;
|
||||
}
|
||||
|
||||
if( activeStack != null && activeStack.getStackSize() > 0 )
|
||||
{
|
||||
final String str = GuiText.Crafting.getLocal() + ": " + converter.toWideReadableForm( activeStack.getStackSize() );
|
||||
final int w = 4 + this.fontRendererObj.getStringWidth( str );
|
||||
|
||||
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR );
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
lineList.add( GuiText.Crafting.getLocal() + ": " + Long.toString( activeStack.getStackSize() ) );
|
||||
}
|
||||
|
||||
downY += 5;
|
||||
}
|
||||
|
||||
if( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
{
|
||||
final String str = GuiText.Scheduled.getLocal() + ": " + converter.toWideReadableForm( pendingStack.getStackSize() );
|
||||
final int w = 4 + this.fontRendererObj.getStringWidth( str );
|
||||
|
||||
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY ) * 2, TEXT_COLOR );
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
lineList.add( GuiText.Scheduled.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
final int posX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19;
|
||||
final int posY = y * offY + ITEMSTACK_TOP_OFFSET;
|
||||
|
||||
final ItemStack is = refStack.copy().getItemStack();
|
||||
|
||||
if( this.tooltip == z - viewStart )
|
||||
{
|
||||
dspToolTip = Platform.getItemDisplayName( is );
|
||||
|
||||
if( lineList.size() > 0 )
|
||||
{
|
||||
addItemTooltip(is, lineList);
|
||||
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
|
||||
}
|
||||
|
||||
toolPosX = x * ( 1 + SECTION_LENGTH ) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 8;
|
||||
toolPosY = y * offY + ITEMSTACK_TOP_OFFSET;
|
||||
}
|
||||
|
||||
this.drawItem( posX, posY, is );
|
||||
|
||||
x++;
|
||||
|
||||
if( x > 2 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( this.tooltip >= 0 && dspToolTip.length() > 0 )
|
||||
{
|
||||
this.drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
|
||||
{
|
||||
this.bindTexture( "appliedenergistics2", "guis/craftingcpu.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
|
||||
}
|
||||
|
||||
public void postUpdate( final List<IAEItemStack> list, final byte ref )
|
||||
{
|
||||
switch( ref )
|
||||
{
|
||||
case 0:
|
||||
for( final IAEItemStack l : list )
|
||||
{
|
||||
this.handleInput( this.storage, l );
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
for( final IAEItemStack l : list )
|
||||
{
|
||||
this.handleInput( this.active, l );
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
for( final IAEItemStack l : list )
|
||||
{
|
||||
this.handleInput( this.pending, l );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for( final IAEItemStack l : list )
|
||||
{
|
||||
final long amt = this.getTotal( l );
|
||||
|
||||
if( amt <= 0 )
|
||||
{
|
||||
this.deleteVisualStack( l );
|
||||
}
|
||||
else
|
||||
{
|
||||
final IAEItemStack is = this.findVisualStack( l );
|
||||
is.setStackSize( amt );
|
||||
}
|
||||
}
|
||||
|
||||
this.setScrollBar();
|
||||
}
|
||||
|
||||
private void handleInput( final IItemList<IAEItemStack> s, final IAEItemStack l )
|
||||
{
|
||||
IAEItemStack a = s.findPrecise( l );
|
||||
|
||||
if( l.getStackSize() <= 0 )
|
||||
{
|
||||
if( a != null )
|
||||
{
|
||||
a.reset();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( a == null )
|
||||
{
|
||||
s.add( l.copy() );
|
||||
a = s.findPrecise( l );
|
||||
}
|
||||
|
||||
if( a != null )
|
||||
{
|
||||
a.setStackSize( l.getStackSize() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private long getTotal( final IAEItemStack is )
|
||||
{
|
||||
final IAEItemStack a = this.storage.findPrecise( is );
|
||||
final IAEItemStack b = this.active.findPrecise( is );
|
||||
final IAEItemStack c = this.pending.findPrecise( is );
|
||||
|
||||
long total = 0;
|
||||
|
||||
if( a != null )
|
||||
{
|
||||
total += a.getStackSize();
|
||||
}
|
||||
|
||||
if( b != null )
|
||||
{
|
||||
total += b.getStackSize();
|
||||
}
|
||||
|
||||
if( c != null )
|
||||
{
|
||||
total += c.getStackSize();
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
private void deleteVisualStack( final IAEItemStack l )
|
||||
{
|
||||
final Iterator<IAEItemStack> i = this.visual.iterator();
|
||||
|
||||
while( i.hasNext() )
|
||||
{
|
||||
final IAEItemStack o = i.next();
|
||||
if( o.equals( l ) )
|
||||
{
|
||||
i.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IAEItemStack findVisualStack( final IAEItemStack l )
|
||||
{
|
||||
for( final IAEItemStack o : this.visual )
|
||||
{
|
||||
if( o.equals( l ) )
|
||||
{
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
final IAEItemStack stack = l.copy();
|
||||
this.visual.add( stack );
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Enum getSortBy()
|
||||
{
|
||||
return SortOrder.NAME;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Enum getSortDir()
|
||||
{
|
||||
return SortDir.ASCENDING;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Enum getSortDisplay()
|
||||
{
|
||||
return ViewItems.ALL;
|
||||
}
|
||||
}
|
||||
+6
-72
@@ -1,35 +1,25 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.client.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import appeng.container.implementations.ContainerCraftingStatus;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.core.localization.GuiText;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTabButton;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftingStatus;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
|
||||
|
||||
public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus
|
||||
{
|
||||
|
||||
private final ContainerCraftingStatus status;
|
||||
private GuiButton selectCPU;
|
||||
|
||||
private GuiTabButton originalGuiBtn;
|
||||
private int originalGui;
|
||||
private ItemStack myIcon = null;
|
||||
@@ -37,10 +27,10 @@ public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
@SuppressWarnings("unused")
|
||||
public GuiCraftingStatus( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
||||
{
|
||||
super( new ContainerCraftingStatus( inventoryPlayer, te ) );
|
||||
super( inventoryPlayer, te );
|
||||
|
||||
this.status = (ContainerCraftingStatus) this.inventorySlots;
|
||||
final Object target = this.status.getTarget();
|
||||
ContainerCraftingStatus status = (ContainerCraftingStatus) this.inventorySlots;
|
||||
final Object target = status.getTarget();
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
|
||||
@@ -50,7 +40,7 @@ public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
{
|
||||
this.myIcon = wirelessTerminalStack;
|
||||
}
|
||||
|
||||
|
||||
ItemStack is = new ItemStack(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem());
|
||||
((ItemWirelessCraftingTerminal) is.getItem()).injectAEPower(is, 6400001);
|
||||
myIcon = is;
|
||||
@@ -64,20 +54,6 @@ public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
final boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if( btn == this.selectCPU )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
WCTLog.debug( e.getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
if( btn == this.originalGuiBtn )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
|
||||
@@ -90,52 +66,10 @@ public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
this.selectCPU = new GuiButton( 0, this.guiLeft + 8, this.guiTop + this.ySize - 25, 150, 20, GuiText.CraftingCPU.getLocal() + ": " + GuiText.NoCraftingCPUs );
|
||||
// selectCPU.enabled = false;
|
||||
this.buttonList.add( this.selectCPU );
|
||||
|
||||
if( this.myIcon != null )
|
||||
{
|
||||
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, this.myIcon, this.myIcon.getDisplayName(), itemRender ) );
|
||||
this.originalGuiBtn.setHideEdge( 13 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen( final int mouseX, final int mouseY, final float btn )
|
||||
{
|
||||
this.updateCPUButtonText();
|
||||
super.drawScreen( mouseX, mouseY, btn );
|
||||
}
|
||||
|
||||
private void updateCPUButtonText()
|
||||
{
|
||||
String btnTextText = GuiText.NoCraftingJobs.getLocal();
|
||||
|
||||
if( this.status.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
|
||||
{
|
||||
if( this.status.myName.length() > 0 )
|
||||
{
|
||||
final String name = this.status.myName.substring( 0, Math.min( 20, this.status.myName.length() ) );
|
||||
btnTextText = GuiText.CPUs.getLocal() + ": " + name;
|
||||
}
|
||||
else
|
||||
{
|
||||
btnTextText = GuiText.CPUs.getLocal() + ": #" + this.status.selectedCpu;
|
||||
}
|
||||
}
|
||||
|
||||
if( this.status.noCPU )
|
||||
{
|
||||
btnTextText = GuiText.NoCraftingJobs.getLocal();
|
||||
}
|
||||
|
||||
this.selectCPU.displayString = btnTextText;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getGuiDisplayName( final String in )
|
||||
{
|
||||
return in; // the cup name is on the button
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.p455w0rd.wirelesscraftingterminal.common;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.container.implementations.ContainerCraftingStatus;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
@@ -13,7 +14,6 @@ import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiMagnet;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftAmount;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftingStatus;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerMagnet;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
|
||||
-277
@@ -1,277 +0,0 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.common.container;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.crafting.CraftingItemList;
|
||||
import appeng.api.networking.crafting.ICraftingCPU;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.guisync.GuiSync;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
|
||||
|
||||
public class ContainerCraftingCPU extends WCTBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject
|
||||
{
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
private CraftingCPUCluster monitor = null;
|
||||
private String cpuName = null;
|
||||
private final WirelessTerminalGuiObject obj;
|
||||
|
||||
@GuiSync( 0 )
|
||||
public long eta = -1;
|
||||
|
||||
public ContainerCraftingCPU( final InventoryPlayer ip, final Object te )
|
||||
{
|
||||
super( ip, te );
|
||||
this.obj = getGuiObject(RandomUtils.getWirelessTerm(ip), ip.player, ip.player.worldObj, (int) ip.player.posX, (int) ip.player.posY, (int) ip.player.posZ);
|
||||
if (this.obj == null) {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
/*
|
||||
final IGridHost host = (IGridHost) ( te instanceof IGridHost ? te : null );
|
||||
|
||||
if( host != null )
|
||||
{
|
||||
this.findNode( host, ForgeDirection.UNKNOWN );
|
||||
for( final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
this.findNode( host, d );
|
||||
}
|
||||
}
|
||||
|
||||
if( te instanceof TileCraftingTile )
|
||||
{
|
||||
this.setCPU( (ICraftingCPU) ( (IAEMultiBlock) te ).getCluster() );
|
||||
}
|
||||
|
||||
if( this.getNetwork() == null && Platform.isServer() )
|
||||
{
|
||||
this.setValidContainer( false );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
protected WirelessTerminalGuiObject getGuiObject(final ItemStack it, final EntityPlayer player, final World w, final int x, final int y, final int z) {
|
||||
if (it != null) {
|
||||
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless().getWirelessTerminalHandler(it);
|
||||
if (wh != null) {
|
||||
return new WirelessTerminalGuiObject(wh, it, player, w, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void setCPU( final ICraftingCPU c )
|
||||
{
|
||||
if( c == this.getMonitor() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.getMonitor() != null )
|
||||
{
|
||||
this.getMonitor().removeListener( this );
|
||||
}
|
||||
|
||||
for( final Object g : this.crafters )
|
||||
{
|
||||
if( g instanceof EntityPlayer )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketValueConfig( "CraftingStatus", "Clear" ), (EntityPlayerMP) g );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
WCTLog.debug( e.getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( c instanceof CraftingCPUCluster )
|
||||
{
|
||||
this.cpuName = c.getName();
|
||||
this.setMonitor( (CraftingCPUCluster) c );
|
||||
this.list.resetStatus();
|
||||
this.getMonitor().getListOfItem( this.list, CraftingItemList.ALL );
|
||||
this.getMonitor().addListener( this, null );
|
||||
this.setEstimatedTime( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setMonitor( null );
|
||||
this.cpuName = "";
|
||||
this.setEstimatedTime( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelCrafting()
|
||||
{
|
||||
if( this.getMonitor() != null )
|
||||
{
|
||||
this.getMonitor().cancel();
|
||||
}
|
||||
this.setEstimatedTime( -1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCraftingFromCrafters( final ICrafting c )
|
||||
{
|
||||
super.removeCraftingFromCrafters( c );
|
||||
|
||||
if( this.crafters.isEmpty() && this.getMonitor() != null )
|
||||
{
|
||||
this.getMonitor().removeListener( this );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed( final EntityPlayer player )
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
if( this.getMonitor() != null )
|
||||
{
|
||||
this.getMonitor().removeListener( this );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
if( Platform.isServer() && this.getMonitor() != null && !this.list.isEmpty() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( this.getEstimatedTime() >= 0 )
|
||||
{
|
||||
final long elapsedTime = this.getMonitor().getElapsedTime();
|
||||
final double remainingItems = this.getMonitor().getRemainingItemCount();
|
||||
final double startItems = this.getMonitor().getStartItemCount();
|
||||
final long eta = (long) ( elapsedTime / Math.max( 1d, ( startItems - remainingItems ) ) * remainingItems );
|
||||
this.setEstimatedTime( eta );
|
||||
}
|
||||
|
||||
final PacketMEInventoryUpdate a = new PacketMEInventoryUpdate( (byte) 0 );
|
||||
final PacketMEInventoryUpdate b = new PacketMEInventoryUpdate( (byte) 1 );
|
||||
final PacketMEInventoryUpdate c = new PacketMEInventoryUpdate( (byte) 2 );
|
||||
|
||||
for( final IAEItemStack out : this.list )
|
||||
{
|
||||
a.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.STORAGE ) );
|
||||
b.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.ACTIVE ) );
|
||||
c.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.PENDING ) );
|
||||
}
|
||||
|
||||
this.list.resetStatus();
|
||||
|
||||
for( final Object g : this.crafters )
|
||||
{
|
||||
if( g instanceof EntityPlayer )
|
||||
{
|
||||
if( !a.isEmpty() )
|
||||
{
|
||||
NetworkHandler.instance.sendTo( a, (EntityPlayerMP) g );
|
||||
}
|
||||
|
||||
if( !b.isEmpty() )
|
||||
{
|
||||
NetworkHandler.instance.sendTo( b, (EntityPlayerMP) g );
|
||||
}
|
||||
|
||||
if( !c.isEmpty() )
|
||||
{
|
||||
NetworkHandler.instance.sendTo( c, (EntityPlayerMP) g );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( final Object verificationToken )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final BaseActionSource actionSource )
|
||||
{
|
||||
for( IAEItemStack is : change )
|
||||
{
|
||||
is = is.copy();
|
||||
is.setStackSize( 1 );
|
||||
this.list.add( is );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCustomName()
|
||||
{
|
||||
return this.cpuName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return this.cpuName != null && this.cpuName.length() > 0;
|
||||
}
|
||||
|
||||
public long getEstimatedTime()
|
||||
{
|
||||
return this.eta;
|
||||
}
|
||||
|
||||
private void setEstimatedTime( final long eta )
|
||||
{
|
||||
this.eta = eta;
|
||||
}
|
||||
|
||||
CraftingCPUCluster getMonitor()
|
||||
{
|
||||
return this.monitor;
|
||||
}
|
||||
|
||||
private void setMonitor( final CraftingCPUCluster monitor )
|
||||
{
|
||||
this.monitor = monitor;
|
||||
}
|
||||
|
||||
IGrid getNetwork()
|
||||
{
|
||||
return this.obj.getTargetGrid();
|
||||
}
|
||||
}
|
||||
-156
@@ -1,156 +0,0 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.common.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.networking.crafting.ICraftingCPU;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.guisync.GuiSync;
|
||||
|
||||
|
||||
public class ContainerCraftingStatus extends ContainerCraftingCPU
|
||||
{
|
||||
|
||||
private final List<CraftingCPURecord> cpus = new ArrayList<CraftingCPURecord>();
|
||||
@GuiSync( 5 )
|
||||
public int selectedCpu = -1;
|
||||
@GuiSync( 6 )
|
||||
public boolean noCPU = true;
|
||||
@GuiSync( 7 )
|
||||
public String myName = "";
|
||||
|
||||
public ContainerCraftingStatus( final InventoryPlayer ip, final ITerminalHost te )
|
||||
{
|
||||
super( ip, te );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class );
|
||||
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
|
||||
|
||||
int matches = 0;
|
||||
boolean changed = false;
|
||||
for( final ICraftingCPU c : cpuSet )
|
||||
{
|
||||
boolean found = false;
|
||||
for( final CraftingCPURecord ccr : this.cpus )
|
||||
{
|
||||
if( ccr.getCpu() == c )
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
final boolean matched = this.cpuMatches( c );
|
||||
|
||||
if( matched )
|
||||
{
|
||||
matches++;
|
||||
}
|
||||
|
||||
if( found == !matched )
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( changed || this.cpus.size() != matches )
|
||||
{
|
||||
this.cpus.clear();
|
||||
for( final ICraftingCPU c : cpuSet )
|
||||
{
|
||||
if( this.cpuMatches( c ) )
|
||||
{
|
||||
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
|
||||
}
|
||||
}
|
||||
|
||||
this.sendCPUs();
|
||||
}
|
||||
|
||||
this.noCPU = this.cpus.isEmpty();
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
private boolean cpuMatches( final ICraftingCPU c )
|
||||
{
|
||||
return c.isBusy();
|
||||
}
|
||||
|
||||
private void sendCPUs()
|
||||
{
|
||||
Collections.sort( this.cpus );
|
||||
|
||||
if( this.selectedCpu >= this.cpus.size() )
|
||||
{
|
||||
this.selectedCpu = -1;
|
||||
this.myName = "";
|
||||
}
|
||||
else if( this.selectedCpu != -1 )
|
||||
{
|
||||
this.myName = this.cpus.get( this.selectedCpu ).getName();
|
||||
}
|
||||
|
||||
if( this.selectedCpu == -1 && this.cpus.size() > 0 )
|
||||
{
|
||||
this.selectedCpu = 0;
|
||||
}
|
||||
|
||||
if( this.selectedCpu != -1 )
|
||||
{
|
||||
if( this.cpus.get( this.selectedCpu ).getCpu() != this.getMonitor() )
|
||||
{
|
||||
this.setCPU( this.cpus.get( this.selectedCpu ).getCpu() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setCPU( null );
|
||||
}
|
||||
}
|
||||
|
||||
public void cycleCpu( final boolean next )
|
||||
{
|
||||
if( next )
|
||||
{
|
||||
this.selectedCpu++;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.selectedCpu--;
|
||||
}
|
||||
|
||||
if( this.selectedCpu < -1 )
|
||||
{
|
||||
this.selectedCpu = this.cpus.size() - 1;
|
||||
}
|
||||
else if( this.selectedCpu >= this.cpus.size() )
|
||||
{
|
||||
this.selectedCpu = -1;
|
||||
}
|
||||
|
||||
if( this.selectedCpu == -1 && this.cpus.size() > 0 )
|
||||
{
|
||||
this.selectedCpu = 0;
|
||||
}
|
||||
|
||||
if( this.selectedCpu == -1 )
|
||||
{
|
||||
this.myName = "";
|
||||
this.setCPU( null );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.myName = this.cpus.get( this.selectedCpu ).getName();
|
||||
this.setCPU( this.cpus.get( this.selectedCpu ).getCpu() );
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-7
@@ -22,7 +22,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftingCPU;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||
@@ -129,11 +128,6 @@ public class PacketMEInventoryUpdate extends WCTPacket
|
||||
( (GuiCraftConfirm) gs ).postUpdate( this.list, this.ref );
|
||||
}
|
||||
|
||||
if( gs instanceof GuiCraftingCPU )
|
||||
{
|
||||
( (GuiCraftingCPU) gs ).postUpdate( this.list, this.ref );
|
||||
}
|
||||
|
||||
if( gs instanceof GuiWirelessCraftingTerminal )
|
||||
{
|
||||
( (GuiWirelessCraftingTerminal) gs ).postUpdate( this.list );
|
||||
@@ -187,4 +181,4 @@ public class PacketMEInventoryUpdate extends WCTPacket
|
||||
{
|
||||
return this.empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-20
@@ -12,15 +12,10 @@ import appeng.api.util.IConfigurableObject;
|
||||
import appeng.helpers.IMouseWheelItem;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftingCPU;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftingCPU;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftingStatus;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.WCTBaseContainer;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
@@ -65,10 +60,6 @@ public class PacketValueConfig extends WCTPacket {
|
||||
final IMouseWheelItem si = (IMouseWheelItem) is.getItem();
|
||||
si.onWheel(is, this.Value.equals("WheelUp"));
|
||||
}
|
||||
else if (this.Name.equals("Terminal.Cpu") && c instanceof ContainerCraftingStatus) {
|
||||
final ContainerCraftingStatus qk = (ContainerCraftingStatus) c;
|
||||
qk.cycleCpu(this.Value.equals("Next"));
|
||||
}
|
||||
else if (this.Name.equals("Terminal.Cpu") && c instanceof ContainerCraftConfirm) {
|
||||
final ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
|
||||
qk.cycleCpu(this.Value.equals("Next"));
|
||||
@@ -77,10 +68,6 @@ public class PacketValueConfig extends WCTPacket {
|
||||
final ContainerCraftConfirm qk = (ContainerCraftConfirm) c;
|
||||
qk.startJob();
|
||||
}
|
||||
else if (this.Name.equals("TileCrafting.Cancel") && c instanceof ContainerCraftingCPU) {
|
||||
final ContainerCraftingCPU qk = (ContainerCraftingCPU) c;
|
||||
qk.cancelCrafting();
|
||||
}
|
||||
else if (c instanceof IConfigurableObject) {
|
||||
final IConfigManager cm = ((IConfigurableObject) c).getConfigManager();
|
||||
|
||||
@@ -122,12 +109,6 @@ public class PacketValueConfig extends WCTPacket {
|
||||
((WCTBaseContainer) c).stringSync(Integer.parseInt(this.Name.substring(8)), this.Value);
|
||||
}
|
||||
}
|
||||
else if (this.Name.equals("CraftingStatus") && this.Value.equals("Clear")) {
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
if (gs instanceof GuiCraftingCPU) {
|
||||
((GuiCraftingCPU) gs).clearItems();
|
||||
}
|
||||
}
|
||||
else if (c instanceof IConfigurableObject) {
|
||||
final IConfigManager cm = ((IConfigurableObject) c).getConfigManager();
|
||||
|
||||
@@ -146,4 +127,4 @@ public class PacketValueConfig extends WCTPacket {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user