JakeNelson1999 Posted June 7, 2017 Posted June 7, 2017 Hi there, I'm looking for a client side solution to moving items from the inventory to hotbar, this is for a Minecraft Mining bot that I'm working on. package com.jakenelson1999.cactusbot; import java.util.List; import com.jakenelson1999.cactusbot.threads.GoToLocThread; import com.jakenelson1999.cactusbot.threads.StackUpThread; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; public class CactusCMD implements ICommand { @Override public int compareTo(Object o) { // TODO Auto-generated method stub return 0; } @Override public String getName() { // TODO Auto-generated method stub return "cactus"; } @Override public String getCommandUsage(ICommandSender sender) { // TODO Auto-generated method stub return "/cactus"; } @Override public List getAliases() { // TODO Auto-generated method stub return null; } @Override public void execute(ICommandSender sender, String[] args) throws CommandException { EntityPlayerMP player = (EntityPlayerMP)sender; if (args[0].toLowerCase().contains("goto")){ cactusbot.printToChat("Going to "+args[1]+", "+args[2]+", "+args[3]); GoToLocThread.setLocX(Double.valueOf(args[1])); GoToLocThread.setLocY(Double.valueOf(args[2])); GoToLocThread.setLocZ(Double.valueOf(args[3])); GoToLocThread.setDestFound(false); } if(args[0].toLowerCase().contains("stack")){ cactusbot.printToChat("Stacking."); StackUpThread.height = Integer.valueOf(args[1])*2; } if(args[0].toLowerCase().contains("request")){ // Move item from inventory to hotbar requested by item id. } } @Override public boolean canCommandSenderUse(ICommandSender sender) { // TODO Auto-generated method stub return true; } @Override public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { // TODO Auto-generated method stub return null; } @Override public boolean isUsernameIndex(String[] args, int index) { // TODO Auto-generated method stub return false; } } Quote
JakeNelson1999 Posted June 7, 2017 Author Posted June 7, 2017 I've found the player.inventory.setInventorySlotContents(player.inventory.currentItem, new function although it looks like many of these inventory functions just change the client and gets unchanged when the server updates the client. Help would be greatly appreciated. Quote
Kokkie Posted June 7, 2017 Posted June 7, 2017 Use packets Quote Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
JakeNelson1999 Posted June 17, 2017 Author Posted June 17, 2017 @diesieben07 Hey there thanks for the suggestion, sorry I didnt see this earlier. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.