Skip to content

Commit

Permalink
Start on 24w21a
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed May 22, 2024
1 parent 3c207ba commit 177b3ee
Show file tree
Hide file tree
Showing 118 changed files with 352 additions and 350 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ private static <T> AbstractMap.SimpleEntry<TagKey<T>, TagKey<T>> createMapEntry(
}

private static <T> TagKey<T> createTagKeyUnderC(RegistryKey<Registry<T>> registryKey, String tagId) {
return TagKey.of(registryKey, new Identifier(TagUtil.C_TAG_NAMESPACE, tagId));
return TagKey.of(registryKey, Identifier.method_60655(TagUtil.C_TAG_NAMESPACE, tagId));
}

private static <T> TagKey<T> createTagKeyUnderFabric(RegistryKey<Registry<T>> registryKey, String tagId) {
return TagKey.of(registryKey, new Identifier(TagUtil.FABRIC_TAG_NAMESPACE, tagId));
return TagKey.of(registryKey, Identifier.method_60655(TagUtil.FABRIC_TAG_NAMESPACE, tagId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ private TagRegistration(RegistryKey<Registry<T>> registry) {

@Deprecated
public TagKey<T> registerFabric(String tagId) {
return TagKey.of(registryKey, new Identifier("fabric", tagId));
return TagKey.of(registryKey, Identifier.method_60655("fabric", tagId));
}

@Deprecated
public TagKey<T> registerC(String tagId) {
return TagKey.of(registryKey, new Identifier("c", tagId));
return TagKey.of(registryKey, Identifier.method_60655("c", tagId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface ExtraModelProvider {
* @param out Accepts paths to be loaded. Arguments that are {@link ModelIdentifier} will be
* loaded through the blockstate JSON system or, if the variant is {@code inventory}, the item model folder.
* Otherwise, the argument is directly loaded as a JSON.
* For example, <pre>new Identifier("mymod", "foo/bar")</pre> will request loading of the file
* For example, <pre>Identifier.method_60655("mymod", "foo/bar")</pre> will request loading of the file
* <pre>/assets/mymod/models/foo/bar.json</pre>
*/
void provideExtraModels(ResourceManager manager, Consumer<Identifier> out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public final T invoker() {
* The identifier of the default phase.
* Have a look at {@link EventFactory#createWithPhases} for an explanation of event phases.
*/
public static final Identifier DEFAULT_PHASE = new Identifier("fabric", "default");
public static final Identifier DEFAULT_PHASE = Identifier.method_60655("fabric", "default");

/**
* Register a listener to the event for the specified phase.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ private static void testDefaultPhaseOnly() {
}

private static void testMultipleDefaultPhases() {
Identifier first = new Identifier("fabric", "first");
Identifier second = new Identifier("fabric", "second");
Identifier first = Identifier.method_60655("fabric", "first");
Identifier second = Identifier.method_60655("fabric", "second");
Event<Test> event = EventFactory.createWithPhases(Test.class, INVOKER_FACTORY, first, second, Event.DEFAULT_PHASE);

event.register(second, ensureOrder(1));
Expand All @@ -100,10 +100,10 @@ private static void testMultipleDefaultPhases() {
private static void testAddedPhases() {
Event<Test> event = createEvent();

Identifier veryEarly = new Identifier("fabric", "very_early");
Identifier early = new Identifier("fabric", "early");
Identifier late = new Identifier("fabric", "late");
Identifier veryLate = new Identifier("fabric", "very_late");
Identifier veryEarly = Identifier.method_60655("fabric", "very_early");
Identifier early = Identifier.method_60655("fabric", "early");
Identifier late = Identifier.method_60655("fabric", "late");
Identifier veryLate = Identifier.method_60655("fabric", "very_late");

event.addPhaseOrdering(veryEarly, early);
event.addPhaseOrdering(early, Event.DEFAULT_PHASE);
Expand Down Expand Up @@ -131,10 +131,10 @@ private static void testAddedPhases() {
private static void testCycle() {
Event<Test> event = createEvent();

Identifier a = new Identifier("fabric", "a");
Identifier b1 = new Identifier("fabric", "b1");
Identifier b2 = new Identifier("fabric", "b2");
Identifier b3 = new Identifier("fabric", "b3");
Identifier a = Identifier.method_60655("fabric", "a");
Identifier b1 = Identifier.method_60655("fabric", "b1");
Identifier b2 = Identifier.method_60655("fabric", "b2");
Identifier b3 = Identifier.method_60655("fabric", "b3");
Identifier c = Event.DEFAULT_PHASE;

// A always first and C always last.
Expand Down Expand Up @@ -184,13 +184,13 @@ private static void testCycle() {
* We get for the final order: [a, d, e, cycle [b, y, z], f].
*/
private static void testDeterministicOrdering() {
Identifier a = new Identifier("fabric", "a");
Identifier b = new Identifier("fabric", "b");
Identifier d = new Identifier("fabric", "d");
Identifier e = new Identifier("fabric", "e");
Identifier f = new Identifier("fabric", "f");
Identifier y = new Identifier("fabric", "y");
Identifier z = new Identifier("fabric", "z");
Identifier a = Identifier.method_60655("fabric", "a");
Identifier b = Identifier.method_60655("fabric", "b");
Identifier d = Identifier.method_60655("fabric", "d");
Identifier e = Identifier.method_60655("fabric", "e");
Identifier f = Identifier.method_60655("fabric", "f");
Identifier y = Identifier.method_60655("fabric", "y");
Identifier z = Identifier.method_60655("fabric", "z");

List<Consumer<Event<Test>>> dependencies = List.of(
ev -> ev.addPhaseOrdering(a, z),
Expand Down Expand Up @@ -229,11 +229,11 @@ private static void testDeterministicOrdering() {
* </pre>
*/
private static void testTwoCycles() {
Identifier a = new Identifier("fabric", "a");
Identifier b = new Identifier("fabric", "b");
Identifier c = new Identifier("fabric", "c");
Identifier d = new Identifier("fabric", "d");
Identifier e = new Identifier("fabric", "e");
Identifier a = Identifier.method_60655("fabric", "a");
Identifier b = Identifier.method_60655("fabric", "b");
Identifier c = Identifier.method_60655("fabric", "c");
Identifier d = Identifier.method_60655("fabric", "d");
Identifier e = Identifier.method_60655("fabric", "e");

List<Consumer<Event<Test>>> dependencies = List.of(
ev -> ev.addPhaseOrdering(e, a),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public class FabricApiLookupTest implements ModInitializer {

@Override
public void onInitialize() {
Identifier chute = new Identifier(MOD_ID, "chute");
Identifier chute = Identifier.method_60655(MOD_ID, "chute");
Registry.register(Registries.BLOCK, chute, CHUTE_BLOCK);
Registry.register(Registries.ITEM, chute, CHUTE_ITEM);
CHUTE_BLOCK_ENTITY_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, chute, FabricBlockEntityTypeBuilder.create(ChuteBlockEntity::new, CHUTE_BLOCK).build());

Identifier cobbleGen = new Identifier(MOD_ID, "cobble_gen");
Identifier cobbleGen = Identifier.method_60655(MOD_ID, "cobble_gen");
Registry.register(Registries.BLOCK, cobbleGen, COBBLE_GEN_BLOCK);
Registry.register(Registries.ITEM, cobbleGen, COBBLE_GEN_ITEM);
COBBLE_GEN_BLOCK_ENTITY_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, cobbleGen, FabricBlockEntityTypeBuilder.create(CobbleGenBlockEntity::new, COBBLE_GEN_BLOCK).build());
Expand All @@ -76,7 +76,7 @@ public void onInitialize() {
testLookupRegistry();
testSelfRegistration();

Identifier inspector = new Identifier(FabricApiLookupTest.MOD_ID, "inspector");
Identifier inspector = Identifier.method_60655(FabricApiLookupTest.MOD_ID, "inspector");
Registry.register(Registries.BLOCK, inspector, INSPECTOR_BLOCK);
Registry.register(Registries.ITEM, inspector, INSPECTOR_ITEM);

Expand All @@ -85,18 +85,18 @@ public void onInitialize() {
}

private static void testLookupRegistry() {
BlockApiLookup<ItemInsertable, @NotNull Direction> insertable2 = BlockApiLookup.get(new Identifier("testmod:item_insertable"), ItemInsertable.class, Direction.class);
BlockApiLookup<ItemInsertable, @NotNull Direction> insertable2 = BlockApiLookup.get(Identifier.method_60655("testmod", "item_insertable"), ItemInsertable.class, Direction.class);

if (insertable2 != ItemApis.INSERTABLE) {
throw new AssertionError("The registry should have returned the same instance.");
}

ensureException(() -> {
BlockApiLookup<Void, Void> wrongInsertable = BlockApiLookup.get(new Identifier("testmod:item_insertable"), Void.class, Void.class);
BlockApiLookup<Void, Void> wrongInsertable = BlockApiLookup.get(Identifier.method_60655("testmod", "item_insertable"), Void.class, Void.class);
wrongInsertable.registerFallback((world, pos, state, be, nocontext) -> null);
}, "The registry should have prevented creation of another instance with different classes, but same id.");

if (!insertable2.getId().equals(new Identifier("testmod:item_insertable"))) {
if (!insertable2.getId().equals(Identifier.method_60655("testmod", "item_insertable"))) {
throw new AssertionError("Incorrect identifier was returned.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

public final class ItemApis {
public static final BlockApiLookup<ItemInsertable, @NotNull Direction> INSERTABLE =
BlockApiLookup.get(new Identifier("testmod:item_insertable"), ItemInsertable.class, Direction.class);
BlockApiLookup.get(Identifier.method_60655("testmod", "item_insertable"), ItemInsertable.class, Direction.class);
public static final BlockApiLookup<ItemExtractable, @NotNull Direction> EXTRACTABLE =
BlockApiLookup.get(new Identifier("testmod:item_extractable"), ItemExtractable.class, Direction.class);
BlockApiLookup.get(Identifier.method_60655("testmod", "item_extractable"), ItemExtractable.class, Direction.class);

private ItemApis() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

public class FabricEntityApiLookupTest {
public static final EntityApiLookup<Inspectable, Void> INSPECTABLE =
EntityApiLookup.get(new Identifier(FabricApiLookupTest.MOD_ID, "inspectable"), Inspectable.class, Void.class);
EntityApiLookup.get(Identifier.method_60655(FabricApiLookupTest.MOD_ID, "inspectable"), Inspectable.class, Void.class);

public static final EntityType<InspectablePigEntity> INSPECTABLE_PIG = FabricEntityTypeBuilder.create()
.spawnGroup(SpawnGroup.CREATURE)
Expand All @@ -44,7 +44,7 @@ public class FabricEntityApiLookupTest {
.build();

public static void onInitialize() {
Registry.register(Registries.ENTITY_TYPE, new Identifier(FabricApiLookupTest.MOD_ID, "inspectable_pig"), INSPECTABLE_PIG);
Registry.register(Registries.ENTITY_TYPE, Identifier.method_60655(FabricApiLookupTest.MOD_ID, "inspectable_pig"), INSPECTABLE_PIG);
FabricDefaultAttributeRegistry.register(INSPECTABLE_PIG, PigEntity.createPigAttributes());

INSPECTABLE.registerSelf(INSPECTABLE_PIG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@

public class FabricItemApiLookupTest {
public static final ItemApiLookup<Inspectable, Void> INSPECTABLE =
ItemApiLookup.get(new Identifier("testmod:inspectable"), Inspectable.class, Void.class);
ItemApiLookup.get(Identifier.method_60655("testmod", "inspectable"), Inspectable.class, Void.class);

public static final InspectableItem HELLO_ITEM = new InspectableItem("Hello Fabric API tester!");

public static void onInitialize() {
Registry.register(Registries.ITEM, new Identifier(FabricApiLookupTest.MOD_ID, "hello"), HELLO_ITEM);
Registry.register(Registries.ITEM, Identifier.method_60655(FabricApiLookupTest.MOD_ID, "hello"), HELLO_ITEM);

// Diamonds and diamond blocks can be inspected and will also print their name.
INSPECTABLE.registerForItems((stack, ignored) -> () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.minecraft.util.Identifier;

public class InspectablePigEntityRenderer extends PigEntityRenderer {
private static final Identifier TEXTURE = new Identifier("missingno");
private static final Identifier TEXTURE = Identifier.method_60656("missingno");

public InspectablePigEntityRenderer(EntityRendererFactory.Context context) {
super(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@
public class DataGeneratorEntrypoint implements net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint {
public static final RegistryKey<ConfiguredFeature<?, ?>> COMMON_DESERT_WELL = RegistryKey.of(
RegistryKeys.CONFIGURED_FEATURE,
new Identifier(FabricBiomeTest.MOD_ID, "fab_desert_well")
Identifier.method_60655(FabricBiomeTest.MOD_ID, "fab_desert_well")
);
public static final RegistryKey<PlacedFeature> PLACED_COMMON_DESERT_WELL = RegistryKey.of(
RegistryKeys.PLACED_FEATURE,
new Identifier(FabricBiomeTest.MOD_ID, "fab_desert_well")
Identifier.method_60655(FabricBiomeTest.MOD_ID, "fab_desert_well")
);
public static final RegistryKey<ConfiguredFeature<?, ?>> COMMON_ORE = RegistryKey.of(
RegistryKeys.CONFIGURED_FEATURE,
new Identifier(FabricBiomeTest.MOD_ID, "common_ore")
Identifier.method_60655(FabricBiomeTest.MOD_ID, "common_ore")
);
public static final RegistryKey<PlacedFeature> PLACED_COMMON_ORE = RegistryKey.of(
RegistryKeys.PLACED_FEATURE,
new Identifier(FabricBiomeTest.MOD_ID, "common_ore")
Identifier.method_60655(FabricBiomeTest.MOD_ID, "common_ore")
);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void onInitialize() {
TheEndBiomes.addMidlandsBiome(TestBiomes.TEST_END_HIGHLANDS, TestBiomes.TEST_END_MIDLANDS, 10.0);
TheEndBiomes.addBarrensBiome(TestBiomes.TEST_END_HIGHLANDS, TestBiomes.TEST_END_BARRRENS, 10.0);

BiomeModifications.create(new Identifier("fabric:test_mod"))
BiomeModifications.create(Identifier.method_60655("fabric", "test_mod"))
.add(ModificationPhase.ADDITIONS,
BiomeSelectors.foundInOverworld(),
modification -> modification.getWeather().setDownfall(100))
Expand All @@ -78,7 +78,7 @@ public void onInitialize() {
);
})
.add(ModificationPhase.ADDITIONS,
BiomeSelectors.tag(TagKey.of(RegistryKeys.BIOME, new Identifier(MOD_ID, "tag_selector_test"))),
BiomeSelectors.tag(TagKey.of(RegistryKeys.BIOME, Identifier.method_60655(MOD_ID, "tag_selector_test"))),
context -> context.getEffects().setSkyColor(0x770000))
.add(ModificationPhase.ADDITIONS, BiomeSelectors.foundInOverworld(), context ->
context.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, PLACED_COMMON_ORE)
Expand All @@ -89,7 +89,7 @@ public void onInitialize() {
BiomeModifications.addFeature(
BiomeSelectors.foundInOverworld(),
GenerationStep.Feature.VEGETAL_DECORATION,
RegistryKey.of(RegistryKeys.PLACED_FEATURE, new Identifier(MOD_ID, "concrete_pile"))
RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.method_60655(MOD_ID, "concrete_pile"))
);

// Make sure data packs can define biomes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public TestBiomeTagProvider(FabricDataOutput output, CompletableFuture<RegistryW

@Override
protected void configure(RegistryWrapper.WrapperLookup registries) {
getOrCreateTagBuilder(TagKey.of(RegistryKeys.BIOME, new Identifier(FabricBiomeTest.MOD_ID, "biome_tag_test")))
getOrCreateTagBuilder(TagKey.of(RegistryKeys.BIOME, Identifier.method_60655(FabricBiomeTest.MOD_ID, "biome_tag_test")))
.add(TestBiomes.CUSTOM_PLAINS)
.add(TestBiomes.TEST_END_HIGHLANDS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
import net.minecraft.world.gen.feature.PlacedFeature;

public final class TestBiomes {
public static final RegistryKey<Biome> EXAMPLE_BIOME = RegistryKey.of(RegistryKeys.BIOME, new Identifier(FabricBiomeTest.MOD_ID, "example_biome"));
public static final RegistryKey<Biome> TEST_CRIMSON_FOREST = RegistryKey.of(RegistryKeys.BIOME, new Identifier(FabricBiomeTest.MOD_ID, "test_crimson_forest"));
public static final RegistryKey<Biome> CUSTOM_PLAINS = RegistryKey.of(RegistryKeys.BIOME, new Identifier(FabricBiomeTest.MOD_ID, "custom_plains"));
public static final RegistryKey<Biome> TEST_END_HIGHLANDS = RegistryKey.of(RegistryKeys.BIOME, new Identifier(FabricBiomeTest.MOD_ID, "test_end_highlands"));
public static final RegistryKey<Biome> TEST_END_MIDLANDS = RegistryKey.of(RegistryKeys.BIOME, new Identifier(FabricBiomeTest.MOD_ID, "test_end_midlands"));
public static final RegistryKey<Biome> TEST_END_BARRRENS = RegistryKey.of(RegistryKeys.BIOME, new Identifier(FabricBiomeTest.MOD_ID, "test_end_barrens"));
public static final RegistryKey<Biome> EXAMPLE_BIOME = RegistryKey.of(RegistryKeys.BIOME, Identifier.method_60655(FabricBiomeTest.MOD_ID, "example_biome"));
public static final RegistryKey<Biome> TEST_CRIMSON_FOREST = RegistryKey.of(RegistryKeys.BIOME, Identifier.method_60655(FabricBiomeTest.MOD_ID, "test_crimson_forest"));
public static final RegistryKey<Biome> CUSTOM_PLAINS = RegistryKey.of(RegistryKeys.BIOME, Identifier.method_60655(FabricBiomeTest.MOD_ID, "custom_plains"));
public static final RegistryKey<Biome> TEST_END_HIGHLANDS = RegistryKey.of(RegistryKeys.BIOME, Identifier.method_60655(FabricBiomeTest.MOD_ID, "test_end_highlands"));
public static final RegistryKey<Biome> TEST_END_MIDLANDS = RegistryKey.of(RegistryKeys.BIOME, Identifier.method_60655(FabricBiomeTest.MOD_ID, "test_end_midlands"));
public static final RegistryKey<Biome> TEST_END_BARRRENS = RegistryKey.of(RegistryKeys.BIOME, Identifier.method_60655(FabricBiomeTest.MOD_ID, "test_end_barrens"));

private TestBiomes() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ClientTagTest implements ClientModInitializer {
public void onInitializeClient() {
final ModContainer container = FabricLoader.getInstance().getModContainer(MODID).get();

if (!ResourceManagerHelper.registerBuiltinResourcePack(new Identifier(MODID, "test2"),
if (!ResourceManagerHelper.registerBuiltinResourcePack(Identifier.method_60655(MODID, "test2"),
container, ResourcePackActivationType.ALWAYS_ENABLED)) {
throw new IllegalStateException("Could not register built-in resource pack.");
}
Expand All @@ -68,7 +68,7 @@ public void onInitializeClient() {
}

if (ClientTags.isInWithLocalFallback(TagKey.of(Registries.BLOCK.getKey(),
new Identifier("fabric", "sword_efficient")), Blocks.DIRT)) {
Identifier.method_60655("fabric", "sword_efficient")), Blocks.DIRT)) {
throw new AssertionError("Expected not to find dirt in fabric:sword_efficient, but it was found!");
}

Expand All @@ -83,7 +83,7 @@ public void onInitializeClient() {
// but the this test should pass as minecraft:sword_efficient will contain dirt on the server
ClientTickEvents.END_WORLD_TICK.register(client -> {
if (!ClientTags.isInWithLocalFallback(TagKey.of(Registries.BLOCK.getKey(),
new Identifier("fabric", "sword_efficient")), Blocks.DIRT)) {
Identifier.method_60655("fabric", "sword_efficient")), Blocks.DIRT)) {
throw new AssertionError("Expected to find dirt in fabric:sword_efficient, but it was not found!");
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private EntitySelectorOptionRegistry() {
* {@code example_min_health} and can be used like {@code @e[example_min_health=5]}.
* <pre>{@code
* EntitySelectorOptionRegistry.register(
* new Identifier("example", "min_health"),
* Identifier.method_60655("example", "min_health"),
* Text.literal("Minimum entity health"),
* (reader) -> {
* final float minHealth = reader.getReader().readFloat();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

public final class CommandTest implements ModInitializer {
private static final Logger LOGGER = LoggerFactory.getLogger(CommandTest.class);
static final Identifier SELECTOR_ID = new Identifier("fabric-command-api-v2-testmod", "min_health");
static final Identifier SELECTOR_ID = Identifier.method_60655("fabric-command-api-v2-testmod", "min_health");
private static final SimpleCommandExceptionType WRONG_SIDE_SHOULD_BE_INTEGRATED = new SimpleCommandExceptionType(Text.literal("This command was registered incorrectly. Should only be present on an integrated server but was ran on a dedicated server!"));
private static final SimpleCommandExceptionType WRONG_SIDE_SHOULD_BE_DEDICATED = new SimpleCommandExceptionType(Text.literal("This command was registered incorrectly. Should only be present on an dedicated server but was ran on an integrated server!"));

Expand Down
Loading

0 comments on commit 177b3ee

Please sign in to comment.