Skip to content

Commit f8f6469

Browse files
committed
Add worldgen:biome
1 parent fb579f0 commit f8f6469

33 files changed

Lines changed: 194 additions & 2274 deletions

fabric-biome-api-v1/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
version = getSubprojectVersion(project)
22

3-
loom {
4-
accessWidenerPath = file("src/main/resources/fabric-biome-api-v1.accesswidener")
5-
}
6-
73
testDependencies(project, [
84
':fabric-api-base',
95
':fabric-resource-loader-v0',
@@ -40,3 +36,7 @@ loom {
4036
test.dependsOn runDatagen
4137
runTestmodClient.dependsOn runDatagen
4238
generateResources.dependsOn runDatagen
39+
40+
dependencies {
41+
modApi getQslModule("worldgen", "biome")
42+
}

fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModification.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
3+
* Copyright 2022 The Quilt Project
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
56
* you may not use this file except in compliance with the License.
@@ -21,17 +22,18 @@
2122
import java.util.function.Predicate;
2223

2324
import org.jetbrains.annotations.ApiStatus;
25+
import org.quiltmc.qsl.worldgen.biome.impl.modification.BiomeModificationImpl;
2426

2527
import net.minecraft.util.Identifier;
2628

27-
import net.fabricmc.fabric.impl.biome.modification.BiomeModificationImpl;
28-
2929
/**
3030
* Provides methods for modifying biomes. To create an instance, call
3131
* {@link BiomeModifications#create(Identifier)}.
3232
*
3333
* @see BiomeModifications
34+
* @deprecated see {@link org.quiltmc.qsl.worldgen.biome.api.BiomeModification}.
3435
*/
36+
@Deprecated
3537
public class BiomeModification {
3638
private final Identifier id;
3739

@@ -45,8 +47,14 @@ public class BiomeModification {
4547
* for this are modifiers that simply add or remove features unconditionally, or change other values
4648
* to constants.
4749
*/
50+
@SuppressWarnings("unchecked")
4851
public BiomeModification add(ModificationPhase phase, Predicate<BiomeSelectionContext> selector, Consumer<BiomeModificationContext> modifier) {
49-
BiomeModificationImpl.INSTANCE.addModifier(id, phase, selector, modifier);
52+
BiomeModificationImpl.INSTANCE.addModifier(
53+
id,
54+
phase.toQuilt(),
55+
(Predicate<org.quiltmc.qsl.worldgen.biome.api.BiomeSelectionContext>) (Object) selector,
56+
(Consumer<org.quiltmc.qsl.worldgen.biome.api.BiomeModificationContext>) (Object) modifier
57+
);
5058
return this;
5159
}
5260

@@ -58,8 +66,14 @@ public BiomeModification add(ModificationPhase phase, Predicate<BiomeSelectionCo
5866
* conditions to the selector, and use a context-free modifier instead, as this will greatly help
5967
* with debugging world generation issues.
6068
*/
69+
@SuppressWarnings("unchecked")
6170
public BiomeModification add(ModificationPhase phase, Predicate<BiomeSelectionContext> selector, BiConsumer<BiomeSelectionContext, BiomeModificationContext> modifier) {
62-
BiomeModificationImpl.INSTANCE.addModifier(id, phase, selector, modifier);
71+
BiomeModificationImpl.INSTANCE.addModifier(
72+
id,
73+
phase.toQuilt(),
74+
(Predicate<org.quiltmc.qsl.worldgen.biome.api.BiomeSelectionContext>) (Object) selector,
75+
(BiConsumer<org.quiltmc.qsl.worldgen.biome.api.BiomeSelectionContext, org.quiltmc.qsl.worldgen.biome.api.BiomeModificationContext>) (Object) modifier
76+
);
6377
return this;
6478
}
6579
}

0 commit comments

Comments
 (0)