Skip to content

Commit

Permalink
Rework chest rendering, generate chest item models.
Browse files Browse the repository at this point in the history
  • Loading branch information
quinn-semele committed Dec 20, 2024
1 parent a3a7196 commit a9288c5
Show file tree
Hide file tree
Showing 35 changed files with 229 additions and 230 deletions.
Original file line number Diff line number Diff line change
@@ -1,46 +1,72 @@
// 1.21.4 2024-12-19T18:08:52.0654653 Model Definitions - expandedstorage
// 1.21.4 2024-12-20T19:42:11.0865182 Model Definitions - expandedstorage
b4fd5fc9e8d0e28986112c115f9a559661a4f1a6 assets/expandedstorage/items/bamboo_chest.json
3026bc864d9eed92206407d514c8f9bdd383e5d8 assets/expandedstorage/items/copper_chest.json
e881519910f7f997764f67dc97d9feaccca10479 assets/expandedstorage/items/copper_to_diamond_conversion_kit.json
62ea24db562038ad5eb3e04241892ff17eb5b630 assets/expandedstorage/items/copper_to_gold_conversion_kit.json
2952954cb779f28de95b08bd81c9f4e96b6119b5 assets/expandedstorage/items/copper_to_iron_conversion_kit.json
cff44fc7388bd272555d8f7ff7fe0d8f60e92c12 assets/expandedstorage/items/copper_to_netherite_conversion_kit.json
11eda7183b0396fae24bc436dbe84bb90c13410f assets/expandedstorage/items/copper_to_obsidian_conversion_kit.json
3b69f1870cd591854d5318a4875665e891c4bf08 assets/expandedstorage/items/diamond_chest.json
4d0de4ecdaafb25c08dc76b7ee9cbb2bbe909933 assets/expandedstorage/items/diamond_to_netherite_conversion_kit.json
129f9a2e873788b1423c7483b05f47737c96c608 assets/expandedstorage/items/diamond_to_obsidian_conversion_kit.json
bfc88e3a63776a8a012f3260b1eaf36f6f61d7b1 assets/expandedstorage/items/gold_chest.json
0135b1e6ebe610347575f7eb30b0ab93e00041ad assets/expandedstorage/items/gold_to_diamond_conversion_kit.json
b44159f290254fe6381d15c4c6551206a8a685bd assets/expandedstorage/items/gold_to_netherite_conversion_kit.json
fa32454c90f65090832ec84aad7748a7eef12b03 assets/expandedstorage/items/gold_to_obsidian_conversion_kit.json
f78a7b35b98895a151fb2a6ee888ce96e4b157ae assets/expandedstorage/items/iron_chest.json
f2222b41a0d776c96f868e23a65609012a3727bf assets/expandedstorage/items/iron_to_diamond_conversion_kit.json
698e00fa7510026f0f23a92844b40959762b714b assets/expandedstorage/items/iron_to_gold_conversion_kit.json
461bfbe0330ce345f6a076984faef55189b74f6a assets/expandedstorage/items/iron_to_netherite_conversion_kit.json
2bbb50f0b04303a9955769783bc0a693ef5b9765 assets/expandedstorage/items/iron_to_obsidian_conversion_kit.json
c5fafbef08bfbba91a426c1419390f63ec144858 assets/expandedstorage/items/metallic_obsidian_chest.json
33e4ca0e4bdb58895309612e5795be38596ad48b assets/expandedstorage/items/moss_chest.json
3d15a755079438bacaf8aaf699800ceeb9bdec74 assets/expandedstorage/items/netherite_chest.json
fa69354eb0e05ede7a84cb7089fe25b3db7a8577 assets/expandedstorage/items/obsidian_chest.json
78094a71e8e5b59c136db78dc2563707ec693db8 assets/expandedstorage/items/obsidian_to_netherite_conversion_kit.json
055f387d7b901ef5d6dfcf267cd18f21d80d1496 assets/expandedstorage/items/present.json
7475108b1d282e7234b971f1eda67af395f6c723 assets/expandedstorage/items/pumpkin_chest.json
36a53f0c890d8e71834c4a7003b2d5889dfb4eef assets/expandedstorage/items/storage_mutator.json
60884dfc0016d24461eb99cd57933e25c88e5700 assets/expandedstorage/items/trial_chest.json
74eb2cd9680cfa3cc0d2b56824d41e65d580b439 assets/expandedstorage/items/wood_chest.json
5ab60fc7010af2c075072d3c6d93ffcab75b9fb1 assets/expandedstorage/items/wood_to_copper_conversion_kit.json
03d31f80607179291009193b11f948685712b5a0 assets/expandedstorage/items/wood_to_diamond_conversion_kit.json
96c7bea62a88962890072241752699b7742456b7 assets/expandedstorage/items/wood_to_gold_conversion_kit.json
bd2d4a7f2d2d699809934e08cbbf7400f5e304be assets/expandedstorage/items/wood_to_iron_conversion_kit.json
7d42270556527b9746db9d5774dbc30c3e311502 assets/expandedstorage/items/wood_to_netherite_conversion_kit.json
2b4678a63618b68027e6e991da9d0cbd1dd4de7e assets/expandedstorage/items/wood_to_obsidian_conversion_kit.json
0de06a1b9783e313694b40950cf19dd300025643 assets/expandedstorage/models/item/bamboo_chest.json
d766b26c966ecba19cd2da92d5adbf26468618da assets/expandedstorage/models/item/copper_chest.json
f83cf0d0e523dba92ad4d106e7dcb9d7102fb949 assets/expandedstorage/models/item/copper_to_diamond_conversion_kit.json
4be0238326ebde4bd3dab168c73626e72026f7f5 assets/expandedstorage/models/item/copper_to_gold_conversion_kit.json
c18cce9dd03ab7191b29e7bd8a86b7657c920303 assets/expandedstorage/models/item/copper_to_iron_conversion_kit.json
6110be860c5e47a8309c079477b3ca2ab7f214a9 assets/expandedstorage/models/item/copper_to_netherite_conversion_kit.json
1799a6e4974ab12f4f436e65e397a31b1dc8f813 assets/expandedstorage/models/item/copper_to_obsidian_conversion_kit.json
0f3ec9591fa224ce50898595e08f05f208d8f51b assets/expandedstorage/models/item/diamond_chest.json
7f9434f5e28599e9d445de3279afa928475c1072 assets/expandedstorage/models/item/diamond_to_netherite_conversion_kit.json
f7f1b905303226ccb7c95ec7b319674f2449aac1 assets/expandedstorage/models/item/diamond_to_obsidian_conversion_kit.json
36c7ee96bb9ec762cb476c8a1e9c44632166301c assets/expandedstorage/models/item/gold_chest.json
bf1b0035f5c3c6b56f31092c0a175b795d7306ed assets/expandedstorage/models/item/gold_to_diamond_conversion_kit.json
78e9accf652ddae5f0f6808da4ea356328e8b0e3 assets/expandedstorage/models/item/gold_to_netherite_conversion_kit.json
f3117b66fd65eef7470ed402d5dbd3b6a6824130 assets/expandedstorage/models/item/gold_to_obsidian_conversion_kit.json
28333cbebf7121dff2bc4ead52798cb7b168b658 assets/expandedstorage/models/item/iron_chest.json
f2a232965c9b56c59b415464bbab7daeb44b41ae assets/expandedstorage/models/item/iron_to_diamond_conversion_kit.json
af5034de9e09cefc2cf32203ce4dab3fdf7f0931 assets/expandedstorage/models/item/iron_to_gold_conversion_kit.json
692f208582d6a3e6b3b90569b84b050853892c70 assets/expandedstorage/models/item/iron_to_netherite_conversion_kit.json
2a7f35b73bd9c0d3c543a8f04d3ea8b1f51738d1 assets/expandedstorage/models/item/iron_to_obsidian_conversion_kit.json
3fd93875b3e1c7784efc9f75db008f652aa71996 assets/expandedstorage/models/item/metallic_obsidian_chest.json
a03c3cf9406e9540d0d555a8fccf0cb5969e12d3 assets/expandedstorage/models/item/moss_chest.json
39b4cf5f8204042a91d46df268d1fe12c0fe181b assets/expandedstorage/models/item/netherite_chest.json
e7a11368537d7afe885a6bba32574f8b7140b38e assets/expandedstorage/models/item/obsidian_chest.json
b8616c63590d1a665e878d5a28583763f5ba6d7a assets/expandedstorage/models/item/obsidian_to_netherite_conversion_kit.json
25d47651730982dbce2489da792672b292817473 assets/expandedstorage/models/item/present.json
b9ef11bb81d5fdb6978d3d75652ad2c0ee6154e1 assets/expandedstorage/models/item/pumpkin_chest.json
9de1a564cb1d8f1a13f1d767a8e6b877d72159c4 assets/expandedstorage/models/item/storage_mutator_merge.json
48bca37bde0ca63e5422faf6d8eb2d576c7d151a assets/expandedstorage/models/item/storage_mutator_rotate.json
43a39e867233835a1547d7cb69f500a2a4cfe897 assets/expandedstorage/models/item/storage_mutator_sparrow.json
ff1d07de3904e7fbdbd05b02c6e09ab211955a14 assets/expandedstorage/models/item/storage_mutator_split.json
17db7c96be018951e9c0969ec2d34e94c7a828ad assets/expandedstorage/models/item/storage_mutator_swap_theme.json
d766b26c966ecba19cd2da92d5adbf26468618da assets/expandedstorage/models/item/trial_chest.json
e22f7a29f8077ba3772717d3fed27920f199473c assets/expandedstorage/models/item/wood_chest.json
a49a7e3e860e304fbaba752ba3898270b0039578 assets/expandedstorage/models/item/wood_to_copper_conversion_kit.json
5d2ccfb97e6d24673e72b2f6702e7c39b98e9d3b assets/expandedstorage/models/item/wood_to_diamond_conversion_kit.json
1191e699f476b10bf33227514e08857326fe285a assets/expandedstorage/models/item/wood_to_gold_conversion_kit.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:item/template_chest",
"textures": {
"particle": "minecraft:block/pumpkin_top"
"particle": "minecraft:block/pumpkin"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,82 +1,12 @@
package compasses.expandedstorage.impl;

import compasses.expandedstorage.api.EsChestType;
import compasses.expandedstorage.impl.block.MiniStorageBlock;
import compasses.expandedstorage.impl.item.MutationMode;
import compasses.expandedstorage.impl.misc.Utils;
import dev.compasses.expandedstorage.item.StorageMutator;
import dev.compasses.expandedstorage.misc.ClientPlatformHelper;
import dev.compasses.expandedstorage.registration.ModBlocks;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite;
import net.minecraft.core.component.DataComponents;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;
import java.util.Map;

public class CommonClient {
private static ClientPlatformHelper platformHelper;
private static final Map<ResourceLocation, ResourceLocation[]> CHEST_TEXTURES = new HashMap<>();

public static void initialize(ClientPlatformHelper helper) {
platformHelper = helper;

ModBlocks.INSTANCE.getCHESTS().forEach(block -> {
String blockId = block.getBlockId().getPath();
declareChestTextures(block.getBlockId(),
Utils.id("entity/chest/" + blockId + "_single"),
Utils.id("entity/chest/" + blockId + "_left"),
Utils.id("entity/chest/" + blockId + "_right"),
Utils.id("entity/chest/" + blockId + "_top"),
Utils.id("entity/chest/" + blockId + "_bottom"),
Utils.id("entity/chest/" + blockId + "_front"),
Utils.id("entity/chest/" + blockId + "_back")
);
});
}

public static void declareChestTextures(ResourceLocation block, ResourceLocation singleTexture, ResourceLocation leftTexture, ResourceLocation rightTexture, ResourceLocation topTexture, ResourceLocation bottomTexture, ResourceLocation frontTexture, ResourceLocation backTexture) {
if (!CHEST_TEXTURES.containsKey(block)) {
ResourceLocation[] collection = {topTexture, bottomTexture, frontTexture, backTexture, leftTexture, rightTexture, singleTexture};
CHEST_TEXTURES.put(block, collection);
} else {
throw new IllegalArgumentException("Tried registering chest textures for \"" + block + "\" which already has textures.");
}
}

public static ResourceLocation getChestTexture(ResourceLocation block, EsChestType chestType) {
if (CHEST_TEXTURES.containsKey(block)) {
return CHEST_TEXTURES.get(block)[chestType.ordinal()];
}
return MissingTextureAtlasSprite.getLocation();
}

@SuppressWarnings("unused")
public static float hasSparrowProperty(ItemStack stack, @Nullable ClientLevel level, @Nullable LivingEntity entity, int i) {
return MiniStorageBlock.hasSparrowProperty(stack) ? 1.0f : 0.0f;
}

@SuppressWarnings("unused")
public static float currentMutatorToolMode(ItemStack stack, @Nullable ClientLevel level, @Nullable LivingEntity entity, int i) {
MutationMode mode = StorageMutator.Companion.getMode(stack);
boolean isSparrow = stack.has(DataComponents.CUSTOM_NAME) && stack.getHoverName().getString().equalsIgnoreCase("sparrow");
if (mode == MutationMode.SWAP_THEME) {
if (isSparrow) {
return 1.0F;
}
return 0.8F;
} else if (mode == MutationMode.ROTATE) {
return 0.6F;
} else if (mode == MutationMode.SPLIT) {
return 0.4F;
} else if (mode == MutationMode.MERGE) {
return 0.2F;
}
return 0.0F;
}

public static ClientPlatformHelper platformHelper() {
Expand Down

This file was deleted.

Loading

0 comments on commit a9288c5

Please sign in to comment.