Class SefiBlock<T extends SefiSlimefunItem<T>>

java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
dev.sefiraat.sefilib.slimefun.items.SefiSlimefunItem<T>
dev.sefiraat.sefilib.slimefun.blocks.SefiBlock<T>
Type Parameters:
T - The type of SefiSlimefunItem that is used to create this block.
All Implemented Interfaces:
io.github.thebusybiscuit.slimefun4.core.attributes.Placeable
Direct Known Subclasses:
OwnedBlock, SimpleTickingBlock

public abstract class SefiBlock<T extends SefiSlimefunItem<T>> extends SefiSlimefunItem<T>
This abstract class can be extended to simplify the creation of Slimefun blocks with methods for ticking, right-clicking, placing, breaking, and using.
  • 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
    SefiBlock(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 SefiBlock.
    protected
    SefiBlock(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 SefiBlock.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected T
    Returns this object
    boolean
    Returns whether this block should allow androids to break it.
    boolean
    Returns whether this block should allow block placers.
    boolean
    Returns whether this block should allow explosions to break it.
    boolean
    Returns whether this block should ticked synchronously.
    protected void
    Override this method to add custom code to be executed when this block is placed.
    protected void
    Override this method to add custom code to be executed when this block is broken.
    protected void
    onPlayerRightClickBlock(io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent event)
    Override this method to add custom code to be executed when this block is right-clicked.
    protected void
    onTick(Block block, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem item, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data)
    Override this method to add custom code to be executed when this block is ticked.
    protected void
    Override this method to add custom code to be executed when this SlimefunItem is uniquely ticked.
    void
    Adds the various required handlers to this block.
    setAllowAndroids(boolean allowAndroids)
    Sets whether this block should allow androids to break it.
    setAllowBlockPlacers(boolean allowBlockPlacers)
    Sets whether this block should allow block placers.
    setAllowExplosions(boolean allowExplosions)
    Sets whether this block should allow explosions to break it.
    setSync(boolean sync)
    Sets whether this block should ticked synchronously.

    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

    • SefiBlock

      protected SefiBlock(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 SefiBlock.
      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.
    • SefiBlock

      protected SefiBlock(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 SefiBlock.
      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 output of this block.
  • Method Details

    • getThis

      protected T getThis()
      Returns this object
      Overrides:
      getThis in class SefiSlimefunItem<T extends SefiSlimefunItem<T>>
      Returns:
      This object
    • preRegister

      @OverridingMethodsMustInvokeSuper public void preRegister()
      Adds the various required handlers to this block. Do not override without calling super.
      Overrides:
      preRegister in class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
    • isSync

      public boolean isSync()
      Returns whether this block should ticked synchronously.
      Returns:
      Whether this block should ticked synchronously.
    • setSync

      public T setSync(boolean sync)
      Sets whether this block should ticked synchronously.
      Parameters:
      sync - Whether this block should ticked synchronously.
      Returns:
      This object
    • isAllowBlockPlacers

      public boolean isAllowBlockPlacers()
      Returns whether this block should allow block placers.
      Returns:
      Whether this block should allow block placers.
    • setAllowBlockPlacers

      public T setAllowBlockPlacers(boolean allowBlockPlacers)
      Sets whether this block should allow block placers.
      Parameters:
      allowBlockPlacers - Whether this block should allow block placers.
      Returns:
      This object
    • isAllowAndroids

      public boolean isAllowAndroids()
      Returns whether this block should allow androids to break it.
      Returns:
      Whether this block should allow androids to break it.
    • setAllowAndroids

      public T setAllowAndroids(boolean allowAndroids)
      Sets whether this block should allow androids to break it.
      Parameters:
      allowAndroids - Whether this block should allow androids to break it.
      Returns:
      This object
    • isAllowExplosions

      public boolean isAllowExplosions()
      Returns whether this block should allow explosions to break it.
      Returns:
      Whether this block should allow explosions to break it.
    • setAllowExplosions

      public T setAllowExplosions(boolean allowExplosions)
      Sets whether this block should allow explosions to break it.
      Parameters:
      allowExplosions - Whether this block should allow explosions to break it.
      Returns:
      This object
    • onBlockPlaced

      protected void onBlockPlaced(@Nonnull BlockPlaceEvent event)
      Override this method to add custom code to be executed when this block is placed.
      Parameters:
      event - The BlockPlaceEvent that was fired.
    • onTick

      @ParametersAreNonnullByDefault protected void onTick(Block block, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem item, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data)
      Override this method to add custom code to be executed when this block is ticked.
      Parameters:
      block - The Block that was ticked.
      item - The SlimefunItem that was ticked.
      data - The Config from BlockStorage
    • onUniqueTick

      protected void onUniqueTick()
      Override this method to add custom code to be executed when this SlimefunItem is uniquely ticked.
    • onPlayerRightClickBlock

      protected void onPlayerRightClickBlock(@Nonnull io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent event)
      Override this method to add custom code to be executed when this block is right-clicked.
      Parameters:
      event - The PlayerRightClickEvent that was fired.
    • onPlayerBreaksBlock

      @ParametersAreNonnullByDefault protected void onPlayerBreaksBlock(BlockBreakEvent event, ItemStack item, List<ItemStack> drops)
      Override this method to add custom code to be executed when this block is broken.
      Parameters:
      event - The BlockBreakEvent that was fired.
      item - The ItemStack that was used to break this block.
      drops - The List of ItemStacks that will be dropped when this block is broken.