From dc7306f96dad83e6fbeaa024dc5b67ee13cb7301 Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 09:56:04 +0800 Subject: [PATCH 01/12] =?UTF-8?q?feat(block):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=A3=95=E6=A6=88=E6=9C=A8=E9=97=A8=E9=BB=98=E8=AE=A4=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/configuration/palm_tree.yml | 89 +++++ .../default/configuration/templates.yml | 369 ++++++++++++++++++ 2 files changed, 458 insertions(+) diff --git a/common-files/src/main/resources/resources/default/configuration/palm_tree.yml b/common-files/src/main/resources/resources/default/configuration/palm_tree.yml index c3d56d240..eeedad323 100644 --- a/common-files/src/main/resources/resources/default/configuration/palm_tree.yml +++ b/common-files/src/main/resources/resources/default/configuration/palm_tree.yml @@ -334,6 +334,95 @@ items: parent: minecraft:block/template_orientable_trapdoor_top textures: texture: minecraft:block/custom/palm_trapdoor + default:palm_door: + material: nether_brick + custom-model-data: 1007 + data: + item-name: + model: + type: minecraft:model + path: minecraft:item/custom/palm_door + generation: + parent: minecraft:item/custom/palm_door + behavior: + type: block_item + block: + behaviors: + - type: door_block + can-open-with-hand: true + can-open-by-wind-charge: true + - type: sturdy_base_block + loot: + template: default:loot_table/self + settings: + template: + - default:sound/wood + overrides: + map-color: 2 + instrument: bass + hardness: 3.0 + resistance: 3.0 + burnable: true + tags: + - minecraft:doors + - minecraft:mineable/axe + - minecraft:mob_interactable_doors + states: + template: default:block_state/door + arguments: + base_block: oak_door + internal_id: + type: self_increase_int + from: 0 + to: 63 + model_top_left_path: minecraft:block/custom/palm_door_top_left + model_top_left_generation: + parent: minecraft:block/door_top_left + textures: + bottom: minecraft:block/palm_door_bottom + top: minecraft:block/palm_door_top + model_top_right_path: minecraft:block/custom/palm_door_top_right + model_top_right_generation: + parent: minecraft:block/door_top_right + textures: + bottom: minecraft:block/palm_door_bottom + top: minecraft:block/palm_door_top + model_top_left_open_path: minecraft:block/custom/palm_door_top_left_open + model_top_left_open_generation: + parent: minecraft:block/door_top_left_open + textures: + bottom: minecraft:block/palm_door_bottom + top: minecraft:block/palm_door_top + model_top_right_open_path: minecraft:block/custom/palm_door_top_right_open + model_top_right_open_generation: + parent: minecraft:block/door_top_right_open + textures: + bottom: minecraft:block/palm_door_bottom + top: minecraft:block/palm_door_top + model_bottom_left_path: minecraft:block/custom/palm_door_bottom_left + model_bottom_left_generation: + parent: minecraft:block/door_bottom_left + textures: + bottom: minecraft:block/palm_door_bottom + top: minecraft:block/palm_door_top + model_bottom_right_path: minecraft:block/custom/palm_door_bottom_right + model_bottom_right_generation: + parent: minecraft:block/door_bottom_right + textures: + bottom: minecraft:block/palm_door_bottom + top: minecraft:block/palm_door_top + model_bottom_left_open_path: minecraft:block/custom/palm_door_bottom_left_open + model_bottom_left_open_generation: + parent: minecraft:block/door_bottom_left_open + textures: + bottom: minecraft:block/palm_door_bottom + top: minecraft:block/palm_door_top + model_bottom_right_open_path: minecraft:block/custom/palm_door_bottom_right_open + model_bottom_right_open_generation: + parent: minecraft:block/door_bottom_right_open + textures: + bottom: minecraft:block/palm_door_bottom + top: minecraft:block/palm_door_top recipes: default:palm_planks: template: default:recipe/planks diff --git a/common-files/src/main/resources/resources/default/configuration/templates.yml b/common-files/src/main/resources/resources/default/configuration/templates.yml index f8381343f..898d068d0 100644 --- a/common-files/src/main/resources/resources/default/configuration/templates.yml +++ b/common-files/src/main/resources/resources/default/configuration/templates.yml @@ -1462,6 +1462,375 @@ templates#block_states: resistance: 1200.0 burnable: false fluid-state: water + # door block + default:block_state/door: + properties: + facing: + type: horizontal_direction + half: + type: double_block_half + hinge: + type: hinge + open: + type: boolean + default: false + powered: + type: boolean + default: false + appearances: + facing=east,half=lower,hinge=left,open=false: + state: ${base_block}[facing=east,half=lower,hinge=left,open=false,powered=true] + model: + path: ${model_bottom_left_path} + generation: ${model_bottom_left_generation} + facing=east,half=lower,hinge=left,open=true: + state: ${base_block}[facing=east,half=lower,hinge=left,open=true,powered=true] + model: + path: ${model_bottom_left_open_path} + y: 90 + generation: ${model_bottom_left_open_generation} + facing=east,half=lower,hinge=right,open=false: + state: ${base_block}[facing=east,half=lower,hinge=right,open=false,powered=true] + model: + path: ${model_bottom_right_path} + generation: ${model_bottom_right_generation} + facing=east,half=lower,hinge=right,open=true: + state: ${base_block}[facing=east,half=lower,hinge=right,open=true,powered=true] + model: + path: ${model_bottom_right_open_path} + y: 270 + generation: ${model_bottom_right_open_generation} + facing=east,half=upper,hinge=left,open=false: + state: ${base_block}[facing=east,half=upper,hinge=left,open=false,powered=true] + model: + path: ${model_top_left_path} + generation: ${model_top_left_generation} + facing=east,half=upper,hinge=left,open=true: + state: ${base_block}[facing=east,half=upper,hinge=left,open=true,powered=true] + model: + path: ${model_top_left_open_path} + y: 90 + generation: ${model_top_left_open_generation} + facing=east,half=upper,hinge=right,open=false: + state: ${base_block}[facing=east,half=upper,hinge=right,open=false,powered=true] + model: + path: ${model_top_right_path} + generation: ${model_top_right_generation} + facing=east,half=upper,hinge=right,open=true: + state: ${base_block}[facing=east,half=upper,hinge=right,open=true,powered=true] + model: + path: ${model_top_right_open_path} + y: 270 + generation: ${model_top_right_open_generation} + facing=north,half=lower,hinge=left,open=false: + state: ${base_block}[facing=north,half=lower,hinge=left,open=false,powered=true] + model: + path: ${model_bottom_left_path} + y: 270 + facing=north,half=lower,hinge=left,open=true: + state: ${base_block}[facing=north,half=lower,hinge=left,open=true,powered=true] + model: + path: ${model_bottom_left_open_path} + facing=north,half=lower,hinge=right,open=false: + state: ${base_block}[facing=north,half=lower,hinge=right,open=false,powered=true] + model: + path: ${model_bottom_right_path} + y: 270 + facing=north,half=lower,hinge=right,open=true: + state: ${base_block}[facing=north,half=lower,hinge=right,open=true,powered=true] + model: + path: ${model_bottom_right_open_path} + y: 180 + facing=north,half=upper,hinge=left,open=false: + state: ${base_block}[facing=north,half=upper,hinge=left,open=false,powered=true] + model: + path: ${model_top_left_path} + y: 270 + facing=north,half=upper,hinge=left,open=true: + state: ${base_block}[facing=north,half=upper,hinge=left,open=true,powered=true] + model: + path: ${model_top_left_open_path} + facing=north,half=upper,hinge=right,open=false: + state: ${base_block}[facing=north,half=upper,hinge=right,open=false,powered=true] + model: + path: ${model_top_right_path} + y: 270 + facing=north,half=upper,hinge=right,open=true: + state: ${base_block}[facing=north,half=upper,hinge=right,open=true,powered=true] + model: + path: ${model_top_right_open_path} + y: 180 + facing=south,half=lower,hinge=left,open=false: + state: ${base_block}[facing=south,half=lower,hinge=left,open=false,powered=true] + model: + path: ${model_bottom_left_path} + y: 90 + facing=south,half=lower,hinge=left,open=true: + state: ${base_block}[facing=south,half=lower,hinge=left,open=true,powered=true] + model: + path: ${model_bottom_left_open_path} + y: 180 + facing=south,half=lower,hinge=right,open=false: + state: ${base_block}[facing=south,half=lower,hinge=right,open=false,powered=true] + model: + path: ${model_bottom_right_path} + y: 90 + facing=south,half=lower,hinge=right,open=true: + state: ${base_block}[facing=south,half=lower,hinge=right,open=true,powered=true] + model: + path: ${model_bottom_right_open_path} + facing=south,half=upper,hinge=left,open=false: + state: ${base_block}[facing=south,half=upper,hinge=left,open=false,powered=true] + model: + path: ${model_top_left_path} + y: 90 + facing=south,half=upper,hinge=left,open=true: + state: ${base_block}[facing=south,half=upper,hinge=left,open=true,powered=true] + model: + path: ${model_top_left_open_path} + y: 180 + facing=south,half=upper,hinge=right,open=false: + state: ${base_block}[facing=south,half=upper,hinge=right,open=false,powered=true] + model: + path: ${model_top_right_path} + y: 90 + facing=south,half=upper,hinge=right,open=true: + state: ${base_block}[facing=south,half=upper,hinge=right,open=true,powered=true] + model: + path: ${model_top_right_open_path} + facing=west,half=lower,hinge=left,open=false: + state: ${base_block}[facing=west,half=lower,hinge=left,open=false,powered=true] + model: + path: ${model_bottom_left_path} + y: 180 + facing=west,half=lower,hinge=left,open=true: + state: ${base_block}[facing=west,half=lower,hinge=left,open=true,powered=true] + model: + path: ${model_bottom_left_open_path} + y: 270 + facing=west,half=lower,hinge=right,open=false: + state: ${base_block}[facing=west,half=lower,hinge=right,open=false,powered=true] + model: + path: ${model_bottom_right_path} + y: 180 + facing=west,half=lower,hinge=right,open=true: + state: ${base_block}[facing=west,half=lower,hinge=right,open=true,powered=true] + model: + path: ${model_bottom_right_open_path} + y: 90 + facing=west,half=upper,hinge=left,open=false: + state: ${base_block}[facing=west,half=upper,hinge=left,open=false,powered=true] + model: + path: ${model_top_left_path} + y: 180 + facing=west,half=upper,hinge=left,open=true: + state: ${base_block}[facing=west,half=upper,hinge=left,open=true,powered=true] + model: + path: ${model_top_left_open_path} + y: 270 + facing=west,half=upper,hinge=right,open=false: + state: ${base_block}[facing=west,half=upper,hinge=right,open=false,powered=true] + model: + path: ${model_top_right_path} + y: 180 + facing=west,half=upper,hinge=right,open=true: + state: ${base_block}[facing=west,half=upper,hinge=right,open=true,powered=true] + model: + path: ${model_top_right_open_path} + y: 90 + variants: + facing=east,half=lower,hinge=left,open=false,powered=true: + appearance: facing=east,half=lower,hinge=left,open=false + id: ${internal_id} + facing=east,half=lower,hinge=left,open=false,powered=false: + appearance: facing=east,half=lower,hinge=left,open=false + id: ${internal_id} + facing=east,half=lower,hinge=right,open=false,powered=true: + appearance: facing=east,half=lower,hinge=right,open=false + id: ${internal_id} + facing=east,half=lower,hinge=right,open=false,powered=false: + appearance: facing=east,half=lower,hinge=right,open=false + id: ${internal_id} + facing=east,half=upper,hinge=left,open=false,powered=true: + appearance: facing=east,half=upper,hinge=left,open=false + id: ${internal_id} + facing=east,half=upper,hinge=left,open=false,powered=false: + appearance: facing=east,half=upper,hinge=left,open=false + id: ${internal_id} + facing=east,half=upper,hinge=right,open=false,powered=true: + appearance: facing=east,half=upper,hinge=right,open=false + id: ${internal_id} + facing=east,half=upper,hinge=right,open=false,powered=false: + appearance: facing=east,half=upper,hinge=right,open=false + id: ${internal_id} + facing=north,half=lower,hinge=left,open=false,powered=true: + appearance: facing=north,half=lower,hinge=left,open=false + id: ${internal_id} + facing=north,half=lower,hinge=left,open=false,powered=false: + appearance: facing=north,half=lower,hinge=left,open=false + id: ${internal_id} + facing=north,half=lower,hinge=right,open=false,powered=true: + appearance: facing=north,half=lower,hinge=right,open=false + id: ${internal_id} + facing=north,half=lower,hinge=right,open=false,powered=false: + appearance: facing=north,half=lower,hinge=right,open=false + id: ${internal_id} + facing=north,half=upper,hinge=left,open=false,powered=true: + appearance: facing=north,half=upper,hinge=left,open=false + id: ${internal_id} + facing=north,half=upper,hinge=left,open=false,powered=false: + appearance: facing=north,half=upper,hinge=left,open=false + id: ${internal_id} + facing=north,half=upper,hinge=right,open=false,powered=true: + appearance: facing=north,half=upper,hinge=right,open=false + id: ${internal_id} + facing=north,half=upper,hinge=right,open=false,powered=false: + appearance: facing=north,half=upper,hinge=right,open=false + id: ${internal_id} + facing=south,half=lower,hinge=left,open=false,powered=true: + appearance: facing=south,half=lower,hinge=left,open=false + id: ${internal_id} + facing=south,half=lower,hinge=left,open=false,powered=false: + appearance: facing=south,half=lower,hinge=left,open=false + id: ${internal_id} + facing=south,half=lower,hinge=right,open=false,powered=true: + appearance: facing=south,half=lower,hinge=right,open=false + id: ${internal_id} + facing=south,half=lower,hinge=right,open=false,powered=false: + appearance: facing=south,half=lower,hinge=right,open=false + id: ${internal_id} + facing=south,half=upper,hinge=left,open=false,powered=true: + appearance: facing=south,half=upper,hinge=left,open=false + id: ${internal_id} + facing=south,half=upper,hinge=left,open=false,powered=false: + appearance: facing=south,half=upper,hinge=left,open=false + id: ${internal_id} + facing=south,half=upper,hinge=right,open=false,powered=true: + appearance: facing=south,half=upper,hinge=right,open=false + id: ${internal_id} + facing=south,half=upper,hinge=right,open=false,powered=false: + appearance: facing=south,half=upper,hinge=right,open=false + id: ${internal_id} + facing=west,half=lower,hinge=left,open=false,powered=true: + appearance: facing=west,half=lower,hinge=left,open=false + id: ${internal_id} + facing=west,half=lower,hinge=left,open=false,powered=false: + appearance: facing=west,half=lower,hinge=left,open=false + id: ${internal_id} + facing=west,half=lower,hinge=right,open=false,powered=true: + appearance: facing=west,half=lower,hinge=right,open=false + id: ${internal_id} + facing=west,half=lower,hinge=right,open=false,powered=false: + appearance: facing=west,half=lower,hinge=right,open=false + id: ${internal_id} + facing=west,half=upper,hinge=left,open=false,powered=true: + appearance: facing=west,half=upper,hinge=left,open=false + id: ${internal_id} + facing=west,half=upper,hinge=left,open=false,powered=false: + appearance: facing=west,half=upper,hinge=left,open=false + id: ${internal_id} + facing=west,half=upper,hinge=right,open=false,powered=true: + appearance: facing=west,half=upper,hinge=right,open=false + id: ${internal_id} + facing=west,half=upper,hinge=right,open=false,powered=false: + appearance: facing=west,half=upper,hinge=right,open=false + id: ${internal_id} + facing=east,half=lower,hinge=left,open=true,powered=true: + appearance: facing=east,half=lower,hinge=left,open=true + id: ${internal_id} + facing=east,half=lower,hinge=left,open=true,powered=false: + appearance: facing=east,half=lower,hinge=left,open=true + id: ${internal_id} + facing=east,half=lower,hinge=right,open=true,powered=true: + appearance: facing=east,half=lower,hinge=right,open=true + id: ${internal_id} + facing=east,half=lower,hinge=right,open=true,powered=false: + appearance: facing=east,half=lower,hinge=right,open=true + id: ${internal_id} + facing=east,half=upper,hinge=left,open=true,powered=true: + appearance: facing=east,half=upper,hinge=left,open=true + id: ${internal_id} + facing=east,half=upper,hinge=left,open=true,powered=false: + appearance: facing=east,half=upper,hinge=left,open=true + id: ${internal_id} + facing=east,half=upper,hinge=right,open=true,powered=true: + appearance: facing=east,half=upper,hinge=right,open=true + id: ${internal_id} + facing=east,half=upper,hinge=right,open=true,powered=false: + appearance: facing=east,half=upper,hinge=right,open=true + id: ${internal_id} + facing=north,half=lower,hinge=left,open=true,powered=true: + appearance: facing=north,half=lower,hinge=left,open=true + id: ${internal_id} + facing=north,half=lower,hinge=left,open=true,powered=false: + appearance: facing=north,half=lower,hinge=left,open=true + id: ${internal_id} + facing=north,half=lower,hinge=right,open=true,powered=true: + appearance: facing=north,half=lower,hinge=right,open=true + id: ${internal_id} + facing=north,half=lower,hinge=right,open=true,powered=false: + appearance: facing=north,half=lower,hinge=right,open=true + id: ${internal_id} + facing=north,half=upper,hinge=left,open=true,powered=true: + appearance: facing=north,half=upper,hinge=left,open=true + id: ${internal_id} + facing=north,half=upper,hinge=left,open=true,powered=false: + appearance: facing=north,half=upper,hinge=left,open=true + id: ${internal_id} + facing=north,half=upper,hinge=right,open=true,powered=true: + appearance: facing=north,half=upper,hinge=right,open=true + id: ${internal_id} + facing=north,half=upper,hinge=right,open=true,powered=false: + appearance: facing=north,half=upper,hinge=right,open=true + id: ${internal_id} + facing=south,half=lower,hinge=left,open=true,powered=true: + appearance: facing=south,half=lower,hinge=left,open=true + id: ${internal_id} + facing=south,half=lower,hinge=left,open=true,powered=false: + appearance: facing=south,half=lower,hinge=left,open=true + id: ${internal_id} + facing=south,half=lower,hinge=right,open=true,powered=true: + appearance: facing=south,half=lower,hinge=right,open=true + id: ${internal_id} + facing=south,half=lower,hinge=right,open=true,powered=false: + appearance: facing=south,half=lower,hinge=right,open=true + id: ${internal_id} + facing=south,half=upper,hinge=left,open=true,powered=true: + appearance: facing=south,half=upper,hinge=left,open=true + id: ${internal_id} + facing=south,half=upper,hinge=left,open=true,powered=false: + appearance: facing=south,half=upper,hinge=left,open=true + id: ${internal_id} + facing=south,half=upper,hinge=right,open=true,powered=true: + appearance: facing=south,half=upper,hinge=right,open=true + id: ${internal_id} + facing=south,half=upper,hinge=right,open=true,powered=false: + appearance: facing=south,half=upper,hinge=right,open=true + id: ${internal_id} + facing=west,half=lower,hinge=left,open=true,powered=true: + appearance: facing=west,half=lower,hinge=left,open=true + id: ${internal_id} + facing=west,half=lower,hinge=left,open=true,powered=false: + appearance: facing=west,half=lower,hinge=left,open=true + id: ${internal_id} + facing=west,half=lower,hinge=right,open=true,powered=true: + appearance: facing=west,half=lower,hinge=right,open=true + id: ${internal_id} + facing=west,half=lower,hinge=right,open=true,powered=false: + appearance: facing=west,half=lower,hinge=right,open=true + id: ${internal_id} + facing=west,half=upper,hinge=left,open=true,powered=true: + appearance: facing=west,half=upper,hinge=left,open=true + id: ${internal_id} + facing=west,half=upper,hinge=left,open=true,powered=false: + appearance: facing=west,half=upper,hinge=left,open=true + id: ${internal_id} + facing=west,half=upper,hinge=right,open=true,powered=true: + appearance: facing=west,half=upper,hinge=right,open=true + id: ${internal_id} + facing=west,half=upper,hinge=right,open=true,powered=false: + appearance: facing=west,half=upper,hinge=right,open=true + id: ${internal_id} # recipes templates#recipes: From 461882a532b72254f4fe08de8b281e726b80805f Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 10:00:46 +0800 Subject: [PATCH 02/12] =?UTF-8?q?feat(block):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common-files/src/main/resources/mappings.yml | 36 +++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/common-files/src/main/resources/mappings.yml b/common-files/src/main/resources/mappings.yml index 378281eb0..5303d07d0 100644 --- a/common-files/src/main/resources/mappings.yml +++ b/common-files/src/main/resources/mappings.yml @@ -3108,4 +3108,38 @@ minecraft:warped_trapdoor[facing=west,half=bottom,open=false,powered=true,waterl # minecraft:chorus_plant[down=true,east=true,north=false,south=true,up=true,west=true]: minecraft:chorus_plant[down=true,east=true,north=true,south=true,up=true,west=true] # minecraft:chorus_plant[down=false,east=false,north=true,south=true,up=true,west=true]: minecraft:chorus_plant[down=true,east=true,north=true,south=true,up=true,west=true] # minecraft:chorus_plant[down=true,east=false,north=true,south=true,up=true,west=true]: minecraft:chorus_plant[down=true,east=true,north=true,south=true,up=true,west=true] -# minecraft:chorus_plant[down=false,east=true,north=true,south=true,up=true,west=true]: minecraft:chorus_plant[down=true,east=true,north=true,south=true,up=true,west=true] \ No newline at end of file +# minecraft:chorus_plant[down=false,east=true,north=true,south=true,up=true,west=true]: minecraft:chorus_plant[down=true,east=true,north=true,south=true,up=true,west=true] + +# oak door +minecraft:oak_door[facing=east,half=lower,hinge=left,open=false,powered=true]: minecraft:oak_door[facing=east,half=lower,hinge=left,open=false,powered=false] +minecraft:oak_door[facing=east,half=lower,hinge=right,open=false,powered=true]: minecraft:oak_door[facing=east,half=lower,hinge=right,open=false,powered=false] +minecraft:oak_door[facing=east,half=upper,hinge=left,open=false,powered=true]: minecraft:oak_door[facing=east,half=upper,hinge=left,open=false,powered=false] +minecraft:oak_door[facing=east,half=upper,hinge=right,open=false,powered=true]: minecraft:oak_door[facing=east,half=upper,hinge=right,open=false,powered=false] +minecraft:oak_door[facing=north,half=lower,hinge=left,open=false,powered=true]: minecraft:oak_door[facing=north,half=lower,hinge=left,open=false,powered=false] +minecraft:oak_door[facing=north,half=lower,hinge=right,open=false,powered=true]: minecraft:oak_door[facing=north,half=lower,hinge=right,open=false,powered=false] +minecraft:oak_door[facing=north,half=upper,hinge=left,open=false,powered=true]: minecraft:oak_door[facing=north,half=upper,hinge=left,open=false,powered=false] +minecraft:oak_door[facing=north,half=upper,hinge=right,open=false,powered=true]: minecraft:oak_door[facing=north,half=upper,hinge=right,open=false,powered=false] +minecraft:oak_door[facing=south,half=lower,hinge=left,open=false,powered=true]: minecraft:oak_door[facing=south,half=lower,hinge=left,open=false,powered=false] +minecraft:oak_door[facing=south,half=lower,hinge=right,open=false,powered=true]: minecraft:oak_door[facing=south,half=lower,hinge=right,open=false,powered=false] +minecraft:oak_door[facing=south,half=upper,hinge=left,open=false,powered=true]: minecraft:oak_door[facing=south,half=upper,hinge=left,open=false,powered=false] +minecraft:oak_door[facing=south,half=upper,hinge=right,open=false,powered=true]: minecraft:oak_door[facing=south,half=upper,hinge=right,open=false,powered=false] +minecraft:oak_door[facing=west,half=lower,hinge=left,open=false,powered=true]: minecraft:oak_door[facing=west,half=lower,hinge=left,open=false,powered=false] +minecraft:oak_door[facing=west,half=lower,hinge=right,open=false,powered=true]: minecraft:oak_door[facing=west,half=lower,hinge=right,open=false,powered=false] +minecraft:oak_door[facing=west,half=upper,hinge=left,open=false,powered=true]: minecraft:oak_door[facing=west,half=upper,hinge=left,open=false,powered=false] +minecraft:oak_door[facing=west,half=upper,hinge=right,open=false,powered=true]: minecraft:oak_door[facing=west,half=upper,hinge=right,open=false,powered=false] +minecraft:oak_door[facing=east,half=lower,hinge=left,open=true,powered=true]: minecraft:oak_door[facing=east,half=lower,hinge=left,open=true,powered=false] +minecraft:oak_door[facing=east,half=lower,hinge=right,open=true,powered=true]: minecraft:oak_door[facing=east,half=lower,hinge=right,open=true,powered=false] +minecraft:oak_door[facing=east,half=upper,hinge=left,open=true,powered=true]: minecraft:oak_door[facing=east,half=upper,hinge=left,open=true,powered=false] +minecraft:oak_door[facing=east,half=upper,hinge=right,open=true,powered=true]: minecraft:oak_door[facing=east,half=upper,hinge=right,open=true,powered=false] +minecraft:oak_door[facing=north,half=lower,hinge=left,open=true,powered=true]: minecraft:oak_door[facing=north,half=lower,hinge=left,open=true,powered=false] +minecraft:oak_door[facing=north,half=lower,hinge=right,open=true,powered=true]: minecraft:oak_door[facing=north,half=lower,hinge=right,open=true,powered=false] +minecraft:oak_door[facing=north,half=upper,hinge=left,open=true,powered=true]: minecraft:oak_door[facing=north,half=upper,hinge=left,open=true,powered=false] +minecraft:oak_door[facing=north,half=upper,hinge=right,open=true,powered=true]: minecraft:oak_door[facing=north,half=upper,hinge=right,open=true,powered=false] +minecraft:oak_door[facing=south,half=lower,hinge=left,open=true,powered=true]: minecraft:oak_door[facing=south,half=lower,hinge=left,open=true,powered=false] +minecraft:oak_door[facing=south,half=lower,hinge=right,open=true,powered=true]: minecraft:oak_door[facing=south,half=lower,hinge=right,open=true,powered=false] +minecraft:oak_door[facing=south,half=upper,hinge=left,open=true,powered=true]: minecraft:oak_door[facing=south,half=upper,hinge=left,open=true,powered=false] +minecraft:oak_door[facing=south,half=upper,hinge=right,open=true,powered=true]: minecraft:oak_door[facing=south,half=upper,hinge=right,open=true,powered=false] +minecraft:oak_door[facing=west,half=lower,hinge=left,open=true,powered=true]: minecraft:oak_door[facing=west,half=lower,hinge=left,open=true,powered=false] +minecraft:oak_door[facing=west,half=lower,hinge=right,open=true,powered=true]: minecraft:oak_door[facing=west,half=lower,hinge=right,open=true,powered=false] +minecraft:oak_door[facing=west,half=upper,hinge=left,open=true,powered=true]: minecraft:oak_door[facing=west,half=upper,hinge=left,open=true,powered=false] +minecraft:oak_door[facing=west,half=upper,hinge=right,open=true,powered=true]: minecraft:oak_door[facing=west,half=upper,hinge=right,open=true,powered=false] \ No newline at end of file From 247bbda4eb23edb1f1fe61e9c36c3649ac3438aa Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 10:31:07 +0800 Subject: [PATCH 03/12] =?UTF-8?q?fix(block):=20=E4=BF=AE=E5=A4=8DupdateSha?= =?UTF-8?q?pe=E8=BF=94=E5=9B=9E=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bukkit/block/behavior/DoorBlockBehavior.java | 2 +- .../resources/default/configuration/palm_tree.yml | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java index 0e1ef1e42..e64038616 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java @@ -89,7 +89,7 @@ public class DoorBlockBehavior extends BukkitBlockBehavior { return MBlocks.AIR$defaultState; } if (neighborState.get(anotherDoorBehavior.get().halfProperty) != half) { - return neighborState.with(anotherDoorBehavior.get().halfProperty, half); + return neighborState.with(anotherDoorBehavior.get().halfProperty, half).customBlockState().handle(); } return MBlocks.AIR$defaultState; } else { diff --git a/common-files/src/main/resources/resources/default/configuration/palm_tree.yml b/common-files/src/main/resources/resources/default/configuration/palm_tree.yml index eeedad323..f81aca492 100644 --- a/common-files/src/main/resources/resources/default/configuration/palm_tree.yml +++ b/common-files/src/main/resources/resources/default/configuration/palm_tree.yml @@ -347,11 +347,10 @@ items: behavior: type: block_item block: - behaviors: - - type: door_block - can-open-with-hand: true - can-open-by-wind-charge: true - - type: sturdy_base_block + behavior: + type: door_block + can-open-with-hand: true + can-open-by-wind-charge: true loot: template: default:loot_table/self settings: From ef14147a0a00ae7164dc3ba29770a1bb9de81990 Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 10:41:38 +0800 Subject: [PATCH 04/12] =?UTF-8?q?fix(block):=20=E4=BF=AE=E5=A4=8D=E7=BB=86?= =?UTF-8?q?=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../craftengine/bukkit/block/behavior/DoorBlockBehavior.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java index e64038616..f86ac4f69 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java @@ -192,10 +192,11 @@ public class DoorBlockBehavior extends BukkitBlockBehavior { @Override public InteractionResult useOnBlock(UseOnContext context, ImmutableBlockState state) { if (!this.canOpenWithHand) { + if (!this.canOpenWithHand || context.getPlayer().isSecondaryUseActive()) { return InteractionResult.PASS; } setOpen(context.getPlayer(), context.getLevel().serverWorld(), state, context.getClickedPos(), !state.get(this.openProperty)); - return InteractionResult.SUCCESS; + return InteractionResult.SUCCESS_AND_CANCEL; } @Override From a71754c64a317a9c2f9a9f78d01a594a5ade0387 Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 11:08:22 +0800 Subject: [PATCH 05/12] =?UTF-8?q?fix(block):=20=E4=BF=AE=E5=A4=8D=E5=8F=AA?= =?UTF-8?q?=E6=94=BE=E4=BA=86=E4=B8=8B=E5=8D=8A=E8=BE=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bukkit/block/behavior/DoorBlockBehavior.java | 7 ++++++- .../bukkit/item/behavior/BlockItemBehavior.java | 2 ++ .../craftengine/core/block/AbstractCustomBlock.java | 5 +++++ .../momirealms/craftengine/core/block/BlockBehavior.java | 3 +++ .../net/momirealms/craftengine/core/block/CustomBlock.java | 2 ++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java index f86ac4f69..dbad0ff89 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java @@ -111,6 +111,12 @@ public class DoorBlockBehavior extends BukkitBlockBehavior { } } + @Override + public void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state) { + BlockPos pos = context.getClickedPos(); + context.getLevel().setBlockAt(pos.x(), pos.y() + 1, pos.z(), state.with(this.halfProperty, DoubleBlockHalf.UPPER).customBlockState(), 3); + } + @Override public ImmutableBlockState updateStateForPlacement(BlockPlaceContext context, ImmutableBlockState state) { World world = context.getLevel(); @@ -191,7 +197,6 @@ public class DoorBlockBehavior extends BukkitBlockBehavior { @Override public InteractionResult useOnBlock(UseOnContext context, ImmutableBlockState state) { - if (!this.canOpenWithHand) { if (!this.canOpenWithHand || context.getPlayer().isSecondaryUseActive()) { return InteractionResult.PASS; } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/BlockItemBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/BlockItemBehavior.java index 9a7ae14bc..213c4ca49 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/BlockItemBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/BlockItemBehavior.java @@ -159,6 +159,8 @@ public class BlockItemBehavior extends ItemBehavior { item.load(); } + block.setPlacedBy(context, blockStateToPlace); + player.swingHand(context.getHand()); context.getLevel().playBlockSound(position, blockStateToPlace.sounds().placeSound()); world.sendGameEvent(bukkitPlayer, GameEvent.BLOCK_PLACE, new Vector(pos.x(), pos.y(), pos.z())); diff --git a/core/src/main/java/net/momirealms/craftengine/core/block/AbstractCustomBlock.java b/core/src/main/java/net/momirealms/craftengine/core/block/AbstractCustomBlock.java index 72ce3af52..32c473c61 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/block/AbstractCustomBlock.java +++ b/core/src/main/java/net/momirealms/craftengine/core/block/AbstractCustomBlock.java @@ -194,4 +194,9 @@ public abstract class AbstractCustomBlock implements CustomBlock { } return state; } + + @Override + public void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state) { + this.behavior.setPlacedBy(context, state); + } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/block/BlockBehavior.java b/core/src/main/java/net/momirealms/craftengine/core/block/BlockBehavior.java index c01b5e4a8..b4be523d7 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/block/BlockBehavior.java +++ b/core/src/main/java/net/momirealms/craftengine/core/block/BlockBehavior.java @@ -95,6 +95,9 @@ public abstract class BlockBehavior { return state; } + public void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state) { + } + public InteractionResult useOnBlock(UseOnContext context, ImmutableBlockState state) { return InteractionResult.PASS; } diff --git a/core/src/main/java/net/momirealms/craftengine/core/block/CustomBlock.java b/core/src/main/java/net/momirealms/craftengine/core/block/CustomBlock.java index 0ff330d4b..4e835b7fc 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/block/CustomBlock.java +++ b/core/src/main/java/net/momirealms/craftengine/core/block/CustomBlock.java @@ -37,6 +37,8 @@ public interface CustomBlock { ImmutableBlockState getStateForPlacement(BlockPlaceContext context); + void setPlacedBy(BlockPlaceContext context, ImmutableBlockState state); + interface Builder { Builder events(Map>> events); From b37a0e90238c839d6189380f715c9fdca4b3ac45 Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 11:09:11 +0800 Subject: [PATCH 06/12] =?UTF-8?q?feat(block):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=96=B9=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common-files/src/main/resources/additional-real-blocks.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common-files/src/main/resources/additional-real-blocks.yml b/common-files/src/main/resources/additional-real-blocks.yml index 9b383231d..d576f66f1 100644 --- a/common-files/src/main/resources/additional-real-blocks.yml +++ b/common-files/src/main/resources/additional-real-blocks.yml @@ -43,4 +43,5 @@ minecraft:oxidized_copper_trapdoor: 32 minecraft:waxed_copper_trapdoor: 32 minecraft:waxed_exposed_copper_trapdoor: 32 minecraft:waxed_weathered_copper_trapdoor: 32 -minecraft:waxed_oxidized_copper_trapdoor: 32 \ No newline at end of file +minecraft:waxed_oxidized_copper_trapdoor: 32 +minecraft:oak_door: 64 \ No newline at end of file From cc57bf8bfa5d3cfc70740f8aa83fa36e00b358ba Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 11:14:33 +0800 Subject: [PATCH 07/12] =?UTF-8?q?fix(block):=20=E4=BF=AE=E5=A4=8D=E6=B4=BB?= =?UTF-8?q?=E5=A1=9E=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/resources/default/configuration/palm_tree.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/common-files/src/main/resources/resources/default/configuration/palm_tree.yml b/common-files/src/main/resources/resources/default/configuration/palm_tree.yml index f81aca492..373c55941 100644 --- a/common-files/src/main/resources/resources/default/configuration/palm_tree.yml +++ b/common-files/src/main/resources/resources/default/configuration/palm_tree.yml @@ -357,6 +357,7 @@ items: template: - default:sound/wood overrides: + push-reaction: DESTROY map-color: 2 instrument: bass hardness: 3.0 From 73b127a5be55f90fcc0183c21041aad94302d49d Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 11:39:07 +0800 Subject: [PATCH 08/12] =?UTF-8?q?fix(block):=20=E8=A7=A3=E5=86=B3=E6=A3=95?= =?UTF-8?q?=E6=A6=88=E6=9C=A8=E9=97=A8=E7=BA=B9=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/configuration/palm_tree.yml | 39 +++++++++--------- .../textures/item/custom/palm_door.png | Bin 0 -> 249 bytes 2 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/palm_door.png diff --git a/common-files/src/main/resources/resources/default/configuration/palm_tree.yml b/common-files/src/main/resources/resources/default/configuration/palm_tree.yml index 373c55941..5f4d0b5cf 100644 --- a/common-files/src/main/resources/resources/default/configuration/palm_tree.yml +++ b/common-files/src/main/resources/resources/default/configuration/palm_tree.yml @@ -340,10 +340,9 @@ items: data: item-name: model: - type: minecraft:model - path: minecraft:item/custom/palm_door - generation: - parent: minecraft:item/custom/palm_door + template: default:model/simplified_generated + arguments: + path: minecraft:item/custom/palm_door behavior: type: block_item block: @@ -379,50 +378,50 @@ items: model_top_left_generation: parent: minecraft:block/door_top_left textures: - bottom: minecraft:block/palm_door_bottom - top: minecraft:block/palm_door_top + bottom: minecraft:block/custom/palm_door_bottom + top: minecraft:block/custom/palm_door_top model_top_right_path: minecraft:block/custom/palm_door_top_right model_top_right_generation: parent: minecraft:block/door_top_right textures: - bottom: minecraft:block/palm_door_bottom - top: minecraft:block/palm_door_top + bottom: minecraft:block/custom/palm_door_bottom + top: minecraft:block/custom/palm_door_top model_top_left_open_path: minecraft:block/custom/palm_door_top_left_open model_top_left_open_generation: parent: minecraft:block/door_top_left_open textures: - bottom: minecraft:block/palm_door_bottom - top: minecraft:block/palm_door_top + bottom: minecraft:block/custom/palm_door_bottom + top: minecraft:block/custom/palm_door_top model_top_right_open_path: minecraft:block/custom/palm_door_top_right_open model_top_right_open_generation: parent: minecraft:block/door_top_right_open textures: - bottom: minecraft:block/palm_door_bottom - top: minecraft:block/palm_door_top + bottom: minecraft:block/custom/palm_door_bottom + top: minecraft:block/custom/palm_door_top model_bottom_left_path: minecraft:block/custom/palm_door_bottom_left model_bottom_left_generation: parent: minecraft:block/door_bottom_left textures: - bottom: minecraft:block/palm_door_bottom - top: minecraft:block/palm_door_top + bottom: minecraft:block/custom/palm_door_bottom + top: minecraft:block/custom/palm_door_top model_bottom_right_path: minecraft:block/custom/palm_door_bottom_right model_bottom_right_generation: parent: minecraft:block/door_bottom_right textures: - bottom: minecraft:block/palm_door_bottom - top: minecraft:block/palm_door_top + bottom: minecraft:block/custom/palm_door_bottom + top: minecraft:block/custom/palm_door_top model_bottom_left_open_path: minecraft:block/custom/palm_door_bottom_left_open model_bottom_left_open_generation: parent: minecraft:block/door_bottom_left_open textures: - bottom: minecraft:block/palm_door_bottom - top: minecraft:block/palm_door_top + bottom: minecraft:block/custom/palm_door_bottom + top: minecraft:block/custom/palm_door_top model_bottom_right_open_path: minecraft:block/custom/palm_door_bottom_right_open model_bottom_right_open_generation: parent: minecraft:block/door_bottom_right_open textures: - bottom: minecraft:block/palm_door_bottom - top: minecraft:block/palm_door_top + bottom: minecraft:block/custom/palm_door_bottom + top: minecraft:block/custom/palm_door_top recipes: default:palm_planks: template: default:recipe/planks diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/palm_door.png b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/item/custom/palm_door.png new file mode 100644 index 0000000000000000000000000000000000000000..7128688a3990e151f3132741ff40473443d0cf07 GIT binary patch literal 249 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`)Ym%P6qNfc)B=- zSo9_*NMs!7I5RUw zmyL}rl_&bbPYd1##!Y)2_#6rk_U_N(@#3l9SoQD=yJg#T|9M6R27iv`GU)K!+gHgd zE-WUPT=DyvXtU5^Z8lX-paE=#ci0q|Re3#nYHB_+YRj)@JfxJQ!F3U2Xe* Date: Thu, 19 Jun 2025 12:20:45 +0800 Subject: [PATCH 09/12] =?UTF-8?q?feat(block):=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E9=97=A8=E6=96=B9=E5=9D=97=E5=AD=98=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractCanSurviveBlockBehavior.java | 2 +- .../block/behavior/DoorBlockBehavior.java | 60 +++++++++++++++---- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/AbstractCanSurviveBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/AbstractCanSurviveBlockBehavior.java index d71dbf8ca..03c1baa99 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/AbstractCanSurviveBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/AbstractCanSurviveBlockBehavior.java @@ -100,7 +100,7 @@ public abstract class AbstractCanSurviveBlockBehavior extends BukkitBlockBehavio } world.playBlockSound(position, previousState.sounds().breakSound()); FastNMS.INSTANCE.method$Level$levelEvent(level, WorldEvents.BLOCK_BREAK_EFFECT, blockPos, stateId); - return CoreReflections.method$Block$defaultBlockState.invoke(MBlocks.AIR); + return MBlocks.AIR$defaultState; } return state; } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java index dbad0ff89..1f252b397 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/DoorBlockBehavior.java @@ -7,6 +7,7 @@ import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MBlocks; import net.momirealms.craftengine.bukkit.util.BlockStateUtils; import net.momirealms.craftengine.bukkit.util.DirectionUtils; import net.momirealms.craftengine.bukkit.util.LocationUtils; +import net.momirealms.craftengine.bukkit.world.BukkitWorld; import net.momirealms.craftengine.core.block.BlockBehavior; import net.momirealms.craftengine.core.block.CustomBlock; import net.momirealms.craftengine.core.block.ImmutableBlockState; @@ -17,15 +18,16 @@ import net.momirealms.craftengine.core.block.state.properties.DoorHinge; import net.momirealms.craftengine.core.block.state.properties.DoubleBlockHalf; import net.momirealms.craftengine.core.entity.player.InteractionResult; import net.momirealms.craftengine.core.entity.player.Player; +import net.momirealms.craftengine.core.item.Item; import net.momirealms.craftengine.core.item.context.BlockPlaceContext; import net.momirealms.craftengine.core.item.context.UseOnContext; +import net.momirealms.craftengine.core.plugin.context.ContextHolder; +import net.momirealms.craftengine.core.plugin.context.parameter.DirectContextParameters; import net.momirealms.craftengine.core.util.Direction; import net.momirealms.craftengine.core.util.HorizontalDirection; import net.momirealms.craftengine.core.util.ResourceConfigUtils; import net.momirealms.craftengine.core.util.VersionHelper; -import net.momirealms.craftengine.core.world.BlockPos; -import net.momirealms.craftengine.core.world.Vec3d; -import net.momirealms.craftengine.core.world.World; +import net.momirealms.craftengine.core.world.*; import org.bukkit.Bukkit; import org.bukkit.GameEvent; import org.bukkit.block.Block; @@ -40,7 +42,7 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.Callable; -public class DoorBlockBehavior extends BukkitBlockBehavior { +public class DoorBlockBehavior extends AbstractCanSurviveBlockBehavior { public static final Factory FACTORY = new Factory(); private final Property halfProperty; private final Property facingProperty; @@ -58,7 +60,7 @@ public class DoorBlockBehavior extends BukkitBlockBehavior { Property openProperty, boolean canOpenWithHand, boolean canOpenByWindCharge) { - super(block); + super(block, 0); this.halfProperty = halfProperty; this.facingProperty = facingProperty; this.hingeProperty = hingeProperty; @@ -73,9 +75,19 @@ public class DoorBlockBehavior extends BukkitBlockBehavior { } @Override - public Object updateShape(Object thisBlock, Object[] args, Callable superMethod) { + public Object updateShape(Object thisBlock, Object[] args, Callable superMethod) throws Exception { + Object level; + Object blockPos; Object blockState = args[0]; - ImmutableBlockState immutableBlockState = BukkitBlockManager.instance().getImmutableBlockState(BlockStateUtils.blockStateToId(blockState)); + if (VersionHelper.isOrAbove1_21_2()) { + level = args[1]; + blockPos = args[3]; + } else { + level = args[3]; + blockPos = args[4]; + } + int stateId = BlockStateUtils.blockStateToId(blockState); + ImmutableBlockState immutableBlockState = BukkitBlockManager.instance().getImmutableBlockState(stateId); if (immutableBlockState == null || immutableBlockState.isEmpty()) return blockState; DoubleBlockHalf half = immutableBlockState.get(this.halfProperty); Object direction = VersionHelper.isOrAbove1_21_2() ? args[4] : args[0]; @@ -93,9 +105,21 @@ public class DoorBlockBehavior extends BukkitBlockBehavior { } return MBlocks.AIR$defaultState; } else { - return half == DoubleBlockHalf.LOWER && - direction == CoreReflections.instance$Direction$DOWN && - !FastNMS.INSTANCE.method$BlockStateBase$canSurvive(blockState, VersionHelper.isOrAbove1_21_2() ? args[1] : args[3], VersionHelper.isOrAbove1_21_2() ? args[3] : args[2]) ? MBlocks.AIR$defaultState : blockState; + if (half == DoubleBlockHalf.LOWER && direction == CoreReflections.instance$Direction$DOWN + && !canSurvive(thisBlock, blockState, level, blockPos)) { + BlockPos pos = LocationUtils.fromBlockPos(blockPos); + net.momirealms.craftengine.core.world.World world = new BukkitWorld(FastNMS.INSTANCE.method$Level$getCraftWorld(level)); + WorldPosition position = new WorldPosition(world, Vec3d.atCenterOf(pos)); + ContextHolder.Builder builder = ContextHolder.builder() + .withParameter(DirectContextParameters.POSITION, position); + for (Item item : immutableBlockState.getDrops(builder, world, null)) { + world.dropItemNaturally(position, item); + } + world.playBlockSound(position, immutableBlockState.sounds().breakSound()); + FastNMS.INSTANCE.method$Level$levelEvent(level, WorldEvents.BLOCK_BREAK_EFFECT, blockPos, stateId); + return MBlocks.AIR$defaultState; + } + return blockState; } } @@ -241,6 +265,22 @@ public class DoorBlockBehavior extends BukkitBlockBehavior { } } + @Override + public boolean canSurvive(Object thisBlock, Object state, Object world, Object blockPos) throws Exception { + ImmutableBlockState immutableBlockState = BukkitBlockManager.instance().getImmutableBlockState(BlockStateUtils.blockStateToId(state)); + if (immutableBlockState == null || immutableBlockState.isEmpty()) return false; + if (immutableBlockState.get(this.halfProperty) == DoubleBlockHalf.UPPER) return true; + int x = FastNMS.INSTANCE.field$Vec3i$x(blockPos); + int y = FastNMS.INSTANCE.field$Vec3i$y(blockPos) - 1; + int z = FastNMS.INSTANCE.field$Vec3i$z(blockPos); + Object targetPos = FastNMS.INSTANCE.constructor$BlockPos(x, y, z); + Object blockState = FastNMS.INSTANCE.method$BlockGetter$getBlockState(world, targetPos); + return (boolean) CoreReflections.method$BlockStateBase$isFaceSturdy.invoke( + blockState, world, targetPos, CoreReflections.instance$Direction$UP, + CoreReflections.instance$SupportType$FULL + ); + } + @SuppressWarnings("unchecked") public static class Factory implements BlockBehaviorFactory { @Override From ef0377412589a82a1be407baa86e3eacecfad932 Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 12:22:37 +0800 Subject: [PATCH 10/12] =?UTF-8?q?feat(block):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=B0=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/resources/default/configuration/categories.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/common-files/src/main/resources/resources/default/configuration/categories.yml b/common-files/src/main/resources/resources/default/configuration/categories.yml index 128180d77..d059a6fc3 100644 --- a/common-files/src/main/resources/resources/default/configuration/categories.yml +++ b/common-files/src/main/resources/resources/default/configuration/categories.yml @@ -23,6 +23,7 @@ categories: - default:stripped_palm_wood - default:palm_planks - default:palm_trapdoor + - default:palm_door default:topaz: name: <#FF8C00> hidden: true From 80973618e01bce167ab2393a3d1c89bb4f77408a Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 12:25:41 +0800 Subject: [PATCH 11/12] =?UTF-8?q?fix(pack):=20=E4=BF=AE=E5=A4=8D=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=96=87=E4=BB=B6=E6=9C=AA=E9=87=8A=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../momirealms/craftengine/core/pack/AbstractPackManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java index ace40069b..14aefaab7 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java @@ -427,6 +427,7 @@ public abstract class AbstractPackManager implements PackManager { plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/block/custom/palm_trapdoor.png"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/block/custom/palm_door_top.png"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/block/custom/palm_door_bottom.png"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/palm_door.png"); // plants plugin.saveResource("resources/default/configuration/plants.yml"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/block/custom/fairy_flower_1.png"); From cb52b290f66ef900aea213ef04c122bc05104f0b Mon Sep 17 00:00:00 2001 From: jhqwqmc <2110242767@qq.com> Date: Thu, 19 Jun 2025 12:53:37 +0800 Subject: [PATCH 12/12] =?UTF-8?q?fix(bukkit):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E5=8F=AF=E5=A0=86=E5=8F=A0=E6=96=B9=E5=9D=97=E8=A1=8C=E4=B8=BA?= =?UTF-8?q?=E4=B8=8D=E8=BF=98=E5=8E=9F=E5=8E=9F=E7=89=88=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../behavior/StackableBlockBehavior.java | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/StackableBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/StackableBlockBehavior.java index e4198b25f..a75504d60 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/StackableBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/StackableBlockBehavior.java @@ -8,6 +8,7 @@ import net.momirealms.craftengine.core.block.ImmutableBlockState; import net.momirealms.craftengine.core.block.UpdateOption; import net.momirealms.craftengine.core.block.behavior.BlockBehaviorFactory; import net.momirealms.craftengine.core.block.properties.IntegerProperty; +import net.momirealms.craftengine.core.entity.player.InteractionHand; import net.momirealms.craftengine.core.entity.player.InteractionResult; import net.momirealms.craftengine.core.entity.player.Player; import net.momirealms.craftengine.core.item.Item; @@ -50,22 +51,36 @@ public class StackableBlockBehavior extends BukkitBlockBehavior { if (item == null) { return InteractionResult.PASS; } - if (this.items.contains(item.id()) && state.get(this.amountProperty) < this.amountProperty.max) { - ImmutableBlockState nextStage = state.cycle(this.amountProperty); - World world = context.getLevel(); - BlockPos pos = context.getClickedPos(); - Location location = new Location((org.bukkit.World) world.platformWorld(), pos.x(), pos.y(), pos.z()); - FastNMS.INSTANCE.method$LevelWriter$setBlock(world.serverWorld(), LocationUtils.toBlockPos(pos), nextStage.customBlockState().handle(), UpdateOption.UPDATE_NONE.flags()); - if (stackSound != null) { - location.getWorld().playSound(location, stackSound.id().toString(), SoundCategory.BLOCKS, stackSound.volume(), stackSound.pitch()); - } - FastNMS.INSTANCE.method$ItemStack$consume(item.getLiteralObject(), 1, player.serverPlayer()); - player.swingHand(context.getHand()); + if (!this.items.contains(item.id())) { + return InteractionResult.PASS; + } + BlockPos pos = context.getClickedPos(); + World world = context.getLevel(); + if (state.get(this.amountProperty) < this.amountProperty.max) { + updateStackableBlock(state, pos, world, item, player, context.getHand()); + return InteractionResult.SUCCESS_AND_CANCEL; + } + BlockPos actualPos = pos.relative(context.getClickedFace()); + ImmutableBlockState actualState = world.getBlockAt(actualPos).customBlockState(); + boolean isValid = actualState != null && !actualState.isEmpty() && actualState.contains(this.amountProperty); + if (isValid && actualState.get(this.amountProperty) < this.amountProperty.max) { + updateStackableBlock(actualState, actualPos, world, item, player, context.getHand()); return InteractionResult.SUCCESS_AND_CANCEL; } return InteractionResult.PASS; } + private void updateStackableBlock(ImmutableBlockState state, BlockPos pos, World world, Item item, Player player, InteractionHand hand) { + ImmutableBlockState nextStage = state.cycle(this.amountProperty); + Location location = new Location((org.bukkit.World) world.platformWorld(), pos.x(), pos.y(), pos.z()); + FastNMS.INSTANCE.method$LevelWriter$setBlock(world.serverWorld(), LocationUtils.toBlockPos(pos), nextStage.customBlockState().handle(), UpdateOption.UPDATE_NONE.flags()); + if (stackSound != null) { + location.getWorld().playSound(location, stackSound.id().toString(), SoundCategory.BLOCKS, stackSound.volume(), stackSound.pitch()); + } + FastNMS.INSTANCE.method$ItemStack$consume(item.getLiteralObject(), 1, player.serverPlayer()); + player.swingHand(hand); + } + public static class Factory implements BlockBehaviorFactory { @Override