fix interfaces with crafting cards attached to storage bus not working
add missing buttons to oredict storagebus
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ aebuild=7
|
||||
aegroup=appeng
|
||||
aebasename=appliedenergistics2
|
||||
extended=extended_life
|
||||
extendedversion=v50
|
||||
extendedversion=v50b
|
||||
#########################################################
|
||||
# Versions #
|
||||
#########################################################
|
||||
|
||||
+47
-17
@@ -1,38 +1,46 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.StorageFilter;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.container.implementations.ContainerPartOreDictStorageBus;
|
||||
import appeng.container.implementations.ContainerOreDictStorageBus;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.parts.misc.PartOreDicStorageBus;
|
||||
import appeng.util.item.OreDictFilterMatcher;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public class GuiPartOreDictStorageBus extends AEBaseGui
|
||||
public class GuiOreDictStorageBus extends AEBaseGui
|
||||
{
|
||||
private final ContainerOreDictStorageBus container;
|
||||
PartOreDicStorageBus part;
|
||||
private GuiTabButton priority;
|
||||
private GuiImgButton partition;
|
||||
|
||||
private GuiImgButton storageFilter;
|
||||
private GuiImgButton rwMode;
|
||||
private static final Pattern ORE_DICTIONARY_FILTER = Pattern.compile( "[(!]* *[0-9a-zA-Z*]* *\\)*( *[&|^]? *[(!]* *[0-9a-zA-Z*]* *\\)*)*" );
|
||||
private MEGuiTextField searchFieldInputs;
|
||||
|
||||
public GuiPartOreDictStorageBus( final InventoryPlayer inventoryPlayer, final PartOreDicStorageBus te )
|
||||
public GuiOreDictStorageBus( final InventoryPlayer inventoryPlayer, final PartOreDicStorageBus te )
|
||||
{
|
||||
super( new ContainerPartOreDictStorageBus( inventoryPlayer, te ) );
|
||||
super( new ContainerOreDictStorageBus( inventoryPlayer, te ) );
|
||||
this.container = (ContainerOreDictStorageBus) super.inventorySlots;
|
||||
part = te;
|
||||
this.ySize = 84;
|
||||
}
|
||||
@@ -52,6 +60,8 @@ public class GuiPartOreDictStorageBus extends AEBaseGui
|
||||
|
||||
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ) );
|
||||
this.buttonList.add( this.partition = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH ) );
|
||||
this.buttonList.add( this.rwMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.ACCESS, AccessRestriction.READ_WRITE ) );
|
||||
this.buttonList.add( this.storageFilter = new GuiImgButton( this.guiLeft - 18, this.guiTop + 68, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY ) );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -73,21 +83,31 @@ public class GuiPartOreDictStorageBus extends AEBaseGui
|
||||
protected void actionPerformed( final GuiButton btn ) throws IOException
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
if( btn == this.priority )
|
||||
|
||||
final boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
||||
if( btn == this.priority )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
||||
}
|
||||
else if( btn == this.partition )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( "StorageBus.Action", "Partition" ) );
|
||||
}
|
||||
else if( btn == this.rwMode )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.rwMode.getSetting(), backwards ) );
|
||||
}
|
||||
else if( btn == this.storageFilter )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketConfigButton( this.storageFilter.getSetting(), backwards ) );
|
||||
}
|
||||
}
|
||||
if( btn == this.partition )
|
||||
catch( final IOException e )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( "StorageBus.Action", "Partition" ) );
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( "OreDictStorageBus.getRegex", "1" ) );
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +152,16 @@ public class GuiPartOreDictStorageBus extends AEBaseGui
|
||||
this.fontRenderer.drawString( "^ = XOR " + "! = NOT", 8, 48, 4210752 );
|
||||
this.fontRenderer.drawString( "() for priority " + "* for wildcard", 8, 60, 4210752 );
|
||||
this.fontRenderer.drawString( "Ex.: *Redstone*&!dustRedstone", 8, 72, 4210752 );
|
||||
|
||||
if( this.storageFilter != null )
|
||||
{
|
||||
this.storageFilter.set( container.getStorageFilter() );
|
||||
}
|
||||
|
||||
if( this.rwMode != null )
|
||||
{
|
||||
this.rwMode.set( container.getReadWriteMode() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
+35
-4
@@ -1,10 +1,12 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.parts.misc.PartOreDicStorageBus;
|
||||
@@ -21,11 +23,17 @@ import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class ContainerPartOreDictStorageBus extends AEBaseContainer
|
||||
public class ContainerOreDictStorageBus extends AEBaseContainer
|
||||
{
|
||||
private final PartOreDicStorageBus part;
|
||||
|
||||
public ContainerPartOreDictStorageBus( final InventoryPlayer ip, final PartOreDicStorageBus anchor )
|
||||
@GuiSync( 3 )
|
||||
public AccessRestriction rwMode = AccessRestriction.READ_WRITE;
|
||||
|
||||
@GuiSync( 4 )
|
||||
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
|
||||
|
||||
public ContainerOreDictStorageBus( final InventoryPlayer ip, final PartOreDicStorageBus anchor )
|
||||
{
|
||||
super( ip, anchor );
|
||||
this.part = anchor;
|
||||
@@ -36,9 +44,12 @@ public class ContainerPartOreDictStorageBus extends AEBaseContainer
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
return;
|
||||
this.setReadWriteMode( (AccessRestriction) part.getConfigManager().getSetting( Settings.ACCESS ) );
|
||||
this.setStorageFilter( (StorageFilter) part.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
|
||||
}
|
||||
|
||||
super.detectAndSendChanges();
|
||||
@@ -106,4 +117,24 @@ public class ContainerPartOreDictStorageBus extends AEBaseContainer
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public AccessRestriction getReadWriteMode()
|
||||
{
|
||||
return this.rwMode;
|
||||
}
|
||||
|
||||
private void setReadWriteMode( final AccessRestriction rwMode )
|
||||
{
|
||||
this.rwMode = rwMode;
|
||||
}
|
||||
|
||||
public StorageFilter getStorageFilter()
|
||||
{
|
||||
return this.storageFilter;
|
||||
}
|
||||
|
||||
private void setStorageFilter( final StorageFilter storageFilter )
|
||||
{
|
||||
this.storageFilter = storageFilter;
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
|
||||
GUI_STORAGEBUS( ContainerStorageBus.class, PartStorageBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
|
||||
GUI_OREDICTSTORAGEBUS( ContainerPartOreDictStorageBus.class, PartOreDicStorageBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
GUI_OREDICTSTORAGEBUS( ContainerOreDictStorageBus.class, PartOreDicStorageBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
|
||||
GUI_STORAGEBUS_FLUID( ContainerFluidStorageBus.class, PartFluidStorageBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import appeng.client.gui.implementations.GuiPartOreDictStorageBus;
|
||||
import appeng.client.gui.implementations.GuiOreDictStorageBus;
|
||||
import appeng.container.implementations.*;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
@@ -276,9 +276,10 @@ public class PacketValueConfig extends AppEngPacket
|
||||
{
|
||||
( (ContainerFluidStorageBus) c ).partition();
|
||||
}
|
||||
else if( c instanceof ContainerPartOreDictStorageBus )
|
||||
else if( c instanceof ContainerOreDictStorageBus )
|
||||
{
|
||||
( (ContainerPartOreDictStorageBus) c ).partition();
|
||||
( (ContainerOreDictStorageBus) c ).partition();
|
||||
( (ContainerOreDictStorageBus) c ).sendRegex();
|
||||
}
|
||||
}
|
||||
else if( this.Value.equals( "Clear" ) )
|
||||
@@ -296,15 +297,15 @@ public class PacketValueConfig extends AppEngPacket
|
||||
}
|
||||
else if( this.Name.startsWith( "OreDictStorageBus" ) )
|
||||
{
|
||||
if( c instanceof ContainerPartOreDictStorageBus )
|
||||
if( c instanceof ContainerOreDictStorageBus )
|
||||
{
|
||||
if( this.Name.equals( "OreDictStorageBus.save" ) )
|
||||
{
|
||||
( (ContainerPartOreDictStorageBus) c ).saveOreMatch( this.Value );
|
||||
( (ContainerOreDictStorageBus) c ).saveOreMatch( this.Value );
|
||||
}
|
||||
if( this.Name.equals( "OreDictStorageBus.getRegex" ) )
|
||||
{
|
||||
( (ContainerPartOreDictStorageBus) c ).sendRegex();
|
||||
( (ContainerOreDictStorageBus) c ).sendRegex();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -387,9 +388,9 @@ public class PacketValueConfig extends AppEngPacket
|
||||
else if( this.Name.equals( "OreDictStorageBus.sendRegex" ) )
|
||||
{
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
if( gs instanceof GuiPartOreDictStorageBus )
|
||||
if( gs instanceof GuiOreDictStorageBus )
|
||||
{
|
||||
( (GuiPartOreDictStorageBus) gs ).fillRegex( this.Value );
|
||||
( (GuiOreDictStorageBus) gs ).fillRegex( this.Value );
|
||||
}
|
||||
}
|
||||
else if( c instanceof IConfigurableObject )
|
||||
|
||||
@@ -903,18 +903,15 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
IAEItemStack storedStack = this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).getStorageList().findPrecise( itemStack );
|
||||
if( storedStack != null )
|
||||
{
|
||||
if( storedStack.getStackSize() > 0 )
|
||||
final IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.interfaceRequestSource );
|
||||
if( acquired != null )
|
||||
{
|
||||
final IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.interfaceRequestSource );
|
||||
if( acquired != null )
|
||||
changed = true;
|
||||
inputStack.setCount( Ints.saturatedCast( acquired.getStackSize() ) );
|
||||
final ItemStack issue = adaptor.addItems( inputStack );
|
||||
if( !issue.isEmpty() )
|
||||
{
|
||||
changed = true;
|
||||
inputStack.setCount( Ints.saturatedCast( acquired.getStackSize() ) );
|
||||
final ItemStack issue = adaptor.addItems( inputStack );
|
||||
if( !issue.isEmpty() )
|
||||
{
|
||||
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" );
|
||||
}
|
||||
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" );
|
||||
}
|
||||
}
|
||||
else if( storedStack.isCraftable() )
|
||||
|
||||
Reference in New Issue
Block a user