mmb.content.imachine.SpeedUpgrade Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multimachinebuilder Show documentation
Show all versions of multimachinebuilder Show documentation
Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world.
THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<
/**
*
*/
package mmb.content.imachine;
import mmb.Nil;
import mmb.engine.inv.storage.SingleItemInventory;
import mmb.engine.item.Item;
import mmb.engine.item.ItemEntry;
/**
* @author oskar
*
*/
public class SpeedUpgrade extends Item {
/** Speed mutiplier */
public final double speed;
/**
* Creates a speed upgrade
* @param speed speed mutiplier
*/
public SpeedUpgrade(double speed) {
this.speed = speed;
}
/**
* Gets a speed mutiplier
* @param inv inventory with speed upgrade
* @return speed mutiplier for the inventory
*/
public static double speedup(SingleItemInventory inv) {
return speedup(inv.getContents());
}
/**
* Gets a speed mutiplier
* @param ent speed upgrade
* @return speed mutiplier for the item
*/
public static double speedup(@Nil ItemEntry ent) {
if(ent instanceof SpeedUpgrade) return ((SpeedUpgrade) ent).speed;
return 1;
}
/**
* Gets a speed mutiplier (optimized)
* @param ent speed upgrade
* @return speed mutiplier for the item
*/
public static double speedup(@Nil SpeedUpgrade ent) {
if(ent != null) return ent.speed;
return 1;
}
}