CCBlueX Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Help writing a custom prison mining script

    ScriptAPI
    8
    21
    749
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Paranoid_breS last edited by

      Is there any more tutorials on the script API (other than https://liquidbounce.net/docs/ScriptAPI/Getting Started)? And the Minecraft docs (https://scriptapi.liquidbounce.net/) are a bit confusing to me, I only know how to use mc.thePlayer and that's it.

      For the mining script I need:
      -A way to path find from /mine to the mining location
      -A 'legit' mining mode (I know how to activate modules via script so I might just use nuker)
      -Check if inventory is full
      -Path finding to the 'Sell' NPC or using the /store menu to sell ore and blocks
      -Fix broken tools by going to another warp and interacting with an NCP
      -Upgrade tools (there's a special plugin in the server for upgrading tools with custom enchants)
      -Read /bal and then /rankup when possible
      -Detect if players are nearby, stop and go to /cell if anyone is nearby
      -Delayed /cell and logout if staff are seen online with /staff
      -And repeat

      I'm not asking anyone to write the script, just asking if there are any resources on writing more world involved scripts. Most scripts I've seen were PVP based so I don't have much experience in custom mining scripts.

      [deleted] ruado_Vn exit scammed 3 Replies Last reply Reply Quote 0
      • [deleted]
        [deleted] @Paranoid_breS last edited by

        @paranoid_bres alot of that you want is unreliable

        1 Reply Last reply Reply Quote 0
        • ruado_Vn
          ruado_Vn @Paranoid_breS last edited by

          @paranoid_bres depend on your creativity

          1 Reply Last reply Reply Quote 0
          • exit scammed
            exit scammed @Paranoid_breS last edited by

            @paranoid_bres you can try Impact client, it has Baritone that can do 1/2 of your requests

            1 Reply Last reply Reply Quote 2
            • ?
              A Former User last edited by

              you can't

              1 Reply Last reply Reply Quote 0
              • C
                commandblock2 last edited by

                A way to path find from /mine to the mining location

                This could be a bit much work to do. U might have to write a path finding algorithm like A*. However I do have a A* in my reachaura branch. Could be hell if u try to write it in js.

                A 'legit' mining mode (I know how to activate modules via script so I might just use nuker)

                Look for RotationUtils.faceBlock method in Nuker.kt in LB's src (cross_version here), it would be a bit different with/without cross_version.

                Check if inventory is full

                Maybe look at the inventory related module of LB and Hek's InventoryManger. Shouldn't be as hard as A*.

                Interact/Right Click NPC

                There is a packet for that and u can find the usage in KillAura.kt.

                Text related operation

                https://github.com/CzechHek/Core/blob/master/Scripts/Deprecated/BasicLogin.js

                P 1 Reply Last reply Reply Quote 3
                • P
                  Paranoid_breS @commandblock2 last edited by

                  @commandblock2 , thanks for the info. Doesn't Minecraft have built in pathfinding ? I saw that the Minecraft java docs have methods for path finding to a x,y,z position and path finding to an entity. Isn't there a way to already use what's built into the game ?

                  yorik100 C 2 Replies Last reply Reply Quote 0
                  • ruado_Vn
                    ruado_Vn last edited by

                    @paranoid_bres btw download liquidbounce from github and then try to learn how the code like mc.thePlayer or others work

                    1 Reply Last reply Reply Quote 0
                    • yorik100
                      yorik100 @Paranoid_breS last edited by

                      @paranoid_bres minecraft's pathfinder is literally running into blocks

                      1 Reply Last reply Reply Quote 0
                      • C
                        commandblock2 @Paranoid_breS last edited by commandblock2

                        @paranoid_bres Indeed there is a builtin pathfinding for minecraft (net.minecraft.pathfinding), but it seemed that it only has the behavior for Climber/Ground/Swimmer things, mining might require a different one which can navigate through stones. But you do remind me that you can just inherit the net.minecraft.pathfinding.PathNavigate and might be less work. Btw it is generally recommended to have a copy of mcp or do gradlew setupDecompWorkspace in LB's repo and attach the src to the project.
                        Edit: I didn't know it runs into blocks

                        1 Reply Last reply Reply Quote 3
                        • P
                          Paranoid_breS last edited by

                          The path finding doesn't have to be state of the art, most mines require you to go forward from the /mine starting point or they require you to climb up some stairs.

                          And for actual mining, we can use the nuker module. Or somehow implement a dead simple 'legit' mining mode which just goes forward and mines then turns left or right until it hits an unbreakable wall.

                          1 Reply Last reply Reply Quote 0
                          • P
                            Paranoid_breS last edited by

                            I wrote the 'path finding' part of the script. The mining location isn't hard to get to from the /mine warp. So I wrote this:

                            if (!IsAtMineLocation) { //Todo: Destination X,Z and rotation yaw will be read from a .ini file
                            		mc.thePlayer.rotationYaw = 0;
                            		if (mc.thePlayer.posX >= -2) 
                            			mc.thePlayer.moveEntityWithHeading(-0.5,0);
                            		if (mc.thePlayer.posZ <= 30) 
                            			mc.thePlayer.moveEntityWithHeading(0,0.8);
                            		if (Math.round(mc.thePlayer.posZ) == 30 && 
                            			Math.round(mc.thePlayer.posX) == -2)
                            			IsAtMineLocation = true;
                            	}	
                            
                            yorik100 1 Reply Last reply Reply Quote 0
                            • yorik100
                              yorik100 @Paranoid_breS last edited by

                              @paranoid_bres said in Help writing a custom prison mining script:

                              I wrote the 'path finding' part of the script. The mining location isn't hard to get to from the /mine warp. So I wrote this:

                              if (!IsAtMineLocation) { //Todo: Destination X,Z and rotation yaw will be read from a .ini file
                              		mc.thePlayer.rotationYaw = 0;
                              		if (mc.thePlayer.posX >= -2) 
                              			mc.thePlayer.moveEntityWithHeading(-0.5,0);
                              		if (mc.thePlayer.posZ <= 30) 
                              			mc.thePlayer.moveEntityWithHeading(0,0.8);
                              		if (Math.round(mc.thePlayer.posZ) == 30 && 
                              			Math.round(mc.thePlayer.posX) == -2)
                              			IsAtMineLocation = true;
                              	}	
                              

                              Interesting

                              1 Reply Last reply Reply Quote 0
                              • P
                                Paranoid_breS last edited by

                                How do I interact with inventory ? I know that I can check if my inventory is full by doing :

                                mc.thePlayer.inventory.getFirstEmptyStack() == -1
                                

                                But how do I interact with opened chest/containers ? To sell blocks/items in the game, you have to type /shop and click on the blocks that you want to sell.

                                CzechHek 1 Reply Last reply Reply Quote 0
                                • CzechHek
                                  CzechHek @Paranoid_breS last edited by CzechHek

                                  @paranoid_bres You check if mc.currentScreen instanceof GuiChest and then you get what it contains in many ways such as mc.currentScreen.inventorySlots.getInventory()
                                  mc.thePlayer.openContainer.getInventory() to get inventory + chest stacks

                                  You can then interact with the stacks using mc.playerController.windowClick(int windowId, int slotId, int mouseButtonClicked, int mode, EntityPlayer playerIn), in order to find the right arguments you should debug what properties does C0EPacketClickWindow when you click legitimately.

                                  Consider looking into src of LB modules like ChestStealer or into scripts such as InventoryManager as well.

                                  P 1 Reply Last reply Reply Quote 0
                                  • P
                                    Paranoid_breS @CzechHek last edited by

                                    @czechhek Thx, I've read your inventory manager script and found how to access the inventory. I've wrote this prototype code for testing purposes, and it works as expected.

                                    if (mc.thePlayer.inventory.getFirstEmptyStack() == -1) {
                                    		if (!(mc.currentScreen instanceof GuiChest))
                                    			mc.thePlayer.sendChatMessage("/shop");
                                    		else
                                    			mc.playerController.windowClick(mc.thePlayer.openContainer.windowId, 14, 0, 1, mc.thePlayer);
                                    	}
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • P
                                      Paranoid_breS last edited by

                                      How do I get the number of players nearby, how do I get the names of the players nearby? And how to swing at/hit an entity nearby?

                                      1 Reply Last reply Reply Quote 0
                                      • P
                                        Paranoid_breS last edited by

                                        I figured out how to get the number of entity present using:

                                        mc.theWorld.loadedEntityList.length
                                        
                                        CzechHek 1 Reply Last reply Reply Quote 0
                                        • ?
                                          A Former User last edited by

                                          for(int i = 1;i<= mc.theWorld.loadedEntityList.size();i++) {
                                          							EntityLivingBase entity = (EntityLivingBase) mc.theWorld.loadedEntityList.get(i);
                                          							System.out.print(entity.getName());
                                          						}
                                          

                                          java codes, but you can convert to javascript easily

                                          1 Reply Last reply Reply Quote 0
                                          • CzechHek
                                            CzechHek @Paranoid_breS last edited by CzechHek

                                            @paranoid_bres

                                            Java.from(mc.theWorld.playerEntities).filter(function (e) mc.thePlayer.getDistanceToEntity(e) < distance) ;
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            About
                                            • Terms of Service
                                            • Privacy Policy
                                            • Status
                                            • Contact Us
                                            Downloads
                                            • Releases
                                            • Source code
                                            • License
                                            Docs
                                            • Tutorials
                                            • CustomHUD
                                            • AutoSettings
                                            • ScriptAPI
                                            Community
                                            • Forum
                                            • Guilded
                                            • YouTube
                                            • Twitter
                                            • D.Tube