Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silk Touch upgrade gametest #638

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
import net.neoforged.neoforge.gametest.GameTestHolder;
import net.neoforged.neoforge.gametest.PrefixGameTestTemplate;

import static com.refinedmods.refinedstorage.common.GameTestUtil.RSITEMS;
import static com.refinedmods.refinedstorage.common.GameTestUtil.asResource;
import static com.refinedmods.refinedstorage.common.GameTestUtil.insert;
import static com.refinedmods.refinedstorage.common.GameTestUtil.networkIsAvailable;
import static com.refinedmods.refinedstorage.common.GameTestUtil.storageContainsExactly;
import static net.minecraft.world.item.Items.DIAMOND;
import static net.minecraft.world.item.Items.DIAMOND_ORE;
import static net.minecraft.world.item.Items.DIRT;
import static net.minecraft.world.item.Items.STONE;
import static net.minecraft.world.level.material.Fluids.LAVA;
Expand Down Expand Up @@ -50,6 +53,15 @@ public static void shouldBreakBlock(final GameTestHelper helper) {
new ResourceAmount(asResource(DIRT), 11),
new ResourceAmount(asResource(STONE), 15)
))
.thenExecute(() -> helper.setBlock(pos.east(), Blocks.DIAMOND_ORE))
.thenWaitUntil(() -> helper.assertBlockNotPresent(Blocks.DIAMOND_ORE, pos.east()))
.thenWaitUntil(storageContainsExactly(
helper,
pos,
new ResourceAmount(asResource(DIRT), 11),
new ResourceAmount(asResource(STONE), 15),
new ResourceAmount(asResource(DIAMOND), 1)
))
.thenSucceed();
});
}
Expand Down Expand Up @@ -116,6 +128,33 @@ public static void shouldBreakBlockBlocklist(final GameTestHelper helper) {
});
}

@GameTest(template = "empty_15x15")
public static void shouldBreakBlockWithSilkTouchUpgrade(final GameTestHelper helper) {
DestructorTestPlots.preparePlot(helper, Direction.EAST, (destructor, pos, sequence) -> {
// Arrange
sequence.thenWaitUntil(networkIsAvailable(helper, pos, network -> {
insert(helper, network, DIRT, 10);
insert(helper, network, STONE, 15);
}));

// Act
helper.setBlock(pos.east(), Blocks.DIAMOND_ORE);
destructor.addUpgradeItem(RSITEMS.getSilkTouchUpgrade());

// Assert
sequence
.thenWaitUntil(() -> helper.assertBlockNotPresent(Blocks.DIAMOND_ORE, pos.east()))
.thenWaitUntil(storageContainsExactly(
helper,
pos,
new ResourceAmount(asResource(DIRT), 10),
new ResourceAmount(asResource(STONE), 15),
new ResourceAmount(asResource(DIAMOND_ORE), 1)
))
.thenSucceed();
});
}

@GameTest(template = "empty_15x15")
public static void shouldPickupItemAllowlist(final GameTestHelper helper) {
DestructorTestPlots.preparePlot(helper, Direction.EAST, (destructor, pos, sequence) -> {
Expand Down
Loading