From dfac8503cbb2afff48f6f5795cdc3f6923d0c894 Mon Sep 17 00:00:00 2001 From: XiaoMoMi Date: Sat, 21 Jun 2025 19:17:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B6=E4=BB=96=E5=BC=B9?= =?UTF-8?q?=E5=B0=84=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bukkit/block/BukkitBlockManager.java | 13 +- .../projectile/BukkitCustomProjectile.java | 6 + .../projectile/BukkitProjectileManager.java | 21 +- .../item/recipe/BukkitRecipeManager.java | 17 +- .../handler/ProjectilePacketHandler.java | 14 +- .../resources/default/configuration/items.yml | 201 ++++++++++++------ .../default/configuration/palm_tree.yml | 166 +++++++-------- .../models/block/custom/pebble_1.json | 75 +++++++ .../models/block/custom/pebble_2.json | 90 ++++++++ .../models/block/custom/pebble_3.json | 90 ++++++++ .../textures/block/custom/pebble.png | Bin 0 -> 988 bytes .../entity/projectile/ProjectileManager.java | 2 +- .../core/pack/model/LegacyOverridesModel.java | 2 +- .../plugin/config/StringKeyConstructor.java | 1 + .../context/function/CommonFunctions.java | 4 +- .../gui/category/ItemBrowserManagerImpl.java | 2 - 16 files changed, 515 insertions(+), 189 deletions(-) create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_1.json create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_2.json create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_3.json create mode 100644 common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pebble.png diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/BukkitBlockManager.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/BukkitBlockManager.java index 1a04bf68e..243afe7d1 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/BukkitBlockManager.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/block/BukkitBlockManager.java @@ -615,17 +615,16 @@ public class BukkitBlockManager extends AbstractBlockManager { if (!Files.exists(mappingsFile)) { this.plugin.saveResource("mappings.yml"); } - File mappingFile = new File(plugin.dataFolderFile(), "mappings.yml"); - Yaml yaml = new Yaml(new StringKeyConstructor(null, new LoaderOptions())); + Yaml yaml = new Yaml(new StringKeyConstructor(mappingsFile, new LoaderOptions())); try (InputStream inputStream = Files.newInputStream(mappingsFile)) { Map blockStateMappings = loadBlockStateMappings(yaml.load(inputStream)); - this.validateBlockStateMappings(mappingFile, blockStateMappings); + this.validateBlockStateMappings(mappingsFile, blockStateMappings); Map stateMap = new Int2ObjectOpenHashMap<>(); Map blockTypeCounter = new LinkedHashMap<>(); Map appearanceMapper = new Int2IntOpenHashMap(); Map> appearanceArranger = new HashMap<>(); for (Map.Entry entry : blockStateMappings.entrySet()) { - this.processBlockStateMapping(mappingFile, entry, stateMap, blockTypeCounter, appearanceMapper, appearanceArranger); + this.processBlockStateMapping(mappingsFile, entry, stateMap, blockTypeCounter, appearanceMapper, appearanceArranger); } this.blockAppearanceMapper = ImmutableMap.copyOf(appearanceMapper); this.blockAppearanceArranger = ImmutableMap.copyOf(appearanceArranger); @@ -679,7 +678,7 @@ public class BukkitBlockManager extends AbstractBlockManager { return blockStateMappings; } - private void validateBlockStateMappings(File mappingFile, Map blockStateMappings) { + private void validateBlockStateMappings(Path mappingFile, Map blockStateMappings) { Map temp = new HashMap<>(blockStateMappings); for (Map.Entry entry : temp.entrySet()) { String state = entry.getValue(); @@ -690,7 +689,7 @@ public class BukkitBlockManager extends AbstractBlockManager { } } - private void processBlockStateMapping(File mappingFile, + private void processBlockStateMapping(Path mappingFile, Map.Entry entry, Map stateMap, Map counter, @@ -725,7 +724,7 @@ public class BukkitBlockManager extends AbstractBlockManager { } } - private Object createBlockState(File mappingFile, String state) { + private Object createBlockState(Path mappingFile, String state) { try { Object registryOrLookUp = MBuiltInRegistries.BLOCK; if (CoreReflections.method$Registry$asLookup != null) { diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitCustomProjectile.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitCustomProjectile.java index a75f4ee63..a940f328b 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitCustomProjectile.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitCustomProjectile.java @@ -16,4 +16,10 @@ public class BukkitCustomProjectile extends AbstractCustomProjectile { public BukkitProjectile projectile() { return (BukkitProjectile) super.projectile(); } + + @SuppressWarnings("unchecked") + @Override + public Item item() { + return (Item) item; + } } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitProjectileManager.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitProjectileManager.java index a36e23b0e..4ce2fbe2a 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitProjectileManager.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/entity/projectile/BukkitProjectileManager.java @@ -2,6 +2,7 @@ package net.momirealms.craftengine.bukkit.entity.projectile; import com.destroystokyo.paper.event.entity.EntityAddToWorldEvent; import com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent; +import com.destroystokyo.paper.event.player.PlayerReadyArrowEvent; import io.papermc.paper.event.player.PlayerStopUsingItemEvent; import net.momirealms.craftengine.bukkit.item.BukkitItemManager; import net.momirealms.craftengine.bukkit.nms.FastNMS; @@ -65,7 +66,7 @@ public class BukkitProjectileManager implements Listener, ProjectileManager { } @Override - public Optional projectileByEntityId(int entityId) { + public Optional projectileByEntityId(int entityId) { return Optional.ofNullable(this.projectiles.get(entityId)); } @@ -191,14 +192,18 @@ public class BukkitProjectileManager implements Listener, ProjectileManager { this.cachedServerEntity = serverEntity; } - boolean inGround = FastNMS.INSTANCE.method$AbstractArrow$isInGround(nmsEntity); - if (canSpawnParticle(nmsEntity, inGround)) { - this.projectile.getWorld().spawnParticle(ParticleUtils.BUBBLE, this.projectile.getLocation(), 3, 0.1, 0.1, 0.1, 0); - } - if (inGround) { - updateProjectileUpdateInterval(Integer.MAX_VALUE); - } else { + if (!CoreReflections.clazz$AbstractArrow.isInstance(nmsEntity)) { updateProjectileUpdateInterval(1); + } else { + boolean inGround = FastNMS.INSTANCE.method$AbstractArrow$isInGround(nmsEntity); + if (canSpawnParticle(nmsEntity, inGround)) { + this.projectile.getWorld().spawnParticle(ParticleUtils.BUBBLE, this.projectile.getLocation(), 3, 0.1, 0.1, 0.1, 0); + } + if (inGround) { + updateProjectileUpdateInterval(Integer.MAX_VALUE); + } else { + updateProjectileUpdateInterval(1); + } } } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/recipe/BukkitRecipeManager.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/recipe/BukkitRecipeManager.java index 9560179ce..c6b7f7fed 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/recipe/BukkitRecipeManager.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/recipe/BukkitRecipeManager.java @@ -303,13 +303,14 @@ public class BukkitRecipeManager extends AbstractRecipeManager { public void unload() { if (!Config.enableRecipeSystem()) return; super.unload(); - try { - if (VersionHelper.isOrAbove1_21_2()) { - // TODO: 排查为什么会出现并发修改问题 - CoreReflections.method$RecipeManager$finalizeRecipeLoading.invoke(nmsRecipeManager); - } - } catch (ReflectiveOperationException e) { - this.plugin.logger().warn("Failed to unregister recipes", e); + if (VersionHelper.isOrAbove1_21_2()) { + this.plugin.scheduler().executeSync(() -> { + try { + CoreReflections.method$RecipeManager$finalizeRecipeLoading.invoke(nmsRecipeManager); + } catch (ReflectiveOperationException e) { + this.plugin.logger().warn("Failed to unregister recipes", e); + } + }); } } @@ -435,7 +436,7 @@ public class BukkitRecipeManager extends AbstractRecipeManager { } } } catch (Exception e) { - plugin.logger().warn("Failed to read data pack recipes", e); + this.plugin.logger().warn("Failed to read data pack recipes", e); } } 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 3d671ff0a..32e45409f 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 @@ -1,6 +1,8 @@ package net.momirealms.craftengine.bukkit.plugin.network.handler; +import net.momirealms.craftengine.bukkit.block.BukkitBlockManager; import net.momirealms.craftengine.bukkit.entity.data.ItemDisplayEntityData; +import net.momirealms.craftengine.bukkit.entity.projectile.BukkitCustomProjectile; import net.momirealms.craftengine.bukkit.item.BukkitItemManager; import net.momirealms.craftengine.bukkit.nms.FastNMS; import net.momirealms.craftengine.bukkit.plugin.injector.ProtectedFieldVisitor; @@ -26,11 +28,11 @@ import java.util.UUID; public class ProjectilePacketHandler implements EntityPacketHandler { private final int entityId; - private final CustomProjectile projectile; + private final BukkitCustomProjectile projectile; private final Object cachedPacket; private final List cachedData; - public ProjectilePacketHandler(CustomProjectile projectile, int entityId) { + public ProjectilePacketHandler(BukkitCustomProjectile projectile, int entityId) { this.projectile = projectile; this.entityId = entityId; this.cachedData = createCustomProjectileEntityDataValues(); @@ -111,7 +113,7 @@ public class ProjectilePacketHandler implements EntityPacketHandler { Optional> customItem = BukkitItemManager.instance().getCustomItem(this.projectile.metadata().item()); if (customItem.isEmpty()) return itemDisplayValues; ProjectileMeta meta = this.projectile.metadata(); - Item displayedItem = customItem.get().buildItem(ItemBuildContext.EMPTY); + Item displayedItem = customItem.get().buildItem(ItemBuildContext.EMPTY); // 我们应当使用新的展示物品的组件覆盖原物品的组件,以完成附魔,附魔光效等组件的继承 displayedItem = this.projectile.item().mergeCopy(displayedItem); ItemDisplayEntityData.InterpolationDelay.addEntityDataIfNotDefaultValue(-1, itemDisplayValues); @@ -124,7 +126,11 @@ public class ProjectilePacketHandler implements EntityPacketHandler { } else { ItemDisplayEntityData.InterpolationDuration.addEntityDataIfNotDefaultValue(1, itemDisplayValues); } - ItemDisplayEntityData.DisplayedItem.addEntityDataIfNotDefaultValue(displayedItem.getLiteralObject(), itemDisplayValues); + + Object literalItem = displayedItem.getLiteralObject(); + BukkitItemManager.instance().s2c(displayedItem.getItem(), null).ifPresentOrElse( + it -> ItemDisplayEntityData.DisplayedItem.addEntityDataIfNotDefaultValue(FastNMS.INSTANCE.field$CraftItemStack$handle(it), itemDisplayValues), + () -> ItemDisplayEntityData.DisplayedItem.addEntityDataIfNotDefaultValue(literalItem, itemDisplayValues)); ItemDisplayEntityData.DisplayType.addEntityDataIfNotDefaultValue(meta.displayType().id(), itemDisplayValues); return itemDisplayValues; } diff --git a/common-files/src/main/resources/resources/default/configuration/items.yml b/common-files/src/main/resources/resources/default/configuration/items.yml index ebeb08279..c44aad2fb 100644 --- a/common-files/src/main/resources/resources/default/configuration/items.yml +++ b/common-files/src/main/resources/resources/default/configuration/items.yml @@ -155,57 +155,127 @@ items#topaz_gears: template: default:model/simplified_handheld arguments: path: minecraft:item/custom/topaz_sword - default:topaz_helmet: - template: default:armor/topaz - arguments: - part: helmet - slot: head - default:topaz_chestplate: - template: default:armor/topaz - arguments: - part: chestplate - slot: chest - default:topaz_leggings: - template: default:armor/topaz - arguments: - part: leggings - slot: legs - default:topaz_boots: - template: default:armor/topaz - arguments: - part: boots - slot: feet - default:topaz_trident: - material: trident - custom-model-data: 1000 - settings: - projectile: - item: default:topaz_trident - translation: 0,0,0 - rotation: 1,1,1,1 - display-transform: NONE - scale: 0.5 - tags: - - default:topaz_tools - data: - item-name: <#FF8C00> - tooltip-style: minecraft:topaz - model: - type: minecraft:select - property: minecraft:display_context - cases: - - when: - - gui - - ground - - fixed - model: + $$>=1.21.2#armor: + default:topaz_helmet: + template: default:armor/topaz + arguments: + part: helmet + slot: head + default:topaz_chestplate: + template: default:armor/topaz + arguments: + part: chestplate + slot: chest + default:topaz_leggings: + template: default:armor/topaz + arguments: + part: leggings + slot: legs + default:topaz_boots: + template: default:armor/topaz + arguments: + part: boots + slot: feet + $$>=1.21.4#topaz_trident: + default:topaz_trident: + material: trident + custom-model-data: 1000 + settings: + projectile: + item: default:topaz_trident + translation: 0,0,0 + rotation: 1,1,1,1 + display-transform: NONE + scale: 0.5 + tags: + - default:topaz_tools + data: + item-name: <#FF8C00> + tooltip-style: minecraft:topaz + model: + type: minecraft:select + property: minecraft:display_context + cases: + - when: + - gui + - ground + - fixed + model: + type: minecraft:model + path: minecraft:item/custom/topaz_trident + generation: + parent: minecraft:item/generated + textures: + layer0: minecraft:item/custom/topaz_trident + fallback: + type: minecraft:condition + property: minecraft:using_item + on-true: type: minecraft:model - path: minecraft:item/custom/topaz_trident - generation: - parent: minecraft:item/generated - textures: - layer0: minecraft:item/custom/topaz_trident - fallback: + path: minecraft:item/custom/topaz_trident_throwing + on-false: + type: minecraft:model + path: minecraft:item/custom/topaz_trident_in_hand + legacy-model: + path: minecraft:item/custom/topaz_trident_in_hand + overrides: + - path: minecraft:item/custom/topaz_trident_throwing + predicate: + throwing: 1 + $$1.21.2~1.21.3#topaz_trident: + default:topaz_trident: + material: honey_bottle + custom-model-data: 1000 + settings: + projectile: + item: default:topaz_trident + translation: 0,0,0 + rotation: 1,1,1,1 + display-transform: NONE + scale: 0.5 + type: trident + throwing-item-in-hand: default:topaz_trident_throwing_in_hand + tags: + - default:topaz_tools + data: + item-name: <#FF8C00> + tooltip-style: minecraft:topaz + components: + minecraft:max_stack_size: 1 + minecraft:consumable: + animation: spear + has_consume_particles: false + consume_seconds: 128000 + minecraft:food: + nutrition: 0 + saturation: 0.0 + can_always_eat: true + model: + type: minecraft:model + path: minecraft:item/custom/topaz_trident_in_hand + default:topaz_trident_throwing_in_hand: + material: honey_bottle + custom-model-data: 1001 + model: + type: minecraft:model + path: minecraft:item/custom/topaz_trident_throwing + $$1.20.1~1.21.1#topaz_trident: + default:topaz_trident: + material: trident + client-bound-material: bow + custom-model-data: 1001 + data: + item-name: <#FF8C00> + settings: + projectile: + item: default:topaz_trident + translation: 0,0,0 + rotation: 1,1,1,1 + display-transform: NONE + scale: 0.5 + tags: + - default:topaz_tools + model: type: minecraft:condition property: minecraft:using_item on-true: @@ -214,21 +284,22 @@ items#topaz_gears: on-false: type: minecraft:model path: minecraft:item/custom/topaz_trident_in_hand - default:flame_elytra: - material: elytra - custom-model-data: 1000 - settings: - equippable: - slot: chest - asset-id: flame - wings: flame_elytra - data: - item-name: <#FF8C00> - model: - template: default:model/simplified_elytra - arguments: - path: minecraft:item/custom/flame_elytra - broken_path: minecraft:item/custom/broken_flame_elytra + $$>=1.21.2#flame_elytra: + default:flame_elytra: + material: elytra + custom-model-data: 1000 + settings: + equippable: + slot: chest + asset-id: flame + wings: flame_elytra + data: + item-name: <#FF8C00> + model: + template: default:model/simplified_elytra + arguments: + path: minecraft:item/custom/flame_elytra + broken_path: minecraft:item/custom/broken_flame_elytra default:cap: material: leather_helmet client-bound-material: leather_horse_armor 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 982001df1..802065e4a 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 @@ -380,51 +380,37 @@ items: model_top_left_path: minecraft:block/custom/palm_door_top_left model_top_left_generation: parent: minecraft:block/door_top_left - textures: + textures: &textures 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/custom/palm_door_bottom - top: minecraft:block/custom/palm_door_top + textures: *textures 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/custom/palm_door_bottom - top: minecraft:block/custom/palm_door_top + textures: *textures 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/custom/palm_door_bottom - top: minecraft:block/custom/palm_door_top + textures: *textures 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/custom/palm_door_bottom - top: minecraft:block/custom/palm_door_top + textures: *textures 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/custom/palm_door_bottom - top: minecraft:block/custom/palm_door_top + textures: *textures 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/custom/palm_door_bottom - top: minecraft:block/custom/palm_door_top + textures: *textures 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/custom/palm_door_bottom - top: minecraft:block/custom/palm_door_top + textures: *textures default:palm_fence_gate: material: nether_brick custom-model-data: 1008 @@ -452,11 +438,10 @@ items: settings: template: - default:sound/wood + - default:hardness/planks overrides: map-color: 2 instrument: bass - hardness: 2.0 - resistance: 3.0 burnable: true tags: - minecraft:fence_gates @@ -506,11 +491,10 @@ items: template: - default:sound/wood - default:burn_data/planks + - default:hardness/planks overrides: map-color: 2 instrument: bass - hardness: 2.0 - resistance: 3.0 tags: - minecraft:wooden_slabs - minecraft:slabs @@ -522,67 +506,66 @@ items: model_bottom_path: minecraft:block/custom/palm_slab model_bottom_generation: parent: minecraft:block/slab - textures: + textures: &textures bottom: minecraft:block/custom/palm_planks side: minecraft:block/custom/palm_planks top: minecraft:block/custom/palm_planks model_top_path: minecraft:block/custom/palm_slab_top model_top_generation: parent: minecraft:block/slab_top - textures: - bottom: minecraft:block/custom/palm_planks - side: minecraft:block/custom/palm_planks - top: minecraft:block/custom/palm_planks + textures: *textures model_double_path: minecraft:block/custom/palm_planks - default:palm_stairs: - material: nether_brick - custom-model-data: 1013 - model: - type: minecraft:model - path: minecraft:item/custom/palm_stairs - generation: - parent: minecraft:block/custom/palm_stairs - data: - item-name: - behavior: - type: block_item - block: - loot: - template: default:loot_table/self - settings: - template: - - default:sound/wood - overrides: - map-color: 2 - instrument: bass - hardness: 2.0 - resistance: 3.0 - burnable: true - tags: - - minecraft:mineable/axe - - minecraft:stairs - - minecraft:wooden_stairs - behaviors: - type: stairs_block - states: - template: default:block_state/stairs - arguments: - base_block: cut_copper_stairs - model_stairs_inner_path: minecraft:block/custom/palm_stairs_inner - model_stairs_inner_generation: - parent: minecraft:block/inner_stairs - textures: &textures - bottom: &block_texture minecraft:block/custom/palm_planks - side: *block_texture - top: *block_texture - model_stairs_outer_path: minecraft:block/custom/palm_stairs_outer - model_stairs_outer_generation: - parent: minecraft:block/outer_stairs - textures: *textures - model_stairs_path: minecraft:block/custom/palm_stairs - model_stairs_generation: - parent: minecraft:block/stairs - textures: *textures + $$>=1.20.3#palm_stairs: + default:palm_stairs: + material: nether_brick + custom-model-data: 1013 + model: + type: minecraft:model + path: minecraft:item/custom/palm_stairs + generation: + parent: minecraft:block/custom/palm_stairs + data: + item-name: + settings: + fuel-time: 300 + behavior: + type: block_item + block: + loot: + template: default:loot_table/self + settings: + template: + - default:sound/wood + - default:hardness/planks + - default:burn_data/planks + overrides: + map-color: 2 + instrument: bass + tags: + - minecraft:mineable/axe + - minecraft:stairs + - minecraft:wooden_stairs + behaviors: + type: stairs_block + states: + template: default:block_state/stairs + arguments: + base_block: cut_copper_stairs + model_stairs_inner_path: minecraft:block/custom/palm_stairs_inner + model_stairs_inner_generation: + parent: minecraft:block/inner_stairs + textures: &textures + bottom: &block_texture minecraft:block/custom/palm_planks + side: *block_texture + top: *block_texture + model_stairs_outer_path: minecraft:block/custom/palm_stairs_outer + model_stairs_outer_generation: + parent: minecraft:block/outer_stairs + textures: *textures + model_stairs_path: minecraft:block/custom/palm_stairs + model_stairs_generation: + parent: minecraft:block/stairs + textures: *textures recipes: default:palm_planks: template: default:recipe/planks @@ -626,14 +609,15 @@ recipes: result: id: default:palm_slab count: 6 - default:palm_stairs: - type: shaped - pattern: - - 'A ' - - 'AA ' - - 'AAA' - ingredients: - A: default:palm_planks - result: - id: default:palm_stairs - count: 4 \ No newline at end of file + $$>=1.20.3#palm_stairs: + default:palm_stairs: + type: shaped + pattern: + - 'A ' + - 'AA ' + - 'AAA' + ingredients: + A: default:palm_planks + result: + id: default:palm_stairs + count: 4 \ No newline at end of file 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 new file mode 100644 index 000000000..9fb2e4f9e --- /dev/null +++ b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_1.json @@ -0,0 +1,75 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "1": "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"} + } + } + ], + "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] + } + ] +} \ 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 new file mode 100644 index 000000000..c769aeed3 --- /dev/null +++ b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_2.json @@ -0,0 +1,90 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [32, 32], + "textures": { + "2": "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]}, + "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"} + } + }, + { + "from": [8, 0, 5], + "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"} + } + }, + { + "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": [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"} + } + } + ], + "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 new file mode 100644 index 000000000..515e6cc87 --- /dev/null +++ b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/models/block/custom/pebble_3.json @@ -0,0 +1,90 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [32, 32], + "textures": { + "2": "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]}, + "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"} + } + }, + { + "from": [7, 0, 4], + "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"} + } + }, + { + "from": [6, 0, 9], + "to": [11, 2, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 1]}, + "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"} + } + } + ], + "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/resources/default/resourcepack/assets/minecraft/textures/block/custom/pebble.png b/common-files/src/main/resources/resources/default/resourcepack/assets/minecraft/textures/block/custom/pebble.png new file mode 100644 index 0000000000000000000000000000000000000000..003a947ddf00057a3f5cc6bd946a9cff64269f26 GIT binary patch literal 988 zcmV<210(#2P)Px&mPtfGR9JB@^7; zPq1yb004vW424|U8IVEQYzCcf&*>2iMh8I|(;p@njAs~(|6sqe<0;eWw%x)gnXEat z*$eZ@p%h4&i8Rx0;?@2oK$76mn@#PO?B&jZ`Y; z>8$5ylj+b#WPXcz>pA21yZhgsL!AyofrYS7zf1=WtYjB@gYnEgJ3cyadYvx3|CvVG z3^G7e%e%`8&UmcoprmsIY5)KVxikjjnM+B%cIdHZpsIVJJYAz(Ga;SRi7sIMKOIAK zhoOKBL>l`0_~cQjPbPz@mUof7OdW#|#ak@{U%!1%ou8l2N6EzbT1&xTJj2HiZ-Hf= zx9ye~DjAPv83ZAV)n+qmtTY;p)UTgE=JncQNEumN?N&1d0Q;4lxm1$fKrl#6D}&%1 z(1A%5^L8}}tL5D_0eLzGC!HoQQ!g!~Rzo}Y+7P1Z2~My5%8sMITHc*AYT5rG244f# zmT5E^Yf3y>ENcBfgU}aL==4Oi2(=Qw>rYlZ89F&VOYvq6-6s;Vm4g9DTIKZ8jKoeS zQ}OBZ7q6giZ?03fH>=-9(gtxK5Ntip_LI}I6b(S}B-U0ncNKzJ%0K+Jfk;9`r% zCKxJ_QqF%Fn07$cpxTisdGqf59Lp{OR+F%px46Bz_5+Ajd&oIuS!lBV2}$*)PI3WA zVY$i3ewT)LdbywgCCF=?sMijIOnL$6d!Ekv!__LKWn$1fBM-m;LPct%vV@-N(kP$r zRZ5;w=^U!AVg+g*y3cE;*aVpp-j-O>ErTrPtxLGuFazB8;GtWG5Ne=Lhv z-xIP{+O4J^05%K|ea$im8H}7E#A~YG1;Aa8igFLs1||JERWkp2d*X};6|>>h`}grF zT5J$kbZq|XWmDSH8?hGv0!1S8h*!3uP8XK%24py9!;n_FzxRhpl2 zLTi*5>gld0000< KMNUMnLSTX^KF2Kp literal 0 HcmV?d00001 diff --git a/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileManager.java b/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileManager.java index 12796743a..7c3c721e0 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileManager.java +++ b/core/src/main/java/net/momirealms/craftengine/core/entity/projectile/ProjectileManager.java @@ -6,5 +6,5 @@ import java.util.Optional; public interface ProjectileManager extends Manageable { - Optional projectileByEntityId(int entityId); + Optional projectileByEntityId(int entityId); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/model/LegacyOverridesModel.java b/core/src/main/java/net/momirealms/craftengine/core/pack/model/LegacyOverridesModel.java index 6d63b08f2..cbb4f5179 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/model/LegacyOverridesModel.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/model/LegacyOverridesModel.java @@ -17,7 +17,7 @@ public class LegacyOverridesModel implements Comparable { this.predicate = predicate == null ? new HashMap<>() : predicate; this.model = model; this.customModelData = customModelData; - if (customModelData > 0) { + if (customModelData > 0 && !this.predicate.containsKey("custom_model_data")) { this.predicate.put("custom_model_data", customModelData); } } diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/StringKeyConstructor.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/StringKeyConstructor.java index 6c55545b8..cd199e3e8 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/StringKeyConstructor.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/StringKeyConstructor.java @@ -139,6 +139,7 @@ public class StringKeyConstructor extends SafeConstructor { } private void logWarning(String keyInLocale, String configKey, Node node) { + if (this.path == null) return; TranslationManager.instance().log("warning.config.yaml." + keyInLocale, this.path.toAbsolutePath().toString(), configKey, diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/CommonFunctions.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/CommonFunctions.java index 7f490b6d9..8c0bc6435 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/CommonFunctions.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/context/function/CommonFunctions.java @@ -20,10 +20,10 @@ public final class CommonFunctions { public static final Key UPDATE_INTERACTION_TICK = Key.of("craftengine:update_interaction_tick"); public static final Key SET_COUNT = Key.of("craftengine:set_count"); public static final Key PLACE_BLOCK = Key.of("craftengine:place_block"); - public static final Key SET_FOOD = Key.of("craftengine:food"); + public static final Key SET_FOOD = Key.of("craftengine:set_food"); public static final Key SET_COOLDOWN = Key.of("craftengine:set_cooldown"); public static final Key REMOVE_COOLDOWN = Key.of("craftengine:remove_cooldown"); - public static final Key SET_SATURATION = Key.of("craftengine:saturation"); + public static final Key SET_SATURATION = Key.of("craftengine:set_saturation"); public static final Key DROP_LOOT = Key.of("craftengine:drop_loot"); public static final Key SWING_HAND = Key.of("craftengine:swing_hand"); public static final Key LEVELER_EXP = Key.of("craftengine:leveler_exp"); diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/gui/category/ItemBrowserManagerImpl.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/gui/category/ItemBrowserManagerImpl.java index ca5695c38..ae89f2462 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/gui/category/ItemBrowserManagerImpl.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/gui/category/ItemBrowserManagerImpl.java @@ -247,7 +247,6 @@ public class ItemBrowserManagerImpl implements ItemBrowserManager { Item item = this.plugin.itemManager().createWrappedItem(subCategory.icon(), player); if (item == null) { if (!subCategory.icon().equals(ItemKeys.AIR)) { - this.plugin.logger().warn("Can't find item " + subCategory.icon() + " as icon for sub category " + subCategoryId); item = this.plugin.itemManager().createWrappedItem(ItemKeys.BARRIER, player); item.customNameJson(AdventureHelper.componentToJson(AdventureHelper.miniMessage().deserialize(subCategory.displayName(), ItemBuildContext.EMPTY.tagResolvers()))); item.loreJson(subCategory.displayLore().stream().map(lore -> AdventureHelper.componentToJson(AdventureHelper.miniMessage().deserialize(lore, ItemBuildContext.EMPTY.tagResolvers()))).toList()); @@ -269,7 +268,6 @@ public class ItemBrowserManagerImpl implements ItemBrowserManager { boolean canGoFurther; if (item == null) { if (!itemId.equals(ItemKeys.AIR)) { - this.plugin.logger().warn("Can't find item " + itemId + " for category " + categoryId); item = this.plugin.itemManager().createWrappedItem(ItemKeys.BARRIER, player); item.customNameJson(AdventureHelper.componentToJson(Component.text(it).decoration(TextDecoration.ITALIC, TextDecoration.State.FALSE).color(NamedTextColor.RED))); }