Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 9 additions & 9 deletions .github/scripts/release-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ github_release() {
if gh release view "$tag" >/dev/null 2>&1; then
echo "GitHub release ${tag} already exists"
else
local -a args=(release create "$tag" --title "Feast Dominion ${tag#v}" --notes-file "$notes")
local -a args=(release create "$tag" --title "Primal Pottery ${tag#v}" --notes-file "$notes")
[[ "$release_type" == release ]] || args+=(--prerelease)
gh "${args[@]}"
fi
Expand Down Expand Up @@ -245,15 +245,15 @@ upload() {
echo "CurseForge file list returned ${code}. A repeated run may upload the same jar again." >&2
fi

modrinth_upload "${version}+1.20.6" "Feast Dominion ${version} for NeoForge 1.20.6" neoforge 1.20.6 "$neo_1206"
modrinth_upload "${version}+1.21.1" "Feast Dominion ${version} for NeoForge 1.21.1" neoforge 1.21.1 "$neo_121"
modrinth_upload "${version}+26.3+fabric" "Feast Dominion ${version} for Fabric 26.3" fabric 26.3 "$fabric_263"
modrinth_upload "${version}+26.3+neoforge" "Feast Dominion ${version} for NeoForge 26.3" neoforge 26.3 "$neo_263"
modrinth_upload "${version}+1.20.6" "Primal Pottery ${version} for NeoForge 1.20.6" neoforge 1.20.6 "$neo_1206"
modrinth_upload "${version}+1.21.1" "Primal Pottery ${version} for NeoForge 1.21.1" neoforge 1.21.1 "$neo_121"
modrinth_upload "${version}+26.3+fabric" "Primal Pottery ${version} for Fabric 26.3" fabric 26.3 "$fabric_263"
modrinth_upload "${version}+26.3+neoforge" "Primal Pottery ${version} for NeoForge 26.3" neoforge 26.3 "$neo_263"

curseforge_upload "Feast Dominion ${version} for NeoForge 1.20.6" NeoForge "$neo_1206" "$cf_neo_1206"
curseforge_upload "Feast Dominion ${version} for NeoForge 1.21.1" NeoForge "$neo_121" "$cf_neo_121"
curseforge_upload "Feast Dominion ${version} for Fabric 26.3" Fabric "$fabric_263" "$cf_fabric_263"
curseforge_upload "Feast Dominion ${version} for NeoForge 26.3" NeoForge "$neo_263" "$cf_neo_263"
curseforge_upload "Primal Pottery ${version} for NeoForge 1.20.6" NeoForge "$neo_1206" "$cf_neo_1206"
curseforge_upload "Primal Pottery ${version} for NeoForge 1.21.1" NeoForge "$neo_121" "$cf_neo_121"
curseforge_upload "Primal Pottery ${version} for Fabric 26.3" Fabric "$fabric_263" "$cf_fabric_263"
curseforge_upload "Primal Pottery ${version} for NeoForge 26.3" NeoForge "$neo_263" "$cf_neo_263"

github_release "$TAG" "$neo_1206" "$neo_121" "$fabric_263" "$neo_263"
}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ bin/
/AGENTS.md
/.cursor/
/docs/team/
/.sprite-room/backups/
/versions/*/logs/
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ After publishing, the action commits the next development version and changelog

## Unreleased

- Picking up clay unlocks recipes for the pottery wheel and raw template. Mining either half of the wheel returns the wheel in Survival.
- Nearby players see the wheel spin together, and a wheel keeps its shaping progress when its chunk unloads.
- The liquid surface in a placed vessel rises as you pour. Placed lids can be changed only within reach.
- A jug, jar, or pot holds liquid, and you can see the liquid when you look inside. Use it on water or lava, flowing or still, or on another fluid, and it fills without using up the source. A waterlogged block or a bubble column does not fill it.
- The tooltip shows how many millilitres it holds, and the liquid and how full it is when there is some. Water's name is blue.
- Use a vessel in the air, or right-click a placed one with an empty hand, to look inside and put a lid on or take it off. The lid sits just above the rim, a little wider than the mouth, with a small handle.
Expand Down
Binary file added art/primal-pottery-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ private static void wheel(GameTestHelper helper) {
}
helper.assertTrue(Math.abs(wheel.clayProgress() - 0.1F) < 0.0001F, "clay progress was " + wheel.clayProgress());

var snapshot = wheel.getUpdateTag(helper.getLevel().registryAccess());
var tracked = new PotteryWheelBlockEntity(helper.absolutePos(wheelPos), wheel.getBlockState());
tracked.loadCustomOnly(TagValueInput.create(ProblemReporter.DISCARDING, helper.getLevel().registryAccess(), snapshot));
helper.assertValueEqual(tracked.spinTicks(), wheel.spinTicks(), "remaining spin in tracking snapshot");
helper.assertValueEqual(tracked.angle(), wheel.angle(), "wheel angle in tracking snapshot");
helper.assertValueEqual(tracked.clayProgress(), wheel.clayProgress(), "saved shaping progress");

helper.useBlock(wheelPos, player);
helper.assertFalse(wheel.hasClay(), "clay was not taken off");
ItemStack shaped = potteryItem(helper);
Expand Down Expand Up @@ -139,13 +146,30 @@ private static void wheel(GameTestHelper helper) {
player.setShiftKeyDown(false);
helper.assertBlockNotPresent(ModBlocks.POTTERY, floor.above());
potteryItem(helper);

((ServerPlayer) player).setGameMode(GameType.SURVIVAL);
helper.assertFalse(player.preventsBlockDrops(), "survival wheel drops disabled");
BlockPos absoluteWheel = helper.absolutePos(wheelPos);
for (BlockPos broken : List.of(absoluteWheel, absoluteWheel.above())) {
helper.setBlock(wheelPos, ModBlocks.WHEEL);
helper.getBlockEntity(wheelPos, PotteryWheelBlockEntity.class).tick();
((ServerPlayer) player).gameMode.destroyBlock(broken);
helper.assertBlockNotPresent(ModBlocks.WHEEL, wheelPos);
helper.assertBlockNotPresent(ModBlocks.WHEEL, wheelPos.above());
var drops = helper.getLevel().getEntitiesOfClass(ItemEntity.class, new AABB(absoluteWheel).inflate(2),
item -> item.getItem().is(ModItems.WHEEL));
helper.assertValueEqual(drops.stream().mapToInt(item -> item.getItem().getCount()).sum(), 1, "wheel drops from " + broken);
drops.forEach(ItemEntity::discard);
}
helper.succeed();
}

private static void checkTemplateCycle(GameTestHelper helper, Player player) {
ItemStack raw = new ItemStack(ModItems.RAW_TEMPLATE);
player.setItemInHand(InteractionHand.MAIN_HAND, raw);
List<PotteryDisc> profile = List.of(new PotteryDisc(1, 4, 1), new PotteryDisc(1, 4));
TemplateSync.apply(player, true, List.of(new PotteryDisc(Double.NaN, 4)));
helper.assertTrue(player.getMainHandItem().is(ModItems.RAW_TEMPLATE), "invalid edit consumed the raw template");
TemplateSync.apply(player, true, profile);

ItemStack blueprint = player.getMainHandItem();
Expand All @@ -158,6 +182,15 @@ private static void checkTemplateCycle(GameTestHelper helper, Player player) {
"blueprint is missing its capacity tooltip");

var recipes = helper.getLevel().recipeAccess();
CraftingInput blank = CraftingInput.of(2, 1, List.of(new ItemStack(Items.STICK), new ItemStack(Items.CLAY_BALL)));
helper.assertTrue(recipes.getRecipeFor(RecipeType.CRAFTING, blank, helper.getLevel()).orElseThrow()
.value().assemble(blank).is(ModItems.RAW_TEMPLATE), "survival template recipe");
CraftingInput wheel = CraftingInput.of(3, 3, List.of(
ItemStack.EMPTY, new ItemStack(Items.STONE_SLAB), ItemStack.EMPTY,
new ItemStack(Items.OAK_PLANKS), new ItemStack(Items.BIRCH_PLANKS), new ItemStack(Items.OAK_PLANKS),
new ItemStack(Items.STICK), new ItemStack(Items.STONE_SLAB), new ItemStack(Items.STICK)));
helper.assertTrue(recipes.getRecipeFor(RecipeType.CRAFTING, wheel, helper.getLevel()).orElseThrow()
.value().assemble(wheel).is(ModItems.WHEEL), "survival wheel recipe");
CraftingInput input = CraftingInput.of(1, 1, List.of(blueprint));
var recipe = recipes.getRecipeFor(RecipeType.CRAFTING, input, helper.getLevel());
helper.assertTrue(recipe.isPresent(), "no reset recipe matched the saved blueprint");
Expand Down Expand Up @@ -425,6 +458,10 @@ private static void lidsAndBreaks(GameTestHelper helper, Player player) {
assertStored(helper, loaded.contents(0), Fluids.WATER, volume, "saved water");

BlockPos absolute = helper.absolutePos(pots);
placeEyes(player, Vec3.atCenterOf(absolute).add(0, 12, 0));
PlacedLidSync.apply(player, absolute, 0, false);
helper.assertTrue(entity.lid(0), "a distant player removed the lid");
placeEyes(player, Vec3.atCenterOf(absolute).add(0, 2, 0));
PlacedLidSync.apply(player, absolute, 0, false);
helper.assertFalse(entity.lid(0), "take placed lid");
helper.assertFalse(entity.lid(1), "neighbor gained a lid");
Expand All @@ -449,8 +486,6 @@ private static void lidsAndBreaks(GameTestHelper helper, Player player) {
player.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY);
float progress = state.getDestroyProgress(player, helper.getLevel(), absolute);
helper.assertTrue(progress > 0.0F && progress < 1.0F, "destroy progress " + progress);
// The two-argument getCollisionShape returns the shape cached at startup, which is empty
// because no pot exists then. The block methods are what the outline and entity collision use.
assertFootprint(helper, pots, 0, 1);

Vec3 gap = helper.absoluteVec(new Vec3(pots.getX() + 0.5, pots.getY() + 0.2, pots.getZ() + 0.5));
Expand Down Expand Up @@ -653,7 +688,9 @@ private static void assertFootprint(GameTestHelper helper, BlockPos relative, in
BlockState state = helper.getBlockState(relative);
CollisionContext context = CollisionContext.empty();
var shape = state.getShape(helper.getLevel(), absolute, context);
var collision = state.getCollisionShape(helper.getLevel(), absolute, context);
var collision = state.getCollisionShape(helper.getLevel(), absolute);
helper.assertFalse(Shapes.joinIsNotEmpty(collision, state.getCollisionShape(helper.getLevel(), absolute, context),
BooleanOp.NOT_SAME), "cached collision differs from occupied slots");
for (int index = 0; index < PotteryBlockEntity.SLOTS; index++) {
var box = Shapes.create(PotteryBlockEntity.box(index));
helper.assertFalse(Shapes.joinIsNotEmpty(shape, box, BooleanOp.ONLY_SECOND), "outline missing " + index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public final class ModBlocks {
public static final PotteryBlock POTTERY = new PotteryBlock(properties(POTTERY_ID)
.mapColor(MapColor.TERRACOTTA_RED)
.sound(SoundType.DECORATED_POT)
.dynamicShape()
.strength(0.5F, 3600000.0F)
.noOcclusion()
.lightLevel(state -> state.getValue(PotteryBlock.LIGHT)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.jspecify.annotations.Nullable;

public class PotteryWheelBlockEntity extends BlockEntity {
/** Collision height. The drawn wheel stays one block tall. */
public static final double BLOCK_HEIGHT = 1.5;
public static final int TABLE = 0;
public static final int BIG_WHEEL = 1;
Expand All @@ -41,16 +42,19 @@ public PotteryWheelBlockEntity(BlockPos pos, BlockState state) {
public static AABB box(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
return new AABB(
minX / 32.0,
minY / 32.0 * BLOCK_HEIGHT,
minY / 32.0,
minZ / 32.0,
maxX / 32.0,
maxY / 32.0 * BLOCK_HEIGHT,
maxY / 32.0,
maxZ / 32.0
);
}

public void spin() {
this.spinTicks += 24;
if (this.level != null && !this.level.isClientSide()) {
this.spinTicks += 24;
this.sync();
}
}

public void install(Pottery pottery) {
Expand Down Expand Up @@ -120,6 +124,14 @@ public void tick() {
if (this.hasClay && this.clayProgress < 1) {
this.clayProgress = Math.min(1, this.clayProgress + 0.01F);
}
// Clients animate between server snapshots. Persist the authoritative tick and settle all clients at rest.
if (this.level != null && !this.level.isClientSide()) {
if (this.spinTicks == 0) {
this.sync();
} else {
this.setChanged();
}
}
}

//? if >=26.1 {
Expand Down Expand Up @@ -150,6 +162,8 @@ protected void loadAdditional(CompoundTag tag, net.minecraft.core.HolderLookup.P

private CompoundTag saveWheel() {
CompoundTag tag = new CompoundTag();
tag.putInt("spin_ticks", this.spinTicks);
tag.putDouble("angle", this.angle);
tag.putBoolean("clay", this.hasClay);
tag.putFloat("progress", this.clayProgress);
if (this.template != null) {
Expand All @@ -159,6 +173,9 @@ private CompoundTag saveWheel() {
}

private void loadWheel(CompoundTag tag) {
this.spinTicks = Math.max(0, Nbt.getInt(tag, "spin_ticks"));
double savedAngle = Nbt.getDouble(tag, "angle");
this.angle = Double.isFinite(savedAngle) ? savedAngle % (Math.PI * 2) : 0;
this.hasClay = Nbt.getBoolean(tag, "clay");
this.clayProgress = Nbt.getFloat(tag, "progress");
CompoundTag template = Nbt.compound(tag, "template");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,21 @@ private static double cut(double backX, double heel, double reach, double radius

/**
* The fluid body. Each open disc is an octagon at its inner radius, inset so it stays inside the clay.
* The top face sits just under the top of the rim disc. A slice whose inset radius is not positive is skipped.
* Fill from the floor by slice volume. A full vessel's surface sits just below its rim.
*/
public void cavity(double centerX, double base, double centerZ, List<PotteryDisc> discs) {
public void cavity(double centerX, double base, double centerZ, List<PotteryDisc> discs, int amount) {
int rim = openRim(discs);
if (rim < 0) {
if (rim < 0 || amount <= 0) {
return;
}
int end = rim;
double capacity = 0;
while (end < discs.size() && discs.get(end).innerRadius() > 0) {
end++;
PotteryDisc disc = discs.get(end++);
capacity += Pottery.cavityArea(disc.innerRadius()) * disc.height();
}
// Stored capacity is rounded to whole millilitres.
double remaining = amount >= Math.round(capacity) ? capacity : amount;
double y = base;
for (int index = discs.size() - 1; index >= end; index--) {
y += Math.max(0, discs.get(index).height());
Expand All @@ -218,15 +222,23 @@ public void cavity(double centerX, double base, double centerZ, List<PotteryDisc
PotteryDisc disc = discs.get(index);
double height = disc.height();
double radius = disc.innerRadius() - FLUID_INSET;
boolean top = index == rim;
double drop = top ? Math.min(FLUID_INSET, Math.max(0, height) * 0.5) : 0;
double drawHeight = height - drop;
double area = Pottery.cavityArea(disc.innerRadius());
double sliceVolume = area * height;
boolean top = index == rim || remaining <= sliceVolume;
double drawHeight = Math.min(height, remaining / area);
if (index == rim) {
drawHeight = Math.min(drawHeight, height - Math.min(FLUID_INSET, height * 0.5));
}
if (radius > 0 && drawHeight > 0) {
this.ringWalls(centerX, centerZ, y, drawHeight, radius, Texture.CLAY);
if (top) {
this.cap(centerX, centerZ, y + drawHeight, radius, Texture.CLAY, true);
}
}
if (top) {
break;
}
remaining -= sliceVolume;
y += height;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState;
import net.modcrafters.minecraft.primalpottery.block.PotteryBlockEntity;
import net.modcrafters.minecraft.primalpottery.pottery.Pottery;
import net.modcrafters.minecraft.primalpottery.pottery.PotteryDisc;
import net.modcrafters.minecraft.primalpottery.pottery.VesselContents;
import net.minecraft.world.phys.AABB;

Expand Down Expand Up @@ -147,7 +146,15 @@ private static Mesh clay(Pottery[] slots, boolean[] lids) {
}
boolean closed = lids != null && index < lids.length && lids[index];
Mesh pot = new Mesh();
placed(index, pot, pottery, closed, false);
AABB box = PotteryBlockEntity.box(index);
double x = box.getCenter().x * 32;
double z = box.getCenter().z * 32;
pot.vessel(x, 0, z, pottery.discs(), Mesh.Texture.CLAY);
Pottery.Cover cover = closed ? pottery.cover() : null;
if (cover != null) {
pot.cover(x, 0, z, cover, Mesh.Texture.CLAY);
}
pot.fitSprite();
mesh.add(pot);
}
return mesh;
Expand All @@ -169,7 +176,8 @@ private static List<FluidDraw> fluids(Pottery[] slots, VesselContents[] contents
continue;
}
Mesh body = new Mesh();
placed(index, body, pottery, false, true);
AABB box = PotteryBlockEntity.box(index);
body.cavity(box.getCenter().x * 32, 0, box.getCenter().z * 32, pottery.discs(), held.amount());
if (body.quads().isEmpty()) {
continue;
}
Expand All @@ -178,20 +186,4 @@ private static List<FluidDraw> fluids(Pottery[] slots, VesselContents[] contents
return draws;
}

private static void placed(int index, Mesh mesh, Pottery pottery, boolean closed, boolean fluid) {
AABB box = PotteryBlockEntity.box(index);
double centerX = (box.minX + box.maxX) / 2.0 * 32.0;
double centerZ = (box.minZ + box.maxZ) / 2.0 * 32.0;
double base = box.minY * 32.0;
List<PotteryDisc> discs = pottery.discs();
if (fluid) {
mesh.cavity(centerX, base, centerZ, discs);
return;
}
mesh.vessel(centerX, base, centerZ, discs, Mesh.Texture.CLAY);
if (closed && pottery.cover() != null) {
mesh.cover(centerX, base, centerZ, pottery.cover(), Mesh.Texture.CLAY);
}
mesh.fitSprite();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public final class TemplateScreen extends Screen {
private static final int PROFILE_Y = 10;
private static final int PROFILE_WIDTH = 100;
private static final int PROFILE_HEIGHT = 120;
private static final double MAX_RADIUS = 5.5;
private static final int BAR_COLOR = 0x60500000;

private final boolean mainHand;
Expand Down Expand Up @@ -176,13 +175,13 @@ private boolean sculpt(double mouseX, double mouseY, int button) {
if (x < 0 || x >= PROFILE_WIDTH || y < 0 || y >= PROFILE_HEIGHT || this.discs.isEmpty() || (button != 0 && button != 1)) {
return false;
}
double value = x * MAX_RADIUS / (PROFILE_WIDTH - 1);
double value = x * Pottery.MAX_RADIUS / (PROFILE_WIDTH - 1);
int row = y * this.discs.size() / PROFILE_HEIGHT;
PotteryDisc disc = this.discs.get(row);
if (button == 0) {
this.discs.set(row, new PotteryDisc(disc.height(), value, disc.innerRadius()));
this.discs.set(row, new PotteryDisc(disc.height(), value, Math.min(value, disc.innerRadius())));
} else {
this.discs.set(row, new PotteryDisc(disc.height(), disc.radius(), value));
this.discs.set(row, new PotteryDisc(disc.height(), disc.radius(), Math.min(disc.radius(), value)));
}
return true;
}
Expand Down Expand Up @@ -240,7 +239,7 @@ private void layout() {
}

private static int barWidth(double radius) {
return Math.max(0, Math.min(PROFILE_WIDTH, (int) (radius * PROFILE_WIDTH / MAX_RADIUS)));
return Math.max(0, Math.min(PROFILE_WIDTH, (int) (radius * PROFILE_WIDTH / Pottery.MAX_RADIUS)));
}

private static int rowEdge(int row, int rows) {
Expand Down
Loading