From 972e49ffc9de28132b4e21deb64861149ad253c8 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 9 Nov 2023 17:21:53 +0100 Subject: [PATCH] Add tags to custom items, fix code examples (#220) --- _docs/geyser/custom-blocks.md | 18 ++++++++---------- _docs/geyser/custom-items.md | 1 + _docs/geyser/custom-skulls.md | 6 ++++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/_docs/geyser/custom-blocks.md b/_docs/geyser/custom-blocks.md index 960c3c1..29af0c2 100644 --- a/_docs/geyser/custom-blocks.md +++ b/_docs/geyser/custom-blocks.md @@ -349,12 +349,11 @@ public class RedstoneDot implements Extension { BoxComponent selectionBox = new BoxComponent(-5, 0, -5, 10, 1f, 10); CustomBlockComponents components = CustomBlockComponents.builder() - .collisionBox(BoxComponent.EMPTY_BOX) + .collisionBox(BoxComponent.emptyBox()) .selectionBox(selectionBox) .geometry(new GeometryComponentBuilder() .identifier("geometry.amberichu.redstone_dot") .build()) - .destroyTime(0f) .lightEmission(0) .lightDampening(0) .friction(1f) @@ -362,7 +361,7 @@ public class RedstoneDot implements Extension { CustomBlockData redstoneDot = CustomBlockData.builder() .name("redstone_dot") - .intProperty(POWER_PROPERTY, IntStream.range(0, 16).boxed().toList()) + .intProperty("POWER_PROPERTY", IntStream.range(0, 16).boxed().toList()) .components(components) .permutations(createRedstoneDotPermutations()) .build(); @@ -410,12 +409,11 @@ public class RedstoneDot implements Extension { BoxComponent selectionBox = new BoxComponent(-5, 0, -5, 10, 1f, 10); CustomBlockComponents components = CustomBlockComponents.builder() - .collisionBox(BoxComponent.EMPTY_BOX) + .collisionBox(BoxComponent.emptyBox()) .selectionBox(selectionBox) .geometry(new GeometryComponentBuilder() .identifier("geometry.amberichu.redstone_dot") .build()) - .destroyTime(0f) .lightEmission(0) .lightDampening(0) .friction(1f) @@ -423,18 +421,18 @@ public class RedstoneDot implements Extension { CustomBlockData redstoneDot = CustomBlockData.builder() .name("redstone_dot") - .intProperty(POWER_PROPERTY, IntStream.range(0, 16).boxed().toList()) + .intProperty("POWER_PROPERTY", IntStream.range(0, 16).boxed().toList()) .components(components) .permutations(createRedstoneDotPermutations()) .build(); - event.registerCustomBlock(redstoneDot); - event.registerBlockItemOverride("minecraft:redstone_wire", redstoneDot); + event.register(redstoneDot); + event.registerItemOverride("minecraft:redstone_wire", redstoneDot); for (int power = 0; power < 16; power++) { String javaIdentifier = String.format("minecraft:redstone_wire[east=none,north=none,power=%d,south=none,west=none]", power); - event.registerBlockStateOverride(javaIdentifier, redstoneDot.blockStateBuilder() - .intProperty(POWER_PROPERTY, power) + event.registerOverride(javaIdentifier, redstoneDot.blockStateBuilder() + .intProperty("POWER_PROPERTY", power) .build()); } } diff --git a/_docs/geyser/custom-items.md b/_docs/geyser/custom-items.md index dacb275..27682df 100644 --- a/_docs/geyser/custom-items.md +++ b/_docs/geyser/custom-items.md @@ -42,6 +42,7 @@ To setup custom items in geyser, you have to choose how you are going to registe * `allow_offhand` (boolean) default: false * `texture_size` (int) default: 16 * `render_offsets` (object) It works as follows. Note that all the sub-objects are optional, except x, y and z. You can have for example only a main hand with a position, and noting else. default: no render offset + * `tags` (array) default: no tags. Allows defining tags that can be used in Molang queries. Example value: ["test:tag_one", "test:tag_two"]. ```json "render_offsets": { "main_hand": { diff --git a/_docs/geyser/custom-skulls.md b/_docs/geyser/custom-skulls.md index 573293f..b87254b 100644 --- a/_docs/geyser/custom-skulls.md +++ b/_docs/geyser/custom-skulls.md @@ -6,7 +6,7 @@ title: Custom skulls with Geyser Unlike Java Edition, Bedrock does not have native support for custom skull items. As a result, any method to display custom skulls with Geyser is, to some extent, a workaround. Geyser has long supported in-world custom skulls via the spawning of player entities. This, however, does not allow for the use of custom skulls in inventories, nor does it allow them to be worn by entities. To resolve this, Geyser now allows for the pre-registration of custom skulls via a config file. Geyser will then use this config file to generate a custom resource pack on start that contains the geometry and textures for the pre-registered custom skulls. To the client, these skulls are blocks. Therefore, they can be held in player inventories. In additional, attachables are defined for each skull block so that it is displayed correctly when worn and held by entities. -To setup custom skulls in geyser, you have to choose how you are going to register your blocks. The easiest is [using custom-skulls.yml](#custom-skullsyml) but you can also [use a Geyser extension](#geyser-extensions). +To setup custom skulls in geyser, you have to choose how you are going to register your blocks. The easiest is [using custom-skulls.yml](#custom-skullsyml), but you can also [use a Geyser extension](#geyser-extensions). ## Enabling custom skulls @@ -57,6 +57,8 @@ skin-hashes: - a90790c57e181ed13aded14c47ee2f7c8de3533e017ba957af7bdf9df1bde94f ``` +To add a skull, you need to choose any of the four methods, and add a new entry. The following sections will explain each method: + ### Player usernames Skulls can be registered in this section via player usernames. These will be updated when Geyser starts. As a result, they may change if the player's username or skin changes. @@ -128,7 +130,7 @@ public class RegisterCustomSkull implements Extension { @Subscribe public void onDefineCustomSkulls(GeyserDefineCustomSkullsEvent event) { String profile = "ewogICJ0aW1lc3RhbXAiIDogMTY1NzMyMjIzOTgzMywKICAicHJvZmlsZUlkIiA6ICJjZGRiZTUyMGQwNDM0YThiYTFjYzlmYzkyZmRlMmJjZiIsCiAgInByb2ZpbGVOYW1lIiA6ICJkYXZjaG9vIiwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2E5MDc5MGM1N2UxODFlZDEzYWRlZDE0YzQ3ZWUyZjdjOGRlMzUzM2UwMTdiYTk1N2FmN2JkZjlkZjFiZGU5NGYiLAogICAgICAibWV0YWRhdGEiIDogewogICAgICAgICJtb2RlbCIgOiAic2xpbSIKICAgICAgfQogICAgfQogIH0KfQ" - event.registerCustomSkull(profile, SkullTextureType.PROFILE); + event.register(profile, SkullTextureType.PROFILE); } } ```