From fa4eec743faf3281b25ee8ae54b4c59ef4ae5376 Mon Sep 17 00:00:00 2001 From: altrisi Date: Fri, 23 Aug 2024 13:04:05 +0200 Subject: [PATCH 1/3] Fix crash with autocrafting dropper --- .../java/carpetextra/mixins/DropperBlock_craftingMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java b/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java index 0e7eb2a3..6b6f03bb 100644 --- a/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java +++ b/src/main/java/carpetextra/mixins/DropperBlock_craftingMixin.java @@ -101,7 +101,7 @@ private void tryCraft(ServerWorld world, BlockState state, BlockPos pos, Callbac for (int column = 0; column < recipeInput.getWidth(); ++column) { int index = column + left + (row + top) * craftingInventory.getWidth(); ItemStack itemStack = dispenser.getStack(index); - ItemStack itemStack2 = defaultedList.get(column + row * craftingInventory.getWidth()); + ItemStack itemStack2 = defaultedList.get(column + row * recipeInput.getWidth()); if (!itemStack.isEmpty()) { dispenser.removeStack(index, 1); itemStack = dispenser.getStack(index); From ae742a9c4489c2625f901ea5443199651154e241 Mon Sep 17 00:00:00 2001 From: altrisi Date: Fri, 23 Aug 2024 13:25:27 +0200 Subject: [PATCH 2/3] Add basic autocrafting dropper test to prevent future crashes --- .../carpetextra/test/DispenserWithBlock.java | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/gametest/java/carpetextra/test/DispenserWithBlock.java b/src/gametest/java/carpetextra/test/DispenserWithBlock.java index 1f227f46..5e271878 100644 --- a/src/gametest/java/carpetextra/test/DispenserWithBlock.java +++ b/src/gametest/java/carpetextra/test/DispenserWithBlock.java @@ -49,6 +49,7 @@ public void before(ServerWorld world) { CarpetExtraSettings.blazeMeal = true; CarpetExtraSettings.renewableEndstone = true; CarpetExtraSettings.renewableNetherrack = true; + CarpetExtraSettings.autoCraftingDropper = true; // TODO separate, further testing for this feature } @AfterBatch(batchId = BATCH) @@ -62,6 +63,7 @@ public void after(ServerWorld world) { CarpetExtraSettings.blazeMeal = false; CarpetExtraSettings.renewableEndstone = false; CarpetExtraSettings.renewableNetherrack = false; + CarpetExtraSettings.autoCraftingDropper = false; } @GameTest(templateName = STRUCTURE, batchId = BATCH) @@ -299,7 +301,7 @@ private void cartTest(TestContext ctx, Item item, EntityType entity, Runnable ctx.spawnEntity(EntityType.MINECART, lapis.up()); ctx.pushButton(button); - ctx.addFinalTaskWithDuration(4, () -> { + ctx.addFinalTaskWithDuration(DISPENSER_DELAY, () -> { ctx.expectEntityAt(entity, lapis.up()); ctx.dontExpectEntity(EntityType.MINECART); ctx.dontExpectEntity(EntityType.ITEM); @@ -307,6 +309,39 @@ private void cartTest(TestContext ctx, Item item, EntityType entity, Runnable }); } + // very basic autocrafting test, for now just to catch simple crashes or malfunctioning stuff + @GameTest(templateName = STRUCTURE, batchId = BATCH) + public void craftCake(TestContext ctx) { + Item[] recipe = new Item[] { + Items.MILK_BUCKET, Items.MILK_BUCKET, Items.MILK_BUCKET, + Items.SUGAR, Items.EGG, Items.SUGAR, + Items.WHEAT, Items.WHEAT, Items.WHEAT + }; + ctx.setBlockState(dispenser, Blocks.DROPPER.getStateWithProperties(ctx.getBlockState(dispenser))); + ctx.setBlockState(lapis.up(), Blocks.CRAFTING_TABLE); + for (int i = 0; i < 9; i++) { + ctx.getBlockEntity(dispenser).setStack(i, recipe[i].getDefaultStack()); + } + ctx.pushButton(button); + + ctx.addFinalTaskWithDuration(DISPENSER_DELAY, () -> { + ctx.expectItem(Items.CAKE); + for (Item item : recipe) ctx.dontExpectItem(item); + for (int i = 0; i < 3; i++) { + int finalI = i; + ctx.checkBlockEntity(dispenser, + disp -> disp.getStack(finalI).getItem() == Items.BUCKET, + () -> "Must have buckets remaining in dispenser"); + } + for (int i = 3; i < 9; i++) { + int finalI = i; + ctx.checkBlockEntity(dispenser, + disp -> disp.getStack(finalI).isEmpty(), + () -> "Must not have anything but the first 3 buckets in dispenser"); + } + }); + } + // Util private void putInDispenser(TestContext ctx, ItemStack item) { ctx.getBlockEntity(dispenser).addToFirstFreeSlot(item); From b377d536968f46f153c807e29a55fa6104408c16 Mon Sep 17 00:00:00 2001 From: altrisi Date: Fri, 23 Aug 2024 13:34:46 +0200 Subject: [PATCH 3/3] Bump version to 1.4.148 and add support for 1.21.1 --- gradle.properties | 4 ++-- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 74a895ce..1ae5a1a3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx1G fabric_api_version=0.100.3+1.21 # Mod Properties - mod_version = 1.4.147 + mod_version = 1.4.148 maven_group = carpet-extra archives_base_name = carpet-extra @@ -23,7 +23,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.21:1.21 + release-curse-versions = Minecraft 1.21:1.21,Minecraft 1.21:1.21.1 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index ab95cd03..2e02aa6c 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,7 +29,7 @@ "depends": { "fabricloader": ">=0.15.11", "carpet": ">=1.4.147", - "minecraft": ["1.21"], + "minecraft": ["1.21", "1.21.1"], "java": ">=21" }, "custom": {