-
-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Warp+Bore lens breaking force relays
(fixes #4225)
- Loading branch information
1 parent
7c3d64a
commit 9229fc8
Showing
6 changed files
with
117 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
Xplat/src/main/java/vazkii/botania/test/item/lens/BoreWarpLensTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package vazkii.botania.test.item.lens; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.gametest.framework.GameTest; | ||
import net.minecraft.gametest.framework.GameTestHelper; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.level.block.ButtonBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
import vazkii.botania.common.block.BotaniaBlocks; | ||
import vazkii.botania.common.item.BotaniaItems; | ||
import vazkii.botania.test.TestingUtil; | ||
|
||
public class BoreWarpLensTest { | ||
private static final String TEMPLATE = "botania:item/lens/bore_warp_relay_interaction"; | ||
|
||
private static final BlockPos SPREADER_POS = new BlockPos(2, 2, 1); | ||
private static final BlockPos SPREADER_TARGET_POS = new BlockPos(5, 2, 1); | ||
private static final BlockPos BUTTON_POS = new BlockPos(2, 3, 2); | ||
private static final BlockPos RELAY_POS = new BlockPos(4, 2, 1); | ||
private static final BlockPos BOUND_POS = new BlockPos(1, 2, 4); | ||
private static final BlockPos TARGET_BLOCK_POS = new BlockPos(3, 2, 4); | ||
private static final BlockPos UNWARPED_HOPPER_POS = new BlockPos(3, 1, 4); | ||
private static final BlockPos WARPED_HOPPER_POS = new BlockPos(1, 1, 1); | ||
|
||
@GameTest(template = TEMPLATE, timeoutTicks = 25) | ||
public void testWarpBoreLens(GameTestHelper helper) { | ||
setUpLensesAndBindings(helper, BotaniaItems.lensWarp, BotaniaItems.lensMine); | ||
|
||
helper.startSequence() | ||
.thenExecuteAfter(1, () -> helper.pressButton(BUTTON_POS)) | ||
.thenWaitUntil(() -> helper.assertBlockProperty(BUTTON_POS, ButtonBlock.POWERED, false)) | ||
.thenExecute(() -> { | ||
helper.assertBlock(RELAY_POS, block -> block == BotaniaBlocks.pistonRelay, "Force relay was broken"); | ||
helper.assertBlockState(TARGET_BLOCK_POS, BlockState::isAir, () -> "Target block was not broken"); | ||
helper.assertContainerContains(UNWARPED_HOPPER_POS, Items.POLISHED_ANDESITE); | ||
helper.assertContainerEmpty(WARPED_HOPPER_POS); | ||
}) | ||
.thenSucceed(); | ||
} | ||
|
||
@GameTest(template = TEMPLATE, timeoutTicks = 25) | ||
public void testBoreWarpLens(GameTestHelper helper) { | ||
setUpLensesAndBindings(helper, BotaniaItems.lensMine, BotaniaItems.lensWarp); | ||
|
||
helper.startSequence() | ||
.thenExecuteAfter(1, () -> helper.pressButton(BUTTON_POS)) | ||
.thenWaitUntil(() -> helper.assertBlockProperty(BUTTON_POS, ButtonBlock.POWERED, false)) | ||
.thenExecute(() -> { | ||
helper.assertBlock(RELAY_POS, block -> block == BotaniaBlocks.pistonRelay, "Force relay was broken"); | ||
helper.assertBlockState(TARGET_BLOCK_POS, BlockState::isAir, () -> "Target block was not broken"); | ||
helper.assertContainerEmpty(UNWARPED_HOPPER_POS); | ||
helper.assertContainerContains(WARPED_HOPPER_POS, Items.POLISHED_ANDESITE); | ||
}) | ||
.thenSucceed(); | ||
} | ||
|
||
private static void setUpLensesAndBindings(GameTestHelper helper, Item firstLensType, Item secondLensType) { | ||
TestingUtil.setUpSpreaderAndCompositeLens(helper, firstLensType, secondLensType, SPREADER_POS, SPREADER_TARGET_POS); | ||
TestingUtil.bindForceRelayTarget(helper, RELAY_POS, BOUND_POS); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...ain/resources/data/botania/gametest/structures/item/lens/bore_warp_relay_interaction.snbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
DataVersion: 3465, | ||
size: [6, 4, 6], | ||
data: [ | ||
{pos: [1, 0, 1], state: "minecraft:hopper{enabled:true,facing:north}"}, | ||
{pos: [3, 0, 4], state: "minecraft:hopper{enabled:true,facing:north}"}, | ||
{pos: [2, 1, 1], state: "botania:redstone_spreader{has_scaffolding:false,waterlogged:false}"}, | ||
{pos: [2, 1, 2], state: "botania:creative_pool{color:none,waterlogged:false}"}, | ||
{pos: [2, 1, 3], state: "minecraft:air"}, | ||
{pos: [2, 1, 4], state: "minecraft:air"}, | ||
{pos: [2, 1, 5], state: "minecraft:air"}, | ||
{pos: [3, 1, 0], state: "minecraft:air"}, | ||
{pos: [3, 1, 1], state: "minecraft:air"}, | ||
{pos: [3, 1, 2], state: "minecraft:air"}, | ||
{pos: [3, 1, 3], state: "minecraft:air"}, | ||
{pos: [3, 1, 4], state: "minecraft:polished_andesite"}, | ||
{pos: [4, 1, 1], state: "botania:piston_relay"}, | ||
{pos: [5, 1, 1], state: "botania:mana_void"}, | ||
{pos: [5, 1, 4], state: "botania:mana_void"}, | ||
{pos: [2, 2, 1], state: "minecraft:polished_andesite"}, | ||
{pos: [2, 2, 2], state: "minecraft:polished_blackstone_button{face:wall,facing:south,powered:false}"} | ||
], | ||
entities: [], | ||
palette: [ | ||
"minecraft:polished_andesite", | ||
"botania:piston_relay", | ||
"botania:mana_void", | ||
"minecraft:polished_blackstone_button{face:wall,facing:south,powered:false}", | ||
"minecraft:hopper{enabled:true,facing:north}", | ||
"botania:redstone_spreader{has_scaffolding:false,waterlogged:false}", | ||
"botania:creative_pool{color:none,waterlogged:false}" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters