Renderer/src/main/java/electrosphere/data/block/BlockData.java
austin 7f33ba6348
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
moving data classes around
2025-05-11 16:32:37 -04:00

48 lines
1.1 KiB
Java

package electrosphere.data.block;
import java.util.Set;
/**
* A list of all block types in game
*/
public class BlockData {
//The set of all voxel types
Set<BlockType> types;
/**
* Gets all block types
* @return The set of all block types
*/
public Set<BlockType> getTypes(){
return types;
}
/**
* Gets the block type by its name, or null if that type does not exist
* @param name The name of the block type
* @return The block type or null
*/
public BlockType getTypeFromName(String name){
for(BlockType type : types){
if(type.name.contains(name)){
return type;
}
}
return null;
}
/**
* Gets the block type by its id, or null if that type does not exist
* @param id The id of the block type
* @return The block type or null
*/
public BlockType getTypeFromId(int id){
for(BlockType type : types){
if(type.id == id){
return type;
}
}
return null;
}
}