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
33 changes: 11 additions & 22 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,17 @@ After publishing, the action commits the next development version and changelog

## Unreleased

- Raw pottery and empty fired pottery each stack to 16 small pieces or 4 large pieces when their shapes and finishes match. Filling a vessel or changing its lid affects one piece at a time.
- Inventory icons show a fluid level gauge, including when the lid is on. Open vessels also show their fluid surface.
- Middle-click in Creative to copy the piece under the crosshair, including its shape, dye, lid, and contents.

- You can fill or break a pot through an empty slot in front of it. Aim at the floor of an empty slot to place another pot there.

- Fired vessels and lids have the reddish, pixel-grained finish of a flower pot. Light wraps smoothly around the belly and shoulders, and dyed vessels show the same grain in their chosen color.

- Right-click a potted tree with the same type of sapling to grow a new shape for free. The pot saves the shape you choose between visits.

- Large pots holding at least 1,000 mL take dirt, grass blocks, or sand. Plant tall flowers or grow a miniature tree from a sapling. Each generated tree block is two Minecraft texture pixels wide and uses its own block textures.

- Fill an open, empty small pot of at least 250 mL with dirt, a grass block, or sand. Both pot sizes accept short grass and anything a vanilla flower pot accepts. An empty-hand click takes the plant out, and a second click takes the soil.

- Shape or hollow clay directly on the template, undo a stroke, and stamp the blueprint when the pot looks right. Drag the display block to see four small pots or one large pot from another angle.
- Hover over the clay to see which ring you are shaping. The editor shows how many mL the pot will hold and keeps clay around the hollow when you pinch a narrow shoulder.
- Capacity follows the smoothed hollow from floor to lip. Narrowing or shortening a nearly full-size template still changes its mL. The wooden wheel guides now meet the finished clay along its curve.
- Adjust the template height with − and +. Small pots hold up to 1,000 mL and take a clay ball on the wheel. Large pots hold up to 4,000 mL, take a clay block, and have lids fitted to the outer rim.
- Small templates give you 16 × 16 × 16 units of clay. Craft a clay block with a stick for a 32 × 32 × 32 large template. Its finished vessel takes a whole block.

- A new pot is a rounded jug with an open mouth, and its clay uses Minecraft's terracotta pixels instead of one picture stretched over the shape.
- Thrown and placed pottery curves from one width to the next, so the shape looks smoother. Liquid inside follows that curve.
- Large displays of matching pottery render faster. Filled pots reuse their liquid surface until the level changes, and wheels reuse their wooden guides until you change the blueprint.
- Use the new painting table while holding fired pottery. Paint one face and the pattern repeats around the vessel. Each square costs 1 mL of paint, and one matching dye refills 100 mL. You can erase squares or undo your last stroke.
- Shape a shallow small pot to make a plate. Paint from its center to its rim and place up to four plates along the edges of a block. Right-click an open plate with a non-block item to display one, then use an empty hand to take it back.
- Shape and hollow clay directly on the template. Hover to see the ring you’re editing, adjust the height with − and +, and undo strokes before stamping the blueprint. The editor keeps clay around the hollow at narrow shoulders and shows how many mL it will hold. Drag the preview to see how four small pots or one large pot will sit on a block.
- A small template gives you 16 × 16 × 16 units of clay. Use a clay ball on the wheel to throw a vessel that holds up to 1,000 mL. Craft a clay block with a stick for a 32 × 32 × 32 large template. A large vessel takes a clay block, holds up to 4,000 mL, and has a lid fitted to its outer rim.
- New templates start as open-mouthed jugs. Thrown and placed pots have smoother curves, and capacity follows the hollow from floor to lip, even near the template’s size limit. Fired pots and lids have the reddish grain of a flower pot, with smoother lighting around the belly and shoulders. Dyed pottery keeps the grain in its chosen color.
- The pottery wheel has a pegged wooden frame and stone wheels. Its wooden guides follow the blueprint’s curve and stay still as the clay spins and throws off flecks.
- Fill an open, empty pot with dirt, a grass block, or sand. Small pots need at least 250 mL of capacity and large pots need 1,000 mL. Both sizes take short grass and vanilla flower-pot plants. A message explains when a pot can’t take soil. An empty hand removes the plant first, then the soil.
- Large planters also take tall flowers and grow miniature trees with their original bark and leaf textures. Each tree block is two texture pixels wide. Use the same sapling to reroll the tree for free. Its shape is saved between visits.
- Matching raw pieces and matching empty fired pieces stack to 16 small or 4 large. Filling a vessel or changing its lid affects one piece. Inventory icons show a fill gauge even with the lid on, and open pots show the liquid surface. When you inspect a pot, you can see the lid on the rim or beside it.
- Aim through an empty slot to fill or break the pot behind it, or aim at the slot floor to place another piece. In Creative, middle-click copies the targeted piece with its shape, dye, lid, and contents.

## 0.0.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,9 @@

/** Maps one square of slip decoration across the throwing rings of each exterior face. */
final class FlowerPaint {
private record Key(boolean plate, double x, double y, double z, java.util.List<net.modcrafters.minecraft.primalpottery.pottery.PotteryDisc> discs, FacePaint paint) {}

private static final java.util.LinkedHashMap<Key, Mesh> vessels = new java.util.LinkedHashMap<>(16, 0.75F, true);
private static int cachedQuads;

private FlowerPaint() {
}

static synchronized Mesh vessel(double x, double base, double z, Pottery pottery) {
Key key = new Key(pottery.isPlate(), x, base, z, pottery.discs(), pottery.paint());
Mesh mesh = vessels.get(key);
if (mesh == null) {
mesh = new Mesh();
mesh.vessel(x, base, z, pottery.discs(), Mesh.Texture.FIRED_CLAY);
mesh.fitSprite();
apply(mesh, x, base, z, pottery);
vessels.put(key, mesh);
cachedQuads += mesh.quads().size();
while (vessels.size() > 64 || cachedQuads > 32768) {
cachedQuads -= vessels.pollFirstEntry().getValue().quads().size();
}
}
return mesh;
}

static void apply(Mesh vessel, double x, double base, double z, Pottery pottery) {
if (pottery.isPlate()) {
PlatePaint.build(vessel, x, base, z, pottery, false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package net.modcrafters.minecraft.primalpottery.client;

import java.util.ArrayList;
import net.modcrafters.minecraft.primalpottery.pottery.PotteryProfile;
import net.modcrafters.minecraft.primalpottery.pottery.PotteryProfile.Station;
import java.util.LinkedHashMap;
import java.util.List;
import net.minecraft.core.Direction;
import net.modcrafters.minecraft.primalpottery.pottery.FacePaint;
import net.modcrafters.minecraft.primalpottery.pottery.Pottery;
import net.modcrafters.minecraft.primalpottery.pottery.PotteryDisc;
import net.modcrafters.minecraft.primalpottery.pottery.PotteryProfile;
import net.modcrafters.minecraft.primalpottery.pottery.PotteryProfile.Station;

public final class Mesh {
static final double FLUID_INSET = 0.05;
Expand Down Expand Up @@ -53,13 +55,37 @@ public List<Quad> quads() {
return this.quads;
}

private record FiredKey(boolean plate, double x, double y, double z, double width, List<PotteryDisc> discs, FacePaint paint) {}
private static final LinkedHashMap<FiredKey, Mesh> firedMeshes = new LinkedHashMap<>(16, 0.75F, true);
private static int cachedQuads;

static Mesh firedVessel(double x, double y, double z, Pottery pottery) {
if (!net.modcrafters.minecraft.primalpottery.pottery.FacePaint.EMPTY.equals(pottery.paint())) {
return FlowerPaint.vessel(x, y, z, pottery);
return firedVessel(x, y, z, pottery, pottery.paint(), 1);
}

static Mesh placedVessel(double x, double z, Pottery pottery, double width) {
FacePaint bakedPaint = pottery.hasFlowerPaint() && !pottery.isPlate() ? FacePaint.FLOWER : FacePaint.EMPTY;
return firedVessel(x, 0, z, pottery, bakedPaint, width);
}

/** Shared read-only geometry. Placed custom designs draw their paint atlas separately. */
private static synchronized Mesh firedVessel(double x, double y, double z, Pottery pottery, FacePaint bakedPaint, double width) {
FiredKey key = new FiredKey(pottery.isPlate(), x, y, z, width, pottery.discs(), bakedPaint);
Mesh mesh = firedMeshes.get(key);
if (mesh == null) {
mesh = new Mesh();
mesh.vessel(x, y, z, pottery.discs(), Texture.FIRED_CLAY);
mesh.fitSprite();
if (!FacePaint.EMPTY.equals(bakedPaint)) {
FlowerPaint.apply(mesh, x, y, z, pottery);
}
if (width != 1) mesh.scaleWidth(x, z, width);
firedMeshes.put(key, mesh);
cachedQuads += mesh.quads().size();
while (firedMeshes.size() > 64 || cachedQuads > 32768) {
cachedQuads -= firedMeshes.pollFirstEntry().getValue().quads().size();
}
}
Mesh mesh = new Mesh();
mesh.vessel(x, y, z, pottery.discs(), Texture.FIRED_CLAY);
mesh.fitSprite();
return mesh;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import net.modcrafters.minecraft.primalpottery.pottery.Pottery;
import net.modcrafters.minecraft.primalpottery.pottery.FacePaint;
import net.modcrafters.minecraft.primalpottery.pottery.VesselContents;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.client.renderer.texture.OverlayTexture;
Expand Down Expand Up @@ -110,7 +109,7 @@ public void submit(
net.minecraft.client.renderer.state.level.CameraRenderState camera
) {
PlacedPot[] bodies = bodies(state.slots, state.lids);
List<FluidDraw> draws = fluids(state.slots, state.contents);
List<FluidDraw> draws = fluids(bodies, state.slots, state.contents);
boolean solidFluid = has(draws, true);
boolean translucent = has(draws, false);
if (!occupied(state.slots) && !solidFluid && !translucent) {
Expand Down Expand Up @@ -190,7 +189,7 @@ public void render(
var lids = blockEntity.lids();
PlacedPot[] bodies = bodies(slots, lids);
List<Planting> plantings = plantings(slots, blockEntity);
List<FluidDraw> draws = fluids(slots, blockEntity.contents());
List<FluidDraw> draws = fluids(bodies, slots, blockEntity.contents());
boolean solidFluid = has(draws, true);
boolean translucent = has(draws, false);
if (!occupied(slots) && !solidFluid && !translucent) {
Expand Down Expand Up @@ -396,22 +395,36 @@ private static boolean occupied(Pottery[] slots) {
private final Map<Pottery, PlacedPot[]> placed = new WeakHashMap<>();

private static final class PlacedPot {
final Mesh vessel = new Mesh();
final Mesh vessel;
Mesh lid;
Mesh paint;
PaintAtlas.Tile tile;

PlacedPot(Pottery pottery, double x, double z) {
vessel.vessel(x, 0, z, pottery.discs(), Mesh.Texture.FIRED_CLAY);
vessel.fitSprite();
if (!FacePaint.EMPTY.equals(pottery.paint())) {
Mesh overlay = FlowerPaint.overlay(vessel, x, 0, z, pottery);
if (pottery.hasFlowerPaint() && !pottery.isPlate()) {
vessel.add(overlay);
} else {
paint = overlay;
tile = PaintAtlas.acquire(pottery.paint());
private Mesh fluid;
private int fluidAmount;

Mesh fluidMesh(int slot, Pottery pottery, int amount) {
if (fluid == null || amount != fluidAmount) {
var center = PotteryBlockEntity.box(slot, pottery.size()).getCenter();
double x = center.x * 32, z = center.z * 32;
Mesh mesh = new Mesh();
mesh.cavity(x, 0, z, pottery, amount);
if (slot >= PotteryBlockEntity.CORNERS) {
mesh.scaleWidth(x, z, PotteryBlockEntity.PLATE_SCALE);
}
fluid = mesh;
fluidAmount = amount;
}
return fluid;
}

PlacedPot(Pottery pottery, double x, double z, double width) {
vessel = Mesh.placedVessel(x, z, pottery, width);
if (!FacePaint.EMPTY.equals(pottery.paint()) && (pottery.isPlate() || !pottery.hasFlowerPaint())) {
paint = FlowerPaint.overlay(vessel, x, 0, z, pottery);
// Plate paint is generated from the unscaled profile, vessel paint from the mesh.
if (pottery.isPlate() && width != 1) paint.scaleWidth(x, z, width);
tile = PaintAtlas.acquire(pottery.paint());
}
}
}
Expand All @@ -426,12 +439,8 @@ private PlacedPot[] bodies(Pottery[] slots, boolean[] lids) {
var center = PotteryBlockEntity.box(i, pottery.size()).getCenter();
double x = center.x * 32, z = center.z * 32;
if (positions[i] == null) {
var body = new PlacedPot(pottery, x, z);
if (i >= PotteryBlockEntity.CORNERS) {
body.vessel.scaleWidth(x, z, PotteryBlockEntity.PLATE_SCALE);
if (body.paint != null) body.paint.scaleWidth(x, z, PotteryBlockEntity.PLATE_SCALE);
}
positions[i] = body;
double width = i >= PotteryBlockEntity.CORNERS ? PotteryBlockEntity.PLATE_SCALE : 1;
positions[i] = new PlacedPot(pottery, x, z, width);
}
if (lids[i]) {
var cover = pottery.cover();
Expand Down Expand Up @@ -460,7 +469,7 @@ private static void drawClay(
}
}

private static List<FluidDraw> fluids(Pottery[] slots, VesselContents[] contents) {
private static List<FluidDraw> fluids(PlacedPot[] bodies, Pottery[] slots, VesselContents[] contents) {
List<FluidDraw> draws = new ArrayList<>();
if (contents == null) {
return draws;
Expand All @@ -475,12 +484,7 @@ private static List<FluidDraw> fluids(Pottery[] slots, VesselContents[] contents
if (sprite == null) {
continue;
}
Mesh body = new Mesh();
AABB box = PotteryBlockEntity.box(index, pottery.size());
body.cavity(box.getCenter().x * 32, 0, box.getCenter().z * 32, pottery, held.amount());
if (index >= PotteryBlockEntity.CORNERS) {
body.scaleWidth(box.getCenter().x * 32, box.getCenter().z * 32, PotteryBlockEntity.PLATE_SCALE);
}
Mesh body = bodies[index].fluidMesh(index, pottery, held.amount());
if (body.quads().isEmpty()) {
continue;
}
Expand Down
Loading