X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=Automap%2FHelpers.cs;h=c21740794eac08895be572d6a4b27597083a3951;hb=8c8cf97e48592b57cde243555596fe3904091568;hp=47033791c91cb3b5757f2d8b029d9acc214f0511;hpb=4fca7aba2426bdd581d5a154fd85deeb81d57e1b;p=automap%2Fautomap.git diff --git a/Automap/Helpers.cs b/Automap/Helpers.cs index 4703379..c217407 100644 --- a/Automap/Helpers.cs +++ b/Automap/Helpers.cs @@ -94,6 +94,12 @@ namespace Automap return whichever; } + public static ushort RainHeight2DMap(this IMapChunk mapChunk, int x, int y, int chunkSize = 32) + { + //int num = posZ % this.chunksize * this.chunksize + posX % this.chunksize; + int index = (y % chunkSize) * chunkSize + (x % chunkSize); + return mapChunk.RainHeightMap[index]; + } /// @@ -110,7 +116,7 @@ namespace Automap { #if DEBUG - CoreApi.World.Logger.VerboseDebug(" World Blocks [Count: {0}]", CoreApi.World.Blocks.Count); + //CoreApi.World.Logger.VerboseDebug(" World Blocks [Count: {0}]", CoreApi.World.Blocks.Count); #endif //If Brute force won't work; use GROOT FORCE! //var theBlock = ClientApi.World.BlockAccessor.GetBlock(0); @@ -153,35 +159,24 @@ namespace Automap } #if DEBUG - CoreApi.World.Logger.VerboseDebug("Block gaps: {0}", emptyCount); + //CoreApi.World.Logger.VerboseDebug("Block gaps: {0}", emptyCount); #endif } return arbBlockIDTable; } + public static Mod Self(this ICoreClientAPI ownApi) + { + AutomapMod ownMod = ownApi.ModLoader.GetModSystem( ); + return ownMod.Mod; + } - /// - /// Chunk local index. Not block position! - /// - /// Clamps to 5 bit ranges automagically - public static int ChunkBlockIndicie16(int X_index, int Y_index, int Z_index) - { - return ((Y_index & 31) * 32 + (Z_index & 31)) * 32 + (X_index & 31); - } - - /// - /// Chunk index converted from block position (in world) - /// - /// The block indicie. - /// Block position. - /// Clamps to 5 bit ranges automagically - public static int ChunkBlockIndicie16(BlockPos blockPos) - { - //Chunk masked - return ((blockPos.Y & 31) * 32 + (blockPos.Z & 31)) * 32 + (blockPos.X & 31); - } + public static bool EndsWith(this AssetLocation asset, string domain, string endPath) + { + return asset.Domain.Equals(domain,StringComparison.InvariantCultureIgnoreCase) && asset.Path.EndsWith(endPath, StringComparison.InvariantCultureIgnoreCase); + } } }