diff --git a/CHANGELOG.md b/CHANGELOG.md index 9098305..39d0f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 3.4.1 +### 3.4.2 -- Fix Bug with stacking portals -- Added support for debris \ No newline at end of file +- Fix Crash on fabric +- Removed Infested Stone for spawning \ No newline at end of file diff --git a/build.gradle b/build.gradle index 07930c8..d97a25a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,3 @@ -import dev.nanite.mlp.tasks.SingleOutputJar - plugins { id("dev.nanite.mlp") version("0.0.3") id("java") @@ -107,7 +105,7 @@ publishMods { def curseForgeOptions = curseforgeOptions { accessToken = providers.environmentVariable("CURSE_TOKEN") - projectId = project.property("curse_id") + projectId = project.property("curse_id") minecraftVersions.add("${minecraft_version}") requires { slug = "trenzalore" diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/JAMDRegistry.java b/common/src/main/java/com/unrealdinnerbone/jamd/JAMDRegistry.java index 6795bd2..7ae5429 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/JAMDRegistry.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/JAMDRegistry.java @@ -11,21 +11,15 @@ import com.unrealdinnerbone.trenzalore.lib.CreativeTabs; import net.minecraft.core.BlockPos; 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; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; 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; import java.util.function.BiFunction; diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/OresCodec.java b/common/src/main/java/com/unrealdinnerbone/jamd/OresCodec.java index 89b5055..883d893 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/OresCodec.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/OresCodec.java @@ -2,15 +2,13 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.StringRepresentable; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import net.minecraft.world.level.levelgen.placement.PlacementModifier; -import org.jetbrains.annotations.NotNull; import java.util.List; -import java.util.Optional; -public record OresCodec(int oreSize, float discardChance, List modifiers, List targets) { +public record OresCodec(int oreSize, float discardChance, List modifiers, + List targets) { public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( Codec.INT.fieldOf("ore_size").forGetter(OresCodec::oreSize), Codec.FLOAT.fieldOf("discard_on_air_chance").forGetter(OresCodec::discardChance), diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/WorldType.java b/common/src/main/java/com/unrealdinnerbone/jamd/WorldType.java index 4c25311..a6dcc90 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/WorldType.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/WorldType.java @@ -9,6 +9,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.features.OreFeatures; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -46,6 +47,7 @@ public class WorldType { private final Path configPath; private final TagKey biomeTag; + public WorldType(String name, RegistryEntry block, RegistryEntry item, RegistryEntry> blockEntity, TagKey biomeTag) { this.name = name; this.key = KeySet.of(new ResourceLocation(JAMD.MOD_ID, name)); @@ -107,32 +109,36 @@ public void export(MinecraftServer server) throws IllegalStateException, IOExcep for (PlacementModifier modifier : placementModifiers) { DataResult dataResult = PlacementModifier.CODEC.encodeStart(JsonOps.INSTANCE, modifier); Optional result = dataResult.result(); - if(result.isEmpty()) { + if (result.isEmpty()) { LOGGER.error("Failed to encode: {}", dataResult.error().get().message()); } } - DataResult json = PlacedFeature.DIRECT_CODEC.encodeStart(JsonOps.INSTANCE, placedFeature); - if (json.result().isPresent()) { - try { - JsonElement jsonElement = json.result().get(); - JsonObject jsonObject = jsonElement.getAsJsonObject(); - JsonObject feature = jsonObject.getAsJsonObject("feature"); - String featureType = GsonHelper.getAsString(feature, "type"); - FeatureTypeRegistry.getFeatureType(featureType).ifPresent(iFeatureTypeCompact -> { - try { - oresCodecs.add(iFeatureTypeCompact.getOreCodec(GsonHelper.getAsJsonObject(feature, "config"), placementModifiers)); - }catch (Exception e) { - LOGGER.error("Failed to parse ore", e); - } - }); - } catch (JsonSyntaxException e) { - LOGGER.error("Skipping ore", e); - } + //Todo better way to do this + if (!placedFeature.feature().is(OreFeatures.ORE_INFESTED)) { + DataResult json = PlacedFeature.DIRECT_CODEC.encodeStart(JsonOps.INSTANCE, placedFeature); + if (json.result().isPresent()) { + try { + JsonElement jsonElement = json.result().get(); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + JsonObject feature = jsonObject.getAsJsonObject("feature"); + String featureType = GsonHelper.getAsString(feature, "type"); + FeatureTypeRegistry.getFeatureType(featureType).ifPresent(iFeatureTypeCompact -> { + try { + oresCodecs.add(iFeatureTypeCompact.getOreCodec(GsonHelper.getAsJsonObject(feature, "config"), placementModifiers)); + } catch (Exception e) { + LOGGER.error("Failed to parse ore", e); + } + }); + } catch (JsonSyntaxException e) { + LOGGER.error("Skipping ore", e); + } + } } + DataResult result = ConfigCodec.CODEC.encodeStart(JsonOps.INSTANCE, new ConfigCodec(1, oresCodecs)); if (result.result().isPresent()) { - if(!Files.exists(JAMD.CONFIG_FOLDER)) { + if (!Files.exists(JAMD.CONFIG_FOLDER)) { Files.createDirectories(JAMD.CONFIG_FOLDER); } Files.writeString(configPath, GSON.toJson(result.result().get())); diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/api/FeatureTypeRegistry.java b/common/src/main/java/com/unrealdinnerbone/jamd/api/FeatureTypeRegistry.java index 58f0fc8..e2684ee 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/api/FeatureTypeRegistry.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/api/FeatureTypeRegistry.java @@ -1,7 +1,5 @@ package com.unrealdinnerbone.jamd.api; -import com.unrealdinnerbone.jamd.api.IFeatureTypeCompact; -import com.unrealdinnerbone.jamd.compact.MinecraftOreCompact; import com.unrealdinnerbone.trenzalore.api.platform.Services; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -11,17 +9,16 @@ import java.util.Optional; import java.util.function.Supplier; -public class FeatureTypeRegistry -{ +public class FeatureTypeRegistry { private static final Logger LOGGER = LogManager.getLogger(); public static final List> FEATURES = new ArrayList<>(); public static void register(String modId, Supplier> featureTypeCompact) { - if(Services.PLATFORM.isModLoaded(modId)) { + if (Services.PLATFORM.isModLoaded(modId)) { IFeatureTypeCompact iFeatureTypeCompact = featureTypeCompact.get(); LOGGER.debug("Registering Feature {} for {}", iFeatureTypeCompact.getFeatureType(), modId); FEATURES.add(iFeatureTypeCompact); - }else { + } else { LOGGER.debug("Skipping Feature for {} as mod is not loaded", modId); } } diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/api/IFeatureTypeCompact.java b/common/src/main/java/com/unrealdinnerbone/jamd/api/IFeatureTypeCompact.java index d8cc7f5..5a7d61a 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/api/IFeatureTypeCompact.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/api/IFeatureTypeCompact.java @@ -10,12 +10,11 @@ import java.util.List; -public interface IFeatureTypeCompact -{ +public interface IFeatureTypeCompact { default OresCodec getOreCodec(JsonObject config, List modifiers) throws IllegalArgumentException { DataResult parse = getCodec().parse(JsonOps.INSTANCE, config); - if(parse.error().isPresent()) { + if (parse.error().isPresent()) { throw new IllegalArgumentException(parse.error().get().message()); } else { return parse(parse.result().get(), modifiers); @@ -28,7 +27,7 @@ default OresCodec getOreCodec(JsonObject config, List modifie Codec getCodec(); /** - * @param value the parsed ore config codec + * @param value the parsed ore config codec * @param placementModifiers the placement modifiers to create ore codec * @return the ore codec */ diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/block/EndPortalBlock.java b/common/src/main/java/com/unrealdinnerbone/jamd/block/EndPortalBlock.java index 134d672..b5bb180 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/block/EndPortalBlock.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/block/EndPortalBlock.java @@ -1,12 +1,7 @@ package com.unrealdinnerbone.jamd.block; import com.unrealdinnerbone.jamd.JAMDRegistry; -import com.unrealdinnerbone.jamd.WorldType; import com.unrealdinnerbone.jamd.block.base.PortalBlock; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import org.jetbrains.annotations.Nullable; public class EndPortalBlock extends PortalBlock { @@ -15,6 +10,4 @@ public EndPortalBlock() { } - - } diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/block/NetherPortalBlock.java b/common/src/main/java/com/unrealdinnerbone/jamd/block/NetherPortalBlock.java index b5f16ea..32e0ac2 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/block/NetherPortalBlock.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/block/NetherPortalBlock.java @@ -2,10 +2,6 @@ import com.unrealdinnerbone.jamd.JAMDRegistry; import com.unrealdinnerbone.jamd.block.base.PortalBlock; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import org.jetbrains.annotations.Nullable; public class NetherPortalBlock extends PortalBlock { diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/block/OverworldPortalBlock.java b/common/src/main/java/com/unrealdinnerbone/jamd/block/OverworldPortalBlock.java index 1330578..07ebedd 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/block/OverworldPortalBlock.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/block/OverworldPortalBlock.java @@ -2,10 +2,6 @@ import com.unrealdinnerbone.jamd.JAMDRegistry; import com.unrealdinnerbone.jamd.block.base.PortalBlock; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import org.jetbrains.annotations.Nullable; public class OverworldPortalBlock extends PortalBlock { diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/block/base/PortalBlock.java b/common/src/main/java/com/unrealdinnerbone/jamd/block/base/PortalBlock.java index 4170b8b..d9349e7 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/block/base/PortalBlock.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/block/base/PortalBlock.java @@ -1,9 +1,7 @@ package com.unrealdinnerbone.jamd.block.base; -import com.unrealdinnerbone.jamd.JAMDRegistry; import com.unrealdinnerbone.jamd.WorldType; import com.unrealdinnerbone.jamd.util.TelerportUtils; -import com.unrealdinnerbone.trenzalore.api.registry.RegistryEntry; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; @@ -11,14 +9,11 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; @@ -26,11 +21,11 @@ public abstract class PortalBlock extends Block implements EntityBlock { - //Todo CONFIG private static final ResourceKey OVERWORLD = Level.OVERWORLD; private final WorldType type; + public PortalBlock(WorldType type) { super(Properties.of().requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.STONE).mapColor(MapColor.COLOR_BLUE)); this.type = type; @@ -46,11 +41,11 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { @Override public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { if (!level.isClientSide()) { - if(level.dimension().equals(type.getKey().level())) { + if (level.dimension().equals(type.getKey().level())) { TelerportUtils.teleport(player, OVERWORLD, pos, type); - }else if(level.dimension().equals(OVERWORLD)) { + } else if (level.dimension().equals(OVERWORLD)) { TelerportUtils.teleport(player, type.getKey().level(), pos, type); - }else { + } else { player.displayClientMessage(Component.literal("You can't teleport from this dimension"), true); } } diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/command/JamdCommand.java b/common/src/main/java/com/unrealdinnerbone/jamd/command/JamdCommand.java index 945122c..448edc3 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/command/JamdCommand.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/command/JamdCommand.java @@ -12,8 +12,8 @@ public class JamdCommand { public static void register(CommandDispatcher commandDispatcher) { commandDispatcher.register(Commands.literal("jamd") - .then(Commands.literal("reload") - .executes(JamdCommand::reload))); + .then(Commands.literal("reload") + .executes(JamdCommand::reload))); } diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/compact/MinecraftScatteredOre.java b/common/src/main/java/com/unrealdinnerbone/jamd/compact/MinecraftScatteredOre.java index 6c2b39c..4d1f614 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/compact/MinecraftScatteredOre.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/compact/MinecraftScatteredOre.java @@ -4,7 +4,6 @@ import com.unrealdinnerbone.jamd.OresCodec; import com.unrealdinnerbone.jamd.api.IFeatureTypeCompact; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.levelgen.feature.ScatteredOreFeature; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import net.minecraft.world.level.levelgen.placement.PlacementModifier; diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/util/OreRegistry.java b/common/src/main/java/com/unrealdinnerbone/jamd/util/OreRegistry.java index 931b02f..5318b10 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/util/OreRegistry.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/util/OreRegistry.java @@ -16,38 +16,38 @@ import java.nio.file.Path; import java.util.*; -public class OreRegistry -{ +public class OreRegistry { private static final Logger LOGGER = LogUtils.getLogger(); public static final Map> REGISTERED_FEATURES = new HashMap<>(); public static List getFeatures(Holder biomeHolder) { - if(biomeHolder.is(JAMDRegistry.OVERWORLD.getKey().biome())) { + if (biomeHolder.is(JAMDRegistry.OVERWORLD.getKey().biome())) { return getFeatures(JAMDRegistry.OVERWORLD); - }else if(biomeHolder.is(JAMDRegistry.NETHER.getKey().biome())) { + } else if (biomeHolder.is(JAMDRegistry.NETHER.getKey().biome())) { return getFeatures(JAMDRegistry.NETHER); - }else if(biomeHolder.is(JAMDRegistry.END.getKey().biome())) { + } else if (biomeHolder.is(JAMDRegistry.END.getKey().biome())) { return getFeatures(JAMDRegistry.END); } return Collections.emptyList(); } + public static List getFeatures(WorldType type) { - if(!REGISTERED_FEATURES.containsKey(type)) { + if (!REGISTERED_FEATURES.containsKey(type)) { try { Path resolve = JAMD.CONFIG_FOLDER.resolve(type.getName() + ".json"); - if(!Files.exists(resolve)) { + if (!Files.exists(resolve)) { return Collections.emptyList(); } String jsonString = Files.readString(resolve); JsonElement parse = new JsonParser().parse(jsonString); DataResult data = ConfigCodec.CODEC.parse(JsonOps.INSTANCE, parse); - if(data.error().isPresent()) { + if (data.error().isPresent()) { LOGGER.error("Failed to parse config: {}", data.error().get().message()); return Collections.emptyList(); } Optional result = data.result(); - if(result.isPresent()) { + if (result.isPresent()) { List features = new ArrayList<>(); ConfigCodec configCodec = result.get(); for (int i = 0; i < configCodec.oreMultiplier(); i++) { @@ -56,11 +56,11 @@ public static List getFeatures(WorldType type) { } } REGISTERED_FEATURES.put(type, features); - }else { + } else { LOGGER.error("Failed to parse config: {}", "No result"); return Collections.emptyList(); } - }catch (IOException e) { + } catch (IOException e) { LOGGER.error("Failed to read config file", e); } } diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/util/TelerportUtils.java b/common/src/main/java/com/unrealdinnerbone/jamd/util/TelerportUtils.java index f862157..7a74e8c 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/util/TelerportUtils.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/util/TelerportUtils.java @@ -1,9 +1,7 @@ package com.unrealdinnerbone.jamd.util; import com.unrealdinnerbone.jamd.JAMD; -import com.unrealdinnerbone.jamd.JAMDRegistry; import com.unrealdinnerbone.jamd.WorldType; -import com.unrealdinnerbone.jamd.block.base.PortalTileEntity; import com.unrealdinnerbone.trenzalore.api.platform.Services; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; @@ -29,7 +27,8 @@ public static void teleport(Player playerEntity, ResourceKey toWorldKey, toWorld.setBlockAndUpdate(portalLocation, registrySet.getBlock().get().defaultBlockState()); } Vec3 portalLocationVec = new Vec3(portalLocation.getX() + 0.5, portalLocation.getY() + 1, portalLocation.getZ() + 0.5); - Services.PLATFORM.teleport(playerEntity, toWorld, new PortalInfo(portalLocationVec, playerEntity.getDeltaMovement(), playerEntity.getYRot(), playerEntity.getXRot())); }, + Services.PLATFORM.teleport(playerEntity, toWorld, new PortalInfo(portalLocationVec, playerEntity.getDeltaMovement(), playerEntity.getYRot(), playerEntity.getXRot())); + }, () -> playerEntity.displayClientMessage(Component.translatable(JAMD.MOD_ID + ".invalid.pos"), true)); } else { @@ -51,7 +50,7 @@ private static Optional findPortalLocation(Level worldTo, BlockPos fro .findFirst() .orElseGet(() -> { BlockPos heightmapPos = worldTo.getHeightmapPos(Heightmap.Types.WORLD_SURFACE_WG, fromPos); - if(forLocationAround(worldTo, heightmapPos.mutable(), fromPos.getX(), fromPos.getZ(), heightmapPos.getY())) { + if (forLocationAround(worldTo, heightmapPos.mutable(), fromPos.getX(), fromPos.getZ(), heightmapPos.getY())) { return heightmapPos; } return null; @@ -63,7 +62,7 @@ private static boolean forLocationAround(Level levelTo, BlockPos.MutableBlockPos for (int x = fromX - 6; x < fromX + 6; x++) { for (int z = fromZ - 6; z < fromZ + 6; z++) { blockPos.set(x, y, z); - if(isSaveLocation(levelTo, blockPos)) { + if (isSaveLocation(levelTo, blockPos)) { return true; } } diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/util/Transformers.java b/common/src/main/java/com/unrealdinnerbone/jamd/util/Transformers.java index 1ce45e9..2d4a79e 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/util/Transformers.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/util/Transformers.java @@ -2,14 +2,10 @@ import com.unrealdinnerbone.jamd.OresCodec; import net.minecraft.core.Holder; -import net.minecraft.world.level.levelgen.VerticalAnchor; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; -import net.minecraft.world.level.levelgen.placement.*; - -import java.util.ArrayList; -import java.util.List; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; public class Transformers { diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/world/CustomFlatLevelGeneratorSettings.java b/common/src/main/java/com/unrealdinnerbone/jamd/world/CustomFlatLevelGeneratorSettings.java index 9ef29dc..85cebad 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/world/CustomFlatLevelGeneratorSettings.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/world/CustomFlatLevelGeneratorSettings.java @@ -19,13 +19,13 @@ public class CustomFlatLevelGeneratorSettings extends FlatLevelGeneratorSettings public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance.group(Biome.CODEC - .fieldOf("biome") - .forGetter(FlatLevelGeneratorSettings::getBiome), - FlatLayerInfo.CODEC.listOf().fieldOf("layers").forGetter(CustomFlatLevelGeneratorSettings::getLayersInfo)) + .fieldOf("biome") + .forGetter(FlatLevelGeneratorSettings::getBiome), + FlatLayerInfo.CODEC.listOf().fieldOf("layers").forGetter(CustomFlatLevelGeneratorSettings::getLayersInfo)) .apply(instance, instance.stable(CustomFlatLevelGeneratorSettings::create))); public static CustomFlatLevelGeneratorSettings create(Holder holder, List layersInfo) { - return new CustomFlatLevelGeneratorSettings(holder, layersInfo); + return new CustomFlatLevelGeneratorSettings(holder, layersInfo); } @Override @@ -40,7 +40,7 @@ public BiomeGenerationSettings adjustGenerationSettings(Holder holder) { return plainBuilder.build(); } - public CustomFlatLevelGeneratorSettings( Holder holder, List infos) { + public CustomFlatLevelGeneratorSettings(Holder holder, List infos) { super(Optional.empty(), holder, List.of()); getLayersInfo().clear(); getLayersInfo().addAll(infos); diff --git a/common/src/main/java/com/unrealdinnerbone/jamd/world/CustomFlatLevelSource.java b/common/src/main/java/com/unrealdinnerbone/jamd/world/CustomFlatLevelSource.java index da74706..8e92b47 100644 --- a/common/src/main/java/com/unrealdinnerbone/jamd/world/CustomFlatLevelSource.java +++ b/common/src/main/java/com/unrealdinnerbone/jamd/world/CustomFlatLevelSource.java @@ -4,7 +4,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.FlatLevelSource; -import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettings; import org.jetbrains.annotations.NotNull; public class CustomFlatLevelSource extends FlatLevelSource { diff --git a/common/src/main/resources/pack.mcmeta b/common/src/main/resources/pack.mcmeta index 52854ec..a13d0c9 100644 --- a/common/src/main/resources/pack.mcmeta +++ b/common/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { - "pack": { - "description": "${mod_name}", - "pack_format": 8 - } + "pack": { + "description": "${mod_name}", + "pack_format": 8 + } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unrealdinnerbone/jamd/JAMDFabric.java b/fabric/src/main/java/com/unrealdinnerbone/jamd/JAMDFabric.java index c111417..436e407 100644 --- a/fabric/src/main/java/com/unrealdinnerbone/jamd/JAMDFabric.java +++ b/fabric/src/main/java/com/unrealdinnerbone/jamd/JAMDFabric.java @@ -1,7 +1,6 @@ package com.unrealdinnerbone.jamd; import com.unrealdinnerbone.jamd.command.JamdCommand; -import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; @@ -10,6 +9,7 @@ public class JAMDFabric implements ModInitializer { @Override public void onInitialize() { + JAMD.init(); CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, dedicated) -> JamdCommand.register(dispatcher)); ServerLifecycleEvents.SERVER_STARTING.register(JAMD::onServerStart); } diff --git a/fabric/src/main/java/com/unrealdinnerbone/jamd/data/BlockTagProvider.java b/fabric/src/main/java/com/unrealdinnerbone/jamd/data/BlockTagProvider.java index 96501bc..f13a53e 100644 --- a/fabric/src/main/java/com/unrealdinnerbone/jamd/data/BlockTagProvider.java +++ b/fabric/src/main/java/com/unrealdinnerbone/jamd/data/BlockTagProvider.java @@ -5,7 +5,6 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.minecraft.core.HolderLookup; import net.minecraft.tags.BlockTags; -import net.minecraft.world.level.block.Blocks; import java.util.concurrent.CompletableFuture; diff --git a/fabric/src/main/java/com/unrealdinnerbone/jamd/data/JAMDData.java b/fabric/src/main/java/com/unrealdinnerbone/jamd/data/JAMDData.java index 5c8041e..f7639da 100644 --- a/fabric/src/main/java/com/unrealdinnerbone/jamd/data/JAMDData.java +++ b/fabric/src/main/java/com/unrealdinnerbone/jamd/data/JAMDData.java @@ -1,22 +1,15 @@ package com.unrealdinnerbone.jamd.data; -import com.unrealdinnerbone.jamd.JAMD; import com.unrealdinnerbone.jamd.JAMDRegistry; import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; -import net.minecraft.core.Holder; import net.minecraft.core.HolderGetter; import net.minecraft.core.RegistrySetBuilder; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BiomeDefaultFeatures; import net.minecraft.data.worldgen.BootstapContext; import net.minecraft.data.worldgen.biome.OverworldBiomes; -import net.minecraft.data.worldgen.features.OreFeatures; -import net.minecraft.data.worldgen.placement.NetherPlacements; import net.minecraft.data.worldgen.placement.OrePlacements; -import net.minecraft.data.worldgen.placement.PlacementUtils; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.Musics; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.BlockTags; @@ -25,10 +18,7 @@ import net.minecraft.world.level.dimension.BuiltinDimensionTypes; import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.levelgen.GenerationStep; -import net.minecraft.world.level.levelgen.VerticalAnchor; import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; import net.minecraft.world.level.levelgen.placement.PlacedFeature; import java.util.OptionalLong; diff --git a/fabric/src/main/java/com/unrealdinnerbone/jamd/data/ModelProvider.java b/fabric/src/main/java/com/unrealdinnerbone/jamd/data/ModelProvider.java index 3c95d24..1a76d84 100644 --- a/fabric/src/main/java/com/unrealdinnerbone/jamd/data/ModelProvider.java +++ b/fabric/src/main/java/com/unrealdinnerbone/jamd/data/ModelProvider.java @@ -5,7 +5,6 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; import net.minecraft.data.models.BlockModelGenerators; import net.minecraft.data.models.ItemModelGenerators; -import net.minecraft.world.item.CreativeModeTab; public class ModelProvider extends FabricModelProvider { diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 7987d37..e73359b 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -2,7 +2,6 @@ "schemaVersion": 1, "id": "jamd", "version": "${version}", - "name": "Just Another Mining Dimension", "description": "Adds a mining dimension to the game", "authors": [ @@ -15,7 +14,7 @@ }, "license": "All Rights Reserved unless stated otherwise. Distribution permission is given to FeedTheBeast and CurseForge for use in modpacks", "icon": "assets/jamd/icon.png", - + "accessWidener": "jamd.accesswidener", "environment": "*", "entrypoints": { "main": [ diff --git a/forge/build.gradle b/forge/build.gradle index b76b42d..9024f7d 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -22,13 +22,13 @@ repositories { dependencies { - implementation (fg.deobf("com.unrealdinnerbone:trenzalore-forge:${project.property("trenzalore_version")}+mc${project.property("minecraft_version")}-SNAPSHOT")) { + implementation(fg.deobf("com.unrealdinnerbone:trenzalore-forge:${project.property("trenzalore_version")}+mc${project.property("minecraft_version")}-SNAPSHOT")) { transitive = true } implementation fg.deobf("mekanism:Mekanism:${mekanism_version}") - minecraftLibrary ("com.unrealdinnerbone:UnRealConfig-gson:12.3.4") - runtimeOnly fg.deobf("com.sunekaer.mods:ToolKit-forge:3.0.2-build.23+mc1.20.1") - runtimeOnly fg.deobf("dev.architectury:architectury-forge:9.0.8") + minecraftLibrary("com.unrealdinnerbone:UnRealConfig-gson:12.3.4") + runtimeOnly fg.deobf("com.sunekaer.mods:ToolKit-forge:3.0.2-build.23+mc1.20.1") + runtimeOnly fg.deobf("dev.architectury:architectury-forge:9.0.8") } diff --git a/forge/src/main/java/com/unrealdinnerbone/jamd/JAMDDataForge.java b/forge/src/main/java/com/unrealdinnerbone/jamd/JAMDDataForge.java index eebd9e5..61162e8 100644 --- a/forge/src/main/java/com/unrealdinnerbone/jamd/JAMDDataForge.java +++ b/forge/src/main/java/com/unrealdinnerbone/jamd/JAMDDataForge.java @@ -1,28 +1,22 @@ package com.unrealdinnerbone.jamd; import com.unrealdinnerbone.jamd.biome.JAMDBiomeModifier; -import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.RegistrySetBuilder; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; import net.minecraft.data.worldgen.BootstapContext; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.biome.Biome; import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider; import net.minecraftforge.common.world.BiomeModifier; -import net.minecraftforge.common.world.ForgeBiomeModifiers; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.registries.ForgeRegistries; import java.util.Set; import java.util.concurrent.CompletableFuture; -public class JAMDDataForge -{ +public class JAMDDataForge { private static final ResourceKey ADD_SELF = ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, new ResourceLocation(JAMD.MOD_ID, "add_self")); @@ -46,5 +40,4 @@ public BiomeModifiers(PackOutput output, CompletableFuture