Class ProgressBarComponent<T extends IComponentHarness>
java.lang.Object
com.hrznstudio.titanium.component.progress.ProgressBarComponent<T>
- All Implemented Interfaces:
IScreenAddonProvider,IContainerAddonProvider,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
public class ProgressBarComponent<T extends IComponentHarness>
extends Object
implements net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>, IScreenAddonProvider, IContainerAddonProvider
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionProgressBarComponent(int posX, int posY, int maxProgress) ProgressBarComponent(int posX, int posY, int progress, int maxProgress) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(net.minecraft.nbt.CompoundTag nbt) Gets the bar directionGets if the progress can be increasedGets if the bar can resetnet.minecraft.world.item.DyeColorgetColor()Gets the color of the barGets the tile where this bar is runningList<IFactory<? extends IContainerAddon>>booleanintGets the max progress of the barintgetPosX()Gets where the bar is located in the XintgetPosY()Gets where the bar is located in the XintGets the current progressintGets how much the bar increases when it can increase progressList<IFactory<? extends IScreenAddon>>Gets the Gui Addons that it will be added to the machine GUIintGets how often the bar ticksvoidonStart()net.minecraft.nbt.CompoundTagsetBarDirection(ProgressBarComponent.BarDirection direction) Sets the direction render for the bar in the guisetCanIncrease(Predicate<T> canIncrease) Sets a predicate to check if the bar can be increasedsetCanReset(Predicate<T> canReset) Sets if the the bar can be reseted when the progress is completedsetColor(net.minecraft.world.item.DyeColor color) Set the color of the progress barsetComponentHarness(T componentHarness) Sets the tile where this bar is runningsetIncreaseType(boolean increaseType) Changes how the progress bar behaves when workingsetMaxProgress(int maxProgress) Sets the max progress of the barsetOnFinishWork(Runnable runnable) Sets a runnable to be executed when the bar is completedsetOnStart(Runnable runnable) Sets a runnable to be executed every time the bar starts from 0setOnTickWork(Runnable runnable) Sets a runnable to be executed every time the bar ticksvoidsetProgress(int progress) Sets the progress bar progresssetProgressIncrease(int progressIncrease) Sets how much the bar will increase when it can increasesetTickingTime(int tickingTime) Sets how often the bar ticksvoidtickBar()Ticks the bar so it can increase if possible, managed byMultiProgressBarHandler.update()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.hrznstudio.titanium.container.addon.IContainerAddonProvider
canInteract
-
Constructor Details
-
ProgressBarComponent
public ProgressBarComponent(int posX, int posY, int maxProgress) -
ProgressBarComponent
public ProgressBarComponent(int posX, int posY, int progress, int maxProgress)
-
-
Method Details
-
setOnFinishWork
Sets a runnable to be executed when the bar is completed- Parameters:
runnable- The runnable- Returns:
- Self
-
setOnTickWork
Sets a runnable to be executed every time the bar ticks- Parameters:
runnable- The runnable- Returns:
- Self
-
setOnStart
Sets a runnable to be executed every time the bar starts from 0- Parameters:
runnable- The runnable- Returns:
- Self
-
setComponentHarness
Sets the tile where this bar is running- Parameters:
componentHarness- The tile- Returns:
- Self
-
getComponentHarness
Gets the tile where this bar is running- Returns:
- The tile
-
getCanReset
Gets if the bar can reset- Returns:
- True if the bar can be reseted
-
setCanReset
Sets if the the bar can be reseted when the progress is completed- Parameters:
canReset- A Predicate- Returns:
- Self
-
getIncreaseType
public boolean getIncreaseType() -
setIncreaseType
Changes how the progress bar behaves when working- Parameters:
increaseType- True if the progress bar increases when working, false if the progress bar decreases when working- Returns:
- itself
-
tickBar
public void tickBar()Ticks the bar so it can increase if possible, managed byMultiProgressBarHandler.update() -
getPosX
public int getPosX()Gets where the bar is located in the X- Returns:
- the x position
-
getPosY
public int getPosY()Gets where the bar is located in the X- Returns:
- the y position
-
getCanIncrease
Gets if the progress can be increased- Returns:
- A predicate
-
setCanIncrease
Sets a predicate to check if the bar can be increased- Parameters:
canIncrease- A predicate- Returns:
- Self
-
getProgress
public int getProgress()Gets the current progress- Returns:
- The progress
-
setProgress
public void setProgress(int progress) Sets the progress bar progress- Parameters:
progress- The progress to set
-
getMaxProgress
public int getMaxProgress()Gets the max progress of the bar- Returns:
- The bas progress
-
setMaxProgress
Sets the max progress of the bar- Parameters:
maxProgress- The max progress- Returns:
- Self
-
getTickingTime
public int getTickingTime()Gets how often the bar ticks- Returns:
- The tick the bar tries to increase
-
setTickingTime
Sets how often the bar ticks- Parameters:
tickingTime- The ticking time- Returns:
- Self
-
getProgressIncrease
public int getProgressIncrease()Gets how much the bar increases when it can increase progress- Returns:
- The amount it increases
-
setProgressIncrease
Sets how much the bar will increase when it can increase- Parameters:
progressIncrease- The increase amount- Returns:
- Self
-
getBarDirection
Gets the bar direction- Returns:
- The bar direction
-
setBarDirection
Sets the direction render for the bar in the gui- Parameters:
direction- The bar direction- Returns:
- Self
-
getColor
public net.minecraft.world.item.DyeColor getColor()Gets the color of the bar- Returns:
- the color
-
setColor
Set the color of the progress bar- Parameters:
color- the color- Returns:
- Self
-
getScreenAddons
Gets the Gui Addons that it will be added to the machine GUI- Specified by:
getScreenAddonsin interfaceIScreenAddonProvider- Returns:
- A list of GUI addon factories
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT()- Specified by:
serializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<T extends IComponentHarness>
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag nbt) - Specified by:
deserializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<T extends IComponentHarness>
-
onStart
public void onStart() -
getContainerAddons
- Specified by:
getContainerAddonsin interfaceIContainerAddonProvider
-