Jump to content

Recommended Posts

Posted

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;
	}

}

 

Posted

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.

 

 

  • 2 weeks later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.