Skip to content

Add spectral weapon launcher 添加幻灵武器发射器#3399

Open
QiuShui1012 wants to merge 6 commits intoAnvil-Dev:dev/1.21/1.6from
QiuShui1012:spectral/1.21/1.6
Open

Add spectral weapon launcher 添加幻灵武器发射器#3399
QiuShui1012 wants to merge 6 commits intoAnvil-Dev:dev/1.21/1.6from
QiuShui1012:spectral/1.21/1.6

Conversation

@QiuShui1012
Copy link
Copy Markdown
Contributor

@QiuShui1012 QiuShui1012 commented Apr 10, 2026

- 添加幻灵武器发射器物品及渲染器,实现专属手持动画和装弹渲染
- 幻灵武器发射器消耗能量发射弹药,封装能量存储和能量条显示逻辑
- 增加能量组件ModComponents.STORED_ENERGY的注册及能量道具叠加支持
- 修改幻灵弹弓以兼容新的能量系统,更新弹药判断与发射弱化攻击逻辑
- 新增幻灵武器发射器的合成配方和解锁进度
- 增加物品工具提示支持显示剩余能量信息
- 服务器端玩家逻辑tick中添加幻灵武器发射器能量充能和逻辑更新
- 修改相关模型资源,实现能量耗尽时模型切换展示
- 优化数据生成工具,支持为带能量的物品批量生成测试样例与标签
- 调整各相关类的导入和调用关系,完善UI呈现和功能集成
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the new Spectral Weapon Launcher energy weapon (as an upgrade crafted via the Energy Weapon Platform), plus supporting rendering/model/tooltip updates and a small gravity-type refactor.

Changes:

  • Introduce spectral_weapon_launcher item with energy consumption, supercapacitor auto-refill, custom exhausted model, and custom item rendering.
  • Fix/adjust spectral slingshot projectile damage scaling and loaded-ammo model rendering (resonator display issue).
  • Refactor gravity typing into a shared enum with scalar multipliers; add a generic “stored energy” tooltip line.

Reviewed changes

Copilot reviewed 20 out of 26 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/main/resources/assets/anvilcraft/models/item/spectral_weapon_launcher.json Adds custom_model_data override to swap to exhausted model.
src/main/resources/anvilcraft.mixins.json Registers new mixin (currently in common mixin list).
src/main/java/dev/dubhe/anvilcraft/util/GravityType.java New gravity-type enum with scalar multipliers.
src/main/java/dev/dubhe/anvilcraft/util/GravityManager.java Uses GravityType scalar to scale gravity vector.
src/main/java/dev/dubhe/anvilcraft/util/DataGenUtil.java Adds creative-tab helper to emit empty/full-energy item variants.
src/main/java/dev/dubhe/anvilcraft/mixin/ModelBakeryMixin.java Wraps baked override models so custom BEWLR model wrapping applies to override models too.
src/main/java/dev/dubhe/anvilcraft/mixin/FallingBlockMixin.java Updates gravity type reference to new enum.
src/main/java/dev/dubhe/anvilcraft/mixin/EntityMixin.java Simplifies gravity scaling using scalar multiplier.
src/main/java/dev/dubhe/anvilcraft/item/weapon/SpectralWeaponLauncherItem.java New energy weapon item: energy drain per shot, auto-refill, custom model switching, HUD bar.
src/main/java/dev/dubhe/anvilcraft/item/weapon/package-info.java Adds non-null defaults for the weapon package.
src/main/java/dev/dubhe/anvilcraft/item/SpectralSlingshotItem.java Enables per-weapon damage amplification and improves ammo selection/shooting behavior.
src/main/java/dev/dubhe/anvilcraft/init/item/ModItems.java Registers spectral_weapon_launcher; adds creative-tab energy variants for launcher/railgun.
src/main/java/dev/dubhe/anvilcraft/event/PlayerTickEventHandler.java Hooks launcher refill logic into server player tick.
src/main/java/dev/dubhe/anvilcraft/entity/SpectralProjectileEntity.java Adds damage amplification parameter to projectile factory.
src/main/java/dev/dubhe/anvilcraft/data/recipe/EnergyWeaponMakeRecipeLoader.java Adds energy-weapon-make recipe for the launcher.
src/main/java/dev/dubhe/anvilcraft/data/lang/ToolPropertyLang.java Adds stored-energy tooltip translation key.
src/main/java/dev/dubhe/anvilcraft/client/renderer/item/WrappingItemCustomRenderedModels.java Adds model wrapping for launcher and exhausted launcher inventory models.
src/main/java/dev/dubhe/anvilcraft/client/renderer/item/SpectralWeaponLauncherRenderer.java New BEWLR for launcher (including rendering loaded ammo).
src/main/java/dev/dubhe/anvilcraft/client/renderer/item/SpectralSlingshotRenderer.java Resolves ammo model overrides when rendering loaded ammo.
src/main/java/dev/dubhe/anvilcraft/api/tooltip/ItemTooltipManager.java Adds generic stored-energy tooltip line + supports formatting arguments.
src/generated/resources/data/minecraft/tags/item/enchantable/durability.json Adds launcher to durability-enchantable tag.
src/generated/resources/data/minecraft/tags/item/enchantable/crossbow.json Adds launcher to crossbow-enchantable tag.
src/generated/resources/data/anvilcraft/recipe/energy_weapon_make/spectral_weapon_launcher.json Generated recipe data for launcher.
src/generated/resources/data/anvilcraft/advancement/recipes/energy_weapon_make/spectral_weapon_launcher.json Generated recipe advancement unlock.
src/generated/resources/assets/anvilcraft/lang/en_us.json Generated EN translation for launcher and stored-energy tooltip.
src/generated/resources/assets/anvilcraft/lang/en_ud.json Generated upside-down EN translation for launcher and stored-energy tooltip.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/resources/anvilcraft.mixins.json
Comment thread src/main/java/dev/dubhe/anvilcraft/mixin/ModelBakeryMixin.java Outdated
…ate energy consumption logic in SpectralWeaponLauncherItem
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 26 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 26 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +29 to +34
public SpectralWeaponLauncherItem(Properties properties) {
super(
properties
.component(ModComponents.STORED_ENERGY, 0)
.component(DataComponents.CUSTOM_MODEL_DATA, new CustomModelData(SpectralWeaponLauncherItem.EXHAUSTED_MODEL))
);
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CUSTOM_MODEL_DATA is initialized to the exhausted value in the item properties, but stacks produced by the energy-weapon crafting path can have STORED_ENERGY set to full (e.g. EnergyWeaponMakeRecipe.assemble sets it to 320000) without updating model data. This can leave a fully-charged launcher rendering as "exhausted" until some later code path flips CUSTOM_MODEL_DATA. Consider defaulting CUSTOM_MODEL_DATA to CustomModelData.DEFAULT and only setting the exhausted model when energy is below SHOOT_CONSUME (e.g. in inventoryTick/onCraftedBy), or otherwise ensuring every place that charges/creates the item also synchronizes CUSTOM_MODEL_DATA with the energy value.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TODO] 幻灵武器发射器 [Bug] 幻灵弹弓与共振器的装填模型

2 participants