Merge pull request #5 from ForestOfLight/dev

v1.0.4
This commit is contained in:
Forest
2025-09-30 12:58:36 -07:00
committed by GitHub
Unverified
14 changed files with 701 additions and 24 deletions
+2 -1
View File
@@ -6,7 +6,7 @@
[![GitHub Downloads](https://img.shields.io/github/downloads/ForestOfLight/Construct/total?label=Github%20downloads&logo=github)](https://github.com/ForestOfLight/Construct/releases) [![GitHub Downloads](https://img.shields.io/github/downloads/ForestOfLight/Construct/total?label=Github%20downloads&logo=github)](https://github.com/ForestOfLight/Construct/releases)
[![Curseforge Downloads](https://cf.way2muchnoise.eu/full_1283139_downloads.svg)](https://www.curseforge.com/minecraft-bedrock/addons/construct) [![Curseforge Downloads](https://cf.way2muchnoise.eu/full_1283139_downloads.svg)](https://www.curseforge.com/minecraft-bedrock/addons/construct)
[![Minecraft - Version](https://img.shields.io/badge/Minecraft-v1.21.100_(Bedrock)-brightgreen)](https://feedback.minecraft.net/hc/en-us/sections/360001186971-Release-Changelogs) [![Minecraft - Version](https://img.shields.io/badge/Minecraft-v1.21.110_(Bedrock)-brightgreen)](https://feedback.minecraft.net/hc/en-us/sections/360001186971-Release-Changelogs)
[![Discord](https://badgen.net/discord/members/9KGche8fxm?icon=discord&label=Discord&list=what)](https://discord.gg/9KGche8fxm) [![Discord](https://badgen.net/discord/members/9KGche8fxm?icon=discord&label=Discord&list=what)](https://discord.gg/9KGche8fxm)
</div> </div>
@@ -70,6 +70,7 @@ Need help, want to discuss technical Minecraft, or follow future updates? [**Joi
- [x] Correct block placement checking - [x] Correct block placement checking
- [x] Automatic material gathering from inventories - [x] Automatic material gathering from inventories
- [x] Material list - [x] Material list
- [x] Flexible structure movement
- [ ] Block texture display - [ ] Block texture display
## Issues & Suggestions ## Issues & Suggestions
+5 -5
View File
@@ -1,11 +1,11 @@
{ {
"format_version": 2, "format_version": 2,
"header": { "header": {
"name": "Construct [BP] v1.0.3", "name": "Construct [BP] v1.0.4",
"description": "Survival building addon by §aForestOfLight§r.", "description": "Survival building addon by §aForestOfLight§r.",
"uuid": "8c0c0153-d8b9-482a-889f-aef922b8fe58", "uuid": "8c0c0153-d8b9-482a-889f-aef922b8fe58",
"min_engine_version": [1, 21, 100], "min_engine_version": [1, 21, 110],
"version": [1, 0, 3] "version": [1, 0, 4]
}, },
"modules": [ "modules": [
{ {
@@ -26,7 +26,7 @@
"dependencies": [ "dependencies": [
{ {
"module_name": "@minecraft/server", "module_name": "@minecraft/server",
"version": "2.2.0-beta" "version": "2.3.0-beta"
}, },
{ {
"module_name": "@minecraft/server-ui", "module_name": "@minecraft/server-ui",
@@ -34,7 +34,7 @@
}, },
{ {
"uuid": "375ec465-3dc1-429f-8b4c-a337889e1ed4", // Construct RP "uuid": "375ec465-3dc1-429f-8b4c-a337889e1ed4", // Construct RP
"version": [1, 0, 3] "version": [1, 0, 4]
} }
], ],
"metadata": { "metadata": {
+483 -2
View File
@@ -45,6 +45,10 @@ export const blocks = {
"up" : "acacia_log_top" "up" : "acacia_log_top"
} }
}, },
"acacia_planks" : {
"sound" : "wood",
"textures" : "acacia_planks"
},
"acacia_pressure_plate" : { "acacia_pressure_plate" : {
"sound" : "wood", "sound" : "wood",
"textures" : "acacia_planks" "textures" : "acacia_planks"
@@ -53,6 +57,10 @@ export const blocks = {
"sound" : "grass", "sound" : "grass",
"textures" : "acacia_sapling" "textures" : "acacia_sapling"
}, },
"acacia_shelf" : {
"sound" : "shelf",
"textures" : "acacia_shelf"
},
"acacia_slab" : { "acacia_slab" : {
"sound" : "wood", "sound" : "wood",
"textures" : "acacia_planks" "textures" : "acacia_planks"
@@ -253,6 +261,10 @@ export const blocks = {
"sound" : "bamboo_sapling", "sound" : "bamboo_sapling",
"textures" : "bamboo_sapling" "textures" : "bamboo_sapling"
}, },
"bamboo_shelf" : {
"sound" : "shelf",
"textures" : "bamboo_shelf"
},
"bamboo_slab" : { "bamboo_slab" : {
"sound" : "bamboo_wood", "sound" : "bamboo_wood",
"textures" : "bamboo_planks" "textures" : "bamboo_planks"
@@ -404,6 +416,10 @@ export const blocks = {
"up" : "birch_log_top" "up" : "birch_log_top"
} }
}, },
"birch_planks" : {
"sound" : "wood",
"textures" : "birch_planks"
},
"birch_pressure_plate" : { "birch_pressure_plate" : {
"sound" : "wood", "sound" : "wood",
"textures" : "birch_planks" "textures" : "birch_planks"
@@ -412,6 +428,10 @@ export const blocks = {
"sound" : "grass", "sound" : "grass",
"textures" : "birch_sapling" "textures" : "birch_sapling"
}, },
"birch_shelf" : {
"sound" : "shelf",
"textures" : "birch_shelf"
},
"birch_slab" : { "birch_slab" : {
"sound" : "wood", "sound" : "wood",
"textures" : "birch_planks" "textures" : "birch_planks"
@@ -930,6 +950,7 @@ export const blocks = {
} }
}, },
"chain" : { "chain" : {
"carried_textures" : "chain_carried",
"sound" : "chain", "sound" : "chain",
"textures" : { "textures" : {
"down" : "chain1", "down" : "chain1",
@@ -1001,6 +1022,10 @@ export const blocks = {
"sound" : "bamboo_sapling", "sound" : "bamboo_sapling",
"textures" : "cherry_sapling" "textures" : "cherry_sapling"
}, },
"cherry_shelf" : {
"sound" : "shelf",
"textures" : "cherry_shelf"
},
"cherry_slab" : { "cherry_slab" : {
"sound" : "cherry_wood", "sound" : "cherry_wood",
"textures" : "cherry_planks" "textures" : "cherry_planks"
@@ -1236,6 +1261,10 @@ export const blocks = {
"sound" : "stone", "sound" : "stone",
"textures" : "conduit" "textures" : "conduit"
}, },
"copper_bars" : {
"sound" : "copper",
"textures" : "copper_bars"
},
"copper_block" : { "copper_block" : {
"isotropic" : false, "isotropic" : false,
"sound" : "copper", "sound" : "copper",
@@ -1246,6 +1275,27 @@ export const blocks = {
"sound" : "copper_bulb", "sound" : "copper_bulb",
"textures" : "copper_bulb" "textures" : "copper_bulb"
}, },
"copper_chain" : {
"carried_textures" : "copper_chain_carried",
"sound" : "chain",
"textures" : {
"down" : "copper_chain1",
"side" : "copper_chain2",
"up" : "copper_chain1"
}
},
"copper_chest" : {
"isotropic" : false,
"sound" : "copper_chest",
"textures" : {
"down" : "copper_chest_inventory_top",
"east" : "copper_chest_inventory_side",
"north" : "copper_chest_inventory_side",
"south" : "copper_chest_inventory_front",
"up" : "copper_chest_inventory_top",
"west" : "copper_chest_inventory_side"
}
},
"copper_door" : { "copper_door" : {
"sound" : "copper", "sound" : "copper",
"textures" : { "textures" : {
@@ -1254,15 +1304,28 @@ export const blocks = {
"up" : "copper_door_bottom" "up" : "copper_door_bottom"
} }
}, },
"copper_golem_statue" : {
"sound" : "copper_golem_statue",
"textures" : "copper_block"
},
"copper_grate" : { "copper_grate" : {
"sound" : "copper_grate", "sound" : "copper_grate",
"textures" : "copper_grate" "textures" : "copper_grate"
}, },
"copper_lantern" : {
"carried_textures" : "copper_lantern_carried",
"sound" : "lantern",
"textures" : "copper_lantern"
},
"copper_ore" : { "copper_ore" : {
"isotropic" : false, "isotropic" : false,
"sound" : "stone", "sound" : "stone",
"textures" : "copper_ore" "textures" : "copper_ore"
}, },
"copper_torch" : {
"sound" : "wood",
"textures" : "copper_torch"
},
"copper_trapdoor" : { "copper_trapdoor" : {
"sound" : "copper", "sound" : "copper",
"textures" : "copper_trapdoor" "textures" : "copper_trapdoor"
@@ -1458,6 +1521,10 @@ export const blocks = {
"west" : "crimson_roots" "west" : "crimson_roots"
} }
}, },
"crimson_shelf" : {
"sound" : "shelf",
"textures" : "crimson_shelf"
},
"crimson_slab" : { "crimson_slab" : {
"sound" : "nether_wood", "sound" : "nether_wood",
"textures" : "crimson_planks" "textures" : "crimson_planks"
@@ -1523,6 +1590,14 @@ export const blocks = {
"up" : "flattened_redsandstone_top" "up" : "flattened_redsandstone_top"
} }
}, },
"cut_red_sandstone_double_slab" : {
"sound" : "stone",
"textures" : {
"down" : "cut_red_sandstone_slab_top",
"side" : "cut_red_sandstone_slab_side",
"up" : "cut_red_sandstone_slab_top"
}
},
"cut_red_sandstone_slab" : { "cut_red_sandstone_slab" : {
"sound" : "stone", "sound" : "stone",
"textures" : { "textures" : {
@@ -1544,6 +1619,14 @@ export const blocks = {
"up" : "flattened_sandstone_top" "up" : "flattened_sandstone_top"
} }
}, },
"cut_sandstone_double_slab" : {
"sound" : "stone",
"textures" : {
"down" : "cut_sandstone_slab_top",
"side" : "cut_sandstone_slab_side",
"up" : "cut_sandstone_slab_top"
}
},
"cut_sandstone_slab" : { "cut_sandstone_slab" : {
"sound" : "stone", "sound" : "stone",
"textures" : { "textures" : {
@@ -1669,6 +1752,10 @@ export const blocks = {
"up" : "dark_oak_log_top" "up" : "dark_oak_log_top"
} }
}, },
"dark_oak_planks" : {
"sound" : "wood",
"textures" : "dark_oak_planks"
},
"dark_oak_pressure_plate" : { "dark_oak_pressure_plate" : {
"sound" : "wood", "sound" : "wood",
"textures" : "dark_oak_planks" "textures" : "dark_oak_planks"
@@ -1677,6 +1764,10 @@ export const blocks = {
"sound" : "grass", "sound" : "grass",
"textures" : "dark_oak_sapling" "textures" : "dark_oak_sapling"
}, },
"dark_oak_shelf" : {
"sound" : "shelf",
"textures" : "dark_oak_shelf"
},
"dark_oak_slab" : { "dark_oak_slab" : {
"sound" : "wood", "sound" : "wood",
"textures" : "dark_oak_planks" "textures" : "dark_oak_planks"
@@ -2232,11 +2323,36 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "exposed_copper" "textures" : "exposed_copper"
}, },
"exposed_copper_bars" : {
"sound" : "copper",
"textures" : "exposed_copper_bars"
},
"exposed_copper_bulb" : { "exposed_copper_bulb" : {
"isotropic" : false, "isotropic" : false,
"sound" : "copper_bulb", "sound" : "copper_bulb",
"textures" : "exposed_copper_bulb" "textures" : "exposed_copper_bulb"
}, },
"exposed_copper_chain" : {
"carried_textures" : "exposed_copper_chain_carried",
"sound" : "chain",
"textures" : {
"down" : "exposed_copper_chain1",
"side" : "exposed_copper_chain2",
"up" : "exposed_copper_chain1"
}
},
"exposed_copper_chest" : {
"isotropic" : false,
"sound" : "copper_chest",
"textures" : {
"down" : "exposed_copper_chest_inventory_top",
"east" : "exposed_copper_chest_inventory_side",
"north" : "exposed_copper_chest_inventory_side",
"south" : "exposed_copper_chest_inventory_front",
"up" : "exposed_copper_chest_inventory_top",
"west" : "exposed_copper_chest_inventory_side"
}
},
"exposed_copper_door" : { "exposed_copper_door" : {
"sound" : "copper", "sound" : "copper",
"textures" : { "textures" : {
@@ -2245,10 +2361,19 @@ export const blocks = {
"up" : "exposed_copper_door_bottom" "up" : "exposed_copper_door_bottom"
} }
}, },
"exposed_copper_golem_statue" : {
"sound" : "copper_golem_statue",
"textures" : "exposed_copper"
},
"exposed_copper_grate" : { "exposed_copper_grate" : {
"sound" : "copper_grate", "sound" : "copper_grate",
"textures" : "exposed_copper_grate" "textures" : "exposed_copper_grate"
}, },
"exposed_copper_lantern" : {
"carried_textures" : "exposed_copper_lantern_carried",
"sound" : "lantern",
"textures" : "exposed_copper_lantern"
},
"exposed_copper_trapdoor" : { "exposed_copper_trapdoor" : {
"sound" : "copper", "sound" : "copper",
"textures" : "exposed_copper_trapdoor" "textures" : "exposed_copper_trapdoor"
@@ -2273,6 +2398,11 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "exposed_cut_copper" "textures" : "exposed_cut_copper"
}, },
"exposed_lightning_rod" : {
"isotropic" : false,
"sound" : "copper",
"textures" : "exposed_lightning_rod"
},
"farmland" : { "farmland" : {
"sound" : "gravel", "sound" : "gravel",
"textures" : { "textures" : {
@@ -2849,6 +2979,10 @@ export const blocks = {
"up" : "jungle_log_top" "up" : "jungle_log_top"
} }
}, },
"jungle_planks" : {
"sound" : "wood",
"textures" : "jungle_planks"
},
"jungle_pressure_plate" : { "jungle_pressure_plate" : {
"sound" : "wood", "sound" : "wood",
"textures" : "jungle_planks" "textures" : "jungle_planks"
@@ -2857,6 +2991,10 @@ export const blocks = {
"sound" : "grass", "sound" : "grass",
"textures" : "jungle_sapling" "textures" : "jungle_sapling"
}, },
"jungle_shelf" : {
"sound" : "shelf",
"textures" : "jungle_shelf"
},
"jungle_slab" : { "jungle_slab" : {
"sound" : "wood", "sound" : "wood",
"textures" : "jungle_planks" "textures" : "jungle_planks"
@@ -3475,6 +3613,10 @@ export const blocks = {
"west" : "mangrove_roots_side" "west" : "mangrove_roots_side"
} }
}, },
"mangrove_shelf" : {
"sound" : "shelf",
"textures" : "mangrove_shelf"
},
"mangrove_slab" : { "mangrove_slab" : {
"sound" : "wood", "sound" : "wood",
"textures" : "mangrove_planks" "textures" : "mangrove_planks"
@@ -3550,6 +3692,10 @@ export const blocks = {
"sound" : "stone", "sound" : "stone",
"textures" : "mossy_cobblestone_wall" "textures" : "mossy_cobblestone_wall"
}, },
"mossy_stone_brick_double_slab" : {
"sound" : "stone",
"textures" : "mossy_stone_brick_slab"
},
"mossy_stone_brick_slab" : { "mossy_stone_brick_slab" : {
"sound" : "stone", "sound" : "stone",
"textures" : "mossy_stone_brick_slab" "textures" : "mossy_stone_brick_slab"
@@ -3685,6 +3831,10 @@ export const blocks = {
"sound" : "metal", "sound" : "metal",
"textures" : "reactor_core" "textures" : "reactor_core"
}, },
"normal_stone_double_slab" : {
"sound" : "stone",
"textures" : "normal_stone_slab"
},
"normal_stone_slab" : { "normal_stone_slab" : {
"sound" : "stone", "sound" : "stone",
"textures" : "normal_stone_slab" "textures" : "normal_stone_slab"
@@ -3727,10 +3877,18 @@ export const blocks = {
"up" : "oak_log_top" "up" : "oak_log_top"
} }
}, },
"oak_planks" : {
"sound" : "wood",
"textures" : "oak_planks"
},
"oak_sapling" : { "oak_sapling" : {
"sound" : "grass", "sound" : "grass",
"textures" : "oak_sapling" "textures" : "oak_sapling"
}, },
"oak_shelf" : {
"sound" : "shelf",
"textures" : "oak_shelf"
},
"oak_slab" : { "oak_slab" : {
"sound" : "wood", "sound" : "wood",
"textures" : "oak_planks" "textures" : "oak_planks"
@@ -3850,11 +4008,36 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "oxidized_copper" "textures" : "oxidized_copper"
}, },
"oxidized_copper_bars" : {
"sound" : "copper",
"textures" : "oxidized_copper_bars"
},
"oxidized_copper_bulb" : { "oxidized_copper_bulb" : {
"isotropic" : false, "isotropic" : false,
"sound" : "copper_bulb", "sound" : "copper_bulb",
"textures" : "oxidized_copper_bulb" "textures" : "oxidized_copper_bulb"
}, },
"oxidized_copper_chain" : {
"carried_textures" : "oxidized_copper_chain_carried",
"sound" : "chain",
"textures" : {
"down" : "oxidized_copper_chain1",
"side" : "oxidized_copper_chain2",
"up" : "oxidized_copper_chain1"
}
},
"oxidized_copper_chest" : {
"isotropic" : false,
"sound" : "copper_chest_oxidized",
"textures" : {
"down" : "oxidized_copper_chest_inventory_top",
"east" : "oxidized_copper_chest_inventory_side",
"north" : "oxidized_copper_chest_inventory_side",
"south" : "oxidized_copper_chest_inventory_front",
"up" : "oxidized_copper_chest_inventory_top",
"west" : "oxidized_copper_chest_inventory_side"
}
},
"oxidized_copper_door" : { "oxidized_copper_door" : {
"sound" : "copper", "sound" : "copper",
"textures" : { "textures" : {
@@ -3863,10 +4046,19 @@ export const blocks = {
"up" : "oxidized_copper_door_bottom" "up" : "oxidized_copper_door_bottom"
} }
}, },
"oxidized_copper_golem_statue" : {
"sound" : "copper_golem_statue",
"textures" : "oxidized_copper"
},
"oxidized_copper_grate" : { "oxidized_copper_grate" : {
"sound" : "copper_grate", "sound" : "copper_grate",
"textures" : "oxidized_copper_grate" "textures" : "oxidized_copper_grate"
}, },
"oxidized_copper_lantern" : {
"carried_textures" : "oxidized_copper_lantern_carried",
"sound" : "lantern",
"textures" : "oxidized_copper_lantern"
},
"oxidized_copper_trapdoor" : { "oxidized_copper_trapdoor" : {
"sound" : "copper", "sound" : "copper",
"textures" : "oxidized_copper_trapdoor" "textures" : "oxidized_copper_trapdoor"
@@ -3891,6 +4083,11 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "oxidized_cut_copper" "textures" : "oxidized_cut_copper"
}, },
"oxidized_lightning_rod" : {
"isotropic" : false,
"sound" : "copper",
"textures" : "oxidized_lightning_rod"
},
"packed_ice" : { "packed_ice" : {
"sound" : "glass", "sound" : "glass",
"textures" : "ice_packed" "textures" : "ice_packed"
@@ -3965,6 +4162,10 @@ export const blocks = {
"sound" : "grass", "sound" : "grass",
"textures" : "pale_oak_sapling" "textures" : "pale_oak_sapling"
}, },
"pale_oak_shelf" : {
"sound" : "shelf",
"textures" : "pale_oak_shelf"
},
"pale_oak_slab" : { "pale_oak_slab" : {
"sound" : "wood", "sound" : "wood",
"textures" : "pale_oak_planks" "textures" : "pale_oak_planks"
@@ -4992,6 +5193,10 @@ export const blocks = {
"sound" : "stone", "sound" : "stone",
"textures" : "smooth_quartz" "textures" : "smooth_quartz"
}, },
"smooth_quartz_double_slab" : {
"sound" : "stone",
"textures" : "smooth_quartz_slab"
},
"smooth_quartz_slab" : { "smooth_quartz_slab" : {
"sound" : "stone", "sound" : "stone",
"textures" : "smooth_quartz_slab" "textures" : "smooth_quartz_slab"
@@ -5189,6 +5394,10 @@ export const blocks = {
"up" : "spruce_log_top" "up" : "spruce_log_top"
} }
}, },
"spruce_planks" : {
"sound" : "wood",
"textures" : "spruce_planks"
},
"spruce_pressure_plate" : { "spruce_pressure_plate" : {
"sound" : "wood", "sound" : "wood",
"textures" : "spruce_planks" "textures" : "spruce_planks"
@@ -5197,6 +5406,10 @@ export const blocks = {
"sound" : "grass", "sound" : "grass",
"textures" : "spruce_sapling" "textures" : "spruce_sapling"
}, },
"spruce_shelf" : {
"sound" : "shelf",
"textures" : "spruce_shelf"
},
"spruce_slab" : { "spruce_slab" : {
"sound" : "wood", "sound" : "wood",
"textures" : "spruce_planks" "textures" : "spruce_planks"
@@ -5858,6 +6071,10 @@ export const blocks = {
"west" : "warped_roots" "west" : "warped_roots"
} }
}, },
"warped_shelf" : {
"sound" : "shelf",
"textures" : "warped_shelf"
},
"warped_slab" : { "warped_slab" : {
"sound" : "nether_wood", "sound" : "nether_wood",
"textures" : "warped_planks" "textures" : "warped_planks"
@@ -5914,11 +6131,36 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "copper_block" "textures" : "copper_block"
}, },
"waxed_copper_bars" : {
"sound" : "copper",
"textures" : "copper_bars"
},
"waxed_copper_bulb" : { "waxed_copper_bulb" : {
"isotropic" : false, "isotropic" : false,
"sound" : "copper_bulb", "sound" : "copper_bulb",
"textures" : "copper_bulb" "textures" : "copper_bulb"
}, },
"waxed_copper_chain" : {
"carried_textures" : "copper_chain_carried",
"sound" : "chain",
"textures" : {
"down" : "copper_chain1",
"side" : "copper_chain2",
"up" : "copper_chain1"
}
},
"waxed_copper_chest" : {
"isotropic" : false,
"sound" : "copper_chest",
"textures" : {
"down" : "copper_chest_inventory_top",
"east" : "copper_chest_inventory_side",
"north" : "copper_chest_inventory_side",
"south" : "copper_chest_inventory_front",
"up" : "copper_chest_inventory_top",
"west" : "copper_chest_inventory_side"
}
},
"waxed_copper_door" : { "waxed_copper_door" : {
"sound" : "copper", "sound" : "copper",
"textures" : { "textures" : {
@@ -5927,10 +6169,19 @@ export const blocks = {
"up" : "copper_door_bottom" "up" : "copper_door_bottom"
} }
}, },
"waxed_copper_golem_statue" : {
"sound" : "copper_golem_statue",
"textures" : "copper_block"
},
"waxed_copper_grate" : { "waxed_copper_grate" : {
"sound" : "copper_grate", "sound" : "copper_grate",
"textures" : "copper_grate" "textures" : "copper_grate"
}, },
"waxed_copper_lantern" : {
"carried_textures" : "copper_lantern_carried",
"sound" : "lantern",
"textures" : "copper_lantern"
},
"waxed_copper_trapdoor" : { "waxed_copper_trapdoor" : {
"sound" : "copper", "sound" : "copper",
"textures" : "copper_trapdoor" "textures" : "copper_trapdoor"
@@ -5964,11 +6215,36 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "exposed_copper" "textures" : "exposed_copper"
}, },
"waxed_exposed_copper_bars" : {
"sound" : "copper",
"textures" : "exposed_copper_bars"
},
"waxed_exposed_copper_bulb" : { "waxed_exposed_copper_bulb" : {
"isotropic" : false, "isotropic" : false,
"sound" : "copper_bulb", "sound" : "copper_bulb",
"textures" : "exposed_copper_bulb" "textures" : "exposed_copper_bulb"
}, },
"waxed_exposed_copper_chain" : {
"carried_textures" : "exposed_copper_chain_carried",
"sound" : "chain",
"textures" : {
"down" : "exposed_copper_chain1",
"side" : "exposed_copper_chain2",
"up" : "exposed_copper_chain1"
}
},
"waxed_exposed_copper_chest" : {
"isotropic" : false,
"sound" : "copper_chest",
"textures" : {
"down" : "exposed_copper_chest_inventory_top",
"east" : "exposed_copper_chest_inventory_side",
"north" : "exposed_copper_chest_inventory_side",
"south" : "exposed_copper_chest_inventory_front",
"up" : "exposed_copper_chest_inventory_top",
"west" : "exposed_copper_chest_inventory_side"
}
},
"waxed_exposed_copper_door" : { "waxed_exposed_copper_door" : {
"sound" : "copper", "sound" : "copper",
"textures" : { "textures" : {
@@ -5977,10 +6253,19 @@ export const blocks = {
"up" : "exposed_copper_door_bottom" "up" : "exposed_copper_door_bottom"
} }
}, },
"waxed_exposed_copper_golem_statue" : {
"sound" : "copper_golem_statue",
"textures" : "exposed_copper"
},
"waxed_exposed_copper_grate" : { "waxed_exposed_copper_grate" : {
"sound" : "copper_grate", "sound" : "copper_grate",
"textures" : "exposed_copper_grate" "textures" : "exposed_copper_grate"
}, },
"waxed_exposed_copper_lantern" : {
"carried_textures" : "exposed_copper_lantern_carried",
"sound" : "lantern",
"textures" : "exposed_copper_lantern"
},
"waxed_exposed_copper_trapdoor" : { "waxed_exposed_copper_trapdoor" : {
"sound" : "copper", "sound" : "copper",
"textures" : "exposed_copper_trapdoor" "textures" : "exposed_copper_trapdoor"
@@ -6005,6 +6290,16 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "exposed_cut_copper" "textures" : "exposed_cut_copper"
}, },
"waxed_exposed_lightning_rod" : {
"isotropic" : false,
"sound" : "copper",
"textures" : "exposed_lightning_rod"
},
"waxed_lightning_rod" : {
"isotropic" : false,
"sound" : "copper",
"textures" : "lightning_rod"
},
"waxed_oxidized_chiseled_copper" : { "waxed_oxidized_chiseled_copper" : {
"sound" : "copper", "sound" : "copper",
"textures" : "oxidized_chiseled_copper" "textures" : "oxidized_chiseled_copper"
@@ -6014,11 +6309,36 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "oxidized_copper" "textures" : "oxidized_copper"
}, },
"waxed_oxidized_copper_bars" : {
"sound" : "copper",
"textures" : "oxidized_copper_bars"
},
"waxed_oxidized_copper_bulb" : { "waxed_oxidized_copper_bulb" : {
"isotropic" : false, "isotropic" : false,
"sound" : "copper_bulb", "sound" : "copper_bulb",
"textures" : "oxidized_copper_bulb" "textures" : "oxidized_copper_bulb"
}, },
"waxed_oxidized_copper_chain" : {
"carried_textures" : "oxidized_copper_chain_carried",
"sound" : "chain",
"textures" : {
"down" : "oxidized_copper_chain1",
"side" : "oxidized_copper_chain2",
"up" : "oxidized_copper_chain1"
}
},
"waxed_oxidized_copper_chest" : {
"isotropic" : false,
"sound" : "copper_chest_oxidized",
"textures" : {
"down" : "oxidized_copper_chest_inventory_top",
"east" : "oxidized_copper_chest_inventory_side",
"north" : "oxidized_copper_chest_inventory_side",
"south" : "oxidized_copper_chest_inventory_front",
"up" : "oxidized_copper_chest_inventory_top",
"west" : "oxidized_copper_chest_inventory_side"
}
},
"waxed_oxidized_copper_door" : { "waxed_oxidized_copper_door" : {
"sound" : "copper", "sound" : "copper",
"textures" : { "textures" : {
@@ -6027,10 +6347,19 @@ export const blocks = {
"up" : "oxidized_copper_door_bottom" "up" : "oxidized_copper_door_bottom"
} }
}, },
"waxed_oxidized_copper_golem_statue" : {
"sound" : "copper_golem_statue",
"textures" : "oxidized_copper"
},
"waxed_oxidized_copper_grate" : { "waxed_oxidized_copper_grate" : {
"sound" : "copper_grate", "sound" : "copper_grate",
"textures" : "oxidized_copper_grate" "textures" : "oxidized_copper_grate"
}, },
"waxed_oxidized_copper_lantern" : {
"carried_textures" : "oxidized_copper_lantern_carried",
"sound" : "lantern",
"textures" : "oxidized_copper_lantern"
},
"waxed_oxidized_copper_trapdoor" : { "waxed_oxidized_copper_trapdoor" : {
"sound" : "copper", "sound" : "copper",
"textures" : "oxidized_copper_trapdoor" "textures" : "oxidized_copper_trapdoor"
@@ -6055,6 +6384,11 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "oxidized_cut_copper" "textures" : "oxidized_cut_copper"
}, },
"waxed_oxidized_lightning_rod" : {
"isotropic" : false,
"sound" : "copper",
"textures" : "oxidized_lightning_rod"
},
"waxed_weathered_chiseled_copper" : { "waxed_weathered_chiseled_copper" : {
"sound" : "copper", "sound" : "copper",
"textures" : "weathered_chiseled_copper" "textures" : "weathered_chiseled_copper"
@@ -6064,11 +6398,36 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "weathered_copper" "textures" : "weathered_copper"
}, },
"waxed_weathered_copper_bars" : {
"sound" : "copper",
"textures" : "weathered_copper_bars"
},
"waxed_weathered_copper_bulb" : { "waxed_weathered_copper_bulb" : {
"isotropic" : false, "isotropic" : false,
"sound" : "copper_bulb", "sound" : "copper_bulb",
"textures" : "weathered_copper_bulb" "textures" : "weathered_copper_bulb"
}, },
"waxed_weathered_copper_chain" : {
"carried_textures" : "weathered_copper_chain_carried",
"sound" : "chain",
"textures" : {
"down" : "weathered_copper_chain1",
"side" : "weathered_copper_chain2",
"up" : "weathered_copper_chain1"
}
},
"waxed_weathered_copper_chest" : {
"isotropic" : false,
"sound" : "copper_chest_weathered",
"textures" : {
"down" : "weathered_copper_chest_inventory_top",
"east" : "weathered_copper_chest_inventory_side",
"north" : "weathered_copper_chest_inventory_side",
"south" : "weathered_copper_chest_inventory_front",
"up" : "weathered_copper_chest_inventory_top",
"west" : "weathered_copper_chest_inventory_side"
}
},
"waxed_weathered_copper_door" : { "waxed_weathered_copper_door" : {
"sound" : "copper", "sound" : "copper",
"textures" : { "textures" : {
@@ -6077,10 +6436,19 @@ export const blocks = {
"up" : "weathered_copper_door_bottom" "up" : "weathered_copper_door_bottom"
} }
}, },
"waxed_weathered_copper_golem_statue" : {
"sound" : "copper_golem_statue",
"textures" : "weathered_copper"
},
"waxed_weathered_copper_grate" : { "waxed_weathered_copper_grate" : {
"sound" : "copper_grate", "sound" : "copper_grate",
"textures" : "weathered_copper_grate" "textures" : "weathered_copper_grate"
}, },
"waxed_weathered_copper_lantern" : {
"carried_textures" : "weathered_copper_lantern_carried",
"sound" : "lantern",
"textures" : "weathered_copper_lantern"
},
"waxed_weathered_copper_trapdoor" : { "waxed_weathered_copper_trapdoor" : {
"sound" : "copper", "sound" : "copper",
"textures" : "weathered_copper_trapdoor" "textures" : "weathered_copper_trapdoor"
@@ -6105,6 +6473,11 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "weathered_cut_copper" "textures" : "weathered_cut_copper"
}, },
"waxed_weathered_lightning_rod" : {
"isotropic" : false,
"sound" : "copper",
"textures" : "weathered_lightning_rod"
},
"weathered_chiseled_copper" : { "weathered_chiseled_copper" : {
"sound" : "copper", "sound" : "copper",
"textures" : "weathered_chiseled_copper" "textures" : "weathered_chiseled_copper"
@@ -6114,11 +6487,36 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "weathered_copper" "textures" : "weathered_copper"
}, },
"weathered_copper_bars" : {
"sound" : "copper",
"textures" : "weathered_copper_bars"
},
"weathered_copper_bulb" : { "weathered_copper_bulb" : {
"isotropic" : false, "isotropic" : false,
"sound" : "copper_bulb", "sound" : "copper_bulb",
"textures" : "weathered_copper_bulb" "textures" : "weathered_copper_bulb"
}, },
"weathered_copper_chain" : {
"carried_textures" : "weathered_copper_chain_carried",
"sound" : "chain",
"textures" : {
"down" : "weathered_copper_chain1",
"side" : "weathered_copper_chain2",
"up" : "weathered_copper_chain1"
}
},
"weathered_copper_chest" : {
"isotropic" : false,
"sound" : "copper_chest_weathered",
"textures" : {
"down" : "weathered_copper_chest_inventory_top",
"east" : "weathered_copper_chest_inventory_side",
"north" : "weathered_copper_chest_inventory_side",
"south" : "weathered_copper_chest_inventory_front",
"up" : "weathered_copper_chest_inventory_top",
"west" : "weathered_copper_chest_inventory_side"
}
},
"weathered_copper_door" : { "weathered_copper_door" : {
"sound" : "copper", "sound" : "copper",
"textures" : { "textures" : {
@@ -6127,10 +6525,19 @@ export const blocks = {
"up" : "weathered_copper_door_bottom" "up" : "weathered_copper_door_bottom"
} }
}, },
"weathered_copper_golem_statue" : {
"sound" : "copper_golem_statue",
"textures" : "weathered_copper"
},
"weathered_copper_grate" : { "weathered_copper_grate" : {
"sound" : "copper_grate", "sound" : "copper_grate",
"textures" : "weathered_copper_grate" "textures" : "weathered_copper_grate"
}, },
"weathered_copper_lantern" : {
"carried_textures" : "weathered_copper_lantern_carried",
"sound" : "lantern",
"textures" : "weathered_copper_lantern"
},
"weathered_copper_trapdoor" : { "weathered_copper_trapdoor" : {
"sound" : "copper", "sound" : "copper",
"textures" : "weathered_copper_trapdoor" "textures" : "weathered_copper_trapdoor"
@@ -6155,6 +6562,11 @@ export const blocks = {
"sound" : "copper", "sound" : "copper",
"textures" : "weathered_cut_copper" "textures" : "weathered_cut_copper"
}, },
"weathered_lightning_rod" : {
"isotropic" : false,
"sound" : "copper",
"textures" : "weathered_lightning_rod"
},
"web" : { "web" : {
"sound" : "web", "sound" : "web",
"textures" : "web" "textures" : "web"
@@ -6350,7 +6762,7 @@ export const blocks = {
"sound" : "stone", "sound" : "stone",
"textures" : "skull" "textures" : "skull"
} }
} };
export const block_sounds = { export const block_sounds = {
"amethyst_block" : { "amethyst_block" : {
@@ -7263,6 +7675,62 @@ export const block_sounds = {
"pitch" : 1.0, "pitch" : 1.0,
"volume" : 1.0 "volume" : 1.0
}, },
"copper_chest" : {
"base" : "copper",
"events" : {
"chest.closed" : {
"pitch" : [ 0.90, 1.0 ],
"sound" : "block.copper_chest.closed"
},
"chest.open" : {
"pitch" : [ 0.90, 1.0 ],
"sound" : "block.copper_chest.open"
}
},
"pitch" : 1.0,
"volume" : 1.0
},
"copper_chest_oxidized" : {
"base" : "copper",
"events" : {
"chest.closed" : {
"pitch" : [ 0.90, 1.0 ],
"sound" : "block.copper_chest.oxidized.closed"
},
"chest.open" : {
"pitch" : [ 0.90, 1.0 ],
"sound" : "block.copper_chest.oxidized.open"
}
},
"pitch" : 1.0,
"volume" : 1.0
},
"copper_chest_weathered" : {
"base" : "copper",
"events" : {
"chest.closed" : {
"pitch" : [ 0.90, 1.0 ],
"sound" : "block.copper_chest.weathered.closed"
},
"chest.open" : {
"pitch" : [ 0.90, 1.0 ],
"sound" : "block.copper_chest.weathered.open"
}
},
"pitch" : 1.0,
"volume" : 1.0
},
"copper_golem_statue" : {
"base" : "copper",
"events" : {
"activate" : "mob.copper_golem.becoming_statue",
"break" : "block.copper_golem_statue.break",
"hit" : "block.copper_golem_statue.hit",
"place" : "block.copper_golem_statue.place"
},
"pitch" : 1.0,
"volume" : 1.0
},
"copper_grate" : { "copper_grate" : {
"events" : { "events" : {
"break" : { "break" : {
@@ -9235,6 +9703,19 @@ export const block_sounds = {
} }
} }
}, },
"shelf" : {
"base" : "chiseled_bookshelf",
"events" : {
"activate" : "block.shelf.activate",
"break" : "block.shelf.break",
"deactivate" : "block.shelf.deactivate",
"multi_swap" : "block.shelf.multi_swap",
"place_item" : "block.shelf.place_item",
"single_swap" : "block.shelf.single_swap"
},
"pitch" : 1.0,
"volume" : 1.0
},
"shroomlight" : { "shroomlight" : {
"events" : { "events" : {
"break" : { "break" : {
@@ -10010,4 +10491,4 @@ export const block_sounds = {
"pitch" : 1.0, "pitch" : 1.0,
"volume" : 1.0 "volume" : 1.0
} }
} };
@@ -3,6 +3,7 @@ import { BuilderOptions } from "./BuilderOptions";
export class Builder { export class Builder {
playerId; playerId;
materialInstanceName = void 0; materialInstanceName = void 0;
flexibleInstanceMovement = void 0;
constructor(playerId) { constructor(playerId) {
this.playerId = playerId; this.playerId = playerId;
@@ -15,4 +16,8 @@ export class Builder {
setOption(optionId, value) { setOption(optionId, value) {
return BuilderOptions.setValue(optionId, this.playerId, value); return BuilderOptions.setValue(optionId, this.playerId, value);
} }
isFlexibleInstanceMoving() {
return this.flexibleInstanceMovement !== void 0;
}
} }
@@ -9,6 +9,7 @@ export const InstanceButtons = Object.freeze({
NextLayer: 'Increase Layer', NextLayer: 'Increase Layer',
PreviousLayer: 'Decrease Layer', PreviousLayer: 'Decrease Layer',
Move: 'Move Here', Move: 'Move Here',
FlexibleMove: 'Flexible Move',
Statistics: 'Statistics', Statistics: 'Statistics',
Settings: 'Settings', Settings: 'Settings',
Materials: 'Material List' Materials: 'Material List'
@@ -0,0 +1,123 @@
import { InputPermissionCategory, world, system } from "@minecraft/server";
import { Outliner } from "../Outliner";
import { MENU_ITEM } from "../../commands/construct";
import { Vector } from "../../lib/Vector";
import { PlayerMovement } from "../PlayerMovement";
import { Builders } from "../Builder/Builders";
export class FlexibleInstanceMove {
player;
instance;
outliner;
currentInstanceLocation;
runner = void 0;
constructor(instance, player) {
this.instance = instance;
this.player = player;
this.currentInstanceLocation = Vector.from(instance.getLocation().location);
this.onPlayerUseItemBound = this.onPlayerUseItem.bind(this);
this.onPlayerLeaveBound = this.onPlayerLeave.bind(this);
this.tryStart();
}
tryStart() {
if (this.instance.isFlexibleMoving()) {
this.sendFeedback('§cThis instance is already being moved.');
return;
}
this.start();
}
start() {
this.prepInstanceForMovement();
this.prepPlayerForMovement();
this.runner = system.runInterval(this.onFlexibleMovementTick.bind(this));
}
prepInstanceForMovement() {
this.instance.flexMovingPlayerId = this.player.id;
this.instance.disable();
const bounds = this.instance.getBounds();
const maxWorldLocation = this.currentInstanceLocation.add(Vector.from(bounds.max));
this.outliner = new Outliner(this.instance.getDimension(), this.currentInstanceLocation, maxWorldLocation, 1, 1);
this.outliner.startDraw();
}
prepPlayerForMovement() {
this.allowPlayerMovement(false);
world.beforeEvents.itemUse.subscribe(this.onPlayerUseItemBound);
world.beforeEvents.playerLeave.unsubscribe(this.onPlayerLeaveBound);
this.sendFeedback(`§aNow moving "${this.instance.getName()}". Use the Construct item when finished.`);
}
onFlexibleMovementTick() {
const playerMovement = new PlayerMovement(this.player);
const instanceVelocity = this.calculateInstanceMovement(playerMovement);
this.move(instanceVelocity);
}
calculateInstanceMovement(playerMovement) {
const speedFactor = 0.5;
const viewDir = playerMovement.getMajorDirectionFacing();
const forward = new Vector(viewDir.x, viewDir.y, viewDir.z);
const right = new Vector(forward.z, 0, -forward.x);
const moveInput = playerMovement.getMovementVector();
let velocity = forward.multiply(moveInput.y).add(right.multiply(moveInput.x));
if (playerMovement.isJumping())
velocity.y += 1;
if (playerMovement.isSneaking())
velocity.y -= 1;
return velocity.multiply(speedFactor);
}
move(instanceVelocity) {
this.currentInstanceLocation = this.currentInstanceLocation.add(instanceVelocity);
this.moveOutline();
}
moveOutline() {
const bounds = this.instance.getBounds();
const minWorldLocation = this.currentInstanceLocation.floor()
const maxWorldLocation = minWorldLocation.add(Vector.from(bounds.max));
this.outliner.setVertices(this.instance.getDimension(), minWorldLocation, maxWorldLocation);
}
onPlayerUseItem(event) {
if (!event.source || event.itemStack?.typeId !== MENU_ITEM) return;
event.cancel = true;
system.run(() => this.finish());
}
onPlayerLeave(event) {
if (event.player?.id === this.player.id)
system.run(() => this.finish());
}
finish() {
system.clearRun(this.runner);
this.outliner.stopDraw();
this.outliner = void 0;
this.instance.move(this.instance.getDimension().id, this.currentInstanceLocation);
this.instance.enable();
this.instance.flexMovingPlayerId = void 0;
this.allowPlayerMovement(true);
const builder = Builders.get(this.player.id);
builder.flexibleInstanceMovement = void 0;
world.beforeEvents.itemUse.unsubscribe(this.onPlayerUseItemBound);
world.beforeEvents.playerLeave.unsubscribe(this.onPlayerLeaveBound);
this.sendFeedback(`§aMoved "${this.instance.getName()}" to ${this.currentInstanceLocation.floor()}.`);
}
allowPlayerMovement(enable) {
const inputPermissions = this.player.inputPermissions;
inputPermissions.setPermissionCategory(InputPermissionCategory.Movement, enable);
}
sendFeedback(message) {
system.run(() => this.player.onScreenDisplay.setActionBar(message));
}
}
@@ -4,6 +4,8 @@ import { forceShow } from '../../utils';
import { InstanceButtons } from '../Enums/InstanceButtons'; import { InstanceButtons } from '../Enums/InstanceButtons';
import { InstanceFormBuilder } from './InstanceFormBuilder'; import { InstanceFormBuilder } from './InstanceFormBuilder';
import { FormCancelationReason } from '@minecraft/server-ui'; import { FormCancelationReason } from '@minecraft/server-ui';
import { FlexibleInstanceMove } from './FlexibleInstanceMove';
import { Builders } from '../Builder/Builders';
export class InstanceForm { export class InstanceForm {
instanceName; instanceName;
@@ -12,6 +14,7 @@ export class InstanceForm {
InstanceButtons.NextLayer, InstanceButtons.NextLayer,
InstanceButtons.PreviousLayer, InstanceButtons.PreviousLayer,
InstanceButtons.Move, InstanceButtons.Move,
InstanceButtons.FlexibleMove,
InstanceButtons.Settings, InstanceButtons.Settings,
InstanceButtons.Statistics, InstanceButtons.Statistics,
InstanceButtons.Materials, InstanceButtons.Materials,
@@ -94,6 +97,9 @@ export class InstanceForm {
case InstanceButtons.Move: case InstanceButtons.Move:
this.instance.move(this.player.dimension.id, this.player.location); this.instance.move(this.player.dimension.id, this.player.location);
break; break;
case InstanceButtons.FlexibleMove:
this.flexibleMovement();
break;
case InstanceButtons.Settings: case InstanceButtons.Settings:
this.settingsForm(); this.settingsForm();
break; break;
@@ -131,6 +137,11 @@ export class InstanceForm {
}); });
} }
flexibleMovement() {
const builder = Builders.get(this.player.id);
builder.flexibleInstanceMovement = new FlexibleInstanceMove(this.instance, this.player);
}
setLayerForm() { setLayerForm() {
InstanceFormBuilder.buildSetLayer(this.instance.getBounds().max.y, this.instance.getLayer()).show(this.player).then((response) => { InstanceFormBuilder.buildSetLayer(this.instance.getBounds().max.y, this.instance.getLayer()).show(this.player).then((response) => {
if (response.canceled) if (response.canceled)
@@ -15,6 +15,7 @@ export class StructureInstance {
verifier = void 0; verifier = void 0;
verificationRenderer = void 0; verificationRenderer = void 0;
materials = void 0; materials = void 0;
flexMovingPlayerId = void 0;
constructor(instanceName, structureId) { constructor(instanceName, structureId) {
this.structure = new Structure(structureId); this.structure = new Structure(structureId);
@@ -245,6 +246,10 @@ export class StructureInstance {
this.setLayer(this.options.currentLayer - 1); this.setLayer(this.options.currentLayer - 1);
} }
isFlexibleMoving() {
return this.flexMovingPlayerId !== void 0;
}
disableInstanceWhenNoPlayersOnline() { disableInstanceWhenNoPlayersOnline() {
// This prevents a memory leak when no players are online. // This prevents a memory leak when no players are online.
world.beforeEvents.playerLeave.subscribe(event => { world.beforeEvents.playerLeave.subscribe(event => {
+8 -3
View File
@@ -1,4 +1,4 @@
import { MolangVariableMap, system, world } from "@minecraft/server"; import { MolangVariableMap, system, TicksPerSecond, world } from "@minecraft/server";
import { Vector } from "../lib/Vector"; import { Vector } from "../lib/Vector";
export class Outliner { export class Outliner {
@@ -6,15 +6,18 @@ export class Outliner {
min = new Vector(); min = new Vector();
max = new Vector(); max = new Vector();
drawParticle = "construct:outline"; drawParticle = "construct:outline";
drawFrequency = 10; drawFrequency;
particleLifetime;
#drawParticles = []; #drawParticles = [];
#runner = void 0; #runner = void 0;
constructor(dimension, min, max) { constructor(dimension, min, max, drawFrequency = 10, particleLifetime = 20) {
this.dimension = dimension; this.dimension = dimension;
this.min = Vector.from(min); this.min = Vector.from(min);
this.max = Vector.from(max); this.max = Vector.from(max);
this.drawFrequency = drawFrequency;
this.particleLifetime = particleLifetime;
this.vertices = this.getVertices(min, max); this.vertices = this.getVertices(min, max);
} }
@@ -42,6 +45,8 @@ export class Outliner {
for (const [particleType, location] of this.#drawParticles) { for (const [particleType, location] of this.#drawParticles) {
const molang = new MolangVariableMap(); const molang = new MolangVariableMap();
molang.setColorRGBA("dot_color", colorCallback()); molang.setColorRGBA("dot_color", colorCallback());
const lifetimeSeconds = this.particleLifetime / TicksPerSecond;
molang.setFloat("lifetime", lifetimeSeconds);
try { try {
this.dimension.spawnParticle(particleType, location, molang); this.dimension.spawnParticle(particleType, location, molang);
} catch (e) { } catch (e) {
@@ -0,0 +1,38 @@
import { ButtonState, InputButton } from "@minecraft/server";
export class PlayerMovement {
inputInfo;
constructor(player) {
this.player = player;
this.inputInfo = player.inputInfo;
}
isJumping() {
return this.inputInfo.getButtonState(InputButton.Jump) === ButtonState.Pressed;
}
isSneaking() {
return this.inputInfo.getButtonState(InputButton.Sneak) === ButtonState.Pressed;
}
getMovementVector() {
return this.inputInfo.getMovementVector();
}
getMajorDirectionFacing() {
const { x, y, z } = this.player.getViewDirection();
const xzAngle = Math.atan2(z, x) * (180 / Math.PI);
if (y > 0.7)
return { x: 0, y: 1, z: 0 };
if (y < -0.7)
return { x: 0, y: -1, z: 0 };
if (xzAngle >= -45 && xzAngle < 45)
return { x: 1, y: 0, z: 0 };
else if (xzAngle >= 45 && xzAngle < 135)
return { x: 0, y: 0, z: 1 };
else if (xzAngle >= 135 || xzAngle < -135)
return { x: -1, y: 0, z: 0 };
return { x: 0, y: 0, z: -1 };
}
}
+15 -8
View File
@@ -3,8 +3,9 @@ import { extension } from '../config';
import { world, system, EntityComponentTypes, ItemStack, CommandPermissionLevel, CustomCommandStatus, Player } from '@minecraft/server'; import { world, system, EntityComponentTypes, ItemStack, CommandPermissionLevel, CustomCommandStatus, Player } from '@minecraft/server';
import { MenuForm } from '../classes/MenuForm'; import { MenuForm } from '../classes/MenuForm';
import { structureCollection } from '../classes/Structure/StructureCollection' import { structureCollection } from '../classes/Structure/StructureCollection'
import { Builders } from '../classes/Builder/Builders';
const ACTION_ITEM = 'construct:menu'; export const MENU_ITEM = 'construct:menu';
const menuCmd = new Command({ const menuCmd = new Command({
name: 'construct', name: 'construct',
@@ -18,9 +19,10 @@ system.beforeEvents.startup.subscribe((event) => {
const command = { const command = {
name: 'construct:item', name: 'construct:item',
description: 'Gives you the Construct item. Use it to open the Construct menu.', description: 'Gives you the Construct item. Use it to open the Construct menu.',
permissionLevel: CommandPermissionLevel.Any permissionLevel: CommandPermissionLevel.Any,
cheatsRequired: false
}; };
event.customCommandRegistry.registerCommand(command, givePlayerConstructItem) event.customCommandRegistry.registerCommand(command, givePlayerConstructItem);
}); });
function givePlayerConstructItem(origin) { function givePlayerConstructItem(origin) {
@@ -28,7 +30,7 @@ function givePlayerConstructItem(origin) {
if (player instanceof Player === false) if (player instanceof Player === false)
return { status: CustomCommandStatus.Failure, message: 'This command can only be used by players.' }; return { status: CustomCommandStatus.Failure, message: 'This command can only be used by players.' };
system.run(() => { system.run(() => {
const givenItemStack = player.getComponent(EntityComponentTypes.Inventory)?.container?.addItem(new ItemStack(ACTION_ITEM)); const givenItemStack = player.getComponent(EntityComponentTypes.Inventory)?.container?.addItem(new ItemStack(MENU_ITEM));
if (givenItemStack) if (givenItemStack)
player.sendMessage('§cFailed to give you the Construct item.'); player.sendMessage('§cFailed to give you the Construct item.');
else else
@@ -38,12 +40,17 @@ function givePlayerConstructItem(origin) {
} }
world.beforeEvents.itemUse.subscribe((event) => { world.beforeEvents.itemUse.subscribe((event) => {
if (!event.source || event.itemStack?.typeId !== ACTION_ITEM) return; if (!event.source || event.itemStack?.typeId !== MENU_ITEM) return;
event.cancel = true; event.cancel = true;
system.run(() => openMenu(event.source, event)); const builder = Builders.get(event.source.id);
system.run(() => {
if (builder.isFlexibleInstanceMoving())
return;
openMenu(event.source, event);
});
}); });
function openMenu(sender, event = void 0) { function openMenu(player, event = void 0) {
const options = { jumpToInstance: true } const options = { jumpToInstance: true }
if (event) { if (event) {
const instanceNames = structureCollection.getInstanceNames(); const instanceNames = structureCollection.getInstanceNames();
@@ -51,5 +58,5 @@ function openMenu(sender, event = void 0) {
if (instanceNames.includes(instanceName)) if (instanceNames.includes(instanceName))
options.instanceName = instanceName; options.instanceName = instanceName;
} }
new MenuForm(sender, options); new MenuForm(player, options);
} }
+1 -1
View File
@@ -4,5 +4,5 @@ export const extension = new CanopyExtension({
author: 'ForestOfLight', author: 'ForestOfLight',
name: 'Construct', name: 'Construct',
description: 'Survival building addon by §aForestOfLight§r.', description: 'Survival building addon by §aForestOfLight§r.',
version: '1.0.3' version: '1.0.4'
}); });
+3 -3
View File
@@ -1,10 +1,10 @@
{ {
"format_version": 2, "format_version": 2,
"header": { "header": {
"name": "Construct [RP] v1.0.3", "name": "Construct [RP] v1.0.4",
"description": "Survival building addon by §aForestOfLight§r.", "description": "Survival building addon by §aForestOfLight§r.",
"uuid": "375ec465-3dc1-429f-8b4c-a337889e1ed4", "uuid": "375ec465-3dc1-429f-8b4c-a337889e1ed4",
"version": [1, 0, 3], "version": [1, 0, 4],
"min_engine_version": [1,17,1] "min_engine_version": [1,17,1]
}, },
"modules": [ "modules": [
@@ -17,7 +17,7 @@
"dependencies": [ "dependencies": [
{ {
"uuid": "8c0c0153-d8b9-482a-889f-aef922b8fe58", // Construct BP "uuid": "8c0c0153-d8b9-482a-889f-aef922b8fe58", // Construct BP
"version": [1, 0, 3] "version": [1, 0, 4]
} }
], ],
"metadata": { "metadata": {
+1 -1
View File
@@ -17,7 +17,7 @@
}, },
"minecraft:emitter_shape_point": {}, "minecraft:emitter_shape_point": {},
"minecraft:particle_lifetime_expression": { "minecraft:particle_lifetime_expression": {
"max_lifetime": 1 "max_lifetime": "variable.lifetime"
}, },
"minecraft:particle_appearance_billboard": { "minecraft:particle_appearance_billboard": {
"size": [0.2, 0.2], "size": [0.2, 0.2],