pala M-mixin: pipeline mixin + XP craft (pain/tarte) et cuisson (viandes)
This commit is contained in:
@@ -563,6 +563,13 @@ avant M4 (TODO:crafts-machines).
|
||||
SUCCESS sinon la GUI ne s'ouvre pas — lecon). Tetes + modifieurs : M-grinder-4 (pas de
|
||||
textures legacy pour les tetes). VERIFIE : build SUCCESSFUL, boot Done, 0 erreur.
|
||||
UNVERIFIED en jeu (GUI + fuel).
|
||||
- M-mixin LIVRE 2026-10-19 ~03:25 : pipeline mixin sans loom (pala.mixins.json + entree
|
||||
fabric.mod.json, pas de refmap : noms Mojang non obfusques) + 2 mixins : craft (pain 1 XP
|
||||
niv.1+, tarte citrouille 4 XP niv.11+, via ResultSlot.checkTakeAchievements) et cuisson
|
||||
(4 viandes 10 XP chasseur niv.1+, lapin exclu, via FurnaceResultSlot.onTake). Signatures
|
||||
verifiees au javap. VERIFIE : build SUCCESSFUL, boot Done, 0 erreur mixin. UNVERIFIED en
|
||||
jeu (prise en main : seul un craft/fourneau avec joueur le prouvera). TODO:craft-xp et
|
||||
TODO:smelt-xp CLOS.
|
||||
- Client/mod : boucle visuelle OPERATIONNELLE 2026-10-19 (Xvfb :99 + runClient SDL x11 +
|
||||
captures Java Robot + pilotage xdotool + vision_analyze) : menu, Select World, monde New World
|
||||
(creatif, cheats), /give, pose de bloc, inventaire, F3+T. Screens : scratch vis*.png.
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package fr.surviepote.pala.mixin;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.ResultSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import fr.surviepote.pala.core.PalaJobs;
|
||||
|
||||
// M-mixin (wiki metiers, VERIFIE) : XP au craft, sans event fabric existant.
|
||||
// Fermier : pain = 1 XP (niveau 1+), tarte citrouille = 4 XP (niveau 11+), par item pris.
|
||||
// Injection en TAIL de checkTakeAchievements (appele a chaque prise du resultat).
|
||||
@Mixin(ResultSlot.class)
|
||||
public class PalaCraftXpMixin {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Player player;
|
||||
|
||||
@Inject(method = "checkTakeAchievements", at = @At("TAIL"))
|
||||
private void pala$craftXp(ItemStack stack, CallbackInfo ci) {
|
||||
if (!(player instanceof ServerPlayer sp) || stack.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String id = net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem())
|
||||
.toString();
|
||||
if (id.equals("minecraft:bread")) {
|
||||
if (PalaJobs.levelOf(sp, "fermier") >= 1) {
|
||||
PalaJobs.addXp(sp, "fermier", 1.0 * stack.getCount());
|
||||
}
|
||||
} else if (id.equals("minecraft:pumpkin_pie")) {
|
||||
if (PalaJobs.levelOf(sp, "fermier") >= 11) {
|
||||
PalaJobs.addXp(sp, "fermier", 4.0 * stack.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package fr.surviepote.pala.mixin;
|
||||
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.FurnaceResultSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import fr.surviepote.pala.core.PalaJobs;
|
||||
|
||||
// M-mixin (wiki chasseur, VERIFIE) : cuisson des viandes = 10 XP chasseur (niveau 1+),
|
||||
// par item pris. Lapin exclu (wiki : "sauf pour le lapin").
|
||||
// Injection en TAIL de onTake (signature vanilla verifiee au javap).
|
||||
@Mixin(FurnaceResultSlot.class)
|
||||
public class PalaSmeltXpMixin {
|
||||
|
||||
@Inject(method = "onTake", at = @At("TAIL"))
|
||||
private void pala$smeltXp(Player player, ItemStack stack, CallbackInfo ci) {
|
||||
if (!(player instanceof ServerPlayer sp) || stack.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
"main": ["fr.surviepote.pala.Pala"],
|
||||
"client": ["fr.surviepote.pala.PalaClient"]
|
||||
},
|
||||
"mixins": ["pala.mixins.json"],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.16.0",
|
||||
"fabric-api": "*",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "fr.surviepote.pala.mixin",
|
||||
"mixins": [
|
||||
"PalaCraftXpMixin",
|
||||
"PalaSmeltXpMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user