Test for moving into a rotated container

Similar to the test in #1277. The duplication here is a little
irritating, but don't think we can avoid that.
This commit is contained in:
Jonathan Coates 2022-12-29 11:11:26 +00:00
parent bcdfa7c5ff
commit a1d5c76d00
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
1 changed files with 16 additions and 0 deletions

View File

@ -130,6 +130,22 @@ public boolean canPlaceItem(int slot, ItemStack item) {
assertNoOverlap(source, destination);
}
@Test
default void testMoveRotateWraps() {
var source = new SimpleContainer(1);
source.setItem(0, new ItemStack(Items.COBBLESTONE, 32));
var destination = new SimpleContainer(9);
destination.setItem(0, new ItemStack(Items.DIRT));
for (var slot = 4; slot < 9; slot++) destination.setItem(slot, new ItemStack(Items.DIRT));
var move = wrap(source).moveTo(wrap(destination).rotate(4), 64);
assertEquals(32, move);
assertThat("Source is empty", source.getItem(0), isStack(ItemStack.EMPTY));
assertThat("Was inserted into slot", destination.getItem(1), isStack(new ItemStack(Items.COBBLESTONE, 32)));
}
static void assertNoOverlap(Container... containers) {
Set<ItemStack> stacks = Collections.newSetFromMap(new IdentityHashMap<>());
for (var container : containers) {