pala M-mineur-xp: gates niveaux, XP cuisson, XP hammer, bonbon jaune

This commit is contained in:
Anaïs Saraiva
2026-10-19 03:56:22 +02:00
parent 588e516dbe
commit 8c4a6748ef
8 changed files with 88 additions and 22 deletions
+7
View File
@@ -591,6 +591,13 @@ avant M4 (TODO:crafts-machines).
vert = +50 000 XP fermier, rainbow = +50 000 aux 4 metiers (wiki VERIFIE). Autres couleurs vert = +50 000 XP fermier, rainbow = +50 000 aux 4 metiers (wiki VERIFIE). Autres couleurs
= mapping non publie (TODO:mapping-bonbons, sans effet). VERIFIE : build SUCCESSFUL, boot = mapping non publie (TODO:mapping-bonbons, sans effet). VERIFIE : build SUCCESSFUL, boot
Done, 0 erreur, lang 228 cles. UNVERIFIED en jeu. Done, 0 erreur, lang 228 cles. UNVERIFIED en jeu.
- M-mineur-xp LIVRE 2026-10-19 ~03:55 : page Evolution mineur relue en live : gates niveau
par bloc (minerLevels, niv.1/5), XP cuisson (8 entrees : brique 0.1@1, charbon 6@1, fer
8@2, or 30@4, amethyste 35@5, titane 50@7, paladium 150@10, green 200@12, centralisees
dans PalaJobs.onSmeltTake), XP hammer par bloc (choix du chiffre 4,5 = 9x0,5, contradiction
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-palaforge LIVRE 2026-10-19 ~03:55 : bloc + BE partagee (3e mode) + gate mineur 14 + - 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, 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 lave exclue : seau non rendu) + craft (1 findium + 4 furnaces + 4 briques, positions
@@ -59,9 +59,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 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 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))); public static final Item XP_BERRIES = register("xp_berries", id -> new Item(new Item.Properties().setId(id)));
// M-candy (wiki metiers, VERIFIE partiel) : bonbons 50 000 XP. Vert = fermier et // M-candy (wiki metiers, VERIFIE partiel) : bonbons 50 000 XP. Vert = fermier,
// rainbow = tous (pages Evolution) ; autres couleurs = mapping non publie (items seuls, // jaune = mineur, rainbow = tous (pages Evolution) ; bleu/rose = mapping non publie
// TODO:mapping-bonbons) ; candy/job_candy = nature inconnue (items seuls). // (items seuls, TODO:mapping-bonbons) ; candy/job_candy = nature inconnue (items seuls).
public static final Item CANDY = register("candy", id -> new Item(new Item.Properties().setId(id))); public static final Item CANDY = register("candy", id -> new Item(new Item.Properties().setId(id)));
public static final Item CANDY_BLUE = register("candy_blue", id -> new Item(new Item.Properties().setId(id))); public static final Item CANDY_BLUE = register("candy_blue", id -> new Item(new Item.Properties().setId(id)));
public static final Item CANDY_GREEN = register("candy_green", id -> new Item(new Item.Properties().setId(id))); public static final Item CANDY_GREEN = register("candy_green", id -> new Item(new Item.Properties().setId(id)));
@@ -43,9 +43,24 @@ public final class PalaConfig {
Map.entry("pala:paladium_green_ore", 20.0), Map.entry("pala:trixium_ore", 10.0), Map.entry("pala:paladium_green_ore", 20.0), Map.entry("pala:trixium_ore", 10.0),
Map.entry("pala:findium_ore", 10.0))); Map.entry("pala:findium_ore", 10.0)));
// Courbe XP : seuils wiki VERIFIES (page Evolution mineur, "XP necessaire" : les points // M-mineur-xp (wiki Evolution mineur, VERIFIE) : niveaux requis par bloc.
// sont des separateurs de milliers : 22.123 = 22 123). Niveaux 2-20 en table exacte ; // Niv.1 : roche/diorite/charbon/quartz/obsidienne/lapis/redstone/emeraude ;
// au-dela : formule de prolongation (xpBase * n^xpExponent, UNVERIFIED). La table mineur // niv.5 : fer/or/diamant/amethyste/titane (+ minerais pala par interpretation
// "Particules paladium 20@5", ECART documente).
public Map<String, Integer> minerLevels = new HashMap<>(Map.ofEntries(
Map.entry("minecraft:stone", 1),
Map.entry("minecraft:diorite", 1), Map.entry("minecraft:andesite", 1),
Map.entry("minecraft:coal_ore", 1), Map.entry("minecraft:deepslate_coal_ore", 1),
Map.entry("minecraft:quartz_ore", 1), Map.entry("minecraft:obsidian", 1),
Map.entry("minecraft:lapis_ore", 1), Map.entry("minecraft:redstone_ore", 1),
Map.entry("minecraft:emerald_ore", 1), Map.entry("minecraft:deepslate_emerald_ore", 1),
Map.entry("minecraft:iron_ore", 5), Map.entry("minecraft:deepslate_iron_ore", 5),
Map.entry("minecraft:gold_ore", 5), Map.entry("minecraft:deepslate_gold_ore", 5),
Map.entry("minecraft:diamond_ore", 5), Map.entry("minecraft:deepslate_diamond_ore", 5),
Map.entry("pala:amethyst_ore", 5), Map.entry("pala:titane_ore", 5),
Map.entry("pala:paladium_ore", 5), Map.entry("pala:paladium_green_ore", 5),
Map.entry("pala:trixium_ore", 5), Map.entry("pala:findium_ore", 5)));
// Courbe XP (M-xpcurve) : seuils wiki VERIFIES 2-20, formule au-dela. La table mineur
// s'applique aux 4 metiers (seule table publiee ; ECART documente). // s'applique aux 4 metiers (seule table publiee ; ECART documente).
public double xpBase = 100.0; public double xpBase = 100.0;
public double xpExponent = 1.5; public double xpExponent = 1.5;
@@ -164,6 +179,9 @@ public final class PalaConfig {
if (loaded.minerXp != null && !loaded.minerXp.isEmpty()) { if (loaded.minerXp != null && !loaded.minerXp.isEmpty()) {
instance.minerXp = loaded.minerXp; instance.minerXp = loaded.minerXp;
} }
if (loaded.minerLevels != null && !loaded.minerLevels.isEmpty()) {
instance.minerLevels = loaded.minerLevels;
}
if (loaded.xpBase > 0) { if (loaded.xpBase > 0) {
instance.xpBase = loaded.xpBase; instance.xpBase = loaded.xpBase;
} }
@@ -205,8 +223,8 @@ public final class PalaConfig {
// absents gardent leurs valeurs par defaut, jamais null), on re-sauvegarde // absents gardent leurs valeurs par defaut, jamais null), on re-sauvegarde
// pour les materialiser si une cle attendue manque. Une table explicitement // pour les materialiser si une cle attendue manque. Une table explicitement
// videe (cle presente, tableau vide) est respectee telle quelle. // videe (cle presente, tableau vide) est respectee telle quelle.
java.util.Set<String> expected = java.util.Set.of("minerXp", "xpBase", java.util.Set<String> expected = java.util.Set.of("minerXp", "minerLevels",
"xpExponent", "levelThresholds", "netherMinerLevel", "stickCooldowns", "xpBase", "xpExponent", "levelThresholds", "netherMinerLevel", "stickCooldowns",
"rankNodes", "hunterKills", "farmerHarvest", "crusherXp", "rankNodes", "hunterKills", "farmerHarvest", "crusherXp",
"crusherResults", "crusherFuels", "crusherInfiniteFuels", "crusherResults", "crusherFuels", "crusherInfiniteFuels",
"furnaceSmelts", "furnaceFuels", "furnaceSmelts", "furnaceFuels",
@@ -49,7 +49,7 @@ public final class PalaJobs {
return data.level; return data.level;
} }
/** Hook casse-bloc : XP mineur selon la table config. Appele depuis PalaToolEvents. */ /** Hook casse-bloc : XP mineur selon la table config + niveau requis (wiki). */
public static void onBlockBreak(ServerPlayer player, ServerLevel level, BlockPos pos, BlockState state) { public static void onBlockBreak(ServerPlayer player, ServerLevel level, BlockPos pos, BlockState state) {
Identifier id = level.registryAccess() Identifier id = level.registryAccess()
.lookupOrThrow(net.minecraft.core.registries.Registries.BLOCK) .lookupOrThrow(net.minecraft.core.registries.Registries.BLOCK)
@@ -58,8 +58,42 @@ public final class PalaJobs {
return; return;
} }
Double xp = PalaConfig.get().minerXp.get(id.toString()); Double xp = PalaConfig.get().minerXp.get(id.toString());
if (xp != null) { if (xp != null && levelOf(player, "mineur") >= PalaConfig.get().minerLevels
.getOrDefault(id.toString(), 0)) {
addXp(player, "mineur", xp); addXp(player, "mineur", xp);
} }
} }
/** Hook prise fourneau : cuisson mineur (table wiki "Cuire") + viandes chasseur. */
public static void onSmeltTake(ServerPlayer player, net.minecraft.world.item.ItemStack stack) {
if (stack.isEmpty()) {
return;
}
String id = net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem())
.toString();
// Viandes chasseur (wiki : 10 XP, sauf lapin).
boolean viande = id.equals("minecraft:cooked_beef") || id.equals("minecraft:cooked_mutton")
|| id.equals("minecraft:cooked_porkchop") || id.equals("minecraft:cooked_chicken");
if (viande) {
if (levelOf(player, "chasseur") >= 1) {
addXp(player, "chasseur", 10.0 * stack.getCount());
}
return;
}
// Cuisson mineur : [xp, niveau] (wiki "Cuire les objets").
double[] table = SMELT_MINER.get(id);
if (table != null && levelOf(player, "mineur") >= (int) table[1]) {
addXp(player, "mineur", table[0] * stack.getCount());
}
}
private static final java.util.Map<String, double[]> SMELT_MINER = java.util.Map.of(
"minecraft:nether_brick", new double[]{0.1, 1},
"minecraft:charcoal", new double[]{6, 1},
"minecraft:iron_ingot", new double[]{8, 2},
"minecraft:gold_ingot", new double[]{30, 4},
"pala:amethyst_ingot", new double[]{35, 5},
"pala:titane_ingot", new double[]{50, 7},
"pala:paladium_ingot", new double[]{150, 10},
"pala:paladium_green_ingot", new double[]{200, 12});
} }
@@ -118,13 +118,18 @@ public final class PalaItemUseEvents {
stack.shrink(1); stack.shrink(1);
return InteractionResult.PASS; return InteractionResult.PASS;
} }
// M-candy (wiki metiers) : bonbon vert = +50 000 XP fermier, rainbow = +50 000 aux // M-candy (wiki metiers) : bonbon vert = +50 000 XP fermier, jaune = mineur,
// 4 metiers. Autres couleurs : mapping non publie (TODO:mapping-bonbons, sans effet). // rainbow = +50 000 aux 4 metiers. Bleu/rose : mapping non publie (sans effet).
if (item == PalaItems.CANDY_GREEN) { if (item == PalaItems.CANDY_GREEN) {
fr.surviepote.pala.core.PalaJobs.addXp(sp, "fermier", 50000.0); fr.surviepote.pala.core.PalaJobs.addXp(sp, "fermier", 50000.0);
stack.shrink(1); stack.shrink(1);
return InteractionResult.PASS; return InteractionResult.PASS;
} }
if (item == PalaItems.CANDY_YELLOW) {
fr.surviepote.pala.core.PalaJobs.addXp(sp, "mineur", 50000.0);
stack.shrink(1);
return InteractionResult.PASS;
}
if (item == PalaItems.CANDY_RAINBOW) { if (item == PalaItems.CANDY_RAINBOW) {
for (String job : fr.surviepote.pala.core.PalaJobs.JOBS) { for (String job : fr.surviepote.pala.core.PalaJobs.JOBS) {
fr.surviepote.pala.core.PalaJobs.addXp(sp, job, 50000.0); fr.surviepote.pala.core.PalaJobs.addXp(sp, job, 50000.0);
@@ -359,7 +359,16 @@ public final class PalaToolEvents {
if (state.getDestroySpeed(level, target) < 0.0F) { if (state.getDestroySpeed(level, target) < 0.0F) {
continue; continue;
} }
level.destroyBlock(target, true, player, 512); // M-mineur-xp (wiki : "avec un hammer vous gagnez 4,5 par coup" = 9 x 0,5) :
// chaque bloc casse donne son XP mineur (gate niveau + pas de silk-touch).
// ECART : contredit "miner avec un hammer ne rapporte pas d'XP" (meme page) ;
// choix du chiffre (4,5 = 9 blocs), documente.
if (level.destroyBlock(target, true, player, 512)) {
ItemStack hand = player.getMainHandItem();
if (!hasSilkTouch(level, hand)) {
fr.surviepote.pala.core.PalaJobs.onBlockBreak(player, level, target, state);
}
}
} }
} }
@@ -19,15 +19,8 @@ public class PalaSmeltXpMixin {
@Inject(method = "onTake", at = @At("TAIL")) @Inject(method = "onTake", at = @At("TAIL"))
private void pala$smeltXp(Player player, ItemStack stack, CallbackInfo ci) { private void pala$smeltXp(Player player, ItemStack stack, CallbackInfo ci) {
if (!(player instanceof ServerPlayer sp) || stack.isEmpty()) { if (player instanceof ServerPlayer sp) {
return; PalaJobs.onSmeltTake(sp, stack);
}
String id = net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem())
.toString();
boolean viande = id.equals("minecraft:cooked_beef") || id.equals("minecraft:cooked_mutton")
|| id.equals("minecraft:cooked_porkchop") || id.equals("minecraft:cooked_chicken");
if (viande && PalaJobs.levelOf(sp, "chasseur") >= 1) {
PalaJobs.addXp(sp, "chasseur", 10.0 * stack.getCount());
} }
} }
} }
Binary file not shown.