Update grinding handler to use in-world crafting for grindstone or obsidian #277
No reviewers
Labels
No labels
Area-Assets
Area-Backend
Area-Conduits
Area-Datapacks
Area-Lang
Area-Mod Compat
Area-Parity
Area-Rendering
Good first issue
MC-1.19.2
MC-1.20.1
MC-1.20.4
MC-1.20.6
MC-1.21
MC-1.21.1
Modtoberfest
P-0-High
P-1-Medium
P-2-Low
Status-Awaiting Response
Status-Behind-Flag
Status-Blocked
Status-Cannot Reproduce
Status-Duplicate
Status-Help Wanted
Status-Incomplete Report
Status-Invalid
Status-Needs LTS Backport
Status-Needs Updating
Status-Stale
Status-To Implement
Status-Triage
Status-Wontfix
Status-Wontmerge
Type-Backport
Type-Bug
Type-Documentation
Type-Enhancement
Type-Question
Type-RFC
Type-Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Team-EnderIO/EnderIO#277
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/1.20.1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Crying obsidian also works and has a 1 in 3 chance to double the output (for grains of infinity) or cut the input cost by 66% (for coal dust).
Description
Since the grindstone craft was crashing, this implementation relies on the right click block event, such that a player can sneak and right-click a grindstone or obsidian block to perform the craft.
Fixes issue(s): #196
Hey !
A new contributor :)
I can't review code but I'm pretty sure that they are going to notice that:
The if/else block should be written in java as
if (condition) {
}
instead of what you wrote
if(condition)
{
}
Darn it, I did it again.
I can't believe it.
This is the C++ programmer in me, old habits die hard.
XD
I fixed the formatting, also streamlined a couple of if statements
@ -3,53 +3,59 @@ package com.enderio.base.common.handler;import com.enderio.EnderIO;instead of the Blocks.OBSIDIAN check use
target.is(Tags.Block.OBSIDIAN)Split this guard clause into two
cancel it for all cases, to mark that we have done something and others don't do further interactions
I did all the above, and I also moved the crouching check to before the getter calls to save a few instructions in the manifold cases where the player clicks a block without crouching
most of the checks are kinda wrong now.
you don't check the target anymore for the 2 valid blocks and the valid tag, resulting in all blocks being a valid shift right click target.
you don't check if you are serverside for the inventory manipulation, which could result in desynced inventories and duplicated item removal in creative mod. Add a check for that before you manipulate the inventory.
the mainhand check in the guard clause is not useless.
cancel the event only if the mainhand items are correct, not in general after the big if/else block
Whoops, I didn't mean to delete the target block check...lol.
Also I don't know how the event set canceled call ended up outside the if/else block, that was also probably an editing error.
Added a serverside check at the very beginning of the method.
(Not to be a pain, could you also add your changes into
CHANGELOG.md? Cheers!)After this and the changelog this looks fine
@ -3,53 +3,59 @@ package com.enderio.base.common.handler;import com.enderio.EnderIO;Replace the obsidian check with the obsidian Tag check. The TagKey can be Found in Tags.Blocks.OBSIDIAN
@ -3,53 +3,59 @@ package com.enderio.base.common.handler;import com.enderio.EnderIO;oh, and can you check, that there is a space between the
ifand the(@ -3,53 +3,59 @@ package com.enderio.base.common.handler;import com.enderio.EnderIO;C++ Coder habits again 😛
Let me know if what I wrote in the changelog is too wordy
@ -3,53 +3,59 @@ package com.enderio.base.common.handler;import com.enderio.EnderIO;that one was close, crying obsidian is not in the obsidian tag, so that check needs to persist
Looks great, thanks a bunch!! Also thanks again agnor for the review
Oh looks like some conflicts have shown up, if you're happy to wrangle them, feel free, if not i can do that at merge after work :)
Actually, I just realised - we need to update JEI 😅. Will need to at least remove the old recipe stuff for the grindstone but maybe add something for this too if you could. If you can't, don't worry; I've an idea on a way it could look.