Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of AoE Blacklist for Tinker's Construct Tools #121

Merged
merged 18 commits into from
Jul 30, 2024
Merged

Implementation of AoE Blacklist for Tinker's Construct Tools #121

merged 18 commits into from
Jul 30, 2024

Conversation

AlexanderChenhall
Copy link

This feature would enhance control over tool behavior and can prevent accidental destruction of important blocks, think accidentally breaking a wall of chests with a lumber axe, or destroying your Smeltery Controller when breaking Seared brick blocks.

Key Changes:
Created new class under tconstruct.library.util to handle loading and checking exclusions for AoE tool effects.

Lists are determined by a config (preferably pre-set with desired defaults).
Lists are separated into exclusions lists for individual tools, so a separate blacklist can exist for the hammer, separate from the excavator or lumberaxe.

Updated the AOEHarvestTool class to add a check before breaking blocks via AoE, of course keeps original functionality.

Did the whole gauntlet of gradle tests, no issues. Of course i may have missed something so feel free to have a look and/or reject if there was an oversight or you feel it wouldn't fit within the mod/pack as present.

Example of the config file:

# Configuration file

aoe_exclusions {
    # Block IDs that should not be broken by tool.excavator's AOE effect [default: ]
    S:tool.excavatorExclusions <
        examplemod:exampleblock
     >

    # Block IDs that should not be broken by tool.hammer's AOE effect [default: ]
    S:tool.hammerExclusions <
        minecraft:furnace
        minecraft:ender_chest
        TConstruct:ToolForgeBlock
        catwalks:scaffold
     >

    # Block IDs that should not be broken by tool.lumberaxe's AOE effect [default: ]
    S:tool.lumberaxeExclusions <
        minecraft:chest
     >
}

AlexanderChenhall and others added 8 commits July 30, 2024 13:22
- Created AoEExclusionList class in tconstruct.library.util package
- Added config file loading for tool-specific block exclusions
- Modified AOEHarvestTool class to check exclusions before breaking blocks
- Updated Hammer class to use new exclusion system
- Added debug logging for troubleshooting

This change allows users to specify blocks that should not be broken by the AoE effect of tools like the Hammer, while still allowing the targeted block to be broken.
- Created AoEExclusionList class in tconstruct.library.util package
- Added config file loading for tool-specific block exclusions
- Modified AOEHarvestTool class to check exclusions before breaking blocks
- Updated Hammer class to use new exclusion system
- Added debug logging for troubleshooting

This change allows users to specify blocks that should not be broken by the AoE effect of tools like the Hammer, while still allowing the targeted block to be broken.
# Conflicts:
#	src/main/java/tconstruct/library/tools/AOEHarvestTool.java
#	src/main/java/tconstruct/library/util/AoEExclusionList.java
Added example formatting for config file.
Inlined Variable
@Dream-Master Dream-Master requested a review from a team July 30, 2024 07:27
Copy link

@OneEyeMaker OneEyeMaker left a comment

Choose a reason for hiding this comment

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

Good start.

Please make tool names consistent and clean up code.

Also I suggest to extend functionality of the blacklist to allow blacklisting blocks only with specific metadata.

src/main/java/tconstruct/library/tools/AOEHarvestTool.java Outdated Show resolved Hide resolved
src/main/java/tconstruct/library/tools/AOEHarvestTool.java Outdated Show resolved Hide resolved
src/main/java/tconstruct/library/tools/AOEHarvestTool.java Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@AlexanderChenhall
Copy link
Author

I'm back to say I've (hopefully) addressed all the issues you raised.
Additionally, there is now support for metadata. So you could for example, blacklist catwalks:scaffold:1 and not catwalks:scaffold

Copy link

@OneEyeMaker OneEyeMaker left a comment

Choose a reason for hiding this comment

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

Good job!

In current state this feature works completely fine (tested).
As I said before, it would be nice to have option to blacklist blocks with specific metadata.
I wrote this comment just a second before your last commit. Now feature is complete.
Thank you for work!

@Dream-Master
Copy link
Member

@AlexanderChenhall can you make a config in the Modpack repo so we can use this feature. Maybe ask around which blocks should be set as standard

@AlexanderChenhall
Copy link
Author

Before anything there is one more commit.
For some reason my IDE automatically changed
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

to

import java.util.*

Should be fixed now.

@AlexanderChenhall
Copy link
Author

@AlexanderChenhall can you make a config in the Modpack repo so we can use this feature. Maybe ask around which blocks should be set as standard

Yes sir 🫡

@Dream-Master Dream-Master merged commit 1a97bff into GTNewHorizons:master Jul 30, 2024
1 check passed
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.

3 participants