AE2 First Commit, the dawn of 1.7 hast arrived.
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
|
||||
public class AppEngGrinderRecipe implements IGrinderEntry
|
||||
{
|
||||
|
||||
private ItemStack in;
|
||||
private ItemStack out;
|
||||
|
||||
private float optionalChance;
|
||||
private ItemStack optionalOutput;
|
||||
|
||||
private int energy;
|
||||
|
||||
public AppEngGrinderRecipe(ItemStack a, ItemStack b, int cost) {
|
||||
in = a;
|
||||
out = b;
|
||||
energy = cost;
|
||||
}
|
||||
|
||||
public AppEngGrinderRecipe(ItemStack a, ItemStack b, ItemStack c, float chance, int cost) {
|
||||
in = a;
|
||||
out = b;
|
||||
|
||||
optionalOutput = c;
|
||||
optionalChance = chance;
|
||||
|
||||
energy = cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getInput()
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInput(ItemStack i)
|
||||
{
|
||||
in = i.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOutput()
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutput(ItemStack o)
|
||||
{
|
||||
out = o.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyCost()
|
||||
{
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyCost(int c)
|
||||
{
|
||||
energy = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOptionalOutput()
|
||||
{
|
||||
return optionalOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionalOutput(ItemStack output, float chance)
|
||||
{
|
||||
optionalOutput = output;
|
||||
optionalChance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getOptionalChance()
|
||||
{
|
||||
return optionalChance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import appeng.api.implementations.IChestOrDrive;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.me.storage.CellInventory;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BasicCellHandler implements ICellHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean isCell(ItemStack is)
|
||||
{
|
||||
return CellInventory.isCell( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(ItemStack is, StorageChannel channel)
|
||||
{
|
||||
if ( channel == StorageChannel.ITEMS )
|
||||
return CellInventory.getCell( is );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getTopTexture()
|
||||
{
|
||||
return ExtraTextures.BlockMEChestItems.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan)
|
||||
{
|
||||
Platform.openGUI( player, (AEBaseTile) chest, chest.getUp(), GuiBridge.GUI_ME );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusForCell(ItemStack is, IMEInventory handler)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double cellIdleDrain(ItemStack is, IMEInventory handler)
|
||||
{
|
||||
CellInventory inv = (CellInventory) handler;
|
||||
return inv.getIdleDrain();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class BasicTerminalHandler implements IWirelessTermHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean canHandle(ItemStack is)
|
||||
{
|
||||
if ( is == null )
|
||||
return false;
|
||||
|
||||
if ( AEApi.instance().items().itemWirelessTerminal.sameAs( is ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usePower(Player player, float amount, ItemStack is)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPower(Player player, ItemStack is)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncryptionKey(ItemStack i)
|
||||
{
|
||||
if ( i == null )
|
||||
return null;
|
||||
NBTTagCompound tag = Platform.openNbtData( i );
|
||||
if ( tag != null )
|
||||
{
|
||||
return tag.getString( "encKey" );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEncryptionKey(ItemStack i, String encKey, String name)
|
||||
{
|
||||
if ( i == null )
|
||||
return;
|
||||
NBTTagCompound tag = Platform.openNbtData( i );
|
||||
if ( tag != null )
|
||||
{
|
||||
tag.setString( "encKey", encKey );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package appeng.core.features.registries.entries;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.Icon;
|
||||
import appeng.api.implementations.IChestOrDrive;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.items.storage.ItemCreativeStorageCell;
|
||||
import appeng.me.storage.CreativeCellInventory;
|
||||
|
||||
public class CreativeCellHandler implements ICellHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean isCell(ItemStack is)
|
||||
{
|
||||
return is != null && is.getItem() instanceof ItemCreativeStorageCell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(ItemStack is, StorageChannel channel)
|
||||
{
|
||||
if ( channel == StorageChannel.ITEMS && is != null && is.getItem() instanceof ItemCreativeStorageCell )
|
||||
return CreativeCellInventory.getCell( is );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getTopTexture()
|
||||
{
|
||||
return ExtraTextures.BlockMEChestItems.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan)
|
||||
{
|
||||
player.sendChatToPlayer( ChatMessageComponent.createFromText( "Not ready yet..." ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusForCell(ItemStack is, IMEInventory handler)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double cellIdleDrain(ItemStack is, IMEInventory handler)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user