This commit is contained in:
gnembon committed 2024-08-28 23:43:40 +02:00
1 parent 7ee1baab2c
commit 5e89cc6ddb
23 files changed
+80 -80

No files matched your search

@@ -23,7 +23,7 @@ public class BiomeInfo
{
public static final Map<String, BiFunction<ServerLevel, Biome, Value>> biomeFeatures = new HashMap<>()
{{
put("tags", (w, b) -> ListValue.wrap(w.registryAccess().registryOrThrow(Registries.BIOME).getTags().filter(p -> p.stream().anyMatch(h -> h.value() == b)).map(ValueConversions::of)));
put("tags", (w, b) -> ListValue.wrap(w.registryAccess().lookupOrThrow(Registries.BIOME).getTags().filter(p -> p.stream().anyMatch(h -> h.value() == b)).map(ValueConversions::of)));
put("temperature", (w, b) -> NumericValue.of(b.getBaseTemperature()));
put("fog_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFogColor()));
put("foliage_color", (w, b) -> ValueConversions.ofRGB(b.getSpecialEffects().getFoliageColorOverride().orElse(4764952))); // client Biome.getDefaultFoliageColor
@@ -33,7 +33,7 @@ public class BiomeInfo
put("humidity", (w, b) -> NumericValue.of(Vanilla.Biome_getClimateSettings(b).downfall()));
put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0), w.getSeaLevel()).name().toLowerCase(Locale.ROOT)));
put("features", (w, b) -> {
Registry<ConfiguredFeature<?, ?>> registry = w.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE);
Registry<ConfiguredFeature<?, ?>> registry = w.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE);
return ListValue.wrap(
b.getGenerationSettings().features().stream().map(step ->
ListValue.wrap(step.stream().map(cfp ->
@@ -76,13 +76,13 @@ public class FeatureGenerator
return custom.apply(world).plop(world, pos);
}
ResourceLocation id = ResourceLocation.parse(featureName);
Structure structure = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(id);
Structure structure = world.registryAccess().lookupOrThrow(Registries.STRUCTURE).getValue(id);
if (structure != null)
{
return plopAnywhere(structure, world, pos, world.getChunkSource().getGenerator(), false);
}
ConfiguredFeature<?, ?> configuredFeature = world.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).get(id);
ConfiguredFeature<?, ?> configuredFeature = world.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).getValue(id);
if (configuredFeature != null)
{
ThreadLocal<Boolean> checks = Vanilla.skipGenerationChecks(world);
@@ -96,7 +96,7 @@ public class FeatureGenerator
checks.set(false);
}
}
Optional<StructureType<?>> structureType = world.registryAccess().registryOrThrow(Registries.STRUCTURE_TYPE).getOptional(id);
Optional<StructureType<?>> structureType = world.registryAccess().lookupOrThrow(Registries.STRUCTURE_TYPE).getOptional(id);
if (structureType.isPresent())
{
Structure configuredStandard = getDefaultFeature(structureType.get(), world, pos);
@@ -105,7 +105,7 @@ public class FeatureGenerator
return plopAnywhere(configuredStandard, world, pos, world.getChunkSource().getGenerator(), false);
}
}
Feature<?> feature = world.registryAccess().registryOrThrow(Registries.FEATURE).get(id);
Feature<?> feature = world.registryAccess().lookupOrThrow(Registries.FEATURE).getValue(id);
if (feature != null)
{
ConfiguredFeature<?, ?> configuredStandard = getDefaultFeature(feature, world, pos, true);
@@ -130,12 +130,12 @@ public class FeatureGenerator
public static Structure resolveConfiguredStructure(String name, ServerLevel world, BlockPos pos)
{
ResourceLocation id = ResourceLocation.parse(name);
Structure configuredStructureFeature = world.registryAccess().registryOrThrow(Registries.STRUCTURE).get(id);
Structure configuredStructureFeature = world.registryAccess().lookupOrThrow(Registries.STRUCTURE).getValue(id);
if (configuredStructureFeature != null)
{
return configuredStructureFeature;
}
StructureType<?> structureFeature = world.registryAccess().registryOrThrow(Registries.STRUCTURE_TYPE).get(id);
StructureType<?> structureFeature = world.registryAccess().lookupOrThrow(Registries.STRUCTURE_TYPE).getValue(id);
if (structureFeature == null)
{
return null;
@@ -197,7 +197,7 @@ public class FeatureGenerator
// TODO allow old types, like vaillage, or bastion
Holder<Biome> existingBiome = world.getBiome(pos);
Structure result = null;
for (Structure confstr : world.registryAccess().registryOrThrow(Registries.STRUCTURE).entrySet().stream().
for (Structure confstr : world.registryAccess().lookupOrThrow(Registries.STRUCTURE).entrySet().stream().
filter(cS -> cS.getValue().type() == structure).map(Map.Entry::getValue).toList())
{
result = confstr;
@@ -226,7 +226,7 @@ public class FeatureGenerator
{
return null;
}
return world.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).entrySet().stream().
return world.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).entrySet().stream().
filter(cS -> cS.getValue().feature() == feature).
findFirst().map(Map.Entry::getValue).orElse(null);
}
@@ -434,7 +434,7 @@ public class FeatureGenerator
if (!wireOnly)
{
Registry<Structure> registry3 = world.registryAccess().registryOrThrow(Registries.STRUCTURE);
Registry<Structure> registry3 = world.registryAccess().lookupOrThrow(Registries.STRUCTURE);
world.setCurrentlyGenerating(() -> {
Objects.requireNonNull(structure);
return registry3.getResourceKey(structure).map(Object::toString).orElseGet(structure::toString);
@@ -760,7 +760,7 @@ public class ShapeDispatcher
{
return p -> {
ParticleOptions particle;
Registry<Block> blocks = p.getServer().registryAccess().registryOrThrow(Registries.BLOCK);
Registry<Block> blocks = p.getServer().registryAccess().lookupOrThrow(Registries.BLOCK);
if (this.isitem)
{
if (Block.byItem(this.item.getItem()).defaultBlockState().isAir())