From f53823b616d14321578c9b6b10fef119fec34472 Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 18:27:16 +0200 Subject: [PATCH 01/11] Share pottery profiles and backport painted vessels to Forge 1.12.2 and 1.20.1 Co-authored-by: Face of Cat --- .../1.12.2/potterycheck/DisplayCheck.java | 100 ++++++++++ .../1.20.1/potterycheck/DisplayCheck.java | 107 +++++++++++ .github/forge-display-check/check.init.gradle | 18 ++ .github/workflows/ci.yml | 50 ++++- README.md | 15 +- .../src/main/groovy/multiloader-common.gradle | 3 + core/build.gradle | 11 ++ .../primalpottery/pottery/BakedVessels.java | 49 +++++ .../primalpottery/pottery/FacePaint.java | 42 +++-- .../primalpottery/pottery/PaintedVessel.java | 133 ++++++++++++++ .../primalpottery/pottery/Pottery.java | 126 ++++++------- .../primalpottery/pottery/PotteryCodec.java | 57 ++++++ .../primalpottery/pottery/PotteryDisc.java | 38 ++++ .../primalpottery/pottery/PotteryProfile.java | 41 ++++- .../primalpottery/pottery/PotteryType.java | 50 +++++ .../pottery/VesselQuadPacker.java | 51 ++++++ forge/build.gradle | 33 ++++ .../primalpottery/forge/ForgePotteryTags.java | 33 ++++ .../primalpottery/forge/PaintedPotBlock.java | 41 +++++ .../primalpottery/forge/PaintedPotEntity.java | 60 ++++++ .../forge/PrimalPotteryForge.java | 31 ++++ .../forge/client/PotteryModel.java | 73 ++++++++ .../forge/client/PotteryQuads.java | 19 ++ forge/src/main/resources/META-INF/mods.toml | 14 ++ .../primalpottery/blockstates/pottery.json | 1 + .../assets/primalpottery/lang/en_us.json | 1 + .../primalpottery/models/block/pottery.json | 8 + .../models/block/pottery_inks.json | 1 + .../primalpottery/models/item/pottery.json | 1 + .../textures/block/pottery_inks.png | Bin 0 -> 396 bytes forge/src/main/resources/pack.mcmeta | 1 + legacy/forge-1.12.2/build.gradle | 48 +++++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54413 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + legacy/forge-1.12.2/gradlew | 172 ++++++++++++++++++ legacy/forge-1.12.2/gradlew.bat | 84 +++++++++ legacy/forge-1.12.2/settings.gradle | 3 + .../legacy/ForgePotteryTags.java | 33 ++++ .../primalpottery/legacy/PaintedPotBlock.java | 78 ++++++++ .../legacy/PaintedPotEntity.java | 54 ++++++ .../legacy/PrimalPotteryForge.java | 30 +++ .../legacy/client/PotteryModel.java | 84 +++++++++ .../legacy/client/PotteryQuads.java | 20 ++ .../primalpottery/blockstates/pottery.json | 1 + .../assets/primalpottery/lang/en_us.lang | 1 + .../src/main/resources/mcmod.info | 1 + .../src/main/resources/pack.mcmeta | 1 + neoforge/build.gradle | 1 + settings.gradle.kts | 1 + .../block/PaintingTableEntity.java | 3 +- .../block/PotteryBlockEntity.java | 5 +- .../block/PotteryWheelBlockEntity.java | 13 +- .../primalpottery/client/ItemIconStamp.java | 3 +- .../primalpottery/client/PaintAtlas.java | 3 +- .../primalpottery/client/PaintingScreen.java | 5 +- .../primalpottery/client/PlatePaint.java | 3 +- .../primalpottery/client/PotteryPaint.java | 3 +- .../primalpottery/client/TemplateScreen.java | 2 +- .../primalpottery/item/PotteryItem.java | 9 +- .../primalpottery/item/RawPotteryItem.java | 9 +- .../primalpottery/item/TemplateItem.java | 7 +- .../primalpottery/menu/PaintingMenu.java | 3 +- .../primalpottery/pottery/PaintColors.java | 19 ++ .../primalpottery/pottery/PotteryDisc.java | 7 - .../primalpottery/pottery/PotteryTags.java | 30 +++ .../primalpottery/pottery/PotteryType.java | 57 ------ .../primalpottery/client/MeshTest.java | 5 +- .../primalpottery/pottery/PotteryTest.java | 40 ++-- stonecutter.gradle.kts | 5 +- 69 files changed, 1850 insertions(+), 206 deletions(-) create mode 100644 .github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java create mode 100644 .github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java create mode 100644 .github/forge-display-check/check.init.gradle create mode 100644 core/build.gradle create mode 100644 core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/BakedVessels.java rename {src => core/src}/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java (70%) create mode 100644 core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java rename {src => core/src}/main/java/net/modcrafters/minecraft/primalpottery/pottery/Pottery.java (82%) create mode 100644 core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryCodec.java create mode 100644 core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryDisc.java rename {src => core/src}/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryProfile.java (86%) create mode 100644 core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryType.java create mode 100644 core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/VesselQuadPacker.java create mode 100644 forge/build.gradle create mode 100644 forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/ForgePotteryTags.java create mode 100644 forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PaintedPotBlock.java create mode 100644 forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PaintedPotEntity.java create mode 100644 forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PrimalPotteryForge.java create mode 100644 forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryModel.java create mode 100644 forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java create mode 100644 forge/src/main/resources/META-INF/mods.toml create mode 100644 forge/src/main/resources/assets/primalpottery/blockstates/pottery.json create mode 100644 forge/src/main/resources/assets/primalpottery/lang/en_us.json create mode 100644 forge/src/main/resources/assets/primalpottery/models/block/pottery.json create mode 100644 forge/src/main/resources/assets/primalpottery/models/block/pottery_inks.json create mode 100644 forge/src/main/resources/assets/primalpottery/models/item/pottery.json create mode 100644 forge/src/main/resources/assets/primalpottery/textures/block/pottery_inks.png create mode 100644 forge/src/main/resources/pack.mcmeta create mode 100644 legacy/forge-1.12.2/build.gradle create mode 100644 legacy/forge-1.12.2/gradle/wrapper/gradle-wrapper.jar create mode 100644 legacy/forge-1.12.2/gradle/wrapper/gradle-wrapper.properties create mode 100755 legacy/forge-1.12.2/gradlew create mode 100644 legacy/forge-1.12.2/gradlew.bat create mode 100644 legacy/forge-1.12.2/settings.gradle create mode 100644 legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/ForgePotteryTags.java create mode 100644 legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotBlock.java create mode 100644 legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotEntity.java create mode 100644 legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PrimalPotteryForge.java create mode 100644 legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryModel.java create mode 100644 legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryQuads.java create mode 100644 legacy/forge-1.12.2/src/main/resources/assets/primalpottery/blockstates/pottery.json create mode 100644 legacy/forge-1.12.2/src/main/resources/assets/primalpottery/lang/en_us.lang create mode 100644 legacy/forge-1.12.2/src/main/resources/mcmod.info create mode 100644 legacy/forge-1.12.2/src/main/resources/pack.mcmeta create mode 100644 src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintColors.java delete mode 100644 src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryDisc.java create mode 100644 src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryTags.java delete mode 100644 src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryType.java diff --git a/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java b/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java new file mode 100644 index 0000000..8f07c83 --- /dev/null +++ b/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java @@ -0,0 +1,100 @@ +package potterycheck; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Locale; +import net.minecraft.client.Minecraft; +import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; +import net.modcrafters.minecraft.primalpottery.legacy.ForgePotteryTags; +import net.modcrafters.minecraft.primalpottery.legacy.PaintedPotEntity; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ScreenShotHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.GameType; +import net.minecraft.world.WorldServer; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.modcrafters.minecraft.primalpottery.legacy.PrimalPotteryForge; + +@Mod.EventBusSubscriber(modid = "primalpottery", value = Side.CLIENT) +// Runs only in the disposable hosted world, under Xvfb with Mesa software rendering. +public final class DisplayCheck { + private static boolean opening; + private static boolean placed; + private static int ticks; + private static long firstFrame; + private static long previousFrame; + private static final ArrayList frames = new ArrayList<>(); + private static final String WORLD = "painted-pot-display"; + + @SubscribeEvent public static void tick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.END) return; + Minecraft mc = Minecraft.getMinecraft(); + if (!opening && mc.currentScreen instanceof GuiMainMenu) { + opening = true; + mc.gameSettings.limitFramerate = 30; + mc.gameSettings.pauseOnLostFocus = false; + mc.launchIntegratedServer(WORLD, WORLD, new WorldSettings(42, GameType.CREATIVE, false, false, WorldType.FLAT)); + return; + } + if (mc.player == null || mc.world == null || ++ticks < 40) return; + if (!placed) { + placed = true; + mc.gameSettings.hideGUI = true; + mc.getIntegratedServer().addScheduledTask(() -> { + WorldServer level = mc.getIntegratedServer().getWorld(0); + install(level); + mc.getIntegratedServer().getPlayerList().getPlayers().get(0).connection.setPlayerLocation(.5, 85, -18.5, 0, 5); + }); + } + } + + private static void install(WorldServer level) { + BlockPos platform = new BlockPos(0, 84, -19); + level.setBlockState(platform, Blocks.STONE.getDefaultState()); + StringBuilder pixels = new StringBuilder(256); + for (int y = 0; y < 16; y++) for (int x = 0; x < 16; x++) pixels.append((x + y) % 2 == 0 ? 'A' : 'O'); + Pottery model = Pottery.jug().withPaint(FacePaint.read(pixels.toString())); + ItemStack stack = new ItemStack(PrimalPotteryForge.POT); + stack.setTagInfo("pottery", ForgePotteryTags.save(model)); + for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { + BlockPos pos = new BlockPos(x, y, 0); + level.setBlockState(pos, PrimalPotteryForge.POT.getDefaultState()); + PrimalPotteryForge.POT.onBlockPlacedBy(level, pos, level.getBlockState(pos), null, stack); + } + } + + @SubscribeEvent public static void frame(TickEvent.RenderTickEvent event) throws Exception { + if (!placed || event.phase != TickEvent.Phase.END) return; + Minecraft mc = Minecraft.getMinecraft(); + if (mc.player == null || mc.currentScreen != null || mc.player.posZ > -18) return; + long now = System.nanoTime(); + if (firstFrame == 0) { + for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { + if (!(mc.world.getTileEntity(new BlockPos(x,y,0)) instanceof PaintedPotEntity)) return; + } + firstFrame = previousFrame = now; + return; + } + if (now - firstFrame > 5_000_000_000L) frames.add(now - previousFrame); + previousFrame = now; + if (now - firstFrame < 17_000_000_000L) return; + placed = false; + Collections.sort(frames); + String report = String.format(Locale.ROOT, "200 checkerboard pots, %d frames, p50 %.2f ms, p95 %.2f ms (30 FPS cap)", + frames.size(), frames.get(frames.size() / 2) / 1e6, frames.get(frames.size() * 95 / 100) / 1e6); + ScreenShotHelper.saveScreenshot(new File("."), "pots.png", mc.displayWidth, mc.displayHeight, mc.getFramebuffer()); + Files.write(Paths.get("display-check.txt"), Collections.singletonList(report)); + mc.shutdown(); + } +} diff --git a/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java b/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java new file mode 100644 index 0000000..92219fb --- /dev/null +++ b/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java @@ -0,0 +1,107 @@ +package potterycheck; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Locale; +import net.minecraft.client.Minecraft; +import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; +import net.modcrafters.minecraft.primalpottery.forge.ForgePotteryTags; +import net.modcrafters.minecraft.primalpottery.forge.PaintedPotEntity; +import net.minecraft.client.Screenshot; +import net.minecraft.client.gui.screens.TitleScreen; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.Difficulty; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.levelgen.WorldOptions; +import net.minecraft.world.level.levelgen.presets.WorldPresets; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.event.TickEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.registries.ForgeRegistries; + +@Mod.EventBusSubscriber(modid = "primalpottery", value = Dist.CLIENT) +// Runs only in the disposable hosted world, under Xvfb with Mesa software rendering. +public final class DisplayCheck { + private static boolean opening; + private static boolean placed; + private static int ticks; + private static long firstFrame; + private static long previousFrame; + private static final ArrayList frames = new ArrayList<>(); + private static final String WORLD = "painted-pot-display"; + + @SubscribeEvent public static void tick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.END) return; + Minecraft mc = Minecraft.getInstance(); + if (!opening && mc.screen instanceof TitleScreen && mc.getOverlay() == null) { + opening = true; + mc.options.framerateLimit().set(30); + mc.options.pauseOnLostFocus = false; + LevelSettings settings = new LevelSettings(WORLD, GameType.CREATIVE, false, Difficulty.PEACEFUL, + true, new GameRules(), WorldDataConfiguration.DEFAULT); + mc.createWorldOpenFlows().createFreshLevel(WORLD, settings, new WorldOptions(42L, false, false), + access -> access.registryOrThrow(Registries.WORLD_PRESET).getOrThrow(WorldPresets.FLAT).createWorldDimensions()); + return; + } + if (mc.player == null || mc.level == null || ++ticks < 40) return; + if (!placed) { + placed = true; + mc.options.hideGui = true; + var server = mc.getSingleplayerServer(); + server.execute(() -> { + install(server.overworld()); + server.getPlayerList().getPlayers().get(0).connection.teleport(.5, 85, -18.5, 0, 5); + }); + } + } + + private static void install(ServerLevel level) { + BlockPos platform = new BlockPos(0, 84, -19); + level.setBlockAndUpdate(platform, Blocks.STONE.defaultBlockState()); + StringBuilder pixels = new StringBuilder(256); + for (int y = 0; y < 16; y++) for (int x = 0; x < 16; x++) pixels.append((x + y) % 2 == 0 ? 'A' : 'O'); + Pottery model = Pottery.jug().withPaint(FacePaint.read(pixels.toString())); + var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("primalpottery", "pottery")); + ItemStack stack = new ItemStack(block); + stack.addTagElement("pottery", ForgePotteryTags.save(model)); + for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { + BlockPos pos = new BlockPos(x, y, 0); + level.setBlockAndUpdate(pos, block.defaultBlockState()); + block.setPlacedBy(level, pos, block.defaultBlockState(), null, stack); + } + } + + @SubscribeEvent public static void frame(TickEvent.RenderTickEvent event) throws Exception { + if (!placed || event.phase != TickEvent.Phase.END) return; + Minecraft mc = Minecraft.getInstance(); + if (mc.player == null || mc.screen != null || mc.player.getZ() > -18) return; + long now = System.nanoTime(); + if (firstFrame == 0) { + for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { + if (!(mc.level.getBlockEntity(new BlockPos(x,y,0)) instanceof PaintedPotEntity)) return; + } + firstFrame = previousFrame = now; + return; + } + if (now - firstFrame > 5_000_000_000L) frames.add(now - previousFrame); + previousFrame = now; + if (now - firstFrame < 17_000_000_000L) return; + placed = false; + Collections.sort(frames); + String report = String.format(Locale.ROOT, "200 checkerboard pots, %d frames, p50 %.2f ms, p95 %.2f ms (30 FPS cap)", + frames.size(), frames.get(frames.size() / 2) / 1e6, frames.get(frames.size() * 95 / 100) / 1e6); + try (var image = Screenshot.takeScreenshot(mc.getMainRenderTarget())) { image.writeToFile(new File("pots.png")); } + Files.write(Paths.get("display-check.txt"), Collections.singletonList(report)); + mc.stop(); + } +} diff --git a/.github/forge-display-check/check.init.gradle b/.github/forge-display-check/check.init.gradle new file mode 100644 index 0000000..6fdad3c --- /dev/null +++ b/.github/forge-display-check/check.init.gradle @@ -0,0 +1,18 @@ +// Only used by the hosted display check. The production jars are built in a separate Gradle invocation. +gradle.beforeProject { p -> + if (p.path == ':forge') p.afterEvaluate { + p.sourceSets.main.java.srcDir(p.rootProject.file('.github/forge-display-check/1.20.1')) + p.legacyForge.runs.client { + gameDirectory = p.rootProject.file('build/display-check') + programArguments.addAll '--width', '854', '--height', '480' + } + } + if (p == p.rootProject && p.name == 'primalpottery-forge-1.12.2') p.afterEvaluate { + p.sourceSets.main.java.srcDir(p.file('../../.github/forge-display-check/1.12.2')) + p.minecraft.runs.client { + workingDirectory p.file('../../build/display-check') + args '--width','854','--height','480' + mods { primalpottery { source p.sourceSets.main } } + } + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 269d38b..dedf349 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,10 +103,58 @@ jobs: name: jars-1.21.1 path: neoforge/versions/1.21.1/build/libs/primalpottery-neoforge-1.21.1-*.jar + forge-painted-pot: + name: Forge painted pot ${{ matrix.minecraft }} + runs-on: ubuntu-latest + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + include: + - minecraft: '1.12.2' + java: '8' + directory: legacy/forge-1.12.2 + build: ./gradlew build + client: ./gradlew -I ../../.github/forge-display-check/check.init.gradle runClient + - minecraft: '1.20.1' + java: '21' + directory: . + build: ./gradlew :forge:build + client: ./gradlew -I .github/forge-display-check/check.init.gradle :forge:runClient + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-java@v6 + with: + distribution: temurin + java-version: ${{ matrix.java }} + - uses: gradle/actions/setup-gradle@v6 + - name: Build production jar + working-directory: ${{ matrix.directory }} + run: ${{ matrix.build }} + - name: Render 200 painted pots on the hosted software renderer + working-directory: ${{ matrix.directory }} + env: + LIBGL_ALWAYS_SOFTWARE: '1' + ALSOFT_DRIVERS: 'null' + run: | + mkdir -p "$GITHUB_WORKSPACE/build/display-check" + printf 'onboardAccessibility:false\nmaxFps:30\npauseOnLostFocus:false\nrenderDistance:5\n' > "$GITHUB_WORKSPACE/build/display-check/options.txt" + timeout 20m xvfb-run -a ${{ matrix.client }} + cat "$GITHUB_WORKSPACE/build/display-check/display-check.txt" + - uses: actions/upload-artifact@v7 + if: always() + with: + name: forge-display-${{ matrix.minecraft }} + path: | + build/display-check/**/*.png + build/display-check/display-check.txt + build/display-check/logs/latest.log + build/display-check/crash-reports/ + all-versions: name: all-versions if: always() - needs: [mc-26-3, mc-1-20-6, mc-1-21-1, release-scripts] + needs: [mc-26-3, mc-1-20-6, mc-1-21-1, forge-painted-pot, release-scripts] runs-on: ubuntu-latest steps: - name: Every check passed diff --git a/README.md b/README.md index d203f1e..815b0b5 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,17 @@ Shape clay on a wheel. -The `main` branch is a Java mod built with Stonecutter. NeoForge covers 1.20.6, 1.21.1, and 26.3. Fabric covers 26.3. Shared sources are written for 26.3. The Forge 1.12 mod remains on the `1.12` branch. +NeoForge covers 1.20.6, 1.21.1, and 26.3. Fabric covers 26.3. Stonecutter keeps their Minecraft integration in `src/`, written for 26.3. The Java 8 library in `core/` owns the pottery profile, classification, dimensions and paint. -`./gradlew collectJars` writes the loader jars to `build/libs//`. +`./gradlew collectJars` collects the Stonecutter loader jars in `build/libs//`. + +## Forge painted-pot preview + +The Forge previews for 1.12.2 and 1.20.1 support one fired vessel per block. Use `/give @p primalpottery:pottery` for a flower-painted jug. Place it, reload the world and harvest it in survival to recover the profile and paint. Both versions use the same disc list and 16 × 16 face pattern. The template editor, wheel and firing recipes are later milestones. + +| Target | Build | Output | +|---|---|---| +| Forge 1.20.1 · Java 17 game | From the root, run `./gradlew :forge:build` with the modern Gradle JDK. | `forge/build/libs/` | +| Forge 1.12.2 · Java 8 game | From `legacy/forge-1.12.2/`, set `JAVA_HOME` to a JDK 8 and run `./gradlew build`. | `legacy/forge-1.12.2/build/libs/` | + +Use `gradlew.bat` on Windows. The Forge directories each contain their own block, saved-data and baked-model adapters. Both compile against the same checkout of `core/` and include it in their production jar. diff --git a/build-logic/src/main/groovy/multiloader-common.gradle b/build-logic/src/main/groovy/multiloader-common.gradle index ef54462..1c57dc4 100644 --- a/build-logic/src/main/groovy/multiloader-common.gradle +++ b/build-logic/src/main/groovy/multiloader-common.gradle @@ -4,6 +4,7 @@ plugins { } // Version projects sit at : for the common code and :: for fabric and neoforge. +evaluationDependsOn(':core') def loaderName = project.parent == rootProject ? 'common' : project.parent.name // The common project for this Minecraft version, e.g. :26.3 for :fabric:26.3. def commonProject = loaderName == 'common' ? project : rootProject.project(":${project.name}") @@ -15,6 +16,7 @@ repositories { } dependencies { + implementation project(':core') // Null annotations: newer Minecraft ships JSpecify, 1.21.1 doesn't. compileOnly 'org.jspecify:jspecify:1.0.0' } @@ -75,6 +77,7 @@ tasks.withType(Jar).configureEach { } jar { + from(project(':core').sourceSets.main.output) manifest { attributes([ diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 0000000..4e06a2c --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,11 @@ +plugins { + id 'java-library' +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} +if (JavaVersion.current().isJava9Compatible()) { + tasks.withType(JavaCompile).configureEach { options.release = 8 } +} diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/BakedVessels.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/BakedVessels.java new file mode 100644 index 0000000..f876e38 --- /dev/null +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/BakedVessels.java @@ -0,0 +1,49 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** One cache per atlas bake. Chunk builders and the inventory can share an immutable list of native faces. */ +public abstract class BakedVessels { + private static final int MAX_QUADS = 32768; + private final Map> models = new LinkedHashMap<>(16, .75F, true); + private int quads; + + private static final class Key { + final List discs; + final FacePaint paint; + Key(Pottery pot) { discs = pot.discs(); paint = pot.paint(); } + @Override public int hashCode() { return discs.hashCode() * 31 + paint.hashCode(); } + @Override public boolean equals(Object obj) { + if (!(obj instanceof Key)) return false; + Key other = (Key) obj; + return discs.equals(other.discs) && paint.equals(other.paint); + } + } + + public synchronized List model(Pottery pot) { + Key key = new Key(pot); + List cached = models.get(key); + if (cached != null) return cached; + List faces = new ArrayList<>(); + new PaintedVessel(pot, (a, b, c, d, ink) -> faces.add(bake(a, b, c, d, ink))); + List model = Collections.unmodifiableList(faces); + if (model.size() > MAX_QUADS) return model; + Iterator> oldest = models.values().iterator(); + int weight = Math.max(1, model.size()); + while (quads + weight > MAX_QUADS && oldest.hasNext()) { + quads -= Math.max(1, oldest.next().size()); + oldest.remove(); + } + quads += weight; + models.put(key, model); + return model; + } + + protected abstract Q bake(PaintedVessel.Vertex a, PaintedVessel.Vertex b, PaintedVessel.Vertex c, + PaintedVessel.Vertex d, int pigment); +} diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java similarity index 70% rename from src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java rename to core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java index aca9cc0..6d2ecf3 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java @@ -1,17 +1,41 @@ package net.modcrafters.minecraft.primalpottery.pottery; -import net.minecraft.world.item.DyeColor; +import java.util.Arrays; /** One upright 16 by 16 face, stored once and repeated around the vessel. */ -public record FacePaint(String pixels) { +public final class FacePaint { + private final String pixels; + + public FacePaint(String pixels) { + this.pixels = pixels; + } + + public String pixels() { return pixels; } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof FacePaint)) return false; + FacePaint other = (FacePaint) obj; + return pixels.equals(other.pixels); + } + + @Override + public int hashCode() { return pixels.hashCode(); } + public static final int SIDE = 16; public static final int CELLS = SIDE * SIDE; public static final int COLORS = 16; public static final int ERASE = -1; - public static final FacePaint EMPTY = new FacePaint(".".repeat(CELLS)); + public static final FacePaint EMPTY = new FacePaint(blankPixels()); private static final String FLOWER_INKS = "ipygtsl"; private static final int[] FLOWER_RGB = {0xFFF1CA, 0xEAC89A, 0xF4C04D, 0xCA8338, 0x467D68, 0x62927A, 0x83A979}; + private static String blankPixels() { + char[] pixels = new char[CELLS]; + Arrays.fill(pixels, '.'); + return new String(pixels); + } + public static FacePaint read(String pixels) { if ("flower".equals(pixels)) return readLegacyFlower(); if (pixels.length() != CELLS || !pixels.chars().allMatch(c -> c == '.' || c >= 'A' && c < 'A' + COLORS + FLOWER_RGB.length)) { @@ -44,15 +68,5 @@ public FacePaint with(int cell, int color) { return new FacePaint(next.toString()); } - public static int rgb(int color) { - if (color >= COLORS) { - return FLOWER_RGB[color - COLORS]; - } - //? if >=1.21 { - return DyeColor.byId(color).getTextureDiffuseColor() & 0xFFFFFF; - //?} else { - /*float[] rgb = DyeColor.byId(color).getTextureDiffuseColors(); - return Math.round(rgb[0] * 255) << 16 | Math.round(rgb[1] * 255) << 8 | Math.round(rgb[2] * 255); - *///?} - } + public static int flowerRgb(int color) { return FLOWER_RGB[color - COLORS]; } } diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java new file mode 100644 index 0000000..655e693 --- /dev/null +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java @@ -0,0 +1,133 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import java.util.List; + +/** Bakes a stationary vessel into ordinary chunk faces. Coordinates are in local block units. */ +public final class PaintedVessel { + public static final Pottery SAMPLE = Pottery.jug().withPaint(FacePaint.read("flower")); + public static final int CLAY = -1; + private static final int SIDES = 8; + private static final double UNITS = 32; + private static final double[] X = new double[SIDES + 1]; + private static final double[] Z = new double[SIDES + 1]; + static { + for (int side = 0; side <= SIDES; side++) { + double angle = (side % SIDES + 0.5) * Math.PI / 4; + X[side] = Math.cos(angle) / UNITS; + Z[side] = Math.sin(angle) / UNITS; + } + } + + public interface Faces { + void quad(Vertex a, Vertex b, Vertex c, Vertex d, int pigment); + } + + public static final class Vertex { + public final float x, y, z, u, v; + + Vertex(double x, double y, double z, double u, double v) { + this.x = (float) x; + this.y = (float) y; + this.z = (float) z; + this.u = (float) u; + this.v = (float) v; + } + } + + private final Pottery pot; + private final Faces faces; + private final double paintTop; + private final double paintSpan; + private final int[] nextPaintRow = new int[FacePaint.SIDE]; + + public PaintedVessel(Pottery pot, Faces faces) { + this.pot = pot; + this.faces = faces; + List outside = PotteryProfile.profile(pot.discs(), false); + double middle = pot.height() * 0.48; + paintSpan = Math.min(2 * Math.sin(Math.PI / 8) * PotteryProfile.sample(outside, middle), pot.height() * 0.84); + paintTop = middle + paintSpan / 2; + String pixels = pot.paint().pixels(); + for (int row = FacePaint.SIDE - 1; row >= 0; row--) { + int next = row + 1; + nextPaintRow[row] = next < FacePaint.SIDE && pixels.regionMatches(row * 16, pixels, next * 16, 16) + ? nextPaintRow[next] : next; + } + surface(outside, true); + surface(PotteryProfile.profile(pot.discs(), true), false); + PotteryDisc lip = pot.discs().get(0); + PotteryDisc foot = pot.discs().get(pot.discs().size() - 1); + ring(pot.height(), lip.radius(), lip.innerRadius(), true); + ring(0, foot.radius(), foot.innerRadius(), false); + } + + private void surface(List outline, boolean outside) { + for (int i = 1; i < outline.size(); i++) { + PotteryProfile.Station low = outline.get(i - 1); + PotteryProfile.Station high = outline.get(i); + if (low.y() == high.y()) { + ring(low.y(), Math.max(low.radius(), high.radius()), Math.min(low.radius(), high.radius()), + outside == (low.radius() > high.radius())); + continue; + } + if (low.radius() == 0 && high.radius() == 0) continue; + for (int side = 0; side < SIDES; side++) { + Vertex a = vertex(side, low.radius(), low.y(), 0, 16); + Vertex b = vertex(side + 1, low.radius(), low.y(), 16, 16); + Vertex c = vertex(side + 1, high.radius(), high.y(), 16, 0); + Vertex d = vertex(side, high.radius(), high.y(), 0, 0); + if (outside) { + faces.quad(b, a, d, c, CLAY); + if (!FacePaint.EMPTY.equals(pot.paint())) paint(low, high, side); + } else { + faces.quad(a, b, c, d, CLAY); + } + } + } + } + + private void ring(double y, double outer, double inner, boolean up) { + if (outer <= inner) return; + for (int side = 0; side < SIDES; side++) { + Vertex a = vertex(side, outer, y, 0, 16); + Vertex b = vertex(side + 1, outer, y, 16, 16); + Vertex c = vertex(side + 1, inner, y, 16, 0); + Vertex d = vertex(side, inner, y, 0, 0); + if (up) faces.quad(d, c, b, a, CLAY); + else faces.quad(a, b, c, d, CLAY); + } + } + + private Vertex vertex(int side, double radius, double y, double u, double v) { + return new Vertex(0.5 + X[side] * radius, y / UNITS, 0.5 + Z[side] * radius, u, v); + } + + private Vertex paintVertex(int side, double radius, double y, int column) { + double t = column / 16.0; + double x = X[side + 1] + (X[side] - X[side + 1]) * t; + double z = Z[side + 1] + (Z[side] - Z[side + 1]) * t; + return new Vertex(0.5 + x * radius * 1.003, y / UNITS, 0.5 + z * radius * 1.003, 8, 8); + } + + private void paint(PotteryProfile.Station low, PotteryProfile.Station high, int side) { + if (paintSpan <= 0 || high.y() <= paintTop - paintSpan || low.y() >= paintTop) return; + double slope = (high.radius() - low.radius()) / (high.y() - low.y()); + for (int row = 0; row < FacePaint.SIDE;) { + int end = nextPaintRow[row]; + double top = Math.min(high.y(), paintTop - row * paintSpan / 16); + double bottom = Math.max(low.y(), paintTop - end * paintSpan / 16); + int offset = row * 16; + row = end; + if (top <= bottom) continue; + double r0 = low.radius() + (bottom - low.y()) * slope; + double r1 = low.radius() + (top - low.y()) * slope; + for (int x = 0; x < FacePaint.SIDE;) { + int start = x++; + int ink = pot.paint().color(offset + start); + while (x < 16 && pot.paint().color(offset + x) == ink) x++; + if (ink != FacePaint.ERASE) faces.quad(paintVertex(side, r0, bottom, start), + paintVertex(side, r0, bottom, x), paintVertex(side, r1, top, x), paintVertex(side, r1, top, start), ink); + } + } + } +} diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/Pottery.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/Pottery.java similarity index 82% rename from src/main/java/net/modcrafters/minecraft/primalpottery/pottery/Pottery.java rename to core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/Pottery.java index b64d75f..9f1823c 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/Pottery.java +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/Pottery.java @@ -2,9 +2,9 @@ import java.util.ArrayList; import java.util.List; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import org.jspecify.annotations.Nullable; +import java.util.Arrays; +import java.util.Collections; +import java.util.stream.Collectors; public final class Pottery { public static final int TEMPLATE_WALL = 2; @@ -29,7 +29,7 @@ int capacity(double hollow) { if (hollow >= largestHollow - 8 * Math.ulp(largestHollow)) { return this.maxVolume; } - return (int) Math.clamp(Math.round(this.maxVolume * hollow / largestHollow), 1, this.maxVolume - 1); + return (int) Math.max(1, Math.min(Math.round(this.maxVolume * hollow / largestHollow), this.maxVolume - 1)); } public int radius() { @@ -62,7 +62,7 @@ public Pottery(Size size, List discs, FacePaint paint) { public Pottery(Size size, List discs, FacePaint paint, boolean allowPlatter) { this.size = size; - this.discs = List.copyOf(discs); + this.discs = Collections.unmodifiableList(new ArrayList<>(discs)); this.paint = paint; this.height = this.discs.stream().mapToDouble(PotteryDisc::height).sum(); this.widestRadius = this.discs.stream().mapToDouble(PotteryDisc::radius).max().orElse(0); @@ -151,7 +151,7 @@ private boolean hasPlateShape() { for (PotteryDisc disc : discs) { if (disc.radius() - disc.innerRadius() < 0.5) return false; } - return discs.getLast().innerRadius() == 0; + return discs.get(discs.size() - 1).innerRadius() == 0; } /** Edge slots identify plates in saves from before the minimum radius. */ @@ -159,7 +159,7 @@ public Pottery fitSavedPlate() { if (size != Size.SMALL || !hasPlateShape() || widestRadius() >= MIN_PLATE_RADIUS) return this; double width = widestRadius(); return new Pottery(size, discs.stream().map(d -> new PotteryDisc(d.height(), - d.radius() / width * MIN_PLATE_RADIUS, d.innerRadius() / width * MIN_PLATE_RADIUS)).toList(), paint); + d.radius() / width * MIN_PLATE_RADIUS, d.innerRadius() / width * MIN_PLATE_RADIUS)).collect(Collectors.toList()), paint); } public int paintColumns() { @@ -218,11 +218,38 @@ public static double cavityArea(double innerRadius) { * Where a lid is drawn. {@code top} is the pot's top, {@code layer} is the top disc's height, * and {@code radius} is the fitted plate radius. The lid is not stored on the profile. */ - public record Cover(double top, double layer, double radius) { + public static final class Cover { + private final double top; + private final double layer; + private final double radius; + + public Cover(double top, double layer, double radius) { + this.top = top; + this.layer = layer; + this.radius = radius; + } + + public double top() { return top; } + + public double layer() { return layer; } + + public double radius() { return radius; } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Cover)) return false; + Cover other = (Cover) obj; + return Double.compare(top, other.top) == 0 + && Double.compare(layer, other.layer) == 0 + && Double.compare(radius, other.radius) == 0; + } + + @Override + public int hashCode() { return java.util.Objects.hash(top, layer, radius); } } /** The rim a lid can cover, or null when the profile has no open mouth. */ - public @Nullable Cover cover() { + public Cover cover() { if (isPlate()) return null; int rim = this.rimIndex(); if (rim < 0) { @@ -240,7 +267,7 @@ public record Cover(double top, double layer, double radius) { /** * The lid plate: one pixel thick, and fitted to the rim. Null when {@link #cover()} is null. */ - public @Nullable PotteryDisc lidDisc() { + public PotteryDisc lidDisc() { Cover cover = this.cover(); if (cover == null) { return null; @@ -281,55 +308,6 @@ private static PotteryType vesselType(double openingRadius, double maxRadius) { return PotteryType.JAR; } - public CompoundTag save() { - CompoundTag tag = new CompoundTag(); - ListTag list = new ListTag(); - for (PotteryDisc disc : this.discs) { - CompoundTag discTag = new CompoundTag(); - discTag.putDouble("height", disc.height()); - discTag.putDouble("radius", disc.radius()); - discTag.putDouble("inner", disc.innerRadius()); - list.add(discTag); - } - tag.put("discs", list); - if (!FacePaint.EMPTY.equals(this.paint)) { - tag.putString("paint", this.paint.pixels()); - } - if (this.size == Size.LARGE) { - tag.putBoolean("large", true); - if (isPlatter()) tag.putBoolean("platter", true); - } - return tag; - } - - public static Pottery load(CompoundTag tag) { - Pottery loaded = readProfile(tag); - return loaded == null ? display() : loaded; - } - - public static @Nullable Pottery readProfile(CompoundTag tag) { - Size size = Nbt.getBoolean(tag, "large") ? Size.LARGE : Size.SMALL; - List discs = new ArrayList<>(); - ListTag list = Nbt.list(tag, "discs"); - if (list.size() > MAX_DISCS) { - return null; - } - for (int index = 0; index < list.size(); index++) { - CompoundTag discTag = Nbt.compoundAt(list, index); - double radius = Nbt.getDouble(discTag, "radius"); - double inner = Nbt.getDouble(discTag, "inner"); - // Older editors allowed the inner brush to cross the outer edge, producing a zero-width wall. - if (inner > radius && inner <= size.radius()) { - inner = radius; - } - discs.add(new PotteryDisc(Nbt.getDouble(discTag, "height"), radius, inner)); - } - String paint = Nbt.getString(tag, "paint"); - // Wide, shallow large vessels made before platters retain their capacity and fitted lid. - return validProfile(size, discs) ? new Pottery(size, discs, FacePaint.read(paint), - Nbt.getBoolean(tag, "platter")) : null; - } - /** The pot a wheel forms: the installed template, or the plain vase when none is installed. */ public static Pottery formed(Pottery template) { return template == null ? wheelShape() : template; @@ -340,7 +318,7 @@ public static Pottery formed(Pottery template) { * Progress at least 1 returns {@code target}. Below 0 is 0. * The result keeps the target's disc count and heights. */ - public static Pottery shaped(@Nullable Pottery start, Pottery target, double progress) { + public static Pottery shaped(Pottery start, Pottery target, double progress) { if (progress >= 1) { return target; } @@ -376,7 +354,7 @@ public double height() { /** Resample the silhouette into editable unit rings, keeping the lip and foot at the ends. */ public Pottery withHeight(int height) { - int rows = Math.clamp(height, 1, this.size.units); + int rows = Math.max(1, Math.min(height, this.size.units)); double originalHeight = this.height(); List rings = new ArrayList<>(rows); for (int i = 0; i < rows; i++) { @@ -411,7 +389,7 @@ private static PotteryDisc sample(Pottery start, double point, double total) { * Discs run from the lip down to the foot. */ public static Pottery jug() { - return new Pottery(List.of( + return new Pottery(Arrays.asList( new PotteryDisc(1.0, 3.4, 2.2), new PotteryDisc(1.5, 2.6, 1.6), new PotteryDisc(2.0, 4.2, 3.0), @@ -429,6 +407,28 @@ public static Pottery display() { return jug(); } - public record Info(PotteryType type, int volume) { + public static final class Info { + private final PotteryType type; + private final int volume; + + public Info(PotteryType type, int volume) { + this.type = type; + this.volume = volume; + } + + public PotteryType type() { return type; } + + public int volume() { return volume; } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Info)) return false; + Info other = (Info) obj; + return type == other.type + && volume == other.volume; + } + + @Override + public int hashCode() { return java.util.Objects.hash(type, volume); } } } diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryCodec.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryCodec.java new file mode 100644 index 0000000..2314daa --- /dev/null +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryCodec.java @@ -0,0 +1,57 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import java.util.ArrayList; +import java.util.List; + +/** The pottery payload inside an item or block entity. Each game supplies its native tag operations. */ +public abstract class PotteryCodec { + protected abstract T compound(); + protected abstract L list(); + protected abstract L discs(T tag); + protected abstract int size(L list); + protected abstract T at(L list, int index); + protected abstract void append(L list, T tag); + protected abstract void writeDiscs(T tag, L discs); + protected abstract void number(T tag, String key, double value); + protected abstract double number(T tag, String key); + protected abstract void flag(T tag, String key); + protected abstract boolean flagged(T tag, String key); + protected abstract void text(T tag, String key, String value); + protected abstract String text(T tag, String key); + + public final T encode(Pottery pot) { + T tag = compound(); + L rings = list(); + for (PotteryDisc ring : pot.discs()) { + T disc = compound(); + number(disc, "height", ring.height()); + number(disc, "radius", ring.radius()); + number(disc, "inner", ring.innerRadius()); + append(rings, disc); + } + writeDiscs(tag, rings); + if (!FacePaint.EMPTY.equals(pot.paint())) text(tag, "paint", pot.paint().pixels()); + if (pot.size() == Pottery.Size.LARGE) flag(tag, "large"); + if (pot.isPlatter()) flag(tag, "platter"); + return tag; + } + + /** Returns null for a malformed or absent profile so each caller can choose its fallback. */ + public final Pottery decode(T tag) { + Pottery.Size size = flagged(tag, "large") ? Pottery.Size.LARGE : Pottery.Size.SMALL; + L rings = discs(tag); + int count = size(rings); + if (count > Pottery.MAX_DISCS) return null; + List result = new ArrayList<>(count); + for (int i = 0; i < count; i++) { + T disc = at(rings, i); + double radius = number(disc, "radius"); + double inner = number(disc, "inner"); + // Early editors could save a zero-width wall with crossed brushes. + if (inner > radius && inner <= size.radius()) inner = radius; + result.add(new PotteryDisc(number(disc, "height"), radius, inner)); + } + if (!Pottery.validProfile(size, result)) return null; + return new Pottery(size, result, FacePaint.read(text(tag, "paint")), flagged(tag, "platter")); + } +} diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryDisc.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryDisc.java new file mode 100644 index 0000000..cb8d52f --- /dev/null +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryDisc.java @@ -0,0 +1,38 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +public final class PotteryDisc { + private final double height; + private final double radius; + private final double innerRadius; + + public PotteryDisc(double height, double radius, double innerRadius) { + this.height = height; + this.radius = radius; + this.innerRadius = innerRadius; + } + + public PotteryDisc(double height, double radius) { + this(height, radius, 0); + } + + public double height() { return height; } + + public double radius() { return radius; } + + public double innerRadius() { return innerRadius; } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof PotteryDisc)) return false; + PotteryDisc other = (PotteryDisc) obj; + return Double.compare(height, other.height) == 0 + && Double.compare(radius, other.radius) == 0 + && Double.compare(innerRadius, other.innerRadius) == 0; + } + + @Override + public int hashCode() { + int hash = 31 * Double.hashCode(height) + Double.hashCode(radius); + return 31 * hash + Double.hashCode(innerRadius); + } +} diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryProfile.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryProfile.java similarity index 86% rename from src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryProfile.java rename to core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryProfile.java index 837344b..a788d75 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryProfile.java +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryProfile.java @@ -20,7 +20,29 @@ public static double clampedInner(PotteryDisc disc) { private static final double SLOPE_REACH = Pottery.PIXEL * 2; private static final int SLOPE_STEPS = 4; - public record Station(double y, double radius) { + public static final class Station { + private final double y; + private final double radius; + + public Station(double y, double radius) { + this.y = y; + this.radius = radius; + } + + public double y() { return y; } + + public double radius() { return radius; } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Station)) return false; + Station other = (Station) obj; + return Double.compare(y, other.y) == 0 + && Double.compare(radius, other.radius) == 0; + } + + @Override + public int hashCode() { return java.util.Objects.hash(y, radius); } } private static final class Slope { @@ -52,8 +74,7 @@ public static boolean slopes(PotteryDisc below, PotteryDisc above, boolean inner } public static List profile(List discs, boolean inner) { - List rising = discs.reversed(); - int count = rising.size(); + int count = discs.size(); List stations = new ArrayList<>(); if (count == 0) { return stations; @@ -62,17 +83,17 @@ public static List profile(List discs, boolean inner) { double[] radius = new double[count]; double y = 0; for (int index = 0; index < count; index++) { - y += Math.max(0, rising.get(index).height()); + y += Math.max(0, discs.get(count - 1 - index).height()); y1[index] = y; - radius[index] = inner ? clampedInner(rising.get(index)) : clayRadius(rising.get(index)); + radius[index] = inner ? clampedInner(discs.get(count - 1 - index)) : clayRadius(discs.get(count - 1 - index)); } double top = y; List slopes = new ArrayList<>(); double sectionBase = 0; int firstSlope = 0; for (int index = 0; index < count - 1; index++) { - PotteryDisc belowDisc = rising.get(index); - PotteryDisc aboveDisc = rising.get(index + 1); + PotteryDisc belowDisc = discs.get(count - 1 - index); + PotteryDisc aboveDisc = discs.get(count - 2 - index); // A floor or a gap ends the continuous shell. Easing cannot cross that face. if ((clampedInner(belowDisc) > 0) != (clampedInner(aboveDisc) > 0) || clayRadius(belowDisc) == 0 || clayRadius(aboveDisc) == 0) { @@ -89,8 +110,8 @@ public static List profile(List discs, boolean inner) { continue; } double joint = y1[index]; - double below = Math.max(Math.max(0, rising.get(index).height()) / 2.0, SLOPE_REACH); - double above = Math.max(Math.max(0, rising.get(index + 1).height()) / 2.0, SLOPE_REACH); + double below = Math.max(Math.max(0, discs.get(count - 1 - index).height()) / 2.0, SLOPE_REACH); + double above = Math.max(Math.max(0, discs.get(count - 2 - index).height()) / 2.0, SLOPE_REACH); slopes.add(new Slope(index, joint, radius[index], radius[index + 1], Math.max(sectionBase, joint - below), joint + above)); } for (int index = 0; index < slopes.size() - 1; index++) { @@ -210,6 +231,6 @@ public static double fillHeight(List wall, double remaining) { } remaining -= segment; } - return wall.getLast().y; + return wall.get(wall.size() - 1).y; } } diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryType.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryType.java new file mode 100644 index 0000000..92a1956 --- /dev/null +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryType.java @@ -0,0 +1,50 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import java.util.Locale; + +public enum PotteryType { + LUMP("Just a lump of clay"), + LUMP_NO_BOTTOM("A pipe?"), + LUMP_THIN("Too thin!"), + PLATE("A plate!"), + PLATTER("A serving platter!"), + POT("A bowl!"), + JAR("Pottery"), + JUG("A jug!"); + + private final String label; + + PotteryType(String label) { + this.label = label; + } + + public String label() { + return this.label; + } + + public boolean isVessel() { + return this == POT || this == JAR || this == JUG; + } + + public String tooltipKey() { + PotteryType type = isServingDish() || this.isVessel() ? this : LUMP; + return "pottery.primalpottery.type." + type.name().toLowerCase(Locale.ROOT); + } + + public boolean isServingDish() { + return this == PLATE || this == PLATTER; + } + + /** Wide mouth is a bowl, narrow mouth is a jug, and every other shape is pottery. */ + public String shapeKey() { + String shape; + switch (this) { + case PLATE: shape = "plate"; break; + case PLATTER: shape = "platter"; break; + case JUG: shape = "jug"; break; + case POT: shape = "bowl"; break; + default: shape = "pottery"; break; + } + return "pottery.primalpottery.shape." + shape; + } +} diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/VesselQuadPacker.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/VesselQuadPacker.java new file mode 100644 index 0000000..dcb5bb4 --- /dev/null +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/VesselQuadPacker.java @@ -0,0 +1,51 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel.Vertex; + +/** Packs cached block-model vertices. Each Forge adapter supplies its atlas UVs, native stride and quad factory. */ +public abstract class VesselQuadPacker extends BakedVessels { + private final S clay; + private final S inks; + private final int stride; + + protected VesselQuadPacker(S clay, S inks, int stride) { + this.clay = clay; + this.inks = inks; + this.stride = stride; + } + + protected abstract float u(S sprite, float pixels); + protected abstract float v(S sprite, float pixels); + protected abstract Q quad(int[] data, S sprite, float nx, float ny, float nz); + + @Override protected final Q bake(Vertex a, Vertex b, Vertex c, Vertex d, int pigment) { + // Diagonals also give floor triangles a normal when their two centre vertices coincide. + float ax = c.x - a.x, ay = c.y - a.y, az = c.z - a.z; + float bx = d.x - b.x, by = d.y - b.y, bz = d.z - b.z; + float nx = ay * bz - az * by, ny = az * bx - ax * bz, nz = ax * by - ay * bx; + float length = (float) Math.sqrt(nx * nx + ny * ny + nz * nz); + int normal = length == 0 ? 0 : pack(nx / length) | pack(ny / length) << 8 | pack(nz / length) << 16; + S sprite = pigment == PaintedVessel.CLAY ? clay : inks; + int[] data = new int[stride * 4]; + write(data, 0, a, sprite, normal, pigment); + write(data, stride, b, sprite, normal, pigment); + write(data, stride * 2, c, sprite, normal, pigment); + write(data, stride * 3, d, sprite, normal, pigment); + return quad(data, sprite, nx, ny, nz); + } + + private void write(int[] data, int index, Vertex point, S sprite, int normal, int pigment) { + // Each ink occupies one cell in the 8-column, 4-row palette. Sample its centre at every vertex. + float x = pigment < 0 ? point.u : (pigment % 8 + .5F) * 2; + float y = pigment < 0 ? point.v : (pigment / 8 + .5F) * 4; + data[index] = Float.floatToRawIntBits(point.x); + data[index + 1] = Float.floatToRawIntBits(point.y); + data[index + 2] = Float.floatToRawIntBits(point.z); + data[index + 3] = 0xffffffff; + data[index + 4] = Float.floatToRawIntBits(u(sprite, x)); + data[index + 5] = Float.floatToRawIntBits(v(sprite, y)); + data[index + stride - 1] = normal; + } + + private static int pack(float value) { return Math.round(value * 127) & 255; } +} diff --git a/forge/build.gradle b/forge/build.gradle new file mode 100644 index 0000000..9562b27 --- /dev/null +++ b/forge/build.gradle @@ -0,0 +1,33 @@ +plugins { + id 'java' + id 'net.neoforged.moddev.legacyforge' +} + +evaluationDependsOn(':core') +java.toolchain.languageVersion = JavaLanguageVersion.of(17) +base.archivesName = 'primalpottery-forge-1.20.1' +dependencies { + implementation project(':core') +} +jar { + manifest.attributes('Implementation-Version': project.version) + from(project(':core').sourceSets.main.output) + from(rootProject.file('LICENSE')) +} +processResources { + from(rootProject.file('src/main/resources')) { include 'assets/primalpottery/textures/block/fired_clay.png' } +} + +legacyForge { + version = '1.20.1-47.1.3' + mods { + primalpottery { + sourceSet sourceSets.main + sourceSet project(':core').sourceSets.main + } + } + runs { + client { client() } + server { server() } + } +} diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/ForgePotteryTags.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/ForgePotteryTags.java new file mode 100644 index 0000000..2c7ca7b --- /dev/null +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/ForgePotteryTags.java @@ -0,0 +1,33 @@ +package net.modcrafters.minecraft.primalpottery.forge; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryCodec; +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel; + +public final class ForgePotteryTags extends PotteryCodec { + private static final ForgePotteryTags CODEC = new ForgePotteryTags(); + + public static CompoundTag save(Pottery pot) { return CODEC.encode(pot); } + public static Pottery readProfile(CompoundTag tag) { return CODEC.decode(tag); } + + public static Pottery load(CompoundTag tag) { + Pottery profile = readProfile(tag); + return profile == null ? PaintedVessel.SAMPLE : profile; + } + + protected CompoundTag compound() { return new CompoundTag(); } + protected ListTag list() { return new ListTag(); } + protected ListTag discs(CompoundTag tag) { return tag.getList("discs", 10); } + protected int size(ListTag list) { return list.size(); } + protected CompoundTag at(ListTag list, int i) { return list.getCompound(i); } + protected void append(ListTag list, CompoundTag disc) { list.add(disc); } + protected void writeDiscs(CompoundTag tag, ListTag discs) { tag.put("discs", discs); } + protected void number(CompoundTag tag, String key, double value) { tag.putDouble(key, value); } + protected double number(CompoundTag tag, String key) { return tag.getDouble(key); } + protected void flag(CompoundTag tag, String key) { tag.putBoolean(key, true); } + protected boolean flagged(CompoundTag tag, String key) { return tag.getBoolean(key); } + protected void text(CompoundTag tag, String key, String value) { tag.putString(key, value); } + protected String text(CompoundTag tag, String key) { return tag.getString(key); } +} diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PaintedPotBlock.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PaintedPotBlock.java new file mode 100644 index 0000000..244f77f --- /dev/null +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PaintedPotBlock.java @@ -0,0 +1,41 @@ +package net.modcrafters.minecraft.primalpottery.forge; + +import java.util.List; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public final class PaintedPotBlock extends BaseEntityBlock { + private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 8, 12); + PaintedPotBlock() { super(Properties.of().strength(0.5F).noOcclusion()); } + + @Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new PaintedPotEntity(pos, state); } + @Override public RenderShape getRenderShape(BlockState state) { return RenderShape.MODEL; } + @Override public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext ctx) { return SHAPE; } + + @Override public void setPlacedBy(Level level, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { + if (!level.isClientSide && level.getBlockEntity(pos) instanceof PaintedPotEntity pot) pot.install(stack); + } + + @Override public List getDrops(BlockState state, LootParams.Builder loot) { + return loot.getOptionalParameter(LootContextParams.BLOCK_ENTITY) instanceof PaintedPotEntity pot + ? List.of(pot.pickup()) : List.of(new ItemStack(this)); + } + + @Override public ItemStack getCloneItemStack(BlockState state, HitResult hit, BlockGetter level, BlockPos pos, Player player) { + return level.getBlockEntity(pos) instanceof PaintedPotEntity pot ? pot.pickup() : new ItemStack(this); + } +} diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PaintedPotEntity.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PaintedPotEntity.java new file mode 100644 index 0000000..2d097e8 --- /dev/null +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PaintedPotEntity.java @@ -0,0 +1,60 @@ +package net.modcrafters.minecraft.primalpottery.forge; + +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.client.model.data.ModelData; +import net.minecraftforge.client.model.data.ModelProperty; +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; + +public final class PaintedPotEntity extends BlockEntity { + public static final ModelProperty PROFILE = new ModelProperty<>(); + private Pottery pot = PaintedVessel.SAMPLE; + + PaintedPotEntity(BlockPos pos, BlockState state) { + super(PrimalPotteryForge.ENTITY.get(), pos, state); + } + + public static Pottery fromStack(ItemStack stack) { + CompoundTag tag = stack.getTagElement("pottery"); + return tag == null ? PaintedVessel.SAMPLE : ForgePotteryTags.load(tag); + } + + void install(ItemStack stack) { + pot = fromStack(stack); + setChanged(); + level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), 3); + } + + ItemStack pickup() { + ItemStack result = new ItemStack(PrimalPotteryForge.ITEM.get()); + result.addTagElement("pottery", ForgePotteryTags.save(pot)); + return result; + } + + @Override public ModelData getModelData() { return ModelData.builder().with(PROFILE, pot).build(); } + + @Override protected void saveAdditional(CompoundTag tag) { + super.saveAdditional(tag); + tag.put("pottery", ForgePotteryTags.save(pot)); + } + + @Override public void load(CompoundTag tag) { + super.load(tag); + pot = ForgePotteryTags.load(tag.getCompound("pottery")); + if (level != null && level.isClientSide) { + requestModelDataUpdate(); + level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), 8); + } + } + + @Override public CompoundTag getUpdateTag() { return saveWithoutMetadata(); } + + @Override public ClientboundBlockEntityDataPacket getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); + } +} diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PrimalPotteryForge.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PrimalPotteryForge.java new file mode 100644 index 0000000..d435761 --- /dev/null +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/PrimalPotteryForge.java @@ -0,0 +1,31 @@ +package net.modcrafters.minecraft.primalpottery.forge; + +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +@Mod("primalpottery") +public final class PrimalPotteryForge { + private static final String MOD_ID = "primalpottery"; + private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MOD_ID); + private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MOD_ID); + private static final DeferredRegister> ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MOD_ID); + + static final RegistryObject POT = BLOCKS.register("pottery", PaintedPotBlock::new); + static final RegistryObject ITEM = ITEMS.register("pottery", () -> new BlockItem(POT.get(), new Item.Properties().stacksTo(1))); + static final RegistryObject> ENTITY = ENTITIES.register("pottery", + () -> BlockEntityType.Builder.of(PaintedPotEntity::new, POT.get()).build(null)); + + public PrimalPotteryForge() { + IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); + BLOCKS.register(bus); + ITEMS.register(bus); + ENTITIES.register(bus); + } +} diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryModel.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryModel.java new file mode 100644 index 0000000..dfe123a --- /dev/null +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryModel.java @@ -0,0 +1,73 @@ +package net.modcrafters.minecraft.primalpottery.forge.client; + +import com.mojang.blaze3d.vertex.PoseStack; +import java.util.List; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.ModelEvent; +import net.minecraftforge.client.model.BakedModelWrapper; +import net.minecraftforge.client.model.data.ModelData; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.modcrafters.minecraft.primalpottery.forge.PaintedPotEntity; +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; + +@Mod.EventBusSubscriber(modid = "primalpottery", bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) +public final class PotteryModel extends BakedModelWrapper { + private static final ResourceLocation INKS = new ResourceLocation("primalpottery", "block/pottery_inks"); + private final PotteryQuads bakery; + private final List item; + private final ItemOverrides overrides = new ItemOverrides() { + @Override public BakedModel resolve(BakedModel model, ItemStack stack, ClientLevel world, LivingEntity entity, int seed) { + return new PotteryModel(originalModel, bakery, bakery.model(PaintedPotEntity.fromStack(stack))); + } + }; + + private PotteryModel(BakedModel base, PotteryQuads bakery, List item) { + super(base); + this.bakery = bakery; + this.item = item; + } + + @SubscribeEvent public static void register(ModelEvent.RegisterAdditional event) { event.register(INKS); } + + @SubscribeEvent public static void bake(ModelEvent.ModifyBakingResult event) { + var inks = event.getModels().get(INKS).getParticleIcon(); + event.getModels().replaceAll((key, base) -> { + if (!key.getNamespace().equals("primalpottery") || !key.getPath().equals("pottery")) return base; + var bakery = new PotteryQuads(base.getParticleIcon(), inks); + return new PotteryModel(base, bakery, bakery.model(PaintedVessel.SAMPLE)); + }); + } + + @Override public ItemOverrides getOverrides() { return overrides; } + + @Override public List getQuads(BlockState state, Direction side, RandomSource random) { + return side == null ? item : List.of(); + } + + @Override public List getQuads(BlockState state, Direction side, RandomSource random, ModelData data, RenderType type) { + if (side != null) return List.of(); + Pottery profile = data.get(PaintedPotEntity.PROFILE); + return profile == null ? item : bakery.model(profile); + } + + @Override public List getRenderPasses(ItemStack stack, boolean fabulous) { return List.of(this); } + + @Override public BakedModel applyTransform(ItemDisplayContext context, PoseStack pose, boolean leftHand) { + getTransforms().getTransform(context).apply(leftHand, pose); + return this; + } +} diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java new file mode 100644 index 0000000..fd951a4 --- /dev/null +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java @@ -0,0 +1,19 @@ +package net.modcrafters.minecraft.primalpottery.forge.client; + +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.core.Direction; +import net.modcrafters.minecraft.primalpottery.pottery.VesselQuadPacker; + +final class PotteryQuads extends VesselQuadPacker { + PotteryQuads(TextureAtlasSprite clay, TextureAtlasSprite inks) { + super(clay, inks, 8); + } + + @Override protected float u(TextureAtlasSprite sprite, float pixels) { return sprite.getU(pixels); } + @Override protected float v(TextureAtlasSprite sprite, float pixels) { return sprite.getV(pixels); } + + @Override protected BakedQuad quad(int[] vertices, TextureAtlasSprite sprite, float nx, float ny, float nz) { + return new BakedQuad(vertices, -1, Direction.getNearest(nx, ny, nz), sprite, true); + } +} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..6ec0832 --- /dev/null +++ b/forge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,14 @@ +modLoader="javafml" +loaderVersion="[47,)" +license="MIT" +[[mods]] +modId="primalpottery" +version="${file.jarVersion}" +displayName="Primal Pottery" +description="Shape clay on a wheel. Forge preview with placeable painted pottery." +[[dependencies.primalpottery]] +modId="minecraft" +mandatory=true +versionRange="[1.20.1,1.20.2)" +ordering="NONE" +side="BOTH" diff --git a/forge/src/main/resources/assets/primalpottery/blockstates/pottery.json b/forge/src/main/resources/assets/primalpottery/blockstates/pottery.json new file mode 100644 index 0000000..17f87c3 --- /dev/null +++ b/forge/src/main/resources/assets/primalpottery/blockstates/pottery.json @@ -0,0 +1 @@ +{"variants":{"":{"model":"primalpottery:block/pottery"}}} diff --git a/forge/src/main/resources/assets/primalpottery/lang/en_us.json b/forge/src/main/resources/assets/primalpottery/lang/en_us.json new file mode 100644 index 0000000..bd44227 --- /dev/null +++ b/forge/src/main/resources/assets/primalpottery/lang/en_us.json @@ -0,0 +1 @@ +{"block.primalpottery.pottery":"Painted Pottery"} diff --git a/forge/src/main/resources/assets/primalpottery/models/block/pottery.json b/forge/src/main/resources/assets/primalpottery/models/block/pottery.json new file mode 100644 index 0000000..e1d3924 --- /dev/null +++ b/forge/src/main/resources/assets/primalpottery/models/block/pottery.json @@ -0,0 +1,8 @@ +{ + "parent": "block/block", + "textures": {"particle": "primalpottery:block/fired_clay"}, + "display": { + "gui": {"rotation": [30, 45, 0], "translation": [0, 4, 0], "scale": [1.75, 1.75, 1.75]}, + "ground": {"translation": [0, 4, 0], "scale": [1, 1, 1]} + } +} diff --git a/forge/src/main/resources/assets/primalpottery/models/block/pottery_inks.json b/forge/src/main/resources/assets/primalpottery/models/block/pottery_inks.json new file mode 100644 index 0000000..dcb6b1a --- /dev/null +++ b/forge/src/main/resources/assets/primalpottery/models/block/pottery_inks.json @@ -0,0 +1 @@ +{"textures":{"particle":"primalpottery:block/pottery_inks"}} diff --git a/forge/src/main/resources/assets/primalpottery/models/item/pottery.json b/forge/src/main/resources/assets/primalpottery/models/item/pottery.json new file mode 100644 index 0000000..cdc7cd8 --- /dev/null +++ b/forge/src/main/resources/assets/primalpottery/models/item/pottery.json @@ -0,0 +1 @@ +{"parent":"primalpottery:block/pottery"} diff --git a/forge/src/main/resources/assets/primalpottery/textures/block/pottery_inks.png b/forge/src/main/resources/assets/primalpottery/textures/block/pottery_inks.png new file mode 100644 index 0000000000000000000000000000000000000000..77485fcf1c19912a103119f643bdb16cce7d8c0e GIT binary patch literal 396 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1SEZ8zRh7^U<~$jaSW-r_4cBnmlGqy@rUJH z+uOHTm|1vU5i^ZcILqrB>!>MkPbE*c@daZMS4>os*Q9_k+a{re0pa5D`#Whz5g*T{L|0AxLYAtTYI}(4`>;wph1cuZS(aP$4aDZv+7;u z$DdogdUx5Ezro7C{%#SCou+<~R0DzP9b_5W-)dETw(b1)_m$iFReoQteop>!__V^V qs@Lw~ndF$r%P>jB6BWI@U(T|CPsU^Y%YxM)BRyUHT-G@yGywptrDu!) literal 0 HcmV?d00001 diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..1001729 --- /dev/null +++ b/forge/src/main/resources/pack.mcmeta @@ -0,0 +1 @@ +{"pack":{"pack_format":15,"description":"Primal Pottery"}} diff --git a/legacy/forge-1.12.2/build.gradle b/legacy/forge-1.12.2/build.gradle new file mode 100644 index 0000000..f696589 --- /dev/null +++ b/legacy/forge-1.12.2/build.gradle @@ -0,0 +1,48 @@ +buildscript { + repositories { + maven { url = 'https://maven.minecraftforge.net/' } + mavenCentral() + } + dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:3.0.197' } +} +apply plugin: 'net.minecraftforge.gradle' +apply plugin: 'java' + +def modProperties = new Properties() +file('../../gradle.properties').withInputStream { modProperties.load(it) } +version = modProperties.version +sourceCompatibility = targetCompatibility = '1.8' +project(':core').buildDir = file('build/core') +evaluationDependsOn(':core') + +minecraft { + mappings channel: 'snapshot', version: '20171003-1.12' + runs { + client { workingDirectory project.file('run/client') } + server { workingDirectory project.file('run/server') } + } +} +dependencies { + minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2864' + implementation project(':core') +} +// MCP's merged development jar contains an extra Side.BUKKIT value which stock FML cannot initialize. +// Use Forge's corrected pair of side markers only on the userdev launch classpath (ForgeGradle #748). +configurations { devSideMarkers } +dependencies { devSideMarkers 'net.minecraftforge:mergetool:0.2.3.3:forge@jar' } +tasks.withType(JavaExec).matching { it.name in ['runClient', 'runServer'] }.configureEach { + doFirst { classpath = configurations.devSideMarkers + classpath } +} +jar { + from(project(':core').sourceSets.main.output) + from('../../LICENSE') + finalizedBy 'reobfJar' +} +processResources { + inputs.property 'version', version + filesMatching('mcmod.info') { expand(version: project.version) } + from('../../src/main/resources') { include 'assets/primalpottery/textures/block/fired_clay.png' } + from('../../forge/src/main/resources') { + include 'assets/primalpottery/models/**', 'assets/primalpottery/textures/block/pottery_inks.png' + } +} diff --git a/legacy/forge-1.12.2/gradle/wrapper/gradle-wrapper.jar b/legacy/forge-1.12.2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..0d4a9516871afd710a9d84d89e31ba77745607bd GIT binary patch literal 54413 zcmafaV|Zr4wq`oEZQHiZj%|LijZQlLf{tz5M#r{o+fI6V=G-$g=gzrzeyqLskF}nv zRZs0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Tle?)%_YzJJcVb>;VJ>P?3Lu2S)vCJZlF>Jxj~~X2U5-NNNy(H?8%XD~yFUxNKs&hwWx^)iF@ zGmEv<|7Q7hGrY_+`iz+d_=^9c(_c}UCzq2#%A0|5WjzCXjZUOxOX zU&-^smw$iwKPe;r`&{rP{L35^&+wk6f2-Sn;D2Ww@sjAJj{Gwbp4H!o{#5_}qALFq z{-q%LGklZvKf%A4D!+t%sRRBDi(>mvuz&V4yu^GdD*KFy?fg%ef5ZU%w=d&M`POGt zNSEJ0{qJI~FRTAjlJc1-+x>Tm{%D?m3sk-&cq#w)OpxI98wCF#2KbWcrAXK_(}M4B zF#VQf*h|irx=+uXZUMi+`A;fPFR5M%Wjs^Wh5rWCKgedhWO^w|@XS;b^&3oom;>K0 zB??|ry^IBarYem6Z7RU`#rDs-ZZAn*hSollv?csD$sh0QpTtI9vb>Dpd}e7*`fZj! zM|8d{~YM@vfW-r0z8vJ z<^6B6Ur(}L?ms_c9@hO0^Iy&J_uc51^?d33e#Y!-``?)VG)BGjCq5$&0G8A*r!2qk zUHscGc;VxE=1KqbH=dW%&Ogl({>L!>((m$2W8M9KQ@a1=h51jN|KoG{v(x0K&*iy% e1c3cF4~(n?C}6GmGu)3JNC)6=LGAhZ*Z%`+-T+_# literal 0 HcmV?d00001 diff --git a/legacy/forge-1.12.2/gradle/wrapper/gradle-wrapper.properties b/legacy/forge-1.12.2/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..5028f28 --- /dev/null +++ b/legacy/forge-1.12.2/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/legacy/forge-1.12.2/gradlew b/legacy/forge-1.12.2/gradlew new file mode 100755 index 0000000..cccdd3d --- /dev/null +++ b/legacy/forge-1.12.2/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/legacy/forge-1.12.2/gradlew.bat b/legacy/forge-1.12.2/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/legacy/forge-1.12.2/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/legacy/forge-1.12.2/settings.gradle b/legacy/forge-1.12.2/settings.gradle new file mode 100644 index 0000000..266e174 --- /dev/null +++ b/legacy/forge-1.12.2/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = 'primalpottery-forge-1.12.2' +include 'core' +project(':core').projectDir = file('../../core') diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/ForgePotteryTags.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/ForgePotteryTags.java new file mode 100644 index 0000000..d789cb7 --- /dev/null +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/ForgePotteryTags.java @@ -0,0 +1,33 @@ +package net.modcrafters.minecraft.primalpottery.legacy; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryCodec; +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel; + +public final class ForgePotteryTags extends PotteryCodec { + private static final ForgePotteryTags CODEC = new ForgePotteryTags(); + + public static NBTTagCompound save(Pottery pot) { return CODEC.encode(pot); } + public static Pottery readProfile(NBTTagCompound tag) { return CODEC.decode(tag); } + + public static Pottery load(NBTTagCompound tag) { + Pottery profile = readProfile(tag); + return profile == null ? PaintedVessel.SAMPLE : profile; + } + + protected NBTTagCompound compound() { return new NBTTagCompound(); } + protected NBTTagList list() { return new NBTTagList(); } + protected NBTTagList discs(NBTTagCompound tag) { return tag.getTagList("discs", 10); } + protected int size(NBTTagList list) { return list.tagCount(); } + protected NBTTagCompound at(NBTTagList list, int i) { return list.getCompoundTagAt(i); } + protected void append(NBTTagList list, NBTTagCompound disc) { list.appendTag(disc); } + protected void writeDiscs(NBTTagCompound tag, NBTTagList discs) { tag.setTag("discs", discs); } + protected void number(NBTTagCompound tag, String key, double value) { tag.setDouble(key, value); } + protected double number(NBTTagCompound tag, String key) { return tag.getDouble(key); } + protected void flag(NBTTagCompound tag, String key) { tag.setBoolean(key, true); } + protected boolean flagged(NBTTagCompound tag, String key) { return tag.getBoolean(key); } + protected void text(NBTTagCompound tag, String key, String value) { tag.setString(key, value); } + protected String text(NBTTagCompound tag, String key) { return tag.getString(key); } +} diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotBlock.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotBlock.java new file mode 100644 index 0000000..246078c --- /dev/null +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotBlock.java @@ -0,0 +1,78 @@ +package net.modcrafters.minecraft.primalpottery.legacy; + +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.property.ExtendedBlockState; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.common.property.IUnlistedProperty; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; + +public final class PaintedPotBlock extends Block implements ITileEntityProvider { + public static final IUnlistedProperty PROFILE = new IUnlistedProperty() { + public String getName() { return "profile"; } + public Class getType() { return Pottery.class; } + public boolean isValid(Pottery pot) { return pot != null; } + public String valueToString(Pottery pot) { return pot.cacheKey(); } + }; + private static final AxisAlignedBB BOUNDS = new AxisAlignedBB(.25, 0, .25, .75, .5, .75); + + PaintedPotBlock() { + super(Material.CLAY); + setHardness(0.5F); + setUnlocalizedName("primalpottery.pottery"); + } + + @Override protected BlockStateContainer createBlockState() { + return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{PROFILE}); + } + @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { + TileEntity tile = world instanceof ChunkCache + ? ((ChunkCache) world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos); + return tile instanceof PaintedPotEntity ? ((IExtendedBlockState)state).withProperty(PROFILE, ((PaintedPotEntity)tile).profile()) : state; + } + @Override public TileEntity createNewTileEntity(World world, int metadata) { return new PaintedPotEntity(); } + @Override public boolean isOpaqueCube(IBlockState state) { return false; } + @Override public boolean isFullCube(IBlockState state) { return false; } + @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { return BOUNDS; } + + @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { + TileEntity tile = world.getTileEntity(pos); + if (!world.isRemote && tile instanceof PaintedPotEntity) ((PaintedPotEntity)tile).install(stack); + } + + @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult hit, World world, BlockPos pos, EntityPlayer player) { + TileEntity tile = world.getTileEntity(pos); + return tile instanceof PaintedPotEntity ? ((PaintedPotEntity)tile).pickup() : new ItemStack(this); + } + + @Override public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + TileEntity tile = world.getTileEntity(pos); + drops.add(tile instanceof PaintedPotEntity ? ((PaintedPotEntity)tile).pickup() : new ItemStack(this)); + } + + // Forge requests player drops after removedByPlayer. Keep the profile alive until harvest completes. + @Override public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + return willHarvest || super.removedByPlayer(state, world, pos, player, false); + } + + @Override public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity tile, ItemStack tool) { + super.harvestBlock(world, player, pos, state, tile, tool); + world.setBlockToAir(pos); + } +} diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotEntity.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotEntity.java new file mode 100644 index 0000000..9c4038f --- /dev/null +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotEntity.java @@ -0,0 +1,54 @@ +package net.modcrafters.minecraft.primalpottery.legacy; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.play.server.SPacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; + +public final class PaintedPotEntity extends TileEntity { + private Pottery pot = PaintedVessel.SAMPLE; + + public Pottery profile() { return pot; } + + public static Pottery fromStack(ItemStack stack) { + NBTTagCompound tag = stack.getSubCompound("pottery"); + return tag == null ? PaintedVessel.SAMPLE : ForgePotteryTags.load(tag); + } + + void install(ItemStack stack) { + pot = fromStack(stack); + markDirty(); + IBlockState state = world.getBlockState(pos); + world.notifyBlockUpdate(pos, state, state, 3); + } + + ItemStack pickup() { + ItemStack result = new ItemStack(PrimalPotteryForge.POT); + result.setTagInfo("pottery", ForgePotteryTags.save(pot)); + return result; + } + + @Override public NBTTagCompound writeToNBT(NBTTagCompound tag) { + super.writeToNBT(tag); + tag.setTag("pottery", ForgePotteryTags.save(pot)); + return tag; + } + + @Override public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + pot = ForgePotteryTags.load(tag.getCompoundTag("pottery")); + } + + @Override public NBTTagCompound getUpdateTag() { return writeToNBT(new NBTTagCompound()); } + + @Override public SPacketUpdateTileEntity getUpdatePacket() { return new SPacketUpdateTileEntity(pos, 0, getUpdateTag()); } + + @Override public void onDataPacket(NetworkManager network, SPacketUpdateTileEntity packet) { + readFromNBT(packet.getNbtCompound()); + world.markBlockRangeForRenderUpdate(pos, pos); + } +} diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PrimalPotteryForge.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PrimalPotteryForge.java new file mode 100644 index 0000000..bf5dd09 --- /dev/null +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PrimalPotteryForge.java @@ -0,0 +1,30 @@ +package net.modcrafters.minecraft.primalpottery.legacy; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; + +@Mod(modid = "primalpottery", name = "Primal Pottery", useMetadata = true, acceptedMinecraftVersions = "[1.12.2]") +@Mod.EventBusSubscriber(modid = "primalpottery") +public final class PrimalPotteryForge { + public static final ResourceLocation ID = new ResourceLocation("primalpottery", "pottery"); + public static final PaintedPotBlock POT = new PaintedPotBlock(); + + @Mod.EventHandler public void setup(FMLPreInitializationEvent event) { + GameRegistry.registerTileEntity(PaintedPotEntity.class, ID); + } + + @SubscribeEvent public static void registerBlocks(RegistryEvent.Register event) { + event.getRegistry().register(POT.setRegistryName(ID)); + } + + @SubscribeEvent public static void registerItems(RegistryEvent.Register event) { + event.getRegistry().register(new ItemBlock(POT).setRegistryName(ID).setMaxStackSize(1)); + } +} diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryModel.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryModel.java new file mode 100644 index 0000000..314b63a --- /dev/null +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryModel.java @@ -0,0 +1,84 @@ +package net.modcrafters.minecraft.primalpottery.legacy.client; + +import java.util.Collections; +import java.util.List; +import javax.vecmath.Matrix4f; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.client.event.ModelBakeEvent; +import net.minecraftforge.client.event.ModelRegistryEvent; +import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.client.model.BakedModelWrapper; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.modcrafters.minecraft.primalpottery.legacy.PaintedPotBlock; +import net.modcrafters.minecraft.primalpottery.legacy.PaintedPotEntity; +import net.modcrafters.minecraft.primalpottery.legacy.PrimalPotteryForge; +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; +import org.apache.commons.lang3.tuple.Pair; + +@Mod.EventBusSubscriber(modid = "primalpottery", value = Side.CLIENT) +public final class PotteryModel extends BakedModelWrapper { + private static final ResourceLocation INKS = new ResourceLocation("primalpottery", "block/pottery_inks"); + private final PotteryQuads bakery; + private final List item; + private final ItemOverrideList overrides = new ItemOverrideList(Collections.emptyList()) { + @Override public IBakedModel handleItemState(IBakedModel model, ItemStack stack, World world, EntityLivingBase entity) { + return new PotteryModel(originalModel, bakery, bakery.model(PaintedPotEntity.fromStack(stack))); + } + }; + + private PotteryModel(IBakedModel base, PotteryQuads bakery, List item) { + super(base); + this.bakery = bakery; + this.item = item; + } + + @SubscribeEvent public static void register(ModelRegistryEvent event) { + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(PrimalPotteryForge.POT), 0, + new ModelResourceLocation(PrimalPotteryForge.ID, "inventory")); + } + + @SubscribeEvent public static void stitch(TextureStitchEvent.Pre event) { event.getMap().registerSprite(INKS); } + + @SubscribeEvent public static void bake(ModelBakeEvent event) { + TextureAtlasSprite inks = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(INKS.toString()); + for (String variant : new String[]{"normal", "inventory"}) { + ModelResourceLocation key = new ModelResourceLocation(PrimalPotteryForge.ID, variant); + IBakedModel base = event.getModelRegistry().getObject(key); + PotteryQuads bakery = new PotteryQuads(base.getParticleTexture(), inks); + event.getModelRegistry().putObject(key, new PotteryModel(base, bakery, bakery.model(PaintedVessel.SAMPLE))); + } + } + + @Override public ItemOverrideList getOverrides() { return overrides; } + + @Override public Pair handlePerspective(ItemCameraTransforms.TransformType type) { + return Pair.of(this, originalModel.handlePerspective(type).getRight()); + } + + @Override public List getQuads(IBlockState state, EnumFacing side, long seed) { + if (side != null) return Collections.emptyList(); + if (state instanceof IExtendedBlockState) { + Pottery profile = ((IExtendedBlockState) state).getValue(PaintedPotBlock.PROFILE); + if (profile != null) return bakery.model(profile); + } + return item; + } +} diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryQuads.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryQuads.java new file mode 100644 index 0000000..c8b370b --- /dev/null +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryQuads.java @@ -0,0 +1,20 @@ +package net.modcrafters.minecraft.primalpottery.legacy.client; + +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.EnumFacing; +import net.modcrafters.minecraft.primalpottery.pottery.VesselQuadPacker; + +final class PotteryQuads extends VesselQuadPacker { + PotteryQuads(TextureAtlasSprite clay, TextureAtlasSprite inks) { + super(clay, inks, DefaultVertexFormats.ITEM.getIntegerSize()); + } + + @Override protected float u(TextureAtlasSprite sprite, float pixels) { return sprite.getInterpolatedU(pixels); } + @Override protected float v(TextureAtlasSprite sprite, float pixels) { return sprite.getInterpolatedV(pixels); } + + @Override protected BakedQuad quad(int[] vertices, TextureAtlasSprite sprite, float nx, float ny, float nz) { + return new BakedQuad(vertices, -1, EnumFacing.getFacingFromVector(nx, ny, nz), sprite, true, DefaultVertexFormats.ITEM); + } +} diff --git a/legacy/forge-1.12.2/src/main/resources/assets/primalpottery/blockstates/pottery.json b/legacy/forge-1.12.2/src/main/resources/assets/primalpottery/blockstates/pottery.json new file mode 100644 index 0000000..14b98df --- /dev/null +++ b/legacy/forge-1.12.2/src/main/resources/assets/primalpottery/blockstates/pottery.json @@ -0,0 +1 @@ +{"variants":{"normal":{"model":"primalpottery:pottery"}}} diff --git a/legacy/forge-1.12.2/src/main/resources/assets/primalpottery/lang/en_us.lang b/legacy/forge-1.12.2/src/main/resources/assets/primalpottery/lang/en_us.lang new file mode 100644 index 0000000..60ed62a --- /dev/null +++ b/legacy/forge-1.12.2/src/main/resources/assets/primalpottery/lang/en_us.lang @@ -0,0 +1 @@ +tile.primalpottery.pottery.name=Painted Pottery diff --git a/legacy/forge-1.12.2/src/main/resources/mcmod.info b/legacy/forge-1.12.2/src/main/resources/mcmod.info new file mode 100644 index 0000000..ec20409 --- /dev/null +++ b/legacy/forge-1.12.2/src/main/resources/mcmod.info @@ -0,0 +1 @@ +[{"modid":"primalpottery","name":"Primal Pottery","version":"${version}","mcversion":"1.12.2","description":"Placeable painted pottery.","authorList":["modcrafters"]}] diff --git a/legacy/forge-1.12.2/src/main/resources/pack.mcmeta b/legacy/forge-1.12.2/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..360fea4 --- /dev/null +++ b/legacy/forge-1.12.2/src/main/resources/pack.mcmeta @@ -0,0 +1 @@ +{"pack":{"pack_format":3,"description":"Primal Pottery"}} diff --git a/neoforge/build.gradle b/neoforge/build.gradle index a6b4427..a395239 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -113,6 +113,7 @@ neoForge { mods { "${mod_id}" { sourceSet sourceSets.main + sourceSet project(':core').sourceSets.main } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index b7d14f4..1c6c68d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -37,3 +37,4 @@ stonecutter { // This should match the folder name of the project, or else IDEA may complain (see https://youtrack.jetbrains.com/issue/IDEA-317606) rootProject.name = "primal-pottery" includeBuild("build-logic") +include("core", "forge") diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/block/PaintingTableEntity.java b/src/main/java/net/modcrafters/minecraft/primalpottery/block/PaintingTableEntity.java index 2630296..c7dd485 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/block/PaintingTableEntity.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/block/PaintingTableEntity.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.block; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryTags; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; @@ -83,7 +84,7 @@ void stamp(ServerPlayer player, FacePaint pattern) { System.arraycopy(remaining, 0, tanks, 0, tanks.length); setChanged(); PotteryItem.editOne(player, net.minecraft.world.InteractionHand.MAIN_HAND, painted -> - CustomData.update(DataComponents.CUSTOM_DATA, painted, tag -> tag.put("pottery", pot.withPaint(pattern).save()))); + CustomData.update(DataComponents.CUSTOM_DATA, painted, tag -> tag.put("pottery", PotteryTags.save(pot.withPaint(pattern))))); inventory.setChanged(); player.sendSystemMessage(Component.translatable("message.primalpottery.paint.stamped", icon.getHoverName()), true); } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/block/PotteryBlockEntity.java b/src/main/java/net/modcrafters/minecraft/primalpottery/block/PotteryBlockEntity.java index a8f4f14..e2d90b4 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/block/PotteryBlockEntity.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/block/PotteryBlockEntity.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.block; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryTags; import java.util.Arrays; import java.util.List; import net.minecraft.core.BlockPos; @@ -496,7 +497,7 @@ private CompoundTag saveSlots() { Pottery slot = this.slots[index]; CompoundTag entry = new CompoundTag(); if (slot != null) { - entry.put("pottery", slot.save()); + entry.put("pottery", PotteryTags.save(slot)); this.contents[index].write(entry); if (this.planters[index] != null) { this.planters[index].save(entry); @@ -532,7 +533,7 @@ private void loadSlots(CompoundTag tag) { } CompoundTag pottery = Nbt.compound(entry, "pottery"); if (!pottery.isEmpty()) { - this.slots[index] = Pottery.load(pottery); + this.slots[index] = PotteryTags.load(pottery); if (this.slots[index] == null) continue; if (index >= CORNERS) this.slots[index] = this.slots[index].fitSavedPlate(); this.contents[index] = VesselContents.read(entry).limitedTo(this.slots[index]); diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/block/PotteryWheelBlockEntity.java b/src/main/java/net/modcrafters/minecraft/primalpottery/block/PotteryWheelBlockEntity.java index 2c3dee2..302137c 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/block/PotteryWheelBlockEntity.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/block/PotteryWheelBlockEntity.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.block; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryTags; import java.util.List; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -294,10 +295,10 @@ private CompoundTag saveWheel() { tag.putFloat("progress", this.clayProgress); this.saveTemplate(tag); if (this.target != null) { - tag.put("target", this.target.save()); + tag.put("target", PotteryTags.save(this.target)); } if (this.start != null) { - tag.put("start", this.start.save()); + tag.put("start", PotteryTags.save(this.start)); } return tag; } @@ -310,9 +311,9 @@ private void loadWheel(CompoundTag tag) { this.clayProgress = Nbt.getFloat(tag, "progress"); this.loadTemplate(tag); CompoundTag target = Nbt.compound(tag, "target"); - this.target = this.hasClay ? (target.isEmpty() ? Pottery.formed(this.template()) : Pottery.load(target)) : null; + this.target = this.hasClay ? (target.isEmpty() ? Pottery.formed(this.template()) : PotteryTags.load(target)) : null; CompoundTag start = Nbt.compound(tag, "start"); - this.start = start.isEmpty() ? null : Pottery.load(start); + this.start = start.isEmpty() ? null : PotteryTags.load(start); } private void saveTemplate(CompoundTag tag) { @@ -323,7 +324,7 @@ private void saveTemplate(CompoundTag tag) { tag.putBoolean("large_template", this.installed.is(ModItems.LARGE_BLUEPRINT)); Pottery saved = TemplateItem.read(this.installed); if (saved != null) { - tag.put("template", saved.save()); + tag.put("template", PotteryTags.save(saved)); } } @@ -335,7 +336,7 @@ private void loadTemplate(CompoundTag tag) { } ItemStack stack = new ItemStack(Nbt.getBoolean(tag, "large_template") ? ModItems.LARGE_BLUEPRINT : ModItems.BLUEPRINT); if (!saved.isEmpty()) { - TemplateItem.write(stack, Pottery.load(saved)); + TemplateItem.write(stack, PotteryTags.load(saved)); } this.installed = stack; } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/ItemIconStamp.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/ItemIconStamp.java index 7d79f4a..1c36f8e 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/ItemIconStamp.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/ItemIconStamp.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.client; +import net.modcrafters.minecraft.primalpottery.pottery.PaintColors; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; @@ -158,7 +159,7 @@ static String quantize(int[] pixels) { visible = true; int closest = 0, bestDistance = Integer.MAX_VALUE; for (int dye = 0; dye < FacePaint.COLORS; dye++) { - int rgb = FacePaint.rgb(dye); + int rgb = PaintColors.rgb(dye); int r = (argb >>> 16 & 255) - (rgb >>> 16 & 255); int g = (argb >>> 8 & 255) - (rgb >>> 8 & 255); int b = (argb & 255) - (rgb & 255); diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java index ea6cc68..d3576f9 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.client; +import net.modcrafters.minecraft.primalpottery.pottery.PaintColors; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -103,7 +104,7 @@ static Tile acquire(FacePaint paint) { for (int v = -1; v <= FacePaint.SIDE; v++) { for (int u = -1; u <= FacePaint.SIDE; u++) { int ink = paint.color(Math.clamp(v, 0, FacePaint.SIDE-1) * FacePaint.SIDE + Math.clamp(u, 0, FacePaint.SIDE-1)); - int argb = ink < 0 ? 0 : 0xFF000000 | FacePaint.rgb(ink); + int argb = ink < 0 ? 0 : 0xFF000000 | PaintColors.rgb(ink); //? if >=26.1 { pixels.setPixel(x+u, y+v, argb); //?} else diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintingScreen.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintingScreen.java index db8c005..25181ac 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintingScreen.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintingScreen.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.client; +import net.modcrafters.minecraft.primalpottery.pottery.PaintColors; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.Button; @@ -158,7 +159,7 @@ private void panel(GuiGraphicsExtractor graphics) { for (int column = 0; column < columns; column++) { int color = pattern.color(paintCell(column, row)); int px = gridLeft + column*PIXEL, py = gridTop + row*PIXEL; - graphics.fill(px, py, px+PIXEL-1, py+PIXEL-1, color < 0 ? clay : 0xFF000000 | FacePaint.rgb(color)); + graphics.fill(px, py, px+PIXEL-1, py+PIXEL-1, color < 0 ? clay : 0xFF000000 | PaintColors.rgb(color)); } } if (columns < FacePaint.SIDE) { @@ -176,7 +177,7 @@ private void panel(GuiGraphicsExtractor graphics) { for (int color = 0; color < FacePaint.COLORS; color++) { int px = x+TANK_X+STRIDE*color, py = y+TANK_Y; graphics.fill(px, py, px+SWATCH_SIZE, py+SWATCH_SIZE, selected == color ? 0xFFFFFFFF : 0xFF695E56); - graphics.fill(px+1, py+1, px+SWATCH_SIZE-1, py+SWATCH_SIZE-1, 0xFF000000 | FacePaint.rgb(color)); + graphics.fill(px+1, py+1, px+SWATCH_SIZE-1, py+SWATCH_SIZE-1, 0xFF000000 | PaintColors.rgb(color)); int gaugeY = py+SWATCH_SIZE+1; graphics.fill(px, gaugeY, px+SWATCH_SIZE, gaugeY+2, 0xFF40352D); int fill = Math.ceilDiv(menu.volume(color)*SWATCH_SIZE, 100); diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlatePaint.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlatePaint.java index acc03fe..03040ef 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlatePaint.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlatePaint.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.client; +import net.modcrafters.minecraft.primalpottery.pottery.PaintColors; import java.util.ArrayList; import java.util.List; import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; @@ -75,7 +76,7 @@ private static Mesh.Quad strip(double x, double base, double z, Station a, Stati float nz = (float)(-rise*Math.sin(mid)/normalLength); Mesh.Quad q = new Mesh.Quad(nx, ny, nz, Mesh.Texture.PIGMENT); q.cornerNormals = new float[12]; - if (!atlas) q.pigment = FacePaint.rgb(ink); + if (!atlas) q.pigment = PaintColors.rgb(ink); for (int v = 0; v < 4; v++) { double u = v < 2 ? from : to; double t = (u-start)/(end-start); diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPaint.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPaint.java index b44a886..2ce8ef8 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPaint.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPaint.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.client; +import net.modcrafters.minecraft.primalpottery.pottery.PaintColors; import net.modcrafters.minecraft.primalpottery.pottery.Pottery; import net.modcrafters.minecraft.primalpottery.pottery.PotteryProfile; import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; @@ -80,7 +81,7 @@ private static void paintRows(Mesh mesh, Mesh.Quad face, FacePaint pattern) { continue; } Mesh.Quad strip = new Mesh.Quad(face.nx, face.ny, face.nz, Mesh.Texture.PIGMENT); - strip.pigment = FacePaint.rgb(color); + strip.pigment = PaintColors.rgb(color); strip.cornerNormals = new float[12]; for (int v = 0; v < 4; v++) { float u = (v == 0 || v == 3 ? start : x) / 16F; diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/TemplateScreen.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/TemplateScreen.java index 447e606..377642e 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/TemplateScreen.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/TemplateScreen.java @@ -323,7 +323,7 @@ private void paint(GuiGraphicsExtractor graphics, int mouseX, int mouseY) { String hint = this.turning || this.overPreview(mouseX, mouseY) ? "turn_hint" : (insideTool ? "hollow_hint" : "shape_hint"); graphics.text(this.font, label(hint), this.left + 9, this.top + 167, 0xFF403C37, false); PotteryType type = this.info.type(); - Component kind = type.isServingDish() || type.isVessel() ? type.shapeName() : Component.literal(type.label()); + Component kind = type.isServingDish() || type.isVessel() ? Component.translatable(type.shapeKey()) : Component.literal(type.label()); graphics.text(this.font, kind, this.left + 28, this.top + 181, 0xFF403C37, false); if (!type.isServingDish()) { Component capacity = Component.translatable("gui.primalpottery.template.volume", this.info.volume()); diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/item/PotteryItem.java b/src/main/java/net/modcrafters/minecraft/primalpottery/item/PotteryItem.java index 5d47da3..8f40852 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/item/PotteryItem.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/item/PotteryItem.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.item; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryTags; import java.util.Map; import java.util.function.Consumer; import net.minecraft.core.BlockPos; @@ -103,7 +104,7 @@ public static Component dyedName(Component name, @Nullable String dye) { @Override public Component getName(ItemStack stack) { - return dyedName(read(stack).classify().type().shapeName(), dye(stack)); + return dyedName(Component.translatable(read(stack).classify().type().shapeKey()), dye(stack)); } public static ItemStack stack(Pottery pottery) { @@ -125,7 +126,7 @@ public static ItemStack stack(Pottery pottery, VesselContents contents, boolean public static ItemStack stack(Pottery pottery, VesselContents contents, boolean lid, @Nullable String dye, @Nullable Planter planter) { ItemStack stack = new ItemStack(ModItems.POTTERY); CompoundTag tag = new CompoundTag(); - tag.put("pottery", pottery.save()); + tag.put("pottery", PotteryTags.save(pottery)); contents = contents.limitedTo(pottery); contents.write(tag); if (planter != null) { @@ -171,7 +172,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity owner, int slot, if (data == null || !data.contains("fluid") && !data.contains("soil")) { Pottery profile = read(stack); if (data == null || !data.contains("pottery")) { - CustomData.update(DataComponents.CUSTOM_DATA, stack, tag -> tag.put("pottery", profile.save())); + CustomData.update(DataComponents.CUSTOM_DATA, stack, tag -> tag.put("pottery", PotteryTags.save(profile))); } stack.set(DataComponents.MAX_STACK_SIZE, profile.size().emptyStackLimit); } @@ -263,7 +264,7 @@ public static Pottery read(ItemStack stack) { if (pottery.isEmpty()) { return Pottery.display(); } - return Pottery.load(pottery); + return PotteryTags.load(pottery); } public static VesselContents contents(ItemStack stack) { diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/item/RawPotteryItem.java b/src/main/java/net/modcrafters/minecraft/primalpottery/item/RawPotteryItem.java index e9384c8..b49d8dc 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/item/RawPotteryItem.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/item/RawPotteryItem.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.item; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryTags; import java.util.List; import java.util.function.Consumer; import net.minecraft.ChatFormatting; @@ -35,7 +36,7 @@ public static ItemStack stack(Pottery pottery) { public static ItemStack stack(Pottery pottery, @Nullable String dye) { ItemStack stack = new ItemStack(ModItems.RAW_POTTERY); CompoundTag tag = new CompoundTag(); - tag.put("pottery", pottery.save()); + tag.put("pottery", PotteryTags.save(pottery)); if (dye != null && !dye.isEmpty()) { tag.putString("dye", dye); } @@ -63,7 +64,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity owner, int slot, /** * The profile a wheel may reshape. Null when the stack is dyed, or the pottery compound is missing or invalid. - * {@link Pottery#load} would substitute the display vase for a bad tag, so that stack must not be accepted. + * {@link PotteryTags#load} would substitute the display vase for a bad tag, so that stack must not be accepted. */ public static @Nullable Pottery wheelProfile(ItemStack stack) { if (!stack.is(ModItems.RAW_POTTERY) || PotteryItem.dye(stack) != null) { @@ -77,13 +78,13 @@ public void inventoryTick(ItemStack stack, Level level, Entity owner, int slot, if (pottery.isEmpty()) { return null; } - return Pottery.readProfile(pottery); + return PotteryTags.readProfile(pottery); } @Override public Component getName(ItemStack stack) { return PotteryItem.dyedName( - Component.translatable("item.primalpottery.raw_shape", PotteryItem.read(stack).classify().type().shapeName()), + Component.translatable("item.primalpottery.raw_shape", Component.translatable(PotteryItem.read(stack).classify().type().shapeKey())), PotteryItem.dye(stack) ); } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/item/TemplateItem.java b/src/main/java/net/modcrafters/minecraft/primalpottery/item/TemplateItem.java index 97affec..7c33184 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/item/TemplateItem.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/item/TemplateItem.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.item; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryTags; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; @@ -62,7 +63,7 @@ public static Pottery fresh(Pottery.Size size) { } public static void write(ItemStack stack, Pottery pottery) { - CustomData.update(DataComponents.CUSTOM_DATA, stack, tag -> tag.put("pottery", pottery.save())); + CustomData.update(DataComponents.CUSTOM_DATA, stack, tag -> tag.put("pottery", PotteryTags.save(pottery))); } public static Pottery read(ItemStack stack) { @@ -74,7 +75,7 @@ public static Pottery read(ItemStack stack) { if (pottery.isEmpty()) { return null; } - return Pottery.load(pottery); + return PotteryTags.load(pottery); } /** The saved profile, or the editor's starting shape. */ @@ -99,7 +100,7 @@ public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip) { if (ModItems.isBlueprint(stack)) { Pottery.Info info = profile(stack).classify(); - tooltip.accept(Component.translatable("tooltip.primalpottery.type", info.type().tooltipName())); + tooltip.accept(Component.translatable("tooltip.primalpottery.type", Component.translatable(info.type().tooltipKey()))); tooltip.accept(Component.translatable(size(stack) == Pottery.Size.LARGE ? "tooltip.primalpottery.wheel_clay_block" : "tooltip.primalpottery.wheel_clay_ball")); if (info.volume() > 0) { diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/menu/PaintingMenu.java b/src/main/java/net/modcrafters/minecraft/primalpottery/menu/PaintingMenu.java index 19b223e..72f6915 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/menu/PaintingMenu.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/menu/PaintingMenu.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.menu; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryTags; import net.minecraft.core.component.DataComponents; import net.minecraft.world.SimpleContainer; import net.minecraft.world.entity.player.Inventory; @@ -186,7 +187,7 @@ private static int inkFor(int color) { private void writeCell(ItemStack stack, Pottery before, int cell, int color) { Pottery painted = before.withPaint(before.paint().with(cell, color)); - CustomData.update(DataComponents.CUSTOM_DATA, stack, tag -> tag.put("pottery", painted.save())); + CustomData.update(DataComponents.CUSTOM_DATA, stack, tag -> tag.put("pottery", PotteryTags.save(painted))); work.setChanged(); undoInk.set(history.isEmpty() ? 0 : inkFor(history.getLast().previous()) + 2); broadcastChanges(); diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintColors.java b/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintColors.java new file mode 100644 index 0000000..1befb71 --- /dev/null +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintColors.java @@ -0,0 +1,19 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import net.minecraft.world.item.DyeColor; + +public final class PaintColors { + private PaintColors() {} + + public static int rgb(int color) { + if (color >= FacePaint.COLORS) { + return FacePaint.flowerRgb(color); + } + //? if >=1.21 { + return DyeColor.byId(color).getTextureDiffuseColor() & 0xFFFFFF; + //?} else { + /*float[] rgb = DyeColor.byId(color).getTextureDiffuseColors(); + return Math.round(rgb[0] * 255) << 16 | Math.round(rgb[1] * 255) << 8 | Math.round(rgb[2] * 255); + *///?} + } +} diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryDisc.java b/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryDisc.java deleted file mode 100644 index 9a708dc..0000000 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryDisc.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.modcrafters.minecraft.primalpottery.pottery; - -public record PotteryDisc(double height, double radius, double innerRadius) { - public PotteryDisc(double height, double radius) { - this(height, radius, 0); - } -} diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryTags.java b/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryTags.java new file mode 100644 index 0000000..72fb73a --- /dev/null +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryTags.java @@ -0,0 +1,30 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; + +public final class PotteryTags extends PotteryCodec { + private static final PotteryTags CODEC = new PotteryTags(); + + public static CompoundTag save(Pottery pot) { return CODEC.encode(pot); } + public static Pottery readProfile(CompoundTag tag) { return CODEC.decode(tag); } + + public static Pottery load(CompoundTag tag) { + Pottery profile = readProfile(tag); + return profile == null ? Pottery.display() : profile; + } + + protected CompoundTag compound() { return new CompoundTag(); } + protected ListTag list() { return new ListTag(); } + protected ListTag discs(CompoundTag tag) { return Nbt.list(tag, "discs"); } + protected int size(ListTag list) { return list.size(); } + protected CompoundTag at(ListTag list, int i) { return Nbt.compoundAt(list, i); } + protected void append(ListTag list, CompoundTag disc) { list.add(disc); } + protected void writeDiscs(CompoundTag tag, ListTag discs) { tag.put("discs", discs); } + protected void number(CompoundTag tag, String key, double value) { tag.putDouble(key, value); } + protected double number(CompoundTag tag, String key) { return Nbt.getDouble(tag, key); } + protected void flag(CompoundTag tag, String key) { tag.putBoolean(key, true); } + protected boolean flagged(CompoundTag tag, String key) { return Nbt.getBoolean(tag, key); } + protected void text(CompoundTag tag, String key, String value) { tag.putString(key, value); } + protected String text(CompoundTag tag, String key) { return Nbt.getString(tag, key); } +} diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryType.java b/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryType.java deleted file mode 100644 index a88f42b..0000000 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryType.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.modcrafters.minecraft.primalpottery.pottery; - -import java.util.Locale; -import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.Component; - -public enum PotteryType { - LUMP("Just a lump of clay", ChatFormatting.DARK_RED), - LUMP_NO_BOTTOM("A pipe?", ChatFormatting.DARK_RED), - LUMP_THIN("Too thin!", ChatFormatting.DARK_RED), - PLATE("A plate!", ChatFormatting.DARK_AQUA), - PLATTER("A serving platter!", ChatFormatting.DARK_AQUA), - POT("A bowl!", ChatFormatting.DARK_AQUA), - JAR("Pottery", ChatFormatting.DARK_AQUA), - JUG("A jug!", ChatFormatting.DARK_AQUA); - - private final String label; - private final ChatFormatting color; - - PotteryType(String label, ChatFormatting color) { - this.label = label; - this.color = color; - } - - public String label() { - return this.label; - } - - public ChatFormatting color() { - return this.color; - } - - public boolean isVessel() { - return this == POT || this == JAR || this == JUG; - } - - public Component tooltipName() { - PotteryType type = isServingDish() || this.isVessel() ? this : LUMP; - return Component.translatable("pottery.primalpottery.type." + type.name().toLowerCase(Locale.ROOT)); - } - - public boolean isServingDish() { - return this == PLATE || this == PLATTER; - } - - /** Wide mouth is a bowl, narrow mouth is a jug, and every other shape is pottery. */ - public Component shapeName() { - String shape = switch (this) { - case PLATE -> "plate"; - case PLATTER -> "platter"; - case JUG -> "jug"; - case POT -> "bowl"; - default -> "pottery"; - }; - return Component.translatable("pottery.primalpottery.shape." + shape); - } -} diff --git a/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java b/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java index 2a9f4a7..84280a6 100644 --- a/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java +++ b/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java @@ -1,5 +1,6 @@ package net.modcrafters.minecraft.primalpottery.client; +import net.modcrafters.minecraft.primalpottery.pottery.PotteryTags; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotSame; @@ -33,7 +34,7 @@ void stampSamplesTheSpriteFrameAndTintInPaintingTableOrder() { int[] pixels = new int[256]; var sheet = new java.awt.image.BufferedImage(32, 64, java.awt.image.BufferedImage.TYPE_INT_ARGB); sheet.setRGB(31, 33, -1); - int tint = 0xff000000 | net.modcrafters.minecraft.primalpottery.pottery.FacePaint.rgb(11); + int tint = 0xff000000 | net.modcrafters.minecraft.primalpottery.pottery.PaintColors.rgb(11); ItemIconStamp.sampleFrame(pixels, sheet::getRGB, 0, 32, 32, 32, tint); assertEquals(".".repeat(15) + "L" + ".".repeat(240), ItemIconStamp.quantize(pixels)); assertEquals(tint, ItemIconStamp.composite(tint, 0, -1)); @@ -74,7 +75,7 @@ void platterMarksStayOnTheLipAtTheSixServingBoundariesAndSampleOnlyClay() { void firedMeshCacheReusesEqualProfilesAndKeepsFinishesAndPositionsSeparate() { Pottery jug = Pottery.jug(); Mesh plain = Mesh.firedVessel(0, 0, 0, jug); - assertSame(plain, Mesh.firedVessel(0, 0, 0, Pottery.load(jug.save()))); + assertSame(plain, Mesh.firedVessel(0, 0, 0, PotteryTags.load(PotteryTags.save(jug)))); assertNotSame(plain, Mesh.firedVessel(8, 0, 0, jug)); var custom = new Pottery(jug.size(), jug.discs(), jug.paint().with(48, 3)); assertSame(plain, Mesh.placedVessel(0, 0, custom, 1)); diff --git a/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryTest.java b/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryTest.java index 991dd61..a28b19a 100644 --- a/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryTest.java +++ b/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PotteryTest.java @@ -44,17 +44,17 @@ class PotteryTest { @Test void legacyFlowerLoadsAsEditablePixelsAndSavesInTheCustomFormat() { - var saved = Pottery.jug().save(); + var saved = PotteryTags.save(Pottery.jug()); assertFalse(saved.contains("paint")); saved.putString("paint", "flower"); - var pot = Pottery.load(saved); + var pot = PotteryTags.load(saved); var pixels = pot.paint(); int petal = FacePaint.SIDE + 7; - assertEquals(0xFFF1CA, FacePaint.rgb(pixels.color(petal))); - assertEquals(pixels.pixels(), Nbt.getString(pot.save(), "paint")); + assertEquals(0xFFF1CA, PaintColors.rgb(pixels.color(petal))); + assertEquals(pixels.pixels(), Nbt.getString(PotteryTags.save(pot), "paint")); var edited = pot.withPaint(pixels.with(petal, FacePaint.ERASE)); assertEquals(pixels.color(petal + 1), edited.paint().color(petal + 1)); - assertEquals(FacePaint.ERASE, Pottery.load(edited.save()).paint().color(petal)); + assertEquals(FacePaint.ERASE, PotteryTags.load(PotteryTags.save(edited)).paint().color(petal)); } private static final Map DYE_COLORS = Map.ofEntries( @@ -233,13 +233,13 @@ void largeWideShallowProfilesArePlattersAndPreviouslySavedVesselsKeepTheirHollow Pottery platter = new Pottery(Pottery.Size.LARGE, List.of(new PotteryDisc(5, 12.8, 10), new PotteryDisc(1, 10))); assertEquals(new Pottery.Info(PotteryType.PLATTER, 0), platter.classify()); assertNull(platter.lidDisc()); - CompoundTag tag = platter.save(); - assertTrue(Pottery.load(tag).isPlatter()); + CompoundTag tag = PotteryTags.save(platter); + assertTrue(PotteryTags.load(tag).isPlatter()); tag.remove("platter"); - Pottery legacy = Pottery.load(tag); + Pottery legacy = PotteryTags.load(tag); assertTrue(legacy.classify().volume() > 0); assertTrue(legacy.cover() != null); - assertFalse(Pottery.load(legacy.withPaint(FacePaint.EMPTY.with(0, 3)).save()).isPlatter()); + assertFalse(PotteryTags.load(PotteryTags.save(legacy.withPaint(FacePaint.EMPTY.with(0, 3)))).isPlatter()); assertFalse(new Pottery(Pottery.Size.LARGE, List.of(new PotteryDisc(6, 12.79))).isPlatter()); assertFalse(new Pottery(Pottery.Size.LARGE, List.of(new PotteryDisc(7, 16))).isPlatter()); } @@ -315,9 +315,9 @@ void shapedIsTheOnlyLerp() { @Test void itemNameUsesJugBowlOrPottery() { - assertEquals(Component.translatable("pottery.primalpottery.shape.bowl"), vessel(5).classify().type().shapeName()); - assertEquals(Component.translatable("pottery.primalpottery.shape.pottery"), vessel(4).classify().type().shapeName()); - assertEquals(Component.translatable("pottery.primalpottery.shape.jug"), vessel(2.7).classify().type().shapeName()); + assertEquals(Component.translatable("pottery.primalpottery.shape.bowl"), Component.translatable(vessel(5).classify().type().shapeKey())); + assertEquals(Component.translatable("pottery.primalpottery.shape.pottery"), Component.translatable(vessel(4).classify().type().shapeKey())); + assertEquals(Component.translatable("pottery.primalpottery.shape.jug"), Component.translatable(vessel(2.7).classify().type().shapeKey())); assertEquals( Component.translatable("item.primalpottery.raw_shape", Component.translatable("pottery.primalpottery.shape.jug")), RawPotteryItem.stack(vessel(2.7)).getHoverName() @@ -366,7 +366,7 @@ void dyeRoundTripsAndClayTextureUsesTerracotta() { assertEquals(1, new ItemStack(ModItems.RAW_POTTERY).getMaxStackSize()); CompoundTag tag = PotteryItem.customData(raw); assertEquals("blue", Nbt.getString(tag, "dye")); - assertEquals(profile.discs(), Pottery.load(Nbt.compound(tag, "pottery")).discs()); + assertEquals(profile.discs(), PotteryTags.load(Nbt.compound(tag, "pottery")).discs()); assertFalse(tag.contains("fluid")); assertFalse(tag.contains("lid")); assertEquals(0x2F4BFF, raw.getItem().getName(raw).getStyle().getColor().getValue()); @@ -383,10 +383,10 @@ void dyeRoundTripsAndClayTextureUsesTerracotta() { ItemStack missing = new ItemStack(ModItems.RAW_POTTERY); assertNull(RawPotteryItem.wheelProfile(missing)); CompoundTag broken = new CompoundTag(); - broken.put("pottery", new Pottery(List.of(new PotteryDisc(0, 2))).save()); + broken.put("pottery", PotteryTags.save(new Pottery(List.of(new PotteryDisc(0, 2))))); missing.set(net.minecraft.core.component.DataComponents.CUSTOM_DATA, net.minecraft.world.item.component.CustomData.of(broken)); assertNull(RawPotteryItem.wheelProfile(missing)); - assertEquals(Pottery.display().discs(), Pottery.load(Nbt.compound(broken, "pottery")).discs()); + assertEquals(Pottery.display().discs(), PotteryTags.load(Nbt.compound(broken, "pottery")).discs()); ItemStack fired = PotteryItem.stack(profile, VesselContents.EMPTY, false, "blue"); ItemStack undyed = PotteryItem.stack(profile); @@ -497,7 +497,7 @@ void resizeKeepsTheFootAndLipAndRoundTripsAtTheChosenHeight() { assertEquals(5, shortPot.discs().getFirst().radius()); assertEquals(4, shortPot.discs().getLast().radius()); assertEquals(0, shortPot.discs().getLast().innerRadius()); - assertEquals(shortPot.discs(), Pottery.load(shortPot.save()).discs()); + assertEquals(shortPot.discs(), PotteryTags.load(PotteryTags.save(shortPot)).discs()); assertEquals(size.units, shape.withHeight(99).height()); assertEquals(1, shape.withHeight(0).height()); } @@ -575,7 +575,7 @@ void templatesKeepTheirSizeThroughFormingAndFiring() { assertFalse(Pottery.validProfile(Pottery.Size.SMALL, TemplateItem.fresh(Pottery.Size.LARGE).discs())); assertFalse(Pottery.validProfile(Pottery.Size.LARGE, List.of(new PotteryDisc(33, 16)))); assertFalse(Pottery.validProfile(Pottery.Size.LARGE, List.of(new PotteryDisc(32, 16.1)))); - assertEquals(Pottery.Size.SMALL, Pottery.load(Pottery.jug().save()).size()); + assertEquals(Pottery.Size.SMALL, PotteryTags.load(PotteryTags.save(Pottery.jug())).size()); } @Test @@ -585,13 +585,13 @@ void profilesRejectInvalidDimensionsAndKeepOlderZeroWidthWalls() { new PotteryDisc(1, 2, Double.NaN), new PotteryDisc(1, 2, -1))) { Pottery bad = new Pottery(List.of(invalid)); assertFalse(Pottery.validProfile(bad.discs())); - assertEquals(Pottery.display().discs(), Pottery.load(bad.save()).discs()); + assertEquals(Pottery.display().discs(), PotteryTags.load(PotteryTags.save(bad)).discs()); } assertFalse(Pottery.validProfile(List.of(new PotteryDisc(8, 2), new PotteryDisc(8.01, 2)))); assertFalse(Pottery.validProfile(java.util.Collections.nCopies(65, new PotteryDisc(0.1, 2)))); Pottery crossed = new Pottery(List.of(new PotteryDisc(1, 2, 3), new PotteryDisc(1, 2))); assertFalse(Pottery.validProfile(crossed.discs())); - assertEquals(List.of(new PotteryDisc(1, 2, 2), new PotteryDisc(1, 2)), Pottery.load(crossed.save()).discs()); + assertEquals(List.of(new PotteryDisc(1, 2, 2), new PotteryDisc(1, 2)), PotteryTags.load(PotteryTags.save(crossed)).discs()); } @Test @@ -601,7 +601,7 @@ void nbtRoundTripKeepsTheShape() { new PotteryDisc(2, 4, 2), new PotteryDisc(1, 4, 0) )); - Pottery loaded = Pottery.load(pottery.save()); + Pottery loaded = PotteryTags.load(PotteryTags.save(pottery)); assertEquals(PotteryType.JUG, loaded.classify().type()); assertEquals(3, loaded.discs().size()); assertEquals(4, loaded.discs().getFirst().radius(), 0.0001); diff --git a/stonecutter.gradle.kts b/stonecutter.gradle.kts index aea991e..613609c 100644 --- a/stonecutter.gradle.kts +++ b/stonecutter.gradle.kts @@ -4,6 +4,7 @@ plugins { id("net.fabricmc.fabric-loom") version "1.18.1" apply false // see https://projects.neoforged.net/neoforged/moddevgradle for new versions id("net.neoforged.moddev") version "2.0.147" apply false + id("net.neoforged.moddev.legacyforge") version "2.0.147" apply false } stonecutter active "26.3" @@ -61,8 +62,8 @@ subprojects { // The active version's merge writes this branch's shared sources. Other versions read those folders // while generating, so they have to wait for that write. Their own merge is not a dependency: running // it would copy the inactive version back over the shared sources. - if (parent != null) { - val activeNode = parent!!.project("26.3") + val activeNode = parent?.findProject("26.3") + if (activeNode != null && name.first().isDigit()) { if (path != activeNode.path) { val activeMerge = activeNode.tasks.named("stonecutterMerge") val activeTestMerge = activeNode.tasks.named("stonecutterMergeTest") From 50b676df5dca6b639ee09c169344dcb6cf3e8351 Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 18:30:48 +0200 Subject: [PATCH 02/11] Test the shared painted mesh and expose the preview jars in CI Co-authored-by: Face of Cat --- .github/workflows/ci.yml | 10 +++++- core/build.gradle | 2 ++ .../pottery/PaintedVesselTest.java | 35 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dedf349..c31c8ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ name: CI # Every pull request must build and pass on every Minecraft version before it can merge. # `all-versions` requires every version job and the release-script checks, so it is the one check for a ruleset on main to require. on: + workflow_dispatch: pull_request: push: branches: [main] @@ -119,7 +120,7 @@ jobs: - minecraft: '1.20.1' java: '21' directory: . - build: ./gradlew :forge:build + build: ./gradlew :core:test :forge:build client: ./gradlew -I .github/forge-display-check/check.init.gradle :forge:runClient steps: - uses: actions/checkout@v7 @@ -131,6 +132,13 @@ jobs: - name: Build production jar working-directory: ${{ matrix.directory }} run: ${{ matrix.build }} + - uses: actions/upload-artifact@v7 + with: + name: jar-forge-${{ matrix.minecraft }} + path: | + forge/build/libs/primalpottery-forge-${{ matrix.minecraft }}-*.jar + legacy/forge-1.12.2/build/libs/primalpottery-forge-${{ matrix.minecraft }}-*.jar + if-no-files-found: error - name: Render 200 painted pots on the hosted software renderer working-directory: ${{ matrix.directory }} env: diff --git a/core/build.gradle b/core/build.gradle index 4e06a2c..621ab3d 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -6,6 +6,8 @@ java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } +repositories { mavenCentral() } +dependencies { testImplementation 'junit:junit:4.13.2' } if (JavaVersion.current().isJava9Compatible()) { tasks.withType(JavaCompile).configureEach { options.release = 8 } } diff --git a/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java b/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java new file mode 100644 index 0000000..f7f03b3 --- /dev/null +++ b/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java @@ -0,0 +1,35 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import java.util.Arrays; +import java.util.List; +import org.junit.Test; +import static org.junit.Assert.*; + +public class PaintedVesselTest { + private static final class FaceCounter extends BakedVessels { + int builds; + @Override protected Integer bake(PaintedVessel.Vertex a, PaintedVessel.Vertex b, + PaintedVessel.Vertex c, PaintedVessel.Vertex d, int pigment) { + builds++; + return pigment; + } + } + + @Test public void independentlyLoadedEqualProfilesShareABakeButDifferentPaintDoesNot() { + FaceCounter counter = new FaceCounter(); + List plain = counter.model(Pottery.jug()); + int built = counter.builds; + assertSame(plain, counter.model(Pottery.jug())); + assertEquals(built, counter.builds); + assertTrue(plain.stream().allMatch(ink -> ink == PaintedVessel.CLAY)); + assertTrue(counter.model(PaintedVessel.SAMPLE).stream().anyMatch(ink -> ink >= 0)); + } + + @Test public void contiguousRowsBecomeOneBandOnEachOfEightFlatFaces() { + char[] pixels = FacePaint.EMPTY.pixels().toCharArray(); + Arrays.fill(pixels, 5 * 16, 11 * 16, 'C'); + Pottery cylinder = new Pottery(Arrays.asList(new PotteryDisc(12, 4, 3), new PotteryDisc(1, 4))); + List quads = new FaceCounter().model(cylinder.withPaint(FacePaint.read(new String(pixels)))); + assertEquals(8, quads.stream().filter(ink -> ink == 2).count()); + } +} From 5a2aed83007bd16592bb3848a1955ef4e9adda6d Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 18:36:10 +0200 Subject: [PATCH 03/11] Give the hosted LWJGL 2 client a virtual monitor mode Co-authored-by: Face of Cat --- .github/forge-display-check/xorg.conf | 24 ++++++++++++++++++++++++ .github/workflows/ci.yml | 17 +++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .github/forge-display-check/xorg.conf diff --git a/.github/forge-display-check/xorg.conf b/.github/forge-display-check/xorg.conf new file mode 100644 index 0000000..f73ab31 --- /dev/null +++ b/.github/forge-display-check/xorg.conf @@ -0,0 +1,24 @@ +# LWJGL 2 reads monitor modes through xrandr. Give its hosted display a named mode and refresh rate. +Section "Device" + Identifier "Headless" + Driver "dummy" + VideoRam 16384 +EndSection + +Section "Monitor" + Identifier "Virtual monitor" + HorizSync 30-80 + VertRefresh 50-75 + Modeline "1280x720" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync +EndSection + +Section "Screen" + Identifier "Screen" + Device "Headless" + Monitor "Virtual monitor" + DefaultDepth 24 + SubSection "Display" + Depth 24 + Modes "1280x720" + EndSubSection +EndSection diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c31c8ec..9767bf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,7 +121,7 @@ jobs: java: '21' directory: . build: ./gradlew :core:test :forge:build - client: ./gradlew -I .github/forge-display-check/check.init.gradle :forge:runClient + client: xvfb-run -a ./gradlew -I .github/forge-display-check/check.init.gradle :forge:runClient steps: - uses: actions/checkout@v7 - uses: actions/setup-java@v6 @@ -139,6 +139,19 @@ jobs: forge/build/libs/primalpottery-forge-${{ matrix.minecraft }}-*.jar legacy/forge-1.12.2/build/libs/primalpottery-forge-${{ matrix.minecraft }}-*.jar if-no-files-found: error + - name: Start a virtual monitor for LWJGL 2 + if: matrix.minecraft == '1.12.2' + run: | + sudo apt-get update -qq + sudo apt-get install -y --no-install-recommends xserver-xorg-core xserver-xorg-video-dummy x11-xserver-utils + sudo Xorg :95 -config "$GITHUB_WORKSPACE/.github/forge-display-check/xorg.conf" -nolisten tcp -noreset -logfile "$RUNNER_TEMP/Xorg.log" >"$RUNNER_TEMP/xorg-console.log" 2>&1 & + export DISPLAY=:95 + for attempt in {1..20}; do + if xrandr --query; then echo "DISPLAY=$DISPLAY" >> "$GITHUB_ENV"; exit 0; fi + sleep 1 + done + cat "$RUNNER_TEMP/Xorg.log" + exit 1 - name: Render 200 painted pots on the hosted software renderer working-directory: ${{ matrix.directory }} env: @@ -147,7 +160,7 @@ jobs: run: | mkdir -p "$GITHUB_WORKSPACE/build/display-check" printf 'onboardAccessibility:false\nmaxFps:30\npauseOnLostFocus:false\nrenderDistance:5\n' > "$GITHUB_WORKSPACE/build/display-check/options.txt" - timeout 20m xvfb-run -a ${{ matrix.client }} + timeout 20m ${{ matrix.client }} cat "$GITHUB_WORKSPACE/build/display-check/display-check.txt" - uses: actions/upload-artifact@v7 if: always() From 971984f6a3c298a633e824b2d1bf7eaa831bbbe6 Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 18:42:31 +0200 Subject: [PATCH 04/11] Load legacy dev resources and verify the held and placed reference pot Co-authored-by: Face of Cat --- .../1.12.2/potterycheck/DisplayCheck.java | 44 ++++++++++++++++--- .../1.20.1/potterycheck/DisplayCheck.java | 39 +++++++++++++--- legacy/forge-1.12.2/build.gradle | 13 +++++- 3 files changed, 84 insertions(+), 12 deletions(-) diff --git a/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java b/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java index 8f07c83..4baf98f 100644 --- a/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java +++ b/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java @@ -27,13 +27,14 @@ import net.modcrafters.minecraft.primalpottery.legacy.PrimalPotteryForge; @Mod.EventBusSubscriber(modid = "primalpottery", value = Side.CLIENT) -// Runs only in the disposable hosted world, under Xvfb with Mesa software rendering. +// Runs only in the disposable hosted world, with Mesa software rendering. public final class DisplayCheck { private static boolean opening; private static boolean placed; private static int ticks; private static long firstFrame; private static long previousFrame; + private static long referenceStarted; private static final ArrayList frames = new ArrayList<>(); private static final String WORLD = "painted-pot-display"; @@ -41,6 +42,12 @@ public final class DisplayCheck { if (event.phase != TickEvent.Phase.END) return; Minecraft mc = Minecraft.getMinecraft(); if (!opening && mc.currentScreen instanceof GuiMainMenu) { + for (String texture : new String[]{"block/fired_clay", "block/pottery_inks"}) { + String id = "primalpottery:" + texture; + if (!id.equals(mc.getTextureMapBlocks().getAtlasSprite(id).getIconName())) { + throw new AssertionError("Missing pottery texture " + id); + } + } opening = true; mc.gameSettings.limitFramerate = 30; mc.gameSettings.pauseOnLostFocus = false; @@ -77,7 +84,15 @@ private static void install(WorldServer level) { @SubscribeEvent public static void frame(TickEvent.RenderTickEvent event) throws Exception { if (!placed || event.phase != TickEvent.Phase.END) return; Minecraft mc = Minecraft.getMinecraft(); - if (mc.player == null || mc.currentScreen != null || mc.player.posZ > -18) return; + if (mc.player == null || mc.currentScreen != null) return; + if (referenceStarted != 0) { + if (mc.player.posX > 39 && System.nanoTime() - referenceStarted > 4_000_000_000L) { + screenshot(mc, "reference.png"); + mc.shutdown(); + } + return; + } + if (mc.player.posZ > -18) return; long now = System.nanoTime(); if (firstFrame == 0) { for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { @@ -89,12 +104,31 @@ private static void install(WorldServer level) { if (now - firstFrame > 5_000_000_000L) frames.add(now - previousFrame); previousFrame = now; if (now - firstFrame < 17_000_000_000L) return; - placed = false; Collections.sort(frames); String report = String.format(Locale.ROOT, "200 checkerboard pots, %d frames, p50 %.2f ms, p95 %.2f ms (30 FPS cap)", frames.size(), frames.get(frames.size() / 2) / 1e6, frames.get(frames.size() * 95 / 100) / 1e6); - ScreenShotHelper.saveScreenshot(new File("."), "pots.png", mc.displayWidth, mc.displayHeight, mc.getFramebuffer()); + screenshot(mc, "pots.png"); Files.write(Paths.get("display-check.txt"), Collections.singletonList(report)); - mc.shutdown(); + referenceStarted = now; + showReference(mc); + } + + private static void showReference(Minecraft mc) { + mc.gameSettings.hideGUI = false; + net.minecraft.server.MinecraftServer server = mc.getIntegratedServer(); + server.addScheduledTask(() -> { + WorldServer level = server.getWorld(0); + level.setBlockState(new BlockPos(40, 79, -2), Blocks.STONE.getDefaultState()); + level.setBlockState(new BlockPos(40, 80, 0), Blocks.STONE.getDefaultState()); + level.setBlockState(new BlockPos(40, 81, 0), PrimalPotteryForge.POT.getDefaultState()); + net.minecraft.entity.player.EntityPlayerMP player = server.getPlayerList().getPlayers().get(0); + player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(PrimalPotteryForge.POT)); + player.inventoryContainer.detectAndSendChanges(); + player.connection.setPlayerLocation(40.5, 80, -1.5, 0, 15); + }); + } + + private static void screenshot(Minecraft mc, String name) throws Exception { + ScreenShotHelper.saveScreenshot(new File("."), name, mc.displayWidth, mc.displayHeight, mc.getFramebuffer()); } } diff --git a/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java b/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java index 92219fb..b42aae0 100644 --- a/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java +++ b/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java @@ -30,13 +30,14 @@ import net.minecraftforge.registries.ForgeRegistries; @Mod.EventBusSubscriber(modid = "primalpottery", value = Dist.CLIENT) -// Runs only in the disposable hosted world, under Xvfb with Mesa software rendering. +// Runs only in the disposable hosted world, with Mesa software rendering. public final class DisplayCheck { private static boolean opening; private static boolean placed; private static int ticks; private static long firstFrame; private static long previousFrame; + private static long referenceStarted; private static final ArrayList frames = new ArrayList<>(); private static final String WORLD = "painted-pot-display"; @@ -84,7 +85,15 @@ private static void install(ServerLevel level) { @SubscribeEvent public static void frame(TickEvent.RenderTickEvent event) throws Exception { if (!placed || event.phase != TickEvent.Phase.END) return; Minecraft mc = Minecraft.getInstance(); - if (mc.player == null || mc.screen != null || mc.player.getZ() > -18) return; + if (mc.player == null || mc.screen != null) return; + if (referenceStarted != 0) { + if (mc.player.getX() > 39 && System.nanoTime() - referenceStarted > 4_000_000_000L) { + screenshot(mc, "reference.png"); + mc.stop(); + } + return; + } + if (mc.player.getZ() > -18) return; long now = System.nanoTime(); if (firstFrame == 0) { for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { @@ -96,12 +105,32 @@ private static void install(ServerLevel level) { if (now - firstFrame > 5_000_000_000L) frames.add(now - previousFrame); previousFrame = now; if (now - firstFrame < 17_000_000_000L) return; - placed = false; Collections.sort(frames); String report = String.format(Locale.ROOT, "200 checkerboard pots, %d frames, p50 %.2f ms, p95 %.2f ms (30 FPS cap)", frames.size(), frames.get(frames.size() / 2) / 1e6, frames.get(frames.size() * 95 / 100) / 1e6); - try (var image = Screenshot.takeScreenshot(mc.getMainRenderTarget())) { image.writeToFile(new File("pots.png")); } + screenshot(mc, "pots.png"); Files.write(Paths.get("display-check.txt"), Collections.singletonList(report)); - mc.stop(); + referenceStarted = now; + showReference(mc); + } + + private static void showReference(Minecraft mc) { + mc.options.hideGui = false; + var server = mc.getSingleplayerServer(); + server.execute(() -> { + ServerLevel level = server.overworld(); + var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("primalpottery", "pottery")); + level.setBlockAndUpdate(new BlockPos(40, 79, -2), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(new BlockPos(40, 80, 0), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(new BlockPos(40, 81, 0), block.defaultBlockState()); + var player = server.getPlayerList().getPlayers().get(0); + player.setItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND, new ItemStack(block)); + player.inventoryMenu.broadcastChanges(); + player.connection.teleport(40.5, 80, -1.5, 0, 15); + }); + } + + private static void screenshot(Minecraft mc, String name) throws Exception { + try (var image = Screenshot.takeScreenshot(mc.getMainRenderTarget())) { image.writeToFile(new File(name)); } } } diff --git a/legacy/forge-1.12.2/build.gradle b/legacy/forge-1.12.2/build.gradle index f696589..4418c3e 100644 --- a/legacy/forge-1.12.2/build.gradle +++ b/legacy/forge-1.12.2/build.gradle @@ -15,11 +15,20 @@ sourceCompatibility = targetCompatibility = '1.8' project(':core').buildDir = file('build/core') evaluationDependsOn(':core') +// FML 1.12 opens the directory containing @Mod as its resource pack in development. +sourceSets.main.output.resourcesDir = compileJava.destinationDir + minecraft { mappings channel: 'snapshot', version: '20171003-1.12' runs { - client { workingDirectory project.file('run/client') } - server { workingDirectory project.file('run/server') } + client { + workingDirectory project.file('run/client') + forceExit false + } + server { + workingDirectory project.file('run/server') + forceExit false + } } } dependencies { From 2b822892d83c072066dc413748047da0a1019625 Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 18:47:18 +0200 Subject: [PATCH 05/11] Position the painted vessel visibly in first person Co-authored-by: Face of Cat --- .../resources/assets/primalpottery/models/block/pottery.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/forge/src/main/resources/assets/primalpottery/models/block/pottery.json b/forge/src/main/resources/assets/primalpottery/models/block/pottery.json index e1d3924..acb02a0 100644 --- a/forge/src/main/resources/assets/primalpottery/models/block/pottery.json +++ b/forge/src/main/resources/assets/primalpottery/models/block/pottery.json @@ -2,6 +2,8 @@ "parent": "block/block", "textures": {"particle": "primalpottery:block/fired_clay"}, "display": { + "firstperson_righthand": {"rotation": [0, 45, 0], "translation": [-2, 8, 0], "scale": [0.85, 0.85, 0.85]}, + "firstperson_lefthand": {"rotation": [0, 225, 0], "translation": [-2, 8, 0], "scale": [0.85, 0.85, 0.85]}, "gui": {"rotation": [30, 45, 0], "translation": [0, 4, 0], "scale": [1.75, 1.75, 1.75]}, "ground": {"translation": [0, 4, 0], "scale": [1, 1, 1]} } From 0860db125848c4a4c192c4870847dfc196fb7a27 Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 19:07:01 +0200 Subject: [PATCH 06/11] Draw Forge 1.20.1 pottery paint from reusable atlas tiles and profile terrain GPU time Co-authored-by: Face of Cat --- .../1.20.1/potterycheck/DisplayCheck.java | 76 ++++++++++++-- .../1.20.1/potterycheck/TerrainTiming.java | 64 ++++++++++++ .../primalpottery/pottery/BakedVessels.java | 4 +- .../primalpottery/pottery/PaintedVessel.java | 56 ++++++++-- .../pottery/VesselQuadPacker.java | 4 + .../pottery/PaintedVesselTest.java | 17 +++ .../forge/client/PaintSheet.java | 98 ++++++++++++++++++ .../forge/client/PotteryModel.java | 14 ++- .../forge/client/PotteryQuads.java | 17 ++- .../models/block/paint_sheet.json | 1 + .../primalpottery/models/block/pottery.json | 1 + .../textures/block/paint_sheet.png | Bin 0 -> 334 bytes .../textures/block/paint_sheet.png.mcmeta | 1 + legacy/forge-1.12.2/build.gradle | 3 +- 14 files changed, 333 insertions(+), 23 deletions(-) create mode 100644 .github/forge-display-check/1.20.1/potterycheck/TerrainTiming.java create mode 100644 forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PaintSheet.java create mode 100644 forge/src/main/resources/assets/primalpottery/models/block/paint_sheet.json create mode 100644 forge/src/main/resources/assets/primalpottery/textures/block/paint_sheet.png create mode 100644 forge/src/main/resources/assets/primalpottery/textures/block/paint_sheet.png.mcmeta diff --git a/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java b/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java index b42aae0..6000767 100644 --- a/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java +++ b/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java @@ -5,7 +5,12 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collections; +import java.util.List; import java.util.Locale; +import java.util.concurrent.CompletableFuture; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.util.RandomSource; +import net.minecraftforge.client.model.data.ModelData; import net.minecraft.client.Minecraft; import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; import net.modcrafters.minecraft.primalpottery.pottery.Pottery; @@ -32,12 +37,14 @@ @Mod.EventBusSubscriber(modid = "primalpottery", value = Dist.CLIENT) // Runs only in the disposable hosted world, with Mesa software rendering. public final class DisplayCheck { + private static final Pottery CHECKER = checkerboardJug(); private static boolean opening; private static boolean placed; private static int ticks; private static long firstFrame; private static long previousFrame; private static long referenceStarted; + private static CompletableFuture reload; private static final ArrayList frames = new ArrayList<>(); private static final String WORLD = "painted-pot-display"; @@ -66,15 +73,18 @@ public final class DisplayCheck { } } + private static Pottery checkerboardJug() { + StringBuilder pixels = new StringBuilder(256); + for (int y = 0; y < 16; y++) for (int x = 0; x < 16; x++) pixels.append((x + y) % 2 == 0 ? 'A' : 'O'); + return Pottery.jug().withPaint(FacePaint.read(pixels.toString())); + } + private static void install(ServerLevel level) { BlockPos platform = new BlockPos(0, 84, -19); level.setBlockAndUpdate(platform, Blocks.STONE.defaultBlockState()); - StringBuilder pixels = new StringBuilder(256); - for (int y = 0; y < 16; y++) for (int x = 0; x < 16; x++) pixels.append((x + y) % 2 == 0 ? 'A' : 'O'); - Pottery model = Pottery.jug().withPaint(FacePaint.read(pixels.toString())); var block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("primalpottery", "pottery")); ItemStack stack = new ItemStack(block); - stack.addTagElement("pottery", ForgePotteryTags.save(model)); + stack.addTagElement("pottery", ForgePotteryTags.save(CHECKER)); for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { BlockPos pos = new BlockPos(x, y, 0); level.setBlockAndUpdate(pos, block.defaultBlockState()); @@ -86,8 +96,11 @@ private static void install(ServerLevel level) { if (!placed || event.phase != TickEvent.Phase.END) return; Minecraft mc = Minecraft.getInstance(); if (mc.player == null || mc.screen != null) return; - if (referenceStarted != 0) { - if (mc.player.getX() > 39 && System.nanoTime() - referenceStarted > 4_000_000_000L) { + if (reload != null) { + if (!reload.isDone() || mc.getOverlay() != null || mc.player.getX() < 39) return; + reload.join(); + if (referenceStarted == 0) referenceStarted = System.nanoTime(); + if (System.nanoTime() - referenceStarted > 4_000_000_000L) { screenshot(mc, "reference.png"); mc.stop(); } @@ -97,21 +110,58 @@ private static void install(ServerLevel level) { long now = System.nanoTime(); if (firstFrame == 0) { for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { - if (!(mc.level.getBlockEntity(new BlockPos(x,y,0)) instanceof PaintedPotEntity)) return; + if (!(mc.level.getBlockEntity(new BlockPos(x, y, 0)) instanceof PaintedPotEntity entity)) return; + Pottery pot = entity.getModelData().get(PaintedPotEntity.PROFILE); + if (pot == null || !pot.paint().equals(CHECKER.paint())) return; } firstFrame = previousFrame = now; return; } - if (now - firstFrame > 5_000_000_000L) frames.add(now - previousFrame); + if (now - firstFrame > 5_000_000_000L) { + TerrainTiming.measuring = true; + frames.add(now - previousFrame); + } previousFrame = now; if (now - firstFrame < 17_000_000_000L) return; Collections.sort(frames); String report = String.format(Locale.ROOT, "200 checkerboard pots, %d frames, p50 %.2f ms, p95 %.2f ms (30 FPS cap)", frames.size(), frames.get(frames.size() / 2) / 1e6, frames.get(frames.size() * 95 / 100) / 1e6); screenshot(mc, "pots.png"); - Files.write(Paths.get("display-check.txt"), Collections.singletonList(report)); - referenceStarted = now; + Files.write(Paths.get("display-check.txt"), List.of(report, TerrainTiming.report(), geometryReport(mc))); + verifyFullSheet(mc); showReference(mc); + reload = mc.reloadResourcePacks(); + } + + private static String geometryReport(Minecraft mc) { + var quads = modelQuads(mc, CHECKER); + long overlays = quads.stream().filter(DisplayCheck::usesPaintSheet).count(); + if (overlays == 0) throw new AssertionError("Checkerboard used fallback geometry"); + return quads.size() * 200 + " terrain quads for 200 pots (" + overlays + " paint quads per pot)"; + } + + private static void verifyFullSheet(Minecraft mc) { + // Fill a sheet with distinct one-pixel designs. A full sheet must keep already-visible pots valid. + List last = List.of(); + for (int cell = 0; cell < FacePaint.CELLS; cell++) { + last = modelQuads(mc, CHECKER.withPaint(FacePaint.EMPTY.with(cell, 1))); + } + if (last.stream().anyMatch(DisplayCheck::usesPaintSheet) + || last.stream().noneMatch(q -> q.getSprite().contents().name().getPath().equals("block/pottery_inks")) + || modelQuads(mc, CHECKER).stream().noneMatch(DisplayCheck::usesPaintSheet)) { + throw new AssertionError("Paint sheet overflow lost a design"); + } + } + + private static boolean usesPaintSheet(BakedQuad quad) { + return quad.getSprite().contents().name().getPath().equals("block/paint_sheet"); + } + + private static List modelQuads(Minecraft mc, Pottery pot) { + var state = mc.level.getBlockState(new BlockPos(0, 85, 0)); + var model = mc.getBlockRenderer().getBlockModel(state); + var data = ModelData.builder().with(PaintedPotEntity.PROFILE, pot).build(); + return model.getQuads(state, null, RandomSource.create(0), data, null); } private static void showReference(Minecraft mc) { @@ -123,6 +173,12 @@ private static void showReference(Minecraft mc) { level.setBlockAndUpdate(new BlockPos(40, 79, -2), Blocks.STONE.defaultBlockState()); level.setBlockAndUpdate(new BlockPos(40, 80, 0), Blocks.STONE.defaultBlockState()); level.setBlockAndUpdate(new BlockPos(40, 81, 0), block.defaultBlockState()); + BlockPos neighbor = new BlockPos(39, 81, 0); + level.setBlockAndUpdate(neighbor.below(), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(neighbor, block.defaultBlockState()); + ItemStack checker = new ItemStack(block); + checker.addTagElement("pottery", ForgePotteryTags.save(CHECKER)); + block.setPlacedBy(level, neighbor, block.defaultBlockState(), null, checker); var player = server.getPlayerList().getPlayers().get(0); player.setItemInHand(net.minecraft.world.InteractionHand.MAIN_HAND, new ItemStack(block)); player.inventoryMenu.broadcastChanges(); diff --git a/.github/forge-display-check/1.20.1/potterycheck/TerrainTiming.java b/.github/forge-display-check/1.20.1/potterycheck/TerrainTiming.java new file mode 100644 index 0000000..719e57a --- /dev/null +++ b/.github/forge-display-check/1.20.1/potterycheck/TerrainTiming.java @@ -0,0 +1,64 @@ +package potterycheck; + +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Locale; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.RenderLevelStageEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL15; +import org.lwjgl.opengl.GL33; + +/** Asynchronous GPU timestamps bracket opaque terrain, including both cutout layers. */ +@Mod.EventBusSubscriber(modid = "primalpottery", value = Dist.CLIENT) +public final class TerrainTiming { + private record Sample(int begin, int end) {} + private static final ArrayDeque pending = new ArrayDeque<>(); + private static final ArrayList gpuMs = new ArrayList<>(); + private static final ArrayList cpuMs = new ArrayList<>(); + private static long cpuStart; + private static int begin; + static boolean measuring; + + @SubscribeEvent public static void stage(RenderLevelStageEvent event) { + if (!measuring) return; + if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_SKY) { + collect(); + begin = GL15.glGenQueries(); + GL33.glQueryCounter(begin, GL33.GL_TIMESTAMP); + cpuStart = System.nanoTime(); + } + if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_CUTOUT_BLOCKS && begin != 0) { + int end = GL15.glGenQueries(); + GL33.glQueryCounter(end, GL33.GL_TIMESTAMP); + pending.addLast(new Sample(begin, end)); + cpuMs.add((System.nanoTime() - cpuStart) / 1e6); + begin = 0; + } + } + + private static void collect() { + while (!pending.isEmpty() && GL15.glGetQueryObjecti(pending.peek().end(), GL15.GL_QUERY_RESULT_AVAILABLE) != 0) { + Sample sample = pending.remove(); + long elapsed = GL33.glGetQueryObjecti64(sample.end(), GL15.GL_QUERY_RESULT) + - GL33.glGetQueryObjecti64(sample.begin(), GL15.GL_QUERY_RESULT); + gpuMs.add(elapsed / 1e6); + GL15.glDeleteQueries(sample.begin()); + GL15.glDeleteQueries(sample.end()); + } + } + + static String report() { + measuring = false; + collect(); + if (gpuMs.isEmpty()) throw new IllegalStateException("No terrain GPU timings collected"); + Collections.sort(gpuMs); + Collections.sort(cpuMs); + return String.format(Locale.ROOT, "%s; terrain GPU p50 %.3f ms, p95 %.3f ms (%d samples); terrain CPU submit p50 %.3f ms", + GL11.glGetString(GL11.GL_RENDERER), gpuMs.get(gpuMs.size() / 2), gpuMs.get(gpuMs.size() * 95 / 100), + gpuMs.size(), cpuMs.get(cpuMs.size() / 2)); + } +} diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/BakedVessels.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/BakedVessels.java index f876e38..cf28fa7 100644 --- a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/BakedVessels.java +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/BakedVessels.java @@ -30,7 +30,7 @@ public synchronized List model(Pottery pot) { List cached = models.get(key); if (cached != null) return cached; List faces = new ArrayList<>(); - new PaintedVessel(pot, (a, b, c, d, ink) -> faces.add(bake(a, b, c, d, ink))); + new PaintedVessel(pot, (a, b, c, d, ink) -> faces.add(bake(a, b, c, d, ink)), paintTile(pot.paint())); List model = Collections.unmodifiableList(faces); if (model.size() > MAX_QUADS) return model; Iterator> oldest = models.values().iterator(); @@ -44,6 +44,8 @@ public synchronized List model(Pottery pot) { return model; } + protected PaintedVessel.PaintTile paintTile(FacePaint paint) { return null; } + protected abstract Q bake(PaintedVessel.Vertex a, PaintedVessel.Vertex b, PaintedVessel.Vertex c, PaintedVessel.Vertex d, int pigment); } diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java index 655e693..075194a 100644 --- a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java @@ -6,6 +6,7 @@ public final class PaintedVessel { public static final Pottery SAMPLE = Pottery.jug().withPaint(FacePaint.read("flower")); public static final int CLAY = -1; + static final int PAINT_TEXTURE = -2; private static final int SIDES = 8; private static final double UNITS = 32; private static final double[] X = new double[SIDES + 1]; @@ -34,6 +35,18 @@ public static final class Vertex { } } + /** Bounds within a stitched paint sheet, in Minecraft's 0..16 sprite coordinates. */ + public static final class PaintTile { + private final double u, v, size; + + public PaintTile(double u, double v, double size) { + this.u = u; + this.v = v; + this.size = size; + } + } + + private final PaintTile tile; private final Pottery pot; private final Faces faces; private final double paintTop; @@ -41,18 +54,18 @@ public static final class Vertex { private final int[] nextPaintRow = new int[FacePaint.SIDE]; public PaintedVessel(Pottery pot, Faces faces) { + this(pot, faces, null); + } + + public PaintedVessel(Pottery pot, Faces faces, PaintTile tile) { + this.tile = tile; this.pot = pot; this.faces = faces; List outside = PotteryProfile.profile(pot.discs(), false); double middle = pot.height() * 0.48; paintSpan = Math.min(2 * Math.sin(Math.PI / 8) * PotteryProfile.sample(outside, middle), pot.height() * 0.84); paintTop = middle + paintSpan / 2; - String pixels = pot.paint().pixels(); - for (int row = FacePaint.SIDE - 1; row >= 0; row--) { - int next = row + 1; - nextPaintRow[row] = next < FacePaint.SIDE && pixels.regionMatches(row * 16, pixels, next * 16, 16) - ? nextPaintRow[next] : next; - } + if (tile == null) findMatchingRows(pot.paint().pixels()); surface(outside, true); surface(PotteryProfile.profile(pot.discs(), true), false); PotteryDisc lip = pot.discs().get(0); @@ -61,6 +74,14 @@ public PaintedVessel(Pottery pot, Faces faces) { ring(0, foot.radius(), foot.innerRadius(), false); } + private void findMatchingRows(String pixels) { + for (int row = FacePaint.SIDE - 1; row >= 0; row--) { + int next = row + 1; + nextPaintRow[row] = next < FacePaint.SIDE && pixels.regionMatches(row * 16, pixels, next * 16, 16) + ? nextPaintRow[next] : next; + } + } + private void surface(List outline, boolean outside) { for (int i = 1; i < outline.size(); i++) { PotteryProfile.Station low = outline.get(i - 1); @@ -103,15 +124,34 @@ private Vertex vertex(int side, double radius, double y, double u, double v) { } private Vertex paintVertex(int side, double radius, double y, int column) { - double t = column / 16.0; + return paintVertex(side, radius, y, column, 8, 8); + } + + private Vertex tileVertex(int side, double radius, double y, int column) { + double u = tile.u + tile.size * column / FacePaint.SIDE; + double v = tile.v + tile.size * (paintTop - y) / paintSpan; + return paintVertex(side, radius, y, column, u, v); + } + + private Vertex paintVertex(int side, double radius, double y, int column, double u, double v) { + double t = column / (double) FacePaint.SIDE; double x = X[side + 1] + (X[side] - X[side + 1]) * t; double z = Z[side + 1] + (Z[side] - Z[side + 1]) * t; - return new Vertex(0.5 + x * radius * 1.003, y / UNITS, 0.5 + z * radius * 1.003, 8, 8); + return new Vertex(0.5 + x * radius * 1.003, y / UNITS, 0.5 + z * radius * 1.003, u, v); } private void paint(PotteryProfile.Station low, PotteryProfile.Station high, int side) { if (paintSpan <= 0 || high.y() <= paintTop - paintSpan || low.y() >= paintTop) return; double slope = (high.radius() - low.radius()) / (high.y() - low.y()); + if (tile != null) { + double top = Math.min(high.y(), paintTop); + double bottom = Math.max(low.y(), paintTop - paintSpan); + double r0 = low.radius() + (bottom - low.y()) * slope; + double r1 = low.radius() + (top - low.y()) * slope; + faces.quad(tileVertex(side, r0, bottom, 0), tileVertex(side, r0, bottom, 16), + tileVertex(side, r1, top, 16), tileVertex(side, r1, top, 0), PAINT_TEXTURE); + return; + } for (int row = 0; row < FacePaint.SIDE;) { int end = nextPaintRow[row]; double top = Math.min(high.y(), paintTop - row * paintSpan / 16); diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/VesselQuadPacker.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/VesselQuadPacker.java index dcb5bb4..2f2acf8 100644 --- a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/VesselQuadPacker.java +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/VesselQuadPacker.java @@ -14,6 +14,9 @@ protected VesselQuadPacker(S clay, S inks, int stride) { this.stride = stride; } + /** Used by adapters that provide texture tiles for whole paint designs. */ + protected S paintSheet() { return inks; } + protected abstract float u(S sprite, float pixels); protected abstract float v(S sprite, float pixels); protected abstract Q quad(int[] data, S sprite, float nx, float ny, float nz); @@ -26,6 +29,7 @@ protected VesselQuadPacker(S clay, S inks, int stride) { float length = (float) Math.sqrt(nx * nx + ny * ny + nz * nz); int normal = length == 0 ? 0 : pack(nx / length) | pack(ny / length) << 8 | pack(nz / length) << 16; S sprite = pigment == PaintedVessel.CLAY ? clay : inks; + if (pigment == PaintedVessel.PAINT_TEXTURE) sprite = paintSheet(); int[] data = new int[stride * 4]; write(data, 0, a, sprite, normal, pigment); write(data, stride, b, sprite, normal, pigment); diff --git a/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java b/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java index f7f03b3..583c4c1 100644 --- a/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java +++ b/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java @@ -32,4 +32,21 @@ private static final class FaceCounter extends BakedVessels { List quads = new FaceCounter().model(cylinder.withPaint(FacePaint.read(new String(pixels)))); assertEquals(8, quads.stream().filter(ink -> ink == 2).count()); } + + @Test public void texturedPaintUsesOneQuadPerSideOnAStraightWallAndKeepsTheDesignUpright() { + Pottery cylinder = new Pottery(Arrays.asList(new PotteryDisc(12, 4, 3), new PotteryDisc(1, 4))); + int[] painted = {0}; + PaintedVessel.Faces inspect = (a, b, c, d, ink) -> { + if (ink == PaintedVessel.CLAY) return; + assertEquals(PaintedVessel.PAINT_TEXTURE, ink); + assertEquals(2, a.u, 0.0001); + assertEquals(3, b.u, 0.0001); + assertEquals(6, a.v, 0.0001); + assertEquals(5, d.v, 0.0001); + assertTrue(a.y < d.y); + painted[0]++; + }; + new PaintedVessel(cylinder.withPaint(PaintedVessel.SAMPLE.paint()), inspect, new PaintedVessel.PaintTile(2, 5, 1)); + assertEquals(8, painted[0]); + } } diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PaintSheet.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PaintSheet.java new file mode 100644 index 0000000..48db500 --- /dev/null +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PaintSheet.java @@ -0,0 +1,98 @@ +package net.modcrafters.minecraft.primalpottery.forge.client; + +import com.mojang.blaze3d.platform.NativeImage; +import java.util.ArrayDeque; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.client.renderer.texture.MipmapGenerator; +import net.minecraft.client.renderer.texture.SpriteContents; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.metadata.animation.AnimationMetadataSection; +import net.minecraft.client.resources.metadata.animation.FrameSize; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.Resource; +import net.minecraftforge.client.textures.ForgeTextureMetadata; +import net.minecraftforge.client.textures.ITextureAtlasSpriteLoader; +import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel.PaintTile; + +/** Stable tiles in the ordinary block atlas. Compiled chunks can keep their UVs until the next resource reload. */ +final class PaintSheet extends TextureAtlasSprite { + private static final int SIDE = FacePaint.SIDE; + private static final int SHEET_SIZE = 256; + private static final int COLUMNS = SHEET_SIZE / SIDE; + private final Map tiles = new HashMap<>(); + private final ArrayDeque pending = new ArrayDeque<>(); + private final int mipLevels; + + private record Upload(FacePaint paint, int x, int y, TextureAtlasSprite palette) {} + + private PaintSheet(ResourceLocation atlas, SpriteContents contents, int width, int height, int x, int y, int mipLevels) { + super(atlas, contents, width, height, x, y); + this.mipLevels = mipLevels; + } + + /** Chunk workers reserve tiles. Once full, new designs use the existing palette geometry. */ + synchronized PaintTile reserve(FacePaint paint, TextureAtlasSprite palette) { + if (FacePaint.EMPTY.equals(paint)) return null; + PaintTile cached = tiles.get(paint); + if (cached != null) return cached; + if (tiles.size() == COLUMNS * COLUMNS || contents().width() != SHEET_SIZE || contents().height() != SHEET_SIZE + || (SIDE >> mipLevels) == 0) return null; + int x = tiles.size() % COLUMNS; + int y = tiles.size() / COLUMNS; + double span = 16.0 / COLUMNS; + PaintTile tile = new PaintTile(x * span, y * span, span); + tiles.put(paint, tile); + pending.add(new Upload(paint, x * SIDE, y * SIDE, palette)); + return tile; + } + + private synchronized Upload nextUpload() { return pending.poll(); } + + @Override public Ticker createTicker() { + // Minecraft binds the correct atlas before ticking its sprites and replaces the ticker on reload. + return new Ticker() { + @Override public void tickAndUpload() { + for (Upload next = nextUpload(); next != null; next = nextUpload()) upload(next); + } + + @Override public void close() {} + }; + } + + private void upload(Upload slot) { + NativeImage pixels = new NativeImage(SIDE, SIDE, true); + NativeImage[] levels = {pixels}; + try { + TextureAtlasSprite palette = slot.palette(); + for (int i = 0; i < FacePaint.CELLS; i++) { + int ink = slot.paint().color(i); + if (ink == FacePaint.ERASE) continue; + int x = (2 * (ink % 8) + 1) * palette.contents().width() / 16; + int y = (2 * (ink / 8) + 1) * palette.contents().height() / 8; + pixels.setPixelRGBA(i % SIDE, i / SIDE, palette.getPixelRGBA(0, x, y)); + } + levels = MipmapGenerator.generateMipLevels(levels, mipLevels); + for (int i = 0; i < levels.length; i++) { + NativeImage level = levels[i]; + level.upload(i, (getX() + slot.x()) >> i, (getY() + slot.y()) >> i, + 0, 0, level.getWidth(), level.getHeight(), mipLevels > 0, false); + } + } finally { + for (NativeImage level : levels) level.close(); + } + } + + static final class Loader implements ITextureAtlasSpriteLoader { + @Override public SpriteContents loadContents(ResourceLocation name, Resource resource, FrameSize size, NativeImage image, + AnimationMetadataSection animation, ForgeTextureMetadata metadata) { + return new SpriteContents(name, size, image, animation, metadata); + } + + @Override public TextureAtlasSprite makeSprite(ResourceLocation atlas, SpriteContents contents, int width, int height, + int x, int y, int mipLevels) { + return new PaintSheet(atlas, contents, width, height, x, y, mipLevels); + } + } +} diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryModel.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryModel.java index dfe123a..b9edbd7 100644 --- a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryModel.java +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryModel.java @@ -16,6 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelEvent; +import net.minecraftforge.client.event.RegisterTextureAtlasSpriteLoadersEvent; import net.minecraftforge.client.model.BakedModelWrapper; import net.minecraftforge.client.model.data.ModelData; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -27,6 +28,7 @@ @Mod.EventBusSubscriber(modid = "primalpottery", bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public final class PotteryModel extends BakedModelWrapper { private static final ResourceLocation INKS = new ResourceLocation("primalpottery", "block/pottery_inks"); + private static final ResourceLocation PAINT_SHEET = new ResourceLocation("primalpottery", "block/paint_sheet"); private final PotteryQuads bakery; private final List item; private final ItemOverrides overrides = new ItemOverrides() { @@ -41,13 +43,21 @@ private PotteryModel(BakedModel base, PotteryQuads bakery, List item) this.item = item; } - @SubscribeEvent public static void register(ModelEvent.RegisterAdditional event) { event.register(INKS); } + @SubscribeEvent public static void register(ModelEvent.RegisterAdditional event) { + event.register(INKS); + event.register(PAINT_SHEET); + } + + @SubscribeEvent public static void registerPaintSheet(RegisterTextureAtlasSpriteLoadersEvent event) { + event.register("paint_sheet", new PaintSheet.Loader()); + } @SubscribeEvent public static void bake(ModelEvent.ModifyBakingResult event) { var inks = event.getModels().get(INKS).getParticleIcon(); + var sheet = event.getModels().get(PAINT_SHEET).getParticleIcon(); event.getModels().replaceAll((key, base) -> { if (!key.getNamespace().equals("primalpottery") || !key.getPath().equals("pottery")) return base; - var bakery = new PotteryQuads(base.getParticleIcon(), inks); + var bakery = new PotteryQuads(base.getParticleIcon(), inks, sheet); return new PotteryModel(base, bakery, bakery.model(PaintedVessel.SAMPLE)); }); } diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java index fd951a4..c726616 100644 --- a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java @@ -3,13 +3,28 @@ import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Direction; +import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel.PaintTile; import net.modcrafters.minecraft.primalpottery.pottery.VesselQuadPacker; final class PotteryQuads extends VesselQuadPacker { - PotteryQuads(TextureAtlasSprite clay, TextureAtlasSprite inks) { + private final PaintSheet sheet; + private final TextureAtlasSprite palette; + + PotteryQuads(TextureAtlasSprite clay, TextureAtlasSprite inks, TextureAtlasSprite sheet) { super(clay, inks, 8); + // A resource pack can animate the ink palette. Its original sprite keeps that animation live. + boolean staticPalette = inks.contents().getUniqueFrames().limit(2).count() == 1; + this.sheet = staticPalette && sheet instanceof PaintSheet custom ? custom : null; + this.palette = inks; + } + + @Override protected PaintTile paintTile(FacePaint paint) { + return sheet == null ? null : sheet.reserve(paint, palette); } + @Override protected TextureAtlasSprite paintSheet() { return sheet; } + @Override protected float u(TextureAtlasSprite sprite, float pixels) { return sprite.getU(pixels); } @Override protected float v(TextureAtlasSprite sprite, float pixels) { return sprite.getV(pixels); } diff --git a/forge/src/main/resources/assets/primalpottery/models/block/paint_sheet.json b/forge/src/main/resources/assets/primalpottery/models/block/paint_sheet.json new file mode 100644 index 0000000..90c9149 --- /dev/null +++ b/forge/src/main/resources/assets/primalpottery/models/block/paint_sheet.json @@ -0,0 +1 @@ +{"textures":{"particle":"primalpottery:block/paint_sheet"}} diff --git a/forge/src/main/resources/assets/primalpottery/models/block/pottery.json b/forge/src/main/resources/assets/primalpottery/models/block/pottery.json index acb02a0..cc9338c 100644 --- a/forge/src/main/resources/assets/primalpottery/models/block/pottery.json +++ b/forge/src/main/resources/assets/primalpottery/models/block/pottery.json @@ -1,4 +1,5 @@ { + "render_type": "minecraft:cutout_mipped", "parent": "block/block", "textures": {"particle": "primalpottery:block/fired_clay"}, "display": { diff --git a/forge/src/main/resources/assets/primalpottery/textures/block/paint_sheet.png b/forge/src/main/resources/assets/primalpottery/textures/block/paint_sheet.png new file mode 100644 index 0000000000000000000000000000000000000000..69bfa68234dfdd05aa5dd27fc878caa2a4727afa GIT binary patch literal 334 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$2RR)5S5Q;?~=Ph9J2^3%>fl g&E{ADWR74^!OUpGz<5K`nFSOGp00i_>zopr07nTD%>V!Z literal 0 HcmV?d00001 diff --git a/forge/src/main/resources/assets/primalpottery/textures/block/paint_sheet.png.mcmeta b/forge/src/main/resources/assets/primalpottery/textures/block/paint_sheet.png.mcmeta new file mode 100644 index 0000000..6029d7a --- /dev/null +++ b/forge/src/main/resources/assets/primalpottery/textures/block/paint_sheet.png.mcmeta @@ -0,0 +1 @@ +{"forge":{"loader":"primalpottery:paint_sheet"}} diff --git a/legacy/forge-1.12.2/build.gradle b/legacy/forge-1.12.2/build.gradle index 4418c3e..f393eed 100644 --- a/legacy/forge-1.12.2/build.gradle +++ b/legacy/forge-1.12.2/build.gradle @@ -52,6 +52,7 @@ processResources { filesMatching('mcmod.info') { expand(version: project.version) } from('../../src/main/resources') { include 'assets/primalpottery/textures/block/fired_clay.png' } from('../../forge/src/main/resources') { - include 'assets/primalpottery/models/**', 'assets/primalpottery/textures/block/pottery_inks.png' + include 'assets/primalpottery/models/block/pottery.json', 'assets/primalpottery/models/item/pottery.json', + 'assets/primalpottery/textures/block/pottery_inks.png' } } From deefed623b8b8d192693663235c4dab855cee167 Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 19:22:14 +0200 Subject: [PATCH 07/11] Share paint tiles across both Forge targets and skip clay hidden by opaque paint Co-authored-by: Face of Cat --- .../1.12.2/potterycheck/DisplayCheck.java | 64 ++++++++++++++----- .../1.20.1/potterycheck/DisplayCheck.java | 21 +++--- .github/forge-display-check/check.init.gradle | 6 +- .../common/potterycheck/FrameReport.java | 24 +++++++ .../primalpottery/pottery/FacePaint.java | 1 + .../pottery/PaintSheetTiles.java | 61 ++++++++++++++++++ .../primalpottery/pottery/PaintedVessel.java | 28 ++++---- .../pottery/PaintSheetTilesTest.java | 43 +++++++++++++ .../pottery/PaintedVesselTest.java | 2 +- .../forge/client/PaintSheet.java | 46 +++---------- .../forge/client/PotteryQuads.java | 10 +-- legacy/forge-1.12.2/build.gradle | 2 +- .../primalpottery/legacy/PaintedPotBlock.java | 2 + .../legacy/client/PaintSheet.java | 31 +++++++++ .../legacy/client/PotteryModel.java | 9 ++- .../legacy/client/PotteryQuads.java | 18 +++++- 16 files changed, 286 insertions(+), 82 deletions(-) create mode 100644 .github/forge-display-check/common/potterycheck/FrameReport.java create mode 100644 core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintSheetTiles.java create mode 100644 core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintSheetTilesTest.java create mode 100644 legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PaintSheet.java diff --git a/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java b/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java index 4baf98f..bb0cefe 100644 --- a/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java +++ b/.github/forge-display-check/1.12.2/potterycheck/DisplayCheck.java @@ -3,9 +3,11 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Locale; +import java.util.Arrays; +import java.util.List; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.tileentity.TileEntity; import net.minecraft.client.Minecraft; import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; import net.modcrafters.minecraft.primalpottery.pottery.Pottery; @@ -27,15 +29,16 @@ import net.modcrafters.minecraft.primalpottery.legacy.PrimalPotteryForge; @Mod.EventBusSubscriber(modid = "primalpottery", value = Side.CLIENT) -// Runs only in the disposable hosted world, with Mesa software rendering. +// Runs only in the disposable display-check world. public final class DisplayCheck { + private static final Pottery CHECKER = checkerboardJug(); private static boolean opening; private static boolean placed; private static int ticks; private static long firstFrame; private static long previousFrame; private static long referenceStarted; - private static final ArrayList frames = new ArrayList<>(); + private static final FrameReport frames = new FrameReport(); private static final String WORLD = "painted-pot-display"; @SubscribeEvent public static void tick(TickEvent.ClientTickEvent event) { @@ -66,14 +69,17 @@ public final class DisplayCheck { } } + private static Pottery checkerboardJug() { + StringBuilder pixels = new StringBuilder(256); + for (int y = 0; y < 16; y++) for (int x = 0; x < 16; x++) pixels.append((x + y) % 2 == 0 ? 'A' : 'O'); + return Pottery.jug().withPaint(FacePaint.read(pixels.toString())); + } + private static void install(WorldServer level) { BlockPos platform = new BlockPos(0, 84, -19); level.setBlockState(platform, Blocks.STONE.getDefaultState()); - StringBuilder pixels = new StringBuilder(256); - for (int y = 0; y < 16; y++) for (int x = 0; x < 16; x++) pixels.append((x + y) % 2 == 0 ? 'A' : 'O'); - Pottery model = Pottery.jug().withPaint(FacePaint.read(pixels.toString())); ItemStack stack = new ItemStack(PrimalPotteryForge.POT); - stack.setTagInfo("pottery", ForgePotteryTags.save(model)); + stack.setTagInfo("pottery", ForgePotteryTags.save(CHECKER)); for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { BlockPos pos = new BlockPos(x, y, 0); level.setBlockState(pos, PrimalPotteryForge.POT.getDefaultState()); @@ -96,23 +102,43 @@ private static void install(WorldServer level) { long now = System.nanoTime(); if (firstFrame == 0) { for (int x = -10; x < 10; x++) for (int y = 80; y < 90; y++) { - if (!(mc.world.getTileEntity(new BlockPos(x,y,0)) instanceof PaintedPotEntity)) return; + TileEntity entity = mc.world.getTileEntity(new BlockPos(x, y, 0)); + if (!(entity instanceof PaintedPotEntity) || !((PaintedPotEntity) entity).profile().paint().equals(CHECKER.paint())) return; + } + if (FrameReport.UNCAPPED) { + mc.gameSettings.enableVsync = false; + org.lwjgl.opengl.Display.setVSyncEnabled(false); + mc.gameSettings.limitFramerate = (int) net.minecraft.client.settings.GameSettings.Options.FRAMERATE_LIMIT.getValueMax(); } firstFrame = previousFrame = now; return; } - if (now - firstFrame > 5_000_000_000L) frames.add(now - previousFrame); + if (now - firstFrame > 5_000_000_000L) frames.sample(now - previousFrame); previousFrame = now; if (now - firstFrame < 17_000_000_000L) return; - Collections.sort(frames); - String report = String.format(Locale.ROOT, "200 checkerboard pots, %d frames, p50 %.2f ms, p95 %.2f ms (30 FPS cap)", - frames.size(), frames.get(frames.size() / 2) / 1e6, frames.get(frames.size() * 95 / 100) / 1e6); + if (FrameReport.UNCAPPED) { + mc.gameSettings.limitFramerate = 30; + mc.gameSettings.enableVsync = true; + org.lwjgl.opengl.Display.setVSyncEnabled(true); + } + String report = frames.summary(org.lwjgl.opengl.GL11.glGetString(org.lwjgl.opengl.GL11.GL_RENDERER)); screenshot(mc, "pots.png"); - Files.write(Paths.get("display-check.txt"), Collections.singletonList(report)); - referenceStarted = now; + Files.write(Paths.get("display-check.txt"), Arrays.asList(report, geometryReport(mc))); + mc.refreshResources(); + referenceStarted = System.nanoTime(); showReference(mc); } + private static String geometryReport(Minecraft mc) { + BlockPos pos = new BlockPos(0, 85, 0); + IBlockState state = mc.world.getBlockState(pos); + IBlockState extended = state.getBlock().getExtendedState(state, mc.world, pos); + List quads = mc.getBlockRendererDispatcher().getModelForState(state).getQuads(extended, null, 0); + long overlays = quads.stream().filter(q -> q.getSprite().getIconName().equals("primalpottery:block/paint_sheet")).count(); + if (overlays == 0) throw new AssertionError("Checkerboard used fallback geometry"); + return quads.size() * 200 + " terrain quads for 200 pots (" + overlays + " paint quads per pot)"; + } + private static void showReference(Minecraft mc) { mc.gameSettings.hideGUI = false; net.minecraft.server.MinecraftServer server = mc.getIntegratedServer(); @@ -121,6 +147,12 @@ private static void showReference(Minecraft mc) { level.setBlockState(new BlockPos(40, 79, -2), Blocks.STONE.getDefaultState()); level.setBlockState(new BlockPos(40, 80, 0), Blocks.STONE.getDefaultState()); level.setBlockState(new BlockPos(40, 81, 0), PrimalPotteryForge.POT.getDefaultState()); + BlockPos neighbor = new BlockPos(39, 81, 0); + level.setBlockState(neighbor.down(), Blocks.STONE.getDefaultState()); + level.setBlockState(neighbor, PrimalPotteryForge.POT.getDefaultState()); + ItemStack checker = new ItemStack(PrimalPotteryForge.POT); + checker.setTagInfo("pottery", ForgePotteryTags.save(CHECKER)); + PrimalPotteryForge.POT.onBlockPlacedBy(level, neighbor, level.getBlockState(neighbor), null, checker); net.minecraft.entity.player.EntityPlayerMP player = server.getPlayerList().getPlayers().get(0); player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(PrimalPotteryForge.POT)); player.inventoryContainer.detectAndSendChanges(); diff --git a/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java b/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java index 6000767..1f3c73f 100644 --- a/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java +++ b/.github/forge-display-check/1.20.1/potterycheck/DisplayCheck.java @@ -3,10 +3,7 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.Locale; import java.util.concurrent.CompletableFuture; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.util.RandomSource; @@ -35,7 +32,7 @@ import net.minecraftforge.registries.ForgeRegistries; @Mod.EventBusSubscriber(modid = "primalpottery", value = Dist.CLIENT) -// Runs only in the disposable hosted world, with Mesa software rendering. +// Runs only in the disposable display-check world. public final class DisplayCheck { private static final Pottery CHECKER = checkerboardJug(); private static boolean opening; @@ -45,7 +42,7 @@ public final class DisplayCheck { private static long previousFrame; private static long referenceStarted; private static CompletableFuture reload; - private static final ArrayList frames = new ArrayList<>(); + private static final FrameReport frames = new FrameReport(); private static final String WORLD = "painted-pot-display"; @SubscribeEvent public static void tick(TickEvent.ClientTickEvent event) { @@ -114,18 +111,24 @@ private static void install(ServerLevel level) { Pottery pot = entity.getModelData().get(PaintedPotEntity.PROFILE); if (pot == null || !pot.paint().equals(CHECKER.paint())) return; } + if (FrameReport.UNCAPPED) { + mc.options.enableVsync().set(false); + mc.options.framerateLimit().set(260); + } firstFrame = previousFrame = now; return; } if (now - firstFrame > 5_000_000_000L) { TerrainTiming.measuring = true; - frames.add(now - previousFrame); + frames.sample(now - previousFrame); } previousFrame = now; if (now - firstFrame < 17_000_000_000L) return; - Collections.sort(frames); - String report = String.format(Locale.ROOT, "200 checkerboard pots, %d frames, p50 %.2f ms, p95 %.2f ms (30 FPS cap)", - frames.size(), frames.get(frames.size() / 2) / 1e6, frames.get(frames.size() * 95 / 100) / 1e6); + if (FrameReport.UNCAPPED) { + mc.options.framerateLimit().set(30); + mc.options.enableVsync().set(true); + } + String report = frames.summary(org.lwjgl.opengl.GL11.glGetString(org.lwjgl.opengl.GL11.GL_RENDERER)); screenshot(mc, "pots.png"); Files.write(Paths.get("display-check.txt"), List.of(report, TerrainTiming.report(), geometryReport(mc))); verifyFullSheet(mc); diff --git a/.github/forge-display-check/check.init.gradle b/.github/forge-display-check/check.init.gradle index 6fdad3c..c9c1823 100644 --- a/.github/forge-display-check/check.init.gradle +++ b/.github/forge-display-check/check.init.gradle @@ -1,15 +1,19 @@ -// Only used by the hosted display check. The production jars are built in a separate Gradle invocation. +// Display-check sources are injected only for test runs. Pass -Puncapped to time hardware beyond the CI frame limit. gradle.beforeProject { p -> if (p.path == ':forge') p.afterEvaluate { p.sourceSets.main.java.srcDir(p.rootProject.file('.github/forge-display-check/1.20.1')) + p.sourceSets.main.java.srcDir(p.rootProject.file('.github/forge-display-check/common')) p.legacyForge.runs.client { + systemProperty 'potterycheck.uncapped', p.hasProperty('uncapped').toString() gameDirectory = p.rootProject.file('build/display-check') programArguments.addAll '--width', '854', '--height', '480' } } if (p == p.rootProject && p.name == 'primalpottery-forge-1.12.2') p.afterEvaluate { p.sourceSets.main.java.srcDir(p.file('../../.github/forge-display-check/1.12.2')) + p.sourceSets.main.java.srcDir(p.file('../../.github/forge-display-check/common')) p.minecraft.runs.client { + property 'potterycheck.uncapped', p.hasProperty('uncapped').toString() workingDirectory p.file('../../build/display-check') args '--width','854','--height','480' mods { primalpottery { source p.sourceSets.main } } diff --git a/.github/forge-display-check/common/potterycheck/FrameReport.java b/.github/forge-display-check/common/potterycheck/FrameReport.java new file mode 100644 index 0000000..845ea4e --- /dev/null +++ b/.github/forge-display-check/common/potterycheck/FrameReport.java @@ -0,0 +1,24 @@ +package potterycheck; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Locale; + +final class FrameReport { + static final boolean UNCAPPED = Boolean.getBoolean("potterycheck.uncapped"); + private final List frames = new ArrayList<>(); + private long elapsed; + + void sample(long nanos) { + frames.add(nanos); + elapsed += nanos; + } + + String summary(String renderer) { + Collections.sort(frames); + return String.format(Locale.ROOT, "%s; 200 checkerboard pots, %d frames, %.1f average FPS, p50 %.3f ms, p95 %.3f ms (%s)", + renderer, frames.size(), frames.size() * 1e9 / elapsed, frames.get(frames.size() / 2) / 1e6, + frames.get(frames.size() * 95 / 100) / 1e6, UNCAPPED ? "unlimited, VSync off" : "30 FPS cap"); + } +} diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java index 6d2ecf3..a80a6db 100644 --- a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/FacePaint.java @@ -29,6 +29,7 @@ public boolean equals(Object obj) { public static final FacePaint EMPTY = new FacePaint(blankPixels()); private static final String FLOWER_INKS = "ipygtsl"; private static final int[] FLOWER_RGB = {0xFFF1CA, 0xEAC89A, 0xF4C04D, 0xCA8338, 0x467D68, 0x62927A, 0x83A979}; + public static final int INK_COUNT = COLORS + FLOWER_RGB.length; private static String blankPixels() { char[] pixels = new char[CELLS]; diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintSheetTiles.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintSheetTiles.java new file mode 100644 index 0000000..125f907 --- /dev/null +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintSheetTiles.java @@ -0,0 +1,61 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import java.util.ArrayDeque; +import java.util.HashMap; +import java.util.Map; +import java.util.function.IntBinaryOperator; + +/** One allocation table per stitched sprite. A chunk's UVs remain valid until the next atlas reload. */ +public final class PaintSheetTiles { + public static final int SIZE = 256; + private static final int SIDE = FacePaint.SIDE; + private static final int COLUMNS = SIZE / SIDE; + private final Map tiles = new HashMap<>(); + private final ArrayDeque pending = new ArrayDeque<>(); + + /** Sample the active resource pack once. Both native pixel formats keep alpha in the high byte. */ + public static int[] palette(int width, int height, IntBinaryOperator pixel) { + int[] colors = new int[FacePaint.INK_COUNT]; + for (int ink = 0; ink < colors.length; ink++) { + int x = (2 * (ink % 8) + 1) * width / 16; + int y = (2 * (ink / 8) + 1) * height / 8; + colors[ink] = pixel.applyAsInt(x, y); + } + return colors; + } + + /** Chunk workers reserve tiles. The native texture ticker consumes each upload once. */ + public synchronized PaintedVessel.PaintTile reserve(FacePaint paint, int[] colors) { + if (FacePaint.EMPTY.equals(paint)) return null; + PaintedVessel.PaintTile cached = tiles.get(paint); + if (cached != null) return cached; + if (tiles.size() == COLUMNS * COLUMNS) return null; + int x = tiles.size() % COLUMNS; + int y = tiles.size() / COLUMNS; + int[] pixels = new int[FacePaint.CELLS]; + boolean opaque = true; + for (int i = 0; i < pixels.length; i++) { + int ink = paint.color(i); + pixels[i] = ink == FacePaint.ERASE ? 0 : colors[ink]; + opaque &= pixels[i] >>> 24 == 255; + } + double span = 16.0 / COLUMNS; + PaintedVessel.PaintTile tile = new PaintedVessel.PaintTile(x * span, y * span, span, opaque); + tiles.put(paint, tile); + pending.add(new Upload(x * SIDE, y * SIDE, pixels)); + return tile; + } + + public synchronized Upload poll() { return pending.poll(); } + + public static final class Upload { + public final int x, y; + public final int[] pixels; + + private Upload(int x, int y, int[] pixels) { + this.x = x; + this.y = y; + this.pixels = pixels; + } + } +} diff --git a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java index 075194a..0255bfe 100644 --- a/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java +++ b/core/src/main/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVessel.java @@ -39,7 +39,10 @@ public static final class Vertex { public static final class PaintTile { private final double u, v, size; - public PaintTile(double u, double v, double size) { + private final boolean opaque; + + public PaintTile(double u, double v, double size, boolean opaque) { + this.opaque = opaque; this.u = u; this.v = v; this.size = size; @@ -92,21 +95,24 @@ private void surface(List outline, boolean outside) { continue; } if (low.radius() == 0 && high.radius() == 0) continue; + boolean covered = outside && tile != null && tile.opaque && paintSpan > 0 + && low.y() >= paintTop - paintSpan && high.y() <= paintTop; for (int side = 0; side < SIDES; side++) { - Vertex a = vertex(side, low.radius(), low.y(), 0, 16); - Vertex b = vertex(side + 1, low.radius(), low.y(), 16, 16); - Vertex c = vertex(side + 1, high.radius(), high.y(), 16, 0); - Vertex d = vertex(side, high.radius(), high.y(), 0, 0); - if (outside) { - faces.quad(b, a, d, c, CLAY); - if (!FacePaint.EMPTY.equals(pot.paint())) paint(low, high, side); - } else { - faces.quad(a, b, c, d, CLAY); - } + if (!covered) clayWall(low, high, side, outside); + if (outside && !FacePaint.EMPTY.equals(pot.paint())) paint(low, high, side); } } } + private void clayWall(PotteryProfile.Station low, PotteryProfile.Station high, int side, boolean outside) { + Vertex a = vertex(side, low.radius(), low.y(), 0, 16); + Vertex b = vertex(side + 1, low.radius(), low.y(), 16, 16); + Vertex c = vertex(side + 1, high.radius(), high.y(), 16, 0); + Vertex d = vertex(side, high.radius(), high.y(), 0, 0); + if (outside) faces.quad(b, a, d, c, CLAY); + else faces.quad(a, b, c, d, CLAY); + } + private void ring(double y, double outer, double inner, boolean up) { if (outer <= inner) return; for (int side = 0; side < SIDES; side++) { diff --git a/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintSheetTilesTest.java b/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintSheetTilesTest.java new file mode 100644 index 0000000..5770bfb --- /dev/null +++ b/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintSheetTilesTest.java @@ -0,0 +1,43 @@ +package net.modcrafters.minecraft.primalpottery.pottery; + +import java.util.Arrays; +import org.junit.Test; +import static org.junit.Assert.*; + +public class PaintSheetTilesTest { + @Test public void tileKeepsItsPixelsAndCoordinatesWhenTheSheetFills() { + PaintSheetTiles sheet = new PaintSheetTiles(); + int[] palette = PaintSheetTiles.palette(128, 128, (x, y) -> 0xff000000 | x << 8 | y); + FacePaint first = FacePaint.EMPTY.with(0, 0); + PaintedVessel.PaintTile original = sheet.reserve(first, palette); + PaintSheetTiles.Upload upload = sheet.poll(); + assertEquals(0, upload.x); + assertEquals(0, upload.y); + assertEquals(0xff000810, upload.pixels[0]); + assertEquals(0, upload.pixels[1]); + for (int i = 1; i < FacePaint.CELLS; i++) { + assertNotNull(sheet.reserve(FacePaint.EMPTY.with(i, 0), palette)); + } + assertNull(sheet.reserve(FacePaint.EMPTY.with(0, 1), palette)); + assertSame(original, sheet.reserve(first, palette)); + } + + @Test public void eraseAndTranslucentPaletteEntriesKeepTheUnderlyingClay() { + char[] pixels = new char[FacePaint.CELLS]; + Arrays.fill(pixels, 'A'); + FacePaint opaque = FacePaint.read(new String(pixels)); + int unpainted = clayFaces(FacePaint.EMPTY, 0xffffffff); + assertTrue(clayFaces(opaque, 0xffffffff) < unpainted); + assertEquals(unpainted, clayFaces(opaque.with(0, FacePaint.ERASE), 0xffffffff)); + assertEquals(unpainted, clayFaces(opaque, 0x7fffffff)); + } + + private static int clayFaces(FacePaint paint, int color) { + PaintedVessel.PaintTile tile = new PaintSheetTiles().reserve(paint, new int[]{color}); + int[] count = {0}; + new PaintedVessel(Pottery.jug().withPaint(paint), (a, b, c, d, ink) -> { + if (ink == PaintedVessel.CLAY) count[0]++; + }, tile); + return count[0]; + } +} diff --git a/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java b/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java index 583c4c1..8ba3240 100644 --- a/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java +++ b/core/src/test/java/net/modcrafters/minecraft/primalpottery/pottery/PaintedVesselTest.java @@ -46,7 +46,7 @@ private static final class FaceCounter extends BakedVessels { assertTrue(a.y < d.y); painted[0]++; }; - new PaintedVessel(cylinder.withPaint(PaintedVessel.SAMPLE.paint()), inspect, new PaintedVessel.PaintTile(2, 5, 1)); + new PaintedVessel(cylinder.withPaint(PaintedVessel.SAMPLE.paint()), inspect, new PaintedVessel.PaintTile(2, 5, 1, false)); assertEquals(8, painted[0]); } } diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PaintSheet.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PaintSheet.java index 48db500..8aff19c 100644 --- a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PaintSheet.java +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PaintSheet.java @@ -1,9 +1,6 @@ package net.modcrafters.minecraft.primalpottery.forge.client; import com.mojang.blaze3d.platform.NativeImage; -import java.util.ArrayDeque; -import java.util.HashMap; -import java.util.Map; import net.minecraft.client.renderer.texture.MipmapGenerator; import net.minecraft.client.renderer.texture.SpriteContents; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -14,69 +11,46 @@ import net.minecraftforge.client.textures.ForgeTextureMetadata; import net.minecraftforge.client.textures.ITextureAtlasSpriteLoader; import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; -import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel.PaintTile; +import net.modcrafters.minecraft.primalpottery.pottery.PaintSheetTiles; /** Stable tiles in the ordinary block atlas. Compiled chunks can keep their UVs until the next resource reload. */ final class PaintSheet extends TextureAtlasSprite { private static final int SIDE = FacePaint.SIDE; - private static final int SHEET_SIZE = 256; - private static final int COLUMNS = SHEET_SIZE / SIDE; - private final Map tiles = new HashMap<>(); - private final ArrayDeque pending = new ArrayDeque<>(); + final PaintSheetTiles tiles = new PaintSheetTiles(); private final int mipLevels; - private record Upload(FacePaint paint, int x, int y, TextureAtlasSprite palette) {} - private PaintSheet(ResourceLocation atlas, SpriteContents contents, int width, int height, int x, int y, int mipLevels) { super(atlas, contents, width, height, x, y); this.mipLevels = mipLevels; } - /** Chunk workers reserve tiles. Once full, new designs use the existing palette geometry. */ - synchronized PaintTile reserve(FacePaint paint, TextureAtlasSprite palette) { - if (FacePaint.EMPTY.equals(paint)) return null; - PaintTile cached = tiles.get(paint); - if (cached != null) return cached; - if (tiles.size() == COLUMNS * COLUMNS || contents().width() != SHEET_SIZE || contents().height() != SHEET_SIZE - || (SIDE >> mipLevels) == 0) return null; - int x = tiles.size() % COLUMNS; - int y = tiles.size() / COLUMNS; - double span = 16.0 / COLUMNS; - PaintTile tile = new PaintTile(x * span, y * span, span); - tiles.put(paint, tile); - pending.add(new Upload(paint, x * SIDE, y * SIDE, palette)); - return tile; + boolean supportsTiles() { + return contents().width() == PaintSheetTiles.SIZE && contents().height() == PaintSheetTiles.SIZE + && (SIDE >> mipLevels) > 0; } - private synchronized Upload nextUpload() { return pending.poll(); } - @Override public Ticker createTicker() { // Minecraft binds the correct atlas before ticking its sprites and replaces the ticker on reload. return new Ticker() { @Override public void tickAndUpload() { - for (Upload next = nextUpload(); next != null; next = nextUpload()) upload(next); + for (PaintSheetTiles.Upload next = tiles.poll(); next != null; next = tiles.poll()) upload(next); } @Override public void close() {} }; } - private void upload(Upload slot) { + private void upload(PaintSheetTiles.Upload slot) { NativeImage pixels = new NativeImage(SIDE, SIDE, true); NativeImage[] levels = {pixels}; try { - TextureAtlasSprite palette = slot.palette(); - for (int i = 0; i < FacePaint.CELLS; i++) { - int ink = slot.paint().color(i); - if (ink == FacePaint.ERASE) continue; - int x = (2 * (ink % 8) + 1) * palette.contents().width() / 16; - int y = (2 * (ink / 8) + 1) * palette.contents().height() / 8; - pixels.setPixelRGBA(i % SIDE, i / SIDE, palette.getPixelRGBA(0, x, y)); + for (int i = 0; i < slot.pixels.length; i++) { + pixels.setPixelRGBA(i % SIDE, i / SIDE, slot.pixels[i]); } levels = MipmapGenerator.generateMipLevels(levels, mipLevels); for (int i = 0; i < levels.length; i++) { NativeImage level = levels[i]; - level.upload(i, (getX() + slot.x()) >> i, (getY() + slot.y()) >> i, + level.upload(i, (getX() + slot.x) >> i, (getY() + slot.y) >> i, 0, 0, level.getWidth(), level.getHeight(), mipLevels > 0, false); } } finally { diff --git a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java index c726616..3a84a82 100644 --- a/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java +++ b/forge/src/main/java/net/modcrafters/minecraft/primalpottery/forge/client/PotteryQuads.java @@ -4,23 +4,25 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.Direction; import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; +import net.modcrafters.minecraft.primalpottery.pottery.PaintSheetTiles; import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel.PaintTile; import net.modcrafters.minecraft.primalpottery.pottery.VesselQuadPacker; final class PotteryQuads extends VesselQuadPacker { private final PaintSheet sheet; - private final TextureAtlasSprite palette; + private final int[] palette; PotteryQuads(TextureAtlasSprite clay, TextureAtlasSprite inks, TextureAtlasSprite sheet) { super(clay, inks, 8); // A resource pack can animate the ink palette. Its original sprite keeps that animation live. boolean staticPalette = inks.contents().getUniqueFrames().limit(2).count() == 1; - this.sheet = staticPalette && sheet instanceof PaintSheet custom ? custom : null; - this.palette = inks; + this.sheet = staticPalette && sheet instanceof PaintSheet custom && custom.supportsTiles() ? custom : null; + this.palette = PaintSheetTiles.palette(inks.contents().width(), inks.contents().height(), + (x, y) -> inks.getPixelRGBA(0, x, y)); } @Override protected PaintTile paintTile(FacePaint paint) { - return sheet == null ? null : sheet.reserve(paint, palette); + return sheet == null ? null : sheet.tiles.reserve(paint, palette); } @Override protected TextureAtlasSprite paintSheet() { return sheet; } diff --git a/legacy/forge-1.12.2/build.gradle b/legacy/forge-1.12.2/build.gradle index f393eed..995ccf3 100644 --- a/legacy/forge-1.12.2/build.gradle +++ b/legacy/forge-1.12.2/build.gradle @@ -53,6 +53,6 @@ processResources { from('../../src/main/resources') { include 'assets/primalpottery/textures/block/fired_clay.png' } from('../../forge/src/main/resources') { include 'assets/primalpottery/models/block/pottery.json', 'assets/primalpottery/models/item/pottery.json', - 'assets/primalpottery/textures/block/pottery_inks.png' + 'assets/primalpottery/textures/block/pottery_inks.png', 'assets/primalpottery/textures/block/paint_sheet.png' } } diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotBlock.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotBlock.java index 246078c..4307999 100644 --- a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotBlock.java +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/PaintedPotBlock.java @@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -47,6 +48,7 @@ public final class PaintedPotBlock extends Block implements ITileEntityProvider return tile instanceof PaintedPotEntity ? ((IExtendedBlockState)state).withProperty(PROFILE, ((PaintedPotEntity)tile).profile()) : state; } @Override public TileEntity createNewTileEntity(World world, int metadata) { return new PaintedPotEntity(); } + @Override public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT_MIPPED; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { return BOUNDS; } diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PaintSheet.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PaintSheet.java new file mode 100644 index 0000000..a6c5408 --- /dev/null +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PaintSheet.java @@ -0,0 +1,31 @@ +package net.modcrafters.minecraft.primalpottery.legacy.client; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; +import net.modcrafters.minecraft.primalpottery.pottery.PaintSheetTiles; + +/** Forge 1.12 ticks animated sprites with the block atlas bound. Each reserved tile uploads once. */ +final class PaintSheet extends TextureAtlasSprite { + final PaintSheetTiles tiles = new PaintSheetTiles(); + + PaintSheet(String name) { super(name); } + + boolean supportsTiles() { + return getIconWidth() == PaintSheetTiles.SIZE && getIconHeight() == PaintSheetTiles.SIZE + && getFrameCount() == 1 && getFrameTextureData(0).length <= 5; + } + + @Override public boolean hasAnimationMetadata() { return true; } + + @Override public void updateAnimation() { + for (PaintSheetTiles.Upload next = tiles.poll(); next != null; next = tiles.poll()) { + int side = FacePaint.SIDE; + int levels = getFrameTextureData(0).length; + int[][] data = new int[levels][]; + data[0] = next.pixels; + int[][] mips = TextureUtil.generateMipmapData(levels - 1, side, data); + TextureUtil.uploadTextureMipmap(mips, side, side, getOriginX() + next.x, getOriginY() + next.y, false, false); + } + } +} diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryModel.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryModel.java index 314b63a..7bcf3a0 100644 --- a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryModel.java +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryModel.java @@ -36,6 +36,7 @@ @Mod.EventBusSubscriber(modid = "primalpottery", value = Side.CLIENT) public final class PotteryModel extends BakedModelWrapper { private static final ResourceLocation INKS = new ResourceLocation("primalpottery", "block/pottery_inks"); + private static final ResourceLocation PAINT_SHEET = new ResourceLocation("primalpottery", "block/paint_sheet"); private final PotteryQuads bakery; private final List item; private final ItemOverrideList overrides = new ItemOverrideList(Collections.emptyList()) { @@ -55,14 +56,18 @@ private PotteryModel(IBakedModel base, PotteryQuads bakery, List item new ModelResourceLocation(PrimalPotteryForge.ID, "inventory")); } - @SubscribeEvent public static void stitch(TextureStitchEvent.Pre event) { event.getMap().registerSprite(INKS); } + @SubscribeEvent public static void stitch(TextureStitchEvent.Pre event) { + event.getMap().registerSprite(INKS); + event.getMap().setTextureEntry(new PaintSheet(PAINT_SHEET.toString())); + } @SubscribeEvent public static void bake(ModelBakeEvent event) { TextureAtlasSprite inks = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(INKS.toString()); + TextureAtlasSprite sheet = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(PAINT_SHEET.toString()); for (String variant : new String[]{"normal", "inventory"}) { ModelResourceLocation key = new ModelResourceLocation(PrimalPotteryForge.ID, variant); IBakedModel base = event.getModelRegistry().getObject(key); - PotteryQuads bakery = new PotteryQuads(base.getParticleTexture(), inks); + PotteryQuads bakery = new PotteryQuads(base.getParticleTexture(), inks, sheet); event.getModelRegistry().putObject(key, new PotteryModel(base, bakery, bakery.model(PaintedVessel.SAMPLE))); } } diff --git a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryQuads.java b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryQuads.java index c8b370b..443d452 100644 --- a/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryQuads.java +++ b/legacy/forge-1.12.2/src/main/java/net/modcrafters/minecraft/primalpottery/legacy/client/PotteryQuads.java @@ -4,13 +4,29 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.EnumFacing; +import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; +import net.modcrafters.minecraft.primalpottery.pottery.PaintSheetTiles; +import net.modcrafters.minecraft.primalpottery.pottery.PaintedVessel.PaintTile; import net.modcrafters.minecraft.primalpottery.pottery.VesselQuadPacker; final class PotteryQuads extends VesselQuadPacker { - PotteryQuads(TextureAtlasSprite clay, TextureAtlasSprite inks) { + private final PaintSheet sheet; + private final int[] palette; + + PotteryQuads(TextureAtlasSprite clay, TextureAtlasSprite inks, TextureAtlasSprite atlasSprite) { super(clay, inks, DefaultVertexFormats.ITEM.getIntegerSize()); + PaintSheet candidate = atlasSprite instanceof PaintSheet ? (PaintSheet) atlasSprite : null; + sheet = candidate != null && candidate.supportsTiles() && !inks.hasAnimationMetadata() ? candidate : null; + palette = sheet == null ? null : PaintSheetTiles.palette(inks.getIconWidth(), inks.getIconHeight(), + (x, y) -> inks.getFrameTextureData(0)[0][y * inks.getIconWidth() + x]); + } + + @Override protected PaintTile paintTile(FacePaint paint) { + return sheet == null ? null : sheet.tiles.reserve(paint, palette); } + @Override protected TextureAtlasSprite paintSheet() { return sheet; } + @Override protected float u(TextureAtlasSprite sprite, float pixels) { return sprite.getInterpolatedU(pixels); } @Override protected float v(TextureAtlasSprite sprite, float pixels) { return sprite.getInterpolatedV(pixels); } From 2667ef4d55b212ca14885a7cc8b4ed66e05e1fa2 Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 20:04:10 +0200 Subject: [PATCH 08/11] Render item and preview paint from shared atlas tiles across modern targets Co-authored-by: Face of Cat --- .../minecraft/primalpottery/client/Mesh.java | 28 ++++++---- .../primalpottery/client/PaintAtlas.java | 11 ++++ .../primalpottery/client/PaintLayer.java | 36 +++++++++++++ .../primalpottery/client/PlatePaint.java | 30 +++-------- .../primalpottery/client/PotteryItemMesh.java | 11 +--- .../client/PotteryItemRenderer.java | 6 ++- .../primalpottery/client/PotteryPaint.java | 52 +------------------ .../primalpottery/client/PotteryPreview.java | 45 +++++++++++----- .../primalpottery/client/PotteryRenderer.java | 4 +- .../client/PotterySpecialRenderer.java | 1 + .../primalpottery/client/Sprites.java | 15 ++++-- .../primalpottery/client/MeshTest.java | 22 +++++--- 12 files changed, 139 insertions(+), 122 deletions(-) create mode 100644 src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintLayer.java diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/Mesh.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/Mesh.java index a587607..509afeb 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/Mesh.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/Mesh.java @@ -6,7 +6,6 @@ import net.minecraft.core.Direction; import net.minecraft.world.phys.Vec3; import net.modcrafters.minecraft.primalpottery.pottery.PlatterSegments; -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; @@ -57,29 +56,26 @@ public List quads() { return this.quads; } - private record FiredKey(boolean plate, double x, double y, double z, double width, List discs, FacePaint paint) {} + private record FiredKey(boolean plate, boolean platter, double x, double y, double z, double width, List discs) {} private static final LinkedHashMap firedMeshes = new LinkedHashMap<>(16, 0.75F, true); private static int cachedQuads; static Mesh firedVessel(double x, double y, double z, Pottery pottery) { - return firedVessel(x, y, z, pottery, pottery.paint(), 1); + return firedVessel(x, y, z, pottery, 1); } static Mesh placedVessel(double x, double z, Pottery pottery, double width) { - return firedVessel(x, 0, z, pottery, FacePaint.EMPTY, width); + return firedVessel(x, 0, z, pottery, 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); + /** Shared read-only clay geometry, independent of the painted design. */ + private static synchronized Mesh firedVessel(double x, double y, double z, Pottery pottery, double width) { + FiredKey key = new FiredKey(pottery.isPlate(), pottery.isPlatter(), x, y, z, width, pottery.discs()); Mesh mesh = firedMeshes.get(key); if (mesh == null) { mesh = new Mesh(); mesh.vessel(x, y, z, pottery, Texture.FIRED_CLAY); mesh.fitSprite(); - if (!FacePaint.EMPTY.equals(bakedPaint)) { - PotteryPaint.apply(mesh, x, y, z, pottery); - } if (width != 1) mesh.scaleWidth(x, z, width); firedMeshes.put(key, mesh); cachedQuads += mesh.quads().size(); @@ -90,6 +86,18 @@ private static synchronized Mesh firedVessel(double x, double y, double z, Potte return mesh; } + private Mesh paintSurface; + + /** Called on a cached fired vessel with its original placement and width. */ + synchronized Mesh paintSurface(double x, double y, double z, Pottery pottery, double width) { + if (paintSurface == null) { + paintSurface = PotteryPaint.overlay(this, x, y, z, pottery); + // Plate mapping uses the profile. Wall mapping already follows the scaled mesh. + if (pottery.isPlate() && width != 1) paintSurface.scaleWidth(x, z, width); + } + return paintSurface; + } + void vessel(double x, double base, double z, Pottery pottery, Texture texture) { vessel(x, base, z, pottery.discs(), texture); if (!pottery.isPlatter()) return; diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java index d3576f9..6f17382 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java @@ -4,6 +4,7 @@ import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.WeakHashMap; import net.minecraft.client.Minecraft; @@ -21,6 +22,15 @@ public final class PaintAtlas { private static final WeakHashMap patterns = new WeakHashMap<>(); private static ReferenceQueue unused = new ReferenceQueue<>(); + // Items and editor previews are transient. Keep recent designs warm between frames. + private static final LinkedHashMap displayed = new LinkedHashMap<>(64, 0.75F, true); + + static Tile forDisplay(FacePaint pattern) { + Tile tile = displayed.computeIfAbsent(pattern, PaintAtlas::acquire); + if (displayed.size() > 128) displayed.pollFirstEntry(); + return tile; + } + record Tile(FacePaint pattern, Page page, int x, int y) {} private static final class TileRef extends WeakReference { @@ -68,6 +78,7 @@ public static void clear() { } pages.clear(); patterns.clear(); + displayed.clear(); unused = new ReferenceQueue<>(); } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintLayer.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintLayer.java new file mode 100644 index 0000000..a374b02 --- /dev/null +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintLayer.java @@ -0,0 +1,36 @@ +package net.modcrafters.minecraft.primalpottery.client; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; +import net.modcrafters.minecraft.primalpottery.pottery.Pottery; +import org.jspecify.annotations.Nullable; +//? if >=26.1 { +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.rendertype.RenderTypes; +//?} else { +/*import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +*///?} + +/** A pottery design and the surface it wraps. Queued draws retain their atlas tile until rendered. */ +record PaintLayer(Mesh surface, FacePaint pattern) { + static @Nullable PaintLayer of(Mesh vessel, Pottery pottery, double width) { + return FacePaint.EMPTY.equals(pottery.paint()) ? null + : new PaintLayer(vessel.paintSurface(0, 0, 0, pottery, width), pottery.paint()); + } + + //? if >=26.1 { + void submit(PoseStack pose, SubmitNodeCollector collector, int light) { + var tile = PaintAtlas.forDisplay(pattern); + collector.submitCustomGeometry(pose, RenderTypes.entityCutoutCull(tile.page().texture), + (entry, buffer) -> Sprites.drawPaint(surface, tile, buffer, entry, light)); + } + //?} else { + /*RenderType draw(PoseStack pose, MultiBufferSource buffers, int light, boolean shade) { + var tile = PaintAtlas.forDisplay(pattern); + var type = RenderType.entityCutout(tile.page().texture); + Sprites.drawPaint(surface, tile, buffers.getBuffer(type), pose.last(), light, shade); + return type; + } + *///?} +} diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlatePaint.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlatePaint.java index 03040ef..4aeb1ee 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlatePaint.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlatePaint.java @@ -1,6 +1,5 @@ package net.modcrafters.minecraft.primalpottery.client; -import net.modcrafters.minecraft.primalpottery.pottery.PaintColors; import java.util.ArrayList; import java.util.List; import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; @@ -26,7 +25,7 @@ private static List surface(Pottery plate) { return path; } - static void build(Mesh mesh, double x, double base, double z, Pottery plate, boolean atlas) { + static void build(Mesh mesh, double x, double base, double z, Pottery plate) { List path = surface(plate); double[] distance = new double[path.size()]; for (int i = 1; i < path.size(); i++) { @@ -45,21 +44,7 @@ static void build(Mesh mesh, double x, double base, double z, Pottery plate, boo if (distance[i] <= distance[i-1]) continue; Station a = path.get(i-1), b = path.get(i); double start = distance[i-1]*FacePaint.SIDE/length, end = distance[i]*FacePaint.SIDE/length; - for (double from = start; from < end;) { - int row = Math.min((int)from, FacePaint.SIDE-1); - int ink = plate.paint().color(column*FacePaint.SIDE + row); - double to = end; - if (!atlas) { - int stop = row+1; - while (stop < end && plate.paint().color(column*FacePaint.SIDE + stop) == ink) stop++; - to = Math.min(end, stop); - } - if (atlas || ink != FacePaint.ERASE) { - mesh.quads().add(strip(x, base, z, a, b, x0, z0, x1, z1, angle, left, right, - start, end, from, to, column, ink, atlas)); - } - from = to; - } + mesh.quads().add(strip(x, base, z, a, b, x0, z0, x1, z1, angle, left, right, start, end, column)); } } } @@ -67,7 +52,7 @@ static void build(Mesh mesh, double x, double base, double z, Pottery plate, boo private static Mesh.Quad strip(double x, double base, double z, Station a, Station b, double x0, double z0, double x1, double z1, double angle, double left, double right, - double start, double end, double from, double to, int column, int ink, boolean atlas) { + double start, double end, int column) { double rise = b.y()-a.y(), run = (b.radius()-a.radius())*Math.cos(Math.PI/8); double normalLength = Math.hypot(rise, run); double mid = angle + Math.PI/8; @@ -76,18 +61,17 @@ private static Mesh.Quad strip(double x, double base, double z, Station a, Stati float nz = (float)(-rise*Math.sin(mid)/normalLength); Mesh.Quad q = new Mesh.Quad(nx, ny, nz, Mesh.Texture.PIGMENT); q.cornerNormals = new float[12]; - if (!atlas) q.pigment = PaintColors.rgb(ink); for (int v = 0; v < 4; v++) { - double u = v < 2 ? from : to; - double t = (u-start)/(end-start); + double u = v < 2 ? start : end; + double t = v < 2 ? 0 : 1; double across = v == 0 || v == 3 ? left : right; // The slight inward/upward inset clears the clay, including vertical inner walls. double radius = Math.max(0, a.radius() + t*(b.radius()-a.radius()) - 0.008); q.x[v] = (float)(x + radius*(x0 + across*(x1-x0))); q.z[v] = (float)(z + radius*(z0 + across*(z1-z0))); q.y[v] = (float)(base + a.y() + t*rise + 0.012); - q.u[v] = atlas ? (float)u : 8; - q.v[v] = atlas ? column + 0.5F : 8; + q.u[v] = (float)u; + q.v[v] = column + 0.5F; q.cornerNormals[v*3] = q.nx; q.cornerNormals[v*3+1] = q.ny; q.cornerNormals[v*3+2] = q.nz; diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryItemMesh.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryItemMesh.java index e50afea..4c6167c 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryItemMesh.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryItemMesh.java @@ -61,7 +61,7 @@ public static Prepared prepare(Pottery pottery, boolean closed, boolean raw, @Nu lid.fitSprite(); } Identifier texture = raw && PotteryItem.dyeColor(dye) == null ? Sprites.rawTexture() : Sprites.clayTexture(dye); - return new Prepared(vessel, lid, scale(radius, height), texture, Sprites.dyeTint(dye)); + return new Prepared(vessel, lid, raw ? null : PaintLayer.of(vessel, pottery, 1), scale(radius, height), texture, Sprites.dyeTint(dye)); } /** Mesh units to block units, keeping the profile inside a 10 by 12.5 pixel icon. */ @@ -91,12 +91,5 @@ public void draw(PoseStack.Pose pose, VertexConsumer buffer, int light) { } } - public record Prepared(@Nullable Mesh vessel, @Nullable Mesh lid, float scale, Identifier texture, int color) { - public void draw(PoseStack pose, VertexConsumer buffer, int light, boolean shade) { - pose.pushPose(); - pose.scale(this.scale, this.scale, this.scale); - Sprites.draw(this.vessel, this.lid, buffer, pose.last(), light, this.texture, this.color, shade); - pose.popPose(); - } - } + public record Prepared(Mesh vessel, @Nullable Mesh lid, @Nullable PaintLayer paint, float scale, Identifier texture, int color) {} } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryItemRenderer.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryItemRenderer.java index faff615..127b016 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryItemRenderer.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryItemRenderer.java @@ -46,11 +46,13 @@ public void renderByItem( pose.translate(0.0F, -0.5F, 0.0F); var buffer = buffers.getBuffer(RenderType.entityCutout(Sprites.blocks())); PotteryItemMesh.Prepared prepared = PotteryItemMesh.prepare(stack); - prepared.draw(pose, buffer, light, context == ItemDisplayContext.GUI); + pose.scale(prepared.scale(), prepared.scale(), prepared.scale()); + boolean shade = context == ItemDisplayContext.GUI; + Sprites.draw(prepared.vessel(), prepared.lid(), buffer, pose.last(), light, prepared.texture(), prepared.color(), shade); + if (prepared.paint() != null) prepared.paint().draw(pose, buffers, light, shade); if (stack.is(net.modcrafters.minecraft.primalpottery.item.ModItems.POTTERY)) { var fluid = PotteryItemMesh.fluid(PotteryItem.read(stack), PotteryItem.contents(stack), PotteryItem.lid(stack)); if (fluid != null) { - pose.scale(prepared.scale(), prepared.scale(), prepared.scale()); fluid.draw(pose.last(), buffers.getBuffer(fluid.solid() ? RenderType.entitySolid(Sprites.blocks()) : RenderType.entityTranslucent(Sprites.blocks())), light); } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPaint.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPaint.java index 2ce8ef8..437e88f 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPaint.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPaint.java @@ -1,30 +1,17 @@ package net.modcrafters.minecraft.primalpottery.client; -import net.modcrafters.minecraft.primalpottery.pottery.PaintColors; import net.modcrafters.minecraft.primalpottery.pottery.Pottery; import net.modcrafters.minecraft.primalpottery.pottery.PotteryProfile; -import net.modcrafters.minecraft.primalpottery.pottery.FacePaint; /** Maps one square of slip decoration across the throwing rings of each exterior face. */ final class PotteryPaint { private PotteryPaint() { } - static void apply(Mesh vessel, double x, double base, double z, Pottery pottery) { - if (pottery.isPlate()) { - PlatePaint.build(vessel, x, base, z, pottery, false); - return; - } - Mesh overlay = overlay(vessel, x, base, z, pottery); - for (Mesh.Quad face : overlay.quads()) { - paintRows(vessel, face, pottery.paint()); - } - } - static Mesh overlay(Mesh vessel, double x, double base, double z, Pottery pottery) { Mesh overlay = new Mesh(); if (pottery.isPlate()) { - PlatePaint.build(overlay, x, base, z, pottery, true); + PlatePaint.build(overlay, x, base, z, pottery); return overlay; } var wall = PotteryProfile.profile(pottery.discs(), false); @@ -67,43 +54,6 @@ static Mesh overlay(Mesh vessel, double x, double base, double z, Pottery potter return overlay; } - private static void paintRows(Mesh mesh, Mesh.Quad face, FacePaint pattern) { - for (int row = Math.max(0, (int) Math.floor(face.v[3])); row < Math.min(16, Math.ceil(face.v[0])); row++) { - double top = Math.max(row, face.v[3]); - double bottom = Math.min(row + 1, face.v[0]); - for (int x = 0; x < FacePaint.SIDE;) { - int start = x++; - int color = pattern.color(row * FacePaint.SIDE + start); - while (x < FacePaint.SIDE && pattern.color(row * FacePaint.SIDE + x) == color) { - x++; - } - if (color == FacePaint.ERASE) { - continue; - } - Mesh.Quad strip = new Mesh.Quad(face.nx, face.ny, face.nz, Mesh.Texture.PIGMENT); - strip.pigment = PaintColors.rgb(color); - strip.cornerNormals = new float[12]; - for (int v = 0; v < 4; v++) { - float u = (v == 0 || v == 3 ? start : x) / 16F; - float t = (float) ((face.v[0] - (v < 2 ? bottom : top)) / (face.v[0] - face.v[3])); - strip.x[v] = sample(face.x, u, t); - strip.y[v] = sample(face.y, u, t); - strip.z[v] = sample(face.z, u, t); - for (int a = 0; a < 3; a++) { - float[] n = face.cornerNormals; - strip.cornerNormals[3 * v + a] = lerp(lerp(n[a], n[a+3], u), lerp(n[a+9], n[a+6], u), t); - } - strip.u[v] = strip.v[v] = 8; - } - mesh.quads().add(strip); - } - } - } - - private static float sample(float[] values, float u, float t) { - return lerp(lerp(values[0], values[1], u), lerp(values[3], values[2], u), t); - } - private static float lerp(float a, float b, float t) { return a + (b - a) * t; } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPreview.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPreview.java index a2f7b62..a13af50 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPreview.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryPreview.java @@ -42,7 +42,7 @@ private static Mesh displayBlock() { return block; } - record Placement(Mesh pot, List centers, double height, double reach) { + record Placement(Mesh pot, @Nullable PaintLayer paint, List centers, double height, double reach) { Model frame(int width, int height, float tilt) { // Reserve the full sweep once. Neither the support's pivot nor the zoom moves during a drag. double corner = Math.hypot(16, 16); @@ -51,25 +51,25 @@ Model frame(int width, int height, float tilt) { float pivot = (float) Math.min(height - 2, height * above / (above + below) + 3); float scale = (float) Math.min((width - 2) / (2 * corner), Math.min((pivot - 1) / above, (height - pivot - 1) / below)); - return new Model(this.pot, 0, 0, scale, pivot - height / 2F, DISPLAY_BLOCK, tilt, this.centers); + return new Model(this.pot, this.paint, 0, 0, scale, pivot - height / 2F, DISPLAY_BLOCK, tilt, this.centers); } } static Placement placement(Pottery pottery) { - Mesh pot = new Mesh(); - pot.vessel(0, 0, 0, pottery, Mesh.Texture.FIRED_CLAY); - pot.fitSprite(); - if (pottery.isPlate() && pottery.size() == Pottery.Size.SMALL) { + boolean smallPlate = pottery.isPlate() && pottery.size() == Pottery.Size.SMALL; + double width = smallPlate ? net.modcrafters.minecraft.primalpottery.block.PotteryBlockEntity.PLATE_SCALE : 1; + Mesh pot = Mesh.placedVessel(0, 0, pottery, width); + PaintLayer paint = PaintLayer.of(pot, pottery, width); + if (smallPlate) { double offset = 32.0 / 3; - pot.scaleWidth(0, 0, net.modcrafters.minecraft.primalpottery.block.PotteryBlockEntity.PLATE_SCALE); - return new Placement(pot, List.of(new Vec3(0, 0, -offset), new Vec3(offset, 0, 0), + return new Placement(pot, paint, List.of(new Vec3(0, 0, -offset), new Vec3(offset, 0, 0), new Vec3(0, 0, offset), new Vec3(-offset, 0, 0)), pottery.height(), 16); } boolean small = pottery.size() == Pottery.Size.SMALL; double radius = pottery.discs().stream().mapToDouble(PotteryDisc::radius).max().orElse(0); double offset = small ? Math.hypot(8, 8) : 0; double height = pottery.discs().stream().mapToDouble(PotteryDisc::height).sum(); - return new Placement(pot, small ? QUARTERS : CENTER, height, offset + radius); + return new Placement(pot, paint, small ? QUARTERS : CENTER, height, offset + radius); } static void drawModel(GuiGraphicsExtractor graphics, Model model, String dye, float spin, int x0, int y0, int x1, int y1) { @@ -93,6 +93,14 @@ static void drawModel(GuiGraphicsExtractor graphics, Model model, PotteryItemMes RenderType type = RenderType.entityCutout(Sprites.blocks()); drawMeshes(model, dye, buffers.getBuffer(type), pose.last()); buffers.endBatch(type); + if (model.paint() != null) { + for (Vec3 center : model.centers()) { + pose.pushPose(); + pose.translate(center.x, 0, center.z); + buffers.endBatch(model.paint().draw(pose, buffers, 0xF000F0, false)); + pose.popPose(); + } + } if (fluid != null) { RenderType fluidType = fluid.solid() ? type : RenderType.entityTranslucent(Sprites.blocks()); fluid.draw(pose.last(), buffers.getBuffer(fluidType), 0xF000F0); @@ -112,12 +120,14 @@ static Model rotatablePot(Pottery pottery, int width, int height, float tilt) { // Fit the full rotation once so a wide bowl or tall vase stays in frame at any tilt. double fit = Math.min((width-4) / Math.max(1, diameter), (height-4) / Math.max(1, Math.hypot(diameter, vesselHeight))); - return new Model(Mesh.firedVessel(0, 0, 0, pottery), 0, (float) (vesselHeight / 2), + Mesh mesh = Mesh.firedVessel(0, 0, 0, pottery); + return new Model(mesh, PaintLayer.of(mesh, pottery, 1), 0, (float) (vesselHeight / 2), (float) fit, 0, null, tilt, CENTER); } static Model model(Pottery pottery, int width, int height, Pottery.@Nullable Cover cover, boolean closed) { Mesh mesh = Mesh.firedVessel(0, 0, 0, pottery); + PaintLayer paint = PaintLayer.of(mesh, pottery, 1); double vesselHeight = 0; double radius = 0; for (PotteryDisc disc : pottery.discs()) { @@ -144,7 +154,7 @@ static Model model(Pottery pottery, int width, int height, Pottery.@Nullable Cov double tilt = Math.toRadians(TILT); double projectedHeight = vesselHeight * Math.cos(tilt) + 2 * radius * Math.sin(tilt); double fit = Math.min((width - 4) / Math.max(1, sceneWidth), (height - 4) / Math.max(1, projectedHeight)); - return new Model(mesh, (float) centerX, (float) (vesselHeight / 2), (float) fit, 0, null, TILT, CENTER); + return new Model(mesh, paint, (float) centerX, (float) (vesselHeight / 2), (float) fit, 0, null, TILT, CENTER); } static void orient(PoseStack pose, Model model, float spin) { @@ -175,9 +185,9 @@ private static void drawMeshes(Model model, String dye, com.mojang.blaze3d.verte } } - record Model(Mesh mesh, float centerX, float centerY, float scale, float offsetY, @Nullable Mesh ground, float tilt, List centers) { + record Model(Mesh mesh, @Nullable PaintLayer paint, float centerX, float centerY, float scale, float offsetY, @Nullable Mesh ground, float tilt, List centers) { Model withTilt(float angle) { - return new Model(mesh, centerX, centerY, scale, offsetY, ground, angle, centers); + return new Model(mesh, paint, centerX, centerY, scale, offsetY, ground, angle, centers); } } @@ -235,6 +245,15 @@ protected void renderToTexture(State state, PoseStack pose, SubmitNodeCollector RenderTypes.entityCutoutCull(Sprites.blocks()), (entry, buffer) -> drawMeshes(state.model(), state.dye(), buffer, entry) ); + Model model = state.model(); + if (model.paint() != null) { + for (Vec3 center : model.centers()) { + pose.pushPose(); + pose.translate(center.x, 0, center.z); + model.paint().submit(pose, collector, 0xF000F0); + pose.popPose(); + } + } var fluid = state.fluid(); if (fluid != null) { collector.submitCustomGeometry(pose, fluid.solid() ? RenderTypes.entitySolid(Sprites.blocks()) diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryRenderer.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryRenderer.java index 6eb1e4f..2492173 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryRenderer.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryRenderer.java @@ -450,9 +450,7 @@ Mesh fluidMesh(int slot, Pottery pottery, int amount) { PlacedPot(Pottery pottery, double x, double z, double width) { vessel = Mesh.placedVessel(x, z, pottery, width); if (!FacePaint.EMPTY.equals(pottery.paint())) { - paint = PotteryPaint.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); + paint = vessel.paintSurface(x, 0, z, pottery, width); tile = PaintAtlas.acquire(pottery.paint()); } } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotterySpecialRenderer.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotterySpecialRenderer.java index 0182f5d..35ecda9 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotterySpecialRenderer.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotterySpecialRenderer.java @@ -57,6 +57,7 @@ public void submit( RenderTypes.entityCutoutCull(Sprites.blocks()), (pose, buffer) -> Sprites.draw(prepared.vessel(), prepared.lid(), buffer, pose, light, prepared.texture(), prepared.color()) ); + if (prepared.paint() != null) prepared.paint().submit(poseStack, collector, light); drawFluid(drawn, poseStack, collector, light); poseStack.popPose(); } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/Sprites.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/Sprites.java index aa001a0..1224015 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/Sprites.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/Sprites.java @@ -199,7 +199,7 @@ private static void write(Mesh mesh, @Nullable TextureAtlasSprite forced, Vertex float nz = normals == null ? quad.nz : normals[i + 2]; // Blend the vanilla axis brightnesses for flat-lit inventory icons. float brightness = shade && normals != null - ? nx * nx * 0.6F + nz * nz * 0.8F + ny * ny * (ny > 0 ? 1.0F : 0.5F) + ? curvedShade(nx, ny, nz) : flatShade; put(buffer, pose, transformed, quad.x[vertex], quad.y[vertex], quad.z[vertex], sampleU(sprite, quad.u[vertex]), sampleV(sprite, quad.v[vertex]), light, @@ -208,6 +208,10 @@ private static void write(Mesh mesh, @Nullable TextureAtlasSprite forced, Vertex } } + private static float curvedShade(float nx, float ny, float nz) { + return nx * nx * 0.6F + nz * nz * 0.8F + ny * ny * (ny > 0 ? 1.0F : 0.5F); + } + /** Block-item brightness for the nearest axis. Up is full, down is half, north and south are 0.8, east and west are 0.6. */ private static float faceShade(float nx, float ny, float nz) { float ax = Math.abs(nx); @@ -243,14 +247,19 @@ private static float sampleU(TextureAtlasSprite sprite, float unit) { } static void drawPaint(Mesh overlay, PaintAtlas.Tile tile, VertexConsumer buffer, PoseStack.Pose pose, int light) { + drawPaint(overlay, tile, buffer, pose, light, false); + } + + static void drawPaint(Mesh overlay, PaintAtlas.Tile tile, VertexConsumer buffer, PoseStack.Pose pose, int light, boolean shade) { tile.page().upload(); Vector3f transformed = new Vector3f(); for (Mesh.Quad quad : overlay.quads()) { for (int v = 0; v < 4; v++) { float u = (tile.x() + quad.u[v]) / PaintAtlas.SIZE; float t = (tile.y() + quad.v[v]) / PaintAtlas.SIZE; - put(buffer, pose, transformed, quad.x[v], quad.y[v], quad.z[v], u, t, light, 255, 255, 255, 255, - quad.cornerNormals[3*v], quad.cornerNormals[3*v+1], quad.cornerNormals[3*v+2]); + float nx = quad.cornerNormals[3*v], ny = quad.cornerNormals[3*v+1], nz = quad.cornerNormals[3*v+2]; + int white = shade ? (int) (255 * curvedShade(nx, ny, nz)) : 255; + put(buffer, pose, transformed, quad.x[v], quad.y[v], quad.z[v], u, t, light, white, white, white, 255, nx, ny, nz); } } } diff --git a/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java b/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java index 84280a6..b34e427 100644 --- a/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java +++ b/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java @@ -4,6 +4,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -72,14 +74,14 @@ void platterMarksStayOnTheLipAtTheSixServingBoundariesAndSampleOnlyClay() { } @Test - void firedMeshCacheReusesEqualProfilesAndKeepsFinishesAndPositionsSeparate() { + void firedMeshesShareGeometryAcrossDesignsAndKeepPositionsSeparate() { Pottery jug = Pottery.jug(); Mesh plain = Mesh.firedVessel(0, 0, 0, jug); assertSame(plain, Mesh.firedVessel(0, 0, 0, PotteryTags.load(PotteryTags.save(jug)))); assertNotSame(plain, Mesh.firedVessel(8, 0, 0, jug)); var custom = new Pottery(jug.size(), jug.discs(), jug.paint().with(48, 3)); assertSame(plain, Mesh.placedVessel(0, 0, custom, 1)); - assertNotSame(plain, Mesh.firedVessel(0, 0, 0, custom)); + assertSame(plain, Mesh.firedVessel(0, 0, 0, custom)); var plate = new Pottery(List.of(new PotteryDisc(2, 8, 6), new PotteryDisc(1, 7, 0))); var full = Mesh.placedVessel(0, 0, plate, 1); float fullX = full.quads().getFirst().x[0]; @@ -105,10 +107,15 @@ void platePaintSpansFloorInnerWallAndRimOnAllEightSectors() { } var ink = plate.paint().with(0, 4).with(63, 9); var painted = new Pottery(plate.size(), plate.discs(), ink); - var pixels = new Mesh(); - PotteryPaint.apply(pixels, 0, 0, 0, painted); - assertEquals(8, pixels.quads().stream().filter(q -> q.x[0] == 0 && q.z[0] == 0).count()); - assertEquals(16, pixels.quads().size()); + var vessel = Mesh.firedVessel(0, 0, 0, painted); + var first = PaintLayer.of(vessel, painted, 1); + var edited = painted.withPaint(ink.with(2, 1)); + var preview = PotteryPreview.rotatablePot(edited, 124, 98, 30); + assertSame(vessel, preview.mesh()); + assertSame(first.surface(), preview.paint().surface()); + assertEquals(edited.paint(), preview.withTilt(45).paint().pattern()); + assertNotEquals(first.pattern(), preview.paint().pattern()); + assertNull(PaintLayer.of(vessel, plate, 1)); } @Test @@ -117,8 +124,7 @@ void customPaintWrapsEachExteriorFaceOnceAcrossTheMiddleOfTheVessel() { var painted = plain.withPaint(plain.paint().with(120, 3)); var mesh = Mesh.placedVessel(8, 24, painted, 1); assertTrue(mesh.quads().stream().noneMatch(quad -> quad.texture == Mesh.Texture.PIGMENT)); - assertTrue(Mesh.firedVessel(8, 0, 24, painted).quads().stream() - .anyMatch(quad -> quad.texture == Mesh.Texture.PIGMENT)); + assertSame(mesh, Mesh.firedVessel(8, 0, 24, painted)); int faces = 0; double middle = painted.height() * 0.48; for (var quad : PotteryPaint.overlay(mesh, 8, 0, 24, painted).quads()) { From 84212b032b18ac0c205a527e20f6875e3995d7ba Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 20:29:49 +0200 Subject: [PATCH 09/11] Keep benchmark reports and documentation in the design repository Co-authored-by: Face of Cat --- .github/workflows/ci.yml | 10 ---------- README.md | 15 ++------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9767bf7..a62d8bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -161,16 +161,6 @@ jobs: mkdir -p "$GITHUB_WORKSPACE/build/display-check" printf 'onboardAccessibility:false\nmaxFps:30\npauseOnLostFocus:false\nrenderDistance:5\n' > "$GITHUB_WORKSPACE/build/display-check/options.txt" timeout 20m ${{ matrix.client }} - cat "$GITHUB_WORKSPACE/build/display-check/display-check.txt" - - uses: actions/upload-artifact@v7 - if: always() - with: - name: forge-display-${{ matrix.minecraft }} - path: | - build/display-check/**/*.png - build/display-check/display-check.txt - build/display-check/logs/latest.log - build/display-check/crash-reports/ all-versions: name: all-versions diff --git a/README.md b/README.md index 815b0b5..d203f1e 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,6 @@ Shape clay on a wheel. -NeoForge covers 1.20.6, 1.21.1, and 26.3. Fabric covers 26.3. Stonecutter keeps their Minecraft integration in `src/`, written for 26.3. The Java 8 library in `core/` owns the pottery profile, classification, dimensions and paint. +The `main` branch is a Java mod built with Stonecutter. NeoForge covers 1.20.6, 1.21.1, and 26.3. Fabric covers 26.3. Shared sources are written for 26.3. The Forge 1.12 mod remains on the `1.12` branch. -`./gradlew collectJars` collects the Stonecutter loader jars in `build/libs//`. - -## Forge painted-pot preview - -The Forge previews for 1.12.2 and 1.20.1 support one fired vessel per block. Use `/give @p primalpottery:pottery` for a flower-painted jug. Place it, reload the world and harvest it in survival to recover the profile and paint. Both versions use the same disc list and 16 × 16 face pattern. The template editor, wheel and firing recipes are later milestones. - -| Target | Build | Output | -|---|---|---| -| Forge 1.20.1 · Java 17 game | From the root, run `./gradlew :forge:build` with the modern Gradle JDK. | `forge/build/libs/` | -| Forge 1.12.2 · Java 8 game | From `legacy/forge-1.12.2/`, set `JAVA_HOME` to a JDK 8 and run `./gradlew build`. | `legacy/forge-1.12.2/build/libs/` | - -Use `gradlew.bat` on Windows. The Forge directories each contain their own block, saved-data and baked-model adapters. Both compile against the same checkout of `core/` and include it in their production jar. +`./gradlew collectJars` writes the loader jars to `build/libs//`. From 3dca3a527250a7eb21dbaace93c5e3bbe2777e3a Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 21:22:55 +0200 Subject: [PATCH 10/11] Cull back-facing pottery geometry and batch atlas draws Co-authored-by: Face of Cat --- .../client/PrimalPotteryNeoForgeClient.java | 5 +- .../minecraft/primalpottery/client/Mesh.java | 7 ++ .../primalpottery/client/PaintAtlas.java | 6 +- .../primalpottery/client/PlacedFaces.java | 68 +++++++++++++++++++ .../primalpottery/client/PotteryRenderer.java | 35 ++++++---- .../primalpottery/client/Sprites.java | 22 ++++-- .../primalpottery/client/MeshTest.java | 27 ++++++++ 7 files changed, 149 insertions(+), 21 deletions(-) create mode 100644 src/main/java/net/modcrafters/minecraft/primalpottery/client/PlacedFaces.java diff --git a/neoforge/src/main/java/net/modcrafters/minecraft/primalpottery/neoforge/client/PrimalPotteryNeoForgeClient.java b/neoforge/src/main/java/net/modcrafters/minecraft/primalpottery/neoforge/client/PrimalPotteryNeoForgeClient.java index 7b85a22..8b5e036 100644 --- a/neoforge/src/main/java/net/modcrafters/minecraft/primalpottery/neoforge/client/PrimalPotteryNeoForgeClient.java +++ b/neoforge/src/main/java/net/modcrafters/minecraft/primalpottery/neoforge/client/PrimalPotteryNeoForgeClient.java @@ -79,7 +79,10 @@ public static void register(IEventBus modBus) { }; modBus.addListener(PrimalPotteryNeoForgeClient::renderers); //? if <26.1 { - /*modBus.addListener(PrimalPotteryNeoForgeClient::colors); + /*// Keep the first paint page batched across block entities. Overflow pages use the regular buffer. + modBus.addListener((net.neoforged.neoforge.client.event.RegisterRenderBuffersEvent event) -> + event.registerRenderBuffer(RenderType.entityCutout(net.modcrafters.minecraft.primalpottery.client.PaintAtlas.pageTexture(0)))); + modBus.addListener(PrimalPotteryNeoForgeClient::colors); *///?} //? if >=26.1 { modBus.addListener(PrimalPotteryNeoForgeClient::pictures); diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/Mesh.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/Mesh.java index 509afeb..ae1ac80 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/Mesh.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/Mesh.java @@ -87,6 +87,13 @@ private static synchronized Mesh firedVessel(double x, double y, double z, Potte } private Mesh paintSurface; + private PlacedFaces placedFaces; + + /** Only requested after shaping and scaling are complete. */ + synchronized PlacedFaces placedFaces() { + if (placedFaces == null) placedFaces = new PlacedFaces(quads); + return placedFaces; + } /** Called on a cached fired vessel with its original placement and width. */ synchronized Mesh paintSurface(double x, double y, double z, Pottery pottery, double width) { diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java index 6f17382..85b4e25 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PaintAtlas.java @@ -54,7 +54,7 @@ static final class Page { Page(int index) { this.index = index; - texture = Ids.of("dynamic/pottery_paint_" + index); + texture = pageTexture(index); //? if >=26.1 { image = new DynamicTexture(texture::toString, SIZE, SIZE, true); //?} else @@ -72,6 +72,10 @@ void upload() { private PaintAtlas() {} + public static Identifier pageTexture(int index) { + return Ids.of("dynamic/pottery_paint_" + index); + } + public static void clear() { for (Page page : pages) { if (page != null) Minecraft.getInstance().getTextureManager().release(page.texture); diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlacedFaces.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlacedFaces.java new file mode 100644 index 0000000..a0b98b4 --- /dev/null +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlacedFaces.java @@ -0,0 +1,68 @@ +package net.modcrafters.minecraft.primalpottery.client; + +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import net.minecraft.world.phys.Vec3; + +/** Face planes for the back-face-culled render pass of a finished, placed pot. */ +final class PlacedFaces { + private final Face[] faces; + + PlacedFaces(List quads) { + faces = new Face[quads.size()]; + for (int i = 0; i < faces.length; i++) { + Mesh.Quad q = quads.get(i); + faces[i] = new Face(q, Plane.triangle(q, 1, 2), Plane.triangle(q, 2, 3)); + } + } + + Iterable visibleFrom(Vec3 eye) { + return () -> new Iterator<>() { + int index = findNext(0); + + private int findNext(int start) { + while (start < faces.length && !faces[start].visibleFrom(eye)) start++; + return start; + } + + @Override + public boolean hasNext() { + return index < faces.length; + } + + @Override + public Mesh.Quad next() { + if (!hasNext()) throw new NoSuchElementException(); + Mesh.Quad quad = faces[index].quad; + index = findNext(index + 1); + return quad; + } + }; + } + + private record Face(Mesh.Quad quad, Plane first, Plane second) { + boolean visibleFrom(Vec3 eye) { + return first.visibleFrom(eye) || second.visibleFrom(eye); + } + } + + // Follow the index buffer's winding. Curved lighting normals do not describe the face plane. + private record Plane(double nx, double ny, double nz, double offset) { + static Plane triangle(Mesh.Quad q, int b, int c) { + Vec3 origin = corner(q, 0); + Vec3 normal = corner(q, b).subtract(origin).cross(corner(q, c).subtract(origin)); + // Keep grazing faces. A zero-area triangle has no fragments from either side. + double offset = -normal.dot(origin) + 1e-4 * normal.length(); + return new Plane(normal.x, normal.y, normal.z, offset); + } + + private static Vec3 corner(Mesh.Quad q, int i) { + return new Vec3(q.x[i], q.y[i], q.z[i]); + } + + boolean visibleFrom(Vec3 eye) { + return nx * eye.x + ny * eye.y + nz * eye.z + offset > 0; + } + } +} diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryRenderer.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryRenderer.java index 2492173..3eb15f2 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryRenderer.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PotteryRenderer.java @@ -11,6 +11,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.BiomeColors; import net.minecraft.core.Direction; +import net.minecraft.world.phys.Vec3; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; @@ -109,6 +110,7 @@ public void submit( net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.level.CameraRenderState camera ) { + Vec3 eye = localEye(camera.pos, state.blockPos); PlacedPot[] bodies = bodies(state.slots, state.lids); List draws = fluids(bodies, state.slots, state.contents); boolean solidFluid = has(draws, true); @@ -123,7 +125,7 @@ public void submit( poseStack, net.minecraft.client.renderer.rendertype.RenderTypes.entityCutoutCull(Sprites.blocks()), (pose, buffer) -> { - drawClay(bodies, state.lids, state.dyes, buffer, pose, state.lightCoords); + drawClay(eye, bodies, state.lids, state.dyes, buffer, pose, state.lightCoords); drawSoil(state.plantings, buffer, pose, state.lightCoords); drawFluids(draws, buffer, pose, state.lightCoords, true); } @@ -133,7 +135,7 @@ public void submit( if (body != null && body.tile != null) { collector.submitCustomGeometry(poseStack, net.minecraft.client.renderer.rendertype.RenderTypes.entityCutoutCull(body.tile.page().texture), - (pose, buffer) -> Sprites.drawPaint(body.paint, body.tile, buffer, pose, state.lightCoords)); + (pose, buffer) -> Sprites.drawPaint(body.paint.visibleFrom(eye), body.tile, buffer, pose, state.lightCoords, false)); } } if (translucent) { @@ -196,6 +198,7 @@ public void render( int light, int overlay ) { + Vec3 eye = localEye(net.minecraft.client.Minecraft.getInstance().gameRenderer.getMainCamera().getPosition(), blockEntity.getBlockPos()); var slots = blockEntity.slots(); var lids = blockEntity.lids(); PlacedPot[] bodies = bodies(slots, lids); @@ -210,14 +213,14 @@ public void render( poseStack.scale(1 / 32.0F, 1 / 32.0F, 1 / 32.0F); if (occupied(slots) || solidFluid) { var buffer = buffers.getBuffer(net.minecraft.client.renderer.RenderType.entityCutout(Sprites.blocks())); - drawClay(bodies, lids, blockEntity.dyes(), buffer, poseStack.last(), light); + drawClay(eye, bodies, lids, blockEntity.dyes(), buffer, poseStack.last(), light); drawSoil(plantings, buffer, poseStack.last(), light); drawFluids(draws, buffer, poseStack.last(), light, true); } for (PlacedPot body : bodies) { if (body != null && body.tile != null) { var type = net.minecraft.client.renderer.RenderType.entityCutout(body.tile.page().texture); - Sprites.drawPaint(body.paint, body.tile, buffers.getBuffer(type), poseStack.last(), light); + Sprites.drawPaint(body.paint.visibleFrom(eye), body.tile, buffers.getBuffer(type), poseStack.last(), light, false); } } if (translucent) { @@ -424,9 +427,9 @@ private static boolean occupied(Pottery[] slots) { private final Map placed = new WeakHashMap<>(); private static final class PlacedPot { - final Mesh vessel; - Mesh lid; - Mesh paint; + final PlacedFaces vessel; + PlacedFaces lid; + PlacedFaces paint; PaintAtlas.Tile tile; private Mesh fluid; @@ -448,9 +451,10 @@ Mesh fluidMesh(int slot, Pottery pottery, int amount) { } PlacedPot(Pottery pottery, double x, double z, double width) { - vessel = Mesh.placedVessel(x, z, pottery, width); + Mesh clay = Mesh.placedVessel(x, z, pottery, width); + vessel = clay.placedFaces(); if (!FacePaint.EMPTY.equals(pottery.paint())) { - paint = vessel.paintSurface(x, 0, z, pottery, width); + paint = clay.paintSurface(x, 0, z, pottery, width).placedFaces(); tile = PaintAtlas.acquire(pottery.paint()); } } @@ -477,7 +481,7 @@ private PlacedPot[] bodies(Pottery[] slots, boolean[] lids) { lid.fitSprite(); if (i >= PotteryBlockEntity.CORNERS) lid.scaleWidth(x, z, PotteryBlockEntity.PLATE_SCALE); } - positions[i].lid = lid; + positions[i].lid = lid.placedFaces(); } } result[i] = positions[i]; @@ -485,13 +489,20 @@ private PlacedPot[] bodies(Pottery[] slots, boolean[] lids) { return result; } + private static Vec3 localEye(Vec3 camera, BlockPos block) { + return camera.subtract(block.getX(), block.getY(), block.getZ()).scale(32); + } + private static void drawClay( - PlacedPot[] bodies, boolean[] lids, String[] dyes, com.mojang.blaze3d.vertex.VertexConsumer buffer, PoseStack.Pose pose, int light + Vec3 eye, PlacedPot[] bodies, boolean[] lids, String[] dyes, com.mojang.blaze3d.vertex.VertexConsumer buffer, PoseStack.Pose pose, int light ) { for (int i = 0; i < bodies.length; i++) { PlacedPot body = bodies[i]; if (body != null) { - Sprites.draw(body.vessel, lids[i] ? body.lid : null, buffer, pose, light, Sprites.clayTexture(dyes[i]), Sprites.dyeTint(dyes[i])); + var sprite = Sprites.sprite(Sprites.clayTexture(dyes[i])); + int tint = Sprites.dyeTint(dyes[i]); + Sprites.drawPlacedClay(body.vessel.visibleFrom(eye), buffer, pose, light, sprite, tint); + if (lids[i]) Sprites.drawPlacedClay(body.lid.visibleFrom(eye), buffer, pose, light, sprite, tint); } } } diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/Sprites.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/Sprites.java index 1224015..75407f3 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/Sprites.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/Sprites.java @@ -162,22 +162,22 @@ public static void draw(@Nullable Mesh first, @Nullable Mesh second, VertexConsu int green = (color >> 8) & 255; int blue = color & 255; if (first != null) { - write(first, sprite, buffer, pose, light, red, green, blue, 255, shade); + write(first.quads(), sprite, buffer, pose, light, red, green, blue, 255, shade); } if (second != null) { - write(second, sprite, buffer, pose, light, red, green, blue, 255, shade); + write(second.quads(), sprite, buffer, pose, light, red, green, blue, 255, shade); } } private static void write(Mesh mesh, @Nullable TextureAtlasSprite forced, VertexConsumer buffer, PoseStack.Pose pose, int light, int alpha) { - write(mesh, forced, buffer, pose, light, 255, 255, 255, alpha, false); + write(mesh.quads(), forced, buffer, pose, light, 255, 255, 255, alpha, false); } - private static void write(Mesh mesh, @Nullable TextureAtlasSprite forced, VertexConsumer buffer, PoseStack.Pose pose, int light, int red, int green, int blue, int alpha, boolean shade) { + private static void write(Iterable faces, @Nullable TextureAtlasSprite forced, VertexConsumer buffer, PoseStack.Pose pose, int light, int red, int green, int blue, int alpha, boolean shade) { Vector3f transformed = new Vector3f(); Mesh.Texture lastTexture = null; TextureAtlasSprite lastSprite = null; - for (Mesh.Quad quad : mesh.quads()) { + for (Mesh.Quad quad : faces) { boolean paint = quad.texture == Mesh.Texture.PIGMENT; TextureAtlasSprite sprite = forced; if (sprite == null || paint) { @@ -208,6 +208,10 @@ private static void write(Mesh mesh, @Nullable TextureAtlasSprite forced, Vertex } } + static void drawPlacedClay(Iterable faces, VertexConsumer buffer, PoseStack.Pose pose, int light, TextureAtlasSprite sprite, int color) { + write(faces, sprite, buffer, pose, light, color >> 16 & 255, color >> 8 & 255, color & 255, 255, false); + } + private static float curvedShade(float nx, float ny, float nz) { return nx * nx * 0.6F + nz * nz * 0.8F + ny * ny * (ny > 0 ? 1.0F : 0.5F); } @@ -227,7 +231,7 @@ private static float faceShade(float nx, float ny, float nz) { } public static void drawTinted(Mesh mesh, VertexConsumer buffer, PoseStack.Pose pose, int light, int color) { - write(mesh, null, buffer, pose, light, (color >> 16) & 255, (color >> 8) & 255, color & 255, 255, false); + write(mesh.quads(), null, buffer, pose, light, (color >> 16) & 255, (color >> 8) & 255, color & 255, 255, false); } public static void drawFluid(Mesh mesh, VertexConsumer buffer, PoseStack.Pose pose, int light, TextureAtlasSprite sprite, int color) { @@ -251,9 +255,13 @@ static void drawPaint(Mesh overlay, PaintAtlas.Tile tile, VertexConsumer buffer, } static void drawPaint(Mesh overlay, PaintAtlas.Tile tile, VertexConsumer buffer, PoseStack.Pose pose, int light, boolean shade) { + drawPaint(overlay.quads(), tile, buffer, pose, light, shade); + } + + static void drawPaint(Iterable faces, PaintAtlas.Tile tile, VertexConsumer buffer, PoseStack.Pose pose, int light, boolean shade) { tile.page().upload(); Vector3f transformed = new Vector3f(); - for (Mesh.Quad quad : overlay.quads()) { + for (Mesh.Quad quad : faces) { for (int v = 0; v < 4; v++) { float u = (tile.x() + quad.u[v]) / PaintAtlas.SIZE; float t = (tile.y() + quad.v[v]) / PaintAtlas.SIZE; diff --git a/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java b/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java index b34e427..ea07180 100644 --- a/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java +++ b/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java @@ -10,6 +10,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.core.Direction; +import net.minecraft.world.phys.Vec3; import java.util.ArrayList; import java.util.List; import net.modcrafters.minecraft.primalpottery.pottery.PlatterSegments; @@ -73,6 +75,31 @@ void platterMarksStayOnTheLipAtTheSixServingBoundariesAndSampleOnlyClay() { } } + @Test + void placedFacesUseTheWindingOfBothTriangles() { + var mesh = new Mesh(); + mesh.boxFace(0, 0, 0, 2, 2, 0, Direction.SOUTH, Mesh.Texture.FIRED_CLAY); + var quad = mesh.quads().getFirst(); + quad.z[3] = 2; // The second triangle now faces sideways as well as forward. + var faces = mesh.placedFaces(); + assertSame(quad, faces.visibleFrom(new Vec3(1, 1, 4)).iterator().next()); + assertTrue(faces.visibleFrom(new Vec3(8, 1, -1)).iterator().hasNext()); + assertFalse(faces.visibleFrom(new Vec3(1, 1, -4)).iterator().hasNext()); + } + + @Test + void repeatedCornerOnARimFacetDoesNotHideItsVisibleTriangle() { + var mesh = new Mesh(); + mesh.boxFace(0, 0, 0, 2, 2, 0, Direction.SOUTH, Mesh.Texture.FIRED_CLAY); + var quad = mesh.quads().getFirst(); + quad.x[3] = quad.x[2]; + var faces = mesh.placedFaces(); + for (double z : new double[]{0, 1}) { + assertSame(quad, faces.visibleFrom(new Vec3(1, 1, z)).iterator().next()); + } + assertFalse(faces.visibleFrom(new Vec3(1, 1, -1)).iterator().hasNext()); + } + @Test void firedMeshesShareGeometryAcrossDesignsAndKeepPositionsSeparate() { Pottery jug = Pottery.jug(); From 67a35ece69c99c103b74dcb9e81770d4a52766f9 Mon Sep 17 00:00:00 2001 From: Face o' Cat Date: Wed, 2 Dec 2026 21:27:05 +0200 Subject: [PATCH 11/11] Keep grazing pottery faces visible during camera bobbing Co-authored-by: Face of Cat --- .../minecraft/primalpottery/client/PlacedFaces.java | 4 +++- .../minecraft/primalpottery/client/MeshTest.java | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlacedFaces.java b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlacedFaces.java index a0b98b4..d97d1fc 100644 --- a/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlacedFaces.java +++ b/src/main/java/net/modcrafters/minecraft/primalpottery/client/PlacedFaces.java @@ -7,6 +7,8 @@ /** Face planes for the back-face-culled render pass of a finished, placed pot. */ final class PlacedFaces { + // Camera bobbing shifts the projected eye by up to 0.1 blocks after the camera position is read. + private static final double EYE_MARGIN = 4.0; // 1/8 block in the mesh's 32 units per block. private final Face[] faces; PlacedFaces(List quads) { @@ -53,7 +55,7 @@ static Plane triangle(Mesh.Quad q, int b, int c) { Vec3 origin = corner(q, 0); Vec3 normal = corner(q, b).subtract(origin).cross(corner(q, c).subtract(origin)); // Keep grazing faces. A zero-area triangle has no fragments from either side. - double offset = -normal.dot(origin) + 1e-4 * normal.length(); + double offset = -normal.dot(origin) + EYE_MARGIN * normal.length(); return new Plane(normal.x, normal.y, normal.z, offset); } diff --git a/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java b/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java index ea07180..5bf0911 100644 --- a/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java +++ b/src/test/java/net/modcrafters/minecraft/primalpottery/client/MeshTest.java @@ -83,8 +83,8 @@ void placedFacesUseTheWindingOfBothTriangles() { quad.z[3] = 2; // The second triangle now faces sideways as well as forward. var faces = mesh.placedFaces(); assertSame(quad, faces.visibleFrom(new Vec3(1, 1, 4)).iterator().next()); - assertTrue(faces.visibleFrom(new Vec3(8, 1, -1)).iterator().hasNext()); - assertFalse(faces.visibleFrom(new Vec3(1, 1, -4)).iterator().hasNext()); + assertTrue(faces.visibleFrom(new Vec3(20, 1, -9)).iterator().hasNext()); + assertFalse(faces.visibleFrom(new Vec3(1, 1, -12)).iterator().hasNext()); } @Test @@ -94,10 +94,10 @@ void repeatedCornerOnARimFacetDoesNotHideItsVisibleTriangle() { var quad = mesh.quads().getFirst(); quad.x[3] = quad.x[2]; var faces = mesh.placedFaces(); - for (double z : new double[]{0, 1}) { + for (double z : new double[]{-3.2, 0, 1}) { assertSame(quad, faces.visibleFrom(new Vec3(1, 1, z)).iterator().next()); } - assertFalse(faces.visibleFrom(new Vec3(1, 1, -1)).iterator().hasNext()); + assertFalse(faces.visibleFrom(new Vec3(1, 1, -5)).iterator().hasNext()); } @Test