Moved Sorting Config Into the World.
This commit is contained in:
@@ -1,14 +1,14 @@
|
|||||||
package appeng.client.gui.implementations;
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.container.implementations.ContainerCraftingTerm;
|
import appeng.container.implementations.ContainerCraftingTerm;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
public class GuiCraftingTerm extends GuiMEMonitorable
|
public class GuiCraftingTerm extends GuiMEMonitorable
|
||||||
{
|
{
|
||||||
|
|
||||||
public GuiCraftingTerm(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
|
public GuiCraftingTerm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||||
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
|
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
|
||||||
reservedSpace = 73;
|
reservedSpace = 73;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package appeng.client.gui.implementations;
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
@@ -8,8 +9,10 @@ import appeng.api.config.SearchBoxMode;
|
|||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
import appeng.api.implementations.tiles.IMEChest;
|
import appeng.api.implementations.tiles.IMEChest;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.api.util.IConfigureableObject;
|
||||||
import appeng.client.gui.AEBaseMEGui;
|
import appeng.client.gui.AEBaseMEGui;
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
import appeng.client.gui.widgets.GuiScrollbar;
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
@@ -20,13 +23,17 @@ import appeng.client.me.ItemRepo;
|
|||||||
import appeng.container.implementations.ContainerMEMonitorable;
|
import appeng.container.implementations.ContainerMEMonitorable;
|
||||||
import appeng.container.slot.AppEngSlot;
|
import appeng.container.slot.AppEngSlot;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.AELog;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.helpers.WirelessTerminalGuiObject;
|
import appeng.helpers.WirelessTerminalGuiObject;
|
||||||
import appeng.parts.reporting.PartTerminal;
|
import appeng.parts.reporting.PartTerminal;
|
||||||
import appeng.tile.misc.TileSecurity;
|
import appeng.tile.misc.TileSecurity;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource
|
public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfigManagerHost
|
||||||
{
|
{
|
||||||
|
|
||||||
MEGuiTextField searchField;
|
MEGuiTextField searchField;
|
||||||
@@ -43,11 +50,19 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource
|
|||||||
int rows = 0;
|
int rows = 0;
|
||||||
int maxRows = Integer.MAX_VALUE;
|
int maxRows = Integer.MAX_VALUE;
|
||||||
|
|
||||||
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
|
IConfigManager configSrc;
|
||||||
|
|
||||||
|
GuiImgButton ViewBox;
|
||||||
|
GuiImgButton SortByBox;
|
||||||
|
GuiImgButton SortDirBox;
|
||||||
|
|
||||||
|
GuiImgButton searchBoxSettings;
|
||||||
|
|
||||||
|
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||||
this( inventoryPlayer, te, new ContainerMEMonitorable( inventoryPlayer, null ) );
|
this( inventoryPlayer, te, new ContainerMEMonitorable( inventoryPlayer, null ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, IStorageMonitorable te, ContainerMEMonitorable c) {
|
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te, ContainerMEMonitorable c) {
|
||||||
|
|
||||||
super( c );
|
super( c );
|
||||||
myScrollBar = new GuiScrollbar();
|
myScrollBar = new GuiScrollbar();
|
||||||
@@ -55,6 +70,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource
|
|||||||
xSize = 195;
|
xSize = 195;
|
||||||
ySize = 204;
|
ySize = 204;
|
||||||
|
|
||||||
|
configSrc = ((IConfigureableObject) inventorySlots).getConfigManager();
|
||||||
|
((ContainerMEMonitorable) inventorySlots).gui = this;
|
||||||
|
|
||||||
if ( te instanceof TileSecurity )
|
if ( te instanceof TileSecurity )
|
||||||
myName = GuiText.Security;
|
myName = GuiText.Security;
|
||||||
else if ( te instanceof WirelessTerminalGuiObject )
|
else if ( te instanceof WirelessTerminalGuiObject )
|
||||||
@@ -124,15 +142,15 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource
|
|||||||
|
|
||||||
if ( customSortOrder )
|
if ( customSortOrder )
|
||||||
{
|
{
|
||||||
buttonList.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, AEConfig.instance.settings.getSetting( Settings.SORT_BY ) ) );
|
buttonList.add( SortByBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, configSrc.getSetting( Settings.SORT_BY ) ) );
|
||||||
offset += 20;
|
offset += 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonList
|
buttonList.add( SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, configSrc.getSetting( Settings.SORT_DIRECTION ) ) );
|
||||||
.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, AEConfig.instance.settings.getSetting( Settings.SORT_DIRECTION ) ) );
|
|
||||||
offset += 20;
|
offset += 20;
|
||||||
|
|
||||||
buttonList.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE ) ) );
|
buttonList.add( searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings
|
||||||
|
.getSetting( Settings.SEARCH_MODE ) ) );
|
||||||
|
|
||||||
searchField = new MEGuiTextField( fontRendererObj, this.guiLeft + Math.max( 82, xoffset ), this.guiTop + 6, 89, fontRendererObj.FONT_HEIGHT );
|
searchField = new MEGuiTextField( fontRendererObj, this.guiLeft + Math.max( 82, xoffset ), this.guiTop + 6, 89, fontRendererObj.FONT_HEIGHT );
|
||||||
searchField.setEnableBackgroundDrawing( false );
|
searchField.setEnableBackgroundDrawing( false );
|
||||||
@@ -162,12 +180,25 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource
|
|||||||
if ( btn instanceof GuiImgButton )
|
if ( btn instanceof GuiImgButton )
|
||||||
{
|
{
|
||||||
GuiImgButton iBtn = (GuiImgButton) btn;
|
GuiImgButton iBtn = (GuiImgButton) btn;
|
||||||
Enum cv = iBtn.getCurrentValue();
|
|
||||||
|
|
||||||
|
Enum cv = iBtn.getCurrentValue();
|
||||||
Enum next = Platform.nextEnum( cv );
|
Enum next = Platform.nextEnum( cv );
|
||||||
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
|
|
||||||
|
if ( btn == searchBoxSettings )
|
||||||
|
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NetworkHandler.instance.sendToServer( new PacketValueConfig( iBtn.getSetting().name(), next.name() ) );
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
AELog.error( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
iBtn.set( next );
|
iBtn.set( next );
|
||||||
repo.updateView();
|
|
||||||
|
|
||||||
if ( next.getClass() == SearchBoxMode.class )
|
if ( next.getClass() == SearchBoxMode.class )
|
||||||
re_init();
|
re_init();
|
||||||
@@ -242,13 +273,28 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource
|
|||||||
@Override
|
@Override
|
||||||
public Enum getSortBy()
|
public Enum getSortBy()
|
||||||
{
|
{
|
||||||
return AEConfig.instance.settings.getSetting( Settings.SORT_BY );
|
return configSrc.getSetting( Settings.SORT_BY );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enum getSortDir()
|
public Enum getSortDir()
|
||||||
{
|
{
|
||||||
return AEConfig.instance.settings.getSetting( Settings.SORT_DIRECTION );
|
return configSrc.getSetting( Settings.SORT_DIRECTION );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
|
{
|
||||||
|
if ( SortByBox != null )
|
||||||
|
SortByBox.set( configSrc.getSetting( Settings.SORT_BY ) );
|
||||||
|
|
||||||
|
if ( SortDirBox != null )
|
||||||
|
SortDirBox.set( configSrc.getSetting( Settings.SORT_DIRECTION ) );
|
||||||
|
|
||||||
|
if ( ViewBox != null )
|
||||||
|
ViewBox.set( configSrc.getSetting( Settings.VIEW_MODE ) );
|
||||||
|
|
||||||
|
repo.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.io.IOException;
|
|||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.config.SortOrder;
|
import appeng.api.config.SortOrder;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.client.gui.widgets.GuiToggleButton;
|
import appeng.client.gui.widgets.GuiToggleButton;
|
||||||
import appeng.container.implementations.ContainerSecurity;
|
import appeng.container.implementations.ContainerSecurity;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
@@ -16,7 +16,7 @@ import appeng.core.sync.packets.PacketValueConfig;
|
|||||||
public class GuiSecurity extends GuiMEMonitorable
|
public class GuiSecurity extends GuiMEMonitorable
|
||||||
{
|
{
|
||||||
|
|
||||||
public GuiSecurity(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
|
public GuiSecurity(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||||
super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) );
|
super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) );
|
||||||
customSortOrder = false;
|
customSortOrder = false;
|
||||||
reservedSpace = 33;
|
reservedSpace = 33;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.container.ContainerNull;
|
import appeng.container.ContainerNull;
|
||||||
import appeng.container.slot.SlotCraftingMatrix;
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
import appeng.container.slot.SlotCraftingTerm;
|
import appeng.container.slot.SlotCraftingTerm;
|
||||||
@@ -38,7 +38,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
|||||||
outputSlot.putStack( CraftingManager.getInstance().findMatchingRecipe( ic, getPlayerInv().player.worldObj ) );
|
outputSlot.putStack( CraftingManager.getInstance().findMatchingRecipe( ic, getPlayerInv().player.worldObj ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContainerCraftingTerm(InventoryPlayer ip, IStorageMonitorable montiorable) {
|
public ContainerCraftingTerm(InventoryPlayer ip, ITerminalHost montiorable) {
|
||||||
super( ip, montiorable, false );
|
super( ip, montiorable, false );
|
||||||
ct = (PartCraftingTerminal) montiorable;
|
ct = (PartCraftingTerminal) montiorable;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ import net.minecraft.entity.player.InventoryPlayer;
|
|||||||
import net.minecraft.inventory.ICrafting;
|
import net.minecraft.inventory.ICrafting;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.SortDir;
|
||||||
|
import appeng.api.config.SortOrder;
|
||||||
|
import appeng.api.config.ViewItems;
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
import appeng.api.implementations.tiles.IMEChest;
|
import appeng.api.implementations.tiles.IMEChest;
|
||||||
import appeng.api.networking.IGrid;
|
import appeng.api.networking.IGrid;
|
||||||
@@ -19,27 +23,45 @@ import appeng.api.networking.security.BaseActionSource;
|
|||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
import appeng.api.storage.IMEMonitor;
|
import appeng.api.storage.IMEMonitor;
|
||||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.api.util.IConfigureableObject;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||||
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
|
import appeng.util.ConfigManager;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.ItemList;
|
import appeng.util.item.ItemList;
|
||||||
|
|
||||||
public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>
|
public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigureableObject, IMEMonitorHandlerReceiver<IAEItemStack>
|
||||||
{
|
{
|
||||||
|
|
||||||
final IMEMonitor<IAEItemStack> monitor;
|
final IMEMonitor<IAEItemStack> monitor;
|
||||||
final IItemList<IAEItemStack> items = new ItemList<IAEItemStack>();
|
final IItemList<IAEItemStack> items = new ItemList<IAEItemStack>();
|
||||||
|
|
||||||
protected ContainerMEMonitorable(InventoryPlayer ip, IStorageMonitorable montiorable, boolean bindInventory) {
|
IConfigManager serverCM;
|
||||||
|
IConfigManager clientCM;
|
||||||
|
|
||||||
|
public IConfigManagerHost gui;
|
||||||
|
|
||||||
|
protected ContainerMEMonitorable(InventoryPlayer ip, ITerminalHost montiorable, boolean bindInventory) {
|
||||||
super( ip, montiorable instanceof TileEntity ? (TileEntity) montiorable : null, montiorable instanceof IPart ? (IPart) montiorable : null );
|
super( ip, montiorable instanceof TileEntity ? (TileEntity) montiorable : null, montiorable instanceof IPart ? (IPart) montiorable : null );
|
||||||
|
|
||||||
|
clientCM = new ConfigManager( this );
|
||||||
|
|
||||||
|
clientCM.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||||
|
clientCM.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||||
|
clientCM.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||||
|
|
||||||
if ( Platform.isServer() )
|
if ( Platform.isServer() )
|
||||||
{
|
{
|
||||||
|
serverCM = montiorable.getConfigManager();
|
||||||
|
|
||||||
monitor = montiorable.getItemInventory();
|
monitor = montiorable.getItemInventory();
|
||||||
if ( monitor != null )
|
if ( monitor != null )
|
||||||
{
|
{
|
||||||
@@ -72,7 +94,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
|||||||
bindPlayerInventory( ip, 0, 0 );
|
bindPlayerInventory( ip, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContainerMEMonitorable(InventoryPlayer ip, IStorageMonitorable montiorable) {
|
public ContainerMEMonitorable(InventoryPlayer ip, ITerminalHost montiorable) {
|
||||||
this( ip, montiorable, true );
|
this( ip, montiorable, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,6 +103,28 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
|||||||
{
|
{
|
||||||
if ( Platform.isServer() )
|
if ( Platform.isServer() )
|
||||||
{
|
{
|
||||||
|
for (Enum set : serverCM.getSettings())
|
||||||
|
{
|
||||||
|
Enum sideLocal = serverCM.getSetting( set );
|
||||||
|
Enum sideRemote = clientCM.getSetting( set );
|
||||||
|
|
||||||
|
if ( sideLocal != sideRemote )
|
||||||
|
{
|
||||||
|
clientCM.putSetting( set, sideLocal );
|
||||||
|
for (int j = 0; j < this.crafters.size(); ++j)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NetworkHandler.instance.sendTo( new PacketValueConfig( set.name(), sideLocal.name() ), (EntityPlayerMP) this.crafters.get( j ) );
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
AELog.error( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !items.isEmpty() )
|
if ( !items.isEmpty() )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -188,4 +232,19 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
|
{
|
||||||
|
if ( gui != null )
|
||||||
|
gui.updateSetting( manager, settingName, newValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IConfigManager getConfigManager()
|
||||||
|
{
|
||||||
|
if ( Platform.isServer() )
|
||||||
|
return serverCM;
|
||||||
|
return clientCM;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||||
@@ -15,7 +15,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
|||||||
IPortableCell civ;
|
IPortableCell civ;
|
||||||
|
|
||||||
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell montiorable) {
|
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell montiorable) {
|
||||||
super( ip, (IStorageMonitorable) montiorable, false );
|
super( ip, (ITerminalHost) montiorable, false );
|
||||||
lockPlayerInventorySlot( ip.currentItem );
|
lockPlayerInventorySlot( ip.currentItem );
|
||||||
civ = montiorable;
|
civ = montiorable;
|
||||||
bindPlayerInventory( ip, 0, 0 );
|
bindPlayerInventory( ip, 0, 0 );
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import appeng.api.AEApi;
|
|||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.features.IWirelessTermHandler;
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
import appeng.api.implementations.items.IBiometricCard;
|
import appeng.api.implementations.items.IBiometricCard;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.container.slot.SlotOutput;
|
import appeng.container.slot.SlotOutput;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||||
@@ -32,7 +32,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
|||||||
|
|
||||||
TileSecurity securityBox;
|
TileSecurity securityBox;
|
||||||
|
|
||||||
public ContainerSecurity(InventoryPlayer ip, IStorageMonitorable montiorable) {
|
public ContainerSecurity(InventoryPlayer ip, ITerminalHost montiorable) {
|
||||||
super( ip, montiorable, false );
|
super( ip, montiorable, false );
|
||||||
|
|
||||||
securityBox = (TileSecurity) montiorable;
|
securityBox = (TileSecurity) montiorable;
|
||||||
|
|||||||
+3
-5
@@ -10,8 +10,6 @@ import appeng.api.config.PowerMultiplier;
|
|||||||
import appeng.api.config.PowerUnits;
|
import appeng.api.config.PowerUnits;
|
||||||
import appeng.api.config.SearchBoxMode;
|
import appeng.api.config.SearchBoxMode;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.config.SortDir;
|
|
||||||
import appeng.api.config.SortOrder;
|
|
||||||
import appeng.api.config.YesNo;
|
import appeng.api.config.YesNo;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.api.util.IConfigureableObject;
|
import appeng.api.util.IConfigureableObject;
|
||||||
@@ -115,9 +113,9 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||||||
|
|
||||||
// settings.registerSetting( Settings.SEARCH_MODS, YesNo.YES );
|
// settings.registerSetting( Settings.SEARCH_MODS, YesNo.YES );
|
||||||
settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES );
|
settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES );
|
||||||
settings.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
|
||||||
settings.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
|
||||||
settings.registerSetting( Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH );
|
settings.registerSetting( Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH );
|
||||||
|
// settings.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||||
|
// settings.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||||
|
|
||||||
WirelessBaseCost = get( "wireless", "WirelessBaseCost", WirelessBaseCost ).getDouble( WirelessBaseCost );
|
WirelessBaseCost = get( "wireless", "WirelessBaseCost", WirelessBaseCost ).getDouble( WirelessBaseCost );
|
||||||
WirelessCostMultiplier = get( "wireless", "WirelessCostMultiplier", WirelessCostMultiplier ).getDouble( WirelessCostMultiplier );
|
WirelessCostMultiplier = get( "wireless", "WirelessCostMultiplier", WirelessCostMultiplier ).getDouble( WirelessCostMultiplier );
|
||||||
@@ -166,7 +164,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSetting(Enum setting, Enum newValue)
|
public void updateSetting(IConfigManager manager, Enum setting, Enum newValue)
|
||||||
{
|
{
|
||||||
for (Enum e : settings.getSettings())
|
for (Enum e : settings.getSettings())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import appeng.api.networking.security.IActionHost;
|
|||||||
import appeng.api.networking.security.ISecurityGrid;
|
import appeng.api.networking.security.ISecurityGrid;
|
||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
import appeng.api.parts.IPartHost;
|
import appeng.api.parts.IPartHost;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.client.gui.GuiNull;
|
import appeng.client.gui.GuiNull;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.ContainerNull;
|
import appeng.container.ContainerNull;
|
||||||
@@ -82,7 +82,7 @@ public enum GuiBridge implements IGuiHandler
|
|||||||
|
|
||||||
GUI_WIRELESS(ContainerWireless.class, TileWireless.class, false, SecurityPermissions.BUILD),
|
GUI_WIRELESS(ContainerWireless.class, TileWireless.class, false, SecurityPermissions.BUILD),
|
||||||
|
|
||||||
GUI_ME(ContainerMEMonitorable.class, IStorageMonitorable.class, false, null),
|
GUI_ME(ContainerMEMonitorable.class, ITerminalHost.class, false, null),
|
||||||
|
|
||||||
GUI_PORTABLE_CELL(ContainerMEPortableCell.class, IPortableCell.class, true, null),
|
GUI_PORTABLE_CELL(ContainerMEPortableCell.class, IPortableCell.class, true, null),
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import java.io.IOException;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.api.util.IConfigureableObject;
|
||||||
import appeng.container.implementations.ContainerCellWorkbench;
|
import appeng.container.implementations.ContainerCellWorkbench;
|
||||||
import appeng.container.implementations.ContainerLevelEmitter;
|
import appeng.container.implementations.ContainerLevelEmitter;
|
||||||
import appeng.container.implementations.ContainerPriority;
|
import appeng.container.implementations.ContainerPriority;
|
||||||
@@ -75,6 +77,60 @@ public class PacketValueConfig extends AppEngPacket
|
|||||||
ccw.setFuzzy( FuzzyMode.valueOf( Value ) );
|
ccw.setFuzzy( FuzzyMode.valueOf( Value ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( c instanceof IConfigureableObject )
|
||||||
|
{
|
||||||
|
IConfigManager cm = ((IConfigureableObject) c).getConfigManager();
|
||||||
|
|
||||||
|
for (Enum e : cm.getSettings())
|
||||||
|
{
|
||||||
|
if ( e.name().equals( Name ) )
|
||||||
|
{
|
||||||
|
Enum def = cm.getSetting( e );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cm.putSetting( e, Enum.valueOf( def.getClass(), Value ) );
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException err)
|
||||||
|
{
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
|
||||||
|
{
|
||||||
|
Container c = player.openContainer;
|
||||||
|
|
||||||
|
if ( c instanceof IConfigureableObject )
|
||||||
|
{
|
||||||
|
IConfigManager cm = ((IConfigureableObject) c).getConfigManager();
|
||||||
|
|
||||||
|
for (Enum e : cm.getSettings())
|
||||||
|
{
|
||||||
|
if ( e.name().equals( Name ) )
|
||||||
|
{
|
||||||
|
Enum def = cm.getSetting( e );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cm.putSetting( e, Enum.valueOf( def.getClass(), Value ) );
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException err)
|
||||||
|
{
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import appeng.api.storage.StorageChannel;
|
|||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.tile.networking.TileWireless;
|
import appeng.tile.networking.TileWireless;
|
||||||
|
|
||||||
public class WirelessTerminalGuiObject implements IPortableCell
|
public class WirelessTerminalGuiObject implements IPortableCell
|
||||||
@@ -265,4 +266,10 @@ public class WirelessTerminalGuiObject implements IPortableCell
|
|||||||
return effectiveItem;
|
return effectiveItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IConfigManager getConfigManager()
|
||||||
|
{
|
||||||
|
return wth.getConfigManager( effectiveItem );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,24 @@
|
|||||||
package appeng.items.contents;
|
package appeng.items.contents;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.SortDir;
|
||||||
|
import appeng.api.config.SortOrder;
|
||||||
|
import appeng.api.config.ViewItems;
|
||||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||||
import appeng.api.storage.IMEMonitor;
|
import appeng.api.storage.IMEMonitor;
|
||||||
import appeng.api.storage.MEMonitorHandler;
|
import appeng.api.storage.MEMonitorHandler;
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.me.storage.CellInventory;
|
import appeng.me.storage.CellInventory;
|
||||||
|
import appeng.util.ConfigManager;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell
|
public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell
|
||||||
{
|
{
|
||||||
@@ -51,4 +60,25 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IConfigManager getConfigManager()
|
||||||
|
{
|
||||||
|
final ConfigManager out = new ConfigManager( new IConfigManagerHost() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
|
{
|
||||||
|
NBTTagCompound data = Platform.openNbtData( target );
|
||||||
|
manager.writeToNBT( data );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
out.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||||
|
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||||
|
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||||
|
|
||||||
|
out.readFromNBT( (NBTTagCompound) Platform.openNbtData( target ).copy() );
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
|
|||||||
{
|
{
|
||||||
super.addInformation( par1ItemStack, par2EntityPlayer, par3List, par4 );
|
super.addInformation( par1ItemStack, par2EntityPlayer, par3List, par4 );
|
||||||
|
|
||||||
|
MaterialType mt = getTypeByStack( par1ItemStack );
|
||||||
|
if ( mt == null )
|
||||||
|
return;
|
||||||
|
|
||||||
Upgrades u = getType( par1ItemStack );
|
Upgrades u = getType( par1ItemStack );
|
||||||
if ( u != null )
|
if ( u != null )
|
||||||
{
|
{
|
||||||
@@ -156,7 +160,14 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
|
|||||||
|
|
||||||
private String nameOf(ItemStack is)
|
private String nameOf(ItemStack is)
|
||||||
{
|
{
|
||||||
return AEFeatureHandler.getName( ItemMaterial.class, getTypeByStack( is ).name() );
|
if ( is == null )
|
||||||
|
return "null";
|
||||||
|
|
||||||
|
MaterialType mt = getTypeByStack( is );
|
||||||
|
if ( mt == null )
|
||||||
|
return "null";
|
||||||
|
|
||||||
|
return AEFeatureHandler.getName( ItemMaterial.class, mt.name() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,11 +9,18 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.SortDir;
|
||||||
|
import appeng.api.config.SortOrder;
|
||||||
|
import appeng.api.config.ViewItems;
|
||||||
import appeng.api.features.IWirelessTermHandler;
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||||
|
import appeng.util.ConfigManager;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class ToolWirelessTerminal extends AEBasePoweredItem implements IWirelessTermHandler
|
public class ToolWirelessTerminal extends AEBasePoweredItem implements IWirelessTermHandler
|
||||||
@@ -87,4 +94,26 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
|||||||
tag.setString( "name", name );
|
tag.setString( "name", name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IConfigManager getConfigManager(final ItemStack target)
|
||||||
|
{
|
||||||
|
final ConfigManager out = new ConfigManager( new IConfigManagerHost() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
|
{
|
||||||
|
NBTTagCompound data = Platform.openNbtData( target );
|
||||||
|
manager.writeToNBT( data );
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
out.registerSetting( Sewttings.SORT_BY, SortOrder.NAME );
|
||||||
|
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||||
|
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||||
|
|
||||||
|
out.readFromNBT( (NBTTagCompound) Platform.openNbtData( target ).copy() );
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.client.texture.CableBusTextures;
|
import appeng.client.texture.CableBusTextures;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
@@ -85,7 +86,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IStackWatcherHo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSetting(Enum settingName, Enum newValue)
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
{
|
{
|
||||||
confgiureWatchers();
|
confgiureWatchers();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class PartUpgradeable extends PartBasicState implements ISegmentedInvento
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSetting(Enum settingName, Enum newValue)
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
|
|||||||
import appeng.api.storage.StorageChannel;
|
import appeng.api.storage.StorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.client.texture.CableBusTextures;
|
import appeng.client.texture.CableBusTextures;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.helpers.IPriorityHost;
|
import appeng.helpers.IPriorityHost;
|
||||||
@@ -167,7 +168,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSetting(Enum settingName, Enum newValue)
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
{
|
{
|
||||||
resetCache( true );
|
resetCache( true );
|
||||||
host.markForSave();
|
host.markForSave();
|
||||||
|
|||||||
@@ -2,20 +2,48 @@ package appeng.parts.reporting;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.SortDir;
|
||||||
|
import appeng.api.config.SortOrder;
|
||||||
|
import appeng.api.config.ViewItems;
|
||||||
import appeng.api.storage.IMEMonitor;
|
import appeng.api.storage.IMEMonitor;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.client.texture.CableBusTextures;
|
import appeng.client.texture.CableBusTextures;
|
||||||
import appeng.core.localization.PlayerMessages;
|
import appeng.core.localization.PlayerMessages;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
|
import appeng.util.ConfigManager;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class PartTerminal extends PartMonitor implements IStorageMonitorable
|
public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigManagerHost
|
||||||
{
|
{
|
||||||
|
|
||||||
|
IConfigManager cm = new ConfigManager( this );
|
||||||
|
|
||||||
public PartTerminal(Class clz, ItemStack is) {
|
public PartTerminal(Class clz, ItemStack is) {
|
||||||
super( clz, is );
|
super( clz, is );
|
||||||
|
|
||||||
|
cm.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||||
|
cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||||
|
cm.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound data)
|
||||||
|
{
|
||||||
|
super.readFromNBT( data );
|
||||||
|
cm.readFromNBT( data );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound data)
|
||||||
|
{
|
||||||
|
super.writeToNBT( data );
|
||||||
|
cm.writeToNBT( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartTerminal(ItemStack is) {
|
public PartTerminal(ItemStack is) {
|
||||||
@@ -24,6 +52,10 @@ public class PartTerminal extends PartMonitor implements IStorageMonitorable
|
|||||||
frontColored = CableBusTextures.PartTerminal_Colored;
|
frontColored = CableBusTextures.PartTerminal_Colored;
|
||||||
frontDark = CableBusTextures.PartTerminal_Dark;
|
frontDark = CableBusTextures.PartTerminal_Dark;
|
||||||
frontSolid = CableBusTextures.PartTerminal_Solid;
|
frontSolid = CableBusTextures.PartTerminal_Solid;
|
||||||
|
|
||||||
|
cm.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||||
|
cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||||
|
cm.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiBridge getGui()
|
public GuiBridge getGui()
|
||||||
@@ -83,4 +115,16 @@ public class PartTerminal extends PartMonitor implements IStorageMonitorable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IConfigManager getConfigManager()
|
||||||
|
{
|
||||||
|
return cm;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ public class TileCondenser extends AEBaseInvTile implements IAEAppEngInventory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSetting(Enum settingName, Enum newValue)
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
{
|
{
|
||||||
addPower( 0 );
|
addPower( 0 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ import net.minecraftforge.common.MinecraftForge;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.SortDir;
|
||||||
|
import appeng.api.config.SortOrder;
|
||||||
|
import appeng.api.config.ViewItems;
|
||||||
import appeng.api.events.LocatableEventAnnounce;
|
import appeng.api.events.LocatableEventAnnounce;
|
||||||
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
|
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
|
||||||
import appeng.api.features.ILocatable;
|
import appeng.api.features.ILocatable;
|
||||||
@@ -29,12 +33,13 @@ import appeng.api.networking.events.MENetworkPowerStatusChange;
|
|||||||
import appeng.api.networking.events.MENetworkSecurityChange;
|
import appeng.api.networking.events.MENetworkSecurityChange;
|
||||||
import appeng.api.storage.IMEInventoryHandler;
|
import appeng.api.storage.IMEInventoryHandler;
|
||||||
import appeng.api.storage.IMEMonitor;
|
import appeng.api.storage.IMEMonitor;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.api.storage.MEMonitorHandler;
|
import appeng.api.storage.MEMonitorHandler;
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.DimensionalCoord;
|
import appeng.api.util.DimensionalCoord;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.me.storage.SecurityInventory;
|
import appeng.me.storage.SecurityInventory;
|
||||||
import appeng.tile.events.AETileEventHandler;
|
import appeng.tile.events.AETileEventHandler;
|
||||||
@@ -43,13 +48,16 @@ import appeng.tile.grid.AENetworkTile;
|
|||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
import appeng.tile.inventory.IAEAppEngInventory;
|
import appeng.tile.inventory.IAEAppEngInventory;
|
||||||
import appeng.tile.inventory.InvOperation;
|
import appeng.tile.inventory.InvOperation;
|
||||||
|
import appeng.util.ConfigManager;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
public class TileSecurity extends AENetworkTile implements IStorageMonitorable, IAEAppEngInventory, ILocatable
|
public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEAppEngInventory, ILocatable, IConfigManagerHost
|
||||||
{
|
{
|
||||||
|
|
||||||
private static int diffrence = 0;
|
private static int diffrence = 0;
|
||||||
|
private IConfigManager cm = new ConfigManager( this );
|
||||||
|
|
||||||
private SecurityInventory inventory = new SecurityInventory( this );
|
private SecurityInventory inventory = new SecurityInventory( this );
|
||||||
private MEMonitorHandler<IAEItemStack> securityMonitor = new MEMonitorHandler<IAEItemStack>( inventory );
|
private MEMonitorHandler<IAEItemStack> securityMonitor = new MEMonitorHandler<IAEItemStack>( inventory );
|
||||||
@@ -133,6 +141,9 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable,
|
|||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound data)
|
public void writeToNBT(NBTTagCompound data)
|
||||||
{
|
{
|
||||||
|
cm.writeToNBT( data );
|
||||||
|
;
|
||||||
|
|
||||||
data.setLong( "securityKey", securityKey );
|
data.setLong( "securityKey", securityKey );
|
||||||
configSlot.writeToNBT( data, "config" );
|
configSlot.writeToNBT( data, "config" );
|
||||||
|
|
||||||
@@ -152,6 +163,8 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable,
|
|||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound data)
|
public void readFromNBT(NBTTagCompound data)
|
||||||
{
|
{
|
||||||
|
cm.readFromNBT( data );
|
||||||
|
|
||||||
securityKey = data.getLong( "securityKey" );
|
securityKey = data.getLong( "securityKey" );
|
||||||
configSlot.readFromNBT( data, "config" );
|
configSlot.readFromNBT( data, "config" );
|
||||||
|
|
||||||
@@ -230,6 +243,10 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable,
|
|||||||
securityKey = System.currentTimeMillis() * 10 + diffrence;
|
securityKey = System.currentTimeMillis() * 10 + diffrence;
|
||||||
if ( diffrence > 10 )
|
if ( diffrence > 10 )
|
||||||
diffrence = 0;
|
diffrence = 0;
|
||||||
|
|
||||||
|
cm.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||||
|
cm.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||||
|
cm.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOwner()
|
public int getOwner()
|
||||||
@@ -277,4 +294,16 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable,
|
|||||||
return gridProxy.isActive();
|
return gridProxy.isActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IConfigManager getConfigManager()
|
||||||
|
{
|
||||||
|
return cm;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSetting(Enum settingName, Enum newValue)
|
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||||
{
|
{
|
||||||
updateTask();
|
updateTask();
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-6
@@ -5,6 +5,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.core.AELog;
|
||||||
|
|
||||||
public class ConfigManager implements IConfigManager
|
public class ConfigManager implements IConfigManager
|
||||||
{
|
{
|
||||||
@@ -21,18 +22,27 @@ public class ConfigManager implements IConfigManager
|
|||||||
*
|
*
|
||||||
* @param tagCompound
|
* @param tagCompound
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("static-access")
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
for (Enum key : Settings.keySet())
|
for (Enum key : Settings.keySet())
|
||||||
{
|
{
|
||||||
String value = tagCompound.getString( key.name() );
|
try
|
||||||
|
{
|
||||||
|
if ( tagCompound.hasKey( key.name() ) )
|
||||||
|
{
|
||||||
|
String value = tagCompound.getString( key.name() );
|
||||||
|
|
||||||
Enum oldValue = Settings.get( key );
|
Enum oldValue = Settings.get( key );
|
||||||
Enum newValue = oldValue.valueOf( oldValue.getClass(), value );
|
Enum newValue = Enum.valueOf( oldValue.getClass(), value );
|
||||||
|
|
||||||
putSetting( key, newValue );
|
putSetting( key, newValue );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException e)
|
||||||
|
{
|
||||||
|
AELog.error( e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +90,7 @@ public class ConfigManager implements IConfigManager
|
|||||||
{
|
{
|
||||||
Enum oldValue = getSetting( settingName );
|
Enum oldValue = getSetting( settingName );
|
||||||
Settings.put( settingName, newValue );
|
Settings.put( settingName, newValue );
|
||||||
target.updateSetting( settingName, newValue );
|
target.updateSetting( this, settingName, newValue );
|
||||||
return oldValue;
|
return oldValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package appeng.util;
|
package appeng.util;
|
||||||
|
|
||||||
public interface IConfigManagerHost {
|
import appeng.api.util.IConfigManager;
|
||||||
|
|
||||||
void updateSetting(Enum settingName, Enum newValue);
|
public interface IConfigManagerHost
|
||||||
|
{
|
||||||
|
|
||||||
|
void updateSetting(IConfigManager manager, Enum settingName, Enum newValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import appeng.util.inv.ItemSlot;
|
|||||||
import appeng.util.inv.WrapperMCISidedInventory;
|
import appeng.util.inv.WrapperMCISidedInventory;
|
||||||
import buildcraft.api.inventory.ISpecialInventory;
|
import buildcraft.api.inventory.ISpecialInventory;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import appeng.api.config.FuzzyMode;
|
|||||||
import appeng.util.InventoryAdaptor;
|
import appeng.util.InventoryAdaptor;
|
||||||
import buildcraft.api.inventory.ISpecialInventory;
|
import buildcraft.api.inventory.ISpecialInventory;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class AdaptorISpecialInventory extends InventoryAdaptor
|
public class AdaptorISpecialInventory extends InventoryAdaptor
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user