Git Product home page Git Product logo

creative's Introduction

creative

Build Status MIT License Discord

A resource-pack library for Minecraft: Java Edition, the resource pack system provides a way to customize textures, models, sounds, translations, splashes, credits, and fonts without modifying the default Minecraft client

This library lets programmers safely create resource-packs, instantly find bugs in the resource-pack and create the most compact version of your resource-pack

Check the documentation for installation and usage information for this project

creative's People

Contributors

boy0000 avatar dev-hydrogen avatar fixeddev avatar melonhell avatar pixeldev avatar renovate[bot] avatar spliterash avatar yusshu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

creative's Issues

1.20 font parse error

java.lang.IllegalStateException: Unknown font provider type: reference
	at team.unnamed.creative.serialize.minecraft.SerializerFont.readFromTree(SerializerFont.java:96)
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackReaderImpl.read(MinecraftResourcePackReaderImpl.java:233)
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackReader.readFromZipFile(MinecraftResourcePackReader.java:45)
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackReader.readFromZipFile(MinecraftResourcePackReader.java:52)
	at ResourcePackMerger-1.0.0-SNAPSHOT.jar//ru.melonhell.resourcepackmerger.MergeService.addFile(MergeService.kt:43)
	at ResourcePackMerger-1.0.0-SNAPSHOT.jar//ru.melonhell.resourcepackmerger.MergeService.merge(MergeService.kt:59)
	at ResourcePackMerger-1.0.0-SNAPSHOT.jar//ru.melonhell.resourcepackmerger.MergeService.build(MergeService.kt:168)
	at ResourcePackMerger-1.0.0-SNAPSHOT.jar//ru.melonhell.resourcepackmerger.PackReloadService.fullReload(PackReloadService.kt:14)
	at ResourcePackMerger-1.0.0-SNAPSHOT.jar//ru.melonhell.resourcepackmerger.Command.reload(Command.kt:18)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:757)
	at cloud.commandframework.annotations.MethodCommandExecutionHandler.execute(MethodCommandExecutionHandler.java:79)
	at cloud.commandframework.execution.CommandExecutionHandler.executeFuture(CommandExecutionHandler.java:95)
	at cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator.lambda$coordinateExecution$1(AsynchronousCommandExecutionCoordinator.java:101)
	at cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator.lambda$coordinateExecution$3(AsynchronousCommandExecutionCoordinator.java:131)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Atlas source types are deserialized as strings

The type field in asset sources is a resource location. If somebody uses minecraft:single instead of single, however, creative throws an error stating that the source type is unknown.

Replace Set with Collection in SoundRegistry

This method requires Set

static @NotNull SoundRegistry soundRegistry(final @NotNull String namespace, final @NotNull Set<SoundEvent> sounds) {

but this constructor can accept any collection

final @NotNull Collection<SoundEvent> sounds

because of this I have to convert my collection to a Set which is a waste

Add missing toBuilder() methods

I'm writing an obfuscator for a resource pack and I need to replace keys in a lot of places. Typically the code looks like this

model.toBuilder().key(newKey).build()

but sometimes I have to do this:

val soundEntryBuilder = SoundEntry.soundEntry()
soundEntryBuilder.key(newKey)
soundEntryBuilder.stream(soundEntry.stream())
soundEntryBuilder.type(soundEntry.type())
soundEntryBuilder.pitch(soundEntry.pitch())
soundEntryBuilder.attenuationDistance(soundEntry.attenuationDistance())
soundEntryBuilder.preload(soundEntry.preload())
soundEntryBuilder.volume(soundEntry.volume())
soundEntryBuilder.weight(soundEntry.weight())
soundEntryBuilder.build()

I would like to see the toBuilder method in all classes

At the moment I found the problem in the following classes:

  • SoundEntry
  • SoundEvent

Metadata should be independent

The Metadata type should be independent and represent any .mcmeta file for any key.
This would remove the Metadatable interface and remove Metadata from the Texture class

Why?

Metadata have their own files, so, they are independent, they may function as replacements by overlays or filters for other resource packs.
Currently, independent metadata (metadata that is not attached to an existing file) is completely ignored and discarded by the MinecraftResourcePackReader class.

However, this would make Texture & other classes usage more complex and time-consuming.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update dependency com.google.code.gson:gson to v2.11.0
  • fix(deps): update dependency org.jetbrains:annotations to v24
  • πŸ” Create all rate-limited PRs at once πŸ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build.yml
  • actions/checkout v2
  • actions/setup-java v1
gradle
gradle.properties
settings.gradle.kts
  • org.gradle.toolchains.foojay-resolver-convention 0.4.0
api/build.gradle.kts
  • org.jetbrains:annotations 23.0.0
  • net.kyori:adventure-key 4.9.3
  • net.kyori:adventure-api 4.14.0
  • net.kyori:adventure-text-serializer-legacy 4.14.0
buildSrc/settings.gradle.kts
buildSrc/build.gradle.kts
  • gradle.plugin.org.cadixdev.gradle:licenser 0.6.1
buildSrc/src/main/kotlin/creative.java-conventions.gradle.kts
  • org.junit.jupiter:junit-jupiter-api 5.8.2
  • org.junit.jupiter:junit-jupiter-engine 5.8.2
buildSrc/src/main/kotlin/creative.publishing-conventions.gradle.kts
serializer-minecraft/build.gradle.kts
  • com.google.code.gson:gson 2.10.1
  • net.kyori:adventure-text-serializer-legacy 4.14.0
  • net.kyori:adventure-text-serializer-gson 4.14.0
server/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.1.1

  • Check this box to trigger a request for Renovate to run again on this repository

java.lang.ClassCastException

Caused by: java.lang.ClassCastException: class java.lang.Float cannot be cast to class java.lang.Double (java.lang.Float and java.lang.Double are in module java.base of loader 'bootstrap')
	at team.unnamed.creative.serialize.minecraft.model.ModelSerializer.writeItemOverride(ModelSerializer.java:366)
	at team.unnamed.creative.serialize.minecraft.model.ModelSerializer.serializeToJson(ModelSerializer.java:130)
	at team.unnamed.creative.serialize.minecraft.model.ModelSerializer.serializeToJson(ModelSerializer.java:61)
	at team.unnamed.creative.serialize.minecraft.io.JsonResourceSerializer.serialize(JsonResourceSerializer.java:42)
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackWriterImpl.writeFullCategory(MinecraftResourcePackWriterImpl.java:64)
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackWriterImpl.writeWithBasePath(MinecraftResourcePackWriterImpl.java:74)
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackWriterImpl.write(MinecraftResourcePackWriterImpl.java:118)
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackWriter.writeToZipFile(MinecraftResourcePackWriter.java:53)
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackWriter.writeToZipFile(MinecraftResourcePackWriter.java:62)

IllegalStateException: Nesting problem

stacktrace:

Caused by: java.lang.IllegalStateException: Nesting problem.
        at com.google.gson.stream.JsonWriter.beforeName(JsonWriter.java:667) ~[gson-2.10.jar:?]
        at com.google.gson.stream.JsonWriter.writeDeferredName(JsonWriter.java:401) ~[gson-2.10.jar:?]
        at com.google.gson.stream.JsonWriter.value(JsonWriter.java:417) ~[gson-2.10.jar:?]
        at team.unnamed.creative.serialize.minecraft.SerializerBlockState.writeCondition(SerializerBlockState.java:198) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.SerializerBlockState.writeCondition(SerializerBlockState.java:192) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.SerializerBlockState.writeCondition(SerializerBlockState.java:227) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.SerializerBlockState.writeCondition(SerializerBlockState.java:192) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.SerializerBlockState.writeCondition(SerializerBlockState.java:210) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.SerializerBlockState.writeSelector(SerializerBlockState.java:171) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.SerializerBlockState.serialize(SerializerBlockState.java:68) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.SerializerBlockState.serialize(SerializerBlockState.java:44) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackWriterImpl.writeToJson(MinecraftResourcePackWriterImpl.java:121) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackWriterImpl.write(MinecraftResourcePackWriterImpl.java:72) ~[?:?]
        at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackWriter.build(MinecraftResourcePackWriter.java:79) ~[?:?]
        at ru.melonhell.resourcepackmerger.MergeService.build(MergeService.kt:46) ~[ResourcePackMerger-1.0.0-SNAPSHOT.jar:?]

siplified code:

val file = File("ia.zip")
val pack = MinecraftResourcePackReader.minecraft().readFromZipFile(file)
val builtPack = MinecraftResourcePackWriter.minecraft().build(pack) // exception on this line

ia.zip from example: ia.zip

[Feature] (`serializer-minecraft`) Add API to (de)serialize elements independently

Add API to deserialize and serialize elements independently, not necessarily a complete resource-pack.
This feature would be, at the moment, specific to serializer-minecraft and it should support reading InputStream, File, Path

For example:

Model model = MinecraftResourcePackReader.minecraft().readModel(inputStream);

Font font = MinecraftResourcePackReader.minecraft().readFont(new File("default.json"));

Or perhaps wrap InputStreams, Files and Paths in a Readable interface, representing data that can be read, similar to the existing Writable, which represents data that can be written. Like:

Model model = MinecraftResourcePackReader.minecraft().readModel(Readable.inputStream(inputStream));

.png twice in texture.png.mcmeta

code:

val pack = MinecraftResourcePackReader.minecraft().readFromZipFile(file)
val builtPack = MinecraftResourcePackWriter.minecraft().build(pack) 

expected Result: texture.png.mcmeta
actual result: texture.png.png.mcmeta

i think the problem is here
https://github.com/unnamed/creative/blob/6faf0213fd62750d11c62a737e5ba19353c819c6/serializer-minecraft/src/main/java/team/unnamed/creative/serialize/minecraft/MinecraftResourcePackReaderImpl.java#LL182C83-L182C83
".mcmeta" should be replaced with ".png.mcmeta"

Support for Shaders

Make creative support shaders and add API for shader modification.

Imperatively (this would require us to parse the shaders):

Shader shader;
shader = shader.modify(m -> m
    .addUniform("mat4", "ModelViewMat")
    .addUniform("mat4", "ProjMat")
    .addUniform("mat3", "IViewRotMat")
    .addIn("vec2", "texCoord1")
    .addIn("float", "part")
    .injectMain(At.START, "if (...) discard;"));

Or maybe using patches (this doesn't require parsing):

Shader shader;
// diff format
shader = shader.patch("""
17 + uniform mat4 ModelViewMat;
18 + uniform mat4 ProjMat;
19 + uniform mat3 IViewRotMat;
20 +
21 + in vec2 texCoord1;
22 + in float part;
""");

Or maybe even something like Mixin, but for GLSL. have a look at JLSL.

@ShaderMixin("rendertype_entity_translucent")
class RenderTypeEntityTranslucentMixin implements FragmentShader {
    @Uniform private Matrix4Float ModelViewMat;
    @Uniform private Matrix4Float ProjMat;
    @Uniform private Matrix3Float IViewRotMat;
    
    @In private Vector2Float texCoord1;
    @In private Vector2Float part;

    @Override
    @Inject(At.START)
    public void main() {
        if (...) { discard(); }
    }
}

Separate item and block models

Currently, the Model interface represents both item and block models. I think that they should have their own interfaces (maybe extending one in common) since they do not really have the same same properties.

creative can't read resources with illegal params

when i try to read the resource pack i get this error

java.lang.IllegalArgumentException: Invalid translation (Vector3Float{x=0.0f, y=-38.114296f, z=-81.24687f}), out of bounds (-80.0 to 80.0)
	at team.unnamed.creative.model.ItemTransform.validate(ItemTransform.java:98) ~[?:?]
	at team.unnamed.creative.model.ItemTransform.<init>(ItemTransform.java:91) ~[?:?]
	at team.unnamed.creative.model.ItemTransform.of(ItemTransform.java:204) ~[?:?]
	at team.unnamed.creative.serialize.minecraft.SerializerModel.readItemTransform(SerializerModel.java:381) ~[?:?]
	at team.unnamed.creative.serialize.minecraft.SerializerModel.readFromTree(SerializerModel.java:133) ~[?:?]
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackReaderImpl.read(MinecraftResourcePackReaderImpl.java:175) ~[?:?]
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackReader.readFromZipFile(MinecraftResourcePackReader.java:45) ~[?:?]
	at team.unnamed.creative.serialize.minecraft.MinecraftResourcePackReader.readFromZipFile(MinecraftResourcePackReader.java:52) ~[?:?]
	at ru.melonhell.resourcepackmerger.MergeService.merge(MergeService.kt:34) ~[ResourcePackMerger-1.0.0-SNAPSHOT.jar:?]
	at ru.melonhell.resourcepackmerger.MergeService.build(MergeService.kt:135) ~[ResourcePackMerger-1.0.0-SNAPSHOT.jar:?]
	at ru.melonhell.resourcepackmerger.Command.reload(Command.kt:21) ~[ResourcePackMerger-1.0.0-SNAPSHOT.jar:?]
	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) ~[?:?]
	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:757) ~[?:?]
	at cloud.commandframework.annotations.MethodCommandExecutionHandler.execute(MethodCommandExecutionHandler.java:79) ~[?:?]
	at cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator.lambda$coordinateExecution$1(AsynchronousCommandExecutionCoordinator.java:101) ~[?:?]
	at cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator.lambda$coordinateExecution$3(AsynchronousCommandExecutionCoordinator.java:131) ~[?:?]
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395) ~[?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]

I understand that the resource pack contains incorrect data, but I would like to read it anyway

I can't manually change this resource pack as it is generated by another plugin

I would really like if you could add some flag that will allow you to read the resource pack ignoring errors or add custom error handlers so that I can write some kind of resolver for these errors at the read stage

Don't throw on file parse errors

Currently, if a single invalid file tries to get parsed the whole parsing crashes with an error, it should do some form of warn and continue. This would mean if single files failed to parse then we would still get an output just with some bits missing.

The crash out is due to this throw inside a try-catch

} catch (IOException e) {
throw new UncheckedIOException("Failed to deserialize resource at: '" + path + "'", e);
}

[Feature Request] Central creative plugin

Create a subproject which would be a server plugin to manage and unify the server's resource-pack. The plugin should support as many platforms as it can (Paper, Minestom, Velocity, etc.).

Some ideas I have for the plugin:

  • There would be an event called at the server start to let other plugins register/add their resources. Like:
interface ResourcePackGenerateEvent {
    
    // Plugins can add their resources to this
    // (mutable) ResourcePack instance
    ResourcePack resourcePack();

}
  • The plugin could "export" the generated resource-pack to a third-party server like MCPacks, or host it locally using the (existing) creative-server subproject. That would be configurable
  • The plugin could load existing resources, these resources would be manually specified by a server administrator. These resources could be located at the plugin folder, like /plugins/creative/initial-resources/

These ideas are possible now since creative 0.6.0-SNAPSHOT
The goal is to create a plugin that would be used in almost every public server that supports resource-pack. See it as the "Vault" but for servers that use resource-packs

Fix Custom Unicode characters

When using unicode characters in the extended charset (UTF-16BE), which is what Vanilla Minecraft supports. I attempt to add the char (due to the BE, two chars represent 1 char)
"\uDBBC\uDC01", however unfortuantely it es escaped automatically to "\\uDBBC\\uDC01". Could we add an override for \u not to be overriden to \\u.

Ability to add layers and variables individually in ModelTextures.Builder

Currently ModelTextures.Builder has layers and variables methods. But that’s the purpose of a builder: he should be able to add content one by one. Now I can't add one texture and pass the builder to the next handler, I have to create a list and hashmap and pass them to the handlers instead of passing the builder.

I propose adding a method layer(ModelTexture layer) and a method variable(String id, ModelTexture variable) that will allow you to replenish the builder gradually

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.