Fixes #675 No disabled feature should log spam or crash anymore.
Deprecates the old usage of the AEItemDefinitions via the direct method access of * blocks() * parts() * items() * materials() and thus use the new re-direct via definitions(). All definitions are now initialized, no matter what. But SubItems, Items and Blocks are not registered, if by chance are disabled.
This commit is contained in:
@@ -34,33 +34,37 @@ import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ItemPaintBall extends AEBaseItem
|
||||
{
|
||||
|
||||
public ItemPaintBall() {
|
||||
super( ItemPaintBall.class );
|
||||
public static final int DAMAGE_THRESHOLD = 20;
|
||||
|
||||
public ItemPaintBall()
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
|
||||
this.hasSubtypes = true;
|
||||
this.setHasSubtypes( true );
|
||||
|
||||
if ( Platform.isClient() )
|
||||
MinecraftForgeClient.registerItemRenderer( this, new PaintBallRender() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack is)
|
||||
public String getItemStackDisplayName( ItemStack is )
|
||||
{
|
||||
return super.getItemStackDisplayName( is ) + " - " + this.getExtraName( is );
|
||||
}
|
||||
|
||||
public String getExtraName(ItemStack is)
|
||||
public String getExtraName( ItemStack is )
|
||||
{
|
||||
return (is.getItemDamage() >= 20 ? GuiText.Lumen.getLocal() + ' ' : "") + this.getColor( is );
|
||||
return ( is.getItemDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
|
||||
}
|
||||
|
||||
public AEColor getColor(ItemStack is)
|
||||
public AEColor getColor( ItemStack is )
|
||||
{
|
||||
int dmg = is.getItemDamage();
|
||||
if ( dmg >= 20 )
|
||||
dmg -= 20;
|
||||
if ( dmg >= DAMAGE_THRESHOLD )
|
||||
dmg -= DAMAGE_THRESHOLD;
|
||||
|
||||
if ( dmg >= AEColor.values().length )
|
||||
return AEColor.Transparent;
|
||||
@@ -69,21 +73,20 @@ public class ItemPaintBall extends AEBaseItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item i, CreativeTabs ct, List l)
|
||||
public void getSubItems( Item i, CreativeTabs ct, List l )
|
||||
{
|
||||
for (AEColor c : AEColor.values())
|
||||
for ( AEColor c : AEColor.values() )
|
||||
if ( c != AEColor.Transparent )
|
||||
l.add( new ItemStack( this, 1, c.ordinal() ) );
|
||||
|
||||
for (AEColor c : AEColor.values())
|
||||
for ( AEColor c : AEColor.values() )
|
||||
if ( c != AEColor.Transparent )
|
||||
l.add( new ItemStack( this, 1, 20 + c.ordinal() ) );
|
||||
l.add( new ItemStack( this, 1, DAMAGE_THRESHOLD + c.ordinal() ) );
|
||||
}
|
||||
|
||||
public boolean isLumen(ItemStack is)
|
||||
public boolean isLumen( ItemStack is )
|
||||
{
|
||||
int dmg = is.getItemDamage();
|
||||
return dmg >= 20;
|
||||
return dmg >= DAMAGE_THRESHOLD;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user