Skip to content

Commit

Permalink
更改tab注册以适应1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MegumiKasuga committed Mar 20, 2024
1 parent f6cc418 commit 1c0c5d3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/kasuga/lib/example_env/AllExampleElements.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ public class AllExampleElements {
.itemType(GreenAppleItem::new)
.stackTo(16)
.shouldCustomRender(true)
.tab(CreativeModeTab.TAB_FOOD)
// .tab(tab)
.submit(testRegistry);

public static final CreativeTabReg tab = new CreativeTabReg("test")
.icon(greenAppleItem).submit(testRegistry);


/*
public static final FluidReg<ExampleFluid> exampleFluid = new FluidReg<ExampleFluid>("example_fluid")
Expand All @@ -67,9 +70,6 @@ public class AllExampleElements {
*/

public static final CreativeTabReg tab = new CreativeTabReg("test")
.icon(greenAppleItem).submit(testRegistry);

public static final ChannelReg Channel = new ChannelReg("example_channel")
.brand("1.0")
.loadPacket(ExampleC2SPacket.class, ExampleC2SPacket::new)
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/kasuga/lib/registrations/common/BlockReg.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ public BlockReg<T> tabTo(CreativeModeTab tab) {
return this;
}

public BlockReg<T> tabTo(CreativeTabReg reg) {
if(itemReg != null)
itemReg.tab(reg);
return this;
}

public BlockReg<T> stackSize(int size) {
if(itemReg != null)
itemReg.stackTo(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public CreativeTabReg submit(SimpleRegistry registry) {
return this;
}

public SimpleCreativeTab getTab() {
return tab;
}

@Override
public String getIdentifier() {
return "tab";
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/kasuga/lib/registrations/common/ItemReg.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public ItemReg<T> stackTo(int size) {
return this;
}

public ItemReg<T> tab(CreativeTabReg tab) {
properties.tab(tab.getTab());
return this;
}

public ItemReg<T> tab(CreativeModeTab tab) {
properties.tab(tab);
return this;
Expand Down

0 comments on commit 1c0c5d3

Please sign in to comment.