Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to 1.16.2+ #11

Closed
wants to merge 5 commits into from
Closed
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
121 changes: 24 additions & 97 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,42 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
}
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = "${mod_version}"
group = "com.tfar.${modid}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "${modid}"

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
java.toolchain.languageVersion = JavaLanguageVersion.of(8)

minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: "official", version: "1.16.1"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
mappings channel: 'official', version: '1.16.5'
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')

// Recommended logging level for the console
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'

mods {
examplemod {
ferroustry {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')


// Recommended logging level for the console
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'

mods {
examplemod {
ferroustry {
source sourceSets.main
}
}
Expand All @@ -63,81 +45,26 @@ minecraft {
}

repositories{
maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
maven { url "https://maven.tehnut.info" }
maven { url "https://dvs1.progwml6.com/files/maven" }
maven { // TOP
name 'tterrag maven'
url "https://maven.tterrag.com/"
}
}

dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}" //21

// compile against the JEI API but do not include it at runtime
//compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api")
// at runtime, use the full JEI jar
//runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version"
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

// Real examples
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")

// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
compileOnly fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}_${minecraft_release}.2:api")
runtimeOnly fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}_${minecraft_release}.2")

// These dependencies get remapped to your current MCP mappings
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
compileOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}:api")
runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}")

// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

}

// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([
"Specification-Title": "ferroustry",
"Specification-Vendor": "examplemodsareus",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

// Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published
// Note you'll need to add a repository here
def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact reobfArtifact
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
12 changes: 7 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
mod_version=2.2
mod_version=1.0
modid=ferroustry
mc_version=1.16.1
forge_version=32.0.1
mapping=20191216
jei_version=6.0.0.11
minecraft_version=1.16.5
minecraft_release=1.16
forge_version=36.1.3
jei_version=7.6.4.88
hwyla_version=1.10.11-B78
top_version=3.0.7-13
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
37 changes: 24 additions & 13 deletions src/main/java/com/tfar/ferroustry/Ferroustry.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.tfar.ferroustry;

import com.google.common.collect.ImmutableList;
import com.tfar.ferroustry.block.ResourceSaplingBlock;
import com.tfar.ferroustry.block.ResourceStairsBlock;
import com.tfar.ferroustry.config.Config;
import com.tfar.ferroustry.tree.ResourceTree;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
Expand All @@ -15,41 +15,51 @@
import net.minecraft.world.gen.blockstateprovider.SimpleBlockStateProvider;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.foliageplacer.BlobFoliagePlacer;
import net.minecraft.world.gen.treedecorator.AlterGroundTreeDecorator;
import net.minecraft.world.gen.trunkplacer.StraightTrunkPlacer;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import static net.minecraft.world.gen.surfacebuilders.SurfaceBuilder.PODZOL;
import static net.minecraftforge.common.MinecraftForge.EVENT_BUS;

// The value here should match an entry in the META-INF/mods.toml file
@Mod(Ferroustry.MODID)
public class Ferroustry {
// Directly reference a log4j logger.

public static final String MODID = "ferroustry";

private static final Logger LOGGER = LogManager.getLogger();
public static final Logger LOGGER = LogManager.getLogger();

public static final ItemGroup TAB = new ItemGroup(MODID) {
@Override
public ItemStack makeIcon() {
return new ItemStack(Items.IRON_INGOT);
}
};

public Ferroustry() {
// Register the setup method for modloading
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.COMMON_SPEC);

FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::client);

}

public static boolean DEV;
Expand All @@ -72,7 +82,8 @@ private void setup(final FMLCommonSetupEvent event) {
.forEach(block -> map.put(block, ForgeRegistries.BLOCKS.getValue(new ResourceLocation(MODID, "stripped_" +
block.getRegistryName().getPath()))));
AxeItem.STRIPABLES = map;
if (DEV) EVENT_BUS.register(Scripts.JsonCrap.class);
//TODO whatever this one does needs to be fixed
//if (DEV) EVENT_BUS.register(Scripts.JsonCrap.class);
}

private void client(final FMLClientSetupEvent event) {
Expand All @@ -93,7 +104,6 @@ public static class RegistryEvents {

public static final Set<Feature<?>> FEATURES = new HashSet<>();


@SubscribeEvent
public static void onBlocksRegistry(final RegistryEvent.Register<Block> event) {
// register a new blocks here
Expand All @@ -109,12 +119,11 @@ public static void onBlocksRegistry(final RegistryEvent.Register<Block> event) {
BaseTreeFeatureConfig treeFeatureConfig = new BaseTreeFeatureConfig.Builder(
new SimpleBlockStateProvider(logBlock.defaultBlockState()),
new SimpleBlockStateProvider(leavesBlock.defaultBlockState()),
new BlobFoliagePlacer(2, 0, 0, 0, 3),
new BlobFoliagePlacer(FeatureSpread.of(2,0), FeatureSpread.of(0,0), 3),
new StraightTrunkPlacer(4, 2, 0), new TwoLayerFeature(1, 0, 1)).ignoreVines().build();

ResourceSaplingBlock resourceSaplingBlock = new ResourceSaplingBlock(new ResourceTree(treeFeatureConfig), sapling);
register(resourceSaplingBlock,
material + "_sapling", event.getRegistry());
register(resourceSaplingBlock,material + "_sapling", event.getRegistry());
FlowerPotBlock flowerPotBlock = new FlowerPotBlock(() -> (FlowerPotBlock)Blocks.FLOWER_POT,() -> resourceSaplingBlock,Block.Properties.of(Material.DECORATION).strength(0).noOcclusion());
((FlowerPotBlock)Blocks.FLOWER_POT).addPlant(resourceSaplingBlock.getRegistryName(),() -> flowerPotBlock);
register(flowerPotBlock,"potted_"+material+"_sapling",event.getRegistry());
Expand All @@ -129,6 +138,8 @@ public static void onBlocksRegistry(final RegistryEvent.Register<Block> event) {
}
}



private static RotatedPillarBlock log(MaterialColor p_235430_0_, MaterialColor p_235430_1_) {
return new RotatedPillarBlock(AbstractBlock.Properties.of(Material.WOOD, (p_lambda$func_235430_a_$36_2_) ->
p_lambda$func_235430_a_$36_2_.getValue(RotatedPillarBlock.AXIS) == Direction.Axis.Y ? p_235430_0_ : p_235430_1_)
Expand All @@ -138,12 +149,12 @@ private static RotatedPillarBlock log(MaterialColor p_235430_0_, MaterialColor p
@SubscribeEvent
public static void onItemsRegistry(final RegistryEvent.Register<Item> event) {
// register a new blocks here
Item.Properties properties = new Item.Properties().tab(ItemGroup.TAB_BUILDING_BLOCKS);
Item.Properties properties = new Item.Properties().tab(TAB);
for (Block block : MOD_BLOCKS) {
if (!(block instanceof FlowerPotBlock))
register(new BlockItem(block, properties), block.getRegistryName().getPath(), event.getRegistry());
}
Item.Properties properties1 = new Item.Properties().tab(ItemGroup.TAB_MATERIALS);
Item.Properties properties1 = new Item.Properties().tab(TAB);
register(new Item(properties1), "aluminum_ingot", event.getRegistry());
register(new Item(properties1), "copper_ingot", event.getRegistry());
register(new Item(properties1), "silver_ingot", event.getRegistry());
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/tfar/ferroustry/OreType.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ public enum OreType {
redstone(false, false),
//modded
aluminum(true, true),
bismuth(true, true),
copper(true, true),
lead(true, true),
//platinum(true),
//bismuth(true, true),
//platinum(true, true),
//zinc(true, true),
//nickel(true, true),
//uranium(true, true),
//osmium(true, true),
silver(true, true),
tin(true, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class ResourceStairsBlock extends StairsBlock {

//majong made it protected
public ResourceStairsBlock(BlockState p_i48321_1_, Properties p_i48321_2_) {
super(p_i48321_1_, p_i48321_2_);
super(() -> p_i48321_1_, p_i48321_2_);
}


Expand Down
47 changes: 47 additions & 0 deletions src/main/java/com/tfar/ferroustry/config/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.tfar.ferroustry.config;

import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.common.Mod;
import org.apache.commons.lang3.tuple.Pair;

@Mod.EventBusSubscriber
public class Config {

public static class Common {
public static ForgeConfigSpec.BooleanValue enable_aluminum;
public static ForgeConfigSpec.BooleanValue enable_bismuth;
public static ForgeConfigSpec.BooleanValue enable_copper;
public static ForgeConfigSpec.BooleanValue enable_lead;
public static ForgeConfigSpec.BooleanValue enable_platinum;
public static ForgeConfigSpec.BooleanValue enable_zinc;
public static ForgeConfigSpec.BooleanValue enable_nickel;
public static ForgeConfigSpec.BooleanValue enable_uranium;
public static ForgeConfigSpec.BooleanValue enable_osmium;
public static ForgeConfigSpec.BooleanValue enable_silver;
public static ForgeConfigSpec.BooleanValue enable_tin;

public Common(ForgeConfigSpec.Builder server) {
server.comment("Enable Ore Trees");
enable_aluminum = server.comment("Enable aluminum").define("ferroustry.enable_aluminum", true);
enable_bismuth = server.comment("Enable bismuth").define("ferroustry.enable_bismuth", false);
enable_copper = server.comment("Enable copper").define("ferroustry.enable_copper", true);
enable_lead = server.comment("Enable lead").define("ferroustry.enable_lead", true);
enable_platinum = server.comment("Enable platinum").define("ferroustry.enable_platinum", false);
enable_zinc = server.comment("Enable zinc").define("ferroustry.enable_zinc", false);
enable_nickel = server.comment("Enable nickel").define("ferroustry.enable_nickel", true);
enable_uranium = server.comment("Enable uranium").define("ferroustry.enable_uranium", false);
enable_osmium = server.comment("Enable osmium").define("ferroustry.enable_osmium", false);
enable_silver = server.comment("Enable silver").define("ferroustry.enable_silver", true);
enable_tin = server.comment("Enable tin").define("ferroustry.enable_tin", true);

}
}

public static final Common COMMON;
public static final ForgeConfigSpec COMMON_SPEC;
static {
final Pair<Common, ForgeConfigSpec> specPair = new ForgeConfigSpec.Builder().configure(Common::new);
COMMON_SPEC = specPair.getRight();
COMMON = specPair.getLeft();
}
}
Loading