diff --git a/common/src/main/java/net/infumia/pack/FileResourceMergerDefault.java b/common/src/main/java/net/infumia/pack/FileResourceMergerDefault.java index 67fab0a..0a8ef2c 100644 --- a/common/src/main/java/net/infumia/pack/FileResourceMergerDefault.java +++ b/common/src/main/java/net/infumia/pack/FileResourceMergerDefault.java @@ -96,13 +96,10 @@ public Collection merge(final Collection resources) mergedModels.add(builder.build()); } - final Collection mergedResources = mergedAtlases + final Collection mergedResources = mergedModels .stream() - .map(FileResources::atlas) + .map(FileResources::model) .collect(Collectors.toList()); - mergedResources.addAll( - mergedModels.stream().map(FileResources::model).collect(Collectors.toList()) - ); mergedResources.addAll(remaining); return mergedResources; } diff --git a/common/src/main/java/net/infumia/pack/FileResources.java b/common/src/main/java/net/infumia/pack/FileResources.java index 17743a6..e99daed 100644 --- a/common/src/main/java/net/infumia/pack/FileResources.java +++ b/common/src/main/java/net/infumia/pack/FileResources.java @@ -2,7 +2,6 @@ import java.util.Arrays; import java.util.Collection; -import team.unnamed.creative.atlas.Atlas; import team.unnamed.creative.base.Writable; import team.unnamed.creative.font.Font; import team.unnamed.creative.model.Model; @@ -23,16 +22,6 @@ public static FileResource texture(final Texture texture) { return new FileResourceTexture(texture); } - /** - * Creates a {@link FileResource} for the specified atlas. - * - * @param atlas the atlas to create a file resource for. Cannot be null. - * @return a {@link FileResource} representing the atlas. - */ - public static FileResource atlas(final Atlas atlas) { - return new FileResourceAtlas(atlas); - } - /** * Creates a {@link FileResource} for the specified font. * diff --git a/common/src/main/java/net/infumia/pack/Internal.java b/common/src/main/java/net/infumia/pack/Internal.java index b5f7a6e..7f031c5 100644 --- a/common/src/main/java/net/infumia/pack/Internal.java +++ b/common/src/main/java/net/infumia/pack/Internal.java @@ -13,9 +13,14 @@ final class Internal { static final Key DEFAULT_SPACES_TEXTURE_KEY = Key.key(Internal.DEFAULT_NAMESPACE, "spaces"); static final int SEPARATOR_WIDTH = 1; - static Key keyWithPngExtension(final Key key) { + static Key toTextureKey(final Key key) { //noinspection PatternValidation - return Key.key(key.namespace(), key.value().concat(".png")); + return Key.key(key.namespace(), "item/" + key.value().concat(".png")); + } + + static Key toItemKey(final Key key) { + //noinspection PatternValidation + return Key.key(key.namespace(), "item/" + key.value()); } static Writable resourceFromJar(final String fileName) { diff --git a/common/src/main/java/net/infumia/pack/ResourceProducerSpacesBitmap.java b/common/src/main/java/net/infumia/pack/ResourceProducerSpacesBitmap.java index e98b172..a1126a8 100644 --- a/common/src/main/java/net/infumia/pack/ResourceProducerSpacesBitmap.java +++ b/common/src/main/java/net/infumia/pack/ResourceProducerSpacesBitmap.java @@ -23,7 +23,7 @@ final class ResourceProducerSpacesBitmap extends ResourceProducerSpacesAbstract ResourceProducerSpacesBitmap(final Key fontKey, final Key textureKey, final Writable writable) { super(fontKey); - this.textureKey = Internal.keyWithPngExtension(textureKey); + this.textureKey = Internal.toTextureKey(textureKey); this.writable = writable; } diff --git a/common/src/main/java/net/infumia/pack/ResourceProducers.java b/common/src/main/java/net/infumia/pack/ResourceProducers.java index a81a0ba..ae37b9d 100644 --- a/common/src/main/java/net/infumia/pack/ResourceProducers.java +++ b/common/src/main/java/net/infumia/pack/ResourceProducers.java @@ -1,8 +1,6 @@ package net.infumia.pack; import net.kyori.adventure.key.Key; -import team.unnamed.creative.atlas.Atlas; -import team.unnamed.creative.atlas.AtlasSource; import team.unnamed.creative.base.Writable; import team.unnamed.creative.font.Font; import team.unnamed.creative.model.ItemOverride; @@ -101,7 +99,11 @@ public static FileResource item( Model.model() .key(itemKey) .parent(Model.ITEM_GENERATED) - .textures(ModelTextures.builder().layers(ModelTexture.ofKey(itemKey)).build()) + .textures( + ModelTextures.builder() + .layers(ModelTexture.ofKey(Internal.toItemKey(itemKey))) + .build() + ) .build() ), FileResources.model( @@ -118,15 +120,7 @@ public static FileResource item( ) .build() ), - FileResources.texture( - Texture.texture(Internal.keyWithPngExtension(itemKey), itemImage) - ), - FileResources.atlas( - Atlas.atlas() - .key(Atlas.BLOCKS) - .sources(AtlasSource.directory(itemKey.namespace(), itemKey.namespace() + "/")) - .build() - ) + FileResources.texture(Texture.texture(Internal.toTextureKey(itemKey), itemImage)) ); } diff --git a/generator/src/main/java/net/infumia/pack/PackReferencePartModel.java b/generator/src/main/java/net/infumia/pack/PackReferencePartModel.java index a5b626d..cb848ea 100644 --- a/generator/src/main/java/net/infumia/pack/PackReferencePartModel.java +++ b/generator/src/main/java/net/infumia/pack/PackReferencePartModel.java @@ -62,7 +62,7 @@ public void add(final PackGeneratorContext context) { final String path = this.parent(context) + texture; return FileResources.texture( Texture.texture( - Key.key(key.namespace(), path), + Key.key(key.namespace(), "item/" + path), Writable.path(context.rootDirectory().resolve(path)) ) );