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
8 changes: 8 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2.5.2.113021 for Minecraft 1.13.2

This fixes the ore drops to match 1.10 to 1.12. Lithium drops one ore block; the other six ores drop 2–4 powders. Fortune increases the maximum, and Silk Touch returns the ore block.

The missing lithium and silicon smelting recipes are back, along with block, ingot and nugget crushing. This also restores the earlier mining hardness, tool requirements, blast resistance, storage-block beacon support, molten-fluid light and smith ingot trades.

Eclipse launches now work when the project path contains spaces.

2.5.1.113021 for Minecraft 1.13.2

- Bring the eight minerals and seven ore deposits across to Forge 25, without MMDLib.
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Use 3.0.3.113021 or a later compatible 1.13.2 build when installing the two toge
Base Minerals shares its ore crushing recipes with Base Metals when installed.
If Base Metals is absent, Modern Metals crackhammers can crush the ores instead.

Mining lithium returns one ore block. Niter, phosphorus, potash, salt,
saltpeter and sulfur drop 2–4 powders, with Fortune increasing the upper
limit by its level. Silk Touch returns one ore block. A Crack Hammer gives
two powders per ore, as on the earlier branches.

## Upgrading a world

Copy the whole save folder before opening it on 1.13.2, including level.dat
Expand Down
71 changes: 69 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import groovy.json.JsonSlurper
import groovy.xml.XmlParser
import groovy.xml.XmlUtil
import java.security.MessageDigest

plugins {
Expand All @@ -10,7 +12,7 @@ plugins {
}

group = 'zone.moddev.mc.baseminerals'
version = '2.5.1.113021'
version = project.mod_version
base.archivesName = 'BaseMinerals'

java {
Expand Down Expand Up @@ -139,6 +141,28 @@ tasks.register('verifyPinnedMods') {
tasks.named('compileJava') { dependsOn 'verifyPinnedMods' }
tasks.named('test') { useJUnitPlatform() }

sourceSets {
miningProbe {
java.srcDirs = ['tools/validation/legacy113/mining-probe/java']
resources.srcDirs = ['tools/validation/legacy113/mining-probe/resources']
compileClasspath += sourceSets.main.output + sourceSets.main.compileClasspath
}
}
def miningProbeJar = tasks.register('miningProbeJar', Jar) {
dependsOn tasks.named('miningProbeClasses')
from sourceSets.miningProbe.output
destinationDirectory = layout.buildDirectory.dir('test-mods')
archiveFileName = 'mineral-mining-probe-dev.jar'
}
def packagedMiningProbe = renamer.classes(miningProbeJar) {
map.from minecraft.dependency.toSrgFile
archiveClassifier = null
output = layout.buildDirectory.file('test-mods/mineral-mining-probe.jar')
}
tasks.register('packagedMiningProbeJar') { dependsOn packagedMiningProbe }
// Keep the executable test mod out of Eclipse's normal game launches.
eclipse.classpath.sourceSets = [sourceSets.main, sourceSets.test]

tasks.register('verifyFluidRegistration', Exec) {
group = 'verification'
description = 'Checks that fluid registration runs before blocks, outside parallel construction.'
Expand All @@ -155,7 +179,50 @@ tasks.named('check') { dependsOn 'verifyFluidRegistration' }
}
}
}
tasks.named('eclipse') { dependsOn 'genEclipseRuns', stageRunClasses }
// Eclipse splits bare launcher paths at spaces, unlike Gradle's JavaExec tasks.
def eclipseLauncherPath = ~/(--(?:cache|metadata|to-srg|to-obf) )("[^"]*"|.+?)(?= (?:--metadata |--to-srg |--to-obf |--(?: |$)))/
tasks.matching { it.name.startsWith('genEclipseRun') && it.name.endsWith('ForForge') }.configureEach {
dependsOn stageRunClasses
String launchName = name.replaceFirst('^genEclipseRun', 'run').replaceFirst('ForForge$', '') + '.launch'
File launch = layout.projectDirectory.file(launchName).asFile
doLast {
Node configuration = new XmlParser().parse(launch)
Node programArguments = configuration.stringAttribute.find {
it.attribute('key') == 'org.eclipse.jdt.launching.PROGRAM_ARGUMENTS'
}
String arguments = programArguments.attribute('value')
String quoted = arguments.replaceAll(eclipseLauncherPath) { match, option, path ->
path.startsWith('"') ? match : option + '"' + path + '"'
}
if (quoted != arguments) {
programArguments.attributes().put('value', quoted)
launch.setText(XmlUtil.serialize(configuration), 'UTF-8')
}
}
}
eclipse { synchronizationTasks 'genEclipseRuns' }

tasks.register('verifyEclipseLaunchArguments') {
group = 'verification'
description = 'Checks that generated Eclipse launcher paths stay intact when they contain spaces.'
dependsOn 'genEclipseRuns'
doLast {
['runClient', 'runServer', 'runTestClient', 'runTestServer'].each { name ->
Node launch = new XmlParser().parse(file(name + '.launch'))
String arguments = launch.stringAttribute.find {
it.attribute('key') == 'org.eclipse.jdt.launching.PROGRAM_ARGUMENTS'
}.attribute('value')
['cache', 'metadata', 'to-srg', 'to-obf'].each { flag ->
def path = arguments =~ /(?:^| )--${flag} "([^"]+)"/
if (!path.find() || !file(path.group(1)).exists()) {
throw new GradleException("${name} needs a quoted, existing --${flag} path")
}
}
}
}
}
tasks.named('check') { dependsOn 'verifyEclipseLaunchArguments' }
tasks.named('eclipse') { dependsOn 'verifyEclipseLaunchArguments', stageRunClasses }

tasks.named('processResources', ProcessResources) {
inputs.property 'version', project.version
Expand Down
11 changes: 10 additions & 1 deletion docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,23 @@ checked by SHA-256. It remains optional when playing.
.\gradlew.bat check build genEclipseRuns eclipse "-PlegacyDependencyVerificationRepository=<mirror>"

On a configured machine, add --offline to rebuild from the same cache.
The reobfuscated player jar is build/libs/BaseMinerals-2.5.1.113021.jar.
The reobfuscated player jar is build/libs/BaseMinerals-2.5.2.113021.jar.
Development output lives under build/libs-dev. Sources and Javadocs are separate.

Import the inner checkout as an Eclipse Gradle project. The generated client
and server launch files use the Java 8 game toolchain and staged mod output.
Gradle refresh regenerates them with quoted paths for checkouts containing spaces.
For a terminal launch, use runClient or runServer. Use the published Base Metals
jar with the packaged Forge profile when checking Crack Hammer integration.

The test runners in tools/validation/legacy113 use an independently installed
Forge server template. Install requirements.txt from that directory for the
Anvil and NBT checks.

Build the separate survival-mining test mod with packagedMiningProbeJar, then
run verify_mining.py --help for the packaged-server options. Add --processing
to check furnace and crushing recipes as well. Run with Base Minerals alone,
with Base Metals, with Modern Metals, and with both hammer mods. The probe
checks normal drops, Fortune, Silk Touch, weak tools, hammer drops, block
properties, fluid light and smith offers. Its jar stays under build/test-mods
and must not be installed in a normal game.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ org.gradle.parallel=false
net.minecraftforge.gradle.merge-source-sets=false
minecraft_version=1.13.2
forge_version=25.0.223
mod_version=2.5.1.113021
mod_version=2.5.2.113021
1 change: 1 addition & 0 deletions gradle/release-113.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def audit = { File directory ->
String path = entry.name.toLowerCase(Locale.ROOT)
if (path.contains('agent-notes') || path.contains('agents.md') || path.contains('.codex')
|| path.startsWith('tools/') || path.startsWith('reference/') || path.contains('/testmod/')
|| path.startsWith('test/') || path.contains('mineralminingprobe')
|| path.startsWith('com/mcmoddev/lib/') || path.startsWith('zone/moddev/mc/mmdlib/')
|| path.startsWith('zone/moddev/mc/basemetals/') || path.startsWith('com/mcmoddev/orespawn/')
|| path.startsWith('net/minecraft/') || path.startsWith('org/junit/')) {
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/zone/moddev/mc/baseminerals/BaseMinerals.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import zone.moddev.mc.baseminerals.client.MineralFluidRenderer;
import zone.moddev.mc.baseminerals.recipe.SharedCrushingSerializer;
import zone.moddev.mc.baseminerals.trade.MineralTrades;
import zone.moddev.mc.baseminerals.worldgen.BaseMineralsWorldgenProvider;

@Mod(BaseMinerals.MOD_ID)
Expand All @@ -23,7 +24,10 @@ public BaseMinerals() {
}

private void setup(FMLCommonSetupEvent event) {
DeferredWorkQueue.runLater(() -> RecipeSerializers.register(new SharedCrushingSerializer()));
DeferredWorkQueue.runLater(() -> {
RecipeSerializers.register(new SharedCrushingSerializer());
MineralTrades.register();
});
}

private void enqueueProvider(InterModEnqueueEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlowingFluid;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.fluid.FlowingFluid;
Expand All @@ -16,13 +18,18 @@
import net.minecraft.init.Items;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.IRegistry;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.ForgeRegistries;
import zone.moddev.mc.baseminerals.BaseMinerals;

/** Registry names are kept from the 1.10–1.12 builds. */
Expand Down Expand Up @@ -58,12 +65,12 @@ private static void initializeFluids() {
public static void registerBlocks(RegistryEvent.Register<Block> event) {
initializeFluids();
for (String name : MATERIALS) {
putBlock(event, name + "_block", new MineralBlock(false));
if (!"silicon".equals(name)) putBlock(event, name + "_ore", new MineralBlock(true));
putBlock(event, name + "_block", new MineralBlock(name, false));
if (!"silicon".equals(name)) putBlock(event, name + "_ore", new MineralBlock(name, true));
}
MOLTEN.forEach((name, molten) -> {
molten.block = new BlockFlowingFluid(molten.source, Block.Properties.create(Material.LAVA)
.doesNotBlockMovement().hardnessAndResistance(100.0F).variableOpacity()) {};
.doesNotBlockMovement().hardnessAndResistance(100.0F).lightValue(10).variableOpacity()) {};
putBlock(event, name, molten.block);
});
}
Expand Down Expand Up @@ -109,14 +116,44 @@ static final class Molten {

private static final class MineralBlock extends Block {
private final boolean ore;
private final int harvestLevel;
private final ResourceLocation powder;

MineralBlock(boolean ore) {
super(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 5.0F));
MineralBlock(String material, boolean ore) {
super(properties(material, ore));
this.ore = ore;
this.harvestLevel = isMetal(material) ? 2 : 1;
this.powder = ore && !isMetal(material) ? id(material + "_powder") : null;
}

private static boolean isMetal(String material) {
return "lithium".equals(material) || "silicon".equals(material);
}

private static Block.Properties properties(String material, boolean ore) {
boolean metal = isMetal(material);
float hardness = ore ? 5.0F : metal ? 16.0F : 10.0F;
// The old library stored resistance at five times Minecraft's exposed value.
float resistance = (metal ? 4.0F : 1.0F) * (ore ? 0.75F : 1.0F);
return Block.Properties.create(metal && !ore ? Material.IRON : Material.ROCK)
.sound(metal && !ore ? SoundType.METAL : SoundType.STONE)
.hardnessAndResistance(hardness, resistance);
}

@Override public ToolType getHarvestTool(IBlockState state) { return ToolType.PICKAXE; }
@Override public int getHarvestLevel(IBlockState state) { return 1; }
@Override public int getHarvestLevel(IBlockState state) { return harvestLevel; }
@Override public IItemProvider getItemDropped(IBlockState state, World world, BlockPos pos, int fortune) {
return powder == null ? this : ForgeRegistries.ITEMS.getValue(powder);
}
@Override public int quantityDropped(IBlockState state, Random random) {
return getItemsToDropCount(state, 0, null, BlockPos.ORIGIN, random);
}
@Override public int getItemsToDropCount(IBlockState state, int fortune, World world, BlockPos pos, Random random) {
return powder == null ? 1 : 2 + random.nextInt(3 + fortune);
}
@Override public boolean isBeaconBase(IBlockState state, IWorldReader world, BlockPos pos, BlockPos beacon) {
return !ore;
}
@Override @OnlyIn(Dist.CLIENT)
public BlockRenderLayer getRenderLayer() {
return ore ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/zone/moddev/mc/baseminerals/trade/MineralTrades.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package zone.moddev.mc.baseminerals.trade;

import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.village.MerchantRecipe;
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
import net.minecraftforge.registries.ForgeRegistries;

/** The old shared library offered one ingot for four or five emeralds at smith level two. */
public final class MineralTrades {
private MineralTrades() {}

public static void register() {
VillagerProfession smith = ForgeRegistries.VILLAGER_PROFESSIONS.getValue(
new ResourceLocation("minecraft", "smith"));
for (int career = 1; career <= 3; career++) {
for (String material : new String[] {"lithium", "silicon"}) {
Item ingot = ForgeRegistries.ITEMS.getValue(new ResourceLocation("baseminerals", material + "_ingot"));
smith.getCareer(career).addTrade(2, (merchant, recipes, random) -> recipes.add(
new MerchantRecipe(new ItemStack(Items.EMERALD, 4 + random.nextInt(2)), new ItemStack(ingot))));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "baseminerals:shared_crushing",
"conditions": [
{
"type": "forge:or",
"values": [
{
"type": "forge:mod_loaded",
"modid": "basemetals"
},
{
"type": "forge:mod_loaded",
"modid": "modernmetals"
}
]
}
],
"ingredient": {
"tag": "forge:storage_blocks/lithium"
},
"result": {
"item": "baseminerals:lithium_powder",
"count": 9
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "baseminerals:shared_crushing",
"conditions": [
{
"type": "forge:or",
"values": [
{
"type": "forge:mod_loaded",
"modid": "basemetals"
},
{
"type": "forge:mod_loaded",
"modid": "modernmetals"
}
]
}
],
"ingredient": {
"tag": "forge:ingots/lithium"
},
"result": {
"item": "baseminerals:lithium_powder",
"count": 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "baseminerals:shared_crushing",
"conditions": [
{
"type": "forge:or",
"values": [
{
"type": "forge:mod_loaded",
"modid": "basemetals"
},
{
"type": "forge:mod_loaded",
"modid": "modernmetals"
}
]
}
],
"ingredient": {
"tag": "forge:nuggets/lithium"
},
"result": {
"item": "baseminerals:lithium_smallpowder",
"count": 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "minecraft:smelting",
"ingredient": {
"item": "baseminerals:lithium_ore"
},
"result": "baseminerals:lithium_ingot",
"experience": 0.45,
"cookingtime": 200
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "minecraft:smelting",
"ingredient": {
"item": "baseminerals:lithium_powder"
},
"result": "baseminerals:lithium_ingot",
"experience": 0.45,
"cookingtime": 200
}
Loading
Loading