pala M-alchi-2: lightning potion (capture eclair, mort si bue)

This commit is contained in:
Anaïs Saraiva
2026-10-19 06:37:51 +02:00
parent 1e29bfef67
commit 4195574341
9 changed files with 52 additions and 4 deletions
+5
View File
@@ -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
@@ -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)));
@@ -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);
@@ -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) {
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "pala:item/lightning_potion"
}
}
@@ -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",
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "pala:item/lightning_potion"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.