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 ofSefiSlimefunItemthat is used to create this block.
- All Implemented Interfaces:
io.github.thebusybiscuit.slimefun4.core.attributes.Placeable
- Direct Known Subclasses:
OwnedBlock,SimpleTickingBlock
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
ConstructorsModifierConstructorDescriptionprotectedSefiBlock(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 newSefiBlock.protectedSefiBlock(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 newSefiBlock. -
Method Summary
Modifier and TypeMethodDescriptionprotected TgetThis()Returns this objectbooleanReturns whether this block should allow androids to break it.booleanReturns whether this block should allow block placers.booleanReturns whether this block should allow explosions to break it.booleanisSync()Returns whether this block should ticked synchronously.protected voidonBlockPlaced(BlockPlaceEvent event) Override this method to add custom code to be executed when this block is placed.protected voidonPlayerBreaksBlock(BlockBreakEvent event, ItemStack item, List<ItemStack> drops) Override this method to add custom code to be executed when this block is broken.protected voidonPlayerRightClickBlock(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 voidonTick(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 voidOverride this method to add custom code to be executed when thisSlimefunItemis uniquely ticked.voidAdds 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
registerItemMethods 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, warnMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 newSefiBlock.- Parameters:
itemGroup- TheItemGroupthis block belongs to.item- TheSlimefunItemStackthat is used to create this block.recipeType- TheRecipeTypeof 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 newSefiBlock.- Parameters:
itemGroup- TheItemGroupthis block belongs to.item- TheSlimefunItemStackthat is used to create this block.recipeType- TheRecipeTypeof this block.recipe- The recipe of this block.recipeOutput- The output of this block.
-
-
Method Details
-
getThis
Returns this object- Overrides:
getThisin classSefiSlimefunItem<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:
preRegisterin classio.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
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
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
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
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
Override this method to add custom code to be executed when this block is placed.- Parameters:
event- TheBlockPlaceEventthat 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- TheBlockthat was ticked.item- TheSlimefunItemthat was ticked.data- TheConfigfromBlockStorage
-
onUniqueTick
protected void onUniqueTick()Override this method to add custom code to be executed when thisSlimefunItemis 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- ThePlayerRightClickEventthat 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- TheBlockBreakEventthat was fired.item- TheItemStackthat was used to break this block.drops- TheListofItemStacks that will be dropped when this block is broken.
-