Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
echo "minecraft_version=$(value minecraft_version)" >> "$GITHUB_OUTPUT"
echo "gradle_java_version=$(value gradle_java_version)" >> "$GITHUB_OUTPUT"
echo "artifact_prefix=SkysBuildingPieces-$(value mod_version)" >> "$GITHUB_OUTPUT"
echo "grass_source_mode=$(sed -n 's/^source.mode=//p' gradle/grass-slabs-release.properties)" >> "$GITHUB_OUTPUT"
echo "grass_source_commit=$(sed -n 's/^source.commit=//p' gradle/grass-slabs-release.properties)" >> "$GITHUB_OUTPUT"

- name: Install target Java toolchain
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
Expand Down Expand Up @@ -66,12 +68,30 @@ jobs:
- name: Make the wrapper executable
run: chmod +x ./gradlew

- name: Check out the pinned Grass Slabs source
if: steps.target.outputs.grass_source_mode == 'checkout'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: MinecraftModDevelopmentMods/SkysGrassSlabs
ref: ${{ steps.target.outputs.grass_source_commit }}
path: .gradle/content-sources/grass-slabs
persist-credentials: false

- name: Build the pinned Grass Slabs dependency
if: steps.target.outputs.grass_source_mode == 'checkout'
working-directory: .gradle/content-sources/grass-slabs
run: chmod +x ./gradlew && ./gradlew assemble --no-daemon --stacktrace

- name: Build, test, and audit release artifacts
env:
ORG_GRADLE_PROJECT_grassSlabsDirectory: .gradle/content-sources/grass-slabs
run: >-
./gradlew clean check integrationTest build javadoc verifyReleaseArtifacts writeReleaseChecksums
verifyEclipseProductionClasspath --no-daemon --stacktrace

- name: Replay artifact checks offline
env:
ORG_GRADLE_PROJECT_grassSlabsDirectory: .gradle/content-sources/grass-slabs
run: >-
./gradlew assemble verifyReleaseArtifacts writeReleaseChecksums --offline --no-daemon --stacktrace

Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.3.10.112021

- Stop snow layers hovering over bottom slabs, steps, corners and lowered paths.
- Clear old floating snow as the world updates, keeping valid snow on full-height tops.
- Prevent a crash when chunks are unloaded and loaded again quickly.
- Snow-covered steps and corners give the grass beneath them a matching snow cap.
- Grass and dirt pieces pick up snow from higher terraces and exposed cold ground.
- Recipes for different materials, shapes and quantities have separate recipe-book entries.
- Native slab-to-block recipes take precedence when another mod already supplies the same recipe.

## 0.3.9.112021

- Directional slab placement can be turned off from the Mods menu.
- Vanilla items stay in their usual creative tabs.

## 0.3.8.112021

- Added the missing recipe-book unlocks for crafting and rebuilding pieces.
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ Pieces doesn't generate terrain.
pieces; corners are eighth-block pieces.
- Matching pieces can join into supported larger shapes or a full block.
Different materials don't combine.
- Find the pieces, including the vanilla items the mod reuses, in the
**Sky's Building Pieces** creative tab.
- Find the new pieces in the **Sky's Building Pieces** creative tab. Vanilla
pieces stay in their usual tabs.
- To use ordinary horizontal placement for regular slabs, open **Mods → Sky's
Building Pieces → Config** and turn off **Directional slab placement**. Restart
Minecraft after saving.

Walls have lower panels with posts at ends, corners and junctions. A torch or
block above keeps a supporting post. Matching glass walls form a continuous
run, with borders at posts, exposed ends and colour changes.

Dirt and grass steps and corners are included too. Grass follows biome colours,
spreads and decays much like vanilla grass. Plants need a complete upper face.
Snow-covered pieces also give the exposed grass beneath them a snow cap. Snow
appearance follows nearby snow and exposed cold ground, without changing saved
piece orientations.
Use a shovel on an uncovered dirt or grass step or corner to turn it into a
matching path piece. Its footprint stays the same, with a one-pixel lower top.
Flattening a grass piece also turns an ordinary grass block directly beneath
Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ plugins {
id 'net.minecraftforge.gradle' version '7.0.34'
}

apply from: 'gradle/legacy-tools.gradle'

group = project.mod_group
version = project.mod_version
base.archivesName = 'SkysBuildingPieces'
Expand All @@ -34,6 +36,7 @@ ext.functional_version = versionParts[0..2].join('.')
ext.display_version = project.mod_version
ext.release_tag = project.mod_version
def pinnedJava8 = providers.environmentVariable('SBP_JAVA8_HOME')
.orElse(providers.environmentVariable('JAVA_HOME_8_X64'))
// Gradle 9.6.1's ordinary language-level selector prefers the newest cached
// Java 8. This opt-in specific installation keeps local/CI qualification exact.
def exactJava8Spec = pinnedJava8.isPresent() ?
Expand Down
19 changes: 13 additions & 6 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Run Gradle with Java 17. Production code and Minecraft use Java 8; the tested
toolchain is Temurin 8.0.502+7. Use the included Gradle wrapper.

The legacy Forge setup verifies its pinned SpecialSource tool from Maven Central.
Run once online before using an empty build cache offline.

```text
gradlew clean check build javadoc verifyReleaseArtifacts writeReleaseChecksums
gradlew genEclipseRuns eclipse verifyEclipseProductionClasspath
Expand All @@ -19,15 +22,19 @@ the launches after changing dependencies. The generated configuration uses
processed resources and keeps test code out of ordinary game runs.

- `runClient` and `runServer` run Building Pieces on its own.
- `runGrassSlabsClient` and `runGrassSlabsServer` also load the released Grass
- `runGrassSlabsClient` and `runGrassSlabsServer` also load the pinned Grass
Slabs jar recorded in `gradle/grass-slabs-release.properties`.
- `runMineralogyClient` and `runMineralogyServer` use the optional Mineralogy
and OreSpawn jars recorded in `gradle/mineralogy-runtime.properties`.

Each profile has its own game folder. Grass Slabs is downloaded from its public
release, checked against its SHA-256 and mapped to development names. There is
no sibling source build to prepare. The published Grass Slabs jar remains
unchanged, and none of its classes are bundled into Building Pieces.
Each profile has its own game folder. Grass Slabs is checked against its SHA-256
and mapped to development names. This candidate uses Grass Slabs 1.2.0 from the
sibling 1.12 checkout: run `gradlew assemble` there first. Its source commit and
jar checksum must match `gradle/grass-slabs-release.properties`. Use
`-PgrassSlabsDirectory=<checkout>` for another location. CI builds that exact
commit before running these checks. The source jar stays unchanged, and none
of its classes are bundled into Building Pieces. The lock also supports a
published Maven jar when `source.mode=release`.

For the Mineralogy profile, supply the jars named in its lock file, or use
`-PmineralogyRuntimeJar=<jar>` and `-PorespawnRuntimeJar=<jar>` to select matching
Expand All @@ -36,7 +43,7 @@ copies. They must pass the recorded checksums.
## Runtime checks

`check` runs the unit suite and disposable server checks, both standalone and
with the released Grass Slabs jar. `integrationGrassSlabsClientProcess` checks
with the pinned Grass Slabs jar. `integrationGrassSlabsClientProcess` checks
the combined client models. `integrationMineralogyTest` and
`integrationMineralogyClientProcess` cover the optional rock pieces when the
locked native jars are available.
Expand Down
9 changes: 8 additions & 1 deletion docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Configuration

Forge creates `config/skysbuildingpieces.cfg`. Stop the game or server before
editing it, then restart.
editing it, then restart. On the client, the same settings are in
**Mods → Sky's Building Pieces → Config**.

`gameplay.directionalSlabPlacement=true`

Click the centre or edge of a face to choose which way a regular slab sits.
Turn this off for normal horizontal placement, then restart. Existing pieces
and separately crafted vertical slabs keep their shape and behaviour.

`compat.forceReplaceBuildingBricksPieces=false`

Expand Down
9 changes: 7 additions & 2 deletions docs/GAMEPLAY.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# Pieces and recipes

Snow layers need a complete supporting top at full-block height. Lower grass
and dirt pieces use their snow-covered appearance instead. Floating layers left
by an earlier build clear during normal soil ticks or block updates; the piece
and its orientation stay in place.

Mineralogy rock steps and corners are included automatically when Mineralogy
is installed. Three matching full rocks diagonally across the crafting grid
make twelve steps; two steps side by side make four corners. Vertical pairs
rebuild corners into steps and steps into Mineralogy's existing slabs.
Disabled native slab types are not used by recipes or smoothing. The rock
steps and corners remain craftable from full blocks.

Find the pieces in the Sky's Building Pieces creative tab. It includes the
vanilla pieces reused by the catalogue. Separate vertical slab items, old
Find the new pieces in the Sky's Building Pieces creative tab. Reused vanilla
blocks stay in their usual tabs. Separate vertical slab items, old
templates and recovery holders stay hidden.

All custom walls have lower connecting panels and raised posts.
Expand Down
3 changes: 3 additions & 0 deletions docs/INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Sky's Terrain Smoother uses this lookup without depending on palette internals.
Building Pieces never generates terrain itself. It optionally joins Grass
Slabs' grass-form integration, using 1.1.1.112021 or later on Minecraft 1.12.2.
It works without either Grass Slabs or Terrain Smoother installed.
With Grass Slabs 1.2 or later, the mods also share physical snow-form recognition
and calculated snow appearance. Older Grass Slabs versions retain their existing
grass integration; Building Pieces uses its standalone snow rules with them.

Mineralogy is supported directly. Its presence adds 35 fixed rock-piece
palettes during pre-initialization; no add-on or compile-time Mineralogy
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ release_enabled=true
curseforge_project_id=1754162
mod_name=Sky's Building Pieces
mod_license=LGPL-2.1-only
mod_version=0.3.8.112021
mod_version=0.3.10.112021
mod_group=zone.moddev.mc.skysbuildingpieces
mod_authors=SkyBlade1978
mod_description=Extra building shapes for vanilla materials, with built-in Mineralogy support when installed. No world generation.
23 changes: 20 additions & 3 deletions gradle/grass-slabs-release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,35 @@ if (lock.coordinate != "zone.moddev.mc.skysgrassslabs:SkysGrassSlabs:${lock.vers
throw new GradleException('The released Grass Slabs dependency needs its public version and checksum')
}

boolean checkoutSource = lock.getProperty('source.mode', 'release') == 'checkout'
def sourceDirectory = file(providers.gradleProperty('grassSlabsDirectory')
.getOrElse(lock.getProperty('source.directory', '../../SkysGrassSlabs112/SkysGrassSlabs')))
configurations { grassSlabsPublishedRelease { transitive = false } }
dependencies { grassSlabsPublishedRelease lock.coordinate }
def publishedJar = providers.provider { configurations.grassSlabsPublishedRelease.singleFile }
if (!checkoutSource) {
dependencies { grassSlabsPublishedRelease lock.coordinate }
}
def publishedJar = providers.provider {
checkoutSource ? new File(sourceDirectory, "build/libs/SkysGrassSlabs-${lock.version}.jar")
: configurations.grassSlabsPublishedRelease.singleFile
}
def developmentJar = layout.projectDirectory.file(
".gradle/released-content/SkysGrassSlabs-${lock.version}-deobf.jar")
def verifyRelease = tasks.register('verifyGrassSlabsRelease') {
group = 'verification'
description = 'Checks the exact public Grass Slabs jar used by the optional development profile.'
description = 'Checks the exact Grass Slabs jar used by the optional development profile.'
inputs.file publishedJar
inputs.file 'gradle/grass-slabs-release.properties'
doLast {
File source = publishedJar.get()
if (checkoutSource) {
String commit = providers.exec {
workingDir sourceDirectory
commandLine 'git', 'rev-parse', 'HEAD'
}.standardOutput.asText.get().trim()
if (commit != lock.getProperty('source.commit')) {
throw new GradleException('The Grass Slabs source checkout does not match its pinned commit')
}
}
String actual = MessageDigest.getInstance('SHA-256').digest(Files.readAllBytes(source.toPath()))
.encodeHex().toString().toUpperCase(Locale.ROOT)
if (actual != lock.sha256) {
Expand Down
12 changes: 7 additions & 5 deletions gradle/grass-slabs-release.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Public main jar, used only for optional development and integration checks.
version=1.1.2.112021
coordinate=zone.moddev.mc.skysgrassslabs:SkysGrassSlabs:1.1.2.112021
sha256=6F056EA5E4ADCE363D835955967ECC4ECA93A153645A32140DE3FC7655529D9C
source.commit=b2636d8a67efa3f257a8a69293ce513e979010fd
# Released Grass Slabs dependency for development and integration checks.
version=1.2.0.112021
coordinate=zone.moddev.mc.skysgrassslabs:SkysGrassSlabs:1.2.0.112021
sha256=0A92C6A9BF28808F2C55A1A3FC00D08D1CBDA7F4910432A3846A839BE9FB497E
source.commit=2780de0ef41fbf7e2ab8336e76c4a4b60919716a
source.mode=checkout
source.directory=../../SkysGrassSlabs112/SkysGrassSlabs
58 changes: 58 additions & 0 deletions gradle/legacy-tools.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import java.nio.file.Files
import java.nio.file.StandardCopyOption
import java.security.MessageDigest
import java.util.jar.JarFile

// The old MCP download URL can return HTML. Use the identical, pinned tool from Maven Central.
def toolSha256 = '9105207CC68FBBA768B314FA8584F7C63DE2CF664F1FD50AAAB4A386975A88BD'
def toolSha1 = 'a70987737b33a1d828713fb7cec4622455618fd9'
def toolUrl = 'https://repo.maven.apache.org/maven2/net/md-5/SpecialSource/1.8.3/SpecialSource-1.8.3-shaded.jar'
def cacheRoot = providers.gradleProperty('legacyToolCacheRoot').map { file(it) }.getOrElse(
new File(gradle.gradleUserHomeDir, 'caches/minecraftforge/forgegradle/mavenizer'))
def tool = new File(cacheRoot, 'caches/maven/mcp-tools/net/md-5/SpecialSource/1.8.3/SpecialSource-1.8.3-shaded.jar')
def checksum = new File(tool.path + '.sha1')
def digest = { byte[] bytes -> MessageDigest.getInstance('SHA-256').digest(bytes).encodeHex().toString().toUpperCase() }

tool.parentFile.mkdirs()
new RandomAccessFile(new File(tool.parentFile, 'specialsource-bootstrap.lock'), 'rw').withCloseable { lockFile ->
def lock = lockFile.channel.lock()
try {
byte[] existing = tool.isFile() ? tool.bytes : null
if (existing == null || digest(existing) != toolSha256) {
if (gradle.startParameter.offline) {
throw new GradleException('The pinned legacy SpecialSource tool is missing or invalid. Run once online to restore it.')
}
def connection = new URL(toolUrl).openConnection()
connection.connectTimeout = 15000
connection.readTimeout = 30000
byte[] downloaded = connection.inputStream.withCloseable { it.bytes }
if (digest(downloaded) != toolSha256) {
throw new GradleException('The legacy SpecialSource download did not match its pinned SHA-256.')
}
// Preserve a rejected cache entry before replacing only this one tool.
if (existing != null) {
File rejected = new File(projectDir, '.gradle/legacy-tools/rejected/' + digest(existing) + '.jar')
rejected.parentFile.mkdirs()
if (!rejected.exists()) rejected.bytes = existing
}
def temporary = Files.createTempFile(tool.parentFile.toPath(), 'specialsource-', '.tmp')
try {
Files.write(temporary, downloaded)
new JarFile(temporary.toFile()).withCloseable { archive ->
if (archive.manifest.mainAttributes.getValue('Main-Class') != 'net.md_5.specialsource.SpecialSource') {
throw new GradleException('The legacy build tool has no expected entry point.')
}
}
Files.move(temporary, tool.toPath(), StandardCopyOption.REPLACE_EXISTING)
} finally {
Files.deleteIfExists(temporary)
}
logger.lifecycle('Restored the verified legacy SpecialSource build tool from Maven Central.')
}
if (!checksum.isFile() || checksum.getText('UTF-8').trim() != toolSha1) {
checksum.setText(toolSha1, 'UTF-8')
}
} finally {
lock.release()
}
}
5 changes: 5 additions & 0 deletions gradle/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ tasks.register('verifyReleaseBundleContract') {
dependsOn tasks.named('writeReleaseChecksums')
doLast {
File bundle = layout.buildDirectory.dir('release-bundle-test').get().asFile
if (bundle.canonicalFile.parentFile != layout.buildDirectory.get().asFile.canonicalFile) {
throw new GradleException('Release contract output must stay inside the build directory')
}
// A new version must not inherit files from an earlier contract test.
project.delete(bundle)
List<String> filenames = releaseFiles.get().collect { it.toString() }
copy {
from layout.buildDirectory.dir('libs')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ public final class ClientProbe extends ProbeProxy {

public void init() {
if (System.getProperty("skysbuildingpieces.integrationPhase", "").startsWith("client")) {
if (org.lwjgl.opengl.Display.isCreated()) {
org.lwjgl.opengl.Display.setLocation(-10000, -10000);
}
if (org.lwjgl.input.Mouse.isCreated()) {
org.lwjgl.input.Mouse.setGrabbed(false);
}
Minecraft.getMinecraft().getSession().setProperties(new com.mojang.authlib.properties.PropertyMap());
MinecraftForge.EVENT_BUS.register(this);
}
}
Expand Down Expand Up @@ -75,8 +82,8 @@ public void tick(TickEvent.ClientTickEvent event) {
throw new AssertionError("Retired template in mod tab");
}
}
if (!entries.contains("minecraft:wooden_slab:0")) {
throw new AssertionError("Reused oak slab missing from mod tab");
if (entries.stream().anyMatch(key -> key.startsWith("minecraft:"))) {
throw new AssertionError("Vanilla content appears in the Building Pieces tab");
}
if (entries.contains("skysbuildingpieces:legacy_piece_holder:0")) {
throw new AssertionError("Recovery holder in mod tab");
Expand All @@ -89,7 +96,9 @@ public void tick(TickEvent.ClientTickEvent event) {
System.out.println("BUILDING_PIECES_CREATIVE_TAB_PASS entries=" + creative.size());

RecipePreviewModels.check(minecraft);
SnowVisualChecks.run(minecraft);

ConfigScreenChecks.run(minecraft);
int checked = 0;

for (PieceBlock block : Pieces.BLOCKS.values()) {
Expand Down
Loading
Loading