Java Code Examples for net.minecraft.item.Items#TOTEM_OF_UNDYING

The following examples show how to use net.minecraft.item.Items#TOTEM_OF_UNDYING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoTotem.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	if (mc.player.getOffHandStack().getItem() == Items.TOTEM_OF_UNDYING) return;
	
	/* Inventory */
	for (int i = 9; i < 44; i++) {
		if (mc.player.inventory.getInvStack(i).getItem() == Items.TOTEM_OF_UNDYING) {
			mc.interactionManager.method_2906(0, 0, i, SlotActionType.PICKUP, mc.player);
			mc.interactionManager.method_2906(1, 0, 45, SlotActionType.PICKUP, mc.player);
			return;
		}
	}
	
	/* Hotbar */
	for (int i = 0; i < 8; i++) {
		if (mc.player.inventory.getInvStack(i).getItem() == Items.TOTEM_OF_UNDYING) {
			//int oldSlot = mc.player.inventory.currentItem;
			mc.player.inventory.selectedSlot = i;
			mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(
					Action.SWAP_HELD_ITEMS, BlockPos.ORIGIN, Direction.DOWN));
			//mc.player.inventory.currentItem = oldSlot;
			return;
		}
	}
}
 
Example 2
Source File: AutoTotem.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public void onUpdate() {
	if (this.isToggled()) {
		if (mc.player.getHeldItemOffhand().getItem() == Items.TOTEM_OF_UNDYING) return;
		
		/*Inventory*/
		for (int i = 9; i < 44; i++) {
			if (mc.player.inventory.getStackInSlot(i).getItem() == Items.TOTEM_OF_UNDYING) {
				mc.playerController.windowClick(0, i, 0, ClickType.PICKUP, mc.player);
				mc.playerController.windowClick(0, 45, 0, ClickType.PICKUP, mc.player);
				return;
			}
		}
		
		/*Hotbar*/
		for (int i = 0; i < 8; i++) {
			if (mc.player.inventory.getStackInSlot(i).getItem() == Items.TOTEM_OF_UNDYING) {
				//int oldSlot = mc.player.inventory.currentItem;
				mc.player.inventory.currentItem = i;
				mc.player.connection.sendPacket(new CPlayerDiggingPacket(
						Action.SWAP_HELD_ITEMS, BlockPos.ZERO, Direction.DOWN));
				//mc.player.inventory.currentItem = oldSlot;
				return;
			}
		}
	}
}
 
Example 3
Source File: AutoTotem.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	if (mc.player.getOffHandStack().getItem() == Items.TOTEM_OF_UNDYING) return;
	
	/* Inventory */
	for (int i = 9; i < 44; i++) {
		if (mc.player.inventory.getStack(i).getItem() == Items.TOTEM_OF_UNDYING) {
			mc.interactionManager.clickSlot(0, 0, i, SlotActionType.PICKUP, mc.player);
			mc.interactionManager.clickSlot(1, 0, 45, SlotActionType.PICKUP, mc.player);
			return;
		}
	}
	
	/* Hotbar */
	for (int i = 0; i < 8; i++) {
		if (mc.player.inventory.getStack(i).getItem() == Items.TOTEM_OF_UNDYING) {
			//int oldSlot = mc.player.inventory.currentItem;
			mc.player.inventory.selectedSlot = i;
			mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(
					Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ORIGIN, Direction.DOWN));
			//mc.player.inventory.currentItem = oldSlot;
			return;
		}
	}
}
 
Example 4
Source File: AutoTotem.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void onTick(EventTick event) {
	if (mc.player.getOffHandStack().getItem() == Items.TOTEM_OF_UNDYING) return;
	
	/* Inventory */
	for (int i = 9; i < 44; i++) {
		if (mc.player.inventory.getInvStack(i).getItem() == Items.TOTEM_OF_UNDYING) {
			mc.interactionManager.clickSlot(0, 0, i, SlotActionType.PICKUP, mc.player);
			mc.interactionManager.clickSlot(1, 0, 45, SlotActionType.PICKUP, mc.player);
			return;
		}
	}
	
	/* Hotbar */
	for (int i = 0; i < 8; i++) {
		if (mc.player.inventory.getInvStack(i).getItem() == Items.TOTEM_OF_UNDYING) {
			//int oldSlot = mc.player.inventory.currentItem;
			mc.player.inventory.selectedSlot = i;
			mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(
					Action.SWAP_HELD_ITEMS, BlockPos.ORIGIN, Direction.DOWN));
			//mc.player.inventory.currentItem = oldSlot;
			return;
		}
	}
}
 
Example 5
Source File: AutoTotemHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate()
{
	IClientPlayerInteractionManager im = IMC.getInteractionManager();
	PlayerInventory inventory = MC.player.inventory;
	
	if(nextTickSlot != -1)
	{
		im.windowClick_PICKUP(nextTickSlot);
		nextTickSlot = -1;
	}
	
	ItemStack offhandStack = inventory.getStack(40);
	if(offhandStack.getItem() == Items.TOTEM_OF_UNDYING)
		return;
	
	if(MC.currentScreen instanceof HandledScreen
		&& !(MC.currentScreen instanceof AbstractInventoryScreen))
		return;
	
	for(int slot = 0; slot <= 36; slot++)
	{
		if(inventory.getStack(slot).getItem() != Items.TOTEM_OF_UNDYING)
			continue;
		
		int newTotemSlot = slot < 9 ? slot + 36 : slot;
		boolean offhandEmpty = offhandStack.isEmpty();
		
		im.windowClick_PICKUP(newTotemSlot);
		im.windowClick_PICKUP(45);
		
		if(!offhandEmpty)
			nextTickSlot = newTotemSlot;
		
		break;
	}
}