Class AnythingLivingPettingHandler<P extends net.minecraft.world.entity.LivingEntity>
java.lang.Object
com.hammy275.immersivemc.server.immersive.petting.AnythingLivingPettingHandler<P>
- All Implemented Interfaces:
PettingHandler<P>
public class AnythingLivingPettingHandler<P extends net.minecraft.world.entity.LivingEntity>
extends Object
implements PettingHandler<P>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdoPetEffect(net.minecraft.server.level.ServerPlayer playerPetting, P petEntity, net.minecraft.world.phys.Vec3 handPosition) Perform effects from an entity being pet.booleanmatchesEntity(net.minecraft.server.level.ServerPlayer playerPetting, net.minecraft.world.entity.Entity possibleEntityToPet) Whether the entity provided matches being pet by this handler.
-
Constructor Details
-
AnythingLivingPettingHandler
public AnythingLivingPettingHandler()
-
-
Method Details
-
matchesEntity
public boolean matchesEntity(net.minecraft.server.level.ServerPlayer playerPetting, net.minecraft.world.entity.Entity possibleEntityToPet) Description copied from interface:PettingHandlerWhether the entity provided matches being pet by this handler. Any entity that matches here will not be handled by handlers that were registered after this one.- Specified by:
matchesEntityin interfacePettingHandler<P extends net.minecraft.world.entity.LivingEntity>- Parameters:
playerPetting- The player that is petting the potential pet.possibleEntityToPet- The entity that may be a pet for this handler.- Returns:
- Whether the entity provided has petting handled by this handler.
-
doPetEffect
public int doPetEffect(net.minecraft.server.level.ServerPlayer playerPetting, P petEntity, net.minecraft.world.phys.Vec3 handPosition) Description copied from interface:PettingHandlerPerform effects from an entity being pet. This happens randomly as determined by ImmersiveMC, not every tick or some other consistent metric! Note that displaying hearts is automatically performed by ImmersiveMC and does not need to be replicated here.- Specified by:
doPetEffectin interfacePettingHandler<P extends net.minecraft.world.entity.LivingEntity>- Parameters:
playerPetting- The player performing the petting.petEntity- The entity being pet.handPosition- The position of the hand performing the petting.- Returns:
- A cooldown to wait in ticks until the entity pet effect can trigger again. Note that ImmersiveMC's hearts can still trigger on the next tick. A value of 0 or less is treated as no cooldown.
-