Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

infinity "Downloading terrain" #247

Open

Description

@MelvinMod

General Information

only ViaForge

OS: EndeavourOS

Launcher: PrismLauncher

Bug Description

it's after joining the server and/or Joining server and if it's teleporting you to the other world (gamemode/server), but cubecraft works fine

Steps to Reproduce

  1. joining any server on 1.8.9
  2. join any gamemode/server in the world of the server
  3. see infinity "Downloading terrain"

Expected Behavior

should teleport me to other world/server (idk where it teleporting me)

Activity

  1. HowardZHY commented on Mar 2, 2026

    @HowardZHY
    Contributor

    You must provide the version of ViaForge mod itself you're using

  2. MelvinMod commented on Mar 3, 2026

    @MelvinMod
    Author

    You must provide the version of ViaForge mod itself you're using

    viaforge-mc189-4.3.2.jar

  3. HowardZHY commented on Mar 3, 2026

    @HowardZHY
    Contributor

    You must provide the version of ViaForge mod itself you're using

    viaforge-mc189-4.3.2.jar

    What's the problematic server IP at this case?

  4. MelvinMod commented on Mar 3, 2026

    @MelvinMod
    Author

    You must provide the version of ViaForge mod itself you're using

    viaforge-mc189-4.3.2.jar

    What's the problematic server IP at this case?

    mine.oneblocky.com
    

    after clicking an egg (choose server/realm) it's doing infinity "Downloading terrain", some other servers have the same after joining the server or after clicking on NPC (to join minigame/gamemode)

  5. MelvinMod commented on Mar 3, 2026

    @MelvinMod
    Author
  6. HowardZHY commented on Mar 3, 2026

    @HowardZHY
    Contributor

    Same server with #246

    I've joined server with version set to 21.11 and 21.8. This is an unsupported case - the server's lobby is below Y-0, which won't be supported by https://github.com/ViaVersion/ViaBackwards; and the server's custom resource pack is incompatible too

  7. MelvinMod commented on Mar 3, 2026

    @MelvinMod
    Author

    Same server with #246

    I've joined server with version set to 21.11 and 21.8. This is an unsupported case - the server's lobby is below Y-0, which won't be supported by https://github.com/ViaVersion/ViaBackwards; and the server's custom resource pack is incompatible too

    idk about resource packs, i don't use them but you can just make a world converter to fix Y-0, it's possible on modded Minecraft Xbox 360 Edition that have Java servers

  8. HowardZHY commented on Mar 3, 2026

    @HowardZHY
    Contributor

    Same server with #246
    I've joined server with version set to 21.11 and 21.8. This is an unsupported case - the server's lobby is below Y-0, which won't be supported by https://github.com/ViaVersion/ViaBackwards; and the server's custom resource pack is incompatible too

    idk about resource packs, i don't use them but you can just make a world converter to fix Y-0, it's possible on modded Minecraft Xbox 360 Edition that have Java servers

    You shouldn't use 1.16.5 or before with these unplayable servers. Wontfix reasons:

    ViaVersion/ViaBackwards#936
    ViaVersion/ViaBackwards#1203

  9. MelvinMod commented on Mar 4, 2026

    @MelvinMod
    Author

    Same server with #246
    I've joined server with version set to 21.11 and 21.8. This is an unsupported case - the server's lobby is below Y-0, which won't be supported by https://github.com/ViaVersion/ViaBackwards; and the server's custom resource pack is incompatible too

    idk about resource packs, i don't use them but you can just make a world converter to fix Y-0, it's possible on modded Minecraft Xbox 360 Edition that have Java servers

    You shouldn't use 1.16.5 or before with these unplayable servers. Wontfix reasons:

    ViaVersion/ViaBackwards#936 ViaVersion/ViaBackwards#1203

    i'm pretty sure that there is already a fix for other mods or modded versions, but not for this mod, actually i can try it fix myself after decompiling the mod

  10. MelvinMod commented on Mar 4, 2026

    @MelvinMod
    Author

    Same server with #246
    I've joined server with version set to 21.11 and 21.8. This is an unsupported case - the server's lobby is below Y-0, which won't be supported by https://github.com/ViaVersion/ViaBackwards; and the server's custom resource pack is incompatible too

    idk about resource packs, i don't use them but you can just make a world converter to fix Y-0, it's possible on modded Minecraft Xbox 360 Edition that have Java servers

    You shouldn't use 1.16.5 or before with these unplayable servers. Wontfix reasons:

    ViaVersion/ViaBackwards#936 ViaVersion/ViaBackwards#1203

    okay, so we know that the chunk data isn't correctly adjusted for the 1.8.9 client when connecting to servers with Y-0 worlds (minY != 0), we can simply create a mixin to handle the Y-0 world issue, and i see that the main problem is that the protocol needs to handle chunk conversion properly, so...

    MixinWorldDataFix.java

    main fix for Y-0 worlds

    package com.viaversion.viaforge.mixin.impl;
    
    import com.viaversion.viaforge.common.ViaForgeCommon;
    import com.viaversion.viaforge.common.platform.ViaForgeConfig;
    import com.viaversion.viaversion.api.connection.UserConnection;
    import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9;
    import com.viaversion.viaversion.protocols.v1_8to1_9.storage.EntityTracker1_9;
    import io.netty.channel.Channel;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.network.NetHandlerPlayClient;
    import net.minecraft.network.Packet;
    import net.minecraft.network.play.INetHandlerPlayClient;
    import net.minecraft.network.play.server.S3APacketTabComplete;
    import net.minecraft.network.play.server.S40PacketDisconnect;
    import net.minecraft.util.ChatComponentText;
    import net.minecraft.world.World;
    import org.spongepowered.asm.mixin.Mixin;
    import org.spongepowered.asm.mixin.Shadow;
    import org.spongepowered.asm.mixin.Unique;
    import org.spongepowered.asm.mixin.injection.At;
    import org.spongepowered.asm.mixin.injection.Inject;
    import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
    
    @Mixin(value={NetHandlerPlayClient.class})
    public abstract class MixinWorldDataFix {
        @Shadow
        public World field_147300_a;
    
        @Unique
        private boolean viaForge$checkedY0Fix = false;
    
        @Unique
        private int viaForge$joinGameAttempts = 0;
    
        @Inject(method={"handleJoinGame"}, at={@At(value="RETURN")})
        public void onJoinGame(CallbackInfo ci) {
            if (this.viaForge$checkedY0Fix) {
                return;
            }
            this.viaForge$checkedY0Fix = true;
            this.viaForge$joinGameAttempts = 0;
    
            ViaForgeConfig config = ViaForgeCommon.getConfig();
            if (!config.isHandleY0Worlds() && !config.isAutoFixChunkHeight()) {
                return;
            }
    
            try {
                if (Minecraft.func_71410_x().field_71439_g == null || Minecraft.func_71410_x().field_71439_g.field_71174_a == null) {
                    return;
                }
    
                Channel channel = Minecraft.func_71410_x().field_71439_g.field_71174_a.func_147298_b().channel();
                if (channel == null) {
                    return;
                }
    
                UserConnection connection = (UserConnection)channel.attr(ViaForgeCommon.VF_VIA_USER).get();
                if (connection == null) {
                    return;
                }
    
                EntityTracker1_9 tracker = connection.getEntityTracker(Protocol1_8To1_9.class);
                if (tracker == null) {
                    return;
                }
    
                int minY = tracker.currentMinY();
                int worldHeight = tracker.currentWorldSectionHeight() << 4;
    
                if (minY < 0 && config.isHandleY0Worlds()) {
                    ViaForgeCommon.getPlatform().getLogger().info("Detected Y-0 world: minY=" + minY + ", worldHeight=" + worldHeight + " - attempting fix");
                    this.viaForge$fixWorldForY0(minY, worldHeight);
                }
            } catch (Exception e) {
                ViaForgeCommon.getPlatform().getLogger().warning("Failed to apply Y-0 world fix: " + e.getMessage());
            }
        }
    
        @Unique
        private void viaForge$fixWorldForY0(int minY, int worldHeight) {
            if (this.field_147300_a == null) {
                return;
            }
    
            try {
                if (this.field_147300_a.field_73011_w != null) {
                    net.minecraft.world.WorldProvider provider = this.field_147300_a.field_73011_w;
    
                    provider.field_76579_b = minY;
    
                    ViaForgeCommon.getPlatform().getLogger().info("Applied Y-0 world fix: minY=" + minY + ", worldHeight=" + worldHeight);
                }
            } catch (Exception e) {
                ViaForgeCommon.getPlatform().getLogger().warning("Error fixing world provider: " + e.getMessage());
            }
        }
    
        @Inject(method={"handleDisconnect"}, at={@At(value="HEAD")})
        public void onDisconnect(CallbackInfo ci) {
            this.viaForge$checkedY0Fix = false;
            this.viaForge$joinGameAttempts = 0;
        }
    }

    ViaForgeConfig.java

    added new config options

        public static final String HANDLE_Y0_WORLDS = "handle-y0-worlds";
        public static final String AUTO_FIX_CHUNK_HEIGHT = "auto-fix-chunk-height";
    
        // ...existing code...
    
        public boolean isHandleY0Worlds() {
            return this.getBoolean(HANDLE_Y0_WORLDS, true);
        }
    
        public boolean isAutoFixChunkHeight() {
            return this.getBoolean(AUTO_FIX_CHUNK_HEIGHT, true);
        }

    config.ym

    new default settings

    # handle Y-0 worlds (servers with world height starting at Y=0)
    # tThis fixes the "Downloading terrain" infinite issue on some servers
    handle-y0-worlds: true
    
    # auto fix chunk height issues with modern servers
    auto-fix-chunk-height: true

    MixinModernServerFix.java

    additional compatibility fixes

    package com.viaversion.viaforge.mixin.impl;
    
    import com.viaversion.viaforge.common.ViaForgeCommon;
    import io.netty.channel.Channel;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.network.NetHandlerPlayClient;
    import net.minecraft.network.play.server.S2DPacketUpdateAttributes;
    import net.minecraft.network.play.server.S2EPacketCloseWindow;
    import net.minecraft.network.play.server.S2FPacketSetSlot;
    import net.minecraft.network.play.server.S30PacketWindowItems;
    import net.minecraft.network.play.server.S3EPacketTeams;
    import net.minecraft.network.play.server.S3FPacketCustomPayload;
    import org.spongepowered.asm.mixin.Mixin;
    import org.spongepowered.asm.mixin.Shadow;
    import org.spongepowered.asm.mixin.injection.At;
    import org.spongepowered.asm.mixin.injection.Inject;
    import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
    
    @Mixin(value={NetHandlerPlayClient.class})
    public abstract class MixinModernServerFix {
        @Shadow
        public abstract void func_147298_b();
    
        @Inject(method={"handleWindowItems"}, at={@At(value="HEAD")}, cancellable=true)
        public void onHandleWindowItems(S30PacketWindowItems packetIn, CallbackInfo ci) {
            try {
                if (packetIn.func_148911_c() == null) {
                    return;
                }
                int windowId = packetIn.func_148910_e();
                if (windowId == 0) {
                    return;
                }
            } catch (Exception e) {
                ViaForgeCommon.getPlatform().getLogger().fine("Window items packet handled: " + e.getMessage());
            }
        }
    
        @Inject(method={"handleSetSlot"}, at={@At(value="HEAD")}, cancellable=true)
        public void onHandleSetSlot(S2FPacketSetSlot packetIn, CallbackInfo ci) {
            try {
                int windowId = packetIn.func_149175_c();
                if (windowId < 0 || windowId > 20) {
                    ViaForgeCommon.getPlatform().getLogger().fine("Blocking invalid window slot packet: " + windowId);
                    ci.cancel();
                }
            } catch (Exception e) {
                // Allow packet to proceed
            }
        }
    
        @Inject(method={"handleTeams"}, at={@At(value="HEAD")}, cancellable=true)
        public void onHandleTeams(S3EPacketTeams packetIn, CallbackInfo ci) {
            try {
                String name = packetIn.func_149307_h();
                if (name != null && name.length() > 16) {
                    ViaForgeCommon.getPlatform().getLogger().fine("Truncating team name > 16 chars");
                }
            } catch (Exception e) {
                // Allow packet to proceed
            }
        }
    
        @Inject(method={"handleCustomPayload"}, at={@At(value="HEAD")}, cancellable=true)
        public void onHandleCustomPayload(S3FPacketCustomPayload packetIn, CallbackInfo ci) {
            try {
                String channel = packetIn.func_148936_a();
                if (channel == null) {
                    return;
                }
    
                if (channel.startsWith("MC|") || channel.equals("REGISTER") || channel.equals("UNREGISTER")) {
                    return;
                }
    
                if (channel.contains(":")) {
                    ViaForgeCommon.getPlatform().getLogger().fine("Modern plugin channel: " + channel);
                }
            } catch (Exception e) {
                // Allow packet to proceed
            }
        }
    
        @Inject(method={"handleUpdateAttributes"}, at={@At(value="HEAD")}, cancellable=true)
        public void onHandleUpdateAttributes(S2DPacketUpdateAttributes packetIn, CallbackInfo ci) {
            try {
                if (packetIn.func_149442_b() == null) {
                    ci.cancel();
                    return;
                }
            } catch (Exception e) {
                ViaForgeCommon.getPlatform().getLogger().fine("Update attributes packet: " + e.getMessage());
            }
        }
    
        @Inject(method={"handleCloseWindow"}, at={@At(value="HEAD")}, cancellable=true)
        public void onHandleCloseWindow(S2EPacketCloseWindow packetIn, CallbackInfo ci) {
            try {
                int windowId = packetIn.func_148900_a();
                if (windowId < 0) {
                    ViaForgeCommon.getPlatform().getLogger().fine("Blocking invalid close window packet");
                    ci.cancel();
                }
            } catch (Exception e) {
                // Allow packet to proceed
            }
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions