diff --git a/PALAMOD_CDC.md b/PALAMOD_CDC.md index f0c7c62..6cbf9a8 100644 --- a/PALAMOD_CDC.md +++ b/PALAMOD_CDC.md @@ -757,6 +757,12 @@ avant M4 (TODO:crafts-machines). Lecon : shapeless 26.3 = ingredients STRINGS (objets {item} rejetes "List too short", crash datapacks). VERIFIE : build SUCCESSFUL, boot Done, 0 erreur. UNVERIFIED en jeu (degats, peche, visuel cast). +- M-hunter-5 LIVRE 2026-10-19 ~08:25 : capture sword/stone (coup + pierre vide -> + capture type en CUSTOM_DATA vanilla, pattern POG ; pierre pleine -> relache + raycast + rend vide ; wither hors-overworld ECART "minages" ; epee sans craft + ECART ingrédients, pierre craftee 9 shapeless). Lecon : ENTITY_TYPE.getValue + retourne direct (@Nullable, pas Optional) ; CompoundTag.getString = Optional. + 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 + 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 8446970..685e127 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/PalaItems.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/PalaItems.java @@ -145,6 +145,13 @@ public final class PalaItems { // gameplay), sans bonus invente ; gate craft chasseur 4 non applicable (pas de // gates craft). Textures legacy cast/uncast. public static final Item PALADIUM_FISHING_ROD = register("paladium_fishing_rod", id -> new net.minecraft.world.item.FishingRodItem(new Item.Properties().setId(id).stacksTo(1).durability(384))); + // M-hunter-5 (wiki niv.13/14 VERIFIE : epee 32 utilisations, 1 pierre = 1 ame, + // pleines non stackables, epee utilisable avant niv.13) : capture d'entites. + // ECART : degats epee non publies (Item simple), crafts exacts (positions image + // non OCR + strength stick/tete epee sans ids -> pierre seule craftee, epee sans). + public static final Item CAPTURE_SWORD = register("capture_sword", id -> new Item(new Item.Properties().setId(id).stacksTo(1).durability(32))); + public static final Item CAPTURE_STONE_EMPTY = register("capture_stone_empty", id -> new Item(new Item.Properties().setId(id))); + public static final Item CAPTURE_STONE_FULL = register("capture_stone_full", id -> new Item(new Item.Properties().setId(id).stacksTo(1))); public static final Item INFERNAL_KNOCKER = register("infernal_knocker", id -> new Item(new Item.Properties().setId(id).stacksTo(1).component(DataComponents.ATTRIBUTE_MODIFIERS, net.minecraft.world.item.component.ItemAttributeModifiers.builder().add( net.minecraft.world.entity.ai.attributes.Attributes.ATTACK_DAMAGE, 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 0d2ab6e..80471ef 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/PalaTabs.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/PalaTabs.java @@ -84,6 +84,9 @@ public final class PalaTabs { output.accept(PalaItems.CAVE_HAMMER); output.accept(PalaItems.INFERNAL_KNOCKER); output.accept(PalaItems.PALADIUM_FISHING_ROD); + output.accept(PalaItems.CAPTURE_SWORD); + output.accept(PalaItems.CAPTURE_STONE_EMPTY); + output.accept(PalaItems.CAPTURE_STONE_FULL); output.accept(PalaItems.SPAWNER_FINDER); output.accept(PalaItems.DYNAMITE); output.accept(PalaItems.NINJA_DYNAMITE); diff --git a/mods/pala/src/main/java/fr/surviepote/pala/events/PalaItemUseEvents.java b/mods/pala/src/main/java/fr/surviepote/pala/events/PalaItemUseEvents.java index cf8555e..2bc8dcc 100644 --- a/mods/pala/src/main/java/fr/surviepote/pala/events/PalaItemUseEvents.java +++ b/mods/pala/src/main/java/fr/surviepote/pala/events/PalaItemUseEvents.java @@ -173,6 +173,43 @@ public final class PalaItemUseEvents { stack.hurtAndBreak(1, sp, hand); return InteractionResult.SUCCESS; } + // M-hunter-5 : pierre pleine — clic droit air, relache la creature visee + // (raycast 32, ECART : rend une pierre vide, spawn TRIGGERED). + if (item == PalaItems.CAPTURE_STONE_FULL) { + String typeId = stack.getOrDefault( + net.minecraft.core.component.DataComponents.CUSTOM_DATA, + net.minecraft.world.item.component.CustomData.EMPTY).copyTag() + .getString("pala:capture").orElse(""); + if (typeId.isEmpty()) { + sp.sendSystemMessage(net.minecraft.network.chat.Component.literal( + "§cPierre vide (aucune ame).")); + return InteractionResult.PASS; + } + net.minecraft.world.phys.Vec3 start = sp.getEyePosition(); + net.minecraft.world.phys.Vec3 look = sp.getLookAngle(); + net.minecraft.world.phys.Vec3 end = start.add(look.x * 32.0, look.y * 32.0, look.z * 32.0); + net.minecraft.world.phys.BlockHitResult hit = sl.clip( + new net.minecraft.world.level.ClipContext(start, end, + net.minecraft.world.level.ClipContext.Block.OUTLINE, + net.minecraft.world.level.ClipContext.Fluid.NONE, sp)); + if (hit.getType() != net.minecraft.world.phys.HitResult.Type.BLOCK) { + return InteractionResult.PASS; + } + net.minecraft.world.entity.EntityType type = net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE + .getValue(net.minecraft.resources.Identifier.parse(typeId)); + if (type == null) { + return InteractionResult.PASS; + } + net.minecraft.core.BlockPos target = hit.getBlockPos().above(); + net.minecraft.world.entity.Entity spawned = type.spawn(sl, target, + net.minecraft.world.entity.EntitySpawnReason.TRIGGERED); + if (spawned == null) { + return InteractionResult.PASS; + } + stack.shrink(1); + sp.addItem(new net.minecraft.world.item.ItemStack(PalaItems.CAPTURE_STONE_EMPTY, 1)); + return InteractionResult.SUCCESS; + } // M-pillage-1 (wiki ID 4640/4641/4642) : dynamites — clic droit air, explosion // au point vise (raycast 32). Ninja = sans son. if (item == PalaItems.DYNAMITE || item == PalaItems.NINJA_DYNAMITE 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 dd5967d..06a4a69 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 @@ -94,6 +94,38 @@ public final class PalaJobEvents { } // M-hunter-2/4 (wiki niv.9) : infernal knocker — knockback amplifie sur wither // quand tenu en main (x3 direction du coup ; 4 degats via attribut M-hunter-4). + // M-hunter-5 (wiki niv.13/14) : epee de capture — coup sur creature capturable + // + pierre vide en inventaire -> capture (type en CUSTOM_DATA), 1 utilisation. + if (killer instanceof ServerPlayer catcher + && catcher.getMainHandItem().is(fr.surviepote.pala.PalaItems.CAPTURE_SWORD)) { + String captured = capturableId(entity, catcher.level()); + if (captured != null) { + net.minecraft.world.entity.player.Inventory inv = catcher.getInventory(); + for (int i = 0; i < inv.getContainerSize(); i++) { + net.minecraft.world.item.ItemStack slot = inv.getItem(i); + if (slot.is(fr.surviepote.pala.PalaItems.CAPTURE_STONE_EMPTY)) { + final String typeId = captured; + slot.shrink(1); + net.minecraft.world.item.ItemStack full = new net.minecraft.world.item.ItemStack( + fr.surviepote.pala.PalaItems.CAPTURE_STONE_FULL, 1); + net.minecraft.world.item.component.CustomData.update( + net.minecraft.core.component.DataComponents.CUSTOM_DATA, + full, tag -> tag.putString("pala:capture", typeId)); + if (!inv.add(full)) { + net.minecraft.world.entity.item.ItemEntity drop = new net.minecraft.world.entity.item.ItemEntity( + catcher.level(), catcher.getX(), catcher.getY(), catcher.getZ(), full); + catcher.level().addFreshEntity(drop); + } + entity.discard(); + catcher.getMainHandItem().hurtAndBreak(1, catcher, + net.minecraft.world.entity.EquipmentSlot.MAINHAND); + catcher.sendSystemMessage(net.minecraft.network.chat.Component.literal( + "§aCreature capturee : " + typeId)); + break; + } + } + } + } if (killer instanceof ServerPlayer knocker && knocker.getMainHandItem().is(fr.surviepote.pala.PalaItems.INFERNAL_KNOCKER) && entity.getType() == net.minecraft.world.entity.EntityTypes.WITHER) { @@ -147,6 +179,25 @@ public final class PalaJobEvents { } } + // M-hunter-5 : creatures capturables (wiki VERIFIE, vanilla uniquement ; moddees + // SKIP M8). Wither : uniquement "dans les minages" -> ECART : hors overworld. + private static final java.util.Set CAPTURABLES = java.util.Set.of( + "minecraft:pig", "minecraft:cow", "minecraft:sheep", "minecraft:slime", + "minecraft:zombie", "minecraft:creeper", "minecraft:rabbit", "minecraft:horse", + "minecraft:chicken", "minecraft:turtle", "minecraft:panda", "minecraft:dolphin", + "minecraft:parrot", "minecraft:goat"); + + private static String capturableId(LivingEntity entity, net.minecraft.world.level.Level level) { + String id = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); + if (CAPTURABLES.contains(id)) { + return id; + } + if (id.equals("minecraft:wither") && !level.dimension().equals(net.minecraft.world.level.Level.OVERWORLD)) { + return id; + } + return null; + } + /** Recolte vanilla : appele depuis PalaToolEvents.afterBreak (etat AVANT casse). */ public static void onHarvest(ServerPlayer player, BlockState state) { Block block = state.getBlock(); diff --git a/mods/pala/src/main/resources/assets/pala/items/capture_stone_empty.json b/mods/pala/src/main/resources/assets/pala/items/capture_stone_empty.json new file mode 100644 index 0000000..afbb7da --- /dev/null +++ b/mods/pala/src/main/resources/assets/pala/items/capture_stone_empty.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "pala:item/capture_stone_empty" + } +} diff --git a/mods/pala/src/main/resources/assets/pala/items/capture_stone_full.json b/mods/pala/src/main/resources/assets/pala/items/capture_stone_full.json new file mode 100644 index 0000000..3a51700 --- /dev/null +++ b/mods/pala/src/main/resources/assets/pala/items/capture_stone_full.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "pala:item/capture_stone_full" + } +} diff --git a/mods/pala/src/main/resources/assets/pala/items/capture_sword.json b/mods/pala/src/main/resources/assets/pala/items/capture_sword.json new file mode 100644 index 0000000..6939553 --- /dev/null +++ b/mods/pala/src/main/resources/assets/pala/items/capture_sword.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "pala:item/capture_sword" + } +} 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 42430c7..fca766e 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 @@ -10,6 +10,9 @@ "item.pala.spawner_finder": "Chercheur de spawners", "item.pala.infernal_knocker": "Infernal Knocker", "item.pala.paladium_fishing_rod": "Paladium Fishing Rod", + "item.pala.capture_sword": "Capture Sword", + "item.pala.capture_stone_empty": "Capture Stone", + "item.pala.capture_stone_full": "Full Capture Stone", "item.pala.cave_hammer": "Marteau des cavernes", "item.pala.magma_amulet": "Amulette de feu", "enchantment.pala.experience_bottler": "Experience Bottler", diff --git a/mods/pala/src/main/resources/assets/pala/models/item/capture_stone_empty.json b/mods/pala/src/main/resources/assets/pala/models/item/capture_stone_empty.json new file mode 100644 index 0000000..e6438e9 --- /dev/null +++ b/mods/pala/src/main/resources/assets/pala/models/item/capture_stone_empty.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "pala:item/capture_stone_empty" + } +} diff --git a/mods/pala/src/main/resources/assets/pala/models/item/capture_stone_full.json b/mods/pala/src/main/resources/assets/pala/models/item/capture_stone_full.json new file mode 100644 index 0000000..79fc97f --- /dev/null +++ b/mods/pala/src/main/resources/assets/pala/models/item/capture_stone_full.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "pala:item/capture_stone_full" + } +} diff --git a/mods/pala/src/main/resources/assets/pala/models/item/capture_sword.json b/mods/pala/src/main/resources/assets/pala/models/item/capture_sword.json new file mode 100644 index 0000000..ac7b142 --- /dev/null +++ b/mods/pala/src/main/resources/assets/pala/models/item/capture_sword.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "pala:item/capture_sword" + } +} diff --git a/mods/pala/src/main/resources/assets/pala/textures/item/capture_stone_empty.png b/mods/pala/src/main/resources/assets/pala/textures/item/capture_stone_empty.png new file mode 100644 index 0000000..6899bf8 Binary files /dev/null and b/mods/pala/src/main/resources/assets/pala/textures/item/capture_stone_empty.png differ diff --git a/mods/pala/src/main/resources/assets/pala/textures/item/capture_stone_full.png b/mods/pala/src/main/resources/assets/pala/textures/item/capture_stone_full.png new file mode 100644 index 0000000..f083cc5 Binary files /dev/null and b/mods/pala/src/main/resources/assets/pala/textures/item/capture_stone_full.png differ diff --git a/mods/pala/src/main/resources/assets/pala/textures/item/capture_sword.png b/mods/pala/src/main/resources/assets/pala/textures/item/capture_sword.png new file mode 100644 index 0000000..a81e70e Binary files /dev/null and b/mods/pala/src/main/resources/assets/pala/textures/item/capture_sword.png differ diff --git a/mods/pala/src/main/resources/data/pala/recipe/capturestone.json b/mods/pala/src/main/resources/data/pala/recipe/capturestone.json new file mode 100644 index 0000000..1bc5445 --- /dev/null +++ b/mods/pala/src/main/resources/data/pala/recipe/capturestone.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + "pala:compressed_amethyst", + "pala:compressed_titane", + "pala:titane_ore_block", + "minecraft:amethyst_block", + "minecraft:obsidian", + "minecraft:blaze_powder", + "minecraft:blaze_powder", + "minecraft:blaze_powder", + "minecraft:blaze_powder" + ], + "result": { + "id": "pala:capture_stone_empty", + "count": 1 + } +} diff --git a/server/mods/pala-0.2.1.jar b/server/mods/pala-0.2.1.jar index 74783db..0d8ab66 100644 Binary files a/server/mods/pala-0.2.1.jar and b/server/mods/pala-0.2.1.jar differ