Applied-Energistics-2-tiler.../core/features/registries/P2PTunnelRegistry.java
AlgorithmX2 4d758d75ee Fixed Bug: #0921 - P2P tunnel cannot be attuned to RF
Added Several Mekaism Attunements.
Added Several Ender IO Attunements.
Added Several Extra Utilities Attunements.
Added TE Cell / Dynamo Attunements.
2014-08-19 00:42:54 -05:00

128 lines
5.1 KiB
Java

package appeng.core.features.registries;
import java.util.HashMap;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.config.TunnelType;
import appeng.api.definitions.Parts;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.util.AEColor;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
public class P2PTunnelRegistry implements IP2PTunnelRegistry
{
HashMap<ItemStack, TunnelType> Tunnels = new HashMap();
public ItemStack getModItem(String modID, String Name, int meta)
{
ItemStack myItmeStack = GameRegistry.findItemStack( modID, Name, 1 );
if ( myItmeStack == null )
return null;
myItmeStack.setItemDamage( meta );
return myItmeStack;
}
public void configure()
{
/**
* light!
*/
addNewAttunement( new ItemStack( Blocks.torch ), TunnelType.LIGHT );
addNewAttunement( new ItemStack( Blocks.glowstone ), TunnelType.LIGHT );
/**
* attune based on most redstone base items.
*/
addNewAttunement( new ItemStack( Items.redstone ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Items.repeater ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Blocks.redstone_lamp ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Blocks.unpowered_comparator ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Blocks.powered_comparator ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Blocks.powered_repeater ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Blocks.unpowered_repeater ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Blocks.daylight_detector ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Blocks.redstone_wire ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Blocks.redstone_block ), TunnelType.REDSTONE );
addNewAttunement( new ItemStack( Blocks.lever ), TunnelType.REDSTONE );
addNewAttunement( getModItem( "EnderIO", "itemRedstoneConduit", OreDictionary.WILDCARD_VALUE ), TunnelType.REDSTONE );
/**
* attune based on lots of random item related stuff
*/
appeng.api.definitions.Blocks AEBlocks = AEApi.instance().blocks();
Parts Parts = AEApi.instance().parts();
addNewAttunement( AEBlocks.blockInterface.stack( 1 ), TunnelType.ITEM );
addNewAttunement( Parts.partInterface.stack( 1 ), TunnelType.ITEM );
addNewAttunement( Parts.partStorageBus.stack( 1 ), TunnelType.ITEM );
addNewAttunement( Parts.partImportBus.stack( 1 ), TunnelType.ITEM );
addNewAttunement( Parts.partExportBus.stack( 1 ), TunnelType.ITEM );
addNewAttunement( new ItemStack( Blocks.hopper ), TunnelType.ITEM );
addNewAttunement( new ItemStack( Blocks.chest ), TunnelType.ITEM );
addNewAttunement( new ItemStack( Blocks.trapped_chest ), TunnelType.ITEM );
addNewAttunement( getModItem( "ExtraUtilities", "extractor_base", 0 ), TunnelType.ITEM );
addNewAttunement( getModItem( "Mekanism", "PartTransmitter", 9 ), TunnelType.ITEM );
addNewAttunement( getModItem( "EnderIO", "itemItemConduit", OreDictionary.WILDCARD_VALUE ), TunnelType.ITEM );
/**
* attune based on lots of random item related stuff
*/
addNewAttunement( new ItemStack( Items.bucket ), TunnelType.FLUID );
addNewAttunement( new ItemStack( Items.lava_bucket ), TunnelType.FLUID );
addNewAttunement( new ItemStack( Items.milk_bucket ), TunnelType.FLUID );
addNewAttunement( new ItemStack( Items.water_bucket ), TunnelType.FLUID );
addNewAttunement( getModItem( "Mekanism", "MachineBlock2", 11 ), TunnelType.FLUID );
addNewAttunement( getModItem( "Mekanism", "PartTransmitter", 4 ), TunnelType.FLUID );
addNewAttunement( getModItem( "ExtraUtilities", "extractor_base", 6 ), TunnelType.FLUID );
addNewAttunement( getModItem( "ExtraUtilities", "drum", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
addNewAttunement( getModItem( "EnderIO", "itemLiquidConduit", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
for (AEColor c : AEColor.values())
{
addNewAttunement( Parts.partCableGlass.stack( c, 1 ), TunnelType.ME );
addNewAttunement( Parts.partCableCovered.stack( c, 1 ), TunnelType.ME );
addNewAttunement( Parts.partCableSmart.stack( c, 1 ), TunnelType.ME );
addNewAttunement( Parts.partCableDense.stack( c, 1 ), TunnelType.ME );
}
}
@Override
public void addNewAttunement(ItemStack trigger, TunnelType type)
{
if ( type == null || trigger == null )
return;
Tunnels.put( trigger, type );
}
@Override
public TunnelType getTunnelTypeByItem(ItemStack trigger)
{
if ( trigger != null )
{
if ( FluidContainerRegistry.isContainer( trigger ) )
return TunnelType.FLUID;
for (ItemStack is : Tunnels.keySet())
{
if ( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE )
return Tunnels.get( is );
if ( Platform.isSameItem( is, trigger ) )
return Tunnels.get( is );
}
}
return null;
}
}