Skip to content

Commit 6206d8a

Browse files
authored
Fix Base Minerals 1.13 mining drops and Eclipse launches (#45)
Bring the ore drops and processing recipes back into line with the earlier branches, and restore the block properties, molten light and smith trades. Fix Eclipse launches from project folders with spaces. Prepare 2.5.2.113021.
1 parent a10f643 commit 6206d8a

32 files changed

Lines changed: 846 additions & 12 deletions

‎CHANGELOG.txt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2.5.2.113021 for Minecraft 1.13.2
2+
3+
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.
4+
5+
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.
6+
7+
Eclipse launches now work when the project path contains spaces.
8+
19
2.5.1.113021 for Minecraft 1.13.2
210

311
- Bring the eight minerals and seven ore deposits across to Forge 25, without MMDLib.

‎README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ Use 3.0.3.113021 or a later compatible 1.13.2 build when installing the two toge
1414
Base Minerals shares its ore crushing recipes with Base Metals when installed.
1515
If Base Metals is absent, Modern Metals crackhammers can crush the ores instead.
1616

17+
Mining lithium returns one ore block. Niter, phosphorus, potash, salt,
18+
saltpeter and sulfur drop 2–4 powders, with Fortune increasing the upper
19+
limit by its level. Silk Touch returns one ore block. A Crack Hammer gives
20+
two powders per ore, as on the earlier branches.
21+
1722
## Upgrading a world
1823

1924
Copy the whole save folder before opening it on 1.13.2, including level.dat

‎build.gradle‎

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import groovy.json.JsonSlurper
2+
import groovy.xml.XmlParser
3+
import groovy.xml.XmlUtil
24
import java.security.MessageDigest
35

46
plugins {
@@ -10,7 +12,7 @@ plugins {
1012
}
1113

1214
group = 'zone.moddev.mc.baseminerals'
13-
version = '2.5.1.113021'
15+
version = project.mod_version
1416
base.archivesName = 'BaseMinerals'
1517

1618
java {
@@ -139,6 +141,28 @@ tasks.register('verifyPinnedMods') {
139141
tasks.named('compileJava') { dependsOn 'verifyPinnedMods' }
140142
tasks.named('test') { useJUnitPlatform() }
141143

144+
sourceSets {
145+
miningProbe {
146+
java.srcDirs = ['tools/validation/legacy113/mining-probe/java']
147+
resources.srcDirs = ['tools/validation/legacy113/mining-probe/resources']
148+
compileClasspath += sourceSets.main.output + sourceSets.main.compileClasspath
149+
}
150+
}
151+
def miningProbeJar = tasks.register('miningProbeJar', Jar) {
152+
dependsOn tasks.named('miningProbeClasses')
153+
from sourceSets.miningProbe.output
154+
destinationDirectory = layout.buildDirectory.dir('test-mods')
155+
archiveFileName = 'mineral-mining-probe-dev.jar'
156+
}
157+
def packagedMiningProbe = renamer.classes(miningProbeJar) {
158+
map.from minecraft.dependency.toSrgFile
159+
archiveClassifier = null
160+
output = layout.buildDirectory.file('test-mods/mineral-mining-probe.jar')
161+
}
162+
tasks.register('packagedMiningProbeJar') { dependsOn packagedMiningProbe }
163+
// Keep the executable test mod out of Eclipse's normal game launches.
164+
eclipse.classpath.sourceSets = [sourceSets.main, sourceSets.test]
165+
142166
tasks.register('verifyFluidRegistration', Exec) {
143167
group = 'verification'
144168
description = 'Checks that fluid registration runs before blocks, outside parallel construction.'
@@ -155,7 +179,50 @@ tasks.named('check') { dependsOn 'verifyFluidRegistration' }
155179
}
156180
}
157181
}
158-
tasks.named('eclipse') { dependsOn 'genEclipseRuns', stageRunClasses }
182+
// Eclipse splits bare launcher paths at spaces, unlike Gradle's JavaExec tasks.
183+
def eclipseLauncherPath = ~/(--(?:cache|metadata|to-srg|to-obf) )("[^"]*"|.+?)(?= (?:--metadata |--to-srg |--to-obf |--(?: |$)))/
184+
tasks.matching { it.name.startsWith('genEclipseRun') && it.name.endsWith('ForForge') }.configureEach {
185+
dependsOn stageRunClasses
186+
String launchName = name.replaceFirst('^genEclipseRun', 'run').replaceFirst('ForForge$', '') + '.launch'
187+
File launch = layout.projectDirectory.file(launchName).asFile
188+
doLast {
189+
Node configuration = new XmlParser().parse(launch)
190+
Node programArguments = configuration.stringAttribute.find {
191+
it.attribute('key') == 'org.eclipse.jdt.launching.PROGRAM_ARGUMENTS'
192+
}
193+
String arguments = programArguments.attribute('value')
194+
String quoted = arguments.replaceAll(eclipseLauncherPath) { match, option, path ->
195+
path.startsWith('"') ? match : option + '"' + path + '"'
196+
}
197+
if (quoted != arguments) {
198+
programArguments.attributes().put('value', quoted)
199+
launch.setText(XmlUtil.serialize(configuration), 'UTF-8')
200+
}
201+
}
202+
}
203+
eclipse { synchronizationTasks 'genEclipseRuns' }
204+
205+
tasks.register('verifyEclipseLaunchArguments') {
206+
group = 'verification'
207+
description = 'Checks that generated Eclipse launcher paths stay intact when they contain spaces.'
208+
dependsOn 'genEclipseRuns'
209+
doLast {
210+
['runClient', 'runServer', 'runTestClient', 'runTestServer'].each { name ->
211+
Node launch = new XmlParser().parse(file(name + '.launch'))
212+
String arguments = launch.stringAttribute.find {
213+
it.attribute('key') == 'org.eclipse.jdt.launching.PROGRAM_ARGUMENTS'
214+
}.attribute('value')
215+
['cache', 'metadata', 'to-srg', 'to-obf'].each { flag ->
216+
def path = arguments =~ /(?:^| )--${flag} "([^"]+)"/
217+
if (!path.find() || !file(path.group(1)).exists()) {
218+
throw new GradleException("${name} needs a quoted, existing --${flag} path")
219+
}
220+
}
221+
}
222+
}
223+
}
224+
tasks.named('check') { dependsOn 'verifyEclipseLaunchArguments' }
225+
tasks.named('eclipse') { dependsOn 'verifyEclipseLaunchArguments', stageRunClasses }
159226

160227
tasks.named('processResources', ProcessResources) {
161228
inputs.property 'version', project.version

‎docs/BUILDING.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,23 @@ checked by SHA-256. It remains optional when playing.
1313
.\gradlew.bat check build genEclipseRuns eclipse "-PlegacyDependencyVerificationRepository=<mirror>"
1414

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

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

2425
The test runners in tools/validation/legacy113 use an independently installed
2526
Forge server template. Install requirements.txt from that directory for the
2627
Anvil and NBT checks.
28+
29+
Build the separate survival-mining test mod with packagedMiningProbeJar, then
30+
run verify_mining.py --help for the packaged-server options. Add --processing
31+
to check furnace and crushing recipes as well. Run with Base Minerals alone,
32+
with Base Metals, with Modern Metals, and with both hammer mods. The probe
33+
checks normal drops, Fortune, Silk Touch, weak tools, hammer drops, block
34+
properties, fluid light and smith offers. Its jar stays under build/test-mods
35+
and must not be installed in a normal game.

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ org.gradle.parallel=false
66
net.minecraftforge.gradle.merge-source-sets=false
77
minecraft_version=1.13.2
88
forge_version=25.0.223
9-
mod_version=2.5.1.113021
9+
mod_version=2.5.2.113021

‎gradle/release-113.gradle‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def audit = { File directory ->
5757
String path = entry.name.toLowerCase(Locale.ROOT)
5858
if (path.contains('agent-notes') || path.contains('agents.md') || path.contains('.codex')
5959
|| path.startsWith('tools/') || path.startsWith('reference/') || path.contains('/testmod/')
60+
|| path.startsWith('test/') || path.contains('mineralminingprobe')
6061
|| path.startsWith('com/mcmoddev/lib/') || path.startsWith('zone/moddev/mc/mmdlib/')
6162
|| path.startsWith('zone/moddev/mc/basemetals/') || path.startsWith('com/mcmoddev/orespawn/')
6263
|| path.startsWith('net/minecraft/') || path.startsWith('org/junit/')) {

‎src/main/java/zone/moddev/mc/baseminerals/BaseMinerals.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
1111
import zone.moddev.mc.baseminerals.client.MineralFluidRenderer;
1212
import zone.moddev.mc.baseminerals.recipe.SharedCrushingSerializer;
13+
import zone.moddev.mc.baseminerals.trade.MineralTrades;
1314
import zone.moddev.mc.baseminerals.worldgen.BaseMineralsWorldgenProvider;
1415

1516
@Mod(BaseMinerals.MOD_ID)
@@ -23,7 +24,10 @@ public BaseMinerals() {
2324
}
2425

2526
private void setup(FMLCommonSetupEvent event) {
26-
DeferredWorkQueue.runLater(() -> RecipeSerializers.register(new SharedCrushingSerializer()));
27+
DeferredWorkQueue.runLater(() -> {
28+
RecipeSerializers.register(new SharedCrushingSerializer());
29+
MineralTrades.register();
30+
});
2731
}
2832

2933
private void enqueueProvider(InterModEnqueueEvent event) {

‎src/main/java/zone/moddev/mc/baseminerals/content/MineralContent.java‎

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import java.util.LinkedHashMap;
44
import java.util.Map;
5+
import java.util.Random;
56
import net.minecraft.block.Block;
67
import net.minecraft.block.BlockFlowingFluid;
8+
import net.minecraft.block.SoundType;
79
import net.minecraft.block.material.Material;
810
import net.minecraft.block.state.IBlockState;
911
import net.minecraft.fluid.FlowingFluid;
@@ -16,13 +18,18 @@
1618
import net.minecraft.init.Items;
1719
import net.minecraft.util.BlockRenderLayer;
1820
import net.minecraft.util.ResourceLocation;
21+
import net.minecraft.util.IItemProvider;
22+
import net.minecraft.util.math.BlockPos;
1923
import net.minecraft.util.registry.IRegistry;
24+
import net.minecraft.world.IWorldReader;
25+
import net.minecraft.world.World;
2026
import net.minecraftforge.api.distmarker.Dist;
2127
import net.minecraftforge.api.distmarker.OnlyIn;
2228
import net.minecraftforge.common.ToolType;
2329
import net.minecraftforge.event.RegistryEvent;
2430
import net.minecraftforge.eventbus.api.SubscribeEvent;
2531
import net.minecraftforge.fml.common.Mod;
32+
import net.minecraftforge.registries.ForgeRegistries;
2633
import zone.moddev.mc.baseminerals.BaseMinerals;
2734

2835
/** Registry names are kept from the 1.10–1.12 builds. */
@@ -58,12 +65,12 @@ private static void initializeFluids() {
5865
public static void registerBlocks(RegistryEvent.Register<Block> event) {
5966
initializeFluids();
6067
for (String name : MATERIALS) {
61-
putBlock(event, name + "_block", new MineralBlock(false));
62-
if (!"silicon".equals(name)) putBlock(event, name + "_ore", new MineralBlock(true));
68+
putBlock(event, name + "_block", new MineralBlock(name, false));
69+
if (!"silicon".equals(name)) putBlock(event, name + "_ore", new MineralBlock(name, true));
6370
}
6471
MOLTEN.forEach((name, molten) -> {
6572
molten.block = new BlockFlowingFluid(molten.source, Block.Properties.create(Material.LAVA)
66-
.doesNotBlockMovement().hardnessAndResistance(100.0F).variableOpacity()) {};
73+
.doesNotBlockMovement().hardnessAndResistance(100.0F).lightValue(10).variableOpacity()) {};
6774
putBlock(event, name, molten.block);
6875
});
6976
}
@@ -109,14 +116,44 @@ static final class Molten {
109116

110117
private static final class MineralBlock extends Block {
111118
private final boolean ore;
119+
private final int harvestLevel;
120+
private final ResourceLocation powder;
112121

113-
MineralBlock(boolean ore) {
114-
super(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 5.0F));
122+
MineralBlock(String material, boolean ore) {
123+
super(properties(material, ore));
115124
this.ore = ore;
125+
this.harvestLevel = isMetal(material) ? 2 : 1;
126+
this.powder = ore && !isMetal(material) ? id(material + "_powder") : null;
127+
}
128+
129+
private static boolean isMetal(String material) {
130+
return "lithium".equals(material) || "silicon".equals(material);
131+
}
132+
133+
private static Block.Properties properties(String material, boolean ore) {
134+
boolean metal = isMetal(material);
135+
float hardness = ore ? 5.0F : metal ? 16.0F : 10.0F;
136+
// The old library stored resistance at five times Minecraft's exposed value.
137+
float resistance = (metal ? 4.0F : 1.0F) * (ore ? 0.75F : 1.0F);
138+
return Block.Properties.create(metal && !ore ? Material.IRON : Material.ROCK)
139+
.sound(metal && !ore ? SoundType.METAL : SoundType.STONE)
140+
.hardnessAndResistance(hardness, resistance);
116141
}
117142

118143
@Override public ToolType getHarvestTool(IBlockState state) { return ToolType.PICKAXE; }
119-
@Override public int getHarvestLevel(IBlockState state) { return 1; }
144+
@Override public int getHarvestLevel(IBlockState state) { return harvestLevel; }
145+
@Override public IItemProvider getItemDropped(IBlockState state, World world, BlockPos pos, int fortune) {
146+
return powder == null ? this : ForgeRegistries.ITEMS.getValue(powder);
147+
}
148+
@Override public int quantityDropped(IBlockState state, Random random) {
149+
return getItemsToDropCount(state, 0, null, BlockPos.ORIGIN, random);
150+
}
151+
@Override public int getItemsToDropCount(IBlockState state, int fortune, World world, BlockPos pos, Random random) {
152+
return powder == null ? 1 : 2 + random.nextInt(3 + fortune);
153+
}
154+
@Override public boolean isBeaconBase(IBlockState state, IWorldReader world, BlockPos pos, BlockPos beacon) {
155+
return !ore;
156+
}
120157
@Override @OnlyIn(Dist.CLIENT)
121158
public BlockRenderLayer getRenderLayer() {
122159
return ore ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package zone.moddev.mc.baseminerals.trade;
2+
3+
import net.minecraft.init.Items;
4+
import net.minecraft.item.Item;
5+
import net.minecraft.item.ItemStack;
6+
import net.minecraft.util.ResourceLocation;
7+
import net.minecraft.village.MerchantRecipe;
8+
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
9+
import net.minecraftforge.registries.ForgeRegistries;
10+
11+
/** The old shared library offered one ingot for four or five emeralds at smith level two. */
12+
public final class MineralTrades {
13+
private MineralTrades() {}
14+
15+
public static void register() {
16+
VillagerProfession smith = ForgeRegistries.VILLAGER_PROFESSIONS.getValue(
17+
new ResourceLocation("minecraft", "smith"));
18+
for (int career = 1; career <= 3; career++) {
19+
for (String material : new String[] {"lithium", "silicon"}) {
20+
Item ingot = ForgeRegistries.ITEMS.getValue(new ResourceLocation("baseminerals", material + "_ingot"));
21+
smith.getCareer(career).addTrade(2, (merchant, recipes, random) -> recipes.add(
22+
new MerchantRecipe(new ItemStack(Items.EMERALD, 4 + random.nextInt(2)), new ItemStack(ingot))));
23+
}
24+
}
25+
}
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"type": "baseminerals:shared_crushing",
3+
"conditions": [
4+
{
5+
"type": "forge:or",
6+
"values": [
7+
{
8+
"type": "forge:mod_loaded",
9+
"modid": "basemetals"
10+
},
11+
{
12+
"type": "forge:mod_loaded",
13+
"modid": "modernmetals"
14+
}
15+
]
16+
}
17+
],
18+
"ingredient": {
19+
"tag": "forge:storage_blocks/lithium"
20+
},
21+
"result": {
22+
"item": "baseminerals:lithium_powder",
23+
"count": 9
24+
}
25+
}

0 commit comments

Comments
 (0)