-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Allow block to specify their type for AI pathfinding #3546
Allow block to specify their type for AI pathfinding #3546
Conversation
+ * Set the PathNodeType for this block. null for vanilla behavior. | ||
+ * @return the PathNodeType | ||
+ */ | ||
+ @Nullable public net.minecraft.pathfinding.PathNodeType getAiPathNodeType() |
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.
- Annotation should be on a new line;
- At least this should be state-aware; consider exposing the block positon.
@@ -8,11 +8,13 @@ | |||
} | |||
} | |||
} | |||
@@ -430,6 +431,7 @@ | |||
@@ -430,6 +431,9 @@ | |||
IBlockState iblockstate = p_189553_1_.func_180495_p(blockpos); | |||
Block block = iblockstate.func_177230_c(); | |||
Material material = iblockstate.func_185904_a(); | |||
+ if(block.isBurning(p_189553_1_, blockpos)) return PathNodeType.DAMAGE_FIRE; |
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.
The new method should handle this check. Other opinions welcomed.
Looks like a good idea. I think liach's requests make sense here. |
Updated as suggested. |
+ * Set the PathNodeType for this block. null for vanilla behavior. | ||
+ * @return the PathNodeType | ||
+ */ | ||
+ @Nullable public net.minecraft.pathfinding.PathNodeType getAiPathNodeType(IBlockState state, IBlockAccess world, BlockPos pos) |
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.
All other methods in Forge project is like
@Nullable
public net.minecraft.pathfinding.PathNodeType getAiPathNodeType(IBlockState state, IBlockAccess world, BlockPos pos)
instead of putting annotation and the method head in the same line.
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 assume diesieben just wanted to minimize the patch size by putting it all in the same line. A similar thing can be found here in commit 150566d.
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.
Yeah, but it doesn't really make sense here, the Block
patch is a huge blob all all already anyways. I just forgot to fix this in my update.
I suggest making a test mod to show that this change works as intended. You should screenshot a picture like this. It is a picture from Minecraft Wiki that demonstrates the Zombies' AI. |
@@ -1359,12 +1359,21 @@ | |||
+ return false; | |||
+ } | |||
+ | |||
+ /** | |||
+ * Set the PathNodeType for this block. null for vanilla behavior. |
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 for the comment:
Gets the PathNodeType for this block. Return null for vanilla behavior.
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.
Returns
The |
- integrate existing patch for burning blocks
- move annotation to it's own line - improve javadoc
ad05b6b
to
a40ec52
Compare
Rebased onto current 1.11.x. |
Tested and it works as expected. |
Allow blocks to specify their
PathNodeType
for AI pathfinding. This allows e.g. mod-added fences to behave like vanilla fences in respect to Mob AI.