ChosenArchitect / Project-Architect-2

For issue regarding the Project Architect 2 Modpack
8 stars 1 forks source link

Modular Routers unable to be broken #165

Closed webflunkie closed 3 weeks ago

webflunkie commented 3 weeks ago

Describe the bug A clear and concise description of what the bug is. -> An existing modular router that has been in use before upgrading cannot be broken so as to be moved. It seems invincible.

To Reproduce Steps to reproduce the behavior:

  1. Have existing modular router
  2. Attempt to break it to move it
  3. Modular router appears to respawn / not get broken
  4. Be sad, and leave it where it was until fixed

Expected behavior A clear and concise description of what you expected to happen. -> I expect to be able to use a pickaxe or my paxel and break the block so as to pick it up and move it elsewhere.

Screenshots If applicable, add screenshots to help explain your problem. (Use F2 to take a screenshot in-game)

2024-08-21_17 42 33 it looks like it starts breaking but respawns as if it was being placed again immediately

Modpack version -> 3.5 Java Version -> 17.0.8 Modpack Launcher Used -> CurseForge Ram Allocated -> 9056MB

Additional context Add any other context about the problem here. -> I was attempting to help someone in discord with this issue, and reproduced it.

IRicTheCoder commented 3 weeks ago

Well, this seems to be an edge case of the fix we applied to the modular router item drop issue, where items got bugged when dropped when the router is broken. However, you can break it with a tiny TNT and it should work.

I would like to have more information though, what kind of pickaxe, enchants in it, where the router is, and does it have things inside. Are you on a server if so are you OP or not?

In all my tests with everything I could consider and could find everything was working.

webflunkie commented 3 weeks ago

Tiny TNT does work to allow the modular router to be moved.

Here's a screenshot of the paxel I was using in my original testing. As you can see, it has some enchantments on it. 2024-08-21_20 40 14

I also tested with a newly created iron pickaxe, and get the same behavior. 2024-08-21_20 40 53

The router has no items inside, here's what its config looks like. 2024-08-21_20 42 26

I am on a single player world, cheats not enabled, the router is in my base (which is claimed and chunk loaded) and is setup as part of my draconic crafting automation. Just as a test I made a fresh new, never before used modular router. I placed it down in my base and couldn't break it. I also placed one outside of my claimed & chunk loaded area and was unable to break it either.

After opening my game to the lan and enabling cheats, I was able to break the modular routers normally.

IRicTheCoder commented 3 weeks ago

Thanks for this, and like I explained over on Discord, this is due to an oversight on the fix implemented to solve another issue with the router. But the problem has been identified and should be solved on the next update.

gutarin-de commented 3 weeks ago

Got the same issue :) I saw something in the log and the config. Log: [11:11:11] [Server thread/INFO]: pa2_extras/drop_handler.js#120: modularrouters:modular_router in the file i found this (Line: 102)

// The block event registration
BlockEvents.broken(event => {
    // Checks for Modular Routers
    if (fixMRWrongDrop && event.block.getId() === "modularrouters:modular_router")
    {
        // Schedules the break fix for 1 tick later
        event.player.getServer().schedule(1, callback => {
            let pos = '${event.block.getX()} ${event.block.getY()} ${event.block.getZ()}';

            event.player.runCommandSilent( 'execute if data block ${pos} Buffer.Items[0] run summon minecraft:item ${pos} {Tags:["pa2.mrfix"],Item:{id:"minecraft:barrier",Count:1b}}');
            event.player.runCommandSilent( 'execute if data block ${pos} Buffer.Items[0] run data modify entity @e[tag=pa2.mrfix,limit=1] Item set from block ${pos} Buffer.Items[0]');
            event.player.runCommandSilent('execute if data block ${pos} Buffer.Items[0] run data remove block ${pos} Buffer.Items[0]');

            if (!event.player.creative)
                event.player.runCommandSilent('setblock ${pos} air destroy');
            else
                event.player.runCommandSilent('setblock ${pos} air');

            console.log(event.block.getId());
        });

        // Cancels the event
        event.cancel();
    }

    // Ignore Creative Players
    if (event.player.creative)
        return;

    let heldItem = event.player.getMainHandItem();

    // Non Silk Touch Drops
    if (drops.length !== 0 && drops.includes(event.block.getId()))
    {
        breakBlock(event, heldItem, false);
        return;
    }

    // Silk Touch Drops
    if (dropsSilk.length !== 0 && dropsSilk.includes(event.block.getId()))
    {
        breakBlock(event, heldItem, true);
        return;
    }

    // Checks for Alchemical Collection usage
    if (fixACEnchant && heldItem.nbt && heldItem.nbt.AlchemicalCollectionEnabled && heldItem.nbt.AlchemicalCollectionEnabled == 1)
        event.player.runCommandSilent('projecte knowledge learn @s ${event.block.getItem().getId()}'); // Force learns the item being broken with AC active
});

may that helps, i think the 1 tick later break or something is not working - but with a little more console.log debugging there will be a soution.

Is it (with problems in the buffer in the router) a temp solution with fixMRWrongDrop = false; ?

Thanks for this nice pack and the work with it 👍

IRicTheCoder commented 3 weeks ago

@gutarin-de I already fixed it, the issue is not that fix, it was that I used the player to run the commands instead of the server. The player is not OP or does not have cheats enabled so they can't run the commands. Next update should fix it. If you do fixMRWrongDrop = false; it will work as a temp solution however you won't be able to use Draconic or Mekanism things inside of the buffer, because they will be resetted to default with you break the modular router without taking them out first.

IRicTheCoder commented 3 weeks ago

Considering this as a duplicate of #179 and leaving the other one open as it provides more info into the issue.