-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
169 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/com/hlysine/create_power_loader/BackportUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.hlysine.create_power_loader; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.phys.Vec3; | ||
|
||
public class BackportUtils { | ||
public static BlockPos blockPosContaining(Vec3 vec) { | ||
return new BlockPos(vec.x, vec.y, vec.z); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 32 additions & 27 deletions
59
src/main/java/com/hlysine/create_power_loader/CPLCreativeTabs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,43 @@ | ||
package com.hlysine.create_power_loader; | ||
|
||
import com.simibubi.create.AllCreativeModeTabs; | ||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.resources.ResourceLocation; | ||
import com.tterrag.registrate.util.entry.ItemProviderEntry; | ||
import io.github.fabricators_of_create.porting_lib.util.ItemGroupUtil; | ||
import net.minecraft.core.NonNullList; | ||
import net.minecraft.world.item.CreativeModeTab; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.function.Supplier; | ||
import java.util.List; | ||
|
||
public class CPLCreativeTabs { | ||
public static final AllCreativeModeTabs.TabInfo MAIN = register("main", () -> FabricItemGroup.builder() | ||
.title(Component.translatable("itemGroup.create_power_loader.main")) | ||
.icon(CPLBlocks.BRASS_CHUNK_LOADER::asStack) | ||
.displayItems((params, output) -> { | ||
output.accept(CPLBlocks.EMPTY_ANDESITE_CHUNK_LOADER.asStack()); | ||
output.accept(CPLBlocks.ANDESITE_CHUNK_LOADER.asStack()); | ||
output.accept(CPLBlocks.EMPTY_BRASS_CHUNK_LOADER.asStack()); | ||
output.accept(CPLBlocks.BRASS_CHUNK_LOADER.asStack()); | ||
}) | ||
.build()); | ||
|
||
private static AllCreativeModeTabs.TabInfo register(String name, Supplier<CreativeModeTab> supplier) { | ||
ResourceLocation id = CreatePowerLoader.asResource(name); | ||
ResourceKey<CreativeModeTab> key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, id); | ||
CreativeModeTab tab = supplier.get(); | ||
Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, tab); | ||
return new AllCreativeModeTabs.TabInfo(key, tab); | ||
} | ||
public static final CreativeModeTab MAIN = new MainCreativeModeTab(); | ||
|
||
public static final List<ItemProviderEntry<?>> ITEMS = List.of( | ||
CPLBlocks.EMPTY_ANDESITE_CHUNK_LOADER, | ||
CPLBlocks.ANDESITE_CHUNK_LOADER, | ||
CPLBlocks.EMPTY_BRASS_CHUNK_LOADER, | ||
CPLBlocks.BRASS_CHUNK_LOADER | ||
); | ||
|
||
public static void register() { | ||
} | ||
|
||
public static class MainCreativeModeTab extends CreativeModeTab { | ||
|
||
public MainCreativeModeTab() { | ||
super(ItemGroupUtil.expandArrayAndGetId(), CreatePowerLoader.MODID + ".main"); | ||
} | ||
|
||
@Override | ||
public @NotNull ItemStack makeIcon() { | ||
return CPLBlocks.BRASS_CHUNK_LOADER.asStack(); | ||
} | ||
|
||
@Override | ||
public void fillItemList(@NotNull NonNullList<ItemStack> pItems) { | ||
for (ItemProviderEntry<?> item : ITEMS) { | ||
item.get().asItem().fillItemCategory(this, pItems); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.