Skip to content

Commit

Permalink
wip: start updating to 24w34a
Browse files Browse the repository at this point in the history
A lot doesn't compile with some registries having changed. Some kinds have migrated to
records, moving away from enums. This poses some slight problem with representing the kinds themselves for API usage.
  • Loading branch information
gabizou committed Aug 25, 2024
1 parent 42dc372 commit 4485781
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 22 deletions.
3 changes: 1 addition & 2 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@
import org.spongepowered.api.world.explosion.Explosion;
import org.spongepowered.api.world.generation.ChunkGenerator;
import org.spongepowered.api.world.generation.carver.Carver;
import org.spongepowered.api.world.generation.carver.CarvingStep;
import org.spongepowered.api.world.generation.config.WorldGenerationConfig;
import org.spongepowered.api.world.generation.feature.DecorationStep;
import org.spongepowered.api.world.generation.feature.PlacedFeature;
Expand Down Expand Up @@ -656,7 +655,7 @@ public final class Keys {
* The carvers of a {@link Biome} used during world generation.
* Readonly
*/
public static final Key<MapValue<CarvingStep, List<Carver>>> CARVERS = Keys.mapKey(ResourceKey.sponge("carvers"), TypeToken.get(CarvingStep.class), new TypeToken<List<Carver>>() {});
public static final Key<ListValue<Carver>> CARVERS = Keys.listKey(ResourceKey.sponge("carvers"), Carver.class);

/**
* The current casting time of a {@link Spellcaster}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@
import org.spongepowered.api.world.gamerule.GameRule;
import org.spongepowered.api.world.generation.carver.Carver;
import org.spongepowered.api.world.generation.carver.CarverType;
import org.spongepowered.api.world.generation.carver.CarvingStep;
import org.spongepowered.api.world.generation.config.flat.FlatGeneratorConfig;
import org.spongepowered.api.world.generation.config.noise.DensityFunction;
import org.spongepowered.api.world.generation.config.noise.Noise;
Expand Down Expand Up @@ -306,8 +305,6 @@ public final class RegistryTypes {

public static final DefaultedRegistryType<CatType> CAT_TYPE = RegistryTypes.minecraftKeyInGame("cat_variant");

public static final DefaultedRegistryType<CarvingStep> CARVING_STEP = RegistryTypes.spongeKeyInGame("carving_step");

public static final DefaultedRegistryType<ChatVisibility> CHAT_VISIBILITY = RegistryTypes.spongeKeyInGame("chat_visibility");

public static final DefaultedRegistryType<ChestAttachmentType> CHEST_ATTACHMENT_TYPE = RegistryTypes.spongeKeyInGame("chest_attachment_type");
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/spongepowered/api/world/biome/Biome.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.spongepowered.api.world.biome.spawner.NaturalSpawnCost;
import org.spongepowered.api.world.biome.spawner.NaturalSpawner;
import org.spongepowered.api.world.generation.carver.Carver;
import org.spongepowered.api.world.generation.carver.CarvingStep;
import org.spongepowered.api.world.generation.feature.DecorationStep;
import org.spongepowered.api.world.generation.feature.PlacedFeature;

Expand Down Expand Up @@ -116,7 +115,7 @@ default TemperatureModifier temperatureModifier() {
*
* @return The carvers
*/
default Map<CarvingStep, List<Carver>> carvers() {
default List<Carver> carvers() {
return this.require(Keys.CARVERS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
*/
package org.spongepowered.api.world.generation.carver;

import org.spongepowered.api.util.annotation.CatalogedBy;

/**
* A carving step for {@link Carver carvers}
*/
@CatalogedBy(CarvingSteps.class)
public interface CarvingStep {

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,9 @@
@RegistryScopes(scopes = RegistryScope.GAME)
public final class CarvingSteps {
// @formatter:off

public static final DefaultedRegistryReference<CarvingStep> AIR = CarvingSteps.key(ResourceKey.sponge("air"));

public static final DefaultedRegistryReference<CarvingStep> LIQUID = CarvingSteps.key(ResourceKey.sponge("liquid"));

// @formatter:on

private CarvingSteps() {
}

public static Registry<CarvingStep> registry() {
return Sponge.game().registry(RegistryTypes.CARVING_STEP);
}

private static DefaultedRegistryReference<CarvingStep> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.CARVING_STEP, location).asDefaultedReference(Sponge::game);
}
}

0 comments on commit 4485781

Please sign in to comment.