Skip to content

Commit

Permalink
feat!: update API for 25w04a
Browse files Browse the repository at this point in the history
Breaking changes:
- CatTypes are now World Registry Scoped, so no longer defaulted
- FrogTypes are now World Registry Scoped
- EntityTypes.POTION is removed, now split in LINGERING_POTION and
  SPLASH_POTION
- DamageTypeTags.BYPASSES_SHIELD is renamed BYPASSES_BLOCKING
  • Loading branch information
gabizou committed Jan 23, 2025
1 parent 7d39d1a commit 0b462f5
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public final class BlockStateKeys {

public static final Key<Value<StructureMode>> STRUCTUREBLOCK_MODE = BlockStateKeys.key(ResourceKey.minecraft("property/mode"), StructureMode.class);

public static final Key<Value<TestBlockMode>> TEST_BLOCK_MODE = BlockStateKeys.key(ResourceKey.minecraft("property/test_block_mode"), TestBlockMode.class);
public static final Key<Value<TestBlockMode>> TEST_BLOCK_MODE = BlockStateKeys.key(ResourceKey.minecraft("property/mode"), TestBlockMode.class);

public static final Key<Value<Tilt>> TILT = BlockStateKeys.key(ResourceKey.minecraft("property/tilt"), Tilt.class);

Expand Down
36 changes: 18 additions & 18 deletions src/main/java/org/spongepowered/api/data/type/CatTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,51 +25,51 @@
package org.spongepowered.api.data.type;

import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.registry.DefaultedRegistryReference;
import org.spongepowered.api.registry.Registry;
import org.spongepowered.api.registry.RegistryKey;
import org.spongepowered.api.registry.RegistryReference;
import org.spongepowered.api.registry.RegistryScope;
import org.spongepowered.api.registry.RegistryScopes;
import org.spongepowered.api.registry.RegistryTypes;
import org.spongepowered.api.world.server.ServerWorld;

/**
* <!-- This file is automatically generated. Any manual changes will be overwritten. -->
*/
@SuppressWarnings("unused")
@RegistryScopes(scopes = RegistryScope.GAME)
@RegistryScopes(scopes = RegistryScope.WORLD)
public final class CatTypes {

public static final DefaultedRegistryReference<CatType> ALL_BLACK = CatTypes.key(ResourceKey.minecraft("all_black"));
public static final RegistryReference<CatType> ALL_BLACK = CatTypes.key(ResourceKey.minecraft("all_black"));

public static final DefaultedRegistryReference<CatType> BLACK = CatTypes.key(ResourceKey.minecraft("black"));
public static final RegistryReference<CatType> BLACK = CatTypes.key(ResourceKey.minecraft("black"));

public static final DefaultedRegistryReference<CatType> BRITISH_SHORTHAIR = CatTypes.key(ResourceKey.minecraft("british_shorthair"));
public static final RegistryReference<CatType> BRITISH_SHORTHAIR = CatTypes.key(ResourceKey.minecraft("british_shorthair"));

public static final DefaultedRegistryReference<CatType> CALICO = CatTypes.key(ResourceKey.minecraft("calico"));
public static final RegistryReference<CatType> CALICO = CatTypes.key(ResourceKey.minecraft("calico"));

public static final DefaultedRegistryReference<CatType> JELLIE = CatTypes.key(ResourceKey.minecraft("jellie"));
public static final RegistryReference<CatType> JELLIE = CatTypes.key(ResourceKey.minecraft("jellie"));

public static final DefaultedRegistryReference<CatType> PERSIAN = CatTypes.key(ResourceKey.minecraft("persian"));
public static final RegistryReference<CatType> PERSIAN = CatTypes.key(ResourceKey.minecraft("persian"));

public static final DefaultedRegistryReference<CatType> RAGDOLL = CatTypes.key(ResourceKey.minecraft("ragdoll"));
public static final RegistryReference<CatType> RAGDOLL = CatTypes.key(ResourceKey.minecraft("ragdoll"));

public static final DefaultedRegistryReference<CatType> RED = CatTypes.key(ResourceKey.minecraft("red"));
public static final RegistryReference<CatType> RED = CatTypes.key(ResourceKey.minecraft("red"));

public static final DefaultedRegistryReference<CatType> SIAMESE = CatTypes.key(ResourceKey.minecraft("siamese"));
public static final RegistryReference<CatType> SIAMESE = CatTypes.key(ResourceKey.minecraft("siamese"));

public static final DefaultedRegistryReference<CatType> TABBY = CatTypes.key(ResourceKey.minecraft("tabby"));
public static final RegistryReference<CatType> TABBY = CatTypes.key(ResourceKey.minecraft("tabby"));

public static final DefaultedRegistryReference<CatType> WHITE = CatTypes.key(ResourceKey.minecraft("white"));
public static final RegistryReference<CatType> WHITE = CatTypes.key(ResourceKey.minecraft("white"));

private CatTypes() {
}

public static Registry<CatType> registry() {
return Sponge.game().registry(RegistryTypes.CAT_TYPE);
public static Registry<CatType> registry(final ServerWorld world) {
return world.registry(RegistryTypes.CAT_TYPE);
}

private static DefaultedRegistryReference<CatType> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.CAT_TYPE, location).asDefaultedReference(Sponge::game);
private static RegistryReference<CatType> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.CAT_TYPE, location).asReference();
}
}
20 changes: 10 additions & 10 deletions src/main/java/org/spongepowered/api/data/type/FrogTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,35 @@
package org.spongepowered.api.data.type;

import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.registry.DefaultedRegistryReference;
import org.spongepowered.api.registry.Registry;
import org.spongepowered.api.registry.RegistryKey;
import org.spongepowered.api.registry.RegistryReference;
import org.spongepowered.api.registry.RegistryScope;
import org.spongepowered.api.registry.RegistryScopes;
import org.spongepowered.api.registry.RegistryTypes;
import org.spongepowered.api.world.server.ServerWorld;

/**
* <!-- This file is automatically generated. Any manual changes will be overwritten. -->
*/
@SuppressWarnings("unused")
@RegistryScopes(scopes = RegistryScope.GAME)
@RegistryScopes(scopes = RegistryScope.WORLD)
public final class FrogTypes {

public static final DefaultedRegistryReference<FrogType> COLD = FrogTypes.key(ResourceKey.minecraft("cold"));
public static final RegistryReference<FrogType> COLD = FrogTypes.key(ResourceKey.minecraft("cold"));

public static final DefaultedRegistryReference<FrogType> TEMPERATE = FrogTypes.key(ResourceKey.minecraft("temperate"));
public static final RegistryReference<FrogType> TEMPERATE = FrogTypes.key(ResourceKey.minecraft("temperate"));

public static final DefaultedRegistryReference<FrogType> WARM = FrogTypes.key(ResourceKey.minecraft("warm"));
public static final RegistryReference<FrogType> WARM = FrogTypes.key(ResourceKey.minecraft("warm"));

private FrogTypes() {
}

public static Registry<FrogType> registry() {
return Sponge.game().registry(RegistryTypes.FROG_TYPE);
public static Registry<FrogType> registry(final ServerWorld world) {
return world.registry(RegistryTypes.FROG_TYPE);
}

private static DefaultedRegistryReference<FrogType> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.FROG_TYPE, location).asDefaultedReference(Sponge::game);
private static RegistryReference<FrogType> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.FROG_TYPE, location).asReference();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public class TestBlockModes {

public static final DefaultedRegistryReference<TestBlockMode> START = TestBlockModes.key(ResourceKey.sponge("start"));


public static Registry<TestBlockMode> registry() {
return Sponge.game().registry(RegistryTypes.TEST_BLOCK_MODE);
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/spongepowered/api/entity/EntityTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ public final class EntityTypes {

public static final DefaultedRegistryReference<EntityType<LightningBolt>> LIGHTNING_BOLT = EntityTypes.key(ResourceKey.minecraft("lightning_bolt"));

public static final DefaultedRegistryReference<EntityType<Potion>> LINGERING_POTION = EntityTypes.key(ResourceKey.minecraft("lingering_potion"));

public static final DefaultedRegistryReference<EntityType<Llama>> LLAMA = EntityTypes.key(ResourceKey.minecraft("llama"));

public static final DefaultedRegistryReference<EntityType<LlamaSpit>> LLAMA_SPIT = EntityTypes.key(ResourceKey.minecraft("llama_spit"));
Expand Down Expand Up @@ -370,8 +372,6 @@ public final class EntityTypes {

public static final DefaultedRegistryReference<EntityType<PolarBear>> POLAR_BEAR = EntityTypes.key(ResourceKey.minecraft("polar_bear"));

public static final DefaultedRegistryReference<EntityType<Potion>> POTION = EntityTypes.key(ResourceKey.minecraft("potion"));

public static final DefaultedRegistryReference<EntityType<Pufferfish>> PUFFERFISH = EntityTypes.key(ResourceKey.minecraft("pufferfish"));

public static final DefaultedRegistryReference<EntityType<Rabbit>> RABBIT = EntityTypes.key(ResourceKey.minecraft("rabbit"));
Expand Down Expand Up @@ -408,6 +408,8 @@ public final class EntityTypes {

public static final DefaultedRegistryReference<EntityType<Spider>> SPIDER = EntityTypes.key(ResourceKey.minecraft("spider"));

public static final DefaultedRegistryReference<EntityType<Potion>> SPLASH_POTION = EntityTypes.key(ResourceKey.minecraft("splash_potion"));

public static final DefaultedRegistryReference<EntityType<Boat>> SPRUCE_BOAT = EntityTypes.key(ResourceKey.minecraft("spruce_boat"));

public static final DefaultedRegistryReference<EntityType<ChestBoat>> SPRUCE_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("spruce_chest_boat"));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/spongepowered/api/tag/DamageTypeTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public final class DamageTypeTags {

public static final Tag<DamageType> BYPASSES_ARMOR = DamageTypeTags.key(ResourceKey.minecraft("bypasses_armor"));

public static final Tag<DamageType> BYPASSES_BLOCKING = DamageTypeTags.key(ResourceKey.minecraft("bypasses_blocking"));

public static final Tag<DamageType> BYPASSES_EFFECTS = DamageTypeTags.key(ResourceKey.minecraft("bypasses_effects"));

public static final Tag<DamageType> BYPASSES_ENCHANTMENTS = DamageTypeTags.key(ResourceKey.minecraft("bypasses_enchantments"));
Expand All @@ -61,8 +63,6 @@ public final class DamageTypeTags {

public static final Tag<DamageType> BYPASSES_RESISTANCE = DamageTypeTags.key(ResourceKey.minecraft("bypasses_resistance"));

public static final Tag<DamageType> BYPASSES_SHIELD = DamageTypeTags.key(ResourceKey.minecraft("bypasses_shield"));

public static final Tag<DamageType> BYPASSES_WOLF_ARMOR = DamageTypeTags.key(ResourceKey.minecraft("bypasses_wolf_armor"));

public static final Tag<DamageType> CAN_BREAK_ARMOR_STAND = DamageTypeTags.key(ResourceKey.minecraft("can_break_armor_stand"));
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/spongepowered/api/tag/EntityTypeTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public final class EntityTypeTags {

public static final Tag<EntityType<?>> CAN_TURN_IN_BOATS = EntityTypeTags.key(ResourceKey.minecraft("can_turn_in_boats"));

public static final Tag<EntityType<?>> CAN_WEAR_HORSE_ARMOR = EntityTypeTags.key(ResourceKey.minecraft("can_wear_horse_armor"));

public static final Tag<EntityType<?>> DEFLECTS_PROJECTILES = EntityTypeTags.key(ResourceKey.minecraft("deflects_projectiles"));

public static final Tag<EntityType<?>> DISMOUNTS_UNDERWATER = EntityTypeTags.key(ResourceKey.minecraft("dismounts_underwater"));
Expand Down

0 comments on commit 0b462f5

Please sign in to comment.