diff --git a/src/main/java/me/ramidzkh/mekae2/AMItems.java b/src/main/java/me/ramidzkh/mekae2/AMItems.java index 74784f5..92ae92a 100644 --- a/src/main/java/me/ramidzkh/mekae2/AMItems.java +++ b/src/main/java/me/ramidzkh/mekae2/AMItems.java @@ -79,24 +79,25 @@ private static Item.Properties properties() { CHEMICAL_CELL_HOUSING.get())); public static final DeferredItem PORTABLE_CHEMICAL_CELL_1K = ITEMS.register( - "portable_chemical_storage_cell_1k", - () -> new ChemicalPortableCellItem(18, AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, - StorageTier.SIZE_1K, properties().stacksTo(1), 0)); + "portable_chemical_cell_1k", + () -> new ChemicalPortableCellItem(18, AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, StorageTier.SIZE_1K, + properties().stacksTo(1), 0x80caff)); public static final DeferredItem PORTABLE_CHEMICAL_CELL_4K = ITEMS.register( - "portable_chemical_storage_cell_4k", () -> new ChemicalPortableCellItem(18, - AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, StorageTier.SIZE_4K, properties().stacksTo(1), 0)); + "portable_chemical_cell_4k", + () -> new ChemicalPortableCellItem(18, AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, StorageTier.SIZE_4K, + properties().stacksTo(1), 0x80caff)); public static final DeferredItem PORTABLE_CHEMICAL_CELL_16K = ITEMS.register( - "portable_chemical_storage_cell_16k", + "portable_chemical_cell_16k", () -> new ChemicalPortableCellItem(18, AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, StorageTier.SIZE_16K, - properties().stacksTo(1), 0)); + properties().stacksTo(1), 0x80caff)); public static final DeferredItem PORTABLE_CHEMICAL_CELL_64K = ITEMS.register( - "portable_chemical_storage_cell_64k", + "portable_chemical_cell_64k", () -> new ChemicalPortableCellItem(18, AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, StorageTier.SIZE_64K, - properties().stacksTo(1), 0)); + properties().stacksTo(1), 0x80caff)); public static final DeferredItem PORTABLE_CHEMICAL_CELL_256K = ITEMS.register( - "portable_chemical_storage_cell_256k", + "portable_chemical_cell_256k", () -> new ChemicalPortableCellItem(18, AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, StorageTier.SIZE_256K, - properties().stacksTo(1), 0)); + properties().stacksTo(1), 0x80caff)); public static final DeferredItem> CHEMICAL_P2P_TUNNEL = Util.make(() -> { PartModels.registerModels(PartModelsHelper.createModels(ChemicalP2PTunnelPart.class)); diff --git a/src/main/java/me/ramidzkh/mekae2/AppliedMekanistics.java b/src/main/java/me/ramidzkh/mekae2/AppliedMekanistics.java index 0e4a56c..018e6a6 100644 --- a/src/main/java/me/ramidzkh/mekae2/AppliedMekanistics.java +++ b/src/main/java/me/ramidzkh/mekae2/AppliedMekanistics.java @@ -8,7 +8,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.neoforged.api.distmarker.Dist; @@ -140,16 +139,13 @@ public void openChestGui(Player player, IChestOrDrive chest, ICellHandler cellHa for (var tier : AMItems.Tier.values()) { var cell = AMItems.get(tier); var portable = AMItems.getPortableCell(tier); + var path = cell.getId().getPath(); - registerCell(cell::get, portable::get, cell.getId().getPath()); + StorageCellModels.registerModel(cell.get(), id("block/drive/cells/" + path)); + StorageCellModels.registerModel(portable.get(), id("block/drive/cells/" + path)); } } - private void registerCell(ItemLike cell, ItemLike portableCell, String path) { - StorageCellModels.registerModel(cell, id("block/drive/cells/" + path)); - StorageCellModels.registerModel(portableCell, id("block/drive/cells/" + path)); - } - private void initializeUpgrades() { var storageCellGroup = GuiText.StorageCells.getTranslationKey(); var portableStorageCellGroup = GuiText.PortableCells.getTranslationKey(); diff --git a/src/main/java/me/ramidzkh/mekae2/AppliedMekanisticsClient.java b/src/main/java/me/ramidzkh/mekae2/AppliedMekanisticsClient.java index 8034b6f..baa23cf 100644 --- a/src/main/java/me/ramidzkh/mekae2/AppliedMekanisticsClient.java +++ b/src/main/java/me/ramidzkh/mekae2/AppliedMekanisticsClient.java @@ -1,5 +1,7 @@ package me.ramidzkh.mekae2; +import net.minecraft.client.color.item.ItemColor; +import net.minecraft.util.FastColor; import net.neoforged.bus.api.IEventBus; import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; @@ -16,9 +18,16 @@ public static void initialize(IEventBus bus) { } private static void registerItemColors(RegisterColorHandlersEvent.Item event) { + ItemColor cells = (stack, tintIndex) -> { + return FastColor.ARGB32.opaque(BasicStorageCell.getColor(stack, tintIndex)); + }; + ItemColor portableCells = (stack, tintIndex) -> { + return FastColor.ARGB32.opaque(PortableCellItem.getColor(stack, tintIndex)); + }; + for (var tier : AMItems.Tier.values()) { - event.register(BasicStorageCell::getColor, AMItems.get(tier)::get); - event.register(PortableCellItem::getColor, AMItems.getPortableCell(tier)::get); + event.register(cells, AMItems.get(tier)::get); + event.register(portableCells, AMItems.getPortableCell(tier)::get); } } } diff --git a/src/main/java/me/ramidzkh/mekae2/data/BlockModelProvider.java b/src/main/java/me/ramidzkh/mekae2/data/BlockModelProvider.java deleted file mode 100644 index 65942d5..0000000 --- a/src/main/java/me/ramidzkh/mekae2/data/BlockModelProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -package me.ramidzkh.mekae2.data; - -import java.util.Locale; - -import net.minecraft.data.PackOutput; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.neoforge.common.data.ExistingFileHelper; - -import me.ramidzkh.mekae2.AMItems; -import me.ramidzkh.mekae2.AppliedMekanistics; - -import appeng.core.AppEng; - -public class BlockModelProvider extends net.neoforged.neoforge.client.model.generators.BlockModelProvider { - - private static final ResourceLocation DRIVE_CELL = AppEng.makeId("block/drive/drive_cell"); - - public BlockModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) { - super(output, AppliedMekanistics.ID, existingFileHelper); - - existingFileHelper.trackGenerated(DRIVE_CELL, MODEL); - } - - @Override - protected void registerModels() { - for (var tier : AMItems.Tier.values()) { - cell("chemical_storage_cell" + tier.toString().toLowerCase(Locale.ROOT)); - } - } - - private void cell(String path) { - withExistingParent("block/drive/cells/" + path, DRIVE_CELL).texture("cell", "block/drive/cells/" + path); - } -} diff --git a/src/main/java/me/ramidzkh/mekae2/data/ItemModelProvider.java b/src/main/java/me/ramidzkh/mekae2/data/ItemModelProvider.java index 523654e..6ad3bbb 100644 --- a/src/main/java/me/ramidzkh/mekae2/data/ItemModelProvider.java +++ b/src/main/java/me/ramidzkh/mekae2/data/ItemModelProvider.java @@ -16,6 +16,7 @@ public class ItemModelProvider extends net.neoforged.neoforge.client.model.gener private static final ResourceLocation P2P_TUNNEL_BASE_PART = AppEng.makeId("part/p2p/p2p_tunnel_base"); private static final ResourceLocation STORAGE_CELL_LED = AppEng.makeId("item/storage_cell_led"); private static final ResourceLocation PORTABLE_CELL_LED = AppEng.makeId("item/portable_cell_led"); + private static final ResourceLocation PORTABLE_CELL_FIELD = AppEng.makeId("item/portable_cell_screen"); private static final ResourceLocation OSMIUM_BLOCK = ResourceLocation.fromNamespaceAndPath("mekanism", "block/block_osmium"); @@ -26,19 +27,22 @@ public ItemModelProvider(PackOutput output, ExistingFileHelper existingFileHelpe existingFileHelper.trackGenerated(P2P_TUNNEL_BASE_PART, MODEL); existingFileHelper.trackGenerated(STORAGE_CELL_LED, TEXTURE); existingFileHelper.trackGenerated(PORTABLE_CELL_LED, TEXTURE); + existingFileHelper.trackGenerated(PORTABLE_CELL_FIELD, TEXTURE); existingFileHelper.trackGenerated(OSMIUM_BLOCK, TEXTURE); } @Override protected void registerModels() { var housing = AMItems.CHEMICAL_CELL_HOUSING; - flatSingleLayer(housing, "item/" + housing.getId().getPath()); + + withExistingParent(housing.getId().getPath(), mcLoc("item/generated")) + .texture("layer0", AppliedMekanistics.id("item/" + housing.getId().getPath())); for (var tier : AMItems.Tier.values()) { var cell = AMItems.get(tier); var portableCell = AMItems.getPortableCell(tier); cell(cell, "item/" + cell.getId().getPath()); - portableCell(portableCell, "item/portable_" + cell.getId().getPath()); + portableCell(portableCell, "item/" + portableCell.getId().getPath()); } withExistingParent("item/chemical_p2p_tunnel", P2P_TUNNEL_BASE_ITEM) @@ -48,13 +52,17 @@ protected void registerModels() { } private void cell(DeferredItem cell, String background) { - singleTexture(cell.getId().getPath(), mcLoc("item/generated"), "layer0", AppliedMekanistics.id(background)) + withExistingParent(cell.getId().getPath(), mcLoc("item/generated")) + .texture("layer0", AppliedMekanistics.id(background)) .texture("layer1", STORAGE_CELL_LED); } private void portableCell(DeferredItem portable, String background) { - singleTexture(portable.getId().getPath(), mcLoc("item/generated"), "layer0", AppliedMekanistics.id(background)) - .texture("layer1", PORTABLE_CELL_LED); + withExistingParent(portable.getId().getPath(), mcLoc("item/generated")) + .texture("layer0", AppliedMekanistics.id("item/portable_chemical_cell_housing")) + .texture("layer1", PORTABLE_CELL_LED) + .texture("layer2", PORTABLE_CELL_FIELD) + .texture("layer3", AppliedMekanistics.id(background)); } private void flatSingleLayer(DeferredItem item, String texture) { diff --git a/src/main/java/me/ramidzkh/mekae2/data/ItemTagsProvider.java b/src/main/java/me/ramidzkh/mekae2/data/ItemTagsProvider.java index bf3ec73..e09cc71 100644 --- a/src/main/java/me/ramidzkh/mekae2/data/ItemTagsProvider.java +++ b/src/main/java/me/ramidzkh/mekae2/data/ItemTagsProvider.java @@ -1,11 +1,14 @@ package me.ramidzkh.mekae2.data; +import java.util.List; import java.util.concurrent.CompletableFuture; import org.jetbrains.annotations.Nullable; import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.neoforged.neoforge.common.data.ExistingFileHelper; @@ -25,12 +28,11 @@ public ItemTagsProvider(PackOutput output, CompletableFuture