diff --git a/src/gametest/java/carpetextra/test/DispenserWithBlock.java b/src/gametest/java/carpetextra/test/DispenserWithBlock.java index d243ed46..1f227f46 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; @@ -44,6 +45,10 @@ public void before(ServerWorld world) { CarpetExtraSettings.dispensersStripBlocks = true; CarpetExtraSettings.dispensersTillSoil = true; CarpetExtraSettings.dispensersUseCauldrons = true; + CarpetExtraSettings.dispensersPlaceBoatsOnIce = true; + CarpetExtraSettings.blazeMeal = true; + CarpetExtraSettings.renewableEndstone = true; + CarpetExtraSettings.renewableNetherrack = true; } @AfterBatch(batchId = BATCH) @@ -53,6 +58,49 @@ public void after(ServerWorld world) { CarpetExtraSettings.dispensersStripBlocks = false; CarpetExtraSettings.dispensersTillSoil = false; CarpetExtraSettings.dispensersUseCauldrons = false; + 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) + public void renewableEndstone(TestContext ctx) { + blockConversionTest(ctx, Items.DRAGON_BREATH, Blocks.COBBLESTONE, Blocks.END_STONE, 1, true); + } + + @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.runAtTick(DISPENSER_DELAY, () -> { + checkFirstSlotHas(ctx, Items.BLAZE_POWDER, false); + ctx.expectBlockProperty(lapis.up(), NetherWartBlock.AGE, NetherWartBlock.MAX_AGE); + ctx.complete(); + }); } @GameTest(templateName = STRUCTURE, batchId = BATCH) @@ -65,6 +113,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 +330,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); } }