Class CustomFeature<C>
java.lang.Object
dev.wyck.wrapper.worldgen.feature.custom.CustomFeature<C>
- Type Parameters:
C- the configuration type carried toplace(PlacementContext)
- All Implemented Interfaces:
Wrapper, AbstractCustomFeature, ConfiguredFeature, Cloneable, Keyed
@NullMarked
@AsOf("2.3.0")
public abstract class CustomFeature<C>
extends Object
implements AbstractCustomFeature, Cloneable
Base class for an authored world generation feature with its own placement
algorithm.
- Since:
- 2.3.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface ConfiguredFeature
ConfiguredFeature.CustomConfigured, ConfiguredFeature.Factory, ConfiguredFeature.Reference, ConfiguredFeature.VanillaConfiguredNested classes/interfaces inherited from interface Wrapper
Wrapper.Context<C> -
Field Summary
Fields inherited from interface ConfiguredFeature
WIRE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCustomFeature(Supplier<C> configSupplier) Creates a new CustomFeature with the given configuration supplier.protectedCustomFeature(Supplier<C> configSupplier, @Nullable ResourceKey key) Creates a new CustomFeature with the given configuration supplier and registry key. -
Method Summary
Modifier and TypeMethodDescriptionprotected CustomFeature<C> clone()Clones this feature.Internal method to get the configuration supplier.key()final CInternal method to create a new configuration instance.abstract booleanplace(PlacementContext<C> context) Places this feature.final CustomFeature<C> register()Registers this feature into the FEATURE registry under the key of this feature.static <C> CustomFeature<C> register(ResourceKey key, CustomFeature<C> feature) Convenience method for registering a feature.final CustomFeature<C> registerAs(ResourceKey key) Registers this feature into the FEATURE registry under the given key.final @Nullable ResourceKeyMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConfiguredFeature
toMinecraft
-
Constructor Details
-
CustomFeature
-
CustomFeature
Creates a new CustomFeature with the given configuration supplier and registry key.- Parameters:
configSupplier- the configuration supplierkey- the key to register this feature under- Since:
- 3.0.0
-
-
Method Details
-
place
@AsOf("2.3.0") @Contract(value="null -> fail", pure=false) public abstract boolean place(PlacementContext<C> context) Places this feature.This should return true if anything was placed.
- Parameters:
context- the placement surface- Returns:
- whether placement occurred
- Since:
- 2.3.0
-
key
- Specified by:
keyin interfaceAbstractCustomFeature- Specified by:
keyin interfaceKeyed
-
resourceKey
-
configSupplier
-
newConfig
-
register
Registers this feature into the FEATURE registry under the key of this feature.- Returns:
- this feature
- Since:
- 3.0.0
-
registerAs
Registers this feature into the FEATURE registry under the given key. Must be called during the bootstrap window. After registration, compose it into a biome with ConfiguredFeature.custom(key, config).- Parameters:
key- the registry key to register under- Since:
- 2.3.0
-
register
@AsOf("2.3.0") public static <C> CustomFeature<C> register(ResourceKey key, CustomFeature<C> feature) Convenience method for registering a feature.- Type Parameters:
C- the configuration type- Parameters:
key- the registry key to register underfeature- the feature to register- Returns:
- the registered feature
- Since:
- 2.3.0
-
clone
Clones this feature.
-