pala M1: worldgen amethyste/titane calibre wiki (size 8, trapezoid 6-10, deep ocean) + /pala orestats

This commit is contained in:
Anaïs Saraiva
2026-10-18 23:44:02 +02:00
parent 86cc852c81
commit cc7a5f7c77
10 changed files with 154 additions and 16 deletions
@@ -57,6 +57,13 @@ public final class PalaCommands {
.then(Commands.literal("info")
.requires(source -> isAdmin(source))
.executes(command -> info(command.getSource())))
.then(Commands.literal("orestats")
.requires(source -> isAdmin(source))
.then(Commands.argument("rayon",
com.mojang.brigadier.arguments.IntegerArgumentType.integer(8, 32))
.executes(command -> orestats(command.getSource(),
com.mojang.brigadier.arguments.IntegerArgumentType
.getInteger(command, "rayon")))))
.then(Commands.literal("rank")
.requires(source -> isAdmin(source))
.then(joueurArg)));
@@ -87,6 +94,63 @@ public final class PalaCommands {
return Command.SINGLE_SUCCESS;
}
// 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).
private static int orestats(CommandSourceStack source, int rayon) {
ServerPlayer player = source.getPlayer();
if (player == null) {
source.sendFailure(Component.literal("§cCommande joueur uniquement."));
return 0;
}
ServerLevel level = player.level();
BlockPos center = player.blockPosition();
java.util.Map<String, Integer> counts = new java.util.HashMap<>();
java.util.Map<String, int[]> histo = new java.util.HashMap<>();
net.minecraft.world.level.block.Block[] ores = {PalaBlocks.AMETHYST_ORE, PalaBlocks.TITANE_ORE,
PalaBlocks.PALADIUM_ORE, PalaBlocks.PALADIUM_GREEN_ORE, PalaBlocks.TRIXIUM_ORE,
PalaBlocks.FINDIUM_ORE, PalaBlocks.KISAKAY_ORE};
for (int dx = -rayon; dx <= rayon; dx++) {
for (int dy = -rayon; dy <= rayon; dy++) {
for (int dz = -rayon; dz <= rayon; dz++) {
BlockPos pos = center.offset(dx, dy, dz);
net.minecraft.world.level.block.state.BlockState state = level.getBlockState(pos);
for (net.minecraft.world.level.block.Block ore : ores) {
if (state.is(ore)) {
String id = net.minecraft.core.registries.BuiltInRegistries.BLOCK
.getKey(ore).toString();
counts.merge(id, 1, Integer::sum);
if (ore == PalaBlocks.AMETHYST_ORE || ore == PalaBlocks.TITANE_ORE) {
int[] bars = histo.computeIfAbsent(id, k -> new int[8]);
int band = Math.min(7, Math.max(0, (pos.getY() + 64) / 16));
bars[band]++;
}
break;
}
}
}
}
}
StringBuilder out = new StringBuilder("§6[Orestats r=" + rayon + "]");
java.util.List<String> ids = new java.util.ArrayList<>(counts.keySet());
java.util.Collections.sort(ids);
for (String id : ids) {
out.append("\n§e").append(id).append(" §7x§a").append(counts.get(id));
int[] bars = histo.get(id);
if (bars != null) {
out.append(" §8Y[-64..63 par 16]=");
for (int b = 0; b < bars.length; b++) {
out.append(bars[b]).append(b < bars.length - 1 ? "/" : "");
}
}
}
if (ids.isEmpty()) {
out.append("\n§7aucun minerai pala dans la zone.");
}
source.sendSuccess(() -> Component.literal(out.toString()), false);
return Command.SINGLE_SUCCESS;
}
private static int rank(CommandSourceStack source, ServerPlayer target, String rank) {
if (!PalaConfig.get().rankNodes.containsKey(rank)) {
source.sendFailure(Component.literal("§cRang inconnu : " + rank));
@@ -5,6 +5,7 @@ import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@@ -50,5 +51,16 @@ public final class PalaWorldgen {
BiomeSelectors.foundInOverworld().or(BiomeSelectors.foundInTheEnd()),
GenerationStep.Decoration.UNDERGROUND_ORES, key("titane_ore"));
addOverworld("trixium_ore");
// M1 (wiki minerais, VERIFIE) : amethyste + titane des la couche 25 dans les
// fonds marins des biomes deep ocean (les 4 variants). Placed *_deep dedies.
addDeepOcean("amethyst_ore_deep");
addDeepOcean("titane_ore_deep");
}
private static void addDeepOcean(String path) {
BiomeModifications.addFeature(
BiomeSelectors.includeByKey(Biomes.DEEP_OCEAN, Biomes.DEEP_LUKEWARM_OCEAN,
Biomes.DEEP_COLD_OCEAN, Biomes.DEEP_FROZEN_OCEAN),
GenerationStep.Decoration.UNDERGROUND_ORES, key(path));
}
}
@@ -1,7 +1,7 @@
{
"type": "minecraft:ore",
"discard_chance_on_air_exposure": 0.0,
"size": 5,
"size": 8,
"targets": [
{
"state": "pala:amethyst_ore",
@@ -1,7 +1,7 @@
{
"type": "minecraft:ore",
"discard_chance_on_air_exposure": 0.0,
"size": 4,
"size": 8,
"targets": [
{
"state": "pala:titane_ore",
@@ -11,12 +11,12 @@
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"type": "minecraft:trapezoid",
"min_inclusive": {
"absolute": 1
"absolute": 6
},
"max_inclusive": {
"absolute": 25
"absolute": 10
}
}
},
@@ -0,0 +1,27 @@
{
"feature": "pala:amethyst_ore",
"placement": [
{
"type": "minecraft:count",
"count": 4
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"min_inclusive": {
"absolute": 25
},
"max_inclusive": {
"absolute": 40
}
}
},
{
"type": "minecraft:biome"
}
]
}
@@ -11,12 +11,12 @@
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"type": "minecraft:trapezoid",
"min_inclusive": {
"absolute": 1
"absolute": 6
},
"max_inclusive": {
"absolute": 19
"absolute": 10
}
}
},
@@ -0,0 +1,27 @@
{
"feature": "pala:titane_ore",
"placement": [
{
"type": "minecraft:count",
"count": 4
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"min_inclusive": {
"absolute": 25
},
"max_inclusive": {
"absolute": 40
}
}
},
{
"type": "minecraft:biome"
}
]
}