Class VanillaMobsPettingHandler<P extends net.minecraft.world.entity.animal.Animal>

java.lang.Object
com.hammy275.immersivemc.server.immersive.petting.VanillaMobsPettingHandler<P>
All Implemented Interfaces:
PettingHandler<P>

public class VanillaMobsPettingHandler<P extends net.minecraft.world.entity.animal.Animal> extends Object implements PettingHandler<P>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    doPetEffect(net.minecraft.server.level.ServerPlayer playerPetting, P petEntity, net.minecraft.world.phys.Vec3 handPosition)
    Perform effects from an entity being pet.
    boolean
    matchesEntity(net.minecraft.server.level.ServerPlayer playerPetting, net.minecraft.world.entity.Entity possibleEntityToPet)
    Whether the entity provided matches being pet by this handler.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VanillaMobsPettingHandler

      public VanillaMobsPettingHandler()
  • Method Details

    • matchesEntity

      public boolean matchesEntity(net.minecraft.server.level.ServerPlayer playerPetting, net.minecraft.world.entity.Entity possibleEntityToPet)
      Description copied from interface: PettingHandler
      Whether 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:
      matchesEntity in interface PettingHandler<P extends net.minecraft.world.entity.animal.Animal>
      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: PettingHandler
      Perform 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:
      doPetEffect in interface PettingHandler<P extends net.minecraft.world.entity.animal.Animal>
      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.