diff --git a/PALAMOD_CDC.md b/PALAMOD_CDC.md index 0e8ca24..a6c70e7 100644 --- a/PALAMOD_CDC.md +++ b/PALAMOD_CDC.md @@ -689,6 +689,11 @@ avant M4 (TODO:crafts-machines). Datapack = validation JSON, toujours rebooter apres recette. ECART : positions craft UNVERIFIED, extracteur sans texture (TODO:M-alchi-extracteur), arbes a seve absents (TODO:M-trees). VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu. +- M-alchi-2 LIVRE 2026-10-19 ~06:35 : lightning potion (capture eclair via afterDamage + + casque fer/or + fiole vanilla, 30 XP@1, degats conserves ; la boire = mort HARM 5). + Correction CDC : craft extracteur = sticks+core+planches+fake water (lingots+eau = + REPARATION palamachine). Lecon : variable locale `entity` masque le parametre (nommer + `drop`). VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu (orage). - 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 diff --git a/mods/pala/src/main/java/fr/surviepote/pala/PalaItems.java b/mods/pala/src/main/java/fr/surviepote/pala/PalaItems.java index a025fa5..1a886c3 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/PalaItems.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/PalaItems.java @@ -123,6 +123,10 @@ public final class PalaItems { // M-alchi-1 (wiki alchimiste) : fiole (stack 16, craft 5 verres shapeless ECART // positions, XP craft 0.2@1). Extracteur : texture absente (TODO:M-alchi-extracteur). public static final Item FLASK = register("flask", id -> new Item(new Item.Properties().setId(id).stacksTo(16))); + // M-alchi-2 (wiki objets alchimiste) : lightning potion — capture d'eclair (hook + // afterDamage), la boire = mort instantanee (HARM amp 5 ~ 192 dmg). Obtention = + // capture uniquement (pas de craft wiki, ECART correct). + public static final Item LIGHTNING_POTION = register("lightning_potion", id -> new Item(new Item.Properties().setId(id).stacksTo(1).food(new FoodProperties(0, 0.0F, true), net.minecraft.world.item.component.Consumable.builder().animation(net.minecraft.world.item.ItemUseAnimation.DRINK).onConsume(new net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.INSTANT_DAMAGE, 1, 5), 1.0F)).build()))); // M-gadget-8 (wiki ID 5023/5029) : cagoule (cosmetique, UNBREAKABLE) + masque de // garde (stats fer). Sans craft (ECART lucky). public static final Item BALACLAVA = register("balaclava", id -> new Item(new Item.Properties().setId(id).durability(1).humanoidArmor(PalaArmorMaterials.BALACLAVA, ArmorType.HELMET).component(DataComponents.UNBREAKABLE, Unit.INSTANCE))); diff --git a/mods/pala/src/main/java/fr/surviepote/pala/PalaTabs.java b/mods/pala/src/main/java/fr/surviepote/pala/PalaTabs.java index dda8c93..c6d4181 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/PalaTabs.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/PalaTabs.java @@ -79,6 +79,7 @@ public final class PalaTabs { output.accept(PalaItems.BALACLAVA); output.accept(PalaItems.GUARD_MASK); output.accept(PalaItems.FLASK); + output.accept(PalaItems.LIGHTNING_POTION); output.accept(PalaItems.CANDY); output.accept(PalaItems.CANDY_BLUE); output.accept(PalaItems.CANDY_GREEN); diff --git a/mods/pala/src/main/java/fr/surviepote/pala/events/PalaJobEvents.java b/mods/pala/src/main/java/fr/surviepote/pala/events/PalaJobEvents.java index ca9b097..fd53e7d 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/events/PalaJobEvents.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/events/PalaJobEvents.java @@ -39,13 +39,14 @@ public final class PalaJobEvents { // M-gadget-5 (wiki ID 5035) : epee couac — bruit de poulet a chaque coup porte // avec l'epee en main (tueur = source directe, item en main principale). + // M-alchi-2 (wiki objets alchimiste) : capture d'eclair — foudre sur joueur avec + // casque fer/or + fiole vanilla en main = 1 fiole -> lightning potion + 30 XP@1. + // Degats conserves (risque de mort fidele au wiki). private static void afterDamage(LivingEntity entity, DamageSource source, float dealt, float taken, boolean blocked) { Entity killer = source.getEntity(); - if (!(killer instanceof ServerPlayer player)) { - return; - } - if (player.getMainHandItem().is(fr.surviepote.pala.PalaItems.COUAC_SWORD)) { + if (killer instanceof ServerPlayer player + && player.getMainHandItem().is(fr.surviepote.pala.PalaItems.COUAC_SWORD)) { ServerLevel level = player.level(); BlockPos pos = player.blockPosition(); // ECART 26.3 : CHICKEN_AMBIENT remplace par variants (ChickenSoundVariants, @@ -54,6 +55,30 @@ public final class PalaJobEvents { net.minecraft.sounds.SoundEvents.CHICKEN_EGG, net.minecraft.sounds.SoundSource.PLAYERS, 1.0F, 1.0F); } + if (entity instanceof ServerPlayer victim + && source.is(net.minecraft.world.damagesource.DamageTypes.LIGHTNING_BOLT)) { + net.minecraft.world.item.ItemStack head = + victim.getItemBySlot(net.minecraft.world.entity.EquipmentSlot.HEAD); + boolean helmet = head.is(net.minecraft.world.item.Items.IRON_HELMET) + || head.is(net.minecraft.world.item.Items.GOLDEN_HELMET); + net.minecraft.world.item.ItemStack hand = victim.getMainHandItem(); + if (helmet && hand.is(net.minecraft.world.item.Items.GLASS_BOTTLE)) { + hand.shrink(1); + net.minecraft.world.item.ItemStack potion = new net.minecraft.world.item.ItemStack( + fr.surviepote.pala.PalaItems.LIGHTNING_POTION, 1); + if (!victim.getInventory().add(potion)) { + net.minecraft.world.entity.item.ItemEntity drop = + new net.minecraft.world.entity.item.ItemEntity(victim.level(), + victim.getX(), victim.getY(), victim.getZ(), potion); + victim.level().addFreshEntity(drop); + } + if (fr.surviepote.pala.core.PalaJobs.levelOf(victim, "alchimiste") >= 1) { + fr.surviepote.pala.core.PalaJobs.addXp(victim, "alchimiste", 30.0); + } + victim.sendSystemMessage(net.minecraft.network.chat.Component.literal( + "§6[Alchimiste] §7Eclair capture dans la fiole !")); + } + } } private static void afterDeath(LivingEntity entity, DamageSource source) { diff --git a/mods/pala/src/main/resources/assets/pala/items/lightning_potion.json b/mods/pala/src/main/resources/assets/pala/items/lightning_potion.json new file mode 100644 index 0000000..53ec0da --- /dev/null +++ b/mods/pala/src/main/resources/assets/pala/items/lightning_potion.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "pala:item/lightning_potion" + } +} \ No newline at end of file diff --git a/mods/pala/src/main/resources/assets/pala/lang/en_us.json b/mods/pala/src/main/resources/assets/pala/lang/en_us.json index 3e883ce..7a53ad5 100644 --- a/mods/pala/src/main/resources/assets/pala/lang/en_us.json +++ b/mods/pala/src/main/resources/assets/pala/lang/en_us.json @@ -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.lightning_potion": "Lightning Potion", "item.pala.flask": "Fiole", "item.pala.balaclava": "Cagoule", "item.pala.guard_mask": "Masque de garde", diff --git a/mods/pala/src/main/resources/assets/pala/models/item/lightning_potion.json b/mods/pala/src/main/resources/assets/pala/models/item/lightning_potion.json new file mode 100644 index 0000000..7a9d356 --- /dev/null +++ b/mods/pala/src/main/resources/assets/pala/models/item/lightning_potion.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "pala:item/lightning_potion" + } +} \ No newline at end of file diff --git a/mods/pala/src/main/resources/assets/pala/textures/item/lightning_potion.png b/mods/pala/src/main/resources/assets/pala/textures/item/lightning_potion.png new file mode 100644 index 0000000..241e318 Binary files /dev/null and b/mods/pala/src/main/resources/assets/pala/textures/item/lightning_potion.png differ diff --git a/server/mods/pala-0.2.1.jar b/server/mods/pala-0.2.1.jar index c6724b4..c3e450f 100644 Binary files a/server/mods/pala-0.2.1.jar and b/server/mods/pala-0.2.1.jar differ