Skip to content

Fix BBW block preview showing on all GT tools#5

Merged
tier940 merged 1 commit intomasterfrom
tier-fix-bbw-preview
Feb 12, 2026
Merged

Fix BBW block preview showing on all GT tools#5
tier940 merged 1 commit intomasterfrom
tier-fix-bbw-preview

Conversation

@tier940
Copy link
Member

@tier940 tier940 commented Feb 12, 2026

No description provided.

@tier940 tier940 self-assigned this Feb 12, 2026
@tier940 tier940 merged commit 7b904a1 into master Feb 12, 2026
0 of 2 checks passed
@tier940 tier940 deleted the tier-fix-bbw-preview branch February 12, 2026 13:40
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @tier940, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where the block preview functionality from Better Builder's Wands was erroneously active on all GregTech tools, regardless of whether they were actual wands. The changes introduce a mechanism to correctly identify wand tools and suppress the preview for non-wand GT tools, thereby improving user experience and preventing unintended visual clutter.

Highlights

  • BBW Block Preview Fix: Implemented a fix to prevent the Better Builder's Wands (BBW) block preview from incorrectly displaying on all GregTech (GT) tools, ensuring it only appears for actual wand tools.
Changelog
  • CHANGELOG.md
    • Added new version v1.1.2 entry.
    • Included a fix for BBW block preview showing on all GT tools.
  • src/main/java/com/github/gtexpert/gtmt/mixins/bbw/ItemGTToolWandMixin.java
    • Modified the getWand method to conditionally return an IWand implementation.
    • Introduced logic to return an IWand with getMaxBlocks returning 0 for non-wand GT tools, effectively suppressing the BBW preview.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、Better Builder's Wandsのブロックプレビューがワンドだけでなく、すべてのGregTechツールで表示されてしまう問題を正しく修正しています。ItemGTToolWandMixinの変更は、ワンドではないツールに対してダミーのIWand実装を返すことで、プレビューを効果的に抑制しており、適切な修正です。

レビューでは、ItemGTToolWandMixin.javaに対して2つの改善提案をさせていただきました。1つ目は、リポジトリのスタイルガイドに準拠するためのコメントのスタイル修正です。2つ目は、パフォーマンス向上のため、繰り返し生成されるオブジェクトを静的な定数に置き換える提案です。

Comment on lines +79 to +90
return new IWand() {

@Override
public int getMaxBlocks(ItemStack itemStack) {
return 0;
}

@Override
public boolean placeBlock(ItemStack itemStack, EntityLivingBase entity) {
return false;
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

この実装では、getWand()が非ワンドツールに対して呼び出されるたびに、新しい無名クラスのインスタンスが生成されます。このメソッドはプレビューのレンダリングなどで頻繁に呼び出される可能性があるため、パフォーマンスに影響を与える可能性があります。

このダミーのIWandはステートレスなので、static finalな定数として一度だけインスタンス化し、それを返すようにリファクタリングすることで、不要なオブジェクト生成を避けることができます。

例:

public abstract class ItemGTToolWandMixin implements IWandItem {
    private static final IWand DUMMY_WAND = new IWand() {
        @Override
        public int getMaxBlocks(ItemStack itemStack) { return 0; }

        @Override
        public boolean placeBlock(ItemStack itemStack, EntityLivingBase entity) { return false; }
    };

    // ...

    @Override
    public IWand getWand() {
        if (!gtexpert$isWandTool()) {
            return DUMMY_WAND;
        }
        // ...
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant