Allow some players to see "better" at Night, is it possible ?

Discussion in 'Plugin Development' started by TrainYourBrain, May 7, 2011.

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

    eleljrk

    Just hough you might like another idea as well;
    Change the far-normal-short-tiny distance.. (If possible)

    Normal Players: Normal distance during day, tiny during night.
    Vampires: Short distance during day, far distance during night.

    I'm quite sure this isn't possible, but would be awesome if it where.
     
  2. Offline

    nickguletskii

    You need to send a chunk object, so the pseudo world is involved. :)
     
  3. Offline

    Alex Nolan

    @nickguletskii
    Hmm, I can't seem to get it to work, the error is no such field "r".
    Then when I tried my own derivation of that:
    Code:
    String s = wor.worldData.name;
    IDataManager idm = wor.p();
    long i = wor.q().b();
    WorldProvider wp = wor.worldProvider;
    World psuedo = new World(idm, s, i, wp);
    It encounters a strange error: [​IMG]
     
  4. Offline

    nickguletskii

    Are you using the latest build? I think I checked the fields to be named like in the latest sourcecode...
     
  5. Offline

    Alex Nolan

    Yep, using Craftbukkit version git-Bukkit-0.0.0-734-gaa4a5c8-b780-jnks

    It's strange, I see the r field here:https://github.com/Bukkit/CraftBukkit/blob/master/src/main/java/net/minecraft/server/World.java but not here:http://javadoc.lukegb.com/Bukkit/d1/dd5/CraftBukkit_2src_2main_2java_2net_2minecraft_2server_2World_8java_source.html



    Edit:
    So my method created a new world, but according to the error, when it is passed to chunk it wants it to be a world server:
    Code:
    public Chunk(World world, int i, int j) {
            this.tileEntities = new HashMap();
            this.entitySlices = new List[8];
            this.done = false;
            this.o = false;
            this.q = false;
            this.r = 0L;
            this.world = world;
            this.x = i;
            this.z = j;
            this.h = new byte[256];
    
            for (int k = 0; k < this.entitySlices.length; ++k) {
                this.entitySlices[k] = new ArrayList();
            }
    
            // CraftBukkit start
            CraftWorld cw = ((WorldServer) world).getWorld();
            bukkitChunk = (cw == null) ? null : cw.popPreservedChunk( i, j );
            if (bukkitChunk == null) {
                bukkitChunk = new org.bukkit.craftbukkit.CraftChunk( this );
            }
        }
    So it looks like we have to make a new WorldServer, which just by the sound of it seems like it will be inefficient. Maybe a better way to going about doing this could be to extend the Packet51MapChunk, and just use the real world, but modify the data as our own packet takes it, not in a world.
     
  6. Offline

    Zeus1976

    Maybe if it is possible make vampires see living things better if it is possible at all. so humans and mobs have a coloured outline. I dono if this would be possible at all but would give a cool feel to the vampirism
     
  7. Offline

    nickguletskii

    Wow... Didn't think of that! That is probably a better way!
     
  8. Offline

    furekusu

    So, did you got this to work?
     
  9. Offline

    Ne0nx3r0

  10. Offline

    Iron_Crystal

    Wow what a grave digger....
     
  11. Offline

    dsmyth1915

    Yes gravedigger, but it gave me an idea for a torch plugin (miners lighting?)
     
  12. Heres the simple answer. No. Bukkit cannot actually change any of the clients settings and/or render's, aside from potions. Read the sticky explaining what Bukkit can and cant do please :D
     
  13. Offline

    dsmyth1915

    Oh ye of little faith! Anything is possible In the world of code!
     
  14. Offline

    Iron_Crystal

    Actually, as of 1.2.3, the client renders its own lighting, so maybe you can do this with Spout?
     
  15. Offline

    gamerzap

    Works fine for me, without even having to clone the world :/

    Although I'm having trouble getting player's light level to go bak to normal

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
  16. Offline

    Hoolean

    Dude, I'm way ahead of ya! Lanterns
     
Thread Status:
Not open for further replies.

Share This Page