Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Correctly set hotbar slots in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenStack committed Feb 9, 2024
1 parent a13d26b commit b4aea86
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minestom.server.coordinate.Pos;
import net.minestom.server.event.player.PlayerChangeHeldSlotEvent;
import net.minestom.server.inventory.PlayerInventory;
import net.minestom.server.item.ItemStack;
import net.minestom.server.item.Material;
import net.minestom.server.network.packet.client.play.ClientHeldItemChangePacket;
Expand All @@ -20,7 +21,7 @@ public void playerHeld(Env env) {
var connection = env.createConnection();
var player = connection.connect(instance, new Pos(0, 40, 0)).join();

player.getInventory().setItemStack(1, ItemStack.of(Material.STONE));
player.getInventory().setItemStack(PlayerInventory.HOTBAR_START + 1, ItemStack.of(Material.STONE));
assertEquals(ItemStack.AIR, player.getItemInMainHand());
assertEquals(0, player.getHeldSlot());

Expand All @@ -37,7 +38,7 @@ public void playerHeldEvent(Env env) {
var connection = env.createConnection();
var player = connection.connect(instance, new Pos(0, 40, 0)).join();

player.getInventory().setItemStack(1, ItemStack.of(Material.STONE));
player.getInventory().setItemStack(PlayerInventory.HOTBAR_START + 1, ItemStack.of(Material.STONE));
assertEquals(ItemStack.AIR, player.getItemInMainHand());
assertEquals(0, player.getHeldSlot());

Expand Down

0 comments on commit b4aea86

Please sign in to comment.