mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-05 19:47:00 -04:00
Add features to the allowed features set. Fixes features not spawning when added via the biome api. (#1796)
This commit is contained in:
parent
0b944752fc
commit
af0cec4081
2 changed files with 13 additions and 0 deletions
fabric-biome-api-v1/src/main/java/net/fabricmc/fabric
impl/biome/modification
mixin/biome/modification
|
@ -19,10 +19,12 @@ package net.fabricmc.fabric.impl.biome.modification;
|
|||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -260,6 +262,7 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
|
|||
}
|
||||
|
||||
accessor.fabric_setFeatures(features);
|
||||
accessor.fabric_setAllowedFeatures(new HashSet<>(accessor.fabric_getAllowedFeatures()));
|
||||
}
|
||||
|
||||
private void unfreezeFlowerFeatures() {
|
||||
|
@ -293,6 +296,7 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
|
|||
}
|
||||
|
||||
accessor.fabric_setFeatures(ImmutableList.copyOf(featureSteps));
|
||||
accessor.fabric_setAllowedFeatures(Set.copyOf(accessor.fabric_getAllowedFeatures()));
|
||||
}
|
||||
|
||||
private void freezeFlowerFeatures() {
|
||||
|
@ -334,6 +338,7 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
|
|||
}
|
||||
|
||||
featureSteps.get(index).add(() -> configuredFeature);
|
||||
accessor.fabric_getAllowedFeatures().add(configuredFeature);
|
||||
|
||||
// Ensure the list of flower features is up to date
|
||||
rebuildFlowerFeatures();
|
||||
|
|
|
@ -18,6 +18,7 @@ package net.fabricmc.fabric.mixin.biome.modification;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -37,6 +38,9 @@ public interface GenerationSettingsAccessor {
|
|||
@Accessor("features")
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> fabric_getFeatures();
|
||||
|
||||
@Accessor("allowedFeatures")
|
||||
Set<ConfiguredFeature<?, ?>> fabric_getAllowedFeatures();
|
||||
|
||||
@Accessor("flowerFeatures")
|
||||
List<ConfiguredFeature<?, ?>> fabric_getFlowerFeatures();
|
||||
|
||||
|
@ -48,6 +52,10 @@ public interface GenerationSettingsAccessor {
|
|||
@Mutable
|
||||
void fabric_setFeatures(List<List<Supplier<ConfiguredFeature<?, ?>>>> value);
|
||||
|
||||
@Accessor("allowedFeatures")
|
||||
@Mutable
|
||||
void fabric_setAllowedFeatures(Set<ConfiguredFeature<?, ?>> allowedFeatures);
|
||||
|
||||
@Accessor("flowerFeatures")
|
||||
@Mutable
|
||||
void fabric_setFlowerFeatures(List<ConfiguredFeature<?, ?>> value);
|
||||
|
|
Loading…
Add table
Reference in a new issue