Skip to content

Commit

Permalink
🌟 更新注册 API
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed Sep 4, 2024
1 parent 6c0a8b3 commit ff2b27b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
31 changes: 22 additions & 9 deletions common/src/main/java/dev/anvilcraft/lib/data/DataProviderType.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,44 @@ public interface DataProviderType<P extends DataProvider> {
DataProviderType<AnvilLibItemModelProvider> ITEM_MODEL = new DataProviderType<>() {
@Override
public void create(DataGenerator.@NotNull PackGenerator generator, @NotNull String namespace, @NotNull List<Consumer<AnvilLibItemModelProvider>> consumer) {
generator.addProvider(packOutput -> new AnvilLibItemModelProvider(
generator.addProvider(packOutput -> {
AnvilLibItemModelProvider provider = new AnvilLibItemModelProvider(
"models/item",
namespace,
packOutput
));
);
consumer.forEach(c -> c.accept(provider));
return provider;
});
}
};
DataProviderType<AnvilLibBlockModelProvider> BLOCK_MODEL = new DataProviderType<>() {
@Override
public void create(DataGenerator.@NotNull PackGenerator generator, @NotNull String namespace, @NotNull List<Consumer<AnvilLibBlockModelProvider>> consumer) {
generator.addProvider(packOutput -> new AnvilLibBlockModelProvider(
"models/block",
namespace,
packOutput
));
generator.addProvider(packOutput -> {
AnvilLibBlockModelProvider provider =
new AnvilLibBlockModelProvider(
"models/block",
namespace,
packOutput
);
consumer.forEach(c -> c.accept(provider));
return provider;
});
}
};
DataProviderType<AnvilLibBlockStateProvider> BLOCK_STATE = new DataProviderType<AnvilLibBlockStateProvider>() {
@Override
public void create(DataGenerator.@NotNull PackGenerator generator, @NotNull String namespace, @NotNull List<Consumer<AnvilLibBlockStateProvider>> consumer) {
generator.addProvider(packOutput -> new AnvilLibBlockStateProvider(
generator.addProvider(packOutput -> {
AnvilLibBlockStateProvider provider = new AnvilLibBlockStateProvider(
"blockstates",
namespace,
packOutput
));
);
consumer.forEach(c -> c.accept(provider));
return provider;
});
}
};
DataProviderType<RegistratorRecipeProvider> RECIPE = new DataProviderType<>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "anvil-lib-test:item/test"
}
}

0 comments on commit ff2b27b

Please sign in to comment.