Skip to content

Commit e5a6404

Browse files
committed
fix: #14 all caches are now separated
1 parent 3ec8926 commit e5a6404

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

model_resolver/item_model/special.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def get_player_texture(self, getter: PackGetterV2, item: Item) -> str | Image.Im
282282
return DEFAULT_TEXTURE
283283
if not "minecraft:profile" in item.components:
284284
return DEFAULT_TEXTURE
285-
cache = getter._ctx.cache["model_resolver"]
285+
cache = getter._ctx.cache["model_resolver_player_skin"]
286286
if not isinstance(item.components["minecraft:profile"], str):
287287
profile = ProfileComponent.model_validate(
288288
item.components["minecraft:profile"]

model_resolver/render.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,16 @@ def add_structure_task(
142142

143143
def resolve_dynamic_textures(self):
144144
# first, resolve all vanilla altas
145-
cache = self.ctx.cache.get("model_resolver")
145+
cache = self.ctx.cache.get("model_resolver_dynamic_textures")
146146
assert cache
147147
opts = self.ctx.validate("model_resolver", ModelResolverOptions)
148148
if "dynamic_textures" in cache.json and opts.use_cache:
149149
for key, path in cache.json["dynamic_textures"].items():
150150
self.dynamic_textures[key] = Image.open(path)
151151
return
152152
# clear the dynamic textures
153-
cache.clear()
153+
if opts.use_cache:
154+
cache.clear()
154155
# construct the dynamic textures
155156
atlases = {
156157
**{key: value for key, value in self.getter.assets.atlases.items()},

model_resolver/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def get_default_components(ctx: Context) -> dict[str, Any]:
115115
match prefered:
116116
case "misode/mcmeta":
117117
url = f"https://raw.githubusercontent.com/misode/mcmeta/refs/tags/{version}-summary/item_components/data.json"
118-
path = ctx.cache["model_resolver"].download(url)
118+
path = ctx.cache["model_resolver_components"].download(url)
119119
with open(path) as file:
120120
components = json.load(file)
121121
return {resolve_key(key): value for key, value in components.items()}
@@ -124,7 +124,7 @@ def get_default_components(ctx: Context) -> dict[str, Any]:
124124
jar = release.cache.download(
125125
release.info.data["downloads"]["server"]["url"]
126126
)
127-
cache = ctx.cache["model_resolver"]
127+
cache = ctx.cache["model_resolver_components"]
128128
path = cache.get_path("minecraft_reports")
129129
if not path.is_dir():
130130
os.makedirs(path, exist_ok=True)

0 commit comments

Comments
 (0)