Skip to content

Commit

Permalink
feat: add Mekanism ore generation
Browse files Browse the repository at this point in the history
Signed-off-by: AlasDiablo <25723276+AlasDiablo@users.noreply.github.com>
  • Loading branch information
AlasDiablo committed Jul 31, 2021
1 parent 54fbabc commit bfbc5e3
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 2 deletions.
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.0.0'
version = '1.1.0'
group = 'fr.alasdiablo.jerintegration'
archivesBaseName = 'JER-Integration'

Expand Down Expand Up @@ -72,7 +72,11 @@ dependencies {
implementation fg.deobf("curse.maven:mantle-74924:3389377") // Mantle
implementation fg.deobf("curse.maven:tinkers-construct-74072:3389395") // Tinkers Construct 3

implementation fg.deobf("curse.maven:immersive-engineering-231951:3377691") // Immersive Engineering
implementation fg.deobf("curse.maven:mekanism-268560:3206392") // Mekanism

// implementation fg.deobf("curse.maven:cofh-core-69162:3407019") // CoFH Core
// implementation fg.deobf("curse.maven:thermal-foundation-222880:3407024") // Thermal Foundation
// implementation fg.deobf("curse.maven:applied-energistics-2-223794:3354897") // Applied Energistics 2
}

jar {
Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### 1.1.0

+ Add Mekanism ore generation

### 1.0.0

+ Init release
+ Add Tinkers' Construct ore generation
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class JERIntegration {

public static class Compat {
public static boolean TINKERS_CONSTRUCT = MOD_LIST.isLoaded("tconstruct");
public static boolean MEKANISM = MOD_LIST.isLoaded("mekanism");
}

public final CompatibilityHandler compatibilityHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import fr.alasdiablo.jerintegration.JERIntegration;
import fr.alasdiablo.jerintegration.api.IJERIntegration;
import fr.alasdiablo.jerintegration.compat.mekanism.MekanismWorldGen;
import fr.alasdiablo.jerintegration.compat.minecraft.MinecraftWorldGen;
import fr.alasdiablo.jerintegration.compat.tconstruct.TConstructWorldGen;
import jeresources.api.IJERAPI;
Expand All @@ -13,11 +14,17 @@ public class CompatibilityHandler {

public IJERIntegration minecraft;

public IJERIntegration mekanism;

public CompatibilityHandler() {
this.minecraft = new MinecraftWorldGen();
if (JERIntegration.Compat.TINKERS_CONSTRUCT) {
this.tconstruct = new TConstructWorldGen();
}

if (JERIntegration.Compat.MEKANISM) {
this.mekanism = new MekanismWorldGen();
}
}

public void init() {
Expand All @@ -27,5 +34,10 @@ public void init() {
this.tconstruct.register(jerApi);
JERIntegration.LOGGER.info("Tinkers' Construct integration have been initialized");
}

if (JERIntegration.Compat.MEKANISM) {
this.mekanism.register(jerApi);
JERIntegration.LOGGER.info("Mekanism integration have been initialized");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package fr.alasdiablo.jerintegration.compat.mekanism;

import fr.alasdiablo.jerintegration.api.WorldGenIntegration;
import jeresources.api.IWorldGenRegistry;
import jeresources.api.distributions.DistributionBase;
import jeresources.api.distributions.DistributionSquare;
import jeresources.api.drop.LootDrop;
import mekanism.common.registries.MekanismBlocks;
import mekanism.common.registries.MekanismItems;
import mekanism.common.resource.OreType;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;

public class MekanismWorldGen extends WorldGenIntegration {
@Override
public void registerWorldGen(IWorldGenRegistry registry) {
// TODO MekanismConfig.world.salt;

this.register(registry,
MekanismBlocks.ORES.get(OreType.COPPER).getBlock(),
OreType.COPPER.getPerChunk(),
OreType.COPPER.getMaxVeinSize(),
OreType.COPPER.getBottomOffset(),
OreType.COPPER.getMaxHeight()
);

this.register(registry,
MekanismBlocks.ORES.get(OreType.TIN).getBlock(),
OreType.TIN.getPerChunk(),
OreType.TIN.getMaxVeinSize(),
OreType.TIN.getBottomOffset(),
OreType.TIN.getMaxHeight()
);

this.register(registry,
MekanismBlocks.ORES.get(OreType.OSMIUM).getBlock(),
OreType.OSMIUM.getPerChunk(),
OreType.OSMIUM.getMaxVeinSize(),
OreType.OSMIUM.getBottomOffset(),
OreType.OSMIUM.getMaxHeight()
);

this.register(registry,
MekanismBlocks.ORES.get(OreType.URANIUM).getBlock(),
OreType.URANIUM.getPerChunk(),
OreType.URANIUM.getMaxVeinSize(),
OreType.URANIUM.getBottomOffset(),
OreType.URANIUM.getMaxHeight()
);

this.register(registry,
MekanismBlocks.ORES.get(OreType.LEAD).getBlock(),
OreType.LEAD.getPerChunk(),
OreType.LEAD.getMaxVeinSize(),
OreType.LEAD.getBottomOffset(),
OreType.LEAD.getMaxHeight()
);

final DistributionBase fluoriteDistribution = new DistributionSquare(
OreType.FLUORITE.getPerChunk(),
OreType.FLUORITE.getMaxVeinSize(),
OreType.FLUORITE.getBottomOffset(),
OreType.FLUORITE.getMaxHeight()
);
final ItemStack fluoriteStack = new ItemStack(MekanismBlocks.ORES.get(OreType.FLUORITE).getBlock());
final LootDrop fluoriteDrop = new LootDrop(new ItemStack(MekanismItems.FLUORITE_GEM.getItem(), 4));
registry.register(fluoriteStack, fluoriteDistribution, fluoriteDrop);
}


public void register(IWorldGenRegistry registry, Block block, int count, int veinSize, int bottom, int top) {
final DistributionBase distribution = new DistributionSquare(
count,
veinSize,
bottom,
top
);
final ItemStack stack = new ItemStack(block);
final LootDrop drop = new LootDrop(stack);
registry.register(stack, distribution, drop);
}
}

0 comments on commit bfbc5e3

Please sign in to comment.