<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Custom Script Help]]></title><description><![CDATA[<p dir="auto">Hi Guys,</p>
<p dir="auto">i recently dived into custom scripts and i would like that the player drops the current main hand slot i have tried already multiple things from different forums and also tried to do my own research in this "fabric" (yarn) library and on the "documentation" of LB but i just cant figure it out if you could help me with that it would be very nice.</p>
<p dir="auto">Thank you in advance,<br />
DeScrupter</p>
]]></description><link>https://forum.liquidbounce.net/topic/8399/custom-script-help</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 12:33:43 GMT</lastBuildDate><atom:link href="https://forum.liquidbounce.net/topic/8399.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 20 Jan 2025 19:40:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Custom Script Help on Thu, 23 Jan 2025 17:38:01 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1737649808611-080a9073-123f-4d34-b555-567a9398963c-image.png" alt="image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">To properly understand the api you will have to have the mod development setup up. Although inventory do have a <code>dropItem()</code> method it appears that it's clearly not what you are looking for. You should use <code>mc.player.dropSelectedItem(false)</code> or true to drop the entire stack, as that api sends <code>PlayerActionC2SPacketPlayerActionC2SPacket</code> to the server. (This one is tested to be working at my side). Also apologies for the previous confusion about the <code>dropItem</code> function (because I assumed that it would work by just looking at its name).</p>
<p dir="auto">If you would like to change the main hand of the player just use <code>mc.player.inventory.selectedSlot = 1</code> or any number from 0 to 9. <a href="https://github.com/CCBlueX/LiquidBounce/blob/10977247fe5b6b36d5841a9b5f21b758e14f1eff/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/ModuleAntiAFK.kt#L111" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/CCBlueX/LiquidBounce/blob/10977247fe5b6b36d5841a9b5f21b758e14f1eff/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/ModuleAntiAFK.kt#L111</a></p>
<p dir="auto">For further usage you will have to figure out on your own by cloning the LiquidBounce's git repo and run the gradle task of <code>genSources</code> to understand how Minecraft works, or, find out a example module in LB for how it works.</p>
<p dir="auto">This is as far as I am willing help you given the snippet you have given me. If you are able to provide a minimal full script for me for testing I might be able to do more.</p>
]]></description><link>https://forum.liquidbounce.net/post/39955</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/39955</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Thu, 23 Jan 2025 17:38:01 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Script Help on Fri, 24 Jan 2025 10:42:36 GMT]]></title><description><![CDATA[<p dir="auto">You are welcome and I am willing to accept further help requests, would appreciate a example error script or errors in the logs. <img src="https://forum.liquidbounce.net/assets/plugins/nodebb-plugin-emoji/emoji/android/1f601.png?v=866ab33d74c" class="not-responsive emoji emoji-android emoji--grin" style="height:23px;width:auto;vertical-align:middle" title="😁" alt="😁" /></p>
]]></description><link>https://forum.liquidbounce.net/post/39957</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/39957</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Fri, 24 Jan 2025 10:42:36 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Script Help on Thu, 23 Jan 2025 22:14:00 GMT]]></title><description><![CDATA[<p dir="auto">OMG i got it working with your help</p>
<p dir="auto">The</p>
<p dir="auto">mc.player.dropSelectedItem(false)<br />
and<br />
mc.player.inventory.selectedSlot = 1</p>
<p dir="auto">when combining them with a for loop which goes from 0 to 8 will drop all slots in the hotbar</p>
<p dir="auto">Thank you for helping me. I can now finally finish the script. Thank you very very much</p>
<p dir="auto">Maybe someday i will write another help request (hopefully only maybe)</p>
<p dir="auto">Again thank you very much for your help <img src="https://forum.liquidbounce.net/assets/plugins/nodebb-plugin-emoji/emoji/android/1f601.png?v=866ab33d74c" class="not-responsive emoji emoji-android emoji--grin" style="height:23px;width:auto;vertical-align:middle" title="😁" alt="😁" /></p>
]]></description><link>https://forum.liquidbounce.net/post/39956</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/39956</guid><dc:creator><![CDATA[DeScrupter]]></dc:creator><pubDate>Thu, 23 Jan 2025 22:14:00 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Script Help on Thu, 23 Jan 2025 17:38:01 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1737649808611-080a9073-123f-4d34-b555-567a9398963c-image.png" alt="image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">To properly understand the api you will have to have the mod development setup up. Although inventory do have a <code>dropItem()</code> method it appears that it's clearly not what you are looking for. You should use <code>mc.player.dropSelectedItem(false)</code> or true to drop the entire stack, as that api sends <code>PlayerActionC2SPacketPlayerActionC2SPacket</code> to the server. (This one is tested to be working at my side). Also apologies for the previous confusion about the <code>dropItem</code> function (because I assumed that it would work by just looking at its name).</p>
<p dir="auto">If you would like to change the main hand of the player just use <code>mc.player.inventory.selectedSlot = 1</code> or any number from 0 to 9. <a href="https://github.com/CCBlueX/LiquidBounce/blob/10977247fe5b6b36d5841a9b5f21b758e14f1eff/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/ModuleAntiAFK.kt#L111" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/CCBlueX/LiquidBounce/blob/10977247fe5b6b36d5841a9b5f21b758e14f1eff/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/ModuleAntiAFK.kt#L111</a></p>
<p dir="auto">For further usage you will have to figure out on your own by cloning the LiquidBounce's git repo and run the gradle task of <code>genSources</code> to understand how Minecraft works, or, find out a example module in LB for how it works.</p>
<p dir="auto">This is as far as I am willing help you given the snippet you have given me. If you are able to provide a minimal full script for me for testing I might be able to do more.</p>
]]></description><link>https://forum.liquidbounce.net/post/39955</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/39955</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Thu, 23 Jan 2025 17:38:01 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Script Help on Thu, 23 Jan 2025 04:31:22 GMT]]></title><description><![CDATA[<p dir="auto">No it is not going to work, I have no idea what the parameter mean(offhand or which slot), the only thing that I know is that the type of the parameter should look like snippet (if the dropItem really is what we need to call, as for actually dropping the item we are probably going to look at the source code of Minecraft or <a href="https://github.com/CCBlueX/LiquidBounce/blob/4af8ab0d70ef468f6ebe129823dca8ada3bf60c0/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/invcleaner/ModuleInventoryCleaner.kt#L4" target="_blank" rel="noopener noreferrer nofollow ugc">ModuleInventoryCleaner</a> and figure out how that works.</p>
]]></description><link>https://forum.liquidbounce.net/post/39954</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/39954</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Thu, 23 Jan 2025 04:31:22 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Script Help on Wed, 22 Jan 2025 17:04:57 GMT]]></title><description><![CDATA[<p dir="auto">so just a question what is this code snipped trying to archive</p>
<p dir="auto">should it drop the players mainhand or hotbar or inventory?</p>
<p dir="auto">and will it even work</p>
<p dir="auto">i am sorry but its a bit hard to understand</p>
<p dir="auto">i got this now and removed the timer</p>
<p dir="auto">run: function() {<br />
Client.displayChatMessage(<code>Dropping Item</code>);<br />
inventory = mc.player.getInventory()<br />
itemStack = inventory.getStack(1)<br />
mc.player.dropItem(itemStack, false)<br />
}</p>
]]></description><link>https://forum.liquidbounce.net/post/39953</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/39953</guid><dc:creator><![CDATA[DeScrupter]]></dc:creator><pubDate>Wed, 22 Jan 2025 17:04:57 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Script Help on Wed, 22 Jan 2025 16:52:06 GMT]]></title><description><![CDATA[<p dir="auto">It looks like that the naming you are using is from the legacy version yet you mentioned yarn previously, please confirm if you are using the nextgen or legacy version of LiquidBounce.</p>
<p dir="auto">If you are on nextgen(1.21.4), the api has changed to something like the following example, it no longer uses <code>mc.thePlayer</code> and uses <code>mc.player</code> instead</p>
<pre><code class="language-javascript">    inventory = mc.player.getInventory()
    itemStack = inventory.getStack(1)
    mc.player.dropItem(itemStack, false)
    // the previous line didn't work for me, either true or false doesn't work, not sure why yet
    // will look back at this once I got sometime to update my fork of LBNG project up-to-date
    // but the player swings if I ran this code
</code></pre>
<p dir="auto">and there is no <code>TimerTask</code> presented in the default global context , you might have to write your own, or just maybe use a counter on a event as well.</p>
<p dir="auto">If you are using legacy version(1.8.9) instead, please look for documentation about mcp instead of yarn and I am not sure if we even have a java doc for mcp if we don't setup the project.</p>
]]></description><link>https://forum.liquidbounce.net/post/39951</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/39951</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Wed, 22 Jan 2025 16:52:06 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Script Help on Tue, 21 Jan 2025 17:00:15 GMT]]></title><description><![CDATA[<p dir="auto">So i got this its not the complete script but the rest works i just need to drop the hotbar</p>
<p dir="auto">for (let i = 0; i &lt; 9; i++) {<br />
let dropTask = new TimerTask({<br />
run: function() {</p>
<pre><code>      var inventory = mc.thePlayer.getInventory();
      var itemStack = inventory.getStackInSlot(i);

      if (itemStack !== null) {

        mc.thePlayer.dropItem(true, itemStack);
        Client.displayChatMessage(`Dropped items from slot ${i + 1}`);
      } else {
        Client.displayChatMessage(`Slot ${i + 1} is empty.`);
      }
    }
  });

  timer.schedule(dropTask, delay);
}
</code></pre>
]]></description><link>https://forum.liquidbounce.net/post/39947</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/39947</guid><dc:creator><![CDATA[DeScrupter]]></dc:creator><pubDate>Tue, 21 Jan 2025 17:00:15 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Script Help on Tue, 21 Jan 2025 14:53:09 GMT]]></title><description><![CDATA[<p dir="auto">It can be a bit difficult to figure this out if you are going to very new to Minecraft modding or scripting.<br />
Do you mind showing us what you have tried so far so we can try to help you fix what u have? It would be much easier for us to help if you can provide a sample code that fails to do the intended behavior or actual error message/log.<br />
Also you can refer to this <a href="https://liquidbounce.net/docs/Script%20API/Debugging" target="_blank" rel="noopener noreferrer nofollow ugc">page</a> to try to debug your script by placing break points in and type in the debug console for quick attempts.</p>
<p dir="auto">If you are looking for deeper understanding to how scripting works I would recommend reading the source code of Minecraft/LiquidBounce, although that could take some time.</p>
]]></description><link>https://forum.liquidbounce.net/post/39946</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/39946</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Tue, 21 Jan 2025 14:53:09 GMT</pubDate></item></channel></rss>