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:
thatsIch
2015-01-03 02:53:14 +01:00
parent 3dd81433ac
commit 9986ffc458
385 changed files with 12477 additions and 8292 deletions
+23 -21
View File
@@ -18,6 +18,8 @@
package appeng.debug;
import java.util.Collection;
import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
@@ -35,16 +37,25 @@ import appeng.core.features.AEFeature;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ToolEraser extends AEBaseItem
{
public ToolEraser() {
super( ToolEraser.class );
public static final int BLOCK_ERASE_LIMIT = 90000;
public ToolEraser()
{
this.setFeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
public void registerIcons( IIconRegister par1IconRegister )
{
this.itemIcon = new MissingIcon( this );
}
@Override
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
{
if ( Platform.isClient() )
return false;
@@ -56,13 +67,12 @@ public class ToolEraser extends AEBaseItem
List<WorldCoord> next = new LinkedList<WorldCoord>();
next.add( new WorldCoord( x, y, z ) );
while (blocks < 90000 && !next.isEmpty())
while ( blocks < BLOCK_ERASE_LIMIT && !next.isEmpty() )
{
List<WorldCoord> c = next;
next = new LinkedList<WorldCoord>();
for (WorldCoord wc : c)
for ( WorldCoord wc : c )
{
Block c_blk = world.getBlock( wc.x, wc.y, wc.z );
int c_meta = world.getBlockMetadata( wc.x, wc.y, wc.z );
@@ -72,15 +82,14 @@ public class ToolEraser extends AEBaseItem
blocks++;
world.setBlock( wc.x, wc.y, wc.z, Platform.AIR );
this.check( world, wc.x + 1, wc.y, wc.z, next );
this.check( world, wc.x - 1, wc.y, wc.z, next );
this.check( world, wc.x, wc.y + 1, wc.z, next );
this.check( world, wc.x, wc.y - 1, wc.z, next );
this.check( world, wc.x, wc.y, wc.z + 1, next );
this.check( world, wc.x, wc.y, wc.z - 1, next );
this.wrappedAdd( world, wc.x + 1, wc.y, wc.z, next );
this.wrappedAdd( world, wc.x - 1, wc.y, wc.z, next );
this.wrappedAdd( world, wc.x, wc.y + 1, wc.z, next );
this.wrappedAdd( world, wc.x, wc.y - 1, wc.z, next );
this.wrappedAdd( world, wc.x, wc.y, wc.z + 1, next );
this.wrappedAdd( world, wc.x, wc.y, wc.z - 1, next );
}
}
}
AELog.info( "Delete " + blocks + " blocks" );
@@ -88,15 +97,8 @@ public class ToolEraser extends AEBaseItem
return true;
}
private void check(World world, int i, int y, int z, List<WorldCoord> next)
private void wrappedAdd( World world, int i, int y, int z, Collection<WorldCoord> next )
{
next.add( new WorldCoord( i, y, z ) );
}
@Override
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = new MissingIcon( this );
}
}