-
Notifications
You must be signed in to change notification settings - Fork 164
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
Revamp tools #688
Revamp tools #688
Conversation
megacommit moment
- adds all classes for custom tools - fabric parity for forge extension methods, minus extra weird ones - custom behaviours - et cetera, contains lots of skill issues
CURRENT ISSUES: - torch place behavior voids your tool. - fabric doesn't have the capabilities attaching yet.
…rtBreak for fabric
if (player.level().isClientSide) return false; | ||
getToolStats().getBehaviors().forEach(behavior -> behavior.onBlockStartBreak(stack, pos, player)); | ||
|
||
if (!player.isCrouching()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend using several early returns in this method to reduce the nesting level
public final int column, row, layer; | ||
|
||
private AoESymmetrical() { | ||
this.column = 0; | ||
this.row = 0; | ||
this.layer = 0; | ||
} | ||
|
||
private AoESymmetrical(int column, int row, int layer) { | ||
this.column = column; | ||
this.row = row; | ||
this.layer = layer; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to move this to the top of the class imo
tag.putInt(ToolHelper.AOE_COLUMN_KEY, column); | ||
tag.putInt(ToolHelper.AOE_ROW_KEY, row); | ||
tag.putInt(ToolHelper.AOE_LAYER_KEY, layer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to write things back into the tag?
If yes, I'd suggest renaming the method to reflect that. Could be something similar to computeIfAbsent()
on maps maybe?
common/src/main/java/com/gregtechceu/gtceu/api/item/tool/aoe/AoESymmetrical.java
Outdated
Show resolved
Hide resolved
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class WaxOffBehavior implements IToolBehavior { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion to rename this to BlockUnwaxBehavior
common/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Mikerooni <[email protected]>
Co-authored-by: Mikerooni <[email protected]>
…oESymmetrical.java Co-authored-by: Mikerooni <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
funi pink crowbar go brrr
* aa why u crash * aa why u crash * holy shit this is worse than I thought... * god this is annoying to do megacommit moment * update muh codes * it runs. * feat: megacommit moment - adds all classes for custom tools - fabric parity for forge extension methods, minus extra weird ones - custom behaviours - et cetera, contains lots of skill issues * fix: use better, not as hardcoded AOE behaviour * fix: behaviours now use UseOnContext instead of a lot of parameters * fix: ShapedEnergyTransferRecipe crashes REI because .matches() is never called * fix: fill creative tabs & recipes with correctly-NBT'd items * fix: some more AOE fixes * fix: better valid drop tier handling * fix: misc fixes * feat: tooltips * fix: move tintColor to IGTTool * fix: make tool types use correct constructors * feat: allow autofilling recipes with items that have different NBT * fix: spades now exist. * fix: mining tool tags. * chore: datagen & some minor touchups CURRENT ISSUES: - torch place behavior voids your tool. - fabric doesn't have the capabilities attaching yet. * feat: remake how tool types are passed to IToolable etc. and how IToolable is called. * fix: better tool break handling when entity == null * fix: plunger now voids fluids. * fix: hoe behaviour works. * "fix": disable torch place behavior for initial release as I can't figure out a fix. * fix: log strip behaviour quirks * feat: custom wrench block rotating actions * fix: rail rotating with crowbar only works with normal rails * feat: forge overrides for all tool actions that have them, onBlockStartBreak for fabric * fix: tree felling might've worked with any tool * fix: bad nullability everywhere * fix: scythe had the wrong tool class, GTHoeItem extends ShovelItem instead of HoeItem * fix: plunger only voids 1/81 on fabric * fix: make constructors protected for tool classes * feat: make GTItems.TOOL_ITEMS be a table of <Material, Type, IGTTool> instead of a <Tier, Type, ToolItem> * fix: fix up tint colors in preparation for 2-color tool textures * feat: fallback to vanilla logic in case someone calls IGTToolImpl.definition$isCorrectToolForDrops with a non-GT tool * fix: plunger recipes set the max durability of the tool when crafting * fix: update jade plugin to use new tool item map * fix: oops. * fix: for some reason NBTToJsonConverter always converts numbers to doubles which ends up in larger numbers having rounding errors. * feat: colored tool handles * fix: reorder tint indexes on tool models * Revert "fix: reorder tint indexes on tool models" This reverts commit fa2cbdf. * fix: this is a better way to do the same thing. * feat: implement getDefaultInstance on all tool type classes * remove now useless mixin, add nbt output to fabric because it seemed to be missing. * Revert "fix: for some reason NBTToJsonConverter always converts numbers to doubles which ends up in larger numbers having rounding errors." This reverts commit 7140db5. * fix: heading comma in tool class tooltip * fix: fabric now has the ability to have electric tools * chore: changelog & version * chore: datagen * emphasize tool breakage Co-authored-by: Mikerooni <[email protected]> * fix weird import Co-authored-by: Mikerooni <[email protected]> * Update common/src/main/java/com/gregtechceu/gtceu/api/item/tool/aoe/AoESymmetrical.java Co-authored-by: Mikerooni <[email protected]> --------- Co-authored-by: Mikerooni <[email protected]>
* Revamp tools (#688) * aa why u crash * aa why u crash * holy shit this is worse than I thought... * god this is annoying to do megacommit moment * update muh codes * it runs. * feat: megacommit moment - adds all classes for custom tools - fabric parity for forge extension methods, minus extra weird ones - custom behaviours - et cetera, contains lots of skill issues * fix: use better, not as hardcoded AOE behaviour * fix: behaviours now use UseOnContext instead of a lot of parameters * fix: ShapedEnergyTransferRecipe crashes REI because .matches() is never called * fix: fill creative tabs & recipes with correctly-NBT'd items * fix: some more AOE fixes * fix: better valid drop tier handling * fix: misc fixes * feat: tooltips * fix: move tintColor to IGTTool * fix: make tool types use correct constructors * feat: allow autofilling recipes with items that have different NBT * fix: spades now exist. * fix: mining tool tags. * chore: datagen & some minor touchups CURRENT ISSUES: - torch place behavior voids your tool. - fabric doesn't have the capabilities attaching yet. * feat: remake how tool types are passed to IToolable etc. and how IToolable is called. * fix: better tool break handling when entity == null * fix: plunger now voids fluids. * fix: hoe behaviour works. * "fix": disable torch place behavior for initial release as I can't figure out a fix. * fix: log strip behaviour quirks * feat: custom wrench block rotating actions * fix: rail rotating with crowbar only works with normal rails * feat: forge overrides for all tool actions that have them, onBlockStartBreak for fabric * fix: tree felling might've worked with any tool * fix: bad nullability everywhere * fix: scythe had the wrong tool class, GTHoeItem extends ShovelItem instead of HoeItem * fix: plunger only voids 1/81 on fabric * fix: make constructors protected for tool classes * feat: make GTItems.TOOL_ITEMS be a table of <Material, Type, IGTTool> instead of a <Tier, Type, ToolItem> * fix: fix up tint colors in preparation for 2-color tool textures * feat: fallback to vanilla logic in case someone calls IGTToolImpl.definition$isCorrectToolForDrops with a non-GT tool * fix: plunger recipes set the max durability of the tool when crafting * fix: update jade plugin to use new tool item map * fix: oops. * fix: for some reason NBTToJsonConverter always converts numbers to doubles which ends up in larger numbers having rounding errors. * feat: colored tool handles * fix: reorder tint indexes on tool models * Revert "fix: reorder tint indexes on tool models" This reverts commit fa2cbdf. * fix: this is a better way to do the same thing. * feat: implement getDefaultInstance on all tool type classes * remove now useless mixin, add nbt output to fabric because it seemed to be missing. * Revert "fix: for some reason NBTToJsonConverter always converts numbers to doubles which ends up in larger numbers having rounding errors." This reverts commit 7140db5. * fix: heading comma in tool class tooltip * fix: fabric now has the ability to have electric tools * chore: changelog & version * chore: datagen * emphasize tool breakage Co-authored-by: Mikerooni <[email protected]> * fix weird import Co-authored-by: Mikerooni <[email protected]> * Update common/src/main/java/com/gregtechceu/gtceu/api/item/tool/aoe/AoESymmetrical.java Co-authored-by: Mikerooni <[email protected]> --------- Co-authored-by: Mikerooni <[email protected]> * fix errors --------- Co-authored-by: Mikerooni <[email protected]>
What
Revamps most of everything related to tools & how they are handled.
Implementation Details
mostly same as how 1.12 handles it. Which is still how MC handles it.
Outcome
Makes tool logic more modular and changeable, as well as easier to update in future versions.
Additional Information
haha funi pink crowbar
Potential Compatibility Issues
might break some addons expecting the old tool table in GTItems, and definitely breaks all existing tools.