Kopamed / Raven-bPLUS

Raven b+ : Raven b3 but better.
https://ravenbplus.cf/
GNU General Public License v3.0
288 stars 120 forks source link

Sumo Fences unsupported map #136

Open Lightcaster5 opened 2 years ago

Lightcaster5 commented 2 years ago

There is a new map to be added for the module Sumo Fences to work. The map name is "Fort Royale".

https://github.com/Kopamed/Raven-bPLUS/blob/046d8b4c4246dc3247372dd5d385f213fd9f5f1e/src/main/java/keystrokesmod/sToNkS/module/modules/minigames/SumoFences.java#L26

UPDATE: Got things fixed myself, the new map is actually higher up than the others (by 7 blocks) Just made the following method:

private int higher() {
    if (Utils.Client.isHyp()) {
        for (String l: Utils.Client.getPlayersFromScoreboard()) {
            String s = Utils.Java.str(l);
            if (s.startsWith("Map:")) {
                String mapName = s.substring(5);
                if (mapName.equalsIgnoreCase("Fort Royale")) {
                    return 7; // because the map is 7 blocks higher
                }
            }
        }
    }
    return 0; // other maps should be at the default height value
}

Here is the updated t method for the SumoFences for functionality:

public TimerTask t() {
    return new TimerTask() {
        public void run() {
            if (SumoFences.this.is()) {
                int a = higher(); // determines additional height of the map
                for (BlockPos p: SumoFences.f_p) {
                    for (int i = 0;
                        (double) i < SumoFences.b.getInput(); ++i) {
                        BlockPos p2 = new BlockPos(p.getX(), p.getY() + i + a, p.getZ()); // updated to use variable 'a'
                        if (Module.mc.theWorld.getBlockState(p2).getBlock() == Blocks.air) {
                            Module.mc.theWorld.setBlockState(p2, SumoFences.this.f);
                        }
                    }
                }
            }
        }
    }
}
tyLunar commented 2 years ago

yes add this