1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-13 03:43:08 +00:00

Fix bug where turtle drops inventory when moving (#1276)

This commit is contained in:
Emma
2022-12-29 02:02:02 -07:00
committed by GitHub
parent 2c59b9122b
commit bcdfa7c5ff
4 changed files with 162 additions and 4 deletions

View File

@@ -324,6 +324,26 @@ class Turtle_Test {
}
}
/**
* Test moving a turtle forwards preserves the turtle's inventory.
*
* @see [#1276](https://github.com/cc-tweaked/CC-Tweaked/pull/1276)
*/
@GameTest
fun Move_preserves_state(helper: GameTestHelper) = helper.sequence {
thenOnComputer { turtle.forward().await().assertArrayEquals(true, message = "Turtle moved forward") }
thenExecute {
helper.assertContainerExactly(BlockPos(2, 2, 3), listOf(ItemStack(Items.DIRT, 32)))
val turtle = helper.getBlockEntity(BlockPos(2, 2, 3), ModRegistry.BlockEntities.TURTLE_NORMAL.get())
assertEquals(1, turtle.computerID)
assertEquals("turtle_test.move_preserves_state", turtle.label)
assertEquals(79, turtle.access.fuelLevel)
helper.assertEntityNotPresent(EntityType.ITEM)
}
}
/**
* Test turtles are not obstructed by plants and instead replace them.
*/