Skip to content

Commit

Permalink
Textures Update (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ridanisaurus authored Jul 7, 2024
1 parent 54ca7c2 commit 794907e
Show file tree
Hide file tree
Showing 41 changed files with 197 additions and 91 deletions.
23 changes: 12 additions & 11 deletions src/main/java/me/ramidzkh/mekae2/AMItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,25 @@ private static Item.Properties properties() {
CHEMICAL_CELL_HOUSING.get()));

public static final DeferredItem<Item> 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<Item> 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<Item> 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<Item> 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<Item> 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<PartItem<ChemicalP2PTunnelPart>> CHEMICAL_P2P_TUNNEL = Util.make(() -> {
PartModels.registerModels(PartModelsHelper.createModels(ChemicalP2PTunnelPart.class));
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/me/ramidzkh/mekae2/AppliedMekanistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/me/ramidzkh/mekae2/AppliedMekanisticsClient.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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);
}
}
}
34 changes: 0 additions & 34 deletions src/main/java/me/ramidzkh/mekae2/data/BlockModelProvider.java

This file was deleted.

18 changes: 13 additions & 5 deletions src/main/java/me/ramidzkh/mekae2/data/ItemModelProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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)
Expand All @@ -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) {
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/me/ramidzkh/mekae2/data/ItemTagsProvider.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -25,12 +28,11 @@ public ItemTagsProvider(PackOutput output, CompletableFuture<HolderLookup.Provid

@Override
protected void addTags(HolderLookup.Provider provider) {
var tanks = P2PTunnelAttunement.getAttunementTag(AMItems.CHEMICAL_P2P_TUNNEL::get);
var tanks = tag(P2PTunnelAttunement.getAttunementTag(AMItems.CHEMICAL_P2P_TUNNEL::get));

tag(tanks).addOptional(ResourceLocation.fromNamespaceAndPath("mekanism", "basic_chemical_tank"));
tag(tanks).addOptional(ResourceLocation.fromNamespaceAndPath("mekanism", "advanced_chemical_tank"));
tag(tanks).addOptional(ResourceLocation.fromNamespaceAndPath("mekanism", "elite_chemical_tank"));
tag(tanks).addOptional(ResourceLocation.fromNamespaceAndPath("mekanism", "ultimate_chemical_tank"));
tag(tanks).addOptional(ResourceLocation.fromNamespaceAndPath("mekanism", "creative_chemical_tank"));
for (var tier : List.of("basic", "advanced", "elite", "ultimate", "creative")) {
var tank = ResourceLocation.fromNamespaceAndPath("mekanism", tier + "_chemical_tank");
tanks.add(ResourceKey.create(Registries.ITEM, tank));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public static void onGatherData(GatherDataEvent event) {
generator.addProvider(true, new ItemTagsProvider(packOutput, lookupProvider,
blockTagsProvider.contentsGetter(), existingFileHelper));

generator.addProvider(true, new BlockModelProvider(packOutput, existingFileHelper));
generator.addProvider(true, new ItemModelProvider(packOutput, existingFileHelper));
generator.addProvider(true, new RecipeProvider(packOutput, lookupProvider));
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/assets/appmek/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"item.appmek.chemical_storage_cell_64k": "64k ME Chemical Storage Cell",
"item.appmek.chemical_storage_cell_256k": "256k ME Chemical Storage Cell",

"item.appmek.portable_chemical_storage_cell_16k": "16k Portable Chemical Cell",
"item.appmek.portable_chemical_storage_cell_1k": "1k Portable Chemical Cell",
"item.appmek.portable_chemical_storage_cell_4k": "4k Portable Chemical Cell",
"item.appmek.portable_chemical_storage_cell_64k": "64k Portable Chemical Cell",
"item.appmek.portable_chemical_storage_cell_256k": "256k Portable Chemical Cell",
"item.appmek.portable_chemical_cell_16k": "16k Portable Chemical Cell",
"item.appmek.portable_chemical_cell_1k": "1k Portable Chemical Cell",
"item.appmek.portable_chemical_cell_4k": "4k Portable Chemical Cell",
"item.appmek.portable_chemical_cell_64k": "64k Portable Chemical Cell",
"item.appmek.portable_chemical_cell_256k": "256k Portable Chemical Cell",

"item.appmek.chemical_p2p_tunnel": "Chemical P2P Tunnel"
}
10 changes: 5 additions & 5 deletions src/main/resources/assets/appmek/lang/ko_kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"item.appmek.chemical_storage_cell_64k": "64k ME 화학 저장 셀",
"item.appmek.chemical_storage_cell_256k": "256k ME 화학 저장 셀",

"item.appmek.portable_chemical_storage_cell_16k": "16k 휴대용 화학 셀",
"item.appmek.portable_chemical_storage_cell_1k": "1k 휴대용 화학 셀",
"item.appmek.portable_chemical_storage_cell_4k": "4k 휴대용 화학 셀",
"item.appmek.portable_chemical_storage_cell_64k": "64k 휴대용 화학 셀",
"item.appmek.portable_chemical_storage_cell_256k": "256k 휴대용 화학 셀",
"item.appmek.portable_chemical_cell_16k": "16k 휴대용 화학 셀",
"item.appmek.portable_chemical_cell_1k": "1k 휴대용 화학 셀",
"item.appmek.portable_chemical_cell_4k": "4k 휴대용 화학 셀",
"item.appmek.portable_chemical_cell_64k": "64k 휴대용 화학 셀",
"item.appmek.portable_chemical_cell_256k": "256k 휴대용 화학 셀",

"item.appmek.chemical_p2p_tunnel": "화학 P2P 터널"
}
10 changes: 5 additions & 5 deletions src/main/resources/assets/appmek/lang/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"item.appmek.chemical_storage_cell_64k": "Célula de Armazenamento de 64k para Químicos",
"item.appmek.chemical_storage_cell_256k": "Célula de Armazenamento de 256k para Químicos",

"item.appmek.portable_chemical_storage_cell_16k": "Célula de Armazenamento Portátil de 16k para Químicos",
"item.appmek.portable_chemical_storage_cell_1k": "Célula de Armazenamento Portátil de 1k para Químicos",
"item.appmek.portable_chemical_storage_cell_4k": "Célula de Armazenamento Portátil de 4k para Químicos",
"item.appmek.portable_chemical_storage_cell_64k": "Célula de Armazenamento Portátil de 64k para Químicos",
"item.appmek.portable_chemical_storage_cell_256k": "Célula de Armazenamento Portátil de 256k para Químicos",
"item.appmek.portable_chemical_cell_16k": "Célula de Armazenamento Portátil de 16k para Químicos",
"item.appmek.portable_chemical_cell_1k": "Célula de Armazenamento Portátil de 1k para Químicos",
"item.appmek.portable_chemical_cell_4k": "Célula de Armazenamento Portátil de 4k para Químicos",
"item.appmek.portable_chemical_cell_64k": "Célula de Armazenamento Portátil de 64k para Químicos",
"item.appmek.portable_chemical_cell_256k": "Célula de Armazenamento Portátil de 256k para Químicos",

"item.appmek.chemical_p2p_tunnel": "Túnel P2P para Químicos"
}
10 changes: 5 additions & 5 deletions src/main/resources/assets/appmek/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"item.appmek.chemical_storage_cell_64k": "Химическая ячейка памяти ME 64К",
"item.appmek.chemical_storage_cell_256k": "Химическая ячейка памяти ME 256К",

"item.appmek.portable_chemical_storage_cell_16k": "Переносная химическая ячейка 16К",
"item.appmek.portable_chemical_storage_cell_1k": "Переносная химическая ячейка 1К",
"item.appmek.portable_chemical_storage_cell_4k": "Переносная химическая ячейка 4К",
"item.appmek.portable_chemical_storage_cell_64k": "Переносная химическая ячейка 64К",
"item.appmek.portable_chemical_storage_cell_256k": "Переносная химическая ячейка 256К",
"item.appmek.portable_chemical_cell_16k": "Переносная химическая ячейка 16К",
"item.appmek.portable_chemical_cell_1k": "Переносная химическая ячейка 1К",
"item.appmek.portable_chemical_cell_4k": "Переносная химическая ячейка 4К",
"item.appmek.portable_chemical_cell_64k": "Переносная химическая ячейка 64К",
"item.appmek.portable_chemical_cell_256k": "Переносная химическая ячейка 256К",

"item.appmek.chemical_p2p_tunnel": "Химический P2P тоннель"
}
10 changes: 5 additions & 5 deletions src/main/resources/assets/appmek/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"item.appmek.chemical_storage_cell_64k": "64k ME 化学品存储元件",
"item.appmek.chemical_storage_cell_256k": "256k ME 化学品存储元件",

"item.appmek.portable_chemical_storage_cell_16k": "16k 便携化学品元件",
"item.appmek.portable_chemical_storage_cell_1k": "1k 便携化学品元件",
"item.appmek.portable_chemical_storage_cell_4k": "4k 便携化学品元件",
"item.appmek.portable_chemical_storage_cell_64k": "64k 便携化学品元件",
"item.appmek.portable_chemical_storage_cell_256k": "256k 便携化学品元件",
"item.appmek.portable_chemical_cell_16k": "16k 便携化学品元件",
"item.appmek.portable_chemical_cell_1k": "1k 便携化学品元件",
"item.appmek.portable_chemical_cell_4k": "4k 便携化学品元件",
"item.appmek.portable_chemical_cell_64k": "64k 便携化学品元件",
"item.appmek.portable_chemical_cell_256k": "256k 便携化学品元件",

"item.appmek.chemical_p2p_tunnel": "化学品 P2P 通道"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"credit": "Made with Blockbench",
"ambientocclusion": false,
"textures": {
"particle": "appmek:block/drive/drive_cells",
"cell": "appmek:block/drive/drive_cells"
},
"elements": [
{
"name": "Cell Backdrop",
"from": [0, 0, 0],
"to": [6, 2, 2],
"rotation": { "angle": 0, "axis": "y", "origin": [9, 8, 8] },
"faces": {
"north": {
"uv": [0, 4, 6, 6],
"texture": "#cell",
"cullface": "north"
},
"up": { "uv": [6, 4, 0, 6], "texture": "#cell", "cullface": "north" },
"down": { "uv": [6, 4, 0, 6], "texture": "#cell", "cullface": "north" }
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"credit": "Made with Blockbench",
"ambientocclusion": false,
"textures": {
"particle": "appmek:block/drive/drive_cells",
"cell": "appmek:block/drive/drive_cells"
},
"elements": [
{
"name": "Cell Backdrop",
"from": [0, 0, 0],
"to": [6, 2, 2],
"rotation": { "angle": 0, "axis": "y", "origin": [9, 8, 8] },
"faces": {
"north": {
"uv": [0, 0, 6, 2],
"texture": "#cell",
"cullface": "north"
},
"up": { "uv": [6, 0, 0, 2], "texture": "#cell", "cullface": "north" },
"down": { "uv": [6, 0, 0, 2], "texture": "#cell", "cullface": "north" }
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"credit": "Made with Blockbench",
"ambientocclusion": false,
"textures": {
"particle": "appmek:block/drive/drive_cells",
"cell": "appmek:block/drive/drive_cells"
},
"elements": [
{
"name": "Cell Backdrop",
"from": [0, 0, 0],
"to": [6, 2, 2],
"rotation": { "angle": 0, "axis": "y", "origin": [9, 8, 8] },
"faces": {
"north": {
"uv": [0, 8, 6, 10],
"texture": "#cell",
"cullface": "north"
},
"up": { "uv": [6, 8, 0, 10], "texture": "#cell", "cullface": "north" },
"down": { "uv": [6, 8, 0, 10], "texture": "#cell", "cullface": "north" }
}
}
]
}
Loading

0 comments on commit 794907e

Please sign in to comment.