Class ImmersiveBeacon

All Implemented Interfaces:
Immersive<BeaconInfo,BeaconStorage>

public class ImmersiveBeacon extends AbstractImmersive<BeaconInfo,BeaconStorage>
  • Constructor Details

    • ImmersiveBeacon

      public ImmersiveBeacon()
  • Method Details

    • buildInfo

      public BeaconInfo buildInfo(net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level level)
      Description copied from interface: Immersive
      Constructs a new ImmersiveInfo based on the provided block position. It's best to calculate initial hitboxes, etc. in this method to make the Immersive available for interaction as soon as possible.
      Parameters:
      pos - The position of a block that matches this Immersive.
      level - The level in which this info is being built.
      Returns:
      An instance of an ImmersiveInfo implementation with the same position as provided.
    • handleHitboxInteract

      public int handleHitboxInteract(BeaconInfo info, net.minecraft.client.player.LocalPlayer player, int hitboxIndex, net.minecraft.world.InteractionHand hand)
      Description copied from interface: Immersive
      The method called when a player interacts with a hitbox.
      If multiple hitboxes are being interacted with at the same time, only the first hitbox in iteration order from ImmersiveInfo.getAllHitboxes() that is being interacted with will have this function called.
      Parameters:
      info - The info containing the hitbox that was interacted with.
      player - The player that interacted with the hitbox. This player is always the player currently controlling the game window.
      hitboxIndex - The index into ImmersiveInfo.getAllHitboxes() that was interacted with.
      hand - The hand used for interaction.
      Returns:
      A number representing the number of ticks of cooldown to apply before the player can interact with any Immersive again, or a negative number to denote no actual interaction has happened, such as obtaining items from an output slot of an Immersive when the output slot has no items. This cooldown should be the cooldown for desktop users if Immersive.isVROnly() returns false, and it should be the cooldown for VR users if Immersive.isVROnly() returns true. ImmersiveMC will modify this cooldown time to accommodate situations, such as VR users requiring an increased cooldown time.
    • tick

      public void tick(BeaconInfo info)
      Description copied from interface: Immersive
      This method is called once per game tick. This is where you should, for example, recalculate hitboxes if needed.
      Specified by:
      tick in interface Immersive<BeaconInfo,BeaconStorage>
      Overrides:
      tick in class AbstractImmersive<BeaconInfo,BeaconStorage>
      Parameters:
      info - The info being ticked.
    • shouldRender

      public boolean shouldRender(BeaconInfo info)
      Description copied from interface: Immersive
      Whether the provided info should render in the world. It's good to return false here if this Immersive does not have its data ready for rendering.
      Parameters:
      info - The info to check.
      Returns:
      Whether the provided info should render to the world, which includes calling Immersive.render(ImmersiveInfo, PoseStack, ImmersiveRenderHelpers, float).
    • render

      public void render(BeaconInfo info, com.mojang.blaze3d.vertex.PoseStack stack, ImmersiveRenderHelpers helpers, float partialTicks)
      Description copied from interface: Immersive
      Render the provided info.
      Parameters:
      info - The info to render.
      stack - The pose stack being rendered with.
      helpers - Some helper functions for rendering.
      partialTicks - The fraction of time between the last tick and the current tick.
    • getHandler

      public ImmersiveHandler<BeaconStorage> getHandler()
      Returns:
      The ImmersiveHandler this Immersive uses.
    • configScreenInfo

      @Nullable public @Nullable ImmersiveConfigScreenInfo configScreenInfo()
      Description copied from interface: Immersive
      The info needed to build a config screen button for this Immersive. If this method returns null, ImmersiveMC will not add a setting for this Immersive to its in-game configuration. Reasons to possibly return null from this method include, but are not limited to:
      • This Immersive cannot be controlled via a config.
      • Another mod already handles configuring this Immersive.
      Returns:
      An ImmersiveConfigScreenInfo instance used for ImmersiveMC to add this Immersive to its in-game configuration screens, or null if ImmersiveMC should not do so.
    • shouldDisableRightClicksWhenVanillaInteractionsDisabled

      public boolean shouldDisableRightClicksWhenVanillaInteractionsDisabled(BeaconInfo info)
      Description copied from interface: Immersive
      Whether normal right-click behavior for this block should be disabled when the option to disable interactions is enabled in ImmersiveMC. This should usually return true if the block opens a GUI on right-click.
      Parameters:
      info - The info for the block that may want to disable right-clicks.
      Returns:
      Whether to skip right-click behavior for this block when the option to disable click interactions is enabled in ImmersiveMC.
    • processStorageFromNetwork

      public void processStorageFromNetwork(BeaconInfo info, BeaconStorage storage)
      Description copied from interface: Immersive
      Process the storage from the server for this Immersive. Not called for Immersives that return true for Immersive.getHandler()'s ImmersiveHandler.clientAuthoritative().
      Parameters:
      info - The info with storage being processed.
      storage - The storage to be processed.
    • isVROnly

      public boolean isVROnly()
      Returns:
      Whether this Immersive should only exist for VR users. The same value should always be returned by this method.
    • setHitboxesAndPositions

      protected void setHitboxesAndPositions(BeaconInfo info)