Fixed applying the type of tunnel for P2P tunnels.

This was caused by the enforced lowercase mod id's and item names since 1.11.
This commit is contained in:
Gunther De Wachter 2017-07-12 06:04:06 +02:00
parent fe213e5ac5
commit eb11845a2f
3 changed files with 21 additions and 18 deletions

View file

@ -26,6 +26,7 @@ package appeng.api.features;
import javax.annotation.Nullable;
import com.sun.istack.internal.NotNull;
import net.minecraft.item.ItemStack;
import appeng.api.config.TunnelType;
@ -44,7 +45,7 @@ public interface IP2PTunnelRegistry
* @param trigger - the item which triggers attunement. Nullable, but then ignored
* @param type - the type of tunnel. Nullable, but then ignored
*/
void addNewAttunement( @Nullable ItemStack trigger, @Nullable TunnelType type );
void addNewAttunement( @NotNull ItemStack trigger, @Nullable TunnelType type );
/**
* returns null if no attunement can be found.
@ -53,6 +54,6 @@ public interface IP2PTunnelRegistry
*
* @return null if no attunement can be found or attunement
*/
@Nullable
@NotNull
TunnelType getTunnelTypeByItem( ItemStack trigger );
}

View file

@ -22,8 +22,10 @@ package appeng.core.features.registries;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.sun.istack.internal.NotNull;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@ -69,7 +71,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
this.addNewAttunement( new ItemStack( Blocks.REDSTONE_WIRE ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.REDSTONE_BLOCK ), TunnelType.REDSTONE );
this.addNewAttunement( new ItemStack( Blocks.LEVER ), TunnelType.REDSTONE );
this.addNewAttunement( this.getModItem( "EnderIO", "itemRedstoneConduit", OreDictionary.WILDCARD_VALUE ), TunnelType.REDSTONE );
this.addNewAttunement( this.getModItem( "enderio", "itemredstoneconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.REDSTONE );
/**
* attune based on lots of random item related stuff
@ -87,10 +89,10 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
this.addNewAttunement( new ItemStack( Blocks.HOPPER ), TunnelType.ITEM );
this.addNewAttunement( new ItemStack( Blocks.CHEST ), TunnelType.ITEM );
this.addNewAttunement( new ItemStack( Blocks.TRAPPED_CHEST ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "ExtraUtilities", "extractor_base", 0 ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "Mekanism", "PartTransmitter", 9 ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "EnderIO", "itemItemConduit", OreDictionary.WILDCARD_VALUE ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "ThermalDynamics", "ThermalDynamics_32", 0 ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 0 ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 9 ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "enderio", "itemitemconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.ITEM );
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 0 ), TunnelType.ITEM );
/**
* attune based on lots of random item related stuff
@ -99,12 +101,12 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
this.addNewAttunement( new ItemStack( Items.LAVA_BUCKET ), TunnelType.FLUID );
this.addNewAttunement( new ItemStack( Items.MILK_BUCKET ), TunnelType.FLUID );
this.addNewAttunement( new ItemStack( Items.WATER_BUCKET ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "Mekanism", "MachineBlock2", 11 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "Mekanism", "PartTransmitter", 4 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "ExtraUtilities", "extractor_base", 6 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "ExtraUtilities", "drum", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "EnderIO", "itemLiquidConduit", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "ThermalDynamics", "ThermalDynamics_16", 0 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "mekanism", "machineblock2", 11 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 4 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 6 ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "extrautilities", "drum", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "enderio", "itemliquidconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID );
this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 0 ), TunnelType.FLUID );
for( final AEColor c : AEColor.values() )
{
@ -116,9 +118,9 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
}
@Override
public void addNewAttunement( @Nullable final ItemStack trigger, @Nullable final TunnelType type )
public void addNewAttunement( @Nonnull final ItemStack trigger, @Nullable final TunnelType type )
{
if( type == null || trigger == null )
if( type == null || trigger.isEmpty() )
{
return;
}
@ -130,7 +132,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
@Override
public TunnelType getTunnelTypeByItem( final ItemStack trigger )
{
if( trigger != null )
if( !trigger.isEmpty() )
{
// if( FluidRegistry.isContainer( trigger ) )
// {
@ -154,7 +156,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry
return null;
}
@Nullable
@NotNull
private ItemStack getModItem( final String modID, final String name, final int meta )
{

View file

@ -160,7 +160,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
{
final ItemStack is = player.inventory.getCurrentItem();
final ItemStack is = player.getHeldItem( hand );
// UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor( is.getItem() );
// AELog.info( "ID:" + id.toString() + " : " + is.getItemDamage() );