AE2 First Commit, the dawn of 1.7 hast arrived.

This commit is contained in:
algorithmx2
2013-12-27 16:59:59 -06:00
commit e9acdcbee2
468 changed files with 47440 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package appeng.client.me;
import net.minecraft.item.ItemStack;
import appeng.api.storage.data.IAEItemStack;
public class InternalSlotME
{
private final ItemRepo repo;
public int offset;
public int xPos;
public int yPos;
public InternalSlotME(ItemRepo def, int offset, int displayX, int displayY) {
this.repo = def;
this.offset = offset;
this.xPos = displayX;
this.yPos = displayY;
}
public ItemStack getStack()
{
return repo.getItem( offset );
}
public IAEItemStack getAEStack()
{
return repo.getRefrenceItem( offset );
}
}
+148
View File
@@ -0,0 +1,148 @@
package appeng.client.me;
import java.util.ArrayList;
import java.util.Collections;
import java.util.regex.Pattern;
import net.minecraft.item.ItemStack;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
import appeng.api.config.YesNo;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource;
import appeng.core.Configuration;
import appeng.util.ItemSorters;
import appeng.util.Platform;
import appeng.util.item.ItemList;
public class ItemRepo
{
final private IItemList<IAEItemStack> list = new ItemList();
final private ArrayList<IAEItemStack> view = new ArrayList();
final private ArrayList<ItemStack> dsp = new ArrayList();
final private IScrollSource src;
public int rowSize = 9;
public String searchString = "";
public ItemRepo(IScrollSource src) {
this.src = src;
}
public IAEItemStack getRefrenceItem(int idx)
{
idx += src.getCurrentScroll() * rowSize;
if ( idx >= view.size() )
return null;
return view.get( idx );
}
public ItemStack getItem(int idx)
{
idx += src.getCurrentScroll() * rowSize;
if ( idx >= dsp.size() )
return null;
return dsp.get( idx );
}
void setSearch(String search)
{
searchString = search == null ? "" : search;
}
public void postUpdate(IAEItemStack is)
{
IAEItemStack st = list.findPrecise( is );
if ( st != null )
{
st.reset();
st.add( is );
}
else
list.add( is );
}
public void updateView()
{
view.clear();
dsp.clear();
view.ensureCapacity( list.size() );
dsp.ensureCapacity( list.size() );
boolean terminalSearchToolTips = Configuration.instance.settings.getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
// boolean terminalSearchMods = Configuration.instance.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
Pattern m = null;
try
{
m = Pattern.compile( searchString.toLowerCase(), Pattern.CASE_INSENSITIVE );
}
catch (Throwable _)
{
try
{
m = Pattern.compile( Pattern.quote( searchString.toLowerCase() ), Pattern.CASE_INSENSITIVE );
}
catch (Throwable __)
{
return;
}
}
boolean notDone = false;
for (IAEItemStack is : list)
{
String dspName = Platform.getItemDisplayName( is );
notDone = true;
if ( m.matcher( dspName.toLowerCase() ).find() )
{
view.add( is );
notDone = false;
}
if ( terminalSearchToolTips && notDone )
{
for (Object lp : Platform.getTooltip( is ))
if ( lp instanceof String && m.matcher( (String) lp ).find() )
{
view.add( is );
notDone = false;
break;
}
}
/*
* if ( terminalSearchMods && notDone ) { if ( m.matcher( Platform.getMod( is.getItemStack() ) ).find() ) {
* view.add( is ); notDone = false; } }
*/
}
Enum SortBy = Configuration.instance.settings.getSetting( Settings.SORT_BY );
Enum SortDir = Configuration.instance.settings.getSetting( Settings.SORT_DIRECTION );
ItemSorters.Direction = (appeng.api.config.SortDir) SortDir;
if ( SortBy == SortOrder.AMOUNT )
Collections.sort( view, ItemSorters.ConfigBased_SortBySize );
else if ( SortBy == SortOrder.MOD )
Collections.sort( view, ItemSorters.ConfigBased_SortByMod );
else
Collections.sort( view, ItemSorters.ConfigBased_SortByName );
for (IAEItemStack is : view)
dsp.add( is.getItemStack() );
}
public int size()
{
return view.size();
}
}
+77
View File
@@ -0,0 +1,77 @@
package appeng.client.me;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import appeng.api.storage.data.IAEItemStack;
public class SlotME extends Slot
{
public InternalSlotME mySlot;
public SlotME(InternalSlotME me) {
super( null, 0, me.xPos, me.yPos );
mySlot = me;
}
@Override
public ItemStack getStack()
{
return mySlot.getStack();
}
public IAEItemStack getAEStack()
{
return mySlot.getAEStack();
}
@Override
public boolean canTakeStack(EntityPlayer par1EntityPlayer)
{
return false;
}
@Override
public ItemStack decrStackSize(int par1)
{
return null;
}
@Override
public void putStack(ItemStack par1ItemStack)
{
}
@Override
public boolean getHasStack()
{
return getStack() != null;
}
@Override
public boolean isItemValid(ItemStack par1ItemStack)
{
return false;
}
@Override
public int getSlotStackLimit()
{
return 0;
}
@Override
public boolean isSlotInInventory(IInventory par1iInventory, int par2)
{
return false;
}
@Override
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
{
}
}