Merge branch 'master' of https://bitbucket.org/AlgorithmX2/appliedenergistics2 into rv1
This commit is contained in:
commit
e9759f681e
10 changed files with 129 additions and 17 deletions
|
@ -139,7 +139,11 @@ public class ClientHelper extends ServerHelper
|
|||
public void init()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postinit()
|
||||
{
|
||||
RenderingRegistry.registerBlockHandler( WorldRender.instance );
|
||||
RenderManager.instance.entityRenderMap.put( EntityTinyTNTPrimed.class, new RenderTinyTNTPrimed() );
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import appeng.container.implementations.ContainerMEMonitorable;
|
|||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
|
@ -132,8 +133,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
maxRows = getMaxRows();
|
||||
perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ((width - standardSize) / 18);
|
||||
|
||||
int NEI = 0;
|
||||
int top = 4;
|
||||
boolean hasNEI = AppEng.instance.isIntegrationEnabled( "NEI" );
|
||||
|
||||
int NEI = hasNEI ? 4 : 0;
|
||||
int top = hasNEI ? 22 : 4;
|
||||
|
||||
int magicNumber = 114 + 1;
|
||||
int extraSpace = height - magicNumber - NEI - top - reservedSpace;
|
||||
|
||||
|
@ -144,6 +148,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
rows = maxRows;
|
||||
}
|
||||
|
||||
if ( hasNEI )
|
||||
rows--;
|
||||
|
||||
meSlots.clear();
|
||||
for (int y = 0; y < rows; y++)
|
||||
{
|
||||
|
@ -181,7 +188,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
.getSetting( Settings.SEARCH_MODE ) ) );
|
||||
offset += 20;
|
||||
|
||||
if ( !(this instanceof GuiMEPortableCell ) )
|
||||
if ( !(this instanceof GuiMEPortableCell) )
|
||||
{
|
||||
buttonList.add( terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings
|
||||
.getSetting( Settings.TERMINAL_STYLE ) ) );
|
||||
|
@ -299,7 +306,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||
bindTexture( getBackground() );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
|
||||
|
||||
if ( viewCell || ( this instanceof GuiSecurity))
|
||||
if ( viewCell || (this instanceof GuiSecurity) )
|
||||
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
|
||||
|
||||
for (int x = 0; x < rows; x++)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package appeng.client.me;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -8,6 +10,7 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.Upgrades;
|
||||
|
@ -26,6 +29,7 @@ import appeng.util.prioitylist.FuzzyPriorityList;
|
|||
import appeng.util.prioitylist.IPartitionList;
|
||||
import appeng.util.prioitylist.MergedPriorityList;
|
||||
import appeng.util.prioitylist.PrecisePriorityList;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class ItemRepo
|
||||
{
|
||||
|
@ -151,6 +155,32 @@ public class ItemRepo
|
|||
updateView();
|
||||
}
|
||||
|
||||
private String NEIWord = null;
|
||||
|
||||
private void updateNEI(String filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( NEIWord == null || !NEIWord.equals( filter ) )
|
||||
{
|
||||
Class c = ReflectionHelper.getClass( getClass().getClassLoader(), "codechicken.nei.LayoutManager" );
|
||||
Field fldSearchField = c.getField( "searchField" );
|
||||
Object searchField = fldSearchField.get( c );
|
||||
|
||||
Method a = searchField.getClass().getMethod( "setText", String.class );
|
||||
Method b = searchField.getClass().getMethod( "onTextChange", String.class );
|
||||
|
||||
NEIWord = filter;
|
||||
a.invoke( searchField, filter );
|
||||
b.invoke( searchField, "" );
|
||||
}
|
||||
}
|
||||
catch (Throwable _)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateView()
|
||||
{
|
||||
view.clear();
|
||||
|
@ -159,6 +189,10 @@ public class ItemRepo
|
|||
view.ensureCapacity( list.size() );
|
||||
dsp.ensureCapacity( list.size() );
|
||||
|
||||
Enum mode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||
if ( mode == SearchBoxMode.NEI_AUTOSEARCH || mode == SearchBoxMode.NEI_MANUAL_SEARCH )
|
||||
updateNEI( searchString );
|
||||
|
||||
boolean terminalSearchToolTips = AEConfig.instance.settings.getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
|
||||
// boolean terminalSearchMods = Configuration.instance.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
|
||||
|
||||
|
|
|
@ -166,7 +166,20 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
for (Enum e : settings.getSettings())
|
||||
{
|
||||
String Category = e.getClass().getSimpleName();
|
||||
this.get( Category, e.name(), settings.getSetting( e ).name() );
|
||||
|
||||
Enum value = settings.getSetting( e );
|
||||
Property p = this.get( Category, e.name(), value.name() );
|
||||
|
||||
try
|
||||
{
|
||||
value = Enum.valueOf( value.getClass(), p.getString() );
|
||||
}
|
||||
catch (IllegalArgumentException er)
|
||||
{
|
||||
AELog.info( "Invalid value '" + p.getString() + "' for " + e.name() + " using '" + value.name() + "' instead" );
|
||||
}
|
||||
|
||||
settings.putSetting( e, value );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -207,9 +220,13 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
public void updateSetting(IConfigManager manager, Enum setting, Enum newValue)
|
||||
{
|
||||
for (Enum e : settings.getSettings())
|
||||
{
|
||||
if ( e == setting )
|
||||
{
|
||||
String Category = e.getClass().getSimpleName();
|
||||
this.get( Category, e.name(), settings.getSetting( e ).name() );
|
||||
Property p = this.get( Category, e.name(), settings.getSetting( e ).name() );
|
||||
p.set( newValue.name() );
|
||||
}
|
||||
}
|
||||
|
||||
save();
|
||||
|
|
|
@ -158,6 +158,7 @@ public class AppEng
|
|||
Registration.instance.PostInit( event );
|
||||
IntegrationRegistry.instance.postinit();
|
||||
|
||||
CommonHelper.proxy.postinit();
|
||||
AEConfig.instance.save();
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler( this, GuiBridge.GUI_Handler );
|
||||
|
|
|
@ -37,4 +37,6 @@ public abstract class CommonHelper
|
|||
|
||||
public abstract void doRenderItem(ItemStack sis, TileEntity tile);
|
||||
|
||||
public abstract void postinit();
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollsionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
@ -34,6 +35,7 @@ import appeng.api.util.AECableType;
|
|||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.helpers.AEMultiTile;
|
||||
import appeng.parts.BusCollisionHelper;
|
||||
import appeng.parts.CableBusContainer;
|
||||
|
@ -282,6 +284,30 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
|
|||
@Override
|
||||
public boolean canAddPart(ItemStack is, ForgeDirection side)
|
||||
{
|
||||
if ( is.getItem() instanceof IFacadeItem )
|
||||
{
|
||||
IFacadeItem bi = (IFacadeItem) is.getItem();
|
||||
|
||||
is = is.copy();
|
||||
is.stackSize = 1;
|
||||
|
||||
IFacadePart bp = bi.createPartFromItemStack( is, side );
|
||||
if ( !(side == null || side == ForgeDirection.UNKNOWN || tile() == null) )
|
||||
{
|
||||
List<AxisAlignedBB> boxes = new ArrayList();
|
||||
IPartCollsionHelper bch = new BusCollisionHelper( boxes, side, null, true );
|
||||
bp.getBoxes( bch );
|
||||
for (AxisAlignedBB bb : boxes)
|
||||
{
|
||||
if ( !tile().canAddPart( new NormallyOccludedPart( new Cuboid6( bb ) ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( is.getItem() instanceof IPartItem )
|
||||
{
|
||||
IPartItem bi = (IPartItem) is.getItem();
|
||||
|
|
|
@ -41,6 +41,7 @@ import appeng.api.util.DimensionalCoord;
|
|||
import appeng.client.render.BusRenderHelper;
|
||||
import appeng.client.render.CableRenderHelper;
|
||||
import appeng.facade.FacadeContainer;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.helpers.AEMultiTile;
|
||||
import appeng.me.GridConnection;
|
||||
import appeng.util.Platform;
|
||||
|
@ -140,6 +141,9 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
@Override
|
||||
public boolean canAddPart(ItemStack is, ForgeDirection side)
|
||||
{
|
||||
if ( is.getItem() instanceof IFacadeItem )
|
||||
return true;
|
||||
|
||||
if ( is.getItem() instanceof IPartItem )
|
||||
{
|
||||
IPartItem bi = (IPartItem) is.getItem();
|
||||
|
@ -390,6 +394,13 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
{
|
||||
IPartCollsionHelper bch = new BusCollisionHelper( boxes, s, e, visual );
|
||||
|
||||
if ( s != ForgeDirection.UNKNOWN )
|
||||
{
|
||||
IFacadePart fpa = fc.getFacade( s );
|
||||
if ( fpa != null )
|
||||
fpa.getBoxes( bch );
|
||||
}
|
||||
|
||||
IPart part = getPart( s );
|
||||
if ( part != null )
|
||||
{
|
||||
|
@ -969,7 +980,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void cleanup() {
|
||||
public void cleanup()
|
||||
{
|
||||
tcb.cleanup();
|
||||
}
|
||||
|
||||
|
|
|
@ -148,6 +148,8 @@ public class PartPlacement
|
|||
if ( host.getPart( ForgeDirection.UNKNOWN ) == null )
|
||||
return false;
|
||||
|
||||
if ( host.canAddPart( held, side ) )
|
||||
{
|
||||
if ( host.getFacadeContainer().addFacade( fp ) )
|
||||
{
|
||||
host.markForUpdate();
|
||||
|
@ -163,6 +165,7 @@ public class PartPlacement
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.swingItem();
|
||||
|
|
|
@ -72,6 +72,12 @@ public class ServerHelper extends CommonHelper
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postinit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue