Class BlockTicker
- java.lang.Object
-
- me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker
-
- All Implemented Interfaces:
ItemHandler
- Direct Known Subclasses:
RainbowTicker
public abstract class BlockTicker extends Object implements ItemHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
unique
-
Constructor Summary
Constructors Constructor Description BlockTicker()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Class<? extends ItemHandler>
getIdentifier()
This method returns the identifier for thisItemHandler
.abstract boolean
isSynchronized()
This method must be overridden to define whether a Block needs to be run on the main server thread (World Manipulation requires that)void
startNewTick()
This method resets the 'unique' flag foruniqueTick()
abstract void
tick(Block b, SlimefunItem item, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data)
This method is called every tick for every blockvoid
uniqueTick()
This method is called every tick but not per-block and only once.void
update()
Optional<IncompatibleItemHandlerException>
validate(SlimefunItem item)
This method is used to check whether a givenSlimefunItem
is compatible with thisItemHandler
, it will return anIncompatibleItemHandlerException
if the items are not compatible.-
Methods inherited from interface me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler
isPrivate
-
-
-
-
Method Detail
-
update
public void update()
-
validate
public Optional<IncompatibleItemHandlerException> validate(SlimefunItem item)
Description copied from interface:ItemHandler
This method is used to check whether a givenSlimefunItem
is compatible with thisItemHandler
, it will return anIncompatibleItemHandlerException
if the items are not compatible.- Specified by:
validate
in interfaceItemHandler
- Parameters:
item
- TheSlimefunItem
to validate- Returns:
- An
Optional
describing the result, it will contain anIncompatibleItemHandlerException
should there be an issue
-
isSynchronized
public abstract boolean isSynchronized()
This method must be overridden to define whether a Block needs to be run on the main server thread (World Manipulation requires that)- Returns:
- Whether this task should run on the main server thread
-
tick
public abstract void tick(Block b, SlimefunItem item, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data)
This method is called every tick for every block- Parameters:
b
- TheBlock
that was tickeditem
- The correspondingSlimefunItem
data
- The data stored in thisBlock
-
uniqueTick
public void uniqueTick()
This method is called every tick but not per-block and only once.
-
getIdentifier
public Class<? extends ItemHandler> getIdentifier()
Description copied from interface:ItemHandler
This method returns the identifier for thisItemHandler
. We use aClass
identifier to group Item Handlers together.- Specified by:
getIdentifier
in interfaceItemHandler
- Returns:
- The
Class
identifier for thisItemHandler
-
startNewTick
public void startNewTick()
This method resets the 'unique' flag foruniqueTick()
-
-