Curios slots rendering !
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
"id": "artifacts:feral_claws",
|
||||
"texture": "artifacts:feral_claws",
|
||||
"max_stack": 1,
|
||||
"worn": {
|
||||
"model": "artifacts:feral_claws_wide",
|
||||
"texture": "artifacts:feral_claws_worn",
|
||||
"slim_model": "artifacts:feral_claws_slim"
|
||||
},
|
||||
"components": {
|
||||
"bworld:curio_modifiers": [
|
||||
{ "attribute": "bworld:attack_speed", "amount": 0.3, "operation": "add_multiplied_base" }
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
"id": "artifacts:power_glove",
|
||||
"texture": "artifacts:power_glove",
|
||||
"max_stack": 1,
|
||||
"worn": {
|
||||
"model": "artifacts:power_glove_wide",
|
||||
"texture": "artifacts:power_glove_wide",
|
||||
"slim_model": "artifacts:power_glove_slim",
|
||||
"slim_texture": "artifacts:power_glove_slim"
|
||||
},
|
||||
"components": {
|
||||
"bworld:curio_modifiers": [
|
||||
{ "attribute": "bworld:attack_damage", "amount": 4, "operation": "add_value" }
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"format_version": "1.12.0",
|
||||
"minecraft:geometry": [
|
||||
{
|
||||
"description": {
|
||||
"identifier": "geometry.artifacts.feral_claws_slim",
|
||||
"texture_width": 32,
|
||||
"texture_height": 16
|
||||
},
|
||||
"bones": [
|
||||
{
|
||||
"name": "right_arm",
|
||||
"pivot": [-5, 21.5, 0],
|
||||
"cubes": [
|
||||
{
|
||||
"origin": [-6.5, 6.5, -1.5],
|
||||
"size": [3, 5, 1],
|
||||
"uv": [8, 0]
|
||||
},
|
||||
{
|
||||
"origin": [-6.5, 6.5, 0.5],
|
||||
"size": [3, 5, 1],
|
||||
"uv": [8, 6]
|
||||
},
|
||||
{
|
||||
"origin": [-7.5, 7.5, -1.5],
|
||||
"size": [1, 4, 1],
|
||||
"uv": [20, 0]
|
||||
},
|
||||
{
|
||||
"origin": [-7.5, 7.5, 0.5],
|
||||
"size": [1, 4, 1],
|
||||
"uv": [20, 6]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"format_version": "1.12.0",
|
||||
"minecraft:geometry": [
|
||||
{
|
||||
"description": {
|
||||
"identifier": "geometry.artifacts.feral_claws_wide",
|
||||
"texture_width": 32,
|
||||
"texture_height": 16
|
||||
},
|
||||
"bones": [
|
||||
{
|
||||
"name": "right_arm",
|
||||
"pivot": [-5, 22, 0],
|
||||
"cubes": [
|
||||
{
|
||||
"origin": [-7.5, 7, -1.5],
|
||||
"size": [3, 5, 1],
|
||||
"uv": [8, 0]
|
||||
},
|
||||
{
|
||||
"origin": [-7.5, 7, 0.5],
|
||||
"size": [3, 5, 1],
|
||||
"uv": [8, 6]
|
||||
},
|
||||
{
|
||||
"origin": [-8.5, 8, -1.5],
|
||||
"size": [1, 4, 1],
|
||||
"uv": [20, 0]
|
||||
},
|
||||
{
|
||||
"origin": [-8.5, 8, 0.5],
|
||||
"size": [1, 4, 1],
|
||||
"uv": [20, 6]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"format_version": "1.12.0",
|
||||
"minecraft:geometry": [
|
||||
{
|
||||
"description": {
|
||||
"identifier": "geometry.artifacts.power_glove_slim",
|
||||
"texture_width": 32,
|
||||
"texture_height": 32
|
||||
},
|
||||
"bones": [
|
||||
{
|
||||
"name": "right_arm",
|
||||
"pivot": [-5, 21.5, 0],
|
||||
"cubes": [
|
||||
{
|
||||
"origin": [-7, 11.5, -2],
|
||||
"size": [3, 12, 4],
|
||||
"uv": [16, 0],
|
||||
"inflate": 0.5
|
||||
},
|
||||
{
|
||||
"origin": [-7, 11.5, -2],
|
||||
"size": [3, 12, 4],
|
||||
"uv": [16, 16],
|
||||
"inflate": 0.75
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"format_version": "1.12.0",
|
||||
"minecraft:geometry": [
|
||||
{
|
||||
"description": {
|
||||
"identifier": "geometry.artifacts.power_glove_wide",
|
||||
"texture_width": 32,
|
||||
"texture_height": 32
|
||||
},
|
||||
"bones": [
|
||||
{
|
||||
"name": "right_arm",
|
||||
"pivot": [-5, 22, 0],
|
||||
"cubes": [
|
||||
{
|
||||
"origin": [-8, 12, -2],
|
||||
"size": [4, 12, 4],
|
||||
"uv": [16, 0],
|
||||
"inflate": 0.5
|
||||
},
|
||||
{
|
||||
"origin": [-8, 12, -2],
|
||||
"size": [4, 12, 4],
|
||||
"uv": [16, 16],
|
||||
"inflate": 0.75
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 190 B |
Binary file not shown.
|
After Width: | Height: | Size: 213 B |
Binary file not shown.
|
After Width: | Height: | Size: 229 B |
@@ -742,3 +742,33 @@ GNU Lesser General Public License for more details.
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with Curios. If not, see <https://www.gnu.org/licenses/>.
|
||||
```
|
||||
|
||||
# The Undergarden
|
||||
|
||||
The giant chestplate's textures (`textures/giant_chestplate.png` and `textures/giant_chestplate_worn.png`) are utherium
|
||||
armor's from [The Undergarden](https://github.com/quek04/undergarden) by quek, the 26.1 branch for NeoForge, which its
|
||||
`neoforge.mods.toml` declares as MIT licensed:
|
||||
|
||||
```
|
||||
MIT License
|
||||
|
||||
Copyright (c) quek
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"id": "bworld:giant_chestplate",
|
||||
"texture": "bworld:giant_chestplate",
|
||||
"max_stack": 1,
|
||||
"worn": { "model": "bworld:giant_chestplate", "texture": "bworld:giant_chestplate_worn" },
|
||||
"components": {
|
||||
"bworld:curio_modifiers": [
|
||||
{ "attribute": "bworld:max_health", "amount": 20, "operation": "add_value" }
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"format_version": "1.12.0",
|
||||
"minecraft:geometry": [
|
||||
{
|
||||
"description": {
|
||||
"identifier": "geometry.bworld.giant_chestplate",
|
||||
"texture_width": 64,
|
||||
"texture_height": 32
|
||||
},
|
||||
"bones": [
|
||||
{
|
||||
"name": "body",
|
||||
"pivot": [0, 24, 0],
|
||||
"cubes": [{ "origin": [-4, 12, -2], "size": [8, 12, 4], "uv": [16, 16], "inflate": 1 }]
|
||||
},
|
||||
{
|
||||
"name": "right_arm",
|
||||
"pivot": [-5, 22, 0],
|
||||
"cubes": [{ "origin": [-8, 12, -2], "size": [4, 12, 4], "uv": [40, 16], "inflate": 1 }]
|
||||
},
|
||||
{
|
||||
"name": "left_arm",
|
||||
"pivot": [5, 22, 0],
|
||||
"cubes": [{ "origin": [4, 12, -2], "size": [4, 12, 4], "uv": [40, 16], "inflate": 1 }]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// curios, from C4's Curios mod: accessory slots, in 2 columns left of the player's inventory. each player's curios are
|
||||
// a container of their own, and fall out when they die like the rest of what they carry. items with the
|
||||
// bworld:curio_modifiers component change the wearer's attributes, like curios' attribute modifiers
|
||||
import type { AttributeModifier, Container, Player, ServerContext, TagApi } from "bworld/server";
|
||||
import type { AttributeModifier, Container, ItemStack, Player, ServerContext, TagApi } from "bworld/server";
|
||||
|
||||
// where the left column of slots goes, from the inventory screen's left edge. the panel around them ends just left of it
|
||||
const COLUMNS_X = -45;
|
||||
@@ -43,16 +43,19 @@ export function register_curios(ctx: ServerContext) {
|
||||
// keeps what their curios give them up to date
|
||||
function watch(player: Player, curios: Container) {
|
||||
stop_watching.get(player.id)?.();
|
||||
stop_watching.set(player.id, curios.on_change(() => update_modifiers(player, curios)));
|
||||
update_modifiers(player, curios);
|
||||
stop_watching.set(player.id, curios.on_change(() => apply_worn(player, curios)));
|
||||
apply_worn(player, curios);
|
||||
}
|
||||
|
||||
function update_modifiers(player: Player, curios: Container) {
|
||||
// what they wear: its attribute modifiers, and its worn model on them for everyone to see
|
||||
function apply_worn(player: Player, curios: Container) {
|
||||
for (const { attribute, id } of applied.get(player.id) ?? []) player.remove_modifier(attribute, id);
|
||||
const now: { attribute: string; id: string }[] = [];
|
||||
const worn: ItemStack[] = [];
|
||||
for (const [index, slot] of SLOTS.entries()) {
|
||||
const item = curios.get(index);
|
||||
if (!item || !active.includes(slot)) continue;
|
||||
worn.push(item);
|
||||
for (const [i, { attribute, amount, operation }] of modifiers_of(item.id).entries()) {
|
||||
const id = `bworld:curio/${slot}/${i}`;
|
||||
player.add_modifier(attribute, { id, amount, operation });
|
||||
@@ -60,6 +63,7 @@ export function register_curios(ctx: ServerContext) {
|
||||
}
|
||||
}
|
||||
applied.set(player.id, now);
|
||||
player.set_worn("bworld:curios", worn);
|
||||
}
|
||||
|
||||
ctx.events.after.player_leave.subscribe(({ player }) => {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user