Skip to content

Commit

Permalink
feat: implement self-reference constructor supporting for BlockReg.wi…
Browse files Browse the repository at this point in the history
…thItem
  • Loading branch information
TimeBather committed Oct 29, 2024
1 parent fbd3a3c commit 9f7f5a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/kasuga/lib/registrations/common/BlockReg.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Supplier;


Expand Down Expand Up @@ -287,6 +288,13 @@ public <R extends Item> BlockReg<T> withItem(ItemReg.ItemBuilder<R> builder, Res
return this;
}

@Optional
public <R extends Item> BlockReg<T> withItem(BiFunction<T, Item.Properties, R> builder, ResourceLocation itemModelLocation) {
itemReg = new ItemReg<R>(registrationKey, itemModelLocation);
itemReg.itemType((p)->builder.apply(this.registryObject.get(),p));
return this;
}

/**
* Is your item renderer by your custom renderer? If you want to create a custom rendered item, see
* {@link kasuga.lib.core.base.CustomRenderedItem}
Expand Down

0 comments on commit 9f7f5a1

Please sign in to comment.