mmb.engine.mods.Modfile 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<
The newest version!
/**
*
*/
package mmb.engine.mods;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import mmb.engine.files.AdvancedFile;
import mmb.engine.files.OnlineFile;
/**
* Represents a modfile which may conain mods or other content
* @author oskar
*/
public class Modfile {
/** The displayed mod path */
public final String path;
/** The type of the modfile */
public ModfileState state = ModfileState.MEDIA;
/** The mod file reference */
public final AdvancedFile file;
/** Is the modfile valid? */
public boolean hasValidData = false;
private final Set classnames0 = new HashSet<>();
/** List of classes contained in this mod */
public final Set classnames = Collections.unmodifiableSet(classnames0);
/** @return is the mod downloaded on load? */
public boolean isOnline() {
return file instanceof OnlineFile;
}
/**
* Creates a modfile
* @param path display mod path
* @param file mod file reference
*/
public Modfile(String path, AdvancedFile file) {
super();
this.path = path;
this.file = file;
}
/**
* Adds a loaded class to the modfile
* @param path1 path to the class file
*/
public void addClassName(String path1) {
String shorter = path1.substring(0, path1.length() - 6);
shorter = shorter.replace('/', '.');
shorter = shorter.replace('\\', '.');
classnames0.add(shorter);
Mods.classnames.add(shorter);
}
}