OSDN Git Service

Fixes for some post *.4 issues
[automap/automap.git] / Automap / Helpers.cs
index 4703379..c217407 100644 (file)
@@ -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];
+               }
 
 
         /// <summary>
@@ -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<AutomapMod>( );
+               return ownMod.Mod;
+               }
 
 
-        /// <summary>
-        /// Chunk local index. Not block position!
-        /// </summary>
-        /// <remarks>Clamps to 5 bit ranges automagically</remarks>
-        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);
-        }
-
-        /// <summary>
-        /// Chunk index converted from block position (in world)
-        /// </summary>
-        /// <returns>The block indicie.</returns>
-        /// <param name="blockPos">Block position.</param>
-        /// <remarks>Clamps to 5 bit ranges automagically</remarks>
-        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);
+               }
     }
 }