Skip to content

Commit

Permalink
🐛 修倍datagen
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuRuoLing committed Sep 6, 2024
1 parent 6efbeeb commit aa2092f
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class BlockBuilder<T extends Block> extends EntryBuilder<T> {
private ItemBuilder<? extends BlockItem, ?> itemBuilder = new BlockItemBuilder<>(this.registrator, this, this.id, BlockItem::new);
private Supplier<ItemEntry<?>> dropOther = null;
private ItemEntry<? extends BlockItem> itemEntry = null;
private BiConsumer<ItemEntry<? extends BlockItem>, RegistratorRecipeProvider> recipeFunction = null;

public BlockBuilder(AbstractRegistrator registrator, String id, Function<BlockBehaviour.Properties, T> factory) {
super(registrator, id);
Expand Down Expand Up @@ -118,6 +119,9 @@ public BlockItemBuilder<BlockItem, T> blockItem() {

public <I extends BlockItem> BlockItemBuilder<I, T> item(BiFunction<Block, Item.Properties, I> factory) {
BlockItemBuilder<I, T> itemBuilder = new BlockItemBuilder<>(this.registrator, this, this.id, factory);
if (recipeFunction != null){
itemBuilder.recipe(recipeFunction::accept);
}
this.itemBuilder = itemBuilder;
dropOther = () -> itemEntry;
return itemBuilder;
Expand Down Expand Up @@ -148,6 +152,7 @@ public BlockEntry<T> register() {

public BlockBuilder<T> recipe(BiConsumer<ItemEntry<? extends BlockItem>, RegistratorRecipeProvider> fn) {
itemBuilder.recipe(fn::accept);
this.recipeFunction = fn;
return this;
}

Expand Down

0 comments on commit aa2092f

Please sign in to comment.