added decobench assets added backend logic to best of my ability
parent
4a48f0bae9
commit
5d1d0a5c21
@ -1 +1,32 @@
|
||||
{"format_version":"1.21.100","minecraft:block":{"description":{"identifier":"rzb_dcs:invisible_block"},"components":{"minecraft:selection_box":{"origin":[-7.95,0,-7.95],"size":[15.9,15.9,15.9]},"minecraft:collision_box":{"origin":[-7.95,0,-7.95],"size":[15.9,15.9,15.9]},"minecraft:destructible_by_mining":false,"minecraft:destructible_by_explosion":false,"minecraft:movable":{"movement_type":"immovable"},"tag:rzb_dcs:inv_block_little":{},"minecraft:liquid_detection":{"can_contain_liquid":true,"detection_rules":[{"liquid_type":"water","on_liquid_touches":"no_reaction"}]},"minecraft:geometry":"geometry.rzb_dcs.none","minecraft:material_instances":{"*":{"texture":"rzb_dcs_none","render_method":"alpha_test"}},"rzb_dcs:breakblock_particle":{}}}}
|
||||
{
|
||||
"format_version": "1.21.60",
|
||||
"minecraft:block": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:invisible_block"
|
||||
},
|
||||
"components": {
|
||||
"minecraft:material_instances": {
|
||||
"*": {
|
||||
"texture": "rzb_dcs_none",
|
||||
"render_method": "alpha_test"
|
||||
}
|
||||
},
|
||||
"minecraft:collision_box": {
|
||||
"origin": [
|
||||
-7.95,
|
||||
0,
|
||||
-7.95
|
||||
],
|
||||
"size": [
|
||||
15.9,
|
||||
15.9,
|
||||
15.9
|
||||
]
|
||||
},
|
||||
"minecraft:selection_box": false,
|
||||
"minecraft:destructible_by_mining": false,
|
||||
"minecraft:destructible_by_explosion": false,
|
||||
"minecraft:light_dampening": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,208 @@
|
||||
{
|
||||
"format_version": "1.21.60",
|
||||
"minecraft:entity": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:decobench",
|
||||
"is_spawnable": true,
|
||||
"is_summonable": true,
|
||||
"is_experimental": false
|
||||
},
|
||||
"components": {
|
||||
"minecraft:type_family": {
|
||||
"family": [
|
||||
"decobench",
|
||||
"inanimate"
|
||||
]
|
||||
},
|
||||
"minecraft:health": {
|
||||
"value": 10,
|
||||
"max": 10
|
||||
},
|
||||
"minecraft:physics": {
|
||||
"has_gravity": false,
|
||||
"has_collision": false
|
||||
},
|
||||
"minecraft:collision_box": {
|
||||
"width": 1,
|
||||
"height": 1
|
||||
},
|
||||
"minecraft:custom_hit_test": {
|
||||
"hitboxes": [
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
0,
|
||||
0.5,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"minecraft:pushable": {
|
||||
"is_pushable": false,
|
||||
"is_pushable_by_piston": false
|
||||
},
|
||||
"minecraft:knockback_resistance": {
|
||||
"value": 1
|
||||
},
|
||||
"minecraft:persistent": {},
|
||||
"minecraft:fire_immune": true,
|
||||
"minecraft:nameable": {
|
||||
"allow_name_tag_renaming": false
|
||||
},
|
||||
"minecraft:damage_sensor": {
|
||||
"triggers": [
|
||||
{
|
||||
"cause": "all",
|
||||
"deals_damage": "no"
|
||||
}
|
||||
]
|
||||
},
|
||||
"minecraft:interact": {
|
||||
"interactions": [
|
||||
{
|
||||
"on_interact": {
|
||||
"filters": {
|
||||
"test": "is_family",
|
||||
"subject": "other",
|
||||
"value": "player"
|
||||
},
|
||||
"event": "rzb_dcs:open"
|
||||
},
|
||||
"swing": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"events": {
|
||||
"rzb_dcs:open": {},
|
||||
"rzb_dcs:ht_0": {
|
||||
"add": {
|
||||
"component_groups": [
|
||||
"rzb_dcs:ht_0"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rzb_dcs:ht_90": {
|
||||
"add": {
|
||||
"component_groups": [
|
||||
"rzb_dcs:ht_90"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rzb_dcs:ht_180": {
|
||||
"add": {
|
||||
"component_groups": [
|
||||
"rzb_dcs:ht_180"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rzb_dcs:ht_270": {
|
||||
"add": {
|
||||
"component_groups": [
|
||||
"rzb_dcs:ht_270"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"component_groups": {
|
||||
"rzb_dcs:ht_0": {
|
||||
"minecraft:custom_hit_test": {
|
||||
"hitboxes": [
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
0,
|
||||
0.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
1,
|
||||
0.5,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"rzb_dcs:ht_90": {
|
||||
"minecraft:custom_hit_test": {
|
||||
"hitboxes": [
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
0,
|
||||
0.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
0,
|
||||
0.5,
|
||||
1
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"rzb_dcs:ht_180": {
|
||||
"minecraft:custom_hit_test": {
|
||||
"hitboxes": [
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
0,
|
||||
0.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
-1,
|
||||
0.5,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"rzb_dcs:ht_270": {
|
||||
"minecraft:custom_hit_test": {
|
||||
"hitboxes": [
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
0,
|
||||
0.5,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
0,
|
||||
0.5,
|
||||
-1
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
{
|
||||
"format_version": "1.21.60",
|
||||
"minecraft:entity": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:decobench_init",
|
||||
"is_spawnable": true,
|
||||
"is_summonable": true,
|
||||
"is_experimental": false
|
||||
},
|
||||
"components": {
|
||||
"minecraft:physics": {
|
||||
"has_gravity": false,
|
||||
"has_collision": false
|
||||
},
|
||||
"minecraft:collision_box": {
|
||||
"width": 0.1,
|
||||
"height": 0.1
|
||||
},
|
||||
"minecraft:damage_sensor": {
|
||||
"triggers": [
|
||||
{
|
||||
"cause": "all",
|
||||
"deals_damage": "no"
|
||||
}
|
||||
]
|
||||
},
|
||||
"minecraft:nameable": {
|
||||
"allow_name_tag_renaming": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
{
|
||||
"format_version": "1.21.60",
|
||||
"minecraft:entity": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:decomposer",
|
||||
"is_spawnable": true,
|
||||
"is_summonable": true,
|
||||
"is_experimental": false
|
||||
},
|
||||
"components": {
|
||||
"minecraft:type_family": {
|
||||
"family": [
|
||||
"decomposer",
|
||||
"inanimate"
|
||||
]
|
||||
},
|
||||
"minecraft:health": {
|
||||
"value": 10,
|
||||
"max": 10
|
||||
},
|
||||
"minecraft:physics": {
|
||||
"has_gravity": false,
|
||||
"has_collision": false
|
||||
},
|
||||
"minecraft:collision_box": {
|
||||
"width": 1,
|
||||
"height": 1
|
||||
},
|
||||
"minecraft:custom_hit_test": {
|
||||
"hitboxes": [
|
||||
{
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"pivot": [
|
||||
0,
|
||||
0.5,
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"minecraft:pushable": {
|
||||
"is_pushable": false,
|
||||
"is_pushable_by_piston": false
|
||||
},
|
||||
"minecraft:knockback_resistance": {
|
||||
"value": 1
|
||||
},
|
||||
"minecraft:persistent": {},
|
||||
"minecraft:fire_immune": true,
|
||||
"minecraft:nameable": {
|
||||
"allow_name_tag_renaming": false
|
||||
},
|
||||
"minecraft:damage_sensor": {
|
||||
"triggers": [
|
||||
{
|
||||
"cause": "all",
|
||||
"deals_damage": "no"
|
||||
}
|
||||
]
|
||||
},
|
||||
"minecraft:interact": {
|
||||
"interactions": [
|
||||
{
|
||||
"on_interact": {
|
||||
"filters": {
|
||||
"test": "is_family",
|
||||
"subject": "other",
|
||||
"value": "player"
|
||||
},
|
||||
"event": "rzb_dcs:open"
|
||||
},
|
||||
"swing": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"events": {
|
||||
"rzb_dcs:open": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
{
|
||||
"format_version": "1.21.60",
|
||||
"minecraft:entity": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:decomposer_init",
|
||||
"is_spawnable": true,
|
||||
"is_summonable": true,
|
||||
"is_experimental": false
|
||||
},
|
||||
"components": {
|
||||
"minecraft:physics": {
|
||||
"has_gravity": false,
|
||||
"has_collision": false
|
||||
},
|
||||
"minecraft:collision_box": {
|
||||
"width": 0.1,
|
||||
"height": 0.1
|
||||
},
|
||||
"minecraft:damage_sensor": {
|
||||
"triggers": [
|
||||
{
|
||||
"cause": "all",
|
||||
"deals_damage": "no"
|
||||
}
|
||||
]
|
||||
},
|
||||
"minecraft:nameable": {
|
||||
"allow_name_tag_renaming": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
{
|
||||
"format_version": "1.21.60",
|
||||
"minecraft:item": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:deco_seasons_decomp",
|
||||
"menu_category": {
|
||||
"category": "items",
|
||||
"group": "rzb_dcs:group_decostation"
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"minecraft:icon": {
|
||||
"textures": {
|
||||
"default": "rzb_dcs_deco_seasons_decomp"
|
||||
}
|
||||
},
|
||||
"minecraft:max_stack_size": 16,
|
||||
"minecraft:hand_equipped": true,
|
||||
"minecraft:entity_placer": {
|
||||
"entity": "rzb_dcs:decomposer_init"
|
||||
},
|
||||
"minecraft:display_name": {
|
||||
"value": "item.rzb_dcs:deco_seasons_decomp.name"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
{
|
||||
"format_version": "1.21.60",
|
||||
"minecraft:item": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:seasons_bench",
|
||||
"menu_category": {
|
||||
"category": "items",
|
||||
"group": "rzb_dcs:group_decostation"
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"minecraft:icon": {
|
||||
"textures": {
|
||||
"default": "rzb_dcs_seasons_bench"
|
||||
}
|
||||
},
|
||||
"minecraft:max_stack_size": 16,
|
||||
"minecraft:hand_equipped": true,
|
||||
"minecraft:entity_placer": {
|
||||
"entity": "rzb_dcs:decobench_init"
|
||||
},
|
||||
"minecraft:display_name": {
|
||||
"value": "item.rzb_dcs:seasons_bench.name"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,55 @@
|
||||
// features/stations.js crafting stations placement + removal (1-to-1 with DecoCraft).
|
||||
// Placer item -> minecraft:entity_placer spawns an INVISIBLE _init; on its spawn we grid-align, check clearance + the
|
||||
// 8-block duplicate guard, then summon the real station PRE-ROTATED to the player's look cardinal (one step, no visible
|
||||
// rotation) and remove the init. A blocked placement refunds the item + plays the reject sound. The station is non-solid;
|
||||
// its footprint is invisible full-collision blocks (bench = 2 cells, decomposer = 1). Hitting a station returns the stored
|
||||
// materials + the item (no item in creative, like DecoCraft) and clears the footprint blocks.
|
||||
import { world, ItemStack, isCreative, safeGetBlock } from "../core/mc.js";
|
||||
import { fcCanReplace } from "../core/grid.js";
|
||||
import { dropStored } from "./decostation.js";
|
||||
|
||||
const INIT_TO_STATION = { "rzb_dcs:decobench_init": "rzb_dcs:decobench", "rzb_dcs:decomposer_init": "rzb_dcs:decomposer" };
|
||||
const STATIONS = new Set(["rzb_dcs:decobench", "rzb_dcs:decomposer"]);
|
||||
const ITEM_FOR = { "rzb_dcs:decobench": "rzb_dcs:seasons_bench", "rzb_dcs:decomposer": "rzb_dcs:deco_seasons_decomp" };
|
||||
const FILL = { "rzb_dcs:decobench": "^ ^ ^ ^1 ^ ^", "rzb_dcs:decomposer": "^ ^ ^ ^ ^ ^" }; // 2-cell bench, 1-cell decomposer
|
||||
const TWO_CELL = new Set(["rzb_dcs:decobench"]);
|
||||
|
||||
const leftCell = (yaw) => { const r = yaw * Math.PI / 180; return [Math.round(Math.cos(r)), Math.round(Math.sin(r))]; }; // world offset of the local-left cell (^1)
|
||||
const replaceable = (dim, cx, cy, cz) => { const b = safeGetBlock(dim, { x: cx, y: cy, z: cz }); return !!b && (b.isAir || fcCanReplace(b)); };
|
||||
|
||||
world.afterEvents.entitySpawn?.subscribe((ev) => {
|
||||
const e = ev.entity;
|
||||
const station = INIT_TO_STATION[e?.typeId];
|
||||
if (station) {
|
||||
const dim = e.dimension, l = e.location;
|
||||
const bx = Math.floor(l.x), by = Math.floor(l.y), bz = Math.floor(l.z);
|
||||
let yaw = 180, player; try { player = dim.getPlayers({ location: l, closest: 1, maxDistance: 6 })[0]; if (player) yaw = Math.round(player.getRotation().y / 90) * 90 + 180; } catch {}
|
||||
const cells = [[bx, by, bz]];
|
||||
if (TWO_CELL.has(station)) { const [lx, lz] = leftCell(yaw); cells.push([bx + lx, by, bz + lz]); }
|
||||
const clear = cells.every(([cx, cy, cz]) => replaceable(dim, cx, cy, cz));
|
||||
let dup = false; try { dup = dim.getEntities({ location: l, type: station, maxDistance: 8 }).length > 0; } catch {}
|
||||
if (!clear || dup) { // DecoCraft: refuse -> refund the item + reject sound
|
||||
try { dim.spawnItem(new ItemStack(ITEM_FOR[station], 1), { x: bx + 0.5, y: by + 0.5, z: bz + 0.5 }); } catch {}
|
||||
try { player?.playSound("note.didgeridoo", { volume: 0.8 }); } catch {}
|
||||
try { e.remove(); } catch {}
|
||||
return;
|
||||
}
|
||||
const ht = TWO_CELL.has(station) ? ` rzb_dcs:ht_${((yaw % 360) + 360) % 360}` : ""; // facing-oriented 2-cell hit box (bench only)
|
||||
try { dim.runCommand(`summon ${station} ${bx + 0.5} ${by} ${bz + 0.5} ${yaw} 0${ht}`); } catch {} // pre-rotated
|
||||
try { e.remove(); } catch {}
|
||||
return;
|
||||
}
|
||||
if (STATIONS.has(e?.typeId) && ev.cause !== "Loaded") { // real station placed -> fill its invisible collision footprint
|
||||
try { e.runCommand(`fill ${FILL[e.typeId]} rzb_dcs:invisible_block`); } catch {}
|
||||
}
|
||||
});
|
||||
|
||||
// hit to break -> clear footprint, return stored materials + the item (no item in creative), remove
|
||||
world.afterEvents.entityHitEntity?.subscribe((ev) => {
|
||||
const t = ev.hitEntity; if (!STATIONS.has(t?.typeId)) return;
|
||||
const dmg = ev.damagingEntity; if (dmg?.typeId !== "minecraft:player") return;
|
||||
try { t.runCommand(`fill ${FILL[t.typeId]} air replace rzb_dcs:invisible_block`); } catch {}
|
||||
try { dropStored(t); } catch {}
|
||||
if (!isCreative(dmg)) { try { t.dimension.spawnItem(new ItemStack(ITEM_FOR[t.typeId], 1), t.location); } catch {} }
|
||||
try { t.remove(); } catch {}
|
||||
});
|
||||
@ -0,0 +1,20 @@
|
||||
{
|
||||
"format_version": "1.10.0",
|
||||
"minecraft:client_entity": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:decobench",
|
||||
"materials": {
|
||||
"default": "entity_alphatest"
|
||||
},
|
||||
"geometry": {
|
||||
"default": "geometry.rzb_dcs.decobench"
|
||||
},
|
||||
"textures": {
|
||||
"default": "textures/entity/rzb_dcs/decobench"
|
||||
},
|
||||
"render_controllers": [
|
||||
"controller.render.default"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
{
|
||||
"format_version": "1.10.0",
|
||||
"minecraft:client_entity": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:decobench_init",
|
||||
"materials": {
|
||||
"default": "entity_alphatest"
|
||||
},
|
||||
"geometry": {
|
||||
"default": "geometry.rzb_dcs.blank"
|
||||
},
|
||||
"textures": {
|
||||
"default": "textures/entity/rzb_dcs/decobench"
|
||||
},
|
||||
"render_controllers": [
|
||||
"controller.render.default"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
{
|
||||
"format_version": "1.10.0",
|
||||
"minecraft:client_entity": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:decomposer",
|
||||
"materials": {
|
||||
"default": "entity_alphatest"
|
||||
},
|
||||
"geometry": {
|
||||
"default": "geometry.rzb_dcs.decomposer"
|
||||
},
|
||||
"textures": {
|
||||
"default": "textures/entity/rzb_dcs/decomposer"
|
||||
},
|
||||
"render_controllers": [
|
||||
"controller.render.default"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
{
|
||||
"format_version": "1.10.0",
|
||||
"minecraft:client_entity": {
|
||||
"description": {
|
||||
"identifier": "rzb_dcs:decomposer_init",
|
||||
"materials": {
|
||||
"default": "entity_alphatest"
|
||||
},
|
||||
"geometry": {
|
||||
"default": "geometry.rzb_dcs.blank"
|
||||
},
|
||||
"textures": {
|
||||
"default": "textures/entity/rzb_dcs/decomposer"
|
||||
},
|
||||
"render_controllers": [
|
||||
"controller.render.default"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
{"format_version":"1.16.0","minecraft:geometry":[{"description":{"identifier":"geometry.rzb_dcs.blank","texture_width":16,"texture_height":16},"bones":[{"name":"root","pivot":[0,0,0]}]}]}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
Loading…
Reference in New Issue