mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-06-25 03:50:05 +02:00
29 lines
906 B
Java
29 lines
906 B
Java
package de.ellpeck.naturesaura.reg;
|
|
|
|
import net.minecraft.world.level.block.Block;
|
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
|
|
import java.util.Arrays;
|
|
|
|
public class ModTileType<T extends BlockEntity> implements IModItem {
|
|
|
|
public final BlockEntityType<T> type;
|
|
public final String name;
|
|
|
|
public ModTileType(BlockEntityType.BlockEntitySupplier<T> supplier, IModItem item) {
|
|
this(supplier, item.getBaseName(), item);
|
|
}
|
|
|
|
public ModTileType(BlockEntityType.BlockEntitySupplier<T> supplier, String name, IModItem... items) {
|
|
this.name = name;
|
|
var blocks = Arrays.stream(items).map(i -> (Block) i).toArray(Block[]::new);
|
|
this.type = BlockEntityType.Builder.of(supplier, blocks).build(null);
|
|
}
|
|
|
|
@Override
|
|
public String getBaseName() {
|
|
return this.name;
|
|
}
|
|
}
|