From 16b3bf2222f7c1f9e9d2807fca65b9aaf82384e9 Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 27 Jun 2024 19:32:58 +0200 Subject: [PATCH 1/5] Add tests for `dispensersPlaceBoatsOnIce` --- .../carpetextra/test/DispenserWithBlock.java | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/gametest/java/carpetextra/test/DispenserWithBlock.java b/src/gametest/java/carpetextra/test/DispenserWithBlock.java index d243ed46..d85c9f74 100644 --- a/src/gametest/java/carpetextra/test/DispenserWithBlock.java +++ b/src/gametest/java/carpetextra/test/DispenserWithBlock.java @@ -44,6 +44,7 @@ public void before(ServerWorld world) { CarpetExtraSettings.dispensersStripBlocks = true; CarpetExtraSettings.dispensersTillSoil = true; CarpetExtraSettings.dispensersUseCauldrons = true; + CarpetExtraSettings.dispensersPlaceBoatsOnIce = true; } @AfterBatch(batchId = BATCH) @@ -53,6 +54,7 @@ public void after(ServerWorld world) { CarpetExtraSettings.dispensersStripBlocks = false; CarpetExtraSettings.dispensersTillSoil = false; CarpetExtraSettings.dispensersUseCauldrons = false; + CarpetExtraSettings.dispensersPlaceBoatsOnIce = false; } @GameTest(templateName = STRUCTURE, batchId = BATCH) @@ -65,6 +67,37 @@ public void shearPumpkinBreaks(TestContext ctx) { blockConversionTest(ctx, Items.SHEARS, Blocks.PUMPKIN, Blocks.CARVED_PUMPKIN, 1, true, () -> ctx.expectItem(Items.PUMPKIN_SEEDS)); } + @GameTest(templateName = STRUCTURE, batchId = BATCH) + public void boatOnRegularIce(TestContext ctx) { + boatTest(ctx, Items.OAK_BOAT, Blocks.ICE, EntityType.BOAT); + } + + @GameTest(templateName = STRUCTURE, batchId = BATCH) + public void boatOnPackedIce(TestContext ctx) { + boatTest(ctx, Items.OAK_BOAT, Blocks.PACKED_ICE, EntityType.BOAT); + } + + @GameTest(templateName = STRUCTURE, batchId = BATCH) + public void boatOnBlueIce(TestContext ctx) { + boatTest(ctx, Items.OAK_BOAT, Blocks.BLUE_ICE, EntityType.BOAT); + } + + @GameTest(templateName = STRUCTURE, batchId = BATCH) + public void chestBoatOnIce(TestContext ctx) { + boatTest(ctx, Items.OAK_CHEST_BOAT, Blocks.ICE, EntityType.CHEST_BOAT); + } + + private void boatTest(TestContext ctx, Item item, Block block, EntityType expectedEntity) { + putInDispenser(ctx, item.getDefaultStack()); + ctx.setBlockState(lapis, block); + + ctx.pushButton(button); + ctx.addFinalTaskWithDuration(DISPENSER_DELAY, () -> { + ctx.expectEmptyContainer(dispenser); + ctx.expectEntityAt(expectedEntity, lapis.up()); + }); + } + @CustomTestProvider public Collection stripTests() { List fns = new ArrayList<>(); @@ -251,7 +284,7 @@ private void runAll(Runnable... actions) { // Setup util private TestFunction makeDispenserTest(String name, Consumer runner) { - name = name.replace("minecraft\\:", ""); + name = name.replace("minecraft:", ""); return new TestFunction(BATCH, BATCH + '.' + name, STRUCTURE, 20, 0, true, runner); } } From e3ba980f013eddf66185243c323e6a0dc0d2061c Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 27 Jun 2024 19:50:44 +0200 Subject: [PATCH 2/5] Test dispenser part of blaze meal --- .../carpetextra/test/DispenserWithBlock.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/gametest/java/carpetextra/test/DispenserWithBlock.java b/src/gametest/java/carpetextra/test/DispenserWithBlock.java index d85c9f74..61690fcb 100644 --- a/src/gametest/java/carpetextra/test/DispenserWithBlock.java +++ b/src/gametest/java/carpetextra/test/DispenserWithBlock.java @@ -12,6 +12,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.LeveledCauldronBlock; +import net.minecraft.block.NetherWartBlock; import net.minecraft.block.entity.DispenserBlockEntity; import net.minecraft.component.type.PotionContentsComponent; import net.minecraft.entity.EntityType; @@ -45,6 +46,7 @@ public void before(ServerWorld world) { CarpetExtraSettings.dispensersTillSoil = true; CarpetExtraSettings.dispensersUseCauldrons = true; CarpetExtraSettings.dispensersPlaceBoatsOnIce = true; + CarpetExtraSettings.blazeMeal = true; } @AfterBatch(batchId = BATCH) @@ -55,6 +57,35 @@ public void after(ServerWorld world) { CarpetExtraSettings.dispensersTillSoil = false; CarpetExtraSettings.dispensersUseCauldrons = false; CarpetExtraSettings.dispensersPlaceBoatsOnIce = false; + CarpetExtraSettings.blazeMeal = false; + } + + @GameTest(templateName = STRUCTURE, batchId = BATCH) + public void blazeMeal(TestContext ctx) { + putInDispenser(ctx, Items.BLAZE_POWDER.getDefaultStack()); + ctx.setBlockState(lapis, Blocks.SOUL_SAND); + ctx.setBlockState(lapis.up(), Blocks.NETHER_WART); + + ctx.pushButton(button); + + ctx.addFinalTaskWithDuration(DISPENSER_DELAY, () -> { + ctx.expectEmptyContainer(dispenser); + ctx.expectBlockProperty(lapis.up(), NetherWartBlock.AGE, 1); + }); + } + + @GameTest(templateName = STRUCTURE, batchId = BATCH) + public void blazeMealMaxed(TestContext ctx) { + putInDispenser(ctx, Items.BLAZE_POWDER.getDefaultStack()); + ctx.setBlockState(lapis, Blocks.SOUL_SAND); + ctx.setBlockState(lapis.up(), Blocks.NETHER_WART.getDefaultState().with(NetherWartBlock.AGE, NetherWartBlock.MAX_AGE)); + + ctx.pushButton(button); + + ctx.addFinalTaskWithDuration(DISPENSER_DELAY, () -> { + checkFirstSlotHas(ctx, Items.BLAZE_POWDER, false); + ctx.expectBlockProperty(lapis.up(), NetherWartBlock.AGE, NetherWartBlock.MAX_AGE); + }); } @GameTest(templateName = STRUCTURE, batchId = BATCH) From 53dc45d8c70c7319dd66523815673df41a3fdb75 Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 27 Jun 2024 19:57:27 +0200 Subject: [PATCH 3/5] Fix blazeMealMaxed test --- src/gametest/java/carpetextra/test/DispenserWithBlock.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gametest/java/carpetextra/test/DispenserWithBlock.java b/src/gametest/java/carpetextra/test/DispenserWithBlock.java index 61690fcb..86038e04 100644 --- a/src/gametest/java/carpetextra/test/DispenserWithBlock.java +++ b/src/gametest/java/carpetextra/test/DispenserWithBlock.java @@ -82,9 +82,10 @@ public void blazeMealMaxed(TestContext ctx) { ctx.pushButton(button); - ctx.addFinalTaskWithDuration(DISPENSER_DELAY, () -> { + ctx.runAtTick(DISPENSER_DELAY, () -> { checkFirstSlotHas(ctx, Items.BLAZE_POWDER, false); ctx.expectBlockProperty(lapis.up(), NetherWartBlock.AGE, NetherWartBlock.MAX_AGE); + ctx.complete(); }); } From 3debfb9d8577295178b933e2d82adbe8ddf14183 Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 27 Jun 2024 20:06:31 +0200 Subject: [PATCH 4/5] Test `renewableEndstone` --- src/gametest/java/carpetextra/test/DispenserWithBlock.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gametest/java/carpetextra/test/DispenserWithBlock.java b/src/gametest/java/carpetextra/test/DispenserWithBlock.java index 86038e04..8232c732 100644 --- a/src/gametest/java/carpetextra/test/DispenserWithBlock.java +++ b/src/gametest/java/carpetextra/test/DispenserWithBlock.java @@ -47,6 +47,7 @@ public void before(ServerWorld world) { CarpetExtraSettings.dispensersUseCauldrons = true; CarpetExtraSettings.dispensersPlaceBoatsOnIce = true; CarpetExtraSettings.blazeMeal = true; + CarpetExtraSettings.renewableEndstone = true; } @AfterBatch(batchId = BATCH) @@ -58,6 +59,12 @@ public void after(ServerWorld world) { CarpetExtraSettings.dispensersUseCauldrons = false; CarpetExtraSettings.dispensersPlaceBoatsOnIce = false; CarpetExtraSettings.blazeMeal = false; + CarpetExtraSettings.renewableEndstone = false; + } + + @GameTest(templateName = STRUCTURE, batchId = BATCH) + public void renewableEndstone(TestContext ctx) { + blockConversionTest(ctx, Items.DRAGON_BREATH, Blocks.COBBLESTONE, Blocks.END_STONE, 1, true); } @GameTest(templateName = STRUCTURE, batchId = BATCH) From 2ea6108db3d78b15dd26c4a15ac66eb4c5fabdf2 Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 27 Jun 2024 20:08:25 +0200 Subject: [PATCH 5/5] Test renewableNetherrack --- src/gametest/java/carpetextra/test/DispenserWithBlock.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gametest/java/carpetextra/test/DispenserWithBlock.java b/src/gametest/java/carpetextra/test/DispenserWithBlock.java index 8232c732..1f227f46 100644 --- a/src/gametest/java/carpetextra/test/DispenserWithBlock.java +++ b/src/gametest/java/carpetextra/test/DispenserWithBlock.java @@ -48,6 +48,7 @@ public void before(ServerWorld world) { CarpetExtraSettings.dispensersPlaceBoatsOnIce = true; CarpetExtraSettings.blazeMeal = true; CarpetExtraSettings.renewableEndstone = true; + CarpetExtraSettings.renewableNetherrack = true; } @AfterBatch(batchId = BATCH) @@ -60,6 +61,12 @@ public void after(ServerWorld world) { CarpetExtraSettings.dispensersPlaceBoatsOnIce = false; CarpetExtraSettings.blazeMeal = false; CarpetExtraSettings.renewableEndstone = false; + CarpetExtraSettings.renewableNetherrack = false; + } + + @GameTest(templateName = STRUCTURE, batchId = BATCH) + public void renewableNetherrack(TestContext ctx) { + blockConversionTest(ctx, Items.FIRE_CHARGE, Blocks.COBBLESTONE, Blocks.NETHERRACK, 1, true); } @GameTest(templateName = STRUCTURE, batchId = BATCH)