diff --git a/PALAMOD_CDC.md b/PALAMOD_CDC.md index 63960ab..35fc62d 100644 --- a/PALAMOD_CDC.md +++ b/PALAMOD_CDC.md @@ -598,6 +598,9 @@ avant M4 (TODO:crafts-machines). wiki documentee), bonbon jaune = mineur (mapping partiel : restent bleu/rose). ECART : "Particules" non identifie (non implemente). VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu. +- M-rtp LIVRE 2026-10-19 ~04:00 : /rtp (wiki commandes : aleatoire overworld, cooldown 15 min, + position safe via heightmap, 16 essais, refuse ocean). ECART : pas de limite "3/version". + VERIFIE : build SUCCESSFUL, boot Done, 0 erreur, 23 cles. UNVERIFIED en jeu. - M-palaforge LIVRE 2026-10-19 ~03:55 : bloc + BE partagee (3e mode) + gate mineur 14 + table fonte wiki §3.2 (31 items, ratio floor usure) + fuels bois (+buche/planches/baton, lave exclue : seau non rendu) + craft (1 findium + 4 furnaces + 4 briques, positions diff --git a/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java b/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java index df75773..79ddfec 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/PalaCommands.java @@ -40,6 +40,8 @@ public final class PalaCommands { private static final java.util.Map TPA_QUEUE = new java.util.HashMap<>(); // M-msg (wiki commandes) : dernier expediteur par destinataire (pour /r). private static final java.util.Map LAST_MSG = new java.util.HashMap<>(); + // M-rtp (wiki commandes) : dernier /rtp par joueur (tick). Cooldown 15 min (config). + private static final java.util.Map RTP_LAST = new java.util.HashMap<>(); private record TpaRequest(java.util.UUID from, long expireTick) { } @@ -141,6 +143,8 @@ public final class PalaCommands { .executes(command -> baltop(command.getSource()))); dispatcher.register(Commands.literal("balance") .executes(command -> balance(command.getSource()))); + dispatcher.register(Commands.literal("rtp") + .executes(command -> rtp(command.getSource()))); net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK .register(PalaCommands::tickSpawnQueue); net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.END_SERVER_TICK @@ -237,6 +241,54 @@ public final class PalaCommands { } } + // M-rtp (wiki commandes) : teleportation aleatoire dans l'overworld, cooldown 15 min. + // ECART : pas de limite "3 utilisations par version" (notion de version/serveur faction + // sans objet ici) ; rayon borne en config (wiki sans borne). + private static int rtp(CommandSourceStack source) { + try { + ServerPlayer player = source.getPlayerOrException(); + MinecraftServer server = source.getServer(); + long cooldown = (long) PalaConfig.get().rtpCooldownMinutes * 60L * 20L; + Long last = RTP_LAST.get(player.getUUID()); + long now = server.getTickCount(); + if (last != null && now - last < cooldown) { + long wait = (cooldown - (now - last)) / 20L; + source.sendFailure(Component.literal("§cProchain /rtp dans " + wait + " s.")); + return 0; + } + ServerLevel overworld = server.overworld(); + BlockPos spawn = overworld.getRespawnData().pos(); + int radius = Math.max(100, PalaConfig.get().rtpRadius); + java.util.Random random = new java.util.Random(); + BlockPos target = null; + for (int i = 0; i < 16 && target == null; i++) { + int x = spawn.getX() + random.nextInt(radius * 2 + 1) - radius; + int z = spawn.getZ() + random.nextInt(radius * 2 + 1) - radius; + BlockPos ground = overworld.getHeightmapPos( + net.minecraft.world.level.levelgen.Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, + new BlockPos(x, 0, z)); + // Refuse l'ocean profond et les zones trop hautes/basses. + if (ground.getY() < overworld.getMinY() + 2 || ground.getY() > 200) { + continue; + } + if (overworld.getFluidState(ground).isSource() + || overworld.getFluidState(ground.above()).isSource()) { + continue; + } + target = ground.above(); + } + if (target == null) { + source.sendFailure(Component.literal("§cAucun endroit sur (reessayez).")); + return 0; + } + RTP_LAST.put(player.getUUID(), now); + teleportPlayer(player, overworld, target.below()); + return Command.SINGLE_SUCCESS; + } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) { + return 0; + } + } + // M1 : prospecte les minerais pala dans un cube de rayon N autour du joueur. // Affiche comptes par minerai + histogramme Y (8 bandes de 16) pour amethyste/titane. // Test distribution worldgen (couches 6-10 + deep ocean). Rayon capé à 32 (65^3 lectures). diff --git a/mods/pala/src/main/java/fr/surviepote/pala/core/PalaConfig.java b/mods/pala/src/main/java/fr/surviepote/pala/core/PalaConfig.java index 3e639ae..3f37eac 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/core/PalaConfig.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/core/PalaConfig.java @@ -85,6 +85,11 @@ public final class PalaConfig { // M-afk (wiki reglement/grades) : kick apres N minutes sans activite (defaut 10). public int afkKickMinutes = 10; + // M-rtp (wiki commandes) : cooldown minutes entre deux /rtp (wiki : 15). + public int rtpCooldownMinutes = 15; + // Rayon max du /rtp autour du spawn (blocs). UNVERIFIED (wiki : "aleatoire", sans borne). + public int rtpRadius = 3000; + // Cooldowns sticks PvP en secondes. UNVERIFIED (durees balance staff, M5). public Map stickCooldowns = new HashMap<>(Map.of( "heal_stick", 60, "speed_stick", 30, "hyper_jump_stick", 30, @@ -229,7 +234,7 @@ public final class PalaConfig { "crusherResults", "crusherFuels", "crusherInfiniteFuels", "furnaceSmelts", "furnaceFuels", "serverName", "wikiUrl", "discordUrl", "shopUrl", - "afkKickMinutes"); + "afkKickMinutes", "rtpCooldownMinutes", "rtpRadius"); boolean complete = true; try (Reader keysReader = Files.newBufferedReader(path)) { com.google.gson.JsonObject obj = diff --git a/server/mods/pala-0.2.1.jar b/server/mods/pala-0.2.1.jar index 6fd4910..f84d23d 100644 Binary files a/server/mods/pala-0.2.1.jar and b/server/mods/pala-0.2.1.jar differ