pala M-spawner-1: chercheur de spawners (scan 9 chunks, gate 10)
This commit is contained in:
@@ -139,6 +139,10 @@ public final class PalaItems {
|
||||
// knockback amplifie (sans degats propres, ECART chiffres). Sans craft/durabilite
|
||||
// (wiki muet, ECART).
|
||||
public static final Item INFERNAL_KNOCKER = register("infernal_knocker", id -> new Item(new Item.Properties().setId(id).stacksTo(1)));
|
||||
// M-spawner-1 (wiki pillage ID 4795) : chercheur de spawners — scan 9 chunks,
|
||||
// message presence + coords du plus proche, gate chasseur 10. Durabilite 140
|
||||
// minutes wiki => 140 usages (1/scan, ECART). Sans craft (image non OCR, ECART).
|
||||
public static final Item SPAWNER_FINDER = register("spawner_finder", id -> new Item(new Item.Properties().setId(id).stacksTo(1).durability(140)));
|
||||
// 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)));
|
||||
|
||||
@@ -83,6 +83,7 @@ public final class PalaTabs {
|
||||
output.accept(PalaItems.MAGMA_AMULET);
|
||||
output.accept(PalaItems.CAVE_HAMMER);
|
||||
output.accept(PalaItems.INFERNAL_KNOCKER);
|
||||
output.accept(PalaItems.SPAWNER_FINDER);
|
||||
output.accept(PalaItems.CANDY);
|
||||
output.accept(PalaItems.CANDY_BLUE);
|
||||
output.accept(PalaItems.CANDY_GREEN);
|
||||
|
||||
@@ -157,6 +157,22 @@ public final class PalaItemUseEvents {
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
// M-spawner-1 (wiki ID 4795) : scan 9 chunks autour du joueur, gate
|
||||
// chasseur 10, 1 usage/scan + cooldown 5 s (scan lourd ~900k blocs).
|
||||
if (item == PalaItems.SPAWNER_FINDER) {
|
||||
if (fr.surviepote.pala.core.PalaJobs.levelOf(sp, "chasseur") < 10) {
|
||||
sp.sendSystemMessage(net.minecraft.network.chat.Component.literal(
|
||||
"§cChasseur niveau 10 requis."));
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
if (sp.getCooldowns().isOnCooldown(stack)) {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
scanSpawners(sp, sl, sp.blockPosition());
|
||||
sp.getCooldowns().addCooldown(stack, 100);
|
||||
stack.hurtAndBreak(1, sp, hand);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
// M-enchants-3 (wiki ID 4849) : incrustation amulette — amulette en main +
|
||||
// plastron pala/endium en seconde main => CUSTOM_DATA "amulet" (1 slot v1).
|
||||
if (item == PalaItems.MAGMA_AMULET) {
|
||||
@@ -333,6 +349,47 @@ public final class PalaItemUseEvents {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
// M-spawner-1 : scan 3x3 chunks (9) autour du bloc vise, spawners vanilla
|
||||
// (minecraft:spawner). Message presence + coords du plus proche.
|
||||
static void scanSpawners(ServerPlayer player, ServerLevel level, BlockPos pos) {
|
||||
java.util.List<BlockPos> found = new java.util.ArrayList<>();
|
||||
int baseChunkX = (pos.getX() >> 4) - 1;
|
||||
int baseChunkZ = (pos.getZ() >> 4) - 1;
|
||||
for (int cx = 0; cx < 3; cx++) {
|
||||
for (int cz = 0; cz < 3; cz++) {
|
||||
int baseX = (baseChunkX + cx) << 4;
|
||||
int baseZ = (baseChunkZ + cz) << 4;
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int y = level.getMinY(); y < level.getMaxY(); y++) {
|
||||
BlockPos cursor = new BlockPos(baseX + x, y, baseZ + z);
|
||||
if (level.getBlockState(cursor).is(net.minecraft.world.level.block.Blocks.SPAWNER)) {
|
||||
found.add(cursor.immutable());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found.isEmpty()) {
|
||||
player.sendSystemMessage(net.minecraft.network.chat.Component.literal(
|
||||
"§6[Finder] §7Aucun spawner dans les 9 chunks."));
|
||||
return;
|
||||
}
|
||||
BlockPos nearest = found.get(0);
|
||||
double best = nearest.distSqr(pos);
|
||||
for (BlockPos candidate : found) {
|
||||
double d = candidate.distSqr(pos);
|
||||
if (d < best) {
|
||||
best = d;
|
||||
nearest = candidate;
|
||||
}
|
||||
}
|
||||
player.sendSystemMessage(net.minecraft.network.chat.Component.literal("§6[Finder] §7"
|
||||
+ found.size() + " spawner(s), plus proche en " + nearest.getX() + ", "
|
||||
+ nearest.getY() + ", " + nearest.getZ() + "."));
|
||||
}
|
||||
|
||||
// M-gadget-1 : scan du chunk (16x16 sur toute la hauteur), top 10 + total.
|
||||
static void analyseChunk(ServerPlayer player, ServerLevel level, BlockPos pos) {
|
||||
java.util.Map<String, Integer> counts = new java.util.HashMap<>();
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "pala:item/spawner_finder"
|
||||
}
|
||||
}
|
||||
@@ -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.spawner_finder": "Chercheur de spawners",
|
||||
"item.pala.infernal_knocker": "Infernal Knocker",
|
||||
"item.pala.cave_hammer": "Marteau des cavernes",
|
||||
"item.pala.magma_amulet": "Amulette de feu",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "pala:item/spawner_finder"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 270 B |
Reference in New Issue
Block a user