1.17.1 lower corner of Worldboarder

Discussion in 'Spigot Plugin Development' started by PixelsDE, Jul 26, 2021.

  1. Code (Java):
        public void createChestFall(Game game) {
            for (int i = 0; i < Settings.cfg.getInt("Chest_Amount"); i++) {
                //Location of the Worldboarder Edge
                Location locationCenter = LocationCreator.getConfigLocation(game.getName(), "WorldCenter", Variables.cfg).subtract(Settings.cfg.getInt("Border_MaxSize") / 2, 0, Settings.cfg.getInt("Border_MaxSize") / 2);
                int x = new Random().nextInt(Settings.cfg.getInt("Border_MaxSize"));
                int z = new Random().nextInt(Settings.cfg.getInt("Border_MaxSize"));
                FallingBlock chest = locationCenter.getWorld().spawnFallingBlock(locationCenter.add(x, 200, z), Material.BEACON.createBlockData());
                chest.setVelocity(new Vector(0, -1.5, 0));
                Game.getEntityGames().put(chest, game);
    My idea is to get the lowst x and z cordinate corner of the worldboarder do than spawn falling blocks (my itemchests) but sometimes the blocks spawn out of my worldboarder meaning the boundary was wrong. anyone can help me. I want these blocks to spawn inside my worldboarder (no matter how)
  2. I don't really understand, but I think you need to replace x and z variables with double or float and add 0.5 so it will be in the center of the block.