Class MysteryBoxEvent.Open.Post

java.lang.Object
net.neoforged.bus.api.Event
Enclosing class:
MysteryBoxEvent.Open

public static class MysteryBoxEvent.Open.Post extends MysteryBoxEvent.Open
  • Constructor Details

    • Post

      public Post(MysteryBoxTileEntity box, net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.world.item.ItemStack itemStack, long lastOpenTime, long openUntil, long nextOpenTime, int scrapsTotal, int scrapsLeft)
      Fired when a Mystery Box has been opened, and its variables are being updated from that process.
      Parameters:
      box - The Mystery Box tile entity.
      player - The player instigating this event.
      blockState - The block state of this Mystery Box.
      itemStack - The item stack being used in this interaction.
      lastOpenTime - The Unix time in milliseconds when this Mystery Box was last opened (in this case, right now).
      openUntil - The Unix time in milliseconds until this Mystery Box will be open for.
      nextOpenTime - The Unix time in milliseconds when this Mystery Box can next be opened.
      scrapsTotal - The new count of Netherite Scraps required to open this Mystery Box again.
      scrapsLeft - The new value of the counter for Netherite Scraps required to open this Mystery Box again.
  • Method Details

    • getLastOpenTime

      public long getLastOpenTime()
      The Unix time in milliseconds when this Mystery Box was last opened (in this case, right now).
      Returns:
      The last open time (ms).
    • setLastOpenTime

      public void setLastOpenTime(long lastOpenTime)
      Sets the Unix time in milliseconds when this Mystery Box was last opened.
      Parameters:
      lastOpenTime - The last open time (ms).
    • getOpenUntil

      public long getOpenUntil()
      The Unix time in milliseconds until this Mystery Box will be open for.
      Returns:
      The open until time (ms).
    • setOpenUntil

      public void setOpenUntil(long openUntil)
      Sets the Unix time in milliseconds until this Mystery Box will be open for.
      Parameters:
      openUntil - The open until time (ms).
    • getNextOpenTime

      public long getNextOpenTime()
      The Unix time in milliseconds when this Mystery Box can next be opened.
      Returns:
      The next open time (ms).
    • setNextOpenTime

      public void setNextOpenTime(long nextOpenTime)
      Sets the Unix time in milliseconds when this Mystery Box can next be opened.
      Parameters:
      nextOpenTime - The next open time (ms).
    • getScrapsTotal

      public int getScrapsTotal()
      The new count of Netherite Scraps required to open this Mystery Box again.
      Returns:
      The total scraps required.
    • setScrapsTotal

      public void setScrapsTotal(int scrapsTotal)
      Sets the new count of Netherite Scraps required to open this Mystery Box again.
      Parameters:
      scrapsTotal - The total scraps required.
    • getScrapsLeft

      public int getScrapsLeft()
      The new value of the counter for Netherite Scraps required to open this Mystery Box again.
      Returns:
      The value of the scrap counter.
    • setScrapsLeft

      public void setScrapsLeft(int scrapsLeft)
      Sets the new value of the counter for Netherite Scraps required to open this Mystery Box again.
      Parameters:
      scrapsLeft - The value of the scrap counter.