From f5953bd4916c2604204a0daeb8f4bcc81688a8a6 Mon Sep 17 00:00:00 2001 From: XiaoMoMi Date: Sat, 21 Jun 2025 23:27:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B0=8F=E7=9F=B3=E5=AD=90?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../behavior/StackableBlockBehavior.java | 21 ++- .../UnsafeCompositeBlockBehavior.java | 2 +- .../handler/ProjectilePacketHandler.java | 1 + .../reflection/minecraft/CoreReflections.java | 4 +- .../default/configuration/blocks.yml | 126 ++++++++++++++++++ .../default/configuration/categories.yml | 4 +- .../resources/default/configuration/i18n.yml | 4 + .../default/configuration/palm_tree.yml | 12 +- .../models/block/custom/pebble_1.json | 79 +++-------- .../models/block/custom/pebble_2.json | 93 ++++--------- .../models/block/custom/pebble_3.json | 93 ++++--------- .../src/main/resources/translations/en.yml | 2 +- .../src/main/resources/translations/zh_cn.yml | 2 +- .../entity/projectile/ProjectileMeta.java | 2 + .../craftengine/core/item/ItemSettings.java | 4 +- .../core/pack/AbstractPackManager.java | 5 + 16 files changed, 233 insertions(+), 221 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 656b780a9..5e68479af 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 @@ -13,6 +13,7 @@ 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.UseOnContext; +import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException; import net.momirealms.craftengine.core.sound.SoundData; import net.momirealms.craftengine.core.util.Key; import net.momirealms.craftengine.core.util.MiscUtils; @@ -56,18 +57,11 @@ public class StackableBlockBehavior extends BukkitBlockBehavior { } BlockPos pos = context.getClickedPos(); World world = context.getLevel(); - if (state.get(this.amountProperty) < this.amountProperty.max) { - updateStackableBlock(state, pos, world, item, player, context.getHand()); + if (state.get(this.amountProperty) >= this.amountProperty.max) { 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; + updateStackableBlock(state, pos, world, item, player, context.getHand()); + return InteractionResult.SUCCESS_AND_CANCEL; } private void updateStackableBlock(ImmutableBlockState state, BlockPos pos, World world, Item item, Player player, InteractionHand hand) { @@ -77,7 +71,7 @@ public class StackableBlockBehavior extends BukkitBlockBehavior { if (this.stackSound != null) { world.playBlockSound(new Vec3d(location.getX(), location.getY(), location.getZ()), this.stackSound); } - FastNMS.INSTANCE.method$ItemStack$consume(item.getLiteralObject(), 1, player.serverPlayer()); + item.count(item.count() - 1); player.swingHand(hand); } @@ -86,7 +80,10 @@ public class StackableBlockBehavior extends BukkitBlockBehavior { @Override @SuppressWarnings("unchecked") public BlockBehavior create(CustomBlock block, Map arguments) { - IntegerProperty amount = (IntegerProperty) ResourceConfigUtils.requireNonNullOrThrow(block.getProperty("amount"), "warning.config.block.behavior.stackable.missing_amount"); + String propertyName = String.valueOf(arguments.getOrDefault("property", "amount")); + IntegerProperty amount = (IntegerProperty) ResourceConfigUtils.requireNonNullOrThrow(block.getProperty(propertyName), () -> { + throw new LocalizedResourceConfigException("warning.config.block.behavior.stackable.missing_property", propertyName); + }); Map sounds = (Map) arguments.get("sounds"); SoundData stackSound = null; if (sounds != null) { diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/UnsafeCompositeBlockBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/UnsafeCompositeBlockBehavior.java index 946994b88..095d46b7d 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/UnsafeCompositeBlockBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/behavior/UnsafeCompositeBlockBehavior.java @@ -35,7 +35,7 @@ public class UnsafeCompositeBlockBehavior extends BukkitBlockBehavior { public InteractionResult useOnBlock(UseOnContext context, ImmutableBlockState state) { for (AbstractBlockBehavior behavior : this.behaviors) { InteractionResult result = behavior.useOnBlock(context, state); - if (result != InteractionResult.PASS) { + if (result != InteractionResult.PASS && result != InteractionResult.TRY_EMPTY_HAND) { return result; } } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/handler/ProjectilePacketHandler.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/handler/ProjectilePacketHandler.java index 23e95d709..133403d1b 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/handler/ProjectilePacketHandler.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/network/handler/ProjectilePacketHandler.java @@ -130,6 +130,7 @@ public class ProjectilePacketHandler implements EntityPacketHandler { it -> ItemDisplayEntityData.DisplayedItem.addEntityDataIfNotDefaultValue(FastNMS.INSTANCE.field$CraftItemStack$handle(it), itemDisplayValues), () -> ItemDisplayEntityData.DisplayedItem.addEntityDataIfNotDefaultValue(literalItem, itemDisplayValues)); ItemDisplayEntityData.DisplayType.addEntityDataIfNotDefaultValue(meta.displayType().id(), itemDisplayValues); + ItemDisplayEntityData.BillboardConstraints.addEntityDataIfNotDefaultValue(meta.billboard().id(), itemDisplayValues); return itemDisplayValues; } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/reflection/minecraft/CoreReflections.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/reflection/minecraft/CoreReflections.java index 4e67d8250..49eb066ab 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/reflection/minecraft/CoreReflections.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/reflection/minecraft/CoreReflections.java @@ -1274,8 +1274,8 @@ public final class CoreReflections { ReflectionUtils.getDeclaredField(clazz$BlockStateBase, boolean.class, 11) ); - public static final Field field$BlockStateBase$Cache$propagatesSkylightDown = requireNonNull( - ReflectionUtils.getDeclaredField(clazz$BlockStateBase$Cache, boolean.class, 2) + public static final Field field$BlockStateBase$Cache$propagatesSkylightDown = ReflectionUtils.getDeclaredField( + clazz$BlockStateBase$Cache, boolean.class, 2 ); public static final Field field$BlockStateBase$requiresCorrectToolForDrops = requireNonNull( diff --git a/common-files/src/main/resources/resources/default/configuration/blocks.yml b/common-files/src/main/resources/resources/default/configuration/blocks.yml index bcb46bbb2..895090c45 100644 --- a/common-files/src/main/resources/resources/default/configuration/blocks.yml +++ b/common-files/src/main/resources/resources/default/configuration/blocks.yml @@ -250,6 +250,115 @@ items#misc: id: 1 settings: luminance: 8 + default:pebble: + material: nether_brick + custom-model-data: 3005 + data: + item-name: + model: + template: default:model/simplified_generated + arguments: + path: minecraft:item/custom/pebble + behavior: + - type: block_item + block: + settings: + template: + - default:sound/stone + - default:hardness/none + overrides: + map-color: 11 + push-reaction: DESTROY + behaviors: + - type: sturdy_base_block + direction: down + - type: stackable_block + property: pebble + items: + - default:pebble + sounds: + stack: minecraft:block.stone.fall + loot: + pools: + - rolls: 1 + entries: + - type: item + item: default:pebble + functions: + - type: set_count + count: 3 + add: false + conditions: + - type: match_block_property + properties: + pebble: 3 + - type: set_count + count: 2 + add: false + conditions: + - type: match_block_property + properties: + pebble: 2 + - type: explosion_decay + states: + properties: + pebble: + type: int + range: 1~3 + default: 1 + appearances: + one: + state: tripwire:2 + models: + - path: minecraft:block/custom/pebble_1 + weight: 1 + - path: minecraft:block/custom/pebble_1 + weight: 1 + y: 90 + - path: minecraft:block/custom/pebble_1 + weight: 1 + y: 180 + - path: minecraft:block/custom/pebble_1 + weight: 1 + y: 270 + two: + state: tripwire:3 + models: + - path: minecraft:block/custom/pebble_2 + weight: 1 + - path: minecraft:block/custom/pebble_2 + weight: 1 + y: 90 + - path: minecraft:block/custom/pebble_2 + weight: 1 + y: 180 + - path: minecraft:block/custom/pebble_2 + weight: 1 + y: 270 + three: + state: tripwire:4 + models: + - path: minecraft:block/custom/pebble_3 + weight: 1 + - path: minecraft:block/custom/pebble_3 + weight: 1 + y: 90 + - path: minecraft:block/custom/pebble_3 + weight: 1 + y: 180 + - path: minecraft:block/custom/pebble_3 + weight: 1 + y: 270 + variants: + pebble=1: + appearance: 'one' + id: 2 + pebble=2: + appearance: 'two' + id: 3 + pebble=3: + appearance: 'three' + id: 4 recipes#misc: default:chinese_lantern: type: shaped @@ -304,4 +413,21 @@ recipes#misc: A: minecraft:copper_ingot result: id: default:copper_coil + count: 1 + default:pebble: + type: shapeless + ingredients: + - minecraft:cobblestone + result: + id: default:pebble + count: 4 + default:cobblestone_from_pebble: + type: shaped + pattern: + - AA + - AA + ingredients: + A: default:pebble + result: + id: minecraft:cobblestone count: 1 \ No newline at end of file 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 87ff57ca2..8bbcc8cf8 100644 --- a/common-files/src/main/resources/resources/default/configuration/categories.yml +++ b/common-files/src/main/resources/resources/default/configuration/categories.yml @@ -27,6 +27,7 @@ categories: - default:palm_fence_gate - default:palm_slab - default:palm_stairs + - default:palm_pressure_plate default:topaz: name: <#FF8C00> hidden: true @@ -74,4 +75,5 @@ categories: - minecraft:air - default:copper_coil - default:flame_elytra - - default:cap \ No newline at end of file + - default:cap + - default:pebble \ No newline at end of file diff --git a/common-files/src/main/resources/resources/default/configuration/i18n.yml b/common-files/src/main/resources/resources/default/configuration/i18n.yml index 8e39f0d8e..815e41006 100644 --- a/common-files/src/main/resources/resources/default/configuration/i18n.yml +++ b/common-files/src/main/resources/resources/default/configuration/i18n.yml @@ -36,11 +36,13 @@ i18n: item.palm_fence_gate: Palm Fence Gate item.palm_slab: Palm Slab item.palm_stairs: Palm Stairs + item.palm_pressure_plate: Palm Pressure Plate item.netherite_anvil: Netherite Anvil item.gunpowder_block: GunPowder Block item.solid_gunpowder_block: Solid GunPowder Block item.copper_coil: Copper Coil item.flame_elytra: Flame Elytra + item.pebble: Pebble item.cap: Cap category.default.name: Default Assets category.default.lore: Contains the default configuration of CraftEngine @@ -88,11 +90,13 @@ i18n: item.palm_fence_gate: 棕榈木栅栏门 item.palm_slab: 棕榈木台阶 item.palm_stairs: 棕榈木楼梯 + item.palm_pressure_plate: 棕榈木压力板 item.netherite_anvil: 下界合金砧 item.gunpowder_block: 火药粉末 item.solid_gunpowder_block: 凝固火药块 item.copper_coil: 铜线圈 item.flame_elytra: 烈焰鞘翅 + item.pebble: 石子 item.cap: 鸭舌帽 category.default.name: 默认资产 category.default.lore: 包含了CraftEngine的默认配置 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 802065e4a..52c1d5310 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 @@ -301,8 +301,8 @@ items: can-open-with-hand: true can-open-by-wind-charge: true sounds: - open: block.wooden_trapdoor.open - close: block.wooden_trapdoor.close + open: minecraft:block.wooden_trapdoor.open + close: minecraft:block.wooden_trapdoor.close loot: template: default:loot_table/self settings: @@ -355,8 +355,8 @@ items: can-open-with-hand: true can-open-by-wind-charge: true sounds: - open: block.wooden_door.open - close: block.wooden_door.close + open: minecraft:block.wooden_door.open + close: minecraft:block.wooden_door.close loot: template: default:loot_table/self settings: @@ -431,8 +431,8 @@ items: can-open-with-hand: true can-open-by-wind-charge: true sounds: - open: block.fence_gate.open - close: block.fence_gate.close + open: minecraft:block.fence_gate.open + close: minecraft:block.fence_gate.close loot: template: default:loot_table/self settings: diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_1.json b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_1.json index 9fb2e4f9e..df5bbce21 100644 --- a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_1.json +++ b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_1.json @@ -1,75 +1,34 @@ { - "credit": "Made with Blockbench", "textures": { - "1": "block/custom/pebble" + "0": "block/custom/pebble", + "particle": "block/custom/pebble" }, "elements": [ - { - "from": [6, -1, 6], - "to": [11, 2, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [6, 0, 6]}, - "faces": { - "north": {"uv": [2.5, 0, 5, 1.5], "texture": "#1"}, - "east": {"uv": [2.5, 1.5, 5, 3], "texture": "#1"}, - "south": {"uv": [2.5, 3, 5, 4.5], "texture": "#1"}, - "west": {"uv": [2.5, 4.5, 5, 6], "texture": "#1"}, - "up": {"uv": [2.5, 2.5, 0, 0], "texture": "#1"}, - "down": {"uv": [2.5, 2.5, 0, 5], "texture": "#1"} - } - }, { "from": [4, -0.99, 5], "to": [7, 1.01, 8], "rotation": {"angle": 0, "axis": "y", "origin": [4, 0, 5]}, "faces": { - "north": {"uv": [5, 1.5, 6.5, 2.5], "texture": "#1"}, - "east": {"uv": [5, 2.5, 6.5, 3.5], "texture": "#1"}, - "south": {"uv": [5, 3.5, 6.5, 4.5], "texture": "#1"}, - "west": {"uv": [5, 4.5, 6.5, 5.5], "texture": "#1"}, - "up": {"uv": [1.5, 6.5, 0, 5], "texture": "#1"}, - "down": {"uv": [6.5, 0, 5, 1.5], "texture": "#1"} + "north": {"uv": [5, 1.5, 6.5, 2.5], "texture": "#0"}, + "east": {"uv": [5, 2.5, 6.5, 3.5], "texture": "#0"}, + "south": {"uv": [5, 3.5, 6.5, 4.5], "texture": "#0"}, + "west": {"uv": [5, 4.5, 6.5, 5.5], "texture": "#0"}, + "up": {"uv": [1.5, 6.5, 0, 5], "texture": "#0"}, + "down": {"uv": [6.5, 0, 5, 1.5], "texture": "#0"} } - } - ], - "display": { - "thirdperson_righthand": { - "rotation": [45, 0, 0], - "translation": [0.5, 5, 4.75], - "scale": [0.8, 0.8, 0.8] }, - "thirdperson_lefthand": { - "rotation": [45, 0, 0], - "translation": [0.5, 5, 4.75], - "scale": [0.8, 0.8, 0.8] - }, - "firstperson_righthand": { - "rotation": [0, -149, 0], - "translation": [3.25, 4.75, 0] - }, - "firstperson_lefthand": { - "rotation": [0, 38, 0], - "translation": [1.75, 7, 0] - }, - "ground": { - "translation": [0, 5.75, 0], - "scale": [0.85, 0.85, 0.85] - }, - "gui": { - "rotation": [30, -155, 0], - "translation": [-1, 4.25, 0] - }, - "fixed": { - "rotation": [-90, 0, 0], - "translation": [0, -1, -11.75], - "scale": [1.5, 1.5, 1.5] - } - }, - "groups": [ { - "name": "group", - "origin": [4, 0, 5], - "color": 0, - "children": [0, 1] + "from": [6, -1, 6], + "to": [11, 2, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 0, 6]}, + "faces": { + "north": {"uv": [2.5, 0, 5, 1.5], "texture": "#0"}, + "east": {"uv": [2.5, 1.5, 5, 3], "texture": "#0"}, + "south": {"uv": [2.5, 3, 5, 4.5], "texture": "#0"}, + "west": {"uv": [2.5, 4.5, 5, 6], "texture": "#0"}, + "up": {"uv": [2.5, 2.5, 0, 0], "texture": "#0"}, + "down": {"uv": [2.5, 2.5, 0, 5], "texture": "#0"} + } } ] } \ No newline at end of file diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_2.json b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_2.json index c769aeed3..7bc0f078c 100644 --- a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_2.json +++ b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_2.json @@ -1,22 +1,20 @@ { - "credit": "Made with Blockbench", - "texture_size": [32, 32], "textures": { - "2": "block/custom/pebble", + "0": "block/custom/pebble", "particle": "block/custom/pebble" }, "elements": [ { - "from": [4.99, -0.01, 6.99], - "to": [10.01, 4.01, 12.01], - "rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 6]}, + "from": [2.01, -0.99, 8.01], + "to": [4.99, 2.99, 10.99], + "rotation": {"angle": 45, "axis": "z", "origin": [3.5, 1.5, 9.5]}, "faces": { - "north": {"uv": [9.5, 0, 12, 2], "texture": "#2"}, - "east": {"uv": [9.5, 2, 12, 4], "texture": "#2"}, - "south": {"uv": [9.5, 4, 12, 6], "texture": "#2"}, - "west": {"uv": [7, 5, 9.5, 7], "texture": "#2"}, - "up": {"uv": [9.5, 2.5, 7, 0], "texture": "#2"}, - "down": {"uv": [9.5, 2.5, 7, 5], "texture": "#2"} + "north": {"uv": [12, 4, 13.5, 6], "texture": "#0"}, + "east": {"uv": [2.5, 6, 4, 8], "texture": "#0"}, + "south": {"uv": [4, 6, 5.5, 8], "texture": "#0"}, + "west": {"uv": [5.5, 6, 7, 8], "texture": "#0"}, + "up": {"uv": [16, 6, 14.5, 4.5], "texture": "#0"}, + "down": {"uv": [16, 6, 14.5, 7.5], "texture": "#0"} } }, { @@ -24,67 +22,26 @@ "to": [12, 3, 9], "rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 6]}, "faces": { - "north": {"uv": [14, 3, 16, 4.5], "texture": "#2"}, - "east": {"uv": [7, 7, 9, 8.5], "texture": "#2"}, - "south": {"uv": [14, 0, 16, 1.5], "texture": "#2"}, - "west": {"uv": [14, 1.5, 16, 3], "texture": "#2"}, - "up": {"uv": [14, 2, 12, 0], "texture": "#2"}, - "down": {"uv": [14, 2, 12, 4], "texture": "#2"} + "north": {"uv": [14, 3, 16, 4.5], "texture": "#0"}, + "east": {"uv": [7, 7, 9, 8.5], "texture": "#0"}, + "south": {"uv": [14, 0, 16, 1.5], "texture": "#0"}, + "west": {"uv": [14, 1.5, 16, 3], "texture": "#0"}, + "up": {"uv": [14, 2, 12, 0], "texture": "#0"}, + "down": {"uv": [14, 2, 12, 4], "texture": "#0"} } }, { - "from": [2.01, -0.99, 8.01], - "to": [4.99, 2.99, 10.99], - "rotation": {"angle": 45, "axis": "z", "origin": [3.5, 1.5, 9.5]}, + "from": [4.99, -0.01, 6.99], + "to": [10.01, 4.01, 12.01], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 6]}, "faces": { - "north": {"uv": [12, 4, 13.5, 6], "texture": "#2"}, - "east": {"uv": [2.5, 6, 4, 8], "texture": "#2"}, - "south": {"uv": [4, 6, 5.5, 8], "texture": "#2"}, - "west": {"uv": [5.5, 6, 7, 8], "texture": "#2"}, - "up": {"uv": [16, 6, 14.5, 4.5], "texture": "#2"}, - "down": {"uv": [16, 6, 14.5, 7.5], "texture": "#2"} + "north": {"uv": [9.5, 0, 12, 2], "texture": "#0"}, + "east": {"uv": [9.5, 2, 12, 4], "texture": "#0"}, + "south": {"uv": [9.5, 4, 12, 6], "texture": "#0"}, + "west": {"uv": [7, 5, 9.5, 7], "texture": "#0"}, + "up": {"uv": [9.5, 2.5, 7, 0], "texture": "#0"}, + "down": {"uv": [9.5, 2.5, 7, 5], "texture": "#0"} } } - ], - "display": { - "thirdperson_righthand": { - "rotation": [45, 0, 0], - "translation": [0.5, 5, 4.75], - "scale": [0.8, 0.8, 0.8] - }, - "thirdperson_lefthand": { - "rotation": [45, 0, 0], - "translation": [0.5, 5, 4.75], - "scale": [0.8, 0.8, 0.8] - }, - "firstperson_righthand": { - "rotation": [0, 38, 0], - "translation": [1.75, 7, 0] - }, - "firstperson_lefthand": { - "rotation": [0, 38, 0], - "translation": [1.75, 7, 0] - }, - "ground": { - "translation": [0, 5.75, 0], - "scale": [0.85, 0.85, 0.85] - }, - "gui": { - "rotation": [25, 144, 0], - "translation": [-0.5, 4.75, 0] - }, - "fixed": { - "rotation": [-90, 0, 0], - "translation": [0, -1, -11.75], - "scale": [1.5, 1.5, 1.5] - } - }, - "groups": [ - { - "name": "group", - "origin": [8, 8, 8], - "color": 0, - "children": [0, 1, 2] - } ] } \ No newline at end of file diff --git a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_3.json b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_3.json index 515e6cc87..14e45b86c 100644 --- a/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_3.json +++ b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_3.json @@ -1,22 +1,20 @@ { - "credit": "Made with Blockbench", - "texture_size": [32, 32], "textures": { - "2": "block/custom/pebble", + "0": "block/custom/pebble", "particle": "block/custom/pebble" }, "elements": [ { - "from": [3, 0, 6], - "to": [9, 8, 12], - "rotation": {"angle": 22.5, "axis": "z", "origin": [7, 3.5, 9]}, + "from": [6, 0, 9], + "to": [11, 2, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 1]}, "faces": { - "north": {"uv": [0, 8, 3, 12], "texture": "#2"}, - "east": {"uv": [3, 8, 6, 12], "texture": "#2"}, - "south": {"uv": [0, 12, 3, 16], "texture": "#2"}, - "west": {"uv": [3, 12, 6, 16], "texture": "#2"}, - "up": {"uv": [9, 13, 6, 10], "texture": "#2"}, - "down": {"uv": [9, 13, 6, 16], "texture": "#2"} + "north": {"uv": [15, 13.5, 16, 16], "rotation": 90, "texture": "#0"}, + "east": {"uv": [6.5, 9, 9, 10], "texture": "#0"}, + "south": {"uv": [11.5, 9, 14, 10], "texture": "#0"}, + "west": {"uv": [15, 16, 14, 13.5], "rotation": 90, "texture": "#0"}, + "up": {"uv": [12, 9, 9.5, 6.5], "texture": "#0"}, + "down": {"uv": [14.5, 6.5, 12, 9], "texture": "#0"} } }, { @@ -24,67 +22,26 @@ "to": [12, 4, 9], "rotation": {"angle": 0, "axis": "y", "origin": [-1, 0, 1]}, "faces": { - "north": {"uv": [9, 11.5, 11.5, 13.5], "texture": "#2"}, - "east": {"uv": [11.5, 10, 14, 12], "texture": "#2"}, - "south": {"uv": [11.5, 12, 14, 14], "texture": "#2"}, - "west": {"uv": [11.5, 14, 14, 16], "texture": "#2"}, - "up": {"uv": [11.5, 16, 9, 13.5], "texture": "#2"}, - "down": {"uv": [11.5, 9, 9, 11.5], "texture": "#2"} + "north": {"uv": [9, 11.5, 11.5, 13.5], "texture": "#0"}, + "east": {"uv": [11.5, 10, 14, 12], "texture": "#0"}, + "south": {"uv": [11.5, 12, 14, 14], "texture": "#0"}, + "west": {"uv": [11.5, 14, 14, 16], "texture": "#0"}, + "up": {"uv": [11.5, 16, 9, 13.5], "texture": "#0"}, + "down": {"uv": [11.5, 9, 9, 11.5], "texture": "#0"} } }, { - "from": [6, 0, 9], - "to": [11, 2, 14], - "rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 1]}, + "from": [3, 0, 6], + "to": [9, 8, 12], + "rotation": {"angle": 22.5, "axis": "z", "origin": [7, 3.5, 9]}, "faces": { - "north": {"uv": [15, 13.5, 16, 16], "rotation": 90, "texture": "#2"}, - "east": {"uv": [6.5, 9, 9, 10], "texture": "#2"}, - "south": {"uv": [11.5, 9, 14, 10], "texture": "#2"}, - "west": {"uv": [15, 16, 14, 13.5], "rotation": 90, "texture": "#2"}, - "up": {"uv": [12, 9, 9.5, 6.5], "texture": "#2"}, - "down": {"uv": [14.5, 6.5, 12, 9], "texture": "#2"} + "north": {"uv": [0, 8, 3, 12], "texture": "#0"}, + "east": {"uv": [3, 8, 6, 12], "texture": "#0"}, + "south": {"uv": [0, 12, 3, 16], "texture": "#0"}, + "west": {"uv": [3, 12, 6, 16], "texture": "#0"}, + "up": {"uv": [9, 13, 6, 10], "texture": "#0"}, + "down": {"uv": [9, 13, 6, 16], "texture": "#0"} } } - ], - "display": { - "thirdperson_righthand": { - "rotation": [45, 0, 0], - "translation": [0.5, 5, 4.75], - "scale": [0.8, 0.8, 0.8] - }, - "thirdperson_lefthand": { - "rotation": [45, 0, 0], - "translation": [0.5, 5, 4.75], - "scale": [0.8, 0.8, 0.8] - }, - "firstperson_righthand": { - "rotation": [0, -149, 0], - "translation": [3.25, 4.75, 0] - }, - "firstperson_lefthand": { - "rotation": [0, 38, 0], - "translation": [1.75, 7, 0] - }, - "ground": { - "translation": [0, 5.75, 0], - "scale": [0.85, 0.85, 0.85] - }, - "gui": { - "rotation": [30, -155, 0], - "translation": [-1, 4.25, 0] - }, - "fixed": { - "rotation": [-90, 0, 0], - "translation": [0, -1, -11.75], - "scale": [1.5, 1.5, 1.5] - } - }, - "groups": [ - { - "name": "group", - "origin": [8, 8, 8], - "color": 0, - "children": [0, 1, 2] - } ] } \ No newline at end of file diff --git a/common-files/src/main/resources/translations/en.yml b/common-files/src/main/resources/translations/en.yml index f00a6c2ed..f80d5d95c 100644 --- a/common-files/src/main/resources/translations/en.yml +++ b/common-files/src/main/resources/translations/en.yml @@ -256,7 +256,7 @@ warning.config.block.behavior.trapdoor.missing_half: "Issue found in fil warning.config.block.behavior.trapdoor.missing_facing: "Issue found in file - The block '' is missing the required 'facing' property for 'trapdoor_block' behavior." warning.config.block.behavior.trapdoor.missing_open: "Issue found in file - The block '' is missing the required 'open' property for 'trapdoor_block' behavior." warning.config.block.behavior.trapdoor.missing_powered: "Issue found in file - The block '' is missing the required 'powered' property for 'trapdoor_block' behavior." -warning.config.block.behavior.stackable.missing_amount: "Issue found in file - The block '' is missing the required 'amount' property for 'stackable_block' behavior." +warning.config.block.behavior.stackable.missing_property: "Issue found in file - The block '' is missing the required '' property for 'stackable_block' behavior." warning.config.block.behavior.stackable.missing_items: "Issue found in file - The block '' is missing the required 'items' argument for 'stackable_block' behavior." warning.config.block.behavior.fence_gate.missing_facing: "Issue found in file - The block '' is missing the required 'facing' argument for 'fence_gate_block' behavior." warning.config.block.behavior.fence_gate.missing_in_wall: "Issue found in file - The block '' is missing the required 'in_wall' argument for 'fence_gate_block' behavior." diff --git a/common-files/src/main/resources/translations/zh_cn.yml b/common-files/src/main/resources/translations/zh_cn.yml index 89491c83e..6c90f70fd 100644 --- a/common-files/src/main/resources/translations/zh_cn.yml +++ b/common-files/src/main/resources/translations/zh_cn.yml @@ -256,7 +256,7 @@ warning.config.block.behavior.trapdoor.missing_half: "在文件 warning.config.block.behavior.trapdoor.missing_facing: "在文件 发现问题 - 方块 '' 的 'trapdoor_block' 行为缺少必需的 'facing' 属性" warning.config.block.behavior.trapdoor.missing_open: "在文件 发现问题 - 方块 '' 的 'trapdoor_block' 行为缺少必需的 'open' 属性" warning.config.block.behavior.trapdoor.missing_powered: "在文件 发现问题 - 方块 '' 的 'trapdoor_block' 行为缺少必需的 'powered' 属性" -warning.config.block.behavior.stackable.missing_amount: "在文件 发现问题 - 方块 '' 的 'stackable_block' 行为缺少必需的 'amount' 属性" +warning.config.block.behavior.stackable.missing_property: "在文件 发现问题 - 方块 '' 的 'stackable_block' 行为缺少必需的 '' 属性" warning.config.block.behavior.stackable.missing_items: "在文件 发现问题 - 方块 '' 的 'stackable_block' 行为缺少必需的 'items' 参数" warning.config.block.behavior.fence_gate.missing_facing: "在文件 发现问题 - 方块 '' 的 'fence_gate_block' 行为缺少必需的 'facing' 属性" warning.config.block.behavior.fence_gate.missing_in_wall: "在文件 发现问题 - 方块 '' 的 'fence_gate_block' 行为缺少必需的 'in_wall' 属性" diff --git a/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileMeta.java b/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileMeta.java index b8fdd6628..4dbefc9b4 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileMeta.java +++ b/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileMeta.java @@ -1,5 +1,6 @@ package net.momirealms.craftengine.core.entity.projectile; +import net.momirealms.craftengine.core.entity.Billboard; import net.momirealms.craftengine.core.entity.ItemDisplayContext; import net.momirealms.craftengine.core.util.Key; import org.jetbrains.annotations.Nullable; @@ -8,6 +9,7 @@ import org.joml.Vector3f; public record ProjectileMeta(Key item, ItemDisplayContext displayType, + Billboard billboard, Vector3f scale, Vector3f translation, Quaternionf rotation, diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java b/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java index 629f0422b..4970d9978 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java @@ -1,5 +1,6 @@ package net.momirealms.craftengine.core.item; +import net.momirealms.craftengine.core.entity.Billboard; import net.momirealms.craftengine.core.entity.ItemDisplayContext; import net.momirealms.craftengine.core.entity.projectile.ProjectileMeta; import net.momirealms.craftengine.core.entity.projectile.ProjectileType; @@ -324,12 +325,13 @@ public class ItemSettings { Map args = MiscUtils.castToMap(value, false); Key customTridentItemId = Key.of(Objects.requireNonNull(args.get("item"), "'item should not be null'").toString()); ItemDisplayContext displayType = ItemDisplayContext.valueOf(args.getOrDefault("display-transform", "NONE").toString().toUpperCase(Locale.ENGLISH)); + Billboard billboard = Billboard.valueOf(args.getOrDefault("billboard", "FIXED").toString().toUpperCase(Locale.ENGLISH)); Vector3f translation = MiscUtils.getAsVector3f(args.getOrDefault("translation", "0"), "translation"); Vector3f scale = MiscUtils.getAsVector3f(args.getOrDefault("scale", "1"), "scale"); Quaternionf rotation = MiscUtils.getAsQuaternionf(ResourceConfigUtils.get(args, "rotation-left", "rotation"), "rotation-left"); ProjectileType type = Optional.ofNullable(args.get("type")).map(String::valueOf).map(it -> ProjectileType.valueOf(it.toUpperCase(Locale.ENGLISH))).orElse(null); double range = ResourceConfigUtils.getAsDouble(args.getOrDefault("range", 1), "range"); - return settings -> settings.projectileMeta(new ProjectileMeta(customTridentItemId, displayType, scale, translation, rotation, range, type)); + return settings -> settings.projectileMeta(new ProjectileMeta(customTridentItemId, displayType, billboard, scale, translation, rotation, range, type)); })); registerFactory("helmet", (value -> { Map args = MiscUtils.castToMap(value, false); 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 438d489a9..f80cd2d4c 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 @@ -406,6 +406,11 @@ public abstract class AbstractPackManager implements PackManager { plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/entity/equipment/wings/flame_elytra.png"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/cap.png"); plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/item/custom/cap.json"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/item/custom/pebble.png"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/textures/block/custom/pebble.png"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_1.json"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_2.json"); + plugin.saveResource("resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_3.json"); // ores plugin.saveResource("resources/default/configuration/ores.yml");