2013-12-27 23:59:59 +01:00
|
|
|
package appeng.core.features.registries;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
import net.minecraft.init.Items;
|
2013-12-27 23:59:59 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
2014-05-02 07:22:22 +02:00
|
|
|
import net.minecraftforge.oredict.OreDictionary;
|
2014-01-24 17:31:29 +01:00
|
|
|
import appeng.api.AEApi;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.api.config.TunnelType;
|
2014-01-24 17:31:29 +01:00
|
|
|
import appeng.api.definitions.Parts;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.api.features.IP2PTunnelRegistry;
|
2014-01-31 04:07:22 +01:00
|
|
|
import appeng.api.util.AEColor;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.util.Platform;
|
|
|
|
|
|
|
|
public class P2PTunnelRegistry implements IP2PTunnelRegistry
|
|
|
|
{
|
|
|
|
|
|
|
|
HashMap<ItemStack, TunnelType> Tunnels = new HashMap();
|
|
|
|
|
2014-01-24 17:31:29 +01:00
|
|
|
public void configure()
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* attune based on most redstone base items.
|
|
|
|
*/
|
2014-02-09 02:34:52 +01:00
|
|
|
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 );
|
2014-01-24 17:31:29 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* attune based on lots of random item related stuff
|
|
|
|
*/
|
2014-02-09 02:34:52 +01:00
|
|
|
appeng.api.definitions.Blocks AEBlocks = AEApi.instance().blocks();
|
2014-01-24 17:31:29 +01:00
|
|
|
Parts Parts = AEApi.instance().parts();
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
addNewAttunement( AEBlocks.blockInterface.stack( 1 ), TunnelType.ITEM );
|
2014-01-24 17:31:29 +01:00
|
|
|
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 );
|
2014-02-09 02:34:52 +01:00
|
|
|
addNewAttunement( new ItemStack( Blocks.hopper ), TunnelType.ITEM );
|
|
|
|
addNewAttunement( new ItemStack( Blocks.chest ), TunnelType.ITEM );
|
|
|
|
addNewAttunement( new ItemStack( Blocks.trapped_chest ), TunnelType.ITEM );
|
2014-01-24 17:31:29 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* attune based on lots of random item related stuff
|
|
|
|
*/
|
2014-02-09 02:34:52 +01:00
|
|
|
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 );
|
2014-01-31 04:07:22 +01:00
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
2014-01-24 17:31:29 +01:00
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
@Override
|
|
|
|
public void addNewAttunement(ItemStack trigger, TunnelType type)
|
|
|
|
{
|
|
|
|
if ( type == null )
|
2014-01-31 04:07:22 +01:00
|
|
|
return;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
|
|
|
Tunnels.put( trigger, type );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TunnelType getTunnelTypeByItem(ItemStack trigger)
|
|
|
|
{
|
2014-05-02 07:40:46 +02:00
|
|
|
if ( trigger != null )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-05-02 07:40:46 +02:00
|
|
|
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 );
|
2014-05-02 07:22:22 +02:00
|
|
|
|
2014-05-02 07:40:46 +02:00
|
|
|
if ( Platform.isSameItem( is, trigger ) )
|
|
|
|
return Tunnels.get( is );
|
|
|
|
}
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|