Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ bin/
# fabric

run/
logs/

# github

Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,27 @@ If you run into issues, contact your launcher's support.
Before using any of these commands, make sure the seed has been configured using `/cconfig seedmapper Seed set <seed>`.

### Biome locating
Usage: `/sm:locate biome <biome>`
Usage: `/sm:locate biome <biome>`.

Locates a given biome closest to the player. All biomes in all dimensions are supported.

### Structure locating
Usage: `/sm:locate feature structure <structure>[<pieces>]{<variants>}`
Usage: `/sm:locate feature structure <structure>[<pieces>]{<variants>}`.

Locates a given structure closest to the player. All structures in all dimensions are supported. However, due to limitations in the underlying library, some structures (in particular desert pyramids, jungle temples and woodland mansions) may result in occasional false positives. For more advanced querying you can also use piece and variant data to further restrict the search. For example, the following command will search for end cities with ships: `/sm:locate feature structure end_city[end_ship]`.

### Ore highlighting
Usage: `/sm:highlight block <block> [chunks]`.

Highlights the specified block in the world. All versions from 1.13 onwards are supported. Due to high dependence on the [`OCEAN_FLOOR_WG`](https://minecraft.wiki/w/Heightmap#OCEAN_FLOOR_WG) heightmap, coal, copper and emerald ore locations may be off.

### Slime chunk locating
Usage: `/sm:locate feature slimechunk`
Usage: `/sm:locate feature slimechunk`.

Locates a slime chunk closest to the player. This will always be accurate.

### Source mutation
Usage: `/sm:source (run)|(as <entity>)|(positioned <position>)|(rotated <rotation>)|(in <dimension>)|(versioned <version>)|(seeded <seed>)`
Usage: `/sm:source (run)|(as <entity>)|(positioned <position>)|(rotated <rotation>)|(in <dimension>)|(versioned <version>)|(seeded <seed>)`.

Executes a given command from a modified source. For example, modifying the source's position will execute the command
as if you were in that position. This command is really powerful, use it!
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Mod Properties
mod_version=2.4.0
mod_version=2.5.0-beta.2
maven_group=dev.xpple
archives_base_name=seedmapper

Expand Down
85 changes: 85 additions & 0 deletions includes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,16 @@
--include-function isShallowOcean
--include-function isSnowy

--include-constant ANCIENT_DEBRIS
--include-constant ANDESITE
--include-constant Ancient_City
--include-constant AndesiteOre
--include-constant BASALT
--include-constant BASE_FLOOR
--include-constant BASE_ROOF
--include-constant BF_APPROX
--include-constant BF_FORCED_OCEAN
--include-constant BLACKSTONE
--include-constant BRIDGE_CORRIDOR_ENTRANCE
--include-constant BRIDGE_CROSSING
--include-constant BRIDGE_END
Expand All @@ -287,7 +292,13 @@
--include-constant BRIDGE_STRAIGHT
--include-constant Bastion
--include-constant Blacksmith
--include-constant BlackstoneOre
--include-constant BuriedDiamondOre
--include-constant BuriedLapisOre
--include-constant Butcher
--include-constant CLAY
--include-constant COAL_ORE
--include-constant COPPER_ORE
--include-constant CORRIDOR_CROSSING
--include-constant CORRIDOR_NETHER_WART
--include-constant CORRIDOR_STAIRS
Expand All @@ -296,13 +307,29 @@
--include-constant CORRIDOR_TURN_RIGHT
--include-constant CORRIDOR_T_CROSSING
--include-constant Church
--include-constant ClayOre
--include-constant CoalOre
--include-constant CopperOre
--include-constant DEEPSLATE
--include-constant DIAMOND_ORE
--include-constant DIORITE
--include-constant DIRT
--include-constant DeepslateOre
--include-constant DeltasGoldOre
--include-constant DeltasQuartzOre
--include-constant Desert_Pyramid
--include-constant Desert_Well
--include-constant DiamondOre
--include-constant DioriteOre
--include-constant DirtOre
--include-constant EMERALD_ORE
--include-constant END_CITY_PIECES_MAX
--include-constant END_SHIP
--include-constant EmeraldOre
--include-constant End_City
--include-constant End_Gateway
--include-constant End_Island
--include-constant ExtraGoldOre
--include-constant FAT_TOWER_BASE
--include-constant FAT_TOWER_MIDDLE
--include-constant FAT_TOWER_TOP
Expand All @@ -313,27 +340,63 @@
--include-constant FarmSmall
--include-constant Feature
--include-constant Fortress
--include-constant GOLD_ORE
--include-constant GRANITE
--include-constant GRAVEL
--include-constant Geode
--include-constant GoldOre
--include-constant GraniteOre
--include-constant GravelOre
--include-constant HOUSE_NUM
--include-constant HouseLarge
--include-constant HouseSmall
--include-constant IRON_ORE
--include-constant Igloo
--include-constant IronOre
--include-constant Jungle_Pyramid
--include-constant Jungle_Temple
--include-constant LAPIS_ORE
--include-constant LapisOre
--include-constant LargeCopperOre
--include-constant LargeDebrisOre
--include-constant LargeDiamondOre
--include-constant Library
--include-constant LowerAndesiteOre
--include-constant LowerCoalOre
--include-constant LowerDioriteOre
--include-constant LowerGoldOre
--include-constant LowerGraniteOre
--include-constant LowerRedstoneOre
--include-constant MAGMA_BLOCK
--include-constant MASK48
--include-constant MagmaOre
--include-constant Mansion
--include-constant MediumDiamondOre
--include-constant MiddleIronOre
--include-constant Mineshaft
--include-constant Monument
--include-constant NETHERRACK
--include-constant NETHER_GOLD_ORE
--include-constant NETHER_QUARTZ_ORE
--include-constant NetherGoldOre
--include-constant NetherGravelOre
--include-constant NetherQuartzOre
--include-constant Ocean_Ruin
--include-constant Outpost
--include-constant PIECE_COUNT
--include-constant REDSTONE_ORE
--include-constant RedstoneOre
--include-constant Ruined_Portal
--include-constant Ruined_Portal_N
--include-constant SECOND_FLOOR_1
--include-constant SECOND_FLOOR_2
--include-constant SECOND_ROOF
--include-constant SOUL_SAND
--include-constant STONE
--include-constant Shipwreck
--include-constant SmallDebrisOre
--include-constant SmallIronOre
--include-constant SoulSandOre
--include-constant Swamp_Hut
--include-constant THIRD_FLOOR_1
--include-constant THIRD_FLOOR_2
Expand All @@ -342,19 +405,34 @@
--include-constant TOWER_FLOOR
--include-constant TOWER_PIECE
--include-constant TOWER_TOP
--include-constant TUFF
--include-constant Trail_Ruins
--include-constant Treasure
--include-constant Trial_Chambers
--include-constant TuffOre
--include-constant UpperAndesiteOre
--include-constant UpperCoalOre
--include-constant UpperDioriteOre
--include-constant UpperGraniteOre
--include-constant UpperIronOre
--include-constant Village
--include-constant WoodHut
--include-function appendPos3List
--include-function canBiomeGenerate
--include-function checkForBiomes
--include-function checkForBiomesAtLayer
--include-function checkForTemps
--include-function createPos3List
--include-function estimateSpawn
--include-function freePos3List
--include-function genPotential
--include-function generateBaseOrePosition
--include-function generateOrePositions
--include-function generateOres
--include-function generateVeinPart
--include-function getAvailableBiomes
--include-function getBiomeCenters
--include-function getBiomeForOreGen
--include-function getBiomeParaExtremes
--include-function getBiomeParaLimits
--include-function getEndCityPieces
Expand All @@ -366,6 +444,8 @@
--include-function getLinkedGatewayChunk
--include-function getLinkedGatewayPos
--include-function getMineshafts
--include-function getOreConfig
--include-function getOreYPos
--include-function getParaDescent
--include-function getParaRange
--include-function getPossibleBiomesForLimits
Expand All @@ -377,6 +457,7 @@
--include-function isEndChunkEmpty
--include-function isViableEndCityTerrain
--include-function isViableFeatureBiome
--include-function isViableOreBiome
--include-function isViableStructurePos
--include-function isViableStructureTerrain
--include-function locateBiome
Expand All @@ -386,9 +467,11 @@
--include-function setupBiomeFilter
--include-struct BiomeFilter
--include-struct EndIsland
--include-struct OreConfig
--include-struct Piece
--include-struct Pos
--include-struct Pos3
--include-struct Pos3List
--include-struct StrongholdIter
--include-struct StructureConfig
--include-struct StructureVariant
Expand Down Expand Up @@ -581,6 +664,7 @@
--include-typedef u32
--include-typedef u64
--include-typedef u8
--include-struct RandomSource
--include-struct Xoroshiro

--include-function biome2str
Expand All @@ -589,6 +673,7 @@
--include-function initBiomeTypeColors
--include-function loadSavedSeeds
--include-function mc2str
--include-function ore2str
--include-function parseBiomeColors
--include-function savePPM
--include-function str2mc
Expand Down
2 changes: 1 addition & 1 deletion src/main/c
Submodule c updated 5 files
+952 −0 finders.c
+193 −0 finders.h
+51 −0 rng.h
+53 −0 util.c
+3 −0 util.h
6 changes: 6 additions & 0 deletions src/main/java/dev/xpple/seedmapper/SeedMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import dev.xpple.seedmapper.command.arguments.SeedResolutionArgument;
import dev.xpple.seedmapper.command.commands.BuildInfoCommand;
import dev.xpple.seedmapper.command.commands.CheckSeedCommand;
import dev.xpple.seedmapper.command.commands.ClearCommand;
import dev.xpple.seedmapper.command.commands.HighlightCommand;
import dev.xpple.seedmapper.command.commands.LocateCommand;
import dev.xpple.seedmapper.command.commands.SourceCommand;
import dev.xpple.seedmapper.config.Configs;
import dev.xpple.seedmapper.config.SeedResolutionAdapter;
import dev.xpple.seedmapper.render.RenderManager;
import dev.xpple.seedmapper.util.SeedDatabaseHelper;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
Expand Down Expand Up @@ -50,12 +53,15 @@ public void onInitializeClient() {
SeedDatabaseHelper.fetchSeeds();

ClientCommandRegistrationCallback.EVENT.register(SeedMapper::registerCommands);
RenderManager.registerEvents();
}

private static void registerCommands(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandBuildContext context) {
LocateCommand.register(dispatcher);
SourceCommand.register(dispatcher);
CheckSeedCommand.register(dispatcher);
BuildInfoCommand.register(dispatcher);
HighlightCommand.register(dispatcher);
ClearCommand.register(dispatcher);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import dev.xpple.seedmapper.command.commands.LocateCommand;
import dev.xpple.seedmapper.thread.ThreadingHelper;
import net.minecraft.network.chat.Component;

public final class CommandExceptions {

private CommandExceptions() {
}

public static final SimpleCommandExceptionType ALREADY_BUSY_LOCATING_EXCEPTION = new SimpleCommandExceptionType(Component.translatable("commands.exceptions.alreadyBusyLocating", LocateCommand.STOP_TASK_COMPONENT));
public static final SimpleCommandExceptionType ALREADY_BUSY_LOCATING_EXCEPTION = new SimpleCommandExceptionType(Component.translatable("commands.exceptions.alreadyBusyLocating", ThreadingHelper.STOP_TASK_COMPONENT));
public static final DynamicCommandExceptionType UNKNOWN_DIMENSION_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.unknownDimension", arg));
public static final DynamicCommandExceptionType UNKNOWN_VERSION_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.unknownVersion", arg));
public static final DynamicCommandExceptionType UNKNOWN_BIOME_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.unknownBiome", arg));
public static final DynamicCommandExceptionType UNKNOWN_STRUCTURE_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.unknownStructure", arg));
public static final DynamicCommandExceptionType UNKNOWN_STRUCTURE_PIECE_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.unknownStructurePiece", arg));
public static final DynamicCommandExceptionType UNKNOWN_VARIANT_KEY_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.unknownVariantKey", arg));
public static final DynamicCommandExceptionType UNKNOWN_VARIANT_VALUE_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.unknownVariantValue", arg));
public static final DynamicCommandExceptionType UNKNOWN_BLOCK_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.unknownOre", arg));
public static final SimpleCommandExceptionType NO_SEED_AVAILABLE_EXCEPTION = new SimpleCommandExceptionType(Component.translatable("commands.exceptions.noSeedAvailable"));
public static final DynamicCommandExceptionType NO_BIOME_FOUND_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.noBiomeFound", arg));
public static final DynamicCommandExceptionType NO_STRUCTURE_FOUND_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.exceptions.noStructureFound", arg));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package dev.xpple.seedmapper.command.arguments;

import com.github.cubiomes.Cubiomes;
import com.google.common.collect.ImmutableMap;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import com.mojang.datafixers.util.Pair;
import dev.xpple.seedmapper.command.CommandExceptions;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.commands.SharedSuggestionProvider;
import net.minecraft.world.level.material.MapColor;

import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

public class BlockArgument implements ArgumentType<Pair<Integer, Integer>> {

private static final Collection<String> EXAMPLES = Arrays.asList("diamond_ore", "gold_ore", "nether_quartz_ore");

public static final Map<String, Pair<Integer, Integer>> BLOCKS = ImmutableMap.<String, Pair<Integer, Integer>>builder()
.put("ancient_debris", Pair.of(Cubiomes.ANCIENT_DEBRIS(), MapColor.TERRACOTTA_BROWN.col))
.put("andesite", Pair.of(Cubiomes.ANDESITE(), MapColor.STONE.col))
.put("basalt", Pair.of(Cubiomes.BASALT(), MapColor.COLOR_BLACK.col))
.put("blackstone", Pair.of(Cubiomes.BLACKSTONE(), MapColor.COLOR_BLACK.col))
.put("clay", Pair.of(Cubiomes.CLAY(), MapColor.CLAY.col))
.put("coal_ore", Pair.of(Cubiomes.COAL_ORE(), MapColor.COLOR_BLACK.col))
.put("copper_ore", Pair.of(Cubiomes.COPPER_ORE(), MapColor.COLOR_ORANGE.col))
.put("deepslate", Pair.of(Cubiomes.DEEPSLATE(), MapColor.DEEPSLATE.col))
.put("diamond_ore", Pair.of(Cubiomes.DIAMOND_ORE(), MapColor.DIAMOND.col))
.put("diorite", Pair.of(Cubiomes.DIORITE(), MapColor.QUARTZ.col))
.put("dirt", Pair.of(Cubiomes.DIRT(), MapColor.DIRT.col))
.put("emerald_ore", Pair.of(Cubiomes.EMERALD_ORE(), MapColor.EMERALD.col))
.put("gold_ore", Pair.of(Cubiomes.GOLD_ORE(), MapColor.GOLD.col))
.put("granite", Pair.of(Cubiomes.GRANITE(), MapColor.DIRT.col))
.put("gravel", Pair.of(Cubiomes.GRAVEL(), MapColor.STONE.col))
.put("iron_ore", Pair.of(Cubiomes.IRON_ORE(), MapColor.RAW_IRON.col))
.put("lapis_ore", Pair.of(Cubiomes.LAPIS_ORE(), MapColor.LAPIS.col))
.put("magma_block", Pair.of(Cubiomes.MAGMA_BLOCK(), MapColor.NETHER.col))
.put("netherrack", Pair.of(Cubiomes.NETHERRACK(), MapColor.NETHER.col))
.put("nether_gold_ore", Pair.of(Cubiomes.NETHER_GOLD_ORE(), MapColor.GOLD.col))
.put("nether_quartz_ore", Pair.of(Cubiomes.NETHER_QUARTZ_ORE(), MapColor.QUARTZ.col))
.put("redstone_ore", Pair.of(Cubiomes.REDSTONE_ORE(), MapColor.FIRE.col))
.put("soul_sand", Pair.of(Cubiomes.SOUL_SAND(), MapColor.COLOR_BROWN.col))
.put("stone", Pair.of(Cubiomes.STONE(), MapColor.STONE.col))
.put("tuff", Pair.of(Cubiomes.TUFF(), MapColor.COLOR_GRAY.col))
.build();

public static BlockArgument block() {
return new BlockArgument();
}

@SuppressWarnings("unchecked")
public static Pair<Integer, Integer> getBlock(CommandContext<FabricClientCommandSource> context, String name) {
return (Pair<Integer, Integer>) context.getArgument(name, Pair.class);
}

@Override
public Pair<Integer, Integer> parse(StringReader reader) throws CommandSyntaxException {
int cursor = reader.getCursor();
String blockString = reader.readUnquotedString();
Pair<Integer, Integer> blockPair = BLOCKS.get(blockString);
if (blockPair == null) {
reader.setCursor(cursor);
throw CommandExceptions.UNKNOWN_BLOCK_EXCEPTION.create(blockString);
}
return blockPair;
}

@Override
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
return SharedSuggestionProvider.suggest(BLOCKS.keySet(), builder);
}

@Override
public Collection<String> getExamples() {
return EXAMPLES;
}
}
Loading