fixes for 22w11a
This commit is contained in:
1 parent
302a7b4817
commit
193cf3777f
5 files changed
+17
-63
No files matched your search
@@ -47,18 +47,14 @@ public interface CarpetExtension
|
||||
* Register your own commands right after vanilla commands are added
|
||||
* 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
|
||||
* where you should register your commands
|
||||
*
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
default void registerCommands(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
final CommandBuildContext context = new CommandBuildContext(RegistryAccess.BUILTIN.get());
|
||||
context.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.RETURN_EMPTY);
|
||||
registerCommands(dispatcher, context);
|
||||
}
|
||||
default void registerCommands(CommandDispatcher<CommandSourceStack> dispatcher) {}
|
||||
|
||||
/**
|
||||
* Register your own commands right after vanilla commands are added
|
||||
@@ -69,7 +65,9 @@ public interface CarpetExtension
|
||||
* @param commandBuildContext The current {@link CommandBuildContext} context
|
||||
* * 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
extensions.forEach(e -> {
|
||||
e.registerCommands(dispatcher, commandBuildContext);
|
||||
e.registerCommands(dispatcher);
|
||||
});
|
||||
currentCommandDispatcher = dispatcher;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -85,10 +86,10 @@ public class FeatureGenerator
|
||||
CarpetSettings.skipGenerationChecks.set(false);
|
||||
}
|
||||
}
|
||||
StructureType<?> structureType = Registry.STRUCTURE_TYPES.get(id);
|
||||
if (structure != null)
|
||||
Optional<StructureType<?>> structureType = Registry.STRUCTURE_TYPES.getOptional(id);
|
||||
if (structureType.isPresent())
|
||||
{
|
||||
Structure configuredStandard = getDefaultFeature(structureType, world, pos);
|
||||
Structure configuredStandard = getDefaultFeature(structureType.get(), world, pos);
|
||||
if (configuredStandard != null)
|
||||
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("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("biome_tags", (w, b) -> {
|
||||
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("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())));
|
||||
|
||||
put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature()));
|
||||
put("fog_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFogColor()));
|
||||
|
||||
Reference in new issue
Block a user