Skip to content

Commit

Permalink
Merge pull request #1 from gnembon/master
Browse files Browse the repository at this point in the history
Merge from upstream for 1.21.1
  • Loading branch information
sakura-ryoko authored Nov 3, 2024
2 parents 645c8eb + b377d53 commit 15a8109
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
37 changes: 36 additions & 1 deletion src/gametest/java/carpetextra/test/DispenserWithBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -299,14 +301,47 @@ 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);
runAll(extras);
});
}

// 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.<DispenserBlockEntity>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.<DispenserBlockEntity>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.<DispenserBlockEntity>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.<DispenserBlockEntity>getBlockEntity(dispenser).addToFirstFreeSlot(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 15a8109

Please sign in to comment.