Jump to content

Updating an old mod but need help


chuggalo

Recommended Posts

So I'm updating a mod called Bounding Box Outline by the minecraft forums member 4poc.

 

It was I mod that I used frequently because of it's usefulness. He stopped updating it at minecraft 1.6.4 though, so I figured I would take it upon myself to update a mod that I enjoyed and wished was still active.

 

So I have multiple questions but these are my main questions...

 

1) How come this ScaledResolution isn't working. It says "The constructor ScaledResolution(GameSettings, int, int) is undefined"

 

 

        if (config.debug) {

            Minecraft mc = Minecraft.getMinecraft();

            ScaledResolution var5 = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);

            int screenWidth = var5.getScaledWidth();

            int screenHeight = var5.getScaledHeight();

            mc.entityRenderer.setupOverlayRendering();

            int count = 0;

            for (BBoxInt bb : map.keySet()) {

                count += map.get(bb).size();

            }

            String debug = String.format("%d/%d", map.keySet().size(), count);

            //if (hitBB != null)

            //    debug += " " + hitBB.toString();

            int width = screenWidth - mc.fontRenderer.getStringWidth(debug);

           

            mc.fontRenderer.drawStringWithShadow(debug, width - 2, 2, 16777215);

        }

 

 

2) This one says that "The field World.activeChunkSet is not visible".

 

 

    private void renderOutlineList(Vector<BBoxInt> bbList) {

        World world = Minecraft.getMinecraft().theWorld;

        Set activeChunks = world.activeChunkSet;

        for (BBoxInt bb : bbList) {

            AxisAlignedBB relBB = getRenderBoundingBox(bb);

           

            if (activeChunks.contains(world.getChunkFromBlockCoords((int) Math.floor(bb.minX), (int) Math.floor(bb.minZ)).getChunkCoordIntPair()) ||

                    activeChunks.contains(world.getChunkFromBlockCoords((int) Math.floor(bb.maxX), (int) Math.floor(bb.maxZ)).getChunkCoordIntPair())) {

               

                if (config.fill) { // TODO: depth-sort vertices for real transparency

                    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);

                    config.fillColorA = 0.2f;

                    renderOutline(relBB);

                    GL11.glEnable(GL11.GL_POLYGON_OFFSET_LINE);

                    GL11.glPolygonOffset(-1.f,-1.f);

                    config.fillColorA = 1.0f;

                }

                GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);

                renderOutline(relBB);

            }

        }

    }

 

 

3) This one player.username doesn't work. It says "username cannot be resolved or is not a field".

 

 

    public synchronized void sendToPlayer(EntityPlayerMP player) {

       

        List<Chunk> loadedChunks = (List<Chunk>) player.loadedChunks;

       

        // collect a subset of the cache that is going to be send:

        HashMap<BBoxInt, Vector<BBoxInt>> cacheSubset = new HashMap<BBoxInt, Vector<BBoxInt>>();

 

        for (BBoxInt structureStartBB : cache.keySet()) {

            if (!cacheSent.containsKey(player) || !cacheSent.get(player).contains(structureStartBB)) {

                for (BBoxInt componentBB : cache.get(structureStartBB)) {

                    // TODO: check here if the BB is within the loaded chunks

                    if (!cacheSubset.containsKey(structureStartBB)) cacheSubset.put(structureStartBB, new Vector<BBoxInt>());

                    cacheSubset.get(structureStartBB).add(componentBB);

                }

            }

        }

       

        if (cacheSubset.keySet().size() > 0) {

            FMLLog.info("send %d entries to %s (%d)", cacheSubset.keySet().size(), player.username, dimensionId);

        }

 

        for (BBoxInt structureStartBB : cacheSubset.keySet()) {

            Vector<BBoxInt> componentBBList = cacheSubset.get(structureStartBB);

            PacketHandler.writeBBoxUpdatePacket(player, dimensionId, structureStartBB, componentBBList);

            //sendCacheEntryToPlayer(player, structureStartBB, componentBBList);

           

            if (!cacheSent.containsKey(player)) cacheSent.put(player,  new Vector<BBoxInt>());

            cacheSent.get(player).add(structureStartBB);

        }

    }

 

Link to comment
Share on other sites

Hi

 

The minecraft code changes from each version to the next.  So the errors you're getting are because those fields / methods are either replaced by something else or are made private.  You'll need to figure out what they have changed to.  If they are now private, you will need either Access Transformer or Reflection to access them.

 

In some cases, there may not be a replacement and you will need to significantly re-code.  In this case I think the mod is pretty simple so there shouldn't be much to change.  You'll probably need to understand Java pretty well though.

 

-TGG

Link to comment
Share on other sites

1.

ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);

2. You will have to use reflection to set this field to public or access it other way.

3. Now there are not only usernames but UUIDs and InGame Nick.

If you are doing something regardig visuals (displaying player name, etc.)

player.getDisplayName();

Otherwise you should use UUID (gettin and setting NBT, operating on actually any internal data).

player.getUniqueID();

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.