Class OwnedBlock<T extends SefiBlock<T>>

java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
Type Parameters:
T - The type of SlimefunItem that is used to create this block.
All Implemented Interfaces:
io.github.thebusybiscuit.slimefun4.core.attributes.Placeable

public abstract class OwnedBlock<T extends SefiBlock<T>> extends SefiBlock<T>
This block will, when placed, register it's placing player as its owner. It will also check for the owner after a restart.
  • Field Summary

    Fields inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem

    addon, disenchantable, enchantable, hidden, recipeOutput, useableInWorkbench
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    OwnedBlock(io.github.thebusybiscuit.slimefun4.api.items.ItemGroup itemGroup, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack item, io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType recipeType, ItemStack[] recipe)
    Creates a new OwnedBlock.
    protected
    OwnedBlock(io.github.thebusybiscuit.slimefun4.api.items.ItemGroup itemGroup, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack item, io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput)
    Creates a new OwnedBlock.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    This method is called after the block is placed and after the owner is set.
    getOwner(io.github.bakedlibs.dough.blocks.BlockPosition blockPosition)
    Gets the owner of the given block.
    getOwner(Block block)
    Gets the owner of the given block.
    Returns this object
    protected void
    This method fires when the block is placed.
    protected void
    onTick(Block block, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem item, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data)
    This method is called each time the block is ticked and should not be overridden.
    protected void
    onTickAfterOwner(Block block, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem item, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data)
    This method is called after the owner is set and should be overridden to add your own code to handle block ticking.
    void
    setOwner(io.github.bakedlibs.dough.blocks.BlockPosition blockPosition, Player player)
    Sets the owner of the given block.
    void
    setOwner(Block block, Player player)
    Sets the owner of the given block.

    Methods inherited from class dev.sefiraat.sefilib.slimefun.items.SefiSlimefunItem

    registerItem

    Methods inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem

    addItemHandler, addItemSetting, addOfficialWikipage, callItemHandler, canUse, equals, error, getAddon, getBlockTicker, getById, getByItem, getDrops, getDrops, getHandlers, getId, getItem, getItemGroup, getItemName, getItemSetting, getItemSettings, getRecipe, getRecipeOutput, getRecipeType, getResearch, getState, getWikipage, hashCode, hasResearch, info, isDisabled, isDisabledIn, isDisenchantable, isEnchantable, isHidden, isItem, isItemStackImmutable, isTicking, isUseableInWorkbench, load, postRegister, register, sendDeprecationWarning, setHidden, setItemGroup, setRecipe, setRecipeOutput, setRecipeType, setResearch, setUseableInWorkbench, toString, warn

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.Placeable

    useVanillaBlockBreaking
  • Constructor Details

    • OwnedBlock

      protected OwnedBlock(io.github.thebusybiscuit.slimefun4.api.items.ItemGroup itemGroup, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack item, io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType recipeType, ItemStack[] recipe)
      Creates a new OwnedBlock.
      Parameters:
      itemGroup - The ItemGroup this block belongs to.
      item - The SlimefunItemStack that is used to create this block.
      recipeType - The RecipeType of this block.
      recipe - The recipe of this block.
    • OwnedBlock

      protected OwnedBlock(io.github.thebusybiscuit.slimefun4.api.items.ItemGroup itemGroup, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack item, io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType recipeType, ItemStack[] recipe, @Nullable ItemStack recipeOutput)
      Creates a new OwnedBlock.
      Parameters:
      itemGroup - The ItemGroup this block belongs to.
      item - The SlimefunItemStack that is used to create this block.
      recipeType - The RecipeType of this block.
      recipe - The recipe of this block.
      recipeOutput - The recipe output of this block.
  • Method Details

    • getThis

      public T getThis()
      Returns this object
      Overrides:
      getThis in class SefiBlock<T extends SefiBlock<T>>
      Returns:
      this object
    • onBlockPlaced

      protected void onBlockPlaced(@Nonnull BlockPlaceEvent event)
      This method fires when the block is placed. Should not be overridden, instead use afterBlockPlaced(BlockPlaceEvent)
      Overrides:
      onBlockPlaced in class SefiBlock<T extends SefiBlock<T>>
      Parameters:
      event - The BlockPlaceEvent that triggered this.
    • afterBlockPlaced

      protected void afterBlockPlaced(@Nonnull BlockPlaceEvent event)
      This method is called after the block is placed and after the owner is set. Override to add your own code to handle block placement.
      Parameters:
      event - The BlockPlaceEvent that triggered this.
    • onTick

      @ParametersAreNonnullByDefault protected void onTick(Block block, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem item, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data)
      This method is called each time the block is ticked and should not be overridden. Instead, use onTickAfterOwner(Block, SlimefunItem, Config)
      Overrides:
      onTick in class SefiBlock<T extends SefiBlock<T>>
      Parameters:
      block - The Block that is being ticked.
      item - The SlimefunItem that is being ticked.
      data - The Config from BlockStorage
    • onTickAfterOwner

      @ParametersAreNonnullByDefault protected void onTickAfterOwner(Block block, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem item, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data)
      This method is called after the owner is set and should be overridden to add your own code to handle block ticking.
      Parameters:
      block - The Block that is being ticked.
      item - The SlimefunItem that is being ticked.
      data - The Config from BlockStorage
    • getOwner

      @Nullable public OfflinePlayer getOwner(@Nonnull Block block)
      Gets the owner of the given block.
      Parameters:
      block - The Block that is being checked.
      Returns:
      The owner of the block.
    • getOwner

      @Nullable public OfflinePlayer getOwner(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition blockPosition)
      Gets the owner of the given block.
      Parameters:
      blockPosition - The BlockPosition of the block that is being checked.
      Returns:
      The owner of the block.
    • setOwner

      public void setOwner(@Nonnull Block block, @Nonnull Player player)
      Sets the owner of the given block.
      Parameters:
      block - The Block that to set the owner of.
      player - The Player that is being set as the owner.
    • setOwner

      public void setOwner(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition blockPosition, @Nonnull Player player)
      Sets the owner of the given block.
      Parameters:
      blockPosition - The BlockPosition of the block that to set the owner of.
      player - The Player that is being set as the owner.