diff --git a/docs/compatibilities/_category_.json b/docs/compatibilities/_category_.json index 5cecde2..0fe8a1b 100644 --- a/docs/compatibilities/_category_.json +++ b/docs/compatibilities/_category_.json @@ -1,4 +1,4 @@ { "label": "Mod Compatibilities", - "position": 5 + "position": 6 } diff --git a/docs/compatibilities/kubejs/_category_.json b/docs/compatibilities/kubejs/_category_.json new file mode 100644 index 0000000..c575b4a --- /dev/null +++ b/docs/compatibilities/kubejs/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "KubeJS" +} diff --git a/docs/compatibilities/kubejs/basics.md b/docs/compatibilities/kubejs/basics.md new file mode 100644 index 0000000..fea189b --- /dev/null +++ b/docs/compatibilities/kubejs/basics.md @@ -0,0 +1,44 @@ +# Basics + +Scripts are not a part of Palladium but rather a part of KubeJS. Palladium adds a lot of compatibility features. KubeJS scripts allow you to use the JavaScript programming language to execute code from events that happen in-game. For example, you can grant players a diamond every time they break a block. It's helpful to know a little Javascript but it is not a requirement. KubeJS has three types of scripts startup, server/world & client. + +| Script Types | Reload Method | Content | Folder Structure | +|--------------|---------------------------------------|------------------------------------------------|-------------------------------------| +| Client | Pressing F3+T | Custom animations, custom HUDs | `assets//kubejs_scripts` | +| Server/World | Running `/reload` | e.g. manipulate entities, player/entity events | `data//kubejs_scripts` | +| Startup | None. Loads once when the game starts | Custom abilities, custom conditions | `addon//kubejs_scripts` | + +## Example +Here's an example of what you can do with KubeJS scripts. If you would like to learn more, I recommend checking out their [wiki v1](https://mods.latvian.dev/books/kubejs) and [wiki v2](https://kubejs.com/wiki/). +```js +ItemEvents.rightClicked((event) => { + + // Show player's SUPERPOWER [when rightclicking bread] + if (event.getItem().getId() === 'minecraft:bread') { + event.player.tell('Current Superpower: ' + event.player.data.powers.getSuperpower()); + } + + // Show all of player's powers (superpower, suit, etc.) [when rightclicking glow berries] + if (event.getItem().getId() === 'minecraft:glow_berries') { + event.player.tell('Current Powers:'); + event.player.data.powers.getPowers().forEach(element => { + event.player.tell(' - ' + element); + }); + } + + // Show ALL AVAILABLE powers [when rightclicking rabbit stew] + else if (event.getItem().getId() === 'minecraft:rabbit_stew') { + event.player.tell('All Powers:'); + event.level.data.powers.getPowers().forEach(element => { + event.player.tell(' - ' + element); + }); + } + + // Swing arm [when rightclicking bone] + else if (event.getItem().getId() === 'minecraft:bone') { + palladium.swingArm(event.player, event.getHand()); + } +}); +``` +TIP: Comments in Javascript code have a `//` in front of them! +TIP: Since this is a server/world script, it's placed in `data//kubejs_scripts`. \ No newline at end of file diff --git a/docs/compatibilities/kubejs/custom-abilities.md b/docs/compatibilities/kubejs/custom-abilities.md new file mode 100644 index 0000000..375bccb --- /dev/null +++ b/docs/compatibilities/kubejs/custom-abilities.md @@ -0,0 +1,70 @@ +# Custom Abilities + +This page of the wiki will show you how to make a custom ability. Custom abilities are made using KubeJS scripts. + +1. Make a file in the addon scripts directory. +2. Add the code to register the ability. +```js +StartupEvents.registry('palladium:abilities', (event) => { + // ID of the condition will be: 'kubejs:mycoolpack/mycoolability' + event.create('mycoolpack/mycoolability') +}); +``` +3. Add a preset icon. +```js +StartupEvents.registry('palladium:abilities', (event) => { + event.create('mycoolpack/mycoolability') + .icon(palladium.createItemIcon('palladium:vibranium_circuit')) +}); +``` +4. [OPTIONAL] Add the first tick handler. You can dfine the behaviour of what happens during the first tick of the ability being enabled. +```js +StartupEvents.registry('palladium:abilities', (event) => { + event.create('mycoolpack/mycoolability') + .icon(palladium.createItemIcon('palladium:vibranium_circuit')) + + .firstTick((entity, entry, holder, enabled) => { + entity.tell('First Tick!'); + }); +}); +``` +5. [OPTIONAL] Add the tick handler. You can dfine the behaviour of what happens during every tick of the ability. You should use `enabled` to see if the ability is enabled. +```js +StartupEvents.registry('palladium:abilities', (event) => { + event.create('mycoolpack/mycoolability') + .icon(palladium.createItemIcon('palladium:vibranium_circuit')) + + .firstTick((entity, entry, holder, enabled) => { + entity.tell('First Tick!'); + }) + + .tick((entity, entry, holder, enabled) => { + if (enabled) { + entity.tell('Tick!'); + } + }); +}); +``` +6. [OPTIONAL] Add the last tick handler. You can dfine the behaviour of what happens during the last tick of the ability being enabled. +```js +StartupEvents.registry('palladium:abilities', (event) => { + event.create('mycoolpack/mycoolability') + .icon(palladium.createItemIcon('palladium:vibranium_circuit')) + + .firstTick((entity, entry, holder, enabled) => { + entity.tell('First Tick!'); + }) + + .tick((entity, entry, holder, enabled) => { + if (enabled) { + entity.tell('Tick!'); + } + }) + + .lastTick((entity, entry, holder, enabled) => { + entity.tell('Last Tick!'); + }); +}); +``` + +That's it! Now you can use your ability in your power json file. You can find the ID in the abilities.html. \ No newline at end of file diff --git a/docs/compatibilities/kubejs/custom-animations.md b/docs/compatibilities/kubejs/custom-animations.md new file mode 100644 index 0000000..d12117d --- /dev/null +++ b/docs/compatibilities/kubejs/custom-animations.md @@ -0,0 +1,73 @@ +# Custom Animations + +Using KubeJS you can also animate the player model itself. + +To get started you create a client-side script (`assets//kubejs_scripts/.js`) and subscribe to the event for registering animations: + +```js +PalladiumEvents.registerAnimations((event) => { + event.register('test/ability_test', 10, (builder) => { + // animation part + }); +}); +``` + +In the `register` function you specificy the ID, the priority, and then a function for animating, which just needs a `builder` parameter. + + + +Let's animate the right arm when the player is crouching. **You should wrap every animation in an `if` to make it dependent on something!** +In the animation part (look above) you can write this to get a player part: +```js +if (builder.getPlayer().isCrouching()) { + builder.get('right_arm'); +} +``` +With this function you get access to the player's arm and can modify it. To rotate it to a certain angle, we can do this: +```js +if (builder.getPlayer().isCrouching()) { + builder.get('right_arm').setXRotDegrees(90); +} +``` +This will rotate the right arm by 90 degrees. + +This will happen instantly though. If you want to progress this animation over time, we need an animation timer ability. Let's say you have named an animation timer ability 'animation' in a 'test:kubejs_animation' power, your script can now look like this: +```js +const progress = animationUtil.getAnimationTimerAbilityValue(builder.getPlayer(), 'test:kubejs_animation', 'animation', builder.getPartialTicks()); +if (progress > 0.0) { + builder.get('right_arm').setXRotDegrees(90).multiplier(progress); +} +``` +With this we are also now having the animation depend on that timer, and not on the crouching anymore. The `animationUtil.getAnimationTimerAbilityValue` function gives you a number from 0.0 to 1.0. This is then used in `multiplier` to make the animation happen. + +This animation however is pretty linear and unnatural. There are various methods to "ease" this animation out. You can see them all [here](https://easings.net/). Let's say we want to use the "easeInOutCubic" from there in our animation, we remove the "ease" part of that name and use it like this: +```js +const progress = animationUtil.getAnimationTimerAbilityValue(builder.getPlayer(), 'test:kubejs_animation', 'animation', builder.getPartialTicks()); +if (progress > 0.0) { + builder.get('right_arm').setXRotDegrees(90).animate('InOutCubic', progress); +} +``` +This will make our animation nice and smooth! + +That's basically it. This example only showed how to rotate the X axis, but here are all the functions you can use: +`setXRot` / `setYRot` / `setZRot` (use radians) +`setXRotDegrees` / `setYRotDegrees` / `setZRotDegrees` (use degrees) +`setX` / `setY` / `setZ` +`scale` / `scaleX` / `scaleY` / `scaleZ` + +And here are all the body parts you can access: +`head`, `chest`, `right_arm`, `left_arm`, `right_leg`, `left_leg`, `body` (last one is able to rotate/scale/move the entire player model) + +# First-Person-Specific Animations +If you want to have the animation in first-person be more specific, or even not appear at all, there are some functions you can use: +```js +PalladiumEvents.registerAnimations((event) => { + event.register('test/ability_test', 10, (builder) => { + if (builder.isFirstPerson()) { + // do first-person animations + } else { + // do third-person animations + } + }); +}); +``` \ No newline at end of file diff --git a/docs/compatibilities/kubejs/custom-conditions.md b/docs/compatibilities/kubejs/custom-conditions.md new file mode 100644 index 0000000..f757bb5 --- /dev/null +++ b/docs/compatibilities/kubejs/custom-conditions.md @@ -0,0 +1,24 @@ +# Custom Conditions + +This page of the wiki will show you how to make a custom condition. Custom conditions are made using KubeJS scripts. + +1. Make a file in the addon scripts directory. +2. Add the code to register the condition. +```js +StartupEvents.registry('palladium:condition_serializer', (event) => { + // ID of the condition will be: 'kubejs:mycoolpack/mycoolcondition' + event.create('mycoolpack/mycoolcondition') +}); +``` +3. Add the condition handler. +```js +StartupEvents.registry('palladium:condition_serializer', (event) => { + event.create('mycoolpack/mycoolcondition') + + // Handler for the condition, in this case, the condition will be fulfilled when the entity is crouching + .test((entity) => { + return entity.isCrouching(); + }); + +}); +``` diff --git a/docs/compatibilities/kubejs/custom-huds.md b/docs/compatibilities/kubejs/custom-huds.md new file mode 100644 index 0000000..1a6ad33 --- /dev/null +++ b/docs/compatibilities/kubejs/custom-huds.md @@ -0,0 +1,24 @@ +# Custom HUDs + +You can also use Palladium with KubeJS to make your own HUD. Simply register it in a client-side script like here: + +```js +// Event for registering HUDs +PalladiumEvents.registerGuiOverlays((event) => { + event.register( + // ID for the overlay + 'test/example_hud', + + // Function for rendering + (minecraft, gui, poseStack, partialTick, screenWidth, screenHeight) => { + // Drawing text. Parameters: PoseStack, Text (as text component), X, Y, Color + guiUtil.drawString(poseStack, Component.string("I am a text"), 10, 10, 0xffffff); + + // Drawing a piece of a texture + // Parameters: Texture, Gui, PoseStack, x, y, U on the texture, V on the texture, width, height + guiUtil.blit('test:textures/gui/my_cool_texture.png', gui, poseStack, 10, 20, 0, 10, 182, 5); + }); +}); +``` + +If you use the `blit` method, your texture file must be 256x256 pixels big. If you choose to have your own dimensions, simply add to more arguments add the end as the texture width & height. \ No newline at end of file diff --git a/docs/compatibilities/kubejs/useful-functions.md b/docs/compatibilities/kubejs/useful-functions.md new file mode 100644 index 0000000..20c5749 --- /dev/null +++ b/docs/compatibilities/kubejs/useful-functions.md @@ -0,0 +1,78 @@ +# Useful Functions + +## Powers +`palladium.powers.getPowerIds(LivingEntity entity)` +Returns a list of the entity's current power IDs. + +`palladium.powers.getPowerIdsForNamespace(LivingEntity entity, String namespace)` +Returns the IDs of the powers the entity currently has, filtered by the namespace + +## Superpowers + +`palladium.superpowers.setSuperpower(LivingEntity entity, ResourceLocation powerId)` +Sets the entity's superpowers to just the given one + +`palladium.superpowers.setSuperpowerIds(LivingEntity entity, ResourceLocation... powerIds)` +Sets the entity's superpowers to the given ones + +`palladium.superpowers.hasSuperpower(LivingEntity entity, ResourceLocation powerId)` +Tests if the entity has the given superpower + +`palladium.superpowers.addSuperpower(LivingEntity entity, ResourceLocation powerId)` +Adds a superpower to the entity + +`palladium.superpowers.removeSuperpower(LivingEntity entity, ResourceLocation powerId)` +Removes a superpower to the entity + +`palladium.superpowers.removeAllSuperpowers(LivingEntity entity)` +Removes all superpowers from an entity + +## Abilities + +`palladium.abilities.getEntries(LivingEntity entity)` +Returns all ability entries from the given entity + +`palladium.abilities.getEntries(LivingEntity entity, ResourceLocation abilityId)` +Returns all ability entries of the given ability type from the entity + +`palladium.abilities.getEntry(LivingEntity entity, ResourceLocation powerId, String abilityKey)` +Returns a specific ability entry from a specific power + +`palladium.abilities.isUnlocked(LivingEntity entity, ResourceLocation powerId, String abilityKey)` +Checks if a specific ability entry is unlocked + +`palladium.abilities.isEnabled(LivingEntity entity, ResourceLocation powerId, String abilityKey)` +Checks if a specific ability entry is enabled + +`palladium.abilities.hasPower(LivingEntity entity, ResourceLocation powerId)` +Checks if the entity has that power (can be superpower or power of any source) + + +## Scoreboard + +`palladium.scoreboard.getScore(Entity entity, String objective, int fallback)` +Gets the entity's score for the given objective, or the fallback value if the entity has no score. +The `fallback` argument is optional and defaults to 0. + +`palladium.scoreboard.setScore(Entity entity, String objective, int value)` +Sets the entity's score for the given objective to the given value. + +`palladium.scoreboard.addScore(Entity entity, String objective, int value)` +Adds the given value to the entity's score for the given objective. + +`palladium.scoreboard.subtractScore(Entity entity, String objective, int value)` +Removes the given value from the entity's score for the given objective. + +## Animation + +`palladium.animations.getAnimationTimerAbilityValue(LivingEntity entity, ResourceLocation powerId, String abilityKey, float partialTicks)` +Gives you the animation progress of the given ability, a float ranging from 0.0 to 1.0 + +`palladium.animations.getAnimationTimerAbilityValue(LivingEntity entity, ResourceLocation powerId, String abilityKey, float partialTicks, float start, float end)` +Gives you the animation progress of the given ability, a float ranging from 0.0 to 1.0. BUT you can determines which +part of the progress you want to look at. If the animation ability goes up to 30, and you only want to see the progress +of between 10 and 20 you can use this function. + +`palladium.animations.getInbetweenProgress(float progress, float startingPoint, float endPoint)` +Calculcates the progress of a bigger number, given from two points. If `progress` is a float that goes up to 30, and you +want to see how far the number is from 10-20, you can use the other 2 parameters to determine that. \ No newline at end of file diff --git a/docs/rendering/_category_.json b/docs/rendering/_category_.json new file mode 100644 index 0000000..08cd30b --- /dev/null +++ b/docs/rendering/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Rendering", + "position": 4 +} diff --git a/docs/rendering/armor-renderers.md b/docs/rendering/armor-renderers.md new file mode 100644 index 0000000..582516b --- /dev/null +++ b/docs/rendering/armor-renderers.md @@ -0,0 +1,284 @@ +# Armor Renderers + +**Before you start with this page, make sure to have checked [Custom Items](/addon-content/items) and the `items.html` file in +your Palladium-documentation folder.** + +If you've created an armor piece in your pack, it won't display on your actual player. To do so, you have to create an +armor renderer file for it. The path for it is equivalent to the ID of your item, so as an example: +Item ID: `namespace:example_chestplate` +Armor Renderer File Path: `assets/namespace/palladium/armor_renderers/example_chestplate.json` + +The file itself can then look like this: + +```json +{ + "textures": "namespace:textures/models/armor/example_chestplate.png" +} +``` + +This simple setup will then give your armor the texture specified, with the default vanilla model. + +To use a custom model, just add this: + +```json +{ + "textures": "namespace:textures/models/armor/example_chestplate.png", + "model_layers": "palladium:humanoid#suit" +} +``` + +In this example I use a model layer that is built into Palladium which makes it skin-tight, so you can use this aswell. + +## Hide the player's second layer + +Sometimes the 2nd layer of the player skin might force to make your armor model too thick, but you can simply make it +invisible by adding this: + +```json +{ + "textures": "namespace:textures/models/armor/example_chestplate.png", + "model_layers": "palladium:humanoid#suit", + "hide_second_layer": true +} +``` + +Or even use conditions, to have it disappear in certain scenarios: + +```json +{ + "textures": "namespace:textures/models/armor/example_chestplate.png", + "model_layers": "palladium:humanoid#suit", + "hide_second_layer": { + "type": "palladium:on_ground" + } +} +``` + +## Attaching Render Layers + +If you followed the render layer tutorial, you can also attach render layers to your armor renderer. +You can either add ones you have created externally in other files: +```json +{ + "textures": "namespace:textures/models/armor/example_chestplate.png", + "model_layers": "palladium:humanoid#suit", + "render_layers": [ + "namespace:my_cool_render_layer", + "namespace:my_second_cool_render_layer" + ] +} +``` + +Or you create them directly in this file: +```json +{ + "textures": "namespace:textures/models/armor/example_chestplate.png", + "model_layers": "palladium:humanoid#suit", + "render_layers": [ + { + "model_layer": "namespace:layer_name", + "texture": "namespace:textures/models/example_texture.png", + "render_type": "glow" + } + ] +} +``` + + +## Advanced: Skin Typed Models/Textures + +If you have made models for the player before, you might have noticed that one model or texture might not always fit +both skin types. For that you can make models and texture depend on the skin type like this: + +```json +{ + "textures": { + "normal": "namespace:textures/models/armor/example_chestplate.png", + "slim": "namespace:textures/models/armor/example_chestplate_slim.png" + }, + "model_layers": { + "normal": "palladium:humanoid#suit", + "slim": "palladium:humanoid#suit_slim" + } +} +``` + +# Advanced: Openable Armor Pieces + +In the settings for the armor piece you might have seen the `openable` setting which you can enable. If you do so, your +armor piece can be opened by the player. For this case you can easily define textures: + +```json +{ + "textures": { + "default": "namespace:textures/models/armor/example_chestplate.png", + "open": "namespace:textures/models/armor/example_chestplate_open.png" + }, + "model_layers": "palladium:humanoid#suit" +} +``` + +If you've also set the `opening_time` to something beyond 0, you can now also define a texture for each tick/frame (it +starts at 1, as 0 is the closed state). Let's say you have set it to 5: + +```json +{ + "textures": { + "default": "namespace:textures/models/armor/example_chestplate.png", + "open_1": "namespace:textures/models/armor/example_chestplate_open_1.png", + "open_2": "namespace:textures/models/armor/example_chestplate_open_2.png", + "open_3": "namespace:textures/models/armor/example_chestplate_open_3.png", + "open_4": "namespace:textures/models/armor/example_chestplate_open_4.png", + "open_5": "namespace:textures/models/armor/example_chestplate_open_5.png" + }, + "model_layers": "palladium:humanoid#suit" +} +``` + +If you want, you can also do that with the model (fully optional): + +```json +{ + "textures": { + "default": "namespace:textures/models/armor/example_chestplate.png", + "open_1": "namespace:textures/models/armor/example_chestplate_open_1.png", + "open_2": "namespace:textures/models/armor/example_chestplate_open_2.png", + "open_3": "namespace:textures/models/armor/example_chestplate_open_3.png", + "open_4": "namespace:textures/models/armor/example_chestplate_open_4.png", + "open_5": "namespace:textures/models/armor/example_chestplate_open_5.png" + }, + "model_layers": { + "default": "namespace:humanoid#example_chestplate", + "open_1": "namespace:humanoid#example_chestplate_open_1", + "open_2": "namespace:humanoid#example_chestplate_open_2", + "open_3": "namespace:humanoid#example_chestplate_open_3", + "open_4": "namespace:humanoid#example_chestplate_open_4", + "open_5": "namespace:humanoid#example_chestplate_open_5" + } +} +``` + +You can also use dynamic textures to simplify this for the textures: + +```json +{ + "textures": { + "default": "namespace:textures/models/armor/example_chestplate.png", + "open": { + "base": "namespace:textures/models/armor/example_chestplate_open_#X.png", + "variables": { + "X": { + "type": "palladium:openable_equipment_progress" + } + } + } + }, + "model_layers": "palladium:humanoid#suit" +} +``` + +Skin-types definitions are also still possible in any of these cases: + +```json +{ + "textures": { + "default": { + "normal": "namespace:textures/models/armor/example_chestplate.png", + "slim": "namespace:textures/models/armor/example_chestplate_slim.png" + }, + "open": { + "normal": { + "base": "namespace:textures/models/armor/example_chestplate_open_#X.png", + "variables": { + "X": { + "type": "palladium:openable_equipment_progress" + } + } + }, + "slim": { + "base": "namespace:textures/models/armor/example_chestplate_slim_open_#X.png", + "variables": { + "X": { + "type": "palladium:openable_equipment_progress" + } + } + } + } + }, + "model_layers": "palladium:humanoid#suit" +} +``` + +## Advanced: Conditional textures/models + +You can also make textures or models dependent on certain states. Let's say we want a different texture and model when +the player is crouching, so we define those different states first: +**Unless you use the skin-typed "normal"/"slim" settings, a "default" texture/model must always be present!** + +```json +{ + "textures": { + "default": "namespace:textures/models/armor/example_chestplate.png", + "crouching": "namespace:textures/models/armor/example_chestplate_crouching.png" + }, + "model_layers": { + "default": "palladium:humanoid#suit", + "crouching": "palladium:humanoid#suit_crouching" + } +} +``` + +Now you have put down a different texture and model under a "crouching" key, we can now use those to define conditions +and use those states: + +```json +{ + "textures": { + "default": "namespace:textures/models/armor/example_chestplate.png", + "crouching": "namespace:textures/models/armor/example_chestplate_crouching.png" + }, + "model_layers": { + "default": "palladium:humanoid#suit", + "crouching": "palladium:humanoid#suit_crouching" + }, + "conditions": [ + { + "texture": "crouching", + "model_layer": "crouching", + "if": { + "type": "palladium:crouching" + } + } + ] +} +``` + +That's it! You can also add multiple of those, and make model and texture depend on different conditions. In this +example, the texture changes on crouching, but the model changes when being under water: + +```json +{ + "textures": { + "default": "namespace:textures/models/armor/example_chestplate.png", + "crouching": "namespace:textures/models/armor/example_chestplate_crouching.png" + }, + "model_layers": { + "default": "palladium:humanoid#suit", + "under_water": "palladium:humanoid#suit_under_water" + }, + "conditions": [ + { + "texture": "crouching", + "if": { + "type": "palladium:crouching" + } + }, + { + "model_layer": "under_water", + "if": { + "type": "palladium:under_water" + } + } + ] +} +``` \ No newline at end of file diff --git a/docs/rendering/dynamic-textures.md b/docs/rendering/dynamic-textures.md new file mode 100644 index 0000000..89ce323 --- /dev/null +++ b/docs/rendering/dynamic-textures.md @@ -0,0 +1,111 @@ +# Dynamic Textures + +Dynamic Textures a great way to make animated content in render layers, icons, and more. To create one, simple create a file like the following + +```json title="assets//palladium/dynamic_textures/.json" +{ + "base": "namespace:textures/models/example_texture" +} +``` +This one would simply just look for the texture, and not do anything special with it. To make it more *dynamic*, read the following chapters. +If you plan to use this somewhere in your pack, you start your texture path with a `#`. +To use this dynamic texture as an icon for an ability, instead of specifying the normal texture path, you use a `#` in +front of the path and make it lead to the dynamic texture ID (`#namespace:filename`). + + +## Texture Variables + +The `base` setting is the texture we'll always start with when the game starts to produce this texture. There are those things called "texture variables". They allow you to get input from the entity and use it in your texture path. Let's use Palladium's variable for crouching: +```json +{ + "base": "namespace:textures/models/example_texture_#CROUCHING.png", + "variables": { + "CROUCHING": { + "type": "palladium:crouching" + } + } +} +``` +Now we get the data from the entity whether it's crouching or not. The `CROUCHING` key I used there is the one you can +use in the texture path starting with a `#`. +Depending on the entity, the game will now look for `namespace:textures/models/example_texture_true.png` or +`namespace:textures/models/example_texture_false.png` (because it will replace `#CROUCHING` in the `base` path with `true`/`false`). + +If you don't want to add it to be replace with `true`/`false`, the `palladium:crouching` variable has extra settings which allow you to specify what the replacements in both cases would be. So this: + +```json +{ + "base": "namespace:textures/models/example_texture#CROUCHING.png", + // highlight-start + "variables": { + "CROUCHING": { + "type": "palladium:crouching", + "true_value": "_crouching", + "false_value": "" + } + }, + // highlight-end +} +``` +...will look for `namespace:textures/models/example_texture.png` (since I gave `false_value` an empty string) and `namespace:textures/models/example_texture_crouching.png`. + +All texture variable types can be found in the `mods/documentation/palladium/dynamic_textures/texture_variables.html` file in your minecraft folder. + +## Texture Transformers + +There are also ways to let the game modify your texture. Those are called "texture transformers". So let's add an overlay on top of our current texture: + +```json +{ + "base": "namespace:textures/models/example_texture#CROUCHING.png", + "variables": { + "CROUCHING": { + "type": "palladium:crouching", + "true_value": "_crouching", + "false_value": "" + } + }, + // highlight-start + "transformers": [ + { + "type": "palladium:overlay", + "overlay": "namespace:textures/models/example_overlay.png" + } + ] + // highlight-end +} +``` + +Now this will put the texture specified in `overlay` on top of our `base` texture. +And just as you can use texture variables in `output`, you can also use them in the transformers: + +```json +{ + "base": "namespace:textures/models/example_texture#CROUCHING.png", + "variables": { + "CROUCHING": { + "type": "palladium:crouching", + "true_value": "_crouching", + "false_value": "" + } + }, + "transformers": [ + { + "type": "palladium:overlay", + // highlight-start + "overlay": "namespace:textures/models/example_overlay#CROUCHING.png", + // highlight-end + } + ] +} +``` + +This change would make the game look for different overlays to put on your base texture, depending on if your entity is crouching or not. + +All texture transformers can be found here: **_coming soon_** + + + +You can add as many variables and transformers as you want. In the case of transformers, the order is important for the result. It will go through each from the start to the end and modify the texture in that order. + +All that might seem complicated at first, but once you understand how it works you should be able to get pretty complex with this. Feel free to suggest any texture transformers and texture variables on issue tracker here if you need any for your dynamic render layer texture. \ No newline at end of file diff --git a/docs/rendering/render-layers.md b/docs/rendering/render-layers.md new file mode 100644 index 0000000..40b9889 --- /dev/null +++ b/docs/rendering/render-layers.md @@ -0,0 +1,127 @@ +# Render Layers + +Before you start, you need to understand what render layers and model layers are and how they work. + +A "model type" is simply a setting that defines what bones the corresponding model layer must have. +Example: By default a render layer uses the `minecraft:humanoid` model type, which you'll most likely need. +It contains the following bones: `head`, `hat`, `body`, `right_arm`, `left_arm`, `right_leg`, `left_leg`. +If you just want to make a model that fits your player, it's wise to not change the model_type. +You only really need to do it in extremely rare cases (like making a render layer that fits a pig). + +A "model layer" is a file that defines the properties of a model. It contains all the **definitions** for the beforementioned bones. +As described above, the model type defines which bones are present, the model layer defines the properties of those bones. +You make a model layer in BlockBench, for example. They utilize the Bedrock Entity Model format, and are stored in +`assets//palladium/model_layers/.json` in your pack. + +A "render layer" then uses a model type and a model layer (and of course a texture) and renders it on the entity. They are stored in +`assets//palladium/render_layers/.json` in your pack. + +## Creating a Model Layer + +For humanoid models, you can download [this BlockBench file](https://drive.google.com/uc?export=download&id=1-OpsTX7qKUv_zy03n5iCLDuVi9fz4JgG) if you want to model something on your own. Palladium uses the Bedrock Entity Model format, so you can just use the built-in system in BlockBench for that. +In Blockbench you can see those groups/folders on the sidebar. Those are the bones! If you wish to add something to e.g. the player's arm, you need to add it to the `right_arm` or `left_arm` group. + +![Inside BlockBench](https://i.imgur.com/SMVqxSn.png) + +## Creating a Render Layer + +After all that, you can finally create a proper render layer, a basic setup can look like this: + +```json title="assets//palladium/render_layers/.json" +{ + "model_layer": "namespace:model_layer_name", + "texture": "namespace:textures/models/example_texture.png" +} +``` + +You can see that `"model_type"` is missing. If you wish to make a render layer for players, you don't need to specify it. + +If you want to make your layer glow, you can also change the render type: + +```json title="assets//palladium/render_layers/.json" +{ + "model_layer": "namespace:model_layer_name", + "texture": "namespace:textures/models/example_texture.png", + "render_type": "glow" +} +``` + +Easy as that! After that, your render layer will be available under the ID `namespace:filename` for you to use in abilities. + +## Compound Render Layer + +If you want to define **multiple** render layers in **one** file, you can use the compound render layer type like this: + +```json title="assets//palladium/render_layers/.json" +{ + "type": "palladium:compound", + "layers": [ + { + "model_layer": "namespace:layer_1_name", + "texture": "namespace:textures/models/example_texture_1.png" + }, + { + "model_layer": "namespace:layer_2_name", + "texture": "namespace:textures/models/example_texture_2.png", + "render_type": "glow" + } + ] +} +``` + + + +## Advanced: Skin Typed Models/Textures + +If you have made models for the player before, you might have noticed that one model or texture might not always fit +both skin types. For that you can make models and texture depend on the skin type like this: + +```json +{ + "model_layer": { + "normal": "namespace:layer_name", + "slim": "namespace:layer_name_slim" + }, + "texture": { + "normal": "namespace:textures/models/example_texture.png", + "slim": "namespace:textures/models/example_texture_slim.png" + } +} +``` + +Of course you don't need to use that all the 3 settings if you just have the texture dependent on the skin type. + + +## Advanced: Dynamic Textures + +You can use any [dynamic texture](Dynamic-Textures) you have created by referencing it with `#`, but you can also define it directly in this render layer file: +```json +{ + "model_type": "minecraft:humanoid", + "model_layer": "namespace:layer_name", + "texture": { + "base": "namespace:textures/models/example_texture#CROUCHING.png", + "variables": { + "CROUCHING": { + "type": "palladium:crouching", + "true_value": "_crouching", + "false_value": "" + } + } + } +} +``` + +## Advanced: Using the entity's texture + +You can also use the entity's own texture on a model by you. Simply use this: +```json +"texture": "#entity" +``` +If you don't want the overriden texture (by skin change abilities) and just the original/base one, use this: +```json +"texture": { + "type": "palladium:entity", + "ignore_skin_change": true +} +``` \ No newline at end of file diff --git a/docs/rendering/special-render-layer-types.md b/docs/rendering/special-render-layer-types.md new file mode 100644 index 0000000..d9947de --- /dev/null +++ b/docs/rendering/special-render-layer-types.md @@ -0,0 +1,50 @@ +# Special Render Layer Types + +On the previous page about render layers you get to know how they work, where you need to place them, and what the basic type requires. However, Palladium comes with some special types. +*"conditions" still work on all of them!* + + +## Skin Overlay +This render layer simply puts a texture directly above the player model, without you needing to define a model: +```json +{ + "type": "palladium:skin_overlay", + "render_type": "solid", + "texture": "namespace:textures/models/overlay.png" +} +``` +`render_type` is **OPTIONAL**. +`texture` is the path to your texture. You can also use a [dynamic setup](https://github.com/ThreeTAG/Palladium/wiki/Dynamic-Textures) for this. + + +## Lightning Sparks +This creates an animated lightning aura around your player. +```json +{ + "type": "palladium:lightning_sparks", + "frequency": 0.5, + "amount": 5, + "core_color": "#ffffff", + "glow_color": "#ffffff", + "core_opacity": 1.0, + "glow_opacity": 1.0, + "thickness": 0.02, + "normal_transparency": false +} +``` +All of those settings are **OPTIONAL**. + + +## Thrusters +Creates animated flame-thrusters at your hands and feet, which react to flying. +```json +{ + "type": "palladium:thrusters", + "color": "#ffffff", + "right_arm": true, + "left_arm": true, + "right_leg": true, + "left_leg": true +} +``` +All of those settings are **OPTIONAL**. \ No newline at end of file diff --git a/docs/rendering/trails.md b/docs/rendering/trails.md new file mode 100644 index 0000000..eb7522d --- /dev/null +++ b/docs/rendering/trails.md @@ -0,0 +1,32 @@ +# Trails + +Trails are a neat visual addition to various powers. +You can find info for all the trails types in the `trails.html` file in your `mods/documentation/palladium` folder. + +A simple lightning trail could look like this: + +```json title="assets//palladium/trails/.json" +{ + "type": "palladium:lightning", + "spacing": 1, + "lifetime": 20, + "glow_color": "#ff0000", + "amount": 7, + "thickness": 0.05 +} +``` + +Then you can reference the trail in a `palladium:trail` ability in your power like this: + +```json +"example_trail": { + "type": "palladium:trail", + "trail": "namespace:filename" +} +``` + +# Examples + +You can find examples for some trails in the test pack [here](https://github.com/ThreeTAG/Palladium/tree/1.20/main/run/addonpacks/Test%20Pack/assets/test/palladium/trails). + +They are used in [this power](https://github.com/ThreeTAG/Palladium/blob/1.20/main/run/addonpacks/Test%20Pack/data/test/palladium/powers/trail_test.json). \ No newline at end of file diff --git a/docs/utilities/_category_.json b/docs/utilities/_category_.json index 3b0d527..82157f0 100644 --- a/docs/utilities/_category_.json +++ b/docs/utilities/_category_.json @@ -1,4 +1,4 @@ { "label": "Utilities", - "position": 4 + "position": 5 }