Skip to content

Commit

Permalink
Merge branch 'dev/rewrit' into 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
UnRealDinnerbone committed Nov 7, 2023
2 parents 6e6603d + 3a657e1 commit 34d0b27
Show file tree
Hide file tree
Showing 50 changed files with 725 additions and 385 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 3.2.2
### 3.3.0

- Blacklist Enlightened End mod
- Rewrite mod to better support modded / custom ores
- Added /jamd reload to reload the config
- Added configs jamd/overworld.json, jamd/nether.json, jamd/end.json
- Configs now completely controls the world generation
- Added support for ore multipliers
- Added Mekanism support
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {
id("java")
id "me.modmuss50.mod-publish-plugin" version "0.3.0"

id("fabric-loom") version("1.3.9") apply(false)
id("net.minecraftforge.gradle") version("6.0.+") apply(false)
id("fabric-loom") version("1.4.2") apply(false)
id 'net.neoforged.gradle' version '[6.0.18,6.2)' apply(false)
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
Expand All @@ -15,6 +15,8 @@ multiLoader.root() {
minecraftVersion.set(project.property("minecraft_version"))
modID.set(project.property("mod_id"))
splitSources.set(true)
accessWidenerFile.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))

dataGen {
useFabric.set(project(":common").file("src/generated/resources"))
useForge.set(project(":forge").file("src/generated/resources"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// 1.20.1 2023-08-20T09:33:14.6325483 Just Another Mining Dimension/Language (en_us)
4d0b94d0ebdcaaafe16d0133c0028cf20bec5a5f assets\jamd\lang\en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// 1.20.1 2023-08-20T09:33:14.6340461 Just Another Mining Dimension/Model Definitions
bf3a9f8231659d8cbc7ea68a7cdde8e3b029071f assets\jamd\blockstates\end_portal.json
7e626048016ba0c9d3b92a12b89eb0ec4d6fe677 assets\jamd\models\block\nether_portal.json
2d9db6c9191663e8106bc53141670ea054209f9a assets\jamd\models\block\portal_block.json
6b50f23823f194ff35bcec0e1694e77efd20e385 assets\jamd\blockstates\nether_portal.json
c43b79f0a1988c4d812f8e77f1c7506d596430a0 assets\jamd\models\item\end_portal.json
098aa69a37ff6ca1b266436f24e891314007f976 assets\jamd\blockstates\portal_block.json
76633e08f2190391221ca5bc14b6536cda1b87a9 assets\jamd\models\item\nether_portal.json
6048ff3f9c71f641213c1d7aa6d605d9b23fed72 assets\jamd\models\block\end_portal.json
155f13040d10cd90e514a56c4d7338c0db232883 assets\jamd\models\item\portal_block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// 1.20.1 2023-08-20T09:33:14.633546 Just Another Mining Dimension/JAMD World Data
e022cecafe8e7e93c9e3e503c46197cf1fb33450 data\jamd\dimension_type\mining.json
9493a2c0221f086efbb4263f171937a72c6d6992 data\jamd\worldgen\biome\end.json
ac9e79911103955c5e8d0b82bd377f175796afac data\jamd\worldgen\biome\mining.json
5015669d20cfba456749215c51c22bc7ace1d4b3 data\jamd\dimension_type\nether.json
cbc1941a40b6da486531a2010be4e6db0866e4f4 data\jamd\dimension_type\end.json
9eb37f0889d455d2929fd947bb4667057ba1b0fe data\jamd\worldgen\biome\nether.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// 1.20.1 2023-08-20T09:33:14.6345452 Just Another Mining Dimension/Tags for minecraft:block
d21a5dcdd4b5cd0b493217e7e9e4aa477a755db8 data\minecraft\tags\blocks\mineable\pickaxe.json
d21a5dcdd4b5cd0b493217e7e9e4aa477a755db8 data\minecraft\tags\blocks\needs_diamond_tool.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// 1.20.1 2023-08-20T09:33:14.6350463 Just Another Mining Dimension/Recipes
6a1227f9e0b372e3546b782215347c8c76dd6f4f data\jamd\advancements\recipes\transportation\nether_portal_block.json
be575abba95e7f591761941b8ce7b15805dd16f5 data\jamd\advancements\recipes\transportation\end_portal_block.json
64a379634715c9f4ea69b6fc5a330a0008cbb33f data\jamd\recipes\portal_block.json
351ba1cdc449781ef49cc5cdb4bfdd5bc5722a13 data\jamd\recipes\nether_portal_block.json
a202bbb60a616a623a317c3b0902f18436701002 data\jamd\recipes\end_portal_block.json
8be629b04926b089b8c6acc497e9fed86ca0ae1b data\jamd\advancements\recipes\transportation\portal_block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// 1.20.1 2023-08-20T09:33:14.633546 Just Another Mining Dimension/Block Loot Tables
d02ea46f3e4060ea18cb73c3b3fe1f1738d4e47c data\jamd\loot_tables\blocks\portal_block.json
8f213054226c115851779a7dd3fb5e0cfb8323f9 data\jamd\loot_tables\blocks\end_portal.json
d4122e44c4d0d50740cfa507d4d05078c7163a7d data\jamd\loot_tables\blocks\nether_portal.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"minecraft:ore_tuff"
]
],
"has_precipitation": true,
"has_precipitation": false,
"spawn_costs": {},
"spawners": {
"ambient": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@
[],
[],
[],
[
"minecraft:ore_gravel_nether",
"minecraft:ore_blackstone",
"minecraft:ore_gold_nether",
"minecraft:ore_quartz_nether",
"minecraft:ore_ancient_debris_large",
"minecraft:ore_debris_small"
]
[]
],
"has_precipitation": false,
"spawn_costs": {},
Expand Down
13 changes: 13 additions & 0 deletions common/src/main/java/com/unrealdinnerbone/jamd/ConfigCodec.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.unrealdinnerbone.jamd;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;

import java.util.List;

public record ConfigCodec(int oreMultiplier, List<OresCodec> ores) {
public static final Codec<ConfigCodec> CODEC = RecordCodecBuilder.create(instance -> instance.group(
Codec.INT.fieldOf("oreMultiplier").forGetter(ConfigCodec::oreMultiplier),
Codec.list(OresCodec.CODEC).fieldOf("ores").forGetter(ConfigCodec::ores)
).apply(instance, ConfigCodec::new));
}
41 changes: 0 additions & 41 deletions common/src/main/java/com/unrealdinnerbone/jamd/DefaultConfig.java

This file was deleted.

27 changes: 23 additions & 4 deletions common/src/main/java/com/unrealdinnerbone/jamd/JAMD.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
package com.unrealdinnerbone.jamd;

import com.unrealdinnerbone.config.ConfigManager;
import com.unrealdinnerbone.trenzalore.api.config.ConfigManger;
import com.mojang.logging.LogUtils;
import com.unrealdinnerbone.jamd.api.FeatureTypeRegistry;
import com.unrealdinnerbone.jamd.compact.MinecraftOreCompact;
import com.unrealdinnerbone.jamd.util.OreRegistry;
import com.unrealdinnerbone.trenzalore.api.platform.Services;
import net.minecraft.server.MinecraftServer;
import org.slf4j.Logger;

import java.io.IOException;
import java.nio.file.Path;

public class JAMD {

private static final Logger LOGGER = LogUtils.getLogger();
public static final Path CONFIG_FOLDER = Services.PLATFORM.getConfigPath().resolve("jamd");
public static final String MOD_ID = "jamd";
private static final ConfigManager CONFIG_MANAGER = ConfigManger.createConfigManager(MOD_ID);
public static final JamdConfig CONFIG = CONFIG_MANAGER.loadConfig("general", JamdConfig::new);

public static void init() {
FeatureTypeRegistry.register("minecraft", MinecraftOreCompact::new);
}

public static void onServerStart(MinecraftServer server) {
OreRegistry.REGISTERED_FEATURES.clear();
for (WorldType type : WorldType.TYPES) {
try {
type.exportIfNotExist(server);
} catch (IOException e) {
LOGGER.error("Failed to export config for world type: {}", type.getName(), e);
}
}
}

}
41 changes: 10 additions & 31 deletions common/src/main/java/com/unrealdinnerbone/jamd/JAMDRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BiomeTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
Expand All @@ -22,6 +24,7 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import org.jetbrains.annotations.ApiStatus;

import java.util.List;
Expand All @@ -37,24 +40,21 @@ public class JAMDRegistry implements IRegistry {

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

public static final RegistrySet OVERWORLD = RegistrySet.of("portal_block", "portal", OverworldPortalBlock::new, OverworldBlockEntity::new);
public static final RegistrySet NETHER = RegistrySet.of("nether_portal", NetherPortalBlock::new, NetherBlockEntity::new);
public static final WorldType OVERWORLD = of("mining", "portal_block", "portal", OverworldPortalBlock::new, OverworldBlockEntity::new, BiomeTags.IS_OVERWORLD);

public static final RegistrySet END = RegistrySet.of("end_portal", EndPortalBlock::new, EndBlockEntity::new);
public static final WorldType NETHER = of("nether", "nether_portal", "nether_portal", NetherPortalBlock::new, NetherBlockEntity::new, BiomeTags.IS_NETHER);

public static final WorldType END = of("end", "end_portal", "end_portal", EndPortalBlock::new, EndBlockEntity::new, BiomeTags.IS_END);

public static class Keys {
public static final KeySet OVERWORLD = KeySet.of(new ResourceLocation(JAMD.MOD_ID, "mining"));

public static final KeySet NETHER = KeySet.of(new ResourceLocation(JAMD.MOD_ID, "nether"));

public static final KeySet END = KeySet.of(new ResourceLocation(JAMD.MOD_ID, "end"));

private static WorldType of(String name, String blockName, String tileName, Supplier<Block> blockSupplier, BiFunction<BlockPos, BlockState, PortalTileEntity> tileSupplier, TagKey<Biome> biomeTagKey) {
RegistryEntry<Block> block = BLOCKS.register(blockName, blockSupplier);
return new WorldType(name, block, ITEMS.register(blockName, () -> new BlockItem(block.get(), new Item.Properties())), TILES.register(tileName, () -> Regeneration.createBlockEntityType(tileSupplier, block.get())), biomeTagKey);
}

@Override
public void afterRegistered() {
Regeneration.addItemsToCreateTab(CreativeTabs.FUNCTIONAL_BLOCKS, List.of(OVERWORLD.item(), NETHER.item(), END.item()));
Regeneration.addItemsToCreateTab(CreativeTabs.FUNCTIONAL_BLOCKS, List.of(OVERWORLD.getItem(), NETHER.getItem(), END.getItem()));
}

@Override
Expand All @@ -67,26 +67,5 @@ public String getModID() {
return JAMD.MOD_ID;
}

public record RegistrySet(RegistryEntry<Block> block, RegistryEntry<BlockItem> item, RegistryEntry<BlockEntityType<PortalTileEntity>> blockEntity) {

private static RegistrySet of(String name, Supplier<Block> blockSupplier, BiFunction<BlockPos, BlockState, PortalTileEntity> tileSupplier) {
return of(name, name, blockSupplier, tileSupplier);
}

@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "4.0.0")
private static RegistrySet of(String blockName, String tileName, Supplier<Block> blockSupplier, BiFunction<BlockPos, BlockState, PortalTileEntity> tileSupplier) {
RegistryEntry<Block> block = BLOCKS.register(blockName, blockSupplier);
RegistryEntry<BlockItem> itemBlock = ITEMS.register(blockName, () -> new BlockItem(block.get(), new Item.Properties()));
RegistryEntry<BlockEntityType<PortalTileEntity>> tile = TILES.register(tileName, () -> Regeneration.createBlockEntityType(tileSupplier, block.get()));
return new RegistrySet(block, itemBlock, tile);
}
}

public record KeySet(ResourceKey<Level> level, ResourceKey<DimensionType> dimensionType, ResourceKey<Biome> biome) {

private static KeySet of(ResourceLocation id) {
return new KeySet(ResourceKey.create(Registries.DIMENSION, id), ResourceKey.create(Registries.DIMENSION_TYPE, id), ResourceKey.create(Registries.BIOME, id));
}
}
}
46 changes: 0 additions & 46 deletions common/src/main/java/com/unrealdinnerbone/jamd/JamdConfig.java

This file was deleted.

Loading

0 comments on commit 34d0b27

Please sign in to comment.