[SOLVED] EnumSkyBlock.BLOCK in 1.2.3-R0.1

Discussion in 'Plugin Development' started by HappyPikachu, Mar 6, 2012.

  1. Is anyone else having a problem with EnumSkyBlock.BLOCK in 1.2.3-R0.1? My plugin TorchLight+ appears to have stopped working, though it worked fine in 1.1-R4...

    Here's a snippet of code:
    1. public static void lightUp(int x, int y, int z, CraftWorld world, Player player) {
    2. int radius = 5;
    3. resetLight(x, y, z, world);
    4. for (int i = -radius; i <= radius; i++) {
    5. for (int j = -radius; j <= radius; j++) {
    6. for (int k = -radius; k <= radius; k++) {
    7. int oldLevel = world.getHandle().getLightLevel(x + i, y + j, z + k);
    8. int newLevel = 15 - (Math.abs(i) + Math.abs(j) + Math.abs(k));
    9. if (newLevel > oldLevel) {
    10. world.getHandle().a(EnumSkyBlock.BLOCK, x + i, y + j, z + k, newLevel);
    11. }
    12. }
    13. }
    14. }
    15. }
  2. Are you trying to light something above the block limit?
  3. No light appears whatsoever. I threw a line above EnumSkyBlock that outputs to the console, so it does reach that part of the code... but nothing happens.

    Nope, in fact I'm testing on a Superflat map. Couldn't be closer to bedrock lol.
  4. Maybe it's trying to light a block below 1?
  5. ZachBora I've been testing my plugin on the same map since before 1.2. Worked fine then.
  6. Out of interest you could try this dev build of ChessCraft on your 1.2.3-R0.1 server: http://dl.dropbox.com/u/12467600/ChessCraft-dev.jar

    Since I know it works on my dev server, if it works on your server, it points to something in your code. If it doesn't, it points to something about your server or world setup. With the plugin loaded, do /chess create board b1 (in an isolated spot - blocks will be overwritten!) and see if the lighting over the board remains (roughly) at full brightness regardless of time of day or blocks covering the board.
  7. Using /chess create board b1 gives me an error: resource file 'standard' is not readable
  8. HappyPikachu

    As I understand it the client now does its own light calculations as of this.
    desht and HappyPikachu like this.
  9. desht is probably still on 1.1 and HappyPikachu is on 1.2 ^^
  10. Nope, my working (development) version of ChessCraft is built against and running on 1.2.3-R0.1.

    (I started a private conversation with HappyPikachu about the board creation error he's getting)
  11. I'm pretty sure (but haven't confirmed 100%) that this is happening because lighting data is now sent along with map chunk data in packet 51: see http://wiki.vg/Protocol#Map_Chunks_.280x33.29

    In other words, just using the World.a() method with EnumSkyBlock alone isn't enough any more; any affected chunks also need to be resent to any nearby players. I do this for ChessCraft in https://github.com/desht/ChessCraft.../java/me/desht/chesscraft/regions/Cuboid.java (see sendClientChanges() and queueChunks()).

    I don't send packets directly, but instead update the chunkCoordIntPairQueue field of any nearby EntityPlayer objects - this lets the server send the packets in its own time instead of all at once, which would be asking for lag. I also take care not to queue up chunks that are already in the player's queue. (Thanks bergerkiller for showing me this concept :) )

    I was only resending map chunks in ChessCraft pre-1.2 because I'm doing block and lighting changes at the same time - which probably explains why ChessCraft mysteriously continued to work in 1.2 and TorchLight+ didn't!
    HappyPikachu and mushroomhostage like this.
  12. Looks like desht has the fix, so I'm marking this as 'Solved'. Big thanks to him - I'll be updating my plugin asap! Also, thanks NuclearW for steering this in the right direction!

Share This Page