Increased Map Height (128+) Test Plugin

Discussion in 'Bukkit Discussion' started by DeLux, Nov 29, 2011.

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

    JoneKone

    It would take too much space.. However I have tried this on my Desktop and I have issues with it.. Won't Work.
     
  2. Offline

    croxis

    I was talking to Ninja, sorry I didn't tag it x.x
     
  3. Plugin does not work.
     
  4. Offline

    yepwatermelon

    Thank you :D Probably not going to actually use the plugin until a later more stable version but I'm so glad that someone finally got this out there.
     
  5. Offline

    croxis

    Here is the source code if anyone wants to take a look at it. The big things I noticed is that all the functions are recursive. If I add it to bukkit.yml generate just returns itself over and over until it explodes. I have no idea how it is suppose to work as a drop in though unless bukkit previously loaded getDefaultWorldGenerator for all plugins. I've been playing with setting heightbits = 8 in WorldListener, but that hasn't worked either.
    Code:
    package com.toadwater.tallmappoc;
    
    import java.util.List;
    import java.util.Random;
    
    import org.bukkit.Location;
    import org.bukkit.World;
    import org.bukkit.craftbukkit.CraftWorld;
    import org.bukkit.generator.BlockPopulator;
    import org.bukkit.generator.ChunkGenerator;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class TallMapPOC extends JavaPlugin {
        @Override
        public void onDisable() {}
    
        private final class WorldGenWrapper extends ChunkGenerator {
            @Override
            public byte[] generate(final World world, final Random random, final int x, final int z) {
                final net.minecraft.server.World mcWorld = ((CraftWorld) world).getHandle();
                mcWorld.heightBits = 8;
                return world.getGenerator().generate(world, random, x, z);
            }
    
            @Override
            public boolean canSpawn(final World world, final int x, final int z) {
                return world.getGenerator().canSpawn(world, x, z);
            }
    
            @Override
            public List<BlockPopulator> getDefaultPopulators(final World world) {
                return world.getGenerator().getDefaultPopulators(world);
            }
    
            @Override
            public Location getFixedSpawnLocation(final World world, final Random random) {
                return world.getGenerator().getFixedSpawnLocation(world, random);
            }
        }
    
        private final WorldGenWrapper    wrapper    = new WorldGenWrapper();
    
        @Override
        public ChunkGenerator getDefaultWorldGenerator(final String worldName, final String id) {
            return wrapper;
        }
    
        @Override
        public void onEnable() {}
    }
    
    [/JAVA]
    I also compiled craftbukkit by manually setting World.heightBits = 8; the results were this before spoutcraft crashed

    [​IMG]
     
  6. Offline

    Erik Vikersveen

    That picture looks like you entered a height world without height mod, or entered a normal world with height mod. The height is off.
     
  7. Offline

    croxis

    That was it. I manually installed height mod in vanilla and that rendered the world properly, so Spout isn't quite working as advertised :p

    The Spoutcraft dudes said that, if done right, vanilla clients can connect to 256 worlds, they just can't build past 128.
     
  8. Offline

    Gunpowder

    Omg why aren't you notch? Great work!!!!! :D
     
  9. Offline

    croxis

    For anyone still following this thread here is the sad news I found out.

    Minecraft's protocol sends the world height to the client, however it is a byte so the maximum value is 128. The server can tell clients if the world is shorter, but not taller. Unless there is java voodoo I don't know about it would require a protocol change from mojang to pass taller world heights through the netcode.
     
  10. Offline

    NinjaZidane

    Did it not render right on Spoutcraft?
     
  11. Offline

    croxis

    NinjaZidane, no it didn't, see my post at post 70
     
  12. Offline

    NinjaZidane

    :eek:....hmmm Did you be sure to file a report on Spout's github?
     
  13. Offline

    croxis

    Yar, but the issue is when 256 height is cast to byte to be sent in the login packet it is sent as 0. So the only option I can think of is either define the world height manually is spoutcraft, like servername.com:port;optionalheight, or just assume if height=0 then it is 256.
     
  14. Offline

    Erik Vikersveen

    I'll take it! Whatever works, works. I will offer anything for this merge to work. even set the server capasaty to 256 slots. Or use motd, or damnd even if I have to pulse the whole server on and off in a weird pattern. Or make a deliberet bug in the code so the server almost crashes, then retryes with 256. Anything!
     
    efstajas likes this.
  15. Offline

    Vhab

    I haven't read the whole conversation, but if the issue is fitting the height value in a single byte, that's easy to fix.
    Instead of storing 128, 256, 512, etc. Put 7, 8 or 9, etc.
    As in height = 1 << value; instead of height = value;
     
  16. Offline

    jinS

    wo..wow.. 128...? what's build?
     
  17. Offline

    croxis

    Height is initially defined in code as a byte, but the vanilla protocol is transmitted as its actual value. It would require changing vanilla clients to make it work.
     
  18. Offline

    JoneKone

    I dropped out alittle.. Are you still talking about the server not beeing able to do 256 world.. or vanilla client can't build past 128.. Or vanilla client can't understand 256 height server at all?

    I would like to know If i put a mod in my server and it would be 256 world, then allow vanilla and modded clients to connect and I don't really care if vanilla client ppl cant build past 128, as long as they can walk there. And make their own decision on whether to get the modded version of client or not..

    ALLSO i have noticed a problem with Transport's.. With.. past what ever version 1.3 beta? You can't TP ppl to the skies and drop them from who knows how high! It has been nerffed to you can only tp ppl to 127 so they can fit in the 128 world... I'm hopping this is not a client side thing.. but server side thing..
     
  19. Offline

    croxis

    The issue is that no matter what the server height is, if it is lager than 128 it is transmitted as 0. I've played with the packet code to see if I can't sneak it in as an int, but my experiments with that have also failed.

    Also your plugin probably auto-claps the tp height, so it is probably a plugin thing not server.
     
  20. Offline

    Afforess

    Send the bits. I purposely wrote Spoutcraft to detect and handle values 6-12. Send 7 for 128 height, 8 for 256, etc. ;p
     
  21. Offline

    croxis

    I knew sending in a naughty pull request would get the attention I needed >:D

    Well I got it working as a manual code change. Hopefully someone will be able to do it as a plugin. I'm going to respect the rules and not post the link to my custom build. I will however post the patch needed for craftbukkit to get spoutcraft to work with heighmodded servers. Hopefully this is a fair compromise to the rules.

    src/main/java/net/minecraft/server/NetLoginHandler.java
    Code:
    @@ -105,7 +105,7 @@ public void b(Packet1Login packet1login) {
                     maxPlayers = 60;
                 }
    -            netserverhandler.sendPacket(new Packet1Login("", entityplayer.id, worldserver.getSeed(), entityplayer.itemInWorldManager.a(), (byte) worldserver.worldProvider.dimension, (byte) worldserver.difficulty, (byte) worldserver.height, (byte) maxPlayers));
    +            netserverhandler.sendPacket(new Packet1Login("", entityplayer.id, worldserver.getSeed(), entityplayer.itemInWorldManager.a(), (byte) worldserver.worldProvider.dimension, (byte) worldserver.difficulty, (byte) worldserver.heightBits, (byte) maxPlayers));
                 // CraftBukkit end
    
                 netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
    src/main/java/net/minecraft/server/World.java
    Code:
    @@ -33,7 +33,7 @@
     public class World implements IBlockAccess {
    -    public int heightBits = 7;
    +    public int heightBits = 8;
         public int heightBitsPlusFour;
         public int height;
         public int heightMinusOne;
     
  22. Offline

    Arudinne

    Having an issue with those 2 changes.

    Not sure if its an issue with the lastest version of CB that i pulled from git and compiled.. but when i used this and NoLagg (had to..) and no other plugins.. and tried placing stone.. it did this...

    When I tried to place som stone blocks... some turned into bedrock or lava.

    Other than that and using spoutcraft.. everything else was stock.

    Its running on a centos 6 server with sun java

    [​IMG]

    It spawned me at level 130 BTW.

    more pics of the glitches.:

    [​IMG]

    [​IMG]

    [​IMG]

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

    croxis

    Are you running spoutplugin?

    Known plugins with issues:
    SpoutPlugin
    Issue: Many tiles above 128 are absent
    Fix: This can be fixed by replacing every 128 with 256 and recompiling. A more sane system would be referencing World.height instead of hard coded

    ChopTree
    Issue: Trees above 128 do not fall
     
  24. Offline

    Arudinne

    I pulled bukkit and then compiled it, then pulled craftbukkit from git, made the changes and compiled it. Then I shut down the currently running minecraft server I had, which was under a completely different user folder. I made a new folder temporarily under the root user and placed the new CB jar I had compiled and ran it, with 3gb min, 6g max of ram assigned. It took longer than normal to generate the initial map which was a good sign.

    At this point I had 0 plugins.

    I downloaded spoutcraft onto the machine I was on at the time (linux if it matters... but i dont think it does), and logged in.. and it seemed somewhat laggy so i shutdown the server, added NoLagg 1.52 and logged back, and things were better, albeit messed up as you see in the screenshots.

    could NoLagg be the issue?
     
  25. Offline

    croxis

    That would be my guess as it has chunk caching that is probably hardcoded at 128. Try it without and let me know and I'll add it to the list
     
  26. Offline

    Arudinne

    Removed the plugin, started the server with java -jar -Xms3092M -Xmx6044M craftbukkit.jar

    01:35:15 [INFO] Arudinne [/ip.port] logged in with entity id 280 at ([world] -232.6875, 145.46875, 269.21875)

    Same Issues minus the lava..

    Manged to rapid fire some Screenshots before and after the stone turning to bedrock

    I'm going to rm -rf this world and make a new one and try it again.

    So I rm -rf ed world, as well as world_nether and world_the_end even though I haven' t tried them just to be safe...

    Server log:

    Code:
    [root@******* test]# java -jar -Xms3092M -Xmx6044M craftbukkit.jar
    174 recipes
    27 achievements
    01:40:43 [INFO] Starting minecraft server version 1.0.1
    01:40:43 [INFO] Loading properties
    01:40:43 [INFO] Starting Minecraft server on *:25565
    01:40:43 [INFO] This server is running Craftbukkit version git-Bukkit-"a0124aa" (MC: 1.0.1) (Implementing API version 1.0.1-R2-SNAPSHOT)
    01:40:44 [INFO] Preparing level "world"
    01:40:44 [INFO] Default game type: 0
    01:40:44 [INFO] Unable to find spawn biome
    01:40:44 [INFO] Unable to find spawn biome
    01:40:47 [INFO] Preparing start region for level 0 (Seed: 3198418705450101906)
    01:40:48 [INFO] Preparing spawn area: 8%
    01:40:49 [INFO] Preparing spawn area: 12%
    01:40:50 [INFO] Preparing spawn area: 16%
    01:40:51 [INFO] Preparing spawn area: 20%
    01:40:52 [INFO] Preparing spawn area: 20%
    01:40:53 [INFO] Preparing spawn area: 24%
    01:40:55 [INFO] Preparing spawn area: 28%
    01:40:56 [INFO] Preparing spawn area: 32%
    01:40:57 [INFO] Preparing spawn area: 36%
    01:40:58 [INFO] Preparing spawn area: 40%
    01:40:59 [INFO] Preparing spawn area: 48%
    01:41:00 [INFO] Preparing spawn area: 52%
    01:41:01 [INFO] Preparing spawn area: 57%
    01:41:03 [INFO] Preparing spawn area: 61%
    01:41:04 [INFO] Preparing spawn area: 69%
    01:41:05 [INFO] Preparing spawn area: 69%
    01:41:06 [INFO] Preparing spawn area: 77%
    01:41:07 [INFO] Preparing spawn area: 85%
    01:41:08 [INFO] Preparing spawn area: 93%
    01:41:09 [INFO] Preparing start region for level 1 (Seed: 3198418705450101906)
    01:41:09 [INFO] Preparing spawn area: 0%
    01:41:10 [INFO] Preparing spawn area: 12%
    01:41:11 [INFO] Preparing spawn area: 16%
    01:41:12 [INFO] Preparing spawn area: 20%
    01:41:13 [INFO] Preparing spawn area: 28%
    01:41:14 [INFO] Preparing spawn area: 32%
    01:41:16 [INFO] Preparing spawn area: 40%
    01:41:18 [INFO] Preparing spawn area: 48%
    01:41:19 [INFO] Preparing spawn area: 56%
    01:41:20 [INFO] Preparing spawn area: 65%
    01:41:21 [INFO] Preparing spawn area: 65%
    01:41:22 [INFO] Preparing spawn area: 77%
    01:41:23 [INFO] Preparing spawn area: 89%
    01:41:24 [INFO] Preparing start region for level 2 (Seed: 3198418705450101906)
    01:41:24 [INFO] Preparing spawn area: 0%
    01:41:25 [INFO] Preparing spawn area: 40%
    01:41:26 [INFO] Preparing spawn area: 81%
    01:41:27 [INFO] Server permissions file permissions.yml is empty, ignoring it
    01:41:27 [INFO] Done (4.322s)! For help, type "help" or "?"
    01:42:39 [INFO] Arudinne [/216.139.254.194:34007] logged in with entity id 2895 at ([world] 257.5, 154.62000000476837, 273.5)
    >op Arudinne
    01:42:50 [INFO] CONSOLE: Opping Arudinne
    >gamemone Arudinne 1
    01:42:57 [INFO] Unknown command. Type "help" for help.
    >gamemode Arudinne 1
    01:43:06 [INFO] CONSOLE: Setting Arudinne to game mode 1
    >op Arudinne
    01:46:22 [INFO] CONSOLE: Opping Arudinne
    >deop Arudinne
    01:46:28 [INFO] CONSOLE: De-opping Arudinne
    01:48:52 [INFO] Arudinne lost connection: disconnect.quitting
    01:48:52 [INFO] Connection reset
    >stop
    01:49:06 [INFO] CONSOLE: Stopping the server..
    01:49:06 [INFO] Stopping server
    01:49:06 [INFO] Saving chunks
    01:49:06 [INFO] Stopping server
    Initially I OPed myself which I had not done on the previous world, and things seemed, fine. Then I deoped myself, and had a few slight glitches, with stone turning to bedrock,, but things were better.
     

    Attached Files:

    Last edited by a moderator: Jun 19, 2016
  27. Offline

    Hazilo

    I changed all hard-coded 128 to 256, but I have a problem with breaking blocks over 128 height, m0st of them work like a charm, but for torches, grass/dirt, glass, glass pannel, netherrack, sand, sandstone, it's nearly impossible to break them. By switching to creative gamemode, there is no problem at all. I guess the problem comes from a block listener, but I can't figure out which one forget blocks over 128 height.
     
  28. Offline

    Deleted user

    LMFAO. I used dir/s, and the cmd started spamming me for 1 hour..
     
  29. Offline

    Isocadia

    Is there currently a working version? Or did something go terribly wrong?
     
  30. Offline

    croxis

    It works. I'm trying to fix some bukkit bugs though. For example playerinteractevent will loop back to 1 when it reaches 128, so a block at 129 returns as bedrock.
     
Thread Status:
Not open for further replies.

Share This Page