Added Sky Stone Dust.
Added View Cell. Configure View Cell in Cell Workbench. View Cell Can Filter Terminals by being inserted into the Side Slot.
This commit is contained in:
parent
500558982f
commit
4536189042
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
|
@ -12,6 +13,7 @@ import appeng.api.config.SearchBoxMode;
|
|||
import appeng.api.config.Settings;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IMEChest;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
|
@ -60,9 +62,13 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
GuiImgButton SortDirBox;
|
||||
|
||||
GuiImgButton searchBoxSettings;
|
||||
boolean viewCell;
|
||||
|
||||
ItemStack currentViewCell;
|
||||
ContainerMEMonitorable mecontainer;
|
||||
|
||||
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
this( inventoryPlayer, te, new ContainerMEMonitorable( inventoryPlayer, null ) );
|
||||
this( inventoryPlayer, te, new ContainerMEMonitorable( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te, ContainerMEMonitorable c) {
|
||||
|
@ -73,8 +79,13 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
xSize = 195;
|
||||
ySize = 204;
|
||||
|
||||
if ( te instanceof IViewCellStorage )
|
||||
xSize += 33;
|
||||
|
||||
configSrc = ((IConfigureableObject) inventorySlots).getConfigManager();
|
||||
((ContainerMEMonitorable) inventorySlots).gui = this;
|
||||
(mecontainer = (ContainerMEMonitorable) inventorySlots).gui = this;
|
||||
|
||||
viewCell = te instanceof IViewCellStorage;
|
||||
|
||||
if ( te instanceof TileSecurity )
|
||||
myName = GuiText.Security;
|
||||
|
@ -264,6 +275,15 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
|
||||
this.drawTexturedModalRect( offsetX, offsetY + 16 + rows * 18 + lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + reservedSpace - lowerTextureOffset );
|
||||
|
||||
if ( viewCell )
|
||||
{
|
||||
if ( currentViewCell != mecontainer.cellView.getStack() )
|
||||
{
|
||||
currentViewCell = mecontainer.cellView.getStack();
|
||||
repo.setViewCell( currentViewCell );
|
||||
}
|
||||
}
|
||||
|
||||
if ( searchField != null )
|
||||
searchField.drawTextBox();
|
||||
}
|
||||
|
|
|
@ -4,18 +4,27 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.util.ItemSorters;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioitylist.FuzzyPriorityList;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import appeng.util.prioitylist.PrecisePriorityList;
|
||||
|
||||
public class ItemRepo
|
||||
{
|
||||
|
@ -71,6 +80,68 @@ public class ItemRepo
|
|||
list.add( is );
|
||||
}
|
||||
|
||||
boolean hasInverter = false;
|
||||
boolean hasFuzzy = false;
|
||||
IPartitionList<IAEItemStack> myPartitionList;
|
||||
|
||||
public void setViewCell(ItemStack currentViewCell)
|
||||
{
|
||||
if ( currentViewCell == null || !(currentViewCell.getItem() instanceof ItemViewCell) )
|
||||
myPartitionList = null;
|
||||
else
|
||||
{
|
||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
|
||||
ItemViewCell vc = (ItemViewCell) currentViewCell.getItem();
|
||||
IInventory upgrades = vc.getUpgradesInventory( currentViewCell );
|
||||
IInventory config = vc.getConfigInventory( currentViewCell );
|
||||
FuzzyMode fzMode = vc.getFuzzyMode( currentViewCell );
|
||||
|
||||
hasInverter = false;
|
||||
hasFuzzy = false;
|
||||
|
||||
for (int x = 0; x < upgrades.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack is = upgrades.getStackInSlot( x );
|
||||
if ( is != null && is.getItem() instanceof IUpgradeModule )
|
||||
{
|
||||
Upgrades u = ((IUpgradeModule) is.getItem()).getType( is );
|
||||
if ( u != null )
|
||||
{
|
||||
switch (u)
|
||||
{
|
||||
case FUZZY:
|
||||
hasFuzzy = true;
|
||||
break;
|
||||
case INVERTER:
|
||||
hasInverter = true;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < config.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack is = config.getStackInSlot( x );
|
||||
if ( is != null )
|
||||
priorityList.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
// myWhitelist = hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
||||
|
||||
if ( !priorityList.isEmpty() )
|
||||
{
|
||||
if ( hasFuzzy )
|
||||
myPartitionList = new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode );
|
||||
else
|
||||
myPartitionList = new PrecisePriorityList<IAEItemStack>( priorityList );
|
||||
}
|
||||
}
|
||||
updateView();
|
||||
}
|
||||
|
||||
public void updateView()
|
||||
{
|
||||
view.clear();
|
||||
|
@ -102,6 +173,12 @@ public class ItemRepo
|
|||
boolean notDone = false;
|
||||
for (IAEItemStack is : list)
|
||||
{
|
||||
if ( myPartitionList != null )
|
||||
{
|
||||
if ( hasInverter == myPartitionList.isListed( is ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
String dspName = Platform.getItemDisplayName( is );
|
||||
notDone = true;
|
||||
|
||||
|
@ -154,4 +231,5 @@ public class ItemRepo
|
|||
{
|
||||
list.resetStatus();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import appeng.api.config.SortOrder;
|
|||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IMEChest;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
|
@ -30,6 +31,9 @@ import appeng.api.storage.data.IItemList;
|
|||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigureableObject;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
|
@ -47,6 +51,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||
IConfigManager serverCM;
|
||||
IConfigManager clientCM;
|
||||
|
||||
public AppEngSlot cellView;
|
||||
|
||||
public IConfigManagerHost gui;
|
||||
|
||||
protected ContainerMEMonitorable(InventoryPlayer ip, ITerminalHost montiorable, boolean bindInventory) {
|
||||
|
@ -90,6 +96,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||
else
|
||||
monitor = null;
|
||||
|
||||
if ( montiorable instanceof IViewCellStorage )
|
||||
addSlotToContainer( cellView = new SlotRestrictedInput( PlaceableItemType.VIEWCELL, ((IViewCellStorage) montiorable).getViewCellStorage(), 0, 205, 7 ) );
|
||||
|
||||
if ( bindInventory )
|
||||
bindPlayerInventory( ip, 0, 0 );
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
|||
STORAGE_CELLS(15), ORE(1 * 16 + 15), STORAGE_COMPONENT(3 * 16 + 15), WIRELESS_TERMINAL(4 * 16 + 15), TRASH(5 * 16 + 15), VALID_ENCODED_PATTERN_W_OUPUT(
|
||||
7 * 16 + 15), ENCODED_PATTERN_W_OUTPUT(7 * 16 + 15), ENCODED_PATTERN(7 * 16 + 15), BLANK_PATTERN(8 * 16 + 15), POWERED_TOOL(9 * 16 + 15), RANGE_BOOSTER(
|
||||
6 * 16 + 15), QE_SINGULARTIY(10 * 16 + 15), SPATIAL_STORAGE_CELLS(11 * 16 + 15), FUEL(12 * 16 + 15), UPGRADES(13 * 16 + 15), WORKBENCH_CELL(15), BIOMETRIC_CARD(
|
||||
14 * 16 + 15);
|
||||
14 * 16 + 15), VIEWCELL(4 * 16 + 14);
|
||||
|
||||
public final int IIcon;
|
||||
|
||||
|
@ -115,6 +115,8 @@ public class SlotRestrictedInput extends AppEngSlot
|
|||
|
||||
return false;
|
||||
}
|
||||
case VIEWCELL:
|
||||
return AEApi.instance().items().itemViewCell.sameAs( i );
|
||||
case ORE:
|
||||
return appeng.api.AEApi.instance().registries().grinder().getRecipeForInput( i ) != null;
|
||||
case FUEL:
|
||||
|
|
|
@ -95,6 +95,7 @@ import appeng.items.parts.PartType;
|
|||
import appeng.items.storage.ItemBasicStorageCell;
|
||||
import appeng.items.storage.ItemCreativeStorageCell;
|
||||
import appeng.items.storage.ItemSpatialStorageCell;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.items.tools.ToolBiometricCard;
|
||||
import appeng.items.tools.ToolMemoryCard;
|
||||
import appeng.items.tools.ToolNetworkTool;
|
||||
|
@ -307,6 +308,7 @@ public class Registration
|
|||
// ItemEncodedPattern.class );
|
||||
|
||||
items.itemCellCreative = addFeature( ItemCreativeStorageCell.class );
|
||||
items.itemViewCell = addFeature( ItemViewCell.class );
|
||||
|
||||
items.itemCell1k = addFeature( ItemBasicStorageCell.class, MaterialType.Cell1kPart, 1 );
|
||||
items.itemCell4k = addFeature( ItemBasicStorageCell.class, MaterialType.Cell4kPart, 4 );
|
||||
|
@ -528,6 +530,9 @@ public class Registration
|
|||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemPortableCell.stack( 1 ), 1 );
|
||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemPortableCell.stack( 1 ), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemViewCell.stack( 1 ), 1 );
|
||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemViewCell.stack( 1 ), 1 );
|
||||
|
||||
// partStorageBus
|
||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
||||
Upgrades.INVERTER.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
||||
|
|
|
@ -55,6 +55,8 @@ public enum MaterialType
|
|||
|
||||
FormationCore, AnnihilationCore,
|
||||
|
||||
SkyDust(AEFeature.Core),
|
||||
|
||||
EnderDust(AEFeature.QuantumNetworkBridge, "dustEnder", EntitySingularity.class), Singularity(AEFeature.QuantumNetworkBridge, EntitySingularity.class), QESingularity(
|
||||
AEFeature.QuantumNetworkBridge, EntitySingularity.class);
|
||||
|
||||
|
|
61
items/storage/ItemViewCell.java
Normal file
61
items/storage/ItemViewCell.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
package appeng.items.storage;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
{
|
||||
|
||||
public ItemViewCell() {
|
||||
super( ItemViewCell.class );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable(ItemStack is)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is)
|
||||
{
|
||||
return new CellUpgrades( is, 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory(ItemStack is)
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode(ItemStack is)
|
||||
{
|
||||
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode)
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import appeng.api.AEApi;
|
|||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
|
@ -28,7 +29,7 @@ import appeng.me.storage.CellInventory;
|
|||
import appeng.me.storage.CellInventoryHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell, IGuiItem
|
||||
public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell, IGuiItem, IItemGroup
|
||||
{
|
||||
|
||||
public ToolPortableCell() {
|
||||
|
@ -130,6 +131,12 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedGroupName(ItemStack is)
|
||||
{
|
||||
return GuiText.StorageCells.getUnlocalized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package appeng.parts.reporting;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
@ -8,6 +9,7 @@ import appeng.api.config.Settings;
|
|||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.util.IConfigManager;
|
||||
|
@ -15,14 +17,18 @@ import appeng.client.texture.CableBusTextures;
|
|||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigManagerHost
|
||||
public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigManagerHost, IViewCellStorage, IAEAppEngInventory
|
||||
{
|
||||
|
||||
IConfigManager cm = new ConfigManager( this );
|
||||
AppEngInternalInventory viewCell = new AppEngInternalInventory( this, 1 );
|
||||
|
||||
public PartTerminal(Class clz, ItemStack is) {
|
||||
super( clz, is );
|
||||
|
@ -37,6 +43,7 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM
|
|||
{
|
||||
super.readFromNBT( data );
|
||||
cm.readFromNBT( data );
|
||||
viewCell.readFromNBT( data, "viewCell" );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,6 +51,7 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM
|
|||
{
|
||||
super.writeToNBT( data );
|
||||
cm.writeToNBT( data );
|
||||
viewCell.writeToNBT( data, "viewCell" );
|
||||
}
|
||||
|
||||
public PartTerminal(ItemStack is) {
|
||||
|
@ -127,4 +135,16 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getViewCellStorage()
|
||||
{
|
||||
return viewCell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
||||
{
|
||||
host.markForSave();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue