pala M-gadget-1: analyseur de chunk (dura 5, scan top10)
This commit is contained in:
@@ -638,6 +638,10 @@ avant M4 (TODO:crafts-machines).
|
||||
plancher 0, hook AFTER_DEATH existant) + /f top (tri elo) + elo dans /f info/help.
|
||||
ECART : formule exacte Paladium non publiee (UNVERIFIED). VERIFIE : build SUCCESSFUL,
|
||||
boot Done, 0 erreur. UNVERIFIED en jeu (2 joueurs).
|
||||
- M-gadget-1 LIVRE 2026-10-19 ~05:20 : analyseur de chunk (ID 4975, durabilite 5 wiki,
|
||||
texture legacy, scan 16x16 top 10 + total, sans craft ECART). Lecon : patch
|
||||
chevauchant la fin d'une methode mange sa signature — verifier la queue du fichier.
|
||||
VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. 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
|
||||
|
||||
@@ -61,6 +61,9 @@ public final class PalaItems {
|
||||
public static final Item TITANE_STICK = register("titane_stick", id -> new Item(new Item.Properties().setId(id)));
|
||||
public static final Item TRIXIUM_GEM = register("trixium_gem", id -> new Item(new Item.Properties().setId(id)));
|
||||
public static final Item XP_BERRIES = register("xp_berries", id -> new Item(new Item.Properties().setId(id)));
|
||||
// M-gadget-1 (wiki items lucky) : analyseur de chunk, durabilite 5, sans craft
|
||||
// (obtention lucky/admin, ECART documente).
|
||||
public static final Item CHUNK_ANALYSER = register("chunk_analyser", id -> new Item(new Item.Properties().setId(id).stacksTo(1).durability(5)));
|
||||
// M-candy (wiki metiers, VERIFIE partiel) : bonbons 50 000 XP. Vert = fermier,
|
||||
// jaune = mineur, rainbow = tous (pages Evolution) ; bleu/rose = mapping non publie
|
||||
// (items seuls, TODO:mapping-bonbons) ; candy/job_candy = nature inconnue (items seuls).
|
||||
|
||||
@@ -69,6 +69,7 @@ public final class PalaTabs {
|
||||
output.accept(PalaItems.TITANE_STICK);
|
||||
output.accept(PalaItems.TRIXIUM_GEM);
|
||||
output.accept(PalaItems.XP_BERRIES);
|
||||
output.accept(PalaItems.CHUNK_ANALYSER);
|
||||
output.accept(PalaItems.CANDY);
|
||||
output.accept(PalaItems.CANDY_BLUE);
|
||||
output.accept(PalaItems.CANDY_GREEN);
|
||||
|
||||
@@ -232,9 +232,55 @@ public final class PalaItemUseEvents {
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
// --- Analyseur de chunk (M-gadget-1, wiki items lucky) : clic droit avec
|
||||
// l'objet -> top 10 des blocs du chunk vise + total. Durabilite 5 (wiki).
|
||||
if (item == PalaItems.CHUNK_ANALYSER) {
|
||||
analyseChunk(sp, sl, pos);
|
||||
stack.hurtAndBreak(1, sp, hand);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
// M-gadget-1 : scan du chunk (16x16 sur toute la hauteur), top 10 + total.
|
||||
static void analyseChunk(ServerPlayer player, ServerLevel level, BlockPos pos) {
|
||||
java.util.Map<String, Integer> counts = new java.util.HashMap<>();
|
||||
int total = 0;
|
||||
int baseX = pos.getX() >> 4 << 4;
|
||||
int baseZ = pos.getZ() >> 4 << 4;
|
||||
net.minecraft.core.BlockPos.MutableBlockPos cursor =
|
||||
new net.minecraft.core.BlockPos.MutableBlockPos();
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int y = level.getMinY(); y < level.getMaxY(); y++) {
|
||||
BlockState state = level.getBlockState(cursor.set(baseX + x, y, baseZ + z));
|
||||
if (state.isAir()) {
|
||||
continue;
|
||||
}
|
||||
total++;
|
||||
String id = net.minecraft.core.registries.BuiltInRegistries.BLOCK
|
||||
.getKey(state.getBlock()).toString();
|
||||
counts.merge(id, 1, Integer::sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
java.util.List<java.util.Map.Entry<String, Integer>> top =
|
||||
new java.util.ArrayList<>(counts.entrySet());
|
||||
top.sort((a, b) -> Integer.compare(b.getValue(), a.getValue()));
|
||||
StringBuilder out = new StringBuilder("§6[Analyseur] §7chunk "
|
||||
+ (baseX >> 4) + "," + (baseZ >> 4) + " : " + total + " blocs");
|
||||
int shown = 0;
|
||||
for (java.util.Map.Entry<String, Integer> entry : top) {
|
||||
if (shown >= 10) {
|
||||
break;
|
||||
}
|
||||
out.append("\n§7- ").append(entry.getKey()).append(" x").append(entry.getValue());
|
||||
shown++;
|
||||
}
|
||||
player.sendSystemMessage(net.minecraft.network.chat.Component.literal(out.toString()));
|
||||
}
|
||||
|
||||
static void drop(ServerLevel level, BlockPos pos, Item item, int count) {
|
||||
ItemEntity entity = new ItemEntity(level, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
new ItemStack(item, count));
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "pala:item/chunk_analyser"
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
"item.pala.amethyst_mixed_coal": "Amethyst Mixed Coal",
|
||||
"item.pala.amethyst_stick": "Amethyst Stick",
|
||||
"item.pala.compressed_amethyst": "Compressed Amethyst",
|
||||
"item.pala.chunk_analyser": "Chunk Analyser",
|
||||
"item.pala.compressed_paladium": "Compressed Paladium",
|
||||
"item.pala.compressed_titane": "Compressed Titane",
|
||||
"item.pala.creative_mixed_coal": "Creative Mixed Coal",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "pala:item/chunk_analyser"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 173 B |
Binary file not shown.
Reference in New Issue
Block a user