private MeshData getMesh() { Dictionary <string, MeshData> lanternMeshes = null; object obj; if (api.ObjectCache.TryGetValue("blockLanternBlockMeshes", out obj)) { lanternMeshes = obj as Dictionary <string, MeshData>; } else { api.ObjectCache["blockLanternBlockMeshes"] = lanternMeshes = new Dictionary <string, MeshData>(); } MeshData mesh = null; BlockLantern block = api.World.BlockAccessor.GetBlock(pos) as BlockLantern; if (block == null) { return(null); } string orient = block.LastCodePart(); if (lanternMeshes.TryGetValue(material + "-" + lining + "-" + orient, out mesh)) { return(mesh); } return(lanternMeshes[material + "-" + lining + "-" + orient] = block.GenMesh(api as ICoreClientAPI, material, lining)); }
private MeshData getMesh(ITesselatorAPI tesselator) { Dictionary <string, MeshData> lanternMeshes = ObjectCacheUtil.GetOrCreate(Api, "blockLanternBlockMeshes", () => new Dictionary <string, MeshData>()); MeshData mesh = null; BlockLantern block = Api.World.BlockAccessor.GetBlock(Pos) as BlockLantern; if (block == null) { return(null); } string orient = block.LastCodePart(); if (lanternMeshes.TryGetValue(material + "-" + lining + "-" + orient + "-" + glass, out mesh)) { return(mesh); } return(lanternMeshes[material + "-" + lining + "-" + orient + "-" + glass] = block.GenMesh(Api as ICoreClientAPI, material, lining, glass, null, tesselator)); }