Initial 1.19.3 Porting with new Creative Tab API

This commit is contained in:
2022-12-29 18:15:42 +02:00
parent 48c0dff0dd
commit 5311799988
26 changed files with 182 additions and 146 deletions

View File

@@ -4,7 +4,6 @@ import me.hypherionmc.craterlib.network.CraterNetworkHandler;
import me.hypherionmc.craterlib.network.CraterPacket;
import me.hypherionmc.craterlib.network.FabricNetworkHandler;
import me.hypherionmc.craterlib.platform.services.LibCommonHelper;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory;
@@ -20,14 +19,11 @@ import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import org.apache.commons.lang3.function.TriFunction;
import org.jetbrains.annotations.Nullable;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* @author HypherionSA
@@ -83,19 +79,4 @@ public class FabricCommonHelper implements LibCommonHelper {
return new ExtendedScreenHandlerType<>(constructor::apply);
}
@Override
public CreativeModeTab tabBuilder(String modid, String tabid, Supplier<ItemStack> icon, String backgroundSuf) {
FabricItemGroupBuilder tab = FabricItemGroupBuilder.create(new ResourceLocation(modid, tabid));
if (icon != null) {
tab.icon(icon);
}
CreativeModeTab tab1 = tab.build();
if (backgroundSuf != null && !backgroundSuf.isEmpty()) {
tab1.setBackgroundSuffix(backgroundSuf);
}
return tab1;
}
}