-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
192 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
common/src/main/java/org/ayamemc/ayame/model/resource/ModelContent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Custom player model mod. Powered by GeckoLib. | ||
* Copyright (C) 2024 CrystalNeko, HappyRespawnanchor, pertaz(Icon Designer) | ||
* | ||
* This file is part of Ayame. | ||
* | ||
* Ayame is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Ayame is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Ayame. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.ayamemc.ayame.model.resource; | ||
|
||
import net.minecraft.server.packs.repository.PackDetector; | ||
import net.minecraft.world.level.validation.DirectoryValidator; | ||
import org.ayamemc.ayame.Ayame; | ||
import org.ayamemc.ayame.util.TODO; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Files; | ||
import java.io.IOException; | ||
import java.util.zip.ZipFile; | ||
import java.util.zip.ZipEntry; | ||
|
||
public class ModelContent extends PackDetector<ModelResourceRegistry.ModelFile> { | ||
|
||
public ModelContent(DirectoryValidator validator) { | ||
super(validator); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public ModelResourceRegistry.ModelFile createZipPack(Path path) { | ||
try (ZipFile zipFile = new ZipFile(path.toFile())) { | ||
ZipEntry entry = zipFile.getEntry("index.json"); | ||
if (entry != null) { | ||
return new ModelResourceRegistry.ModelFile(zipFile); | ||
} | ||
} catch (IOException e) { | ||
Ayame.LOGGER.error("Failed to read ZIP pack at path: {}", path, e); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
protected ModelResourceRegistry.ModelFile createDirectoryPack(Path path) { | ||
throw new TODO("createDirectoryPack"); | ||
// Path indexFilePath = path.resolve("index.json"); | ||
// if (Files.exists(indexFilePath)) { | ||
// return new ModelResourceRegistry.ModelFile(null); | ||
// } | ||
// return null; | ||
} | ||
|
||
public static ModelContent create() { | ||
return new ModelContent(new DirectoryValidator(path1 -> true)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
common/src/main/java/org/ayamemc/ayame/model/resource/SimpleModelResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Custom player model mod. Powered by GeckoLib. | ||
* Copyright (C) 2024 CrystalNeko, HappyRespawnanchor, pertaz(Icon Designer) | ||
* | ||
* This file is part of Ayame. | ||
* | ||
* Ayame is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Ayame is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Ayame. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.ayamemc.ayame.model.resource; | ||
|
||
import org.ayamemc.ayame.model.IndexData; | ||
|
||
import java.util.List; | ||
|
||
public class SimpleModelResource implements IModelResource{ | ||
private final ModelResourceRegistry.ModelFile modelFile; | ||
private final IndexData.ModelMetaData metaData; | ||
public SimpleModelResource(ModelResourceRegistry.ModelFile modelFile){ | ||
this.modelFile = modelFile; | ||
this.metaData = createMetaData(); | ||
} | ||
private IndexData.ModelMetaData createMetaData(){ | ||
return IndexData.ModelMetaData.Builder.create().parseJson(modelFile.getIndexJson()).build(); | ||
} | ||
|
||
@Override | ||
public IndexData.ModelMetaData getMetaData() { | ||
return this.metaData; | ||
} | ||
|
||
@Override | ||
public List<IndexData.ModelData> getModels() { | ||
return List.of(IndexData.ModelData.Builder.create() | ||
.model("model.json") | ||
.name(getMetaData().name()) | ||
.animation("animation.json") | ||
.texture("texture.png") | ||
.build() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
common/src/main/java/org/ayamemc/ayame/util/ModelContent.java
This file was deleted.
Oops, something went wrong.
Binary file renamed
BIN
+7.29 KB
...ources/assets/ayame/models/grmmy_neko.zip → ...ces/assets/ayame/models/AQuarter_neko.zip
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"format_version": "0.0.1", | ||
"format": "AYAME", | ||
"metadata": { | ||
"name": "AQuarter_neko", | ||
"version": "0.0.1", | ||
|