Fixed biome registration for spatial storage cells.
Fixed matrix block conversion to air when transferring. Fixed biome initialization of new chunks.
This commit is contained in:
parent
0ed8a4c3e8
commit
8e7d63dccb
|
@ -167,13 +167,16 @@ public final class Registration
|
||||||
}
|
}
|
||||||
|
|
||||||
this.storageBiome = new BiomeGenStorage();
|
this.storageBiome = new BiomeGenStorage();
|
||||||
|
Biome.registerBiome( config.storageBiomeID, "appliedenergistics2:storage_biome", this.storageBiome );
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !force && config.storageBiomeID != -1 )
|
if( !force && config.storageBiomeID != -1 )
|
||||||
{
|
{
|
||||||
this.storageBiome = new BiomeGenStorage();
|
this.storageBiome = new BiomeGenStorage();
|
||||||
|
Biome.registerBiome( config.storageBiomeID, "appliedenergistics2:storage_biome", this.storageBiome );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( config.storageProviderID != -1 )
|
if( config.storageProviderID != -1 )
|
||||||
|
|
|
@ -63,10 +63,21 @@ public class CachedPlane
|
||||||
private final LinkedList<WorldCoord> updates = new LinkedList<WorldCoord>();
|
private final LinkedList<WorldCoord> updates = new LinkedList<WorldCoord>();
|
||||||
private final IBlockDefinition matrixFrame = AEApi.instance().definitions().blocks().matrixFrame();
|
private final IBlockDefinition matrixFrame = AEApi.instance().definitions().blocks().matrixFrame();
|
||||||
private int verticalBits;
|
private int verticalBits;
|
||||||
|
private final IBlockState matrixBlockState;
|
||||||
|
|
||||||
public CachedPlane( final World w, final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ )
|
public CachedPlane( final World w, final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Block matrixFrameBlock = AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().orElse( null );
|
||||||
|
if( matrixFrameBlock != null )
|
||||||
|
{
|
||||||
|
this.matrixBlockState = matrixFrameBlock.getDefaultState();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.matrixBlockState = null;
|
||||||
|
}
|
||||||
|
|
||||||
this.world = w;
|
this.world = w;
|
||||||
|
|
||||||
this.x_size = maxX - minX + 1;
|
this.x_size = maxX - minX + 1;
|
||||||
|
@ -403,13 +414,10 @@ public class CachedPlane
|
||||||
|
|
||||||
private void setBlockIDWithMetadata( final int y, final Object[] blk )
|
private void setBlockIDWithMetadata( final int y, final Object[] blk )
|
||||||
{
|
{
|
||||||
CachedPlane.this.matrixFrame.maybeBlock().ifPresent( matrixFrameBlock ->
|
if( blk[0] == matrixBlockState )
|
||||||
{
|
{
|
||||||
if( blk[0] == matrixFrameBlock )
|
blk[0] = Platform.AIR_BLOCK.getDefaultState();
|
||||||
{
|
}
|
||||||
blk[0] = Platform.AIR_BLOCK;
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
final ExtendedBlockStorage extendedBlockStorage = this.storage[y >> 4];
|
final ExtendedBlockStorage extendedBlockStorage = this.storage[y >> 4];
|
||||||
extendedBlockStorage.set( this.x, y & 15, this.z, (IBlockState) blk[0] );
|
extendedBlockStorage.set( this.x, y & 15, this.z, (IBlockState) blk[0] );
|
||||||
|
|
|
@ -22,33 +22,20 @@ package appeng.spatial;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EnumCreatureType;
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.gen.ChunkProviderOverworld;
|
import net.minecraft.world.gen.ChunkProviderOverworld;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AppEng;
|
||||||
|
|
||||||
|
|
||||||
public class StorageChunkProvider extends ChunkProviderOverworld
|
public class StorageChunkProvider extends ChunkProviderOverworld
|
||||||
{
|
{
|
||||||
private static final int SQUARE_CHUNK_SIZE = 256;
|
|
||||||
private static final Block[] BLOCKS;
|
|
||||||
|
|
||||||
static
|
|
||||||
{
|
|
||||||
BLOCKS = new Block[255 * SQUARE_CHUNK_SIZE];
|
|
||||||
|
|
||||||
AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().ifPresent( matrixFrameBlock -> {
|
|
||||||
for( int x = 0; x < BLOCKS.length; x++ )
|
|
||||||
{
|
|
||||||
BLOCKS[x] = matrixFrameBlock;
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
private final World world;
|
private final World world;
|
||||||
|
|
||||||
|
@ -64,13 +51,18 @@ public class StorageChunkProvider extends ChunkProviderOverworld
|
||||||
final Chunk chunk = new Chunk( this.world, x, z );
|
final Chunk chunk = new Chunk( this.world, x, z );
|
||||||
|
|
||||||
final byte[] biomes = chunk.getBiomeArray();
|
final byte[] biomes = chunk.getBiomeArray();
|
||||||
final AEConfig config = AEConfig.instance;
|
Biome biome = AppEng.instance().getRegistration().getStorageBiome();
|
||||||
|
byte biomeId = (byte) Biome.getIdForBiome(biome);
|
||||||
|
|
||||||
for( int k = 0; k < biomes.length; ++k )
|
for( int k = 0; k < biomes.length; ++k )
|
||||||
{
|
{
|
||||||
biomes[k] = (byte) config.storageBiomeID;
|
biomes[k] = biomeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AEApi.instance().definitions().blocks().matrixFrame().maybeBlock().ifPresent( block -> fillChunk( chunk, block.getDefaultState() ) );
|
||||||
|
|
||||||
|
chunk.setModified( false );
|
||||||
|
|
||||||
if( !chunk.isTerrainPopulated() )
|
if( !chunk.isTerrainPopulated() )
|
||||||
{
|
{
|
||||||
chunk.setTerrainPopulated( true );
|
chunk.setTerrainPopulated( true );
|
||||||
|
@ -80,6 +72,20 @@ public class StorageChunkProvider extends ChunkProviderOverworld
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fillChunk( Chunk chunk, IBlockState defaultState )
|
||||||
|
{
|
||||||
|
for( int cx = 0; cx < 16; cx++ )
|
||||||
|
{
|
||||||
|
for( int cz = 0; cz < 16; cz++ )
|
||||||
|
{
|
||||||
|
for( int cy = 0; cy < 256; cy++ )
|
||||||
|
{
|
||||||
|
chunk.setBlockState( new BlockPos( cx, cy, cz ), defaultState );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populate( final int par2, final int par3 )
|
public void populate( final int par2, final int par3 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.DimensionType;
|
import net.minecraft.world.DimensionType;
|
||||||
import net.minecraft.world.WorldProvider;
|
import net.minecraft.world.WorldProvider;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.BiomeProviderSingle;
|
import net.minecraft.world.biome.BiomeProviderSingle;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.IChunkGenerator;
|
import net.minecraft.world.chunk.IChunkGenerator;
|
||||||
|
@ -38,10 +39,13 @@ import appeng.core.AppEng;
|
||||||
public class StorageWorldProvider extends WorldProvider
|
public class StorageWorldProvider extends WorldProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private final Biome biome;
|
||||||
|
|
||||||
public StorageWorldProvider()
|
public StorageWorldProvider()
|
||||||
{
|
{
|
||||||
this.hasNoSky = true;
|
this.hasNoSky = true;
|
||||||
this.biomeProvider = new BiomeProviderSingle( AppEng.instance().getRegistration().getStorageBiome() );
|
biome = AppEng.instance().getRegistration().getStorageBiome();
|
||||||
|
this.biomeProvider = new BiomeProviderSingle( biome );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -147,4 +151,11 @@ public class StorageWorldProvider extends WorldProvider
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Biome getBiomeForCoords( BlockPos pos )
|
||||||
|
{
|
||||||
|
return biome;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue