From a6bd64e68656795e78b9a320b1305954f3c75d98 Mon Sep 17 00:00:00 2001 From: Kas-tle <26531652+Kas-tle@users.noreply.github.com> Date: Sat, 6 Mar 2021 21:10:13 -0800 Subject: [PATCH] Add Killer Bunny (#7) --- .gitignore | 7 +++- copy_java_files_to_pack.sh | 3 +- developer_documentation.md | 32 +++++++++++++++- entity/rabbit.entity.json | 37 +++++++++++++++++++ manifest.json | 4 +- .../rabbit.render_controllers.json | 28 ++++++++++++++ required_files.txt | 1 + 7 files changed, 105 insertions(+), 7 deletions(-) create mode 100755 entity/rabbit.entity.json create mode 100755 render_controllers/rabbit.render_controllers.json diff --git a/.gitignore b/.gitignore index 5c6066d..7cbcb48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ .idea/ -GeyserOptionalPack.zip \ No newline at end of file +GeyserOptionalPack.zip +textures/entity/iron_golem/iron_golem_crackiness_high.png +textures/entity/iron_golem/iron_golem_crackiness_low.png +textures/entity/iron_golem/iron_golem_crackiness_medium.png +textures/entity/arrow/spectral_arrow.png +textures/entity/rabbit/caerbannog.png \ No newline at end of file diff --git a/copy_java_files_to_pack.sh b/copy_java_files_to_pack.sh index e5b3062..647b822 100755 --- a/copy_java_files_to_pack.sh +++ b/copy_java_files_to_pack.sh @@ -1,12 +1,11 @@ wget https://launcher.mojang.com/v1/objects/37fd3c903861eeff3bc24b71eed48f828b5269c8/client.jar unzip client.jar -d extracted/ IFS=' ' -while read -r p; do +while read -r p || [ -n "$p" ]; do read -rafilesToCopy<<< "$p" echo "extracted/${filesToCopy[0]} ${filesToCopy[1]}" mkdir -p "${filesToCopy[1]}" cp "extracted/${filesToCopy[0]}" "${filesToCopy[1]}" done + * [Introduction](#Introduction) + * [Armor stands](#Armor-stands) + * [Part visibility and rotation encoding](#Part-visibility-and-rotation-encoding) + * [Geometry and attachables](#Geometry-and-attachables) + * [Iron golems](#Iron-golems) + * [Cracking](#Cracking) + * [Materials](#Materials) + * [Render controller](Render-controllers) + * [Shulkers](#Shulkers) + * [Spectral arrow entities](#Spectral-arrow-entities) + * [Killer bunnies](#Killer-bunnies) + + ### Introduction Entity data and entity flags (known as queries in Molang) are pieces of metadata that store various pieces of information about an entity on the Bedrock Edition of Minecraft. You have a query for an entity's health, for example (a number query, or an entity data), and you have a query for is an entity is angry (an entity flag, which is either 1.0 or 0.0 in Molang). Not all entities use every query, but every entity has access to most queries, though Bedrock by default ignores these. We use this to our advantage in this resource pack. @@ -85,8 +99,10 @@ Unfortunately, the "USE_COLOR_MASK" and "MULTIPLICATIVE_TINT_COLOR" definitions In order to utilize multiple textures, a render controller containing a texture array was defined. A position in the texture array is then determined by the following Molang expression: -```c -(q.health > 99 || !q.is_bribed) ? 3 : math.floor(q.health / 25) +```json +"textures": [ + "(q.health > 99 || !q.is_bribed) ? 3 : math.floor(q.health / 25)" + ] ``` The trinary operator ensures that even if `max_health`, defined at 100, is overflowed, the expression will never produce a value outside the range of 0-3. As all data is derived resource pack side, this addition requires no modification by the server (though `query.is_bribed` enables the feature). The textures required for this to display can be retrieved during the build process. @@ -116,3 +132,15 @@ The glowing effect and the spectral arrow item and entities do not exist on Bedr ``` The texture required for this to be displayed can be retrieved during the build process. + +### Killer bunnies + +The killer bunny does not exist in Bedrock Edition. Nonetheless, this is primarily a simple texture swap. The "caerbannog" texture is the name of the texture in Java Edition, so that name has been used for consistency. This texture is added to the pack and the rabbit entity definition file. In order to construct the Molang query, the "Toast" rabbit must also be considered. In the event a rabbit is named "Toast", the texture is always overridden as the texture "Toast", including in the case of the killer bunny. Therefore, the query to select the texture is constructed as follows, with `q.is_bribed` being determined by Geyser: + +```json +"textures": [ + "q.get_name == 'Toast' ? Texture.toast : (q.is_bribed ? Texture.caerbannog : Array.skins[q.variant])" +] +``` + +The texture required for this to be displayed can be retrieved during the build process. diff --git a/entity/rabbit.entity.json b/entity/rabbit.entity.json new file mode 100755 index 0000000..3669ddd --- /dev/null +++ b/entity/rabbit.entity.json @@ -0,0 +1,37 @@ +{ + "format_version": "1.8.0", + "minecraft:client_entity": { + "description": { + "identifier": "minecraft:rabbit", + "min_engine_version": "1.8.0", + "materials": { "default": "rabbit" }, + "textures": { + "brown": "textures/entity/rabbit/brown", + "white": "textures/entity/rabbit/white", + "black": "textures/entity/rabbit/blackrabbit", + "white_splotched": "textures/entity/rabbit/white_splotched", + "gold": "textures/entity/rabbit/gold", + "salt": "textures/entity/rabbit/salt", + "toast": "textures/entity/rabbit/toast", + "caerbannog": "textures/entity/rabbit/caerbannog" + }, + "geometry": { + "default": "geometry.rabbit.v1.8" + }, + "animations": { + "move": "animation.rabbit.move", + "baby_transform": "animation.rabbit.baby_transform", + "look_at_target": "animation.common.look_at_target" + }, + "animation_controllers": [ + { "general": "controller.animation.rabbit.general" }, + { "baby": "controller.animation.rabbit.baby" } + ], + "render_controllers": [ "controller.render.rabbit" ], + "spawn_egg": { + "texture": "spawn_egg", + "texture_index": 24 + } + } + } +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 76ef475..3cf4643 100755 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "description": "Geyser Vanilla Assets", "name": "Geyser Vanilla Assets", "uuid": "5d8f8e98-7a2a-11eb-9439-0242ac130002", - "version": [1, 0, 72], + "version": [1, 0, 73], "min_engine_version": [ 1, 16, 0 ] }, "modules": [ @@ -12,7 +12,7 @@ "description": "Geyser Vanilla Assets", "type": "resources", "uuid": "72e9b0ca-7a2a-11eb-9439-0242ac130002", - "version": [1, 0, 72] + "version": [1, 0, 73] } ] } diff --git a/render_controllers/rabbit.render_controllers.json b/render_controllers/rabbit.render_controllers.json new file mode 100755 index 0000000..4f85857 --- /dev/null +++ b/render_controllers/rabbit.render_controllers.json @@ -0,0 +1,28 @@ +{ + "format_version": "1.8.0", + "render_controllers": { + "controller.render.rabbit": { + "arrays": { + "textures": { + "Array.skins": [ + "Texture.brown", + "Texture.white", + "Texture.black", + "Texture.white_splotched", + "Texture.gold", + "Texture.salt" + ] + } + }, + "geometry": "Geometry.default", + "materials": [ + { + "*": "Material.default" + } + ], + "textures": [ + "q.get_name == 'Toast' ? Texture.toast : (q.is_bribed ? Texture.caerbannog : Array.skins[q.variant])" + ] + } + } +} \ No newline at end of file diff --git a/required_files.txt b/required_files.txt index 23d5641..c81338a 100644 --- a/required_files.txt +++ b/required_files.txt @@ -2,3 +2,4 @@ assets/minecraft/textures/entity/iron_golem/iron_golem_crackiness_high.png textu assets/minecraft/textures/entity/iron_golem/iron_golem_crackiness_low.png textures/entity/iron_golem/ assets/minecraft/textures/entity/iron_golem/iron_golem_crackiness_medium.png textures/entity/iron_golem/ assets/minecraft/textures/entity/projectiles/spectral_arrow.png textures/entity/arrow/ +assets/minecraft/textures/entity/rabbit/caerbannog.png textures/entity/rabbit/ \ No newline at end of file