Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

PathfinderRemoveBlock to include BlockData #80

Closed
ShaneBeee opened this issue Jul 10, 2023 · 2 comments · Fixed by #81
Closed

PathfinderRemoveBlock to include BlockData #80

ShaneBeee opened this issue Jul 10, 2023 · 2 comments · Fixed by #81
Assignees
Labels
enhancement New feature or request

Comments

@ShaneBeee
Copy link

Feature Type

Optimization

Description of Feature

Ok let me try keep this short and simple.

for this goal, mobchip.ai.goal.PathfinderRemoveBlock, the constructor takes in a Bukkit Block
The actual NMS goal takes in an NMS Block (which in Minecraft land represents the type of a BlockState)
I noticed internally you are doing this:
((CraftBlock)p.getBlock()).getNMS().b()
This is essentially getting the NMS BlockState (or IBlockData as Bukkit calls it) and then getting the NMS Block to use in the NMS goal

The issue with this contractor is you'd have to use a Bukkit Block actually placed in the world, which may never actually exist for a type we may want.

What I would like to recommend is having a constructor using Bukkit's BlockData and/or Bukkit's Material so that we don't have to reference a specific block in the world.
CraftBlockData has a method getState() which returns BlockState (IBlockData) which you could get the Minecraft Block required for the Minecraft goal.
CraftBlockData#getState().getBlock() or CraftBlockData#getState().b()(when obfuscated)

Jesus I can blab on, I really hope that makes sense to you.

@ShaneBeee ShaneBeee added the enhancement New feature or request label Jul 10, 2023
@gmitch215 gmitch215 self-assigned this Jul 11, 2023
@gmitch215
Copy link
Owner

Feature Type

Optimization

Description of Feature

Ok let me try keep this short and simple.

for this goal, mobchip.ai.goal.PathfinderRemoveBlock, the constructor takes in a Bukkit Block The actual NMS goal takes in an NMS Block (which in Minecraft land represents the type of a BlockState) I noticed internally you are doing this: ((CraftBlock)p.getBlock()).getNMS().b() This is essentially getting the NMS BlockState (or IBlockData as Bukkit calls it) and then getting the NMS Block to use in the NMS goal

The issue with this contractor is you'd have to use a Bukkit Block actually placed in the world, which may never actually exist for a type we may want.

What I would like to recommend is having a constructor using Bukkit's BlockData and/or Bukkit's Material so that we don't have to reference a specific block in the world. CraftBlockData has a method getState() which returns BlockState (IBlockData) which you could get the Minecraft Block required for the Minecraft goal. CraftBlockData#getState().getBlock() or CraftBlockData#getState().b()(when obfuscated)

Jesus I can blab on, I really hope that makes sense to you.

After some investigating, I have come to the following conclusion:

PathfinderRemoveBlock's Block Field represents a Material, not a BlockData instance, because there is usually a map of properties that represent the additional data used in BlockData (without it it's just represented as a Material), i.e. Advancements.

I'm going to add a constructor for a Material and deprecate some API methods, but it's not possible to convert from the Block instance to a BlockData interface.

@ShaneBeee
Copy link
Author

thanks for all the updates ... really appreciate it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants