2230 {
2232 int num = 0;
2233 for (
int i = yStart;
i < yStart + height;
i++)
2234 {
2235 for (int j = xStart; j < xStart + width; j++)
2236 {
2237 if (num != 0)
2238 {
2239 num--;
2240 if (Main.tile[j, i] == null)
2241 {
2242 Main.tile[j,
i] =
new Tile(tile);
2243 }
2244 else
2245 {
2246 Main.tile[j,
i].CopyFrom(tile);
2247 }
2248 continue;
2249 }
2250 byte b2;
2251 byte b;
2252 byte b3 = (b2 = (b = 0));
2253 tile = Main.tile[j,
i];
2254 if (tile == null)
2255 {
2257 Main.tile[j,
i] = tile;
2258 }
2259 else
2260 {
2261 tile.ClearEverything();
2262 }
2264 bool flag = false;
2265 if ((b4 & 1) == 1)
2266 {
2267 flag = true;
2269 }
2270 bool flag2 = false;
2271 if (flag && (b3 & 1) == 1)
2272 {
2273 flag2 = true;
2275 }
2276 if (flag2 && (b2 & 1) == 1)
2277 {
2279 }
2280 bool flag3 = tile.active();
2281 byte b5;
2282 if ((b4 & 2) == 2)
2283 {
2284 tile.active(active: true);
2285 ushort
type = tile.type;
2286 int num2;
2287 if ((b4 & 0x20) == 32)
2288 {
2291 num2 = (num2 << 8) | b5;
2292 }
2293 else
2294 {
2296 }
2297 tile.type = (ushort)num2;
2298 if (Main.tileFrameImportant[num2])
2299 {
2302 }
2303 else if (!flag3 || tile.type !=
type)
2304 {
2305 tile.frameX = -1;
2306 tile.frameY = -1;
2307 }
2308 if ((b2 & 8) == 8)
2309 {
2311 }
2312 }
2313 if ((b4 & 4) == 4)
2314 {
2316 if ((b2 & 0x10) == 16)
2317 {
2319 }
2320 }
2321 b5 = (byte)((b4 & 0x18) >> 3);
2322 if (b5 != 0)
2323 {
2325 if ((b2 & 0x80) == 128)
2326 {
2327 tile.shimmer(shimmer: true);
2328 }
2329 else if (b5 > 1)
2330 {
2331 if (b5 == 2)
2332 {
2333 tile.lava(lava: true);
2334 }
2335 else
2336 {
2337 tile.honey(honey: true);
2338 }
2339 }
2340 }
2341 if (b3 > 1)
2342 {
2343 if ((b3 & 2) == 2)
2344 {
2345 tile.wire(wire: true);
2346 }
2347 if ((b3 & 4) == 4)
2348 {
2349 tile.wire2(wire2: true);
2350 }
2351 if ((b3 & 8) == 8)
2352 {
2353 tile.wire3(wire3: true);
2354 }
2355 b5 = (byte)((b3 & 0x70) >> 4);
2356 if (b5 != 0 && Main.tileSolid[tile.type])
2357 {
2358 if (b5 == 1)
2359 {
2360 tile.halfBrick(halfBrick: true);
2361 }
2362 else
2363 {
2364 tile.slope((byte)(b5 - 1));
2365 }
2366 }
2367 }
2368 if (b2 > 1)
2369 {
2370 if ((b2 & 2) == 2)
2371 {
2372 tile.actuator(actuator: true);
2373 }
2374 if ((b2 & 4) == 4)
2375 {
2376 tile.inActive(inActive: true);
2377 }
2378 if ((b2 & 0x20) == 32)
2379 {
2380 tile.wire4(wire4: true);
2381 }
2382 if ((b2 & 0x40) == 64)
2383 {
2385 tile.wall = (ushort)((b5 << 8) | tile.wall);
2386 }
2387 }
2388 if (b > 1)
2389 {
2390 if ((b & 2) == 2)
2391 {
2392 tile.invisibleBlock(invisibleBlock: true);
2393 }
2394 if ((b & 4) == 4)
2395 {
2396 tile.invisibleWall(invisibleWall: true);
2397 }
2398 if ((b & 8) == 8)
2399 {
2400 tile.fullbrightBlock(fullbrightBlock: true);
2401 }
2402 if ((b & 0x10) == 16)
2403 {
2404 tile.fullbrightWall(fullbrightWall: true);
2405 }
2406 }
2407 num = (byte)((b4 & 0xC0) >> 6) switch
2408 {
2409 0 => 0,
2412 };
2413 }
2414 }
2416 for (int k = 0; k < num3; k++)
2417 {
2422 if (num4 >= 0 && num4 < 8000)
2423 {
2424 if (Main.chest[num4] == null)
2425 {
2426 Main.chest[num4] = new Chest();
2427 }
2428 Main.chest[num4].name =
name;
2429 Main.chest[num4].x = x;
2430 Main.chest[num4].y = y;
2431 }
2432 }
2434 for (int l = 0; l < num3; l++)
2435 {
2440 if (num5 >= 0 && num5 < 1000)
2441 {
2442 if (Main.sign[num5] == null)
2443 {
2444 Main.sign[num5] =
new Sign();
2445 }
2446 Main.sign[num5].text =
text;
2447 Main.sign[num5].x = x2;
2448 Main.sign[num5].y = y2;
2449 }
2450 }
2452 for (int m = 0; m < num3; m++)
2453 {
2457 }
2458 Main.sectionManager.SetTilesLoaded(xStart, yStart, xStart + width - 1, yStart + height - 1);
2459 }
virtual string ReadString()
virtual short ReadInt16()
static Dictionary< int, TileEntity > ByID
static Dictionary< Point16, TileEntity > ByPosition
static TileEntity Read(BinaryReader reader, bool networkSend=false)