internal Block GetBlock(BlockLocation BL) { ChunkSection CS = ChunkParts[MathHelper.RTZ(BL.Y / 16)]; //get the ChunkSection based off the y location int x = BL.X % 16; int z = BL.Z % 16; if (x < 0) { x += 16; } if (z < 0) { z += 16; } int y = BL.Y % 16; return(CS.GetBlock(x, y, z)); }
internal void SetBlock(BlockLocation BL, Material mat, byte meta = 0) { ChunkSection CS = ChunkParts[(int)Math.Floor((double)BL.Y / 16)]; //get the ChunkSection based off the y location int x = BL.X % 16; int z = BL.Z % 16; if (x < 0) { x += 16; } if (z < 0) { z += 16; } int y = BL.Y % 16; CS.SetBlock(x, y, z, mat.ID, meta); }
internal Window(bool isEntity,dynamic EidOrLocation,WindowTypeBase windowType,string name = "") { isEntityWindow = isEntity; if (isEntity) { e = EidOrLocation; } else { BL = EidOrLocation; } WindowType = windowType; if (name == "") { Title = windowType.BaseName; } else { Title = name; } container = new Container(windowType.SlotCount); }
public float GetDistance(BlockLocation L) //TODO Verify this is correct, should it be sqrt or cubed-rt? { BlockLocation Delta = GetOffset(L); return((float)Math.Sqrt(Delta.X * Delta.X + Delta.Y * Delta.Y + Delta.Z * Delta.Z)); }
public BlockLocation GetOffset(BlockLocation L) //Subract primary from secondary to get the offset of the two location (directional distance) { return(new BlockLocation(L.X - X, (byte)(L.Y - Y), L.Z - Z, world)); }
internal Block GetBlock(BlockLocation BL) { Chunk C = chunkManager.GetChunkAt(BL.chunkLocation); //Get the chunk based off the blocks ChunkLocation variable return(C.GetBlock(BL)); }