Added 4 View Cell Slots.
Multiple View Cells now sum together to allow more customization. View Cells are now protected by Build Security. Meteorite Compass now renders correctly in other peoples hands.
This commit is contained in:
parent
4536189042
commit
929efa5597
30 changed files with 228 additions and 102 deletions
|
@ -64,7 +64,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
GuiImgButton searchBoxSettings;
|
||||
boolean viewCell;
|
||||
|
||||
ItemStack currentViewCell;
|
||||
ItemStack myCurrentViewCells[] = new ItemStack[5];
|
||||
ContainerMEMonitorable mecontainer;
|
||||
|
||||
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
|
@ -277,13 +277,21 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
|
||||
if ( viewCell )
|
||||
{
|
||||
if ( currentViewCell != mecontainer.cellView.getStack() )
|
||||
boolean update = false;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
currentViewCell = mecontainer.cellView.getStack();
|
||||
repo.setViewCell( currentViewCell );
|
||||
if ( myCurrentViewCells[i] != mecontainer.cellView[i].getStack() )
|
||||
{
|
||||
update = true;
|
||||
myCurrentViewCells[i] = mecontainer.cellView[i].getStack();
|
||||
}
|
||||
}
|
||||
|
||||
if ( update )
|
||||
repo.setViewCell( myCurrentViewCells );
|
||||
}
|
||||
|
||||
if ( searchField != null )
|
||||
searchField.drawTextBox();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import appeng.util.Platform;
|
|||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioitylist.FuzzyPriorityList;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import appeng.util.prioitylist.MergedPriorityList;
|
||||
import appeng.util.prioitylist.PrecisePriorityList;
|
||||
|
||||
public class ItemRepo
|
||||
|
@ -80,16 +81,22 @@ public class ItemRepo
|
|||
list.add( is );
|
||||
}
|
||||
|
||||
boolean hasInverter = false;
|
||||
boolean hasFuzzy = false;
|
||||
IPartitionList<IAEItemStack> myPartitionList;
|
||||
|
||||
public void setViewCell(ItemStack currentViewCell)
|
||||
public void setViewCell(ItemStack[] list)
|
||||
{
|
||||
if ( currentViewCell == null || !(currentViewCell.getItem() instanceof ItemViewCell) )
|
||||
myPartitionList = null;
|
||||
else
|
||||
MergedPriorityList<IAEItemStack> myMergedList = new MergedPriorityList<IAEItemStack>();
|
||||
|
||||
for (ItemStack currentViewCell : list)
|
||||
{
|
||||
if ( currentViewCell == null )
|
||||
continue;
|
||||
|
||||
if ( (currentViewCell.getItem() instanceof ItemViewCell) )
|
||||
{
|
||||
boolean hasInverter = false;
|
||||
boolean hasFuzzy = false;
|
||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
|
||||
ItemViewCell vc = (ItemViewCell) currentViewCell.getItem();
|
||||
|
@ -129,16 +136,18 @@ public class ItemRepo
|
|||
priorityList.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
// myWhitelist = hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
||||
|
||||
if ( !priorityList.isEmpty() )
|
||||
{
|
||||
if ( hasFuzzy )
|
||||
myPartitionList = new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode );
|
||||
myMergedList.addNewList( new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode ), !hasInverter );
|
||||
else
|
||||
myPartitionList = new PrecisePriorityList<IAEItemStack>( priorityList );
|
||||
myMergedList.addNewList( new PrecisePriorityList<IAEItemStack>( priorityList ), !hasInverter );
|
||||
|
||||
myPartitionList = myMergedList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateView();
|
||||
}
|
||||
|
||||
|
@ -175,7 +184,7 @@ public class ItemRepo
|
|||
{
|
||||
if ( myPartitionList != null )
|
||||
{
|
||||
if ( hasInverter == myPartitionList.isListed( is ) )
|
||||
if ( !myPartitionList.isListed( is ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ public class BaseBlockRender
|
|||
}
|
||||
}
|
||||
|
||||
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] data)
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ItemRenderer implements IItemRenderer
|
|||
if ( type == ItemRenderType.INVENTORY )
|
||||
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
|
||||
|
||||
WorldRender.instance.renderItemBlock( item, type );
|
||||
WorldRender.instance.renderItemBlock( item, type, data );
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
|
|
@ -58,7 +58,7 @@ public class WorldRender implements ISimpleBlockRenderingHandler
|
|||
return renderID;
|
||||
}
|
||||
|
||||
public void renderItemBlock(ItemStack item, ItemRenderType type)
|
||||
public void renderItemBlock(ItemStack item, ItemRenderType type, Object[] data)
|
||||
{
|
||||
Block blk = Block.getBlockFromItem( item.getItem() );
|
||||
if ( blk instanceof AEBaseBlock )
|
||||
|
@ -67,7 +67,7 @@ public class WorldRender implements ISimpleBlockRenderingHandler
|
|||
renderer.setRenderBoundsFromBlock( block );
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
getRender( block ).renderInventory( block, item, renderer, type );
|
||||
getRender( block ).renderInventory( block, item, renderer, type, data );
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -32,7 +32,7 @@ public class RenderBlockCharger extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
|
|
|
@ -25,15 +25,15 @@ public class RenderBlockCrank extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
renderer.setRenderBounds( 0.5D - 0.05, 0.5D - 0.5, 0.5D - 0.05, 0.5D + 0.05, 0.5D + 0.3, 0.5D + 0.05 );
|
||||
super.renderInventory( blk, is, renderer, type );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
|
||||
renderer.setRenderBounds( 0.70D - 0.15, 0.75D - 0.05, 0.5D - 0.05, 0.70D + 0.28, 0.75D + 0.05, 0.5D + 0.05 );
|
||||
super.renderInventory( blk, is, renderer, type );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public class RenderBlockEnergyCube extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
IAEItemPowerStorage myItem = (IAEItemPowerStorage) is.getItem();
|
||||
double internalCurrentPower = myItem.getAECurrentPower( is );
|
||||
|
@ -30,7 +30,7 @@ public class RenderBlockEnergyCube extends BaseBlockRender
|
|||
meta = 0;
|
||||
|
||||
renderer.setOverrideBlockTexture( blk.getIcon( 0, meta ) );
|
||||
super.renderInventory( blk, is, renderer, type );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class RenderBlockSkyChest extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
|
|
@ -31,7 +31,7 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
@ -62,10 +62,16 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
|||
}
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY )
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY || type == ItemRenderType.EQUIPPED )
|
||||
{
|
||||
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if ( type == ItemRenderType.EQUIPPED )
|
||||
{
|
||||
p = (EntityPlayer) obj[1];
|
||||
p.rotationYaw = p.renderYawOffset;
|
||||
}
|
||||
|
||||
int x = (int) p.posX;
|
||||
int y = (int) p.posY;
|
||||
int z = (int) p.posZ;
|
||||
|
|
|
@ -27,7 +27,7 @@ public class RenderBlockWireless extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
this.blk = blk;
|
||||
cenx = 0;
|
||||
|
|
|
@ -23,13 +23,13 @@ public class RenderDrive extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,7 @@ public class RenderMEChest extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||
|
@ -36,7 +36,7 @@ public class RenderMEChest extends BaseBlockRender
|
|||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, 0xffffff, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,7 @@ public class RenderNull extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -72,13 +72,13 @@ public class RenderQNB extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
float px = 2.0f / 16.0f;
|
||||
float maxpx = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( px, px, px, maxpx, maxpx, maxpx );
|
||||
|
||||
super.renderInventory( block, item, renderer, type );
|
||||
super.renderInventory( block, item, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -114,12 +114,12 @@ public class RenderQuartzGlass extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraTextures.GlassFrame.getIcon();
|
||||
super.renderInventory( block, is, renderer, type );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,11 +17,11 @@ public class RenderQuartzOre extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
super.renderInventory( blk, is, renderer, type );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.OreQuartzStone.getIcon() );
|
||||
super.renderInventory( blk, is, renderer, type );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderQuartzTorch extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ public class RenderSpatialPylon extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraTextures.BlockSpatialPylon_dim.getIcon();
|
||||
super.renderInventory( block, is, renderer, type );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,10 +15,10 @@ public class RenderTinyTNT extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
super.renderInventory( block, is, renderer, type );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,7 @@ public class RendererCableBus extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
// nothin.
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RendererSecurity extends BaseBlockRender
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type)
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||
|
@ -31,7 +31,7 @@ public class RendererSecurity extends BaseBlockRender
|
|||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, 0xffffff, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,6 +70,11 @@ public abstract class AEBaseContainer extends Container
|
|||
return;
|
||||
|
||||
ticksSinceCheck = 0;
|
||||
isContainerValid = isContainerValid && hasAccess( security, requirePower );
|
||||
}
|
||||
|
||||
protected boolean hasAccess(SecurityPermissions perm, boolean requirePower)
|
||||
{
|
||||
IActionHost host = null;
|
||||
|
||||
if ( tileEntity instanceof IActionHost )
|
||||
|
@ -77,11 +82,7 @@ public abstract class AEBaseContainer extends Container
|
|||
if ( part instanceof IActionHost )
|
||||
host = (IActionHost) part;
|
||||
|
||||
if ( host == null )
|
||||
{
|
||||
isContainerValid = false;
|
||||
}
|
||||
else
|
||||
if ( host != null )
|
||||
{
|
||||
IGridNode gn = host.getActionableNode();
|
||||
if ( gn != null )
|
||||
|
@ -93,18 +94,17 @@ public abstract class AEBaseContainer extends Container
|
|||
{
|
||||
IEnergyGrid eg = g.getCache( IEnergyGrid.class );
|
||||
if ( !eg.isNetworkPowered() )
|
||||
{
|
||||
isContainerValid = false;
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ISecurityGrid sg = g.getCache( ISecurityGrid.class );
|
||||
if ( !sg.hasPermission( invPlayer.player, security ) )
|
||||
isContainerValid = false;
|
||||
if ( sg.hasPermission( invPlayer.player, perm ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ContainerOpenContext openContext;
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.inventory.ICrafting;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
|
@ -31,7 +32,6 @@ 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;
|
||||
|
@ -51,7 +51,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||
IConfigManager serverCM;
|
||||
IConfigManager clientCM;
|
||||
|
||||
public AppEngSlot cellView;
|
||||
public boolean canAccessViewCells = false;
|
||||
public SlotRestrictedInput cellView[] = new SlotRestrictedInput[5];
|
||||
|
||||
public IConfigManagerHost gui;
|
||||
|
||||
|
@ -96,8 +97,16 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||
else
|
||||
monitor = null;
|
||||
|
||||
canAccessViewCells = false;
|
||||
if ( montiorable instanceof IViewCellStorage )
|
||||
addSlotToContainer( cellView = new SlotRestrictedInput( PlaceableItemType.VIEWCELL, ((IViewCellStorage) montiorable).getViewCellStorage(), 0, 205, 7 ) );
|
||||
{
|
||||
for (int y = 0; y < 5; y++)
|
||||
{
|
||||
cellView[y] = new SlotRestrictedInput( PlaceableItemType.VIEWCELL, ((IViewCellStorage) montiorable).getViewCellStorage(), y, 206, y * 18 + 8 );
|
||||
cellView[y].allowEdit = canAccessViewCells;
|
||||
addSlotToContainer( cellView[y] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( bindInventory )
|
||||
bindPlayerInventory( ip, 0, 0 );
|
||||
|
@ -171,6 +180,23 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||
}
|
||||
}
|
||||
|
||||
boolean oldCanAccessViewCells = canAccessViewCells;
|
||||
canAccessViewCells = hasAccess( SecurityPermissions.BUILD, false );
|
||||
if ( canAccessViewCells != oldCanAccessViewCells )
|
||||
{
|
||||
for (int y = 0; y < 5; y++)
|
||||
{
|
||||
if ( cellView[y] != null )
|
||||
cellView[y].allowEdit = canAccessViewCells;
|
||||
}
|
||||
|
||||
for (Object c : this.crafters)
|
||||
{
|
||||
if ( c instanceof ICrafting )
|
||||
((ICrafting) c).sendProgressBarUpdate( this, 99, canAccessViewCells ? 1 : 0 );
|
||||
}
|
||||
}
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
@ -212,6 +238,19 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int idx, int value)
|
||||
{
|
||||
super.updateProgressBar( idx, value );
|
||||
|
||||
if ( idx == 99 )
|
||||
canAccessViewCells = value == 1;
|
||||
|
||||
for (int y = 0; y < 5; y++)
|
||||
if ( cellView[y] != null )
|
||||
cellView[y].allowEdit = canAccessViewCells;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer player)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package appeng.container.slot;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -54,8 +55,15 @@ public class SlotRestrictedInput extends AppEngSlot
|
|||
}
|
||||
|
||||
public PlaceableItemType which;
|
||||
public boolean allowEdit = true;
|
||||
public int stackLimit = -1;
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return allowEdit;
|
||||
}
|
||||
|
||||
public Slot setStackLimit(int i)
|
||||
{
|
||||
stackLimit = i;
|
||||
|
@ -98,6 +106,10 @@ public class SlotRestrictedInput extends AppEngSlot
|
|||
return false;
|
||||
|
||||
IAppEngApi api = AEApi.instance();
|
||||
|
||||
if ( !allowEdit )
|
||||
return false;
|
||||
|
||||
switch (which)
|
||||
{
|
||||
case VALID_ENCODED_PATTERN_W_OUPUT:
|
||||
|
|
|
@ -42,7 +42,7 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
|
|||
talkBackTo = player;
|
||||
|
||||
DimensionalCoord loc = new DimensionalCoord( player.worldObj, this.cx << 4, this.cdy << 5, this.cz << 4 );
|
||||
WorldSettings.getInstance().getCompass().getCompassDirection( loc, 128, this );
|
||||
WorldSettings.getInstance().getCompass().getCompassDirection( loc, 174, this );
|
||||
}
|
||||
|
||||
// api
|
||||
|
|
|
@ -43,7 +43,7 @@ final public class MeteoriteWorldGen implements IWorldGenerator
|
|||
int z = r.nextInt( 16 ) + (chunkZ << 4);
|
||||
|
||||
myGen obj = new myGen();
|
||||
WorldSettings.getInstance().getCompass().getCompassDirection( new DimensionalCoord( w, x, 128, z ), 30, obj );
|
||||
WorldSettings.getInstance().getCompass().getCompassDirection( new DimensionalCoord( w, x, 128, z ), 70, obj );
|
||||
|
||||
synchronized (obj)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM
|
|||
{
|
||||
|
||||
IConfigManager cm = new ConfigManager( this );
|
||||
AppEngInternalInventory viewCell = new AppEngInternalInventory( this, 1 );
|
||||
AppEngInternalInventory viewCell = new AppEngInternalInventory( this, 5 );
|
||||
|
||||
public PartTerminal(Class clz, ItemStack is) {
|
||||
super( clz, is );
|
||||
|
|
|
@ -57,8 +57,8 @@ public class CompassService implements Runnable
|
|||
private class CMDirectionRequest extends CompassMessage
|
||||
{
|
||||
|
||||
public final DimensionalCoord coord;
|
||||
public final int maxRange;
|
||||
public final DimensionalCoord coord;
|
||||
public final ICompassCallback callback;
|
||||
|
||||
@Override
|
||||
|
@ -190,7 +190,7 @@ public class CompassService implements Runnable
|
|||
}
|
||||
|
||||
// spiral outward...
|
||||
for (int offset = 1; offset < 174; offset++)
|
||||
for (int offset = 1; offset < req.maxRange; offset++)
|
||||
{
|
||||
int minx = cx - offset;
|
||||
int minz = cz - offset;
|
||||
|
|
52
util/prioitylist/MergedPriorityList.java
Normal file
52
util/prioitylist/MergedPriorityList.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package appeng.util.prioitylist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
public class MergedPriorityList<T extends IAEStack<T>> implements IPartitionList<T>
|
||||
{
|
||||
|
||||
final List<IPartitionList<T>> positive = new ArrayList();
|
||||
final List<IPartitionList<T>> negative = new ArrayList();
|
||||
|
||||
public void addNewList(IPartitionList<T> list, boolean isWhitelist)
|
||||
{
|
||||
if ( isWhitelist )
|
||||
positive.add( list );
|
||||
else
|
||||
negative.add( list );
|
||||
}
|
||||
|
||||
public boolean isListed(T input)
|
||||
{
|
||||
for (IPartitionList<T> l : negative)
|
||||
if ( l.isListed( input ) )
|
||||
return false;
|
||||
|
||||
if ( !positive.isEmpty() )
|
||||
{
|
||||
for (IPartitionList<T> l : positive)
|
||||
if ( l.isListed( input ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return positive.isEmpty() && negative.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<T> getItems()
|
||||
{
|
||||
throw new RuntimeException( "Not Implemented" );
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue