All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mmb.content.imachine.SpeedUpgrade Maven / Gradle / Ivy

Go to download

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<

There is a newer version: 0.6
Show newest version
/**
 * 
 */
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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy