Class ForgePlatformHelper

java.lang.Object
tschipp.callablehorses.platform.ForgePlatformHelper
All Implemented Interfaces:
IPlatformHelper

public class ForgePlatformHelper extends Object implements IPlatformHelper
  • Constructor Details

    • ForgePlatformHelper

      public ForgePlatformHelper()
  • Method Details

    • getPlatformName

      public String getPlatformName()
      Description copied from interface: IPlatformHelper
      Gets the name of the current platform.
      Specified by:
      getPlatformName in interface IPlatformHelper
    • isModLoaded

      public boolean isModLoaded(String modId)
      Description copied from interface: IPlatformHelper
      Checks if a mod with the given id is loaded.
      Specified by:
      isModLoaded in interface IPlatformHelper
    • isDevelopmentEnvironment

      public boolean isDevelopmentEnvironment()
      Description copied from interface: IPlatformHelper
      Check if the game is currently in a development environment.
      Specified by:
      isDevelopmentEnvironment in interface IPlatformHelper
    • registerConfig

      public void registerConfig(BuiltConfig cfg)
      Specified by:
      registerConfig in interface IPlatformHelper
    • registerServerboundPacket

      public <T extends PacketBase, B extends net.minecraft.network.FriendlyByteBuf> void registerServerboundPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, Class<T> clazz, net.minecraft.network.codec.StreamCodec<B,T> codec, BiConsumer<T,net.minecraft.world.entity.player.Player> handler)
      Specified by:
      registerServerboundPacket in interface IPlatformHelper
    • registerClientboundPacket

      public <T extends PacketBase, B extends net.minecraft.network.FriendlyByteBuf> void registerClientboundPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, Class<T> clazz, net.minecraft.network.codec.StreamCodec<B,T> codec, BiConsumer<T,net.minecraft.world.entity.player.Player> handler)
      Specified by:
      registerClientboundPacket in interface IPlatformHelper
    • sendPacketToServer

      public void sendPacketToServer(PacketBase packet)
      Specified by:
      sendPacketToServer in interface IPlatformHelper
    • sendPacketToPlayer

      public void sendPacketToPlayer(PacketBase packet, net.minecraft.server.level.ServerPlayer player)
      Specified by:
      sendPacketToPlayer in interface IPlatformHelper
    • sendPacketToPlayersTracking

      public void sendPacketToPlayersTracking(PacketBase packet, net.minecraft.world.entity.Entity entity)
      Specified by:
      sendPacketToPlayersTracking in interface IPlatformHelper
    • getOwnerData

      public HorseOwnerData getOwnerData(net.minecraft.world.entity.player.Player player)
      Description copied from interface: IPlatformHelper
      Per-player horse ownership data. Backed by data attachments on Fabric/NeoForge and by a capability on Forge.
      Specified by:
      getOwnerData in interface IPlatformHelper
    • setOwnerData

      public void setOwnerData(net.minecraft.world.entity.player.Player player, HorseOwnerData data)
      Specified by:
      setOwnerData in interface IPlatformHelper
    • getHorseData

      @Nullable public @Nullable StoredHorseData getHorseData(net.minecraft.world.entity.Entity horse)
      Description copied from interface: IPlatformHelper
      Must never attach data as a side effect: the presence of data is what tells the rest of the mod that a mount is bound, and this is called for arbitrary entities.
      Specified by:
      getHorseData in interface IPlatformHelper
    • getOrCreateHorseData

      @Nullable public @Nullable StoredHorseData getOrCreateHorseData(net.minecraft.world.entity.Entity horse)
      Description copied from interface: IPlatformHelper
      Only for the paths about to write a binding. Still null on Forge for an entity constructed without the capability.
      Specified by:
      getOrCreateHorseData in interface IPlatformHelper
    • setHorseData

      public void setHorseData(net.minecraft.world.entity.Entity horse, StoredHorseData data)
      Specified by:
      setHorseData in interface IPlatformHelper
    • isAreaProtected

      public boolean isAreaProtected(net.minecraft.world.entity.player.Player player, net.minecraft.world.entity.Entity probe)
      Description copied from interface: IPlatformHelper
      Asks any installed protection mod whether player may interact with probe at its current position. Used to stop horses being called into, or bound inside, claimed regions.
      Specified by:
      isAreaProtected in interface IPlatformHelper
      Parameters:
      probe - a horse entity positioned where the interaction would happen