Switch to a serious name I like
This commit is contained in:
parent
22b944a189
commit
0bb3541d23
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace TrueCraft.API.World
|
||||
{
|
||||
public interface IChunk : IEventSubject, IDisposable, ApplesauceChunk
|
||||
public interface IChunk : IEventSubject, IDisposable, ISpatialBlockInformationProvider
|
||||
{
|
||||
bool IsModified { get; set; }
|
||||
bool LightPopulated { get; set; }
|
||||
|
@ -11,6 +11,6 @@ namespace TrueCraft.API.World
|
||||
/// </summary>
|
||||
public interface IChunkDecorator
|
||||
{
|
||||
void Decorate(IWorldSeed world, ApplesauceChunk chunk, IBiomeRepository biomes, IBlockRepository blockRepository);
|
||||
void Decorate(IWorldSeed world, ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, IBlockRepository blockRepository);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,6 @@ namespace TrueCraft.API.World
|
||||
public interface IDecoration
|
||||
{
|
||||
bool ValidLocation(Coordinates3D location);
|
||||
bool GenerateAt(IWorldSeed world, ApplesauceChunk chunk, Coordinates3D location);
|
||||
bool GenerateAt(IWorldSeed world, ISpatialBlockInformationProvider chunk, Coordinates3D location);
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace TrueCraft.API.World
|
||||
{
|
||||
public interface ApplesauceChunk
|
||||
public interface ISpatialBlockInformationProvider
|
||||
{
|
||||
int X {get;}
|
||||
int Z { get; }
|
@ -22,7 +22,7 @@ namespace TrueCraft.Core.Test.World
|
||||
public void DecoratorGrowsNoInvalidSugarCane()
|
||||
{
|
||||
var aWorld = new WorldWithJustASeed(9001);
|
||||
ApplesauceChunk aChunk = new PrimeSugarCaneGrowingSeasonChunk();
|
||||
ISpatialBlockInformationProvider aChunk = new PrimeSugarCaneGrowingSeasonChunk();
|
||||
IBiomeRepository aBiomeRepository = new BiomeRepository();
|
||||
var decorator = GetDecoratorForTestChunk(aWorld, aChunk, aBiomeRepository);
|
||||
|
||||
@ -35,7 +35,7 @@ namespace TrueCraft.Core.Test.World
|
||||
public void DecoratorDoesNotGrowSugarcaneUniformly()
|
||||
{
|
||||
IWorldSeed aWorld = new WorldWithJustASeed(9001);
|
||||
ApplesauceChunk aChunk = new PrimeSugarCaneGrowingSeasonChunk();
|
||||
ISpatialBlockInformationProvider aChunk = new PrimeSugarCaneGrowingSeasonChunk();
|
||||
IBiomeRepository aBiomeRepository = new BiomeRepository();
|
||||
var decorator = GetDecoratorForTestChunk(aWorld, aChunk, aBiomeRepository);
|
||||
|
||||
@ -44,7 +44,7 @@ namespace TrueCraft.Core.Test.World
|
||||
AssertChunkSugarCaneGrowthIsNotUniform(aChunk);
|
||||
}
|
||||
|
||||
private void AssertChunkHasNoSugarCaneInColumnsWhereItShouldNot(ApplesauceChunk aChunk)
|
||||
private void AssertChunkHasNoSugarCaneInColumnsWhereItShouldNot(ISpatialBlockInformationProvider aChunk)
|
||||
{
|
||||
for (int x = 0; x < 6; x++)
|
||||
{
|
||||
@ -59,7 +59,7 @@ namespace TrueCraft.Core.Test.World
|
||||
}
|
||||
}
|
||||
|
||||
private void AssertChunkSugarCaneGrowthIsNotUniform(ApplesauceChunk aChunk)
|
||||
private void AssertChunkSugarCaneGrowthIsNotUniform(ISpatialBlockInformationProvider aChunk)
|
||||
{
|
||||
var counts = new List<double>();
|
||||
for (int x = 0; x < 6; x++)
|
||||
@ -82,7 +82,7 @@ namespace TrueCraft.Core.Test.World
|
||||
}
|
||||
}
|
||||
|
||||
private static SugarCaneDecorator GetDecoratorForTestChunk(IWorldSeed aWorld, ApplesauceChunk aChunk,
|
||||
private static SugarCaneDecorator GetDecoratorForTestChunk(IWorldSeed aWorld, ISpatialBlockInformationProvider aChunk,
|
||||
IBiomeRepository aBiomeRepository)
|
||||
{
|
||||
var decorator = new SugarCaneDecorator(new NoiseAlwaysGrowsSugarCaneInTestBounds());
|
||||
@ -90,7 +90,7 @@ namespace TrueCraft.Core.Test.World
|
||||
return decorator;
|
||||
}
|
||||
|
||||
static int CountBlockInColumn(ApplesauceChunk aChunk, int x, int z, byte blockId)
|
||||
static int CountBlockInColumn(ISpatialBlockInformationProvider aChunk, int x, int z, byte blockId)
|
||||
{
|
||||
int counter = 0;
|
||||
|
||||
@ -113,7 +113,7 @@ namespace TrueCraft.Core.Test.World
|
||||
|
||||
var ourDictionary = PrimeSugarCaneGrowingSeasonChunk.createStartingBlockDictionary();
|
||||
|
||||
Mock<ApplesauceChunk> aChunk = new Mock<ApplesauceChunk>();
|
||||
Mock<ISpatialBlockInformationProvider> aChunk = new Mock<ISpatialBlockInformationProvider>();
|
||||
|
||||
aChunk.Setup(foo => foo.GetBlockID(It.IsAny<Coordinates3D>())).Returns((Coordinates3D coordinates) =>
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ using TrueCraft.Core.Logic.Blocks;
|
||||
using TrueCraft.Core.TerrainGen.Biomes;
|
||||
using TrueCraft.Core.World;
|
||||
|
||||
public class PrimeSugarCaneGrowingSeasonChunk : ApplesauceChunk
|
||||
public class PrimeSugarCaneGrowingSeasonChunk : ISpatialBlockInformationProvider
|
||||
{
|
||||
public int X => 6;
|
||||
public int Z => 6;
|
||||
@ -172,7 +172,7 @@ public class PrimeSugarCaneGrowingSeasonChunk : ApplesauceChunk
|
||||
return result;
|
||||
}
|
||||
|
||||
byte ApplesauceChunk.GetMetadata(Coordinates3D locationToCheck)
|
||||
byte ISpatialBlockInformationProvider.GetMetadata(Coordinates3D locationToCheck)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool GenerateAt(IWorldSeed world, ApplesauceChunk chunk, Coordinates3D location)
|
||||
public override bool GenerateAt(IWorldSeed world, ISpatialBlockInformationProvider chunk, Coordinates3D location)
|
||||
{
|
||||
if (!ValidLocation(location))
|
||||
return false;
|
||||
|
@ -25,7 +25,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool GenerateAt(IWorldSeed world, ApplesauceChunk chunk, Coordinates3D location)
|
||||
public override bool GenerateAt(IWorldSeed world, ISpatialBlockInformationProvider chunk, Coordinates3D location)
|
||||
{
|
||||
if (!ValidLocation(location))
|
||||
return false;
|
||||
|
@ -13,7 +13,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
{
|
||||
const int LeafRadius = 2;
|
||||
|
||||
public override bool GenerateAt(IWorldSeed world, ApplesauceChunk chunk, Coordinates3D location)
|
||||
public override bool GenerateAt(IWorldSeed world, ISpatialBlockInformationProvider chunk, Coordinates3D location)
|
||||
{
|
||||
if (!ValidLocation(location))
|
||||
return false;
|
||||
|
@ -12,7 +12,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
{
|
||||
public virtual bool ValidLocation(Coordinates3D location) { return true; }
|
||||
|
||||
public abstract bool GenerateAt(IWorldSeed world, ApplesauceChunk chunk, Coordinates3D location);
|
||||
public abstract bool GenerateAt(IWorldSeed world, ISpatialBlockInformationProvider chunk, Coordinates3D location);
|
||||
|
||||
public static bool IsCuboidWall(Coordinates2D location, Coordinates3D start, Vector3 size)
|
||||
{
|
||||
@ -30,7 +30,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
|| location.X.Equals(start.X + (int)size.X - 1) && location.Z.Equals(start.Z + (int)size.Z - 1);
|
||||
}
|
||||
|
||||
public static bool NeighboursBlock(ApplesauceChunk chunk, Coordinates3D location, byte block, byte meta = 0x0)
|
||||
public static bool NeighboursBlock(ISpatialBlockInformationProvider chunk, Coordinates3D location, byte block, byte meta = 0x0)
|
||||
{
|
||||
var surrounding = new[] {
|
||||
location + Coordinates3D.Left,
|
||||
@ -53,7 +53,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void GenerateColumn(ApplesauceChunk chunk, Coordinates3D location, int height, byte block, byte meta = 0x0)
|
||||
public static void GenerateColumn(ISpatialBlockInformationProvider chunk, Coordinates3D location, int height, byte block, byte meta = 0x0)
|
||||
{
|
||||
for (int offset = 0; offset < height; offset++)
|
||||
{
|
||||
@ -71,7 +71,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
* 0x1 - Hollow cuboid of the specified block
|
||||
* 0x2 - Outlines the area of the cuboid using the specified block
|
||||
*/
|
||||
public static void GenerateCuboid(ApplesauceChunk chunk, Coordinates3D location, Vector3 size, byte block, byte meta = 0x0, byte mode = 0x0)
|
||||
public static void GenerateCuboid(ISpatialBlockInformationProvider chunk, Coordinates3D location, Vector3 size, byte block, byte meta = 0x0, byte mode = 0x0)
|
||||
{
|
||||
//If mode is 0x2 offset the size by 2 and change mode to 0x1
|
||||
if (mode.Equals(0x2))
|
||||
@ -102,7 +102,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
}
|
||||
}
|
||||
|
||||
protected void GenerateVanillaLeaves(ApplesauceChunk chunk, Coordinates3D location, int radius, byte block, byte meta = 0x0)
|
||||
protected void GenerateVanillaLeaves(ISpatialBlockInformationProvider chunk, Coordinates3D location, int radius, byte block, byte meta = 0x0)
|
||||
{
|
||||
int radiusOffset = radius;
|
||||
for (int yOffset = -radius; yOffset <= radius; yOffset = (yOffset + 1))
|
||||
@ -116,7 +116,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
}
|
||||
}
|
||||
|
||||
protected void GenerateVanillaCircle(ApplesauceChunk chunk, Coordinates3D location, int radius, byte block, byte meta = 0x0, double corner = 0)
|
||||
protected void GenerateVanillaCircle(ISpatialBlockInformationProvider chunk, Coordinates3D location, int radius, byte block, byte meta = 0x0, double corner = 0)
|
||||
{
|
||||
for (int i = -radius; i <= radius; i = (i + 1))
|
||||
{
|
||||
@ -146,7 +146,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
}
|
||||
}
|
||||
|
||||
protected void GenerateCircle(ApplesauceChunk chunk, Coordinates3D location, int radius, byte block, byte meta = 0x0)
|
||||
protected void GenerateCircle(ISpatialBlockInformationProvider chunk, Coordinates3D location, int radius, byte block, byte meta = 0x0)
|
||||
{
|
||||
for (int i = -radius; i <= radius; i = (i + 1))
|
||||
{
|
||||
@ -172,7 +172,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
}
|
||||
}
|
||||
|
||||
protected static void GenerateSphere(ApplesauceChunk chunk, Coordinates3D location, int radius, byte block, byte meta = 0x0)
|
||||
protected static void GenerateSphere(ISpatialBlockInformationProvider chunk, Coordinates3D location, int radius, byte block, byte meta = 0x0)
|
||||
{
|
||||
for (int i = -radius; i <= radius; i = (i + 1))
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool GenerateAt(IWorldSeed world, ApplesauceChunk chunk, Coordinates3D location)
|
||||
public override bool GenerateAt(IWorldSeed world, ISpatialBlockInformationProvider chunk, Coordinates3D location)
|
||||
{
|
||||
Console.WriteLine("Dungeon in chunk {0}", chunk.Coordinates);
|
||||
if (!ValidLocation(location))
|
||||
@ -52,7 +52,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreateEntraces(ApplesauceChunk chunk, Coordinates3D location, Random random)
|
||||
private void CreateEntraces(ISpatialBlockInformationProvider chunk, Coordinates3D location, Random random)
|
||||
{
|
||||
int entrances = 0;
|
||||
var above = location + Coordinates3D.Up;
|
||||
@ -80,7 +80,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
}
|
||||
}
|
||||
|
||||
private void MossFloor(ApplesauceChunk chunk, Coordinates3D location, Random random)
|
||||
private void MossFloor(ISpatialBlockInformationProvider chunk, Coordinates3D location, Random random)
|
||||
{
|
||||
for (int x = location.X; x < location.X + Size.X; x++)
|
||||
{
|
||||
@ -96,7 +96,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaceChests(ApplesauceChunk chunk, Coordinates3D location, Random random)
|
||||
private void PlaceChests(ISpatialBlockInformationProvider chunk, Coordinates3D location, Random random)
|
||||
{
|
||||
var above = location + Coordinates3D.Up;
|
||||
var chests = random.Next(0, 2);
|
||||
|
@ -23,7 +23,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool GenerateAt(IWorldSeed world, ApplesauceChunk chunk, Coordinates3D location)
|
||||
public override bool GenerateAt(IWorldSeed world, ISpatialBlockInformationProvider chunk, Coordinates3D location)
|
||||
{
|
||||
if (!ValidLocation(location))
|
||||
return false;
|
||||
|
@ -23,7 +23,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool GenerateAt(IWorldSeed world, ApplesauceChunk chunk, Coordinates3D location)
|
||||
public override bool GenerateAt(IWorldSeed world, ISpatialBlockInformationProvider chunk, Coordinates3D location)
|
||||
{
|
||||
if (!ValidLocation(location))
|
||||
return false;
|
||||
@ -51,7 +51,7 @@ namespace TrueCraft.Core.TerrainGen.Decorations
|
||||
* 0x0 - two level topper
|
||||
* 0x1 - three level topper
|
||||
*/
|
||||
protected void GenerateTopper(ApplesauceChunk chunk, Coordinates3D location, byte type = 0x0)
|
||||
protected void GenerateTopper(ISpatialBlockInformationProvider chunk, Coordinates3D location, byte type = 0x0)
|
||||
{
|
||||
const int sectionRadius = 1;
|
||||
GenerateCircle(chunk, location, sectionRadius, LeavesBlock.BlockID, 0x1);
|
||||
|
@ -14,7 +14,7 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
{
|
||||
public class CactusDecorator : IChunkDecorator
|
||||
{
|
||||
public void Decorate(IWorldSeed world, ApplesauceChunk chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
public void Decorate(IWorldSeed world, ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
{
|
||||
var noise = new Perlin(world.Seed);
|
||||
var chanceNoise = new ClampNoise(noise);
|
||||
|
@ -21,7 +21,7 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
this.BaseLevel = groundLevel;
|
||||
}
|
||||
|
||||
public void Decorate(IWorldSeed world, ApplesauceChunk chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
public void Decorate(IWorldSeed world, ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
{
|
||||
for (int attempts = 0; attempts < 8; attempts++)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
{
|
||||
class FreezeDecorator : IChunkDecorator
|
||||
{
|
||||
public void Decorate(IWorldSeed world, ApplesauceChunk chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
public void Decorate(IWorldSeed world, ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
{
|
||||
for (int x = 0; x < 16; x++)
|
||||
{
|
||||
@ -51,7 +51,7 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
}
|
||||
}
|
||||
|
||||
bool CoverIce(ApplesauceChunk chunk, IBiomeRepository biomes, Coordinates3D location)
|
||||
bool CoverIce(ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, Coordinates3D location)
|
||||
{
|
||||
const int maxDistance = 4;
|
||||
var adjacent = new[] {
|
||||
|
@ -15,7 +15,7 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
{
|
||||
public static readonly int WaterLevel = 40;
|
||||
|
||||
public void Decorate(IWorldSeed world, ApplesauceChunk chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
public void Decorate(IWorldSeed world, ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
{
|
||||
for (int x = 0; x < Chunk.Width; x++)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
Ores.Add(redstone);
|
||||
}
|
||||
|
||||
public void Decorate(IWorldSeed world, ApplesauceChunk chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
public void Decorate(IWorldSeed world, ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
{
|
||||
var perlin = new Perlin(world.Seed);
|
||||
perlin.Lacunarity = 1;
|
||||
|
@ -13,7 +13,7 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
{
|
||||
public class PlantDecorator : IChunkDecorator
|
||||
{
|
||||
public void Decorate(IWorldSeed world, ApplesauceChunk chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
public void Decorate(IWorldSeed world, ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
{
|
||||
var noise = new Perlin(world.Seed);
|
||||
var chanceNoise = new ClampNoise(noise);
|
||||
@ -68,23 +68,23 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateRose(ApplesauceChunk chunk, Coordinates3D location)
|
||||
void GenerateRose(ISpatialBlockInformationProvider chunk, Coordinates3D location)
|
||||
{
|
||||
chunk.SetBlockID(location, RoseBlock.BlockID);
|
||||
}
|
||||
|
||||
void GenerateDandelion(ApplesauceChunk chunk, Coordinates3D location)
|
||||
void GenerateDandelion(ISpatialBlockInformationProvider chunk, Coordinates3D location)
|
||||
{
|
||||
chunk.SetBlockID(location, DandelionBlock.BlockID);
|
||||
}
|
||||
|
||||
void GenerateTallGrass(ApplesauceChunk chunk, Coordinates3D location, byte meta)
|
||||
void GenerateTallGrass(ISpatialBlockInformationProvider chunk, Coordinates3D location, byte meta)
|
||||
{
|
||||
chunk.SetBlockID(location, TallGrassBlock.BlockID);
|
||||
chunk.SetMetadata(location, meta);
|
||||
}
|
||||
|
||||
void GenerateDeadBush(ApplesauceChunk chunk, Coordinates3D location)
|
||||
void GenerateDeadBush(ISpatialBlockInformationProvider chunk, Coordinates3D location)
|
||||
{
|
||||
chunk.SetBlockID(location, DeadBushBlock.BlockID);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
{
|
||||
suppliedNoise = suppliedNoiseSource;
|
||||
}
|
||||
public void Decorate(IWorldSeed world, ApplesauceChunk chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
public void Decorate(IWorldSeed world, ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
{
|
||||
NoiseGen noise;
|
||||
if (suppliedNoise == null)
|
||||
|
@ -17,7 +17,7 @@ namespace TrueCraft.Core.TerrainGen.Decorators
|
||||
public Perlin Noise { get; set; }
|
||||
public ClampNoise ChanceNoise { get; set; }
|
||||
|
||||
public void Decorate(IWorldSeed world, ApplesauceChunk chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
public void Decorate(IWorldSeed world, ISpatialBlockInformationProvider chunk, IBiomeRepository biomes, IBlockRepository blockRepository)
|
||||
{
|
||||
Noise = new Perlin(world.Seed);
|
||||
ChanceNoise = new ClampNoise(Noise);
|
||||
|
Reference in New Issue
Block a user