pala M2: tooltip XP POG via LORE serveur + craft verifie conforme wiki

This commit is contained in:
Anaïs Saraiva
2026-10-18 23:48:42 +02:00
parent cc7a5f7c77
commit 3330b5bd04
3 changed files with 39 additions and 4 deletions
+10 -2
View File
@@ -452,9 +452,9 @@ avant M4 (TODO:crafts-machines).
- Features wiki couvertes (entree CDC) : ~210 (§1.14). Portage existant : ~120 (assets+registres). - Features wiki couvertes (entree CDC) : ~210 (§1.14). Portage existant : ~120 (assets+registres).
Logique specifiee restant a implementer : ~90. Couverture spec : 100 % des pages FR Java ingestionnees. Logique specifiee restant a implementer : ~90. Couverture spec : 100 % des pages FR Java ingestionnees.
- TODO explicites : 12 nommes (grep : ocr-fiable, worldgen-couches, broadsword, - TODO explicites : 13 nommes (grep : ocr-fiable, worldgen-couches, broadsword,
crafts-machines, chervil, commandes-exactes, ghost, luckperms, runclient, mcp-ocular, shebang, crafts-machines, chervil, commandes-exactes, ghost, luckperms, runclient, mcp-ocular, shebang,
java-home) java-home, pog-os)
+ 4 points UNVERIFIED (seuils XP 6-100, durees sticks, valeurs armures wiki vs MCreator, + 4 points UNVERIFIED (seuils XP 6-100, durees sticks, valeurs armures wiki vs MCreator,
patterns machines images). patterns machines images).
- Methode : WAVES (crawl 137 articles → stub JS isoles → re-crawl navigateur → verifie) + ETERNAL CODE - Methode : WAVES (crawl 137 articles → stub JS isoles → re-crawl navigateur → verifie) + ETERNAL CODE
@@ -490,6 +490,14 @@ avant M4 (TODO:crafts-machines).
(export JAVA_HOME jdk25) pour ne plus bricoler. Raison : decouvert en testant (3 essais). (export JAVA_HOME jdk25) pour ne plus bricoler. Raison : decouvert en testant (3 essais).
- M1 LIVRE 2026-10-18 23:40 : worldgen amethyste/titane calibre wiki (size 8, trapezoid 6-10, - M1 LIVRE 2026-10-18 23:40 : worldgen amethyste/titane calibre wiki (size 8, trapezoid 6-10,
placed deep 25-40 + injection 4 biomes deep ocean), /pala orestats (scan + histo Y). placed deep 25-40 + injection 4 biomes deep ocean), /pala orestats (scan + histo Y).
- M2 LIVRE (partiel) 2026-10-18 23:45 : tooltip XP POG via composant LORE serveur
(ItemLore verifie au javap ; niveau + "XP : x / seuil" maj a chaque casse, ligne MAX au niv.25 ;
conserve sur evolution). Craft POG VERIFIE dans data (pattern "#AB/C/C" = 1 pioche amethyste +
1 paladium + 1 titane + 2 sticks paladium, conforme wiki). Seuils legacy conserves (25..3500).
VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED : affichage tooltip en jeu
(pas de joueur), paliers OS wiki non implementes (TODO:pog-os : seuils one-shot 11/21/26/31.
Raison : M2 lore d'abord, OS ensuite).
placed deep 25-40 + injection 4 biomes deep ocean), /pala orestats (scan + histo Y).
VERIFIE : build SUCCESSFUL, boot Done (0.345s), config persistee ("config existante"), VERIFIE : build SUCCESSFUL, boot Done (0.345s), config persistee ("config existante"),
0 ERROR/Exception/datapack au log. UNVERIFIED en jeu : /pala orestats (pas de joueur connecte 0 ERROR/Exception/datapack au log. UNVERIFIED en jeu : /pala orestats (pas de joueur connecte
pendant le test) + distribution reelle sur nouveaux chunks. pendant le test) + distribution reelle sur nouveaux chunks.
@@ -48,6 +48,7 @@ public final class PalaToolEvents {
private static final Set<Item> GOD_PICKAXES = new HashSet<>(); private static final Set<Item> GOD_PICKAXES = new HashSet<>();
private static final Map<Item, GodLevel> GOD_UPGRADES = new java.util.HashMap<>(); private static final Map<Item, GodLevel> GOD_UPGRADES = new java.util.HashMap<>();
private static final Map<Item, Integer> GOD_NUMBERS = new java.util.HashMap<>();
static { static {
Item base = PalaItems.PICKAXE_OF_THE_GOD; Item base = PalaItems.PICKAXE_OF_THE_GOD;
@@ -83,6 +84,9 @@ public final class PalaToolEvents {
for (Item item : chain) { for (Item item : chain) {
GOD_PICKAXES.add(item); GOD_PICKAXES.add(item);
} }
for (int i = 0; i < chain.length; i++) {
GOD_NUMBERS.put(chain[i], i);
}
for (int i = 0; i < thresholds.length; i++) { for (int i = 0; i < thresholds.length; i++) {
GOD_UPGRADES.put(chain[i], new GodLevel(chain[i], thresholds[i], chain[i + 1])); GOD_UPGRADES.put(chain[i], new GodLevel(chain[i], thresholds[i], chain[i + 1]));
} }
@@ -112,21 +116,28 @@ public final class PalaToolEvents {
if (held != null && GOD_PICKAXES.contains(held)) { if (held != null && GOD_PICKAXES.contains(held)) {
if (held == PalaItems.PICKAXE_OF_THE_GOD_LEVEL25) { if (held == PalaItems.PICKAXE_OF_THE_GOD_LEVEL25) {
sp.giveExperiencePoints(1); sp.giveExperiencePoints(1);
setGodLore(hand, 25, -1, -1);
} else { } else {
GodLevel upgrade = GOD_UPGRADES.get(held); GodLevel upgrade = GOD_UPGRADES.get(held);
if (upgrade != null) { if (upgrade != null) {
double value = hand.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY) double value = hand.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY)
.copyTag().getDoubleOr("level", -1.0) + 1.0; .copyTag().getDoubleOr("level", -1.0) + 1.0;
int godLevel = GOD_NUMBERS.getOrDefault(held, 0);
if (value >= upgrade.threshold()) { if (value >= upgrade.threshold()) {
sp.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(upgrade.next(), 1)); ItemStack evolved = new ItemStack(upgrade.next(), 1);
GodLevel next = GOD_UPGRADES.get(upgrade.next());
setGodLore(evolved, godLevel + 1, 0,
next == null ? -1 : next.threshold());
sp.setItemSlot(EquipmentSlot.MAINHAND, evolved);
sp.sendSystemMessage(Component.literal("§2Your " sp.sendSystemMessage(Component.literal("§2Your "
+ new ItemStack(held).getItemName().getString() + new ItemStack(held).getItemName().getString()
+ " §2Leveled Up to " + " §2Leveled Up to "
+ new ItemStack(upgrade.next()).getItemName().getString())); + evolved.getItemName().getString()));
} else { } else {
final double stored = value; final double stored = value;
CustomData.update(DataComponents.CUSTOM_DATA, hand, CustomData.update(DataComponents.CUSTOM_DATA, hand,
tag -> tag.putDouble("level", stored)); tag -> tag.putDouble("level", stored));
setGodLore(hand, godLevel, stored, upgrade.threshold());
sp.sendOverlayMessage(Component.literal("§6You Need to Mine " sp.sendOverlayMessage(Component.literal("§6You Need to Mine "
+ (int) (upgrade.threshold() - stored) + " §6To Level Up")); + (int) (upgrade.threshold() - stored) + " §6To Level Up"));
} }
@@ -295,4 +306,20 @@ public final class PalaToolEvents {
static boolean isGodPickaxe(Item item) { static boolean isGodPickaxe(Item item) {
return GOD_PICKAXES.contains(item); return GOD_PICKAXES.contains(item);
} }
// M2 (wiki POG, VERIFIE) : le niveau est dans le nom (lang), le nombre d'XP vers le
// niveau suivant va dans le tooltip via le composant LORE (serveur -> client vanilla).
// stored/threshold < 0 : ligne MAX (niveau 25) ou objectif inconnu.
private static void setGodLore(ItemStack stack, int level, double stored, double threshold) {
java.util.List<Component> lines;
if (stored < 0 || threshold < 0) {
lines = java.util.List.of(Component.literal("§6Niveau " + level + " §8(MAX)"));
} else {
lines = java.util.List.of(
Component.literal("§6Niveau " + level),
Component.literal("§7XP : " + (int) stored + " / " + (int) threshold));
}
stack.set(DataComponents.LORE,
new net.minecraft.world.item.component.ItemLore(lines));
}
} }
Binary file not shown.