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
@@ -0,0 +1,98 @@
package appeng.worldgen.meteorite;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import appeng.util.Platform;
public class ChunkOnly extends StandardWorld
{
final Chunk target;
final int cx, cz;
int verticalBits = 0;
public ChunkOnly( World w, int cx, int cz )
{
super( w );
this.target = w.getChunkFromChunkCoords( cx, cz );
this.cx = cx;
this.cz = cz;
}
@Override
public int minX( int in )
{
return Math.max( in, this.cx << 4 );
}
@Override
public int minZ( int in )
{
return Math.max( in, this.cz << 4 );
}
@Override
public int maxX( int in )
{
return Math.min( in, ( this.cx + 1 ) << 4 );
}
@Override
public int maxZ( int in )
{
return Math.min( in, ( this.cz + 1 ) << 4 );
}
@Override
public int getBlockMetadata( int x, int y, int z )
{
if ( this.range( x, y, z ) )
return this.target.getBlockMetadata( x & 0xF, y, z & 0xF );
return 0;
}
@Override
public Block getBlock( int x, int y, int z )
{
if ( this.range( x, y, z ) )
return this.target.getBlock( x & 0xF, y, z & 0xF );
return Platform.AIR;
}
@Override
public void setBlock( int x, int y, int z, Block blk )
{
if ( this.range( x, y, z ) )
{
this.verticalBits |= 1 << ( y >> 4 );
this.w.setBlock( x, y, z, blk, 0, 1 );
}
}
@Override
public void setBlock( int x, int y, int z, Block blk, int metadata, int flags )
{
if ( this.range( x, y, z ) )
{
this.verticalBits |= 1 << ( y >> 4 );
this.w.setBlock( x, y, z, blk, metadata, flags & ( ~2 ) );
}
}
@Override
public void done()
{
if ( this.verticalBits != 0 )
Platform.sendChunk( this.target, this.verticalBits );
}
@Override
public boolean range( int x, int y, int z )
{
return this.cx == ( x >> 4 ) && this.cz == ( z >> 4 );
}
}