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

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

Thread Status:
Not open for further replies.
  1. Offline

    HappyPikachu

    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:
    Code:java
    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. Offline

    desht

  3. Offline

    ZachBora

    Are you trying to light something above the block limit?
     
  4. Offline

    HappyPikachu

    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.
     
  5. Offline

    ZachBora

    Maybe it's trying to light a block below 1?
     
  6. Offline

    HappyPikachu

    ZachBora I've been testing my plugin on the same map since before 1.2. Worked fine then.
     
  7. Offline

    desht

    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.
     
  8. Offline

    HappyPikachu

    Using /chess create board b1 gives me an error: resource file 'standard' is not readable
     
  9. Offline

    NuclearW

    HappyPikachu

    As I understand it the client now does its own light calculations as of this.
     
    desht and HappyPikachu like this.
  10. Offline

    ZachBora

    desht is probably still on 1.1 and HappyPikachu is on 1.2 ^^
     
  11. Offline

    desht

    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)
     
  12. Offline

    desht

    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.
  13. Offline

    HappyPikachu

    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!
     
Thread Status:
Not open for further replies.

Share This Page