Skip to content

Commit

Permalink
Add test for turtle crafting with remainders
Browse files Browse the repository at this point in the history
See #2007. This isn't an issue on 1.20.1, so it doesn't fix the issue,
but good to have the test everywhere.
  • Loading branch information
SquidDev committed Nov 12, 2024
1 parent 4f66ac7 commit e7c7919
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import javax.annotation.Nullable;

/**
* The redstone relay is a peripheral that allows reading and outputting redstone signals.
* The redstone relay is a peripheral that allows reading and outputting redstone signals. While this is not very useful
* on its own (as computers have the same functionality [built-in][`redstone`]), this can be used with [wired
* modems][`modem`] to interact with multiple redstone signals from the same computer.
* <p>
* The peripheral provides largely identical methods to a computer's built-in {@link RedstoneAPI} API, allowing setting
* signals on all six sides of the block ("top", "bottom", "left", "right", "front" and "back").
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,35 @@ class Turtle_Test {
}
}

/**
* `turtle.craft` leaves a remainder
*
* @see [#2007](https://github.com/cc-tweaked/CC-Tweaked/issues/2007)
*/
@GameTest
fun Craft_remainder(helper: GameTestHelper) = helper.sequence {
thenOnComputer {
callPeripheral("left", "craft", 1).assertArrayEquals(true)
}
thenExecute {
val turtle = helper.getBlockEntity(BlockPos(2, 2, 2), ModRegistry.BlockEntities.TURTLE_NORMAL.get())

val turtleStack = ItemStack(ModRegistry.Items.TURTLE_NORMAL.get())
turtleStack.orCreateTag

assertThat(
"Inventory is as expected.",
turtle.contents,
contains(
isStack(turtleStack), isStack(Items.WET_SPONGE, 1), isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY),
isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY),
isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY),
isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY), isStack(ItemStack.EMPTY),
),
)
}
}

/**
* `turtle.equipLeft` equips a tool.
*/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e7c7919

Please sign in to comment.