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

- name: Verify reproducible release archives
id: release_archives
shell: bash
run: |
set -euo pipefail
Expand All @@ -170,6 +171,9 @@ jobs:
)
./gradlew "${gradle_args[@]}"
cmp "$RUNNER_TEMP/first-SHA256SUMS" build/release/SHA256SUMS
version="$(sed -n 's/^mod_version=//p' gradle.properties)"
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]
echo "version=$version" >> "$GITHUB_OUTPUT"

- name: Upload audited release candidate
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
Expand All @@ -178,9 +182,9 @@ jobs:
if-no-files-found: error
retention-days: 30
path: |
build/libs/BaseMetals-2.6.2.112021.jar
build/libs/BaseMetals-2.6.2.112021-sources.jar
build/libs/BaseMetals-2.6.2.112021-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 @@
Base Metals 2.6.3.112021 — Minecraft 1.12.2

- Brought KiriCattus's ore overlays to Minecraft 1.12.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.

Base Metals 2.6.2.112021 — Minecraft 1.12.2

- Updated to OreSpawn 4.1.6.112021. Install it on both the client and server.
Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ Base Metals adds metals, alloys, equipment, building blocks, and the crackhammer
Crush ores into powder, smelt the powder into ingots, or combine it into alloy
blends. The metals also work with supported processing and tool-building mods.

This branch builds **2.6.2.112021** for Minecraft 1.12.2 and Forge. I've
updated OreSpawn support so saved ore settings carry over when you move an
older world. This update also fixes shallow molten metal not burning on
contact and gives players a clear message if their Fantasy Level doesn't
match the server's. See the [changelog](CHANGELOG.txt) for the details.
Version **2.6.3.112021** brings the ore overlays from newer versions of
Base Metals to Minecraft 1.12.2. Ores now match your resource pack's rock
textures. You can update an existing world without changing where ores spawn.
See the [changelog](CHANGELOG.txt) for what's changed.

## Installation

Expand Down Expand Up @@ -61,6 +60,11 @@ End. Copper, Silver, Tin, Lead, Zinc, Mercury, Nickel, and Platinum generate
in ordinary dimensions. Antimony and Bismuth ore blocks are available, but
they do not generate by default. Aquarium and Mithril are alloys, not ores.

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

Make alloys by combining powders in a crafting grid and smelting the resulting
blend. For example, Bronze uses Copper and Tin; Steel uses Iron and carbon.
Vanilla Bits adds useful forms for vanilla materials, such as Iron powder,
Expand Down Expand Up @@ -144,11 +148,13 @@ toolchain and dependency versions are recorded in `gradle.properties`.

`prepareEclipse` creates client and server launches with processed resources
and keeps optional compile-only mods and test code out of normal launches.
After updating an existing Eclipse project, use **Gradle → Refresh Gradle
Project** so Eclipse picks up the generated ore models.
The [build-script guide](gradle/README.md) explains the supporting scripts.
The [release guide](docs/releasing.md) covers publication from the MMD Actions tab.

Release artifacts use the Maven coordinates
`zone.moddev.mc.basemetals:BaseMetals:2.6.2.112021`. Java packages remain under
`zone.moddev.mc.basemetals:BaseMetals:2.6.3.112021`. Java packages remain under
`com.mcmoddev.basemetals`; this release does not move saved registry names.

Report bugs through the [issue tracker](https://github.com/MinecraftModDevelopmentMods/BaseMetals/issues).
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ repositories {
}

apply from: 'gradle/dependencies.gradle'
apply from: 'gradle/ore-models.gradle'
apply from: 'gradle/data/recipe-advancements.gradle'
apply from: 'gradle/data/gameplay-advancements.gradle'

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.parallel=false
net.minecraftforge.gradle.merge-source-sets=false

mod_group=zone.moddev.mc.basemetals
mod_version=2.6.2.112021
mod_version=2.6.3.112021

# Generic release-dispatcher metadata.
minecraft_version=1.12.2
Expand Down
10 changes: 10 additions & 0 deletions gradle/ide/eclipse.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import groovy.xml.XmlSlurper

// Eclipse support repairs ForgeGradle's generated launches without changing product dependencies.
idea {
module {
Expand Down Expand Up @@ -184,6 +186,14 @@ tasks.register('verifyEclipseProductionClasspath') {
|| eclipseClasspath ==~ /(?s).*<classpathentry[^>]+path="[A-Za-z]:[\\\/].*/) {
throw new GradleException('Eclipse must expose dependencies through the Buildship container only')
}
File generatedOreModels = tasks.named('generateOreModels').get().outputs.files.singleFile
String oreModelSource = project.relativePath(generatedOreModels).replace('\\', '/')
def classpathEntries = new XmlSlurper().parseText(eclipseClasspath).classpathentry
if (!classpathEntries.any { entry ->
entry.@kind.text() == 'src' && entry.@path.text() == oreModelSource && entry.@output.text() == 'bin/main'
}) {
throw new GradleException("Eclipse must copy the generated ore models from ${oreModelSource} into bin/main")
}
List<File> runtimeArchives = configurations.runtimeClasspath.files.collect {
it.canonicalFile
}
Expand Down
114 changes: 114 additions & 0 deletions gradle/ore-models.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
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}")
}
}
}

// Eclipse copies these models into bin/main just like the other game resources.
sourceSets.main.resources.srcDir(generateOreModels)

['genEclipseRuns', 'eclipseClasspath'].each { taskName ->
tasks.named(taskName) { dependsOn generateOreModels }
}

def processResources = tasks.named('processResources', ProcessResources)

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 }
7 changes: 7 additions & 0 deletions gradle/release/artifacts.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ tasks.register('verifyReleaseArtifacts') {
List<String> generatedRecipeAdvancements = currentInventory.findAll { String entry ->
entry ==~ /assets\/basemetals\/advancements\/recipes\/materials\/[^\/]+\/[^\/]+\.json/
}
allowedAddedEntries.addAll([
'com/mcmoddev/basemetals/block/OverlayOreBlock.class',
'assets/basemetals/models/block/ore_overlay.json'
])
allowedAddedEntries.addAll(project.baseMetalsOreOverlayIds.collect {
"assets/basemetals/textures/blocks/ore_overlays/${it}.png".toString()
})
allowedAddedEntries.addAll([
'this_is_new', 'blocktastic', 'geologist', 'metallurgy',
'aquarium_maker', 'brass_maker', 'bronze_maker', 'cupronickel_maker',
Expand Down
4 changes: 2 additions & 2 deletions gradle/verification/support.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ tasks.register('verifyReleaseConfiguration') {
description = 'Validates the complete Base Metals 1.12 release identity and dependency contract.'
dependsOn tasks.named('verifyReleaseToolchains')
doLast {
if (project.mod_version != '2.6.2.112021'
if (project.mod_version != '2.6.3.112021'
|| project.minecraft_version != '1.12.2'
|| project.forge_version != '14.23.5.2859'
|| project.mappings_channel != 'stable'
Expand Down Expand Up @@ -130,7 +130,7 @@ tasks.register('verifyReleaseConfiguration') {
throw new GradleException('Unexpected published OreSpawn 4.1 CurseForge artifact identity')
}
String source = file('src/main/java/com/mcmoddev/basemetals/BaseMetals.java').getText('UTF-8')
if (!source.contains('VERSION = "2.6.2.112021"')
if (!source.contains('VERSION = "2.6.3.112021"')
|| !source.contains('certificateFingerprint = ""')
|| !source.contains("required-after:orespawn@[${project.orespawn4_version},5.0.0)")) {
throw new GradleException('Base Metals source version or unsigned fingerprint contract drifted')
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mcmoddev/basemetals/BaseMetals.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public final class BaseMetals {
protected static final String NAME = "Base Metals";

/** Release version in the shared MMD major.minor.patch.target format. */
protected static final String VERSION = "2.6.2.112021";
protected static final String VERSION = "2.6.3.112021";

protected static final String UPDATEJSON = SharedStrings.UPDATE_JSON_URL
+ "BaseMetals/master/update.json";
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/mcmoddev/basemetals/block/OverlayOreBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.mcmoddev.basemetals.block;

import com.mcmoddev.lib.block.BlockMMDOre;
import com.mcmoddev.lib.material.MMDMaterial;
import net.minecraft.util.BlockRenderLayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

/** Lets the rock show through the ore texture's transparent pixels. */
public final class OverlayOreBlock extends BlockMMDOre {
public OverlayOreBlock(final MMDMaterial material) {
super(material);
}

@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT_MIPPED;
}
}
21 changes: 19 additions & 2 deletions src/main/java/com/mcmoddev/basemetals/init/Blocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.google.common.collect.ImmutableList;
import com.mcmoddev.basemetals.BaseMetals;
import com.mcmoddev.basemetals.block.OverlayOreBlock;
import com.mcmoddev.basemetals.data.MaterialNames;
import com.mcmoddev.lib.block.BlockHumanDetector;
import com.mcmoddev.lib.data.Names;
Expand All @@ -13,6 +14,7 @@
import com.mcmoddev.lib.init.ItemGroups;
import com.mcmoddev.lib.init.Materials;
import com.mcmoddev.lib.material.MMDMaterial;
import com.mcmoddev.lib.util.Oredicts;

import net.minecraft.block.Block;
import net.minecraftforge.common.MinecraftForge;
Expand Down Expand Up @@ -46,7 +48,7 @@ public static void init(final MMDLibRegisterBlocks event) {

create(Names.BLOCK, material);
create(Names.PLATE, material);
create(Names.ORE, material);
createOre(material);
create(Names.BARS, material);
create(Names.DOOR, material);
create(Names.TRAPDOOR, material);
Expand Down Expand Up @@ -79,14 +81,29 @@ private static void createMercury() {
if (Materials.hasMaterial(MaterialNames.MERCURY)) {
final MMDMaterial mercury = Materials.getMaterialByName(MaterialNames.MERCURY);

create(Names.ORE, mercury);
createOre(mercury);

if (mercury.hasBlock(Names.ORE)) {
mercury.getBlock(Names.ORE).setHardness(3.0f).setResistance(5.0f);
}
}
}

private static void createOre(final MMDMaterial material) {
if (!material.hasOre() || material.hasBlock(Names.ORE) || !isNameEnabled(Names.ORE)) {
return;
}

final Block ore = addBlock(new OverlayOreBlock(material), Names.ORE, material,
ItemGroups.getTab(SharedStrings.TAB_BLOCKS));
material.addNewBlock(Names.ORE, ore);

final String prefix = getOredictFromName(Names.ORE);
if (prefix != null) {
Oredicts.registerOre(prefix + material.getCapitalizedName(), ore);
}
}

/** Adds the previously created blocks to Forge's block registry. */
@SubscribeEvent
public static void registerBlocks(final RegistryEvent.Register<Block> event) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/mcmoddev/basemetals/init/Items.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

import com.google.common.collect.ImmutableList;
import com.mcmoddev.basemetals.BaseMetals;
import com.mcmoddev.basemetals.block.OverlayOreBlock;
import com.mcmoddev.basemetals.data.MaterialNames;
import com.mcmoddev.basemetals.items.ItemBaseMetalsArrow;
import com.mcmoddev.basemetals.items.ItemBaseMetalsBolt;
import com.mcmoddev.basemetals.items.ItemBaseMetalsBow;
import com.mcmoddev.basemetals.items.ItemBaseMetalsCrossbow;
import com.mcmoddev.basemetals.items.ItemBaseMetalsHoe;
import com.mcmoddev.lib.block.BlockMMDOre;
import com.mcmoddev.lib.data.Names;
import com.mcmoddev.lib.data.SharedStrings;
import com.mcmoddev.lib.events.MMDLibRegisterItems;
Expand Down Expand Up @@ -38,6 +40,8 @@ private Items() {
/** Creates material forms before Forge opens the item registry. */
@SubscribeEvent
public static void registerItems(MMDLibRegisterItems ev) {
addClassSorting(OverlayOreBlock.class, BlockMMDOre.class);

final List<String> materials = Arrays.asList(MaterialNames.ADAMANTINE,
MaterialNames.ANTIMONY, MaterialNames.AQUARIUM, MaterialNames.BISMUTH,
MaterialNames.BRASS, MaterialNames.BRONZE, MaterialNames.COLDIRON,
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading