fixes for 22w11a

This commit is contained in:
gnembon committed 2022-03-17 23:57:42 +01:00
1 parent 302a7b4817
commit 193cf3777f
5 files changed
+17 -63

No files matched your search

+7 -48
View File
@@ -357,10 +357,11 @@ Note: Have to pass all 6 of the mentioned noise types and only these noise types
With an optional feature, it returns value for the specified attribute for that biome. Available and queryable features include: With an optional feature, it returns value for the specified attribute for that biome. Available and queryable features include:
* `'top_material'`: unlocalized block representing the top surface material (1.17.1 and below only) * `'top_material'`: unlocalized block representing the top surface material (1.17.1 and below only)
* `'under_material'`: unlocalized block representing what sits below topsoil (1.17.1 and below only) * `'under_material'`: unlocalized block representing what sits below topsoil (1.17.1 and below only)
* `'category'`: the parent biome this biome is derived from. Possible values include: * `'category'`: the parent biome this biome is derived from. Possible values include (1.18.2 and below only):
`'none'`, `'taiga'`, `'extreme_hills'`, `'jungle'`, `'mesa'`, `'plains'`, `'savanna'`, `'none'`, `'taiga'`, `'extreme_hills'`, `'jungle'`, `'mesa'`, `'plains'`, `'savanna'`,
`'icy'`, `'the_end'`, `'beach'`, `'forest'`, `'ocean'`, `'desert'`, `'river'`, `'icy'`, `'the_end'`, `'beach'`, `'forest'`, `'ocean'`, `'desert'`, `'river'`,
`'swamp'`, `'mushroom'` , `'nether'`, `'underground'` (1.18+) and `'mountain'` (1.18+). `'swamp'`, `'mushroom'` , `'nether'`, `'underground'` (1.18+) and `'mountain'` (1.18+).
* `'tags'`: list of biome tags associated with this biome
* `'temperature'`: temperature from 0 to 1 * `'temperature'`: temperature from 0 to 1
* `'fog_color'`: RGBA color value of fog * `'fog_color'`: RGBA color value of fog
* `'foliage_color'`: RGBA color value of foliage * `'foliage_color'`: RGBA color value of foliage
@@ -617,9 +618,9 @@ with minecraft 1.16.1 and below or 1.16.2 and above since in 1.16.2 Mojang has a
meaning that since 1.16.2 - they have official names that can be used by datapacks and scarpet. If you have most recent meaning that since 1.16.2 - they have official names that can be used by datapacks and scarpet. If you have most recent
scarpet on 1.16.4, you can use `plop()` to get all available worldgen features including custom features and structures scarpet on 1.16.4, you can use `plop()` to get all available worldgen features including custom features and structures
controlled by datapacks. It returns a map of lists in the following categories: controlled by datapacks. It returns a map of lists in the following categories:
`'scarpet_custom'`, `'configured_features'`, `'structures'`, `'features'`, `'configured_structures'` `'scarpet_custom'`, `'configured_features'`, `'structures'`, `'features'`, `'structure_types'`
### Previous Structure Names, including variants (MC1.16.1 and below) ### Previous Structure Names, including variants (for MC1.16.1 and below only)
* `'monument'`: Ocean Monument. Generates at fixed Y coordinate, surrounds itself with water. * `'monument'`: Ocean Monument. Generates at fixed Y coordinate, surrounds itself with water.
* `'fortress'`: Nether Fortress. Altitude varies, but its bounded by the code. * `'fortress'`: Nether Fortress. Altitude varies, but its bounded by the code.
* `'mansion'`: Woodland Mansion * `'mansion'`: Woodland Mansion
@@ -713,28 +714,10 @@ controlled by datapacks. It returns a map of lists in the following categories:
* `'twisting_vines'` (1.16) * `'twisting_vines'` (1.16)
* `'basalt_pillar'` (1.16) * `'basalt_pillar'` (1.16)
### Standard Structures (as of MC1.16.2+)
Use `plop():'structures'`, but it always returns the following: ### World Generation Features and Structures (as of MC1.16.2+)
`'bastion_remnant'`, `'buried_treasure'`, `'desert_pyramid'`, `'endcity'`, `'fortress'`, `'igloo'`, Use `plop():'structure_types'`, `plop():'structures'`, `plop():'features'`, and `plop():'configured_features'` for a list of available options. Your output may vary based on
`'jungle_pyramid'`, `'mansion'`, `'mineshaft'`, `'monument'`, `'nether_fossil'`, `'ocean_ruin'`,
`'pillager_outpost'`, `'ruined_portal'`, `'shipwreck'`, `'stronghold'`, `'swamp_hut'`, `'village'`
### Structure Variants (as of MC1.16.2+)
Use `plop():'configured_structures'`, but it always returns the following:
`'bastion_remnant'`, `'buried_treasure'`, `'desert_pyramid'`, `'end_city'`, `'fortress'`, `'igloo'`,
`'jungle_pyramid'`, `'mansion'`, `'mineshaft'`, `'mineshaft_mesa'`, `'monument'`, `'nether_fossil'`,
`'ocean_ruin_cold'`, `'ocean_ruin_warm'`, `'pillager_outpost'`, `'ruined_portal'`, `'ruined_portal_desert'`,
`'ruined_portal_jungle'`, `'ruined_portal_mountain'`, `'ruined_portal_nether'`, `'ruined_portal_ocean'`,
`'ruined_portal_swamp'`, `'shipwreck'`, `'shipwreck_beached'`, `'stronghold'`, `'swamp_hut'`,
`'village_desert'`, `'village_plains'`, `'village_savanna'`, `'village_snovy'`, `'village_taiga'`
### World Generation Features (as of MC1.16.2+)
Use `plop():'features'` and `plop():'configured_features'` for a list of available options. Your output may vary based on
datapacks installed in your world. datapacks installed in your world.
### Custom Scarpet Features ### Custom Scarpet Features
@@ -817,7 +800,7 @@ Throws `unknown_structure` if structure doesn't exist.
Plops a structure or a feature at a given `pos`, so block, triple position coordinates or a list of coordinates. Plops a structure or a feature at a given `pos`, so block, triple position coordinates or a list of coordinates.
To `what` gets plopped and exactly where it often depends on the feature or structure itself. To `what` gets plopped and exactly where it often depends on the feature or structure itself.
Requires a `Structure Variant`, `Standard Structure`, `World Generation Feature` or `Custom Scarpet Feature` name (see Requires a `Structure Type`, `Structure`, `World Generation Feature` or `Custom Scarpet Feature` name (see
above). If standard name is used, the variant of the structure may depend on the biome, otherwise the default above). If standard name is used, the variant of the structure may depend on the biome, otherwise the default
structure for this type will be generated. structure for this type will be generated.
@@ -833,27 +816,3 @@ which sets it without looking into world blocks, and then use `plop` to fill it
All generated structures will retain their properties, like mob spawning, however in many cases the world / dimension All generated structures will retain their properties, like mob spawning, however in many cases the world / dimension
itself has certain rules to spawn mobs, like plopping a nether fortress in the overworld will not spawn nether mobs, itself has certain rules to spawn mobs, like plopping a nether fortress in the overworld will not spawn nether mobs,
because nether mobs can spawn only in the nether, but plopped in the nether - will behave like a valid nether fortress. because nether mobs can spawn only in the nether, but plopped in the nether - will behave like a valid nether fortress.
### (deprecated) `custom_dimension(name, seed?)`
Deprecated by `create_datapack()` which can be used to setup custom dimensions
Ensures the dimension with the given `'name'` is available and configured with the given seed. It merely sets the world
generator settings to the overworld, and the optional custom seed (or using current world seed, if not provided).
If the dimension with this name already exists, returns `false` and does nothing.
Created dimension with `custom_dimension` only exist till the game restart (same with the datapacks, if removed), but
all the world data should be saved. If custom dimension is re-created next time the app is loaded it will be using
the existing world content. This means that it is up to the programmer to make sure the custom dimensions settings
are stored in app data and restored when app reloads and wants to use previous worlds. Since vanilla game only keeps
track of world data, not the world settings, if the dimension hasn't been yet configured via `custom_dimension` and
the app hasn't yet initalized their dimension, the players will be positioned in the overworld at the same coordinates.
List of custom dimensions (to be used in the likes of `/execute in <dim>`) is only send to the clients when joining the
game, meaning custom worlds created after a player has joined will not be suggested in vanilla commands, but running
vanilla commands on them will be successful. Its due to the fact that datapacks with dimensions are always loaded
with the game and assumed not changing.
`custom_dimension` is experimental and considered a WIP. More customization options besides the seed will be added in
the future.
+5 -7
View File
@@ -47,18 +47,14 @@ public interface CarpetExtension
* Register your own commands right after vanilla commands are added * Register your own commands right after vanilla commands are added
* If that matters for you * If that matters for you
* *
* Deprecated, use either this or rather {@link CarpetExtension#registerCommands(CommandDispatcher, CommandBuildContext)} * Deprecated, Implement {@link CarpetExtension#registerCommands(CommandDispatcher, CommandBuildContext)}
* *
* @param dispatcher The current {@link CommandSource<ServerCommandSource>} dispatcher * @param dispatcher The current {@link CommandSource<ServerCommandSource>} dispatcher
* where you should register your commands * where you should register your commands
* *
*/ */
@Deprecated(forRemoval = true) @Deprecated(forRemoval = true)
default void registerCommands(CommandDispatcher<CommandSourceStack> dispatcher) { default void registerCommands(CommandDispatcher<CommandSourceStack> dispatcher) {}
final CommandBuildContext context = new CommandBuildContext(RegistryAccess.BUILTIN.get());
context.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.RETURN_EMPTY);
registerCommands(dispatcher, context);
}
/** /**
* Register your own commands right after vanilla commands are added * Register your own commands right after vanilla commands are added
@@ -69,7 +65,9 @@ public interface CarpetExtension
* @param commandBuildContext The current {@link CommandBuildContext} context * @param commandBuildContext The current {@link CommandBuildContext} context
* * which you can use for registries lookup * * which you can use for registries lookup
*/ */
default void registerCommands(CommandDispatcher<CommandSourceStack> dispatcher, final CommandBuildContext commandBuildContext) {} default void registerCommands(CommandDispatcher<CommandSourceStack> dispatcher, final CommandBuildContext commandBuildContext) {
registerCommands(dispatcher);
}
-1
View File
@@ -145,7 +145,6 @@ public class CarpetServer // static for now - easier to handle all around the co
// for all other, they will have them registered when they add themselves // for all other, they will have them registered when they add themselves
extensions.forEach(e -> { extensions.forEach(e -> {
e.registerCommands(dispatcher, commandBuildContext); e.registerCommands(dispatcher, commandBuildContext);
e.registerCommands(dispatcher);
}); });
currentCommandDispatcher = dispatcher; currentCommandDispatcher = dispatcher;
@@ -9,6 +9,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import java.util.OptionalInt; import java.util.OptionalInt;
import java.util.Random; import java.util.Random;
@@ -85,10 +86,10 @@ public class FeatureGenerator
CarpetSettings.skipGenerationChecks.set(false); CarpetSettings.skipGenerationChecks.set(false);
} }
} }
StructureType<?> structureType = Registry.STRUCTURE_TYPES.get(id); Optional<StructureType<?>> structureType = Registry.STRUCTURE_TYPES.getOptional(id);
if (structure != null) if (structureType.isPresent())
{ {
Structure configuredStandard = getDefaultFeature(structureType, world, pos); Structure configuredStandard = getDefaultFeature(structureType.get(), world, pos);
if (configuredStandard != null) if (configuredStandard != null)
return plopAnywhere(configuredStandard, world, pos, world.getChunkSource().getGenerator(), false); return plopAnywhere(configuredStandard, world, pos, world.getChunkSource().getGenerator(), false);
} }
@@ -25,10 +25,7 @@ public class BiomeInfo
//put("top_material", (w, b) -> new BlockValue( b.getGenerationSettings(). getSurfaceConfig().getTopMaterial(), null, null)); //put("top_material", (w, b) -> new BlockValue( b.getGenerationSettings(). getSurfaceConfig().getTopMaterial(), null, null));
//put("under_material", (w, b) -> new BlockValue( b.getGenerationSettings().getSurfaceConfig().getUnderMaterial(), null, null)); //put("under_material", (w, b) -> new BlockValue( b.getGenerationSettings().getSurfaceConfig().getUnderMaterial(), null, null));
//put("category", (w, b) -> StringValue.of(Biome.getBiomeCategory(Holder.direct(b)).getName())); //put("category", (w, b) -> StringValue.of(Biome.getBiomeCategory(Holder.direct(b)).getName()));
put("biome_tags", (w, b) -> { put("tags", (w, b) -> ListValue.wrap(w.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getTags().filter(p -> p.getSecond().stream().anyMatch(h -> h.value() == b)).map(p -> p.getFirst().location()).map(ValueConversions::of).collect(Collectors.toList())));
Holder<Biome> direct = Holder.direct(b);
return ListValue.wrap(w.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getTags().filter(p -> p.getSecond().contains(direct)).map(p -> p.getFirst().location()).map(ValueConversions::of).collect(Collectors.toList()));
});
put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature())); put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature()));
put("fog_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFogColor())); put("fog_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFogColor()));