Applied-Energistics-2-tiler.../src/main/java/appeng/items/AEBaseItem.java

93 lines
2.4 KiB
Java
Raw Normal View History

2014-11-13 22:15:06 +01:00
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
2014-09-24 02:26:27 +02:00
package appeng.items;
2014-11-13 22:15:06 +01:00
2014-09-24 02:26:27 +02:00
import java.util.EnumSet;
import java.util.List;
2014-09-24 02:26:27 +02:00
import net.minecraft.entity.player.EntityPlayer;
2014-09-24 02:26:27 +02:00
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
2014-11-13 22:15:06 +01:00
2014-09-24 02:26:27 +02:00
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IAEFeature;
2014-11-13 22:15:06 +01:00
2014-09-24 02:26:27 +02:00
public class AEBaseItem extends Item implements IAEFeature
{
final String featureFullName;
final String featureSubName;
2014-09-24 02:26:27 +02:00
AEFeatureHandler feature;
@Override
public String toString()
{
return featureFullName;
2014-09-24 02:26:27 +02:00
}
@Override
public AEFeatureHandler feature()
{
return feature;
}
2014-11-13 22:15:06 +01:00
public void setFeature( EnumSet<AEFeature> f )
2014-09-24 02:26:27 +02:00
{
feature = new AEFeatureHandler( f, this, featureSubName );
2014-09-24 02:26:27 +02:00
}
2014-11-13 22:15:06 +01:00
public AEBaseItem( Class c )
{
2014-09-24 02:26:27 +02:00
this( c, null );
canRepair = false;
}
2014-11-13 22:15:06 +01:00
public AEBaseItem( Class c, String subName )
{
featureSubName = subName;
featureFullName = AEFeatureHandler.getName( c, subName );
2014-09-24 02:26:27 +02:00
}
@Override
2014-11-13 22:15:06 +01:00
public boolean isBookEnchantable( ItemStack itemstack1, ItemStack itemstack2 )
2014-09-24 02:26:27 +02:00
{
return false;
}
@Override
public void postInit()
{
// override!
}
@Override
@SuppressWarnings( "unchecked" )
public final void addInformation( ItemStack stack, EntityPlayer player, List lines, boolean displayAdditionalInformation )
{
this.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
}
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
super.addInformation( stack, player, lines, displayAdditionalInformation );
}
2014-09-24 02:26:27 +02:00
}