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
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,16 @@ jobs:
cp build/release/SHA256SUMS "$RUNNER_TEMP/first-SHA256SUMS"

- name: Verify the prepared release bundle
id: release_archives
shell: bash
run: |
set -euo pipefail
version="$(sed -n 's/^mod_version=//p' gradle.properties)"
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]
echo "version=$version" >> "$GITHUB_OUTPUT"
bundle="$RUNNER_TEMP/release-input"
mkdir -p "$bundle"
cp build/libs/BaseMetals-2.6.0.110021{,-sources,-javadoc}.jar "$bundle/"
cp "build/libs/BaseMetals-$version"{,-sources,-javadoc}.jar "$bundle/"
cp build/release/SHA256SUMS CHANGELOG.txt "$bundle/"
./gradlew verifyPreparedReleaseArtifacts verifyMavenCoordinates \
-PpreparedReleaseDir="$bundle" \
Expand Down Expand Up @@ -204,9 +208,9 @@ jobs:
if-no-files-found: error
retention-days: 30
path: |
build/libs/BaseMetals-2.6.0.110021.jar
build/libs/BaseMetals-2.6.0.110021-sources.jar
build/libs/BaseMetals-2.6.0.110021-javadoc.jar
build/libs/BaseMetals-${{ steps.release_archives.outputs.version }}.jar
build/libs/BaseMetals-${{ steps.release_archives.outputs.version }}-sources.jar
build/libs/BaseMetals-${{ steps.release_archives.outputs.version }}-javadoc.jar
build/release/SHA256SUMS
CHANGELOG.txt

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2.6.1.110021 for 1.10.2

- Brought KiriCattus's ore overlays to Minecraft 1.10.2. If your resource
pack changes stone, netherrack or end stone, Base Metals ores now match
the surrounding rock and keep their ore markings.
- Ore placement and existing worlds are unchanged.

2.6.0.110021 for 1.10.2

- Open Base Metals settings from the Mods list or the OreSpawn cog.
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ OreSpawn handles ore placement and imports old OreSpawn configuration files.
The eleven ore defaults are unchanged. See [ore generation and upgrades](docs/ORE_GENERATION.md)
for configuration locations and advice for existing worlds.

Base Metals ores use your resource pack's stone, netherrack and end stone.
The ore markings are a separate layer, using textures by KiriCattus. Pack
makers can replace those markings in
`assets/basemetals/textures/blocks/ore_overlays/`.

## Configuration

Open **Mods → Base Metals → Config** from the main menu, or use the Base Metals
Expand Down Expand Up @@ -119,7 +124,7 @@ pass. Normal builds and tags do not publish anything.

## Installing

Install Forge and OreSpawn, then put `BaseMetals-2.6.0.110021.jar` in your
Install Forge and OreSpawn, then put `BaseMetals-2.6.1.110021.jar` in your
`mods` folder. Downloads are available on CurseForge and the repository's
Releases page once the version is published.

Expand All @@ -139,7 +144,7 @@ items cannot, by itself, repair those Java references. Base Metal Golems
its eighteen golems use the existing Base Metals blocks and ingots. Neither
add-on needs changing, and neither is required when playing without golems.

This release uses version `2.6.0.110021`. The final six digits identify Minecraft
This release uses version `2.6.1.110021`. The final six digits identify Minecraft
1.10.2 on Forge, following the same version format as the newer branches.
The mod ID, saved block and item names, resources and configuration names remain
`basemetals`; moving the Java packages does not rename anything in your world.
Expand All @@ -149,7 +154,7 @@ The mod ID, saved block and item names, resources and configuration names remain

New integrations should use `zone.moddev.mc.basemetals.init` for materials,
blocks and items. Maven builds use
`zone.moddev.mc.basemetals:BaseMetals:2.6.0.110021`. Crack Hammer recipes still
`zone.moddev.mc.basemetals:BaseMetals:2.6.1.110021`. Crack Hammer recipes still
use `com.mcmoddev.lib.registry.CrusherRecipeRegistry`; the bundled library API
has not moved.

Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ repositories {
}

apply from: 'gradle/dependencies.gradle'
apply from: 'gradle/ore-models.gradle'
renamer.mappings.from minecraft.dependency.toSrgFile

tasks.named('processResources', ProcessResources) {
Expand Down
4 changes: 2 additions & 2 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ transformed copies cannot retain a valid signature for the original bytes.
gradlew clean check build javadoc verifyReleaseArtifacts writeReleaseChecksums prepareEclipse
```

The installable jar is `build/libs/BaseMetals-2.6.0.110021.jar`. Sources,
The installable jar is `build/libs/BaseMetals-2.6.1.110021.jar`. Sources,
Javadocs are written alongside it; checksums are in `build/release/SHA256SUMS`. The mapped development jar
is kept separately under `build/libs-dev`; it is not the jar to install in a
normal Minecraft instance. Building never uploads anything.
Expand Down Expand Up @@ -80,7 +80,7 @@ with `-PpackagedForgeRuntimeRoot=<server-directory>`. Python 3 needs `nbtlib`
keep a failed run before cleaning the build directory.

The shared **Release Base Metals** workflow lives on the repository's default
branch. Version `2.6.0.110021` selects `master-1.10.2`; it requires successful
branch. Version `2.6.1.110021` selects `master-1.10.2`; it requires successful
CI for the exact source commit and explicit publication confirmation. It builds
one candidate, then publishes those same files to MMD Maven, CurseForge and
GitHub, in that order. A tag alone only validates the candidate.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mappings_version=29-1.10.2

mod_id=basemetals
mod_group=zone.moddev.mc.basemetals
mod_version=2.6.0.110021
mod_version=2.6.1.110021
mod_artifact=BaseMetals
loader_name=forge
loader_code=1
Expand Down
115 changes: 115 additions & 0 deletions gradle/ore-models.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import groovy.json.JsonOutput
import groovy.json.JsonSlurper

import javax.imageio.ImageIO

// KiriCattus's two-layer model uses the legacy texture paths on these Forge versions.
def hosts = [
adamantine_ore: 'netherrack', antimony_ore: 'stone', bismuth_ore: 'stone',
coldiron_ore: 'netherrack', copper_ore: 'stone', lead_ore: 'stone',
mercury_ore: 'stone', nickel_ore: 'stone', platinum_ore: 'stone',
silver_ore: 'stone', starsteel_ore: 'end_stone', tin_ore: 'stone', zinc_ore: 'stone'
].asImmutable()
ext.baseMetalsOreOverlayIds = hosts.keySet().toList().asImmutable()

def assets = layout.projectDirectory.dir('src/main/resources/assets/basemetals')
def textures = assets.dir('textures/blocks/ore_overlays')
def overlayFiles = fileTree(textures) { include '*_ore.png' }
def oreStates = fileTree(assets.dir('blockstates')) { include '*_ore.json' }
def oreItems = fileTree(assets.dir('models/item')) { include '*_ore.json' }
def generated = layout.buildDirectory.dir('generated/ore-models')
def sides = ['down', 'up', 'north', 'south', 'west', 'east']

def cube = { Number from, Number to, String texture ->
def faces = sides.collectEntries { side ->
[(side): [texture: texture, cullface: side, uv: [0, 0, 16, 16]]]
}
[from: [from, from, from], to: [to, to, to], faces: faces]
}

def models = [ore_overlay: [
parent: 'minecraft:block/block',
elements: [cube(0, 16, '#base'), cube(-0.05, 16.05, '#overlay')]
]]
hosts.each { id, host ->
def base = "minecraft:blocks/${host}".toString()
models[id] = [
parent: 'basemetals:block/ore_overlay',
textures: [particle: base, base: base, overlay: "basemetals:blocks/ore_overlays/${id}".toString()]
]
}

def generateOreModels = tasks.register('generateOreModels') {
group = 'build'
description = 'Generates the ore models from KiriCattus’s textures and vanilla rock.'
inputs.files(overlayFiles, oreStates, oreItems).withPathSensitivity(PathSensitivity.RELATIVE)
inputs.property('models', JsonOutput.toJson(models))
outputs.dir(generated)

doLast {
def found = overlayFiles.files.collect { it.name - '.png' }.toSet()
if (found != hosts.keySet()) {
throw new GradleException("Ore textures do not match the model list: missing ${hosts.keySet() - found}, extra ${found - hosts.keySet()}")
}

def json = new JsonSlurper()
hosts.keySet().each { id ->
def state = json.parse(assets.file("blockstates/${id}.json").asFile)
def item = json.parse(assets.file("models/item/${id}.json").asFile)
if (state.variants?.normal?.model != "basemetals:${id}" || item.parent != "basemetals:block/${id}") {
throw new GradleException("The block and item must both use the generated model for ${id}")
}

def image = ImageIO.read(textures.file("${id}.png").asFile)
if (image == null) throw new GradleException("Cannot read the overlay for ${id}")
def alpha = image.getRGB(0, 0, image.width, image.height, null, 0, image.width).collect { it >>> 24 }
if (!alpha.contains(0) || !alpha.any { it >= 128 }) {
throw new GradleException("The overlay for ${id} must show both the ore and the rock behind it")
}
}

def dir = generated.get().dir('assets/basemetals/models/block').asFile
dir.mkdirs()
models.each { id, model ->
new File(dir, "${id}.json").setText(JsonOutput.prettyPrint(JsonOutput.toJson(model)) + '\n', 'UTF-8')
}
dir.listFiles().findAll { it.isFile() && it.name.endsWith('.json') && !models.containsKey(it.name - '.json') }.each {
if (!it.delete()) throw new GradleException("Could not remove stale generated model ${it.name}")
}
}
}

def processResources = tasks.named('processResources', ProcessResources) {
dependsOn generateOreModels
from generated
}

tasks.named('sourcesJar', Jar) {
dependsOn generateOreModels
from generated
}

def verifyOreOverlayModels = tasks.register('verifyOreOverlayModels') {
group = 'verification'
description = 'Checks that the processed block and item resources use the generated ore overlays.'
dependsOn processResources

doLast {
def root = new File(processResources.get().destinationDir, 'assets/basemetals')
def json = new JsonSlurper()
models.each { id, expected ->
def path = new File(root, "models/block/${id}.json")
if (!path.isFile() || json.parse(path) != expected) {
throw new GradleException("Missing or incorrect processed ore model: ${id}")
}
}
hosts.keySet().each { id ->
def packaged = new File(root, "textures/blocks/ore_overlays/${id}.png")
if (!packaged.isFile() || !Arrays.equals(packaged.bytes, textures.file("${id}.png").asFile.bytes)) {
throw new GradleException("Missing or changed processed ore overlay: ${id}")
}
}
}
}

tasks.named('check') { dependsOn verifyOreOverlayModels }
2 changes: 1 addition & 1 deletion gradle/release/artifacts.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ tasks.register('verifyReleaseConfiguration') {
group = 'verification'
dependsOn tasks.named('verifyJava8Toolchain')
doLast {
if (project.group != 'zone.moddev.mc.basemetals' || project.version != '2.6.0.110021'
if (project.group != 'zone.moddev.mc.basemetals' || project.version != '2.6.1.110021'
|| project.minecraft_version != '1.10.2' || project.forge_version != '12.18.3.2511'
|| project.mappings_channel != 'stable' || project.mappings_version != '29-1.10.2') {
throw new GradleException('Base Metals target, mappings or Maven identity changed.')
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/mcmoddev/lib/block/BlockMMDOre.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Random;

import zone.moddev.mc.basemetals.BaseMetals;
import zone.moddev.mc.basemetals.data.MaterialNames;
import com.mcmoddev.lib.data.Names;
import com.mcmoddev.lib.init.Materials;
Expand All @@ -12,8 +13,12 @@
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

/**
* Ore Block.
Expand Down Expand Up @@ -57,6 +62,19 @@ public BlockMMDOre(final MMDMaterial material, final boolean isSoft) {
this.setHarvestLevel(tool, this.material.getRequiredHarvestLevel());
}

@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() {
final ResourceLocation id = getRegistryName();

if (id != null && BaseMetals.MODID.equals(id.getResourceDomain())
&& id.getResourcePath().equals(material.getName() + "_ore")) {
return BlockRenderLayer.CUTOUT_MIPPED;
}

return super.getBlockLayer();
}

@Override
public int getExpDrop(final IBlockState bs, final IBlockAccess w, final BlockPos coord,
final int i) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/zone/moddev/mc/basemetals/BaseMetals.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class BaseMetals {
/**
* Major.Minor.Patch.Target, where 110021 means Minecraft 1.10.2 on Forge.
*/
public static final String VERSION = "2.6.0.110021";
public static final String VERSION = "2.6.1.110021";

protected static final String UPDATEJSON = SharedStrings.UPDATE_JSON_URL
+ "BaseMetals/master/update.json";
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void started(final FMLServerStartedEvent event) throws Exception {
}

private static void checkWorld(final MinecraftServer server) {
final String expectedVersion = System.getProperty("launch.expectedVersion", "2.6.0.110021");
final String expectedVersion = System.getProperty("launch.expectedVersion", "2.6.1.110021");
require(expectedVersion.equals(Loader.instance().getIndexedModList().get("basemetals").getVersion()), "Wrong Base Metals version");
require(Loader.isModLoaded("orespawn"), "The ordinary launch did not load OreSpawn");
for (final String optional : new String[]{"tconstruct", "ic2", "cofhcore", "Mekanism", "taiga", "golems_metal"}) {
Expand Down
2 changes: 1 addition & 1 deletion tools/validation/legacy110/run_ci_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def main():
downloads = args.output / "downloads"
downloads.mkdir()
jars = {name: download(downloads, name) for name in RELEASES}
mod = ROOT / "build/libs/BaseMetals-2.6.0.110021.jar"
mod = ROOT / "build/libs/BaseMetals-2.6.1.110021.jar"
probes = ROOT / "build/test-mods"
molten = args.output / "molten-contact"
prepare(molten, args.template, [mod, jars["orespawn"], probes / "launch-probe-packaged.jar"])
Expand Down
Loading