Skip to content

Commit

Permalink
Add Support for Mek and IE
Browse files Browse the repository at this point in the history
  • Loading branch information
UnRealDinnerbone committed Feb 29, 2024
1 parent 664970f commit 5a4f51f
Show file tree
Hide file tree
Showing 22 changed files with 139 additions and 190 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### 4.0.1
### 4.1.0

- Fix Dependencies
- Add Support for Mekanism and Immersive Engineering ores
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("dev.nanite.mlp") version("0.1.1")
id("dev.nanite.mlp") version("0.1.3")
id("java-library")
id("maven-publish")
id("me.modmuss50.mod-publish-plugin") version "0.3.0"
Expand Down Expand Up @@ -53,6 +53,10 @@ subprojects {
name = "Nanite"
url = "https://maven.nanite.dev/releases"
}
maven {
name = "Nanite"
url = "https://maven.blamejared.com/"
}
}
tasks.withType(ProcessResources).configureEach {
outputs.upToDateWhen { false }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.unrealdinnerbone.jamd;

import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.serialization.Codec;
import com.unrealdinnerbone.jamd.block.*;
import com.unrealdinnerbone.jamd.block.base.PortalTileEntity;
Expand All @@ -9,6 +10,9 @@
import com.unrealdinnerbone.trenzalore.api.registry.RegistryEntry;
import com.unrealdinnerbone.trenzalore.api.registry.RegistryObjects;
import com.unrealdinnerbone.trenzalore.lib.CreativeTabs;
import net.minecraft.commands.synchronization.ArgumentTypeInfo;
import net.minecraft.commands.synchronization.ArgumentTypeInfos;
import net.minecraft.commands.synchronization.SingletonArgumentInfo;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.tags.BiomeTags;
Expand All @@ -30,8 +34,11 @@ public class JAMDRegistry implements IRegistry {
private static final RegistryObjects<Block> BLOCKS = Regeneration.create(Registries.BLOCK);
private static final RegistryObjects<Item> ITEMS = Regeneration.create(Registries.ITEM);
private static final RegistryObjects<BlockEntityType<?>> TILES = Regeneration.create(Registries.BLOCK_ENTITY_TYPE);

private static final RegistryObjects<ArgumentTypeInfo<?, ?>> ARG_TYPE = Regeneration.create(Registries.COMMAND_ARGUMENT_TYPE);
private static final RegistryObjects<Codec<? extends ChunkGenerator>> CHUNK_GENERATORS = Regeneration.create(Registries.CHUNK_GENERATOR);


public static final RegistryEntry<Codec<? extends ChunkGenerator>> CUSTOM_FLAT_LEVEL_SOURCE = CHUNK_GENERATORS.register("mining", () -> CustomFlatLevelSource.CODEC);

public static final WorldType OVERWORLD = of("mining", "portal_block", "portal", OverworldPortalBlock::new, OverworldBlockEntity::new, BiomeTags.IS_OVERWORLD);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,59 @@
package com.unrealdinnerbone.jamd.command;

import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import com.mojang.brigadier.suggestion.Suggestions;
import com.unrealdinnerbone.jamd.WorldType;
import com.unrealdinnerbone.jamd.util.OreRegistry;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.SharedSuggestionProvider;
import net.minecraft.network.chat.Component;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.world.flag.FeatureFlagSet;

import java.io.IOException;
import java.util.Collection;

public class JamdCommand {

private static final DynamicCommandExceptionType INVALID_WORLD_TYPE = new DynamicCommandExceptionType((object) -> Component.translatable("commands.jamd.invalid_world_type", object));

public static void register(CommandDispatcher<CommandSourceStack> commandDispatcher) {
commandDispatcher.register(Commands.literal("jamd")
.then(Commands.literal("export")
.then(Commands.argument("type", StringArgumentType.string())
.suggests((context, builder) -> SharedSuggestionProvider.suggest(WorldType.TYPES.stream().map(WorldType::getName), builder))
.executes(JamdCommand::export)
.then(Commands.literal("reload")
.executes(JamdCommand::reload)));
.executes(JamdCommand::reload)))));

}

private static int export(CommandContext<CommandSourceStack> stackCommandContext) throws CommandSyntaxException {
String string = StringArgumentType.getString(stackCommandContext, "type");
WorldType worldType = WorldType.TYPES.stream()
.filter(theWorldType -> theWorldType.getName().equalsIgnoreCase(string))
.findFirst()
.orElseThrow(() -> INVALID_WORLD_TYPE.create(string));
try {
worldType.export(stackCommandContext.getSource().getLevel().getServer());
} catch (IOException e) {
throw new RuntimeException(e);
}
stackCommandContext.getSource().sendSuccess(() -> Component.literal("Exported Biomes Data"), true);
return Command.SINGLE_SUCCESS;
}

private static int reload(CommandContext<CommandSourceStack> stackCommandContext) throws CommandSyntaxException {
OreRegistry.REGISTERED_FEATURES.clear();
stackCommandContext.getSource().sendSuccess(() -> Component.literal("Reloaded Biomes Data"), true);
return 0;
return Command.SINGLE_SUCCESS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public void generateTranslations(TranslationBuilder translationBuilder) {
translationBuilder.add("biome.jamd.mining", "Mining");
translationBuilder.add("biome.jamd.nether", "Nether Mining");
translationBuilder.add("biome.jamd.end", "End Mining");
translationBuilder.add("jamd.argument.world_type.invalid", "Invalid World Type '%s'");
translationBuilder.add(JAMDRegistry.OVERWORLD.getAdvancementTitleKey(), "To Infinity and Underground");
translationBuilder.add(JAMDRegistry.OVERWORLD.getAdvancementDescriptionKey(), "Enter the Mining Dimension");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.unrealdinnerbone.jamd;
package com.unrealdinnerbone.jamd.fabric;

import com.unrealdinnerbone.jamd.JAMD;
import com.unrealdinnerbone.jamd.command.JamdCommand;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"environment": "*",
"entrypoints": {
"main": [
"com.unrealdinnerbone.jamd.JAMDFabric"
"com.unrealdinnerbone.jamd.fabric.JAMDFabric"
],
"fabric-datagen": [
"com.unrealdinnerbone.jamd.data.JAMDData"
Expand Down
11 changes: 0 additions & 11 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,8 @@ multiLoader.forge() {

publishing.publications.mavenJava.artifact jar

repositories {
maven {
url "https://cursemaven.com"
}
maven {
url "https://maven.nanite.dev/releases"
}
}


dependencies {
implementation(fg.deobf("com.unrealdinnerbone:trenzalore-forge:${project.property("trenzalore_version")}+mc${project.property("minecraft_version")}")) {
transitive = true
}
// implementation fg.deobf("mekanism:Mekanism:${mekanism_version}")
}
43 changes: 0 additions & 43 deletions forge/src/main/java/com/unrealdinnerbone/jamd/JAMDDataForge.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.unrealdinnerbone.jamd;
package com.unrealdinnerbone.jamd.forge;

import com.unrealdinnerbone.jamd.JAMD;
import com.unrealdinnerbone.jamd.command.JamdCommand;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegisterCommandsEvent;
Expand All @@ -17,8 +18,7 @@ public JAMDForge() {
}

public static void registerCompact() {
//Todo register compact
// FeatureTypeRegistry.register("mekanism", MekenismOreCompact::new);

}

public void onRegisterCommands(RegisterCommandsEvent event) {
Expand Down
13 changes: 7 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project
mod_version=4.0.1
mod_version=4.1.0
maven_group=com.unrealdinnerbone
curse_id=422981
mod_name=JAMD
Expand All @@ -11,12 +11,12 @@ mod_id=jamd
minecraft_version=1.20.4

# Forge
forge_version=49.0.13
forge_version=49.0.30

neo_version=20.4.70-beta
neo_version=20.4.189

fabric_version=0.91.2+1.20.4
fabric_loader_version=0.15.1
fabric_version=0.96.4+1.20.4
fabric_loader_version=0.15.7

# Other
trenzalore_version=4.0.1
Expand All @@ -26,4 +26,5 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

#Compact
mekanism_version=1.20.1-10.4.0.14
mekanism_version=1.20.4-10.5.0.22
immersive_engineering_version=1.20.4-10.0.1-pre.177
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 3 additions & 1 deletion neo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ multiLoader.neo() {
neoVersion.set("${neo_version}")
}


dependencies {
implementation("com.unrealdinnerbone:trenzalore-neo:${project.property("trenzalore_version")}+mc${project.property("minecraft_version")}")

api "mekanism:Mekanism:${mekanism_version}"
api "blusunrize.immersiveengineering:ImmersiveEngineering:${immersive_engineering_version}"
}

publishing.publications.mavenJava.from components.java
Expand Down

This file was deleted.

Loading

0 comments on commit 5a4f51f

Please sign in to comment.