Skip to content

Change Petting rules to allow petting all friendly creatures#253

Open
CCF100 wants to merge 2 commits intotr7zw:mainfrom
CCF100:main
Open

Change Petting rules to allow petting all friendly creatures#253
CCF100 wants to merge 2 commits intotr7zw:mainfrom
CCF100:main

Conversation

@CCF100
Copy link
Copy Markdown

@CCF100 CCF100 commented Feb 19, 2025

I wanted to be able to pet all of the friendly mobs, so I wrote this PR lol

(I only updated the English text because I don't know those other languages)

@what-the-diff
Copy link
Copy Markdown

what-the-diff bot commented Feb 19, 2025

PR Summary

  • Enhancement in Friendly Entity Recognition
    Updated the way friendly entities are detected. The existing method involved checking for specific types such as 'Wolf' and 'Cat'. We've improved this by having the system recognize any entity that falls under the category of being 'friendly'.

  • Variable Names Adjusted for Understanding
    The variable previously named pet is now changed to entityToBeTargetted. This offers improved clarity when others review or work with the code, demonstrating exactly what the variable signifies.

  • Optimized Height Difference Calculation
    The way we calculate height difference has been simplified. This change has been applied to the recently renamed variable entityToBeTargetted, optimizing this portion of the system.

  • Preserved Code for Position Difference
    The existing code for calculating the position difference, posDif, remains untouched. This could indicate the part is still under development or future changes are expected.

@sonarqubecloud
Copy link
Copy Markdown

@tr7zw
Copy link
Copy Markdown
Owner

tr7zw commented Feb 21, 2025

Huh, wouldn't expect entHit.getEntity().getType().getCategory().isFriendly() to work in 1.16.5, gonna let the build run for all versions. Which EntityTypes are "friendly"? Does that also add animals like pigs, or just some like Parrots?

@tr7zw
Copy link
Copy Markdown
Owner

tr7zw commented Feb 25, 2025

Apparently, everything except monsters are "friendly". I think this needs some refinement so stuff like boats/leashes/armorstands/villagers/minecarts/windcharge/itemframe etc don't end up being pettable 😅.

@CCF100
Copy link
Copy Markdown
Author

CCF100 commented Mar 2, 2025

Apparently, everything except monsters are "friendly". I think this needs some refinement so stuff like boats/leashes/armorstands/villagers/minecarts/windcharge/itemframe etc don't end up being pettable 😅.

Yeah, as is, even XP orbs are pettable, which is quite funny...

@NoahRoopull
Copy link
Copy Markdown

I'm no expert, and this might count as a necropost or something, but couldn't you use:

if (entHit != null && (entHit.getEntity() instanceof TameableAnimal))

to target anything that can be tamed? That would cover most other mods (Pet Cemetery's zombie/skeleton variants, Critters and Companions, etc.) as long as they extend TameableAnimal or something tameable from vanilla.

Of course, it wouldn't cover pigs, cows, sheep, etc., so if that's the goal, then I can be safely ignored, but I'd definitely like to see the petting animation work on more mobs.

@tr7zw
Copy link
Copy Markdown
Owner

tr7zw commented Mar 5, 2026

I think combining that with a bigger rewrite would be better, that also keeps in mind the size of the animal. Especially when also looking at modded entities.

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