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.5.1.111021{,-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.5.1.111021.jar
build/libs/BaseMetals-2.5.1.111021-sources.jar
build/libs/BaseMetals-2.5.1.111021-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.5.2.111021 for 1.11.2

- Brought KiriCattus's ore overlays to Minecraft 1.11.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.5.1.111021 for 1.11.2

This update brings the newer Base Metals features to 1.11.2. It requires
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Adamantine in the Nether, and Star Steel in the End.
Install Forge `13.20.1.2588` or later and
[MMD OreSpawn `4.1.6.111021`](https://www.curseforge.com/minecraft/mc-mods/mmd-orespawn/files/9524249)
or a newer compatible 4.x release for Minecraft 1.11.2. Put the OreSpawn and
`BaseMetals-2.5.1.111021.jar` files in your `mods` folder.
`BaseMetals-2.5.2.111021.jar` files in your `mods` folder.

If you're updating an existing world, back up the world and the `config` folder
first. Replace Base Metals and OreSpawn together, but keep your old OreSpawn
Expand All @@ -21,6 +21,11 @@ Metals ore placement, and the eleven default rules haven't changed. Check
[the ore generation guide](docs/ORE_GENERATION.md) before exploring new chunks,
especially if your pack changes where vanilla ores spawn.

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/`.

## Using the Crack Hammer

Break an ore block with a Crack Hammer to get two piles of powder. Smelt the
Expand Down Expand Up @@ -63,7 +68,7 @@ tests. The source for this version is on `master-1.11.2`.

New integrations should use `zone.moddev.mc.basemetals.init` for materials,
blocks and items. The Maven coordinate is
`zone.moddev.mc.basemetals:BaseMetals:2.5.1.111021`. Crack Hammer recipes still
`zone.moddev.mc.basemetals:BaseMetals:2.5.2.111021`. Crack Hammer recipes still
use `com.mcmoddev.lib.registry.CrusherRecipeRegistry`.

Existing add-ons can still use the old `com.mcmoddev.basemetals` class names.
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
6 changes: 3 additions & 3 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.5.1.111021.jar`. Sources,
The installable jar is `build/libs/BaseMetals-2.5.2.111021.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 @@ -85,7 +85,7 @@ does not duplicate its ore rules. They also exercise the vanilla-ore switch,
molten metal contact and the Modern Metals add-on.

The shared **Release Base Metals** workflow lives on the repository's default
branch. Version `2.5.1.111021` selects `master-1.11.2`; it requires successful
branch. Version `2.5.2.111021` selects `master-1.11.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 All @@ -105,5 +105,5 @@ point. The verification jars are under `build/test-mods`; don't install them in
a regular instance.

For add-on development, use
`zone.moddev.mc.basemetals:BaseMetals:2.5.1.111021`. The public material and
`zone.moddev.mc.basemetals:BaseMetals:2.5.2.111021`. The public material and
recipe types under `com.mcmoddev.lib` are still bundled in Base Metals.
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=32-1.11

mod_id=basemetals
mod_group=zone.moddev.mc.basemetals
mod_version=2.5.1.111021
mod_version=2.5.2.111021
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.5.1.111021'
if (project.group != 'zone.moddev.mc.basemetals' || project.version != '2.5.2.111021'
|| project.minecraft_version != '1.11.2' || project.forge_version != '13.20.1.2588'
|| project.mappings_channel != 'stable' || project.mappings_version != '32-1.11') {
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 111021 means Minecraft 1.11.2 on Forge.
*/
public static final String VERSION = "2.5.1.111021";
public static final String VERSION = "2.5.2.111021";

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 @@ -66,7 +66,7 @@ public void started(final FMLServerStartedEvent event) throws Exception {
}

private static void checkWorld(final MinecraftServer server) {
final String expectedVersion = System.getProperty("launch.expectedVersion", "2.5.1.111021");
final String expectedVersion = System.getProperty("launch.expectedVersion", "2.5.2.111021");
require(expectedVersion.equals(Loader.instance().getIndexedModList().get("basemetals").getVersion()), "Wrong Base Metals version");
require(Loader.isModLoaded("orespawn"), "The ordinary launch did not load OreSpawn");
final boolean modernMetals = Loader.isModLoaded("modernmetals");
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 @@ -120,7 +120,7 @@ def main():
downloads = args.output / "downloads"
downloads.mkdir()
jars = {name: download(downloads, name) for name in RELEASES}
mod = ROOT / "build/libs/BaseMetals-2.5.1.111021.jar"
mod = ROOT / "build/libs/BaseMetals-2.5.2.111021.jar"
probes = ROOT / "build/test-mods"

def script(name, *arguments):
Expand Down
Loading