mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-17 13:47:11 +00:00
42 lines
1.3 KiB
Java
42 lines
1.3 KiB
Java
/*
|
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
|
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
|
* Send enquiries to dratcliffe@gmail.com
|
|
*/
|
|
|
|
package dan200.computercraft.shared.computer.items;
|
|
|
|
import dan200.computercraft.shared.ComputerCraftRegistry;
|
|
import dan200.computercraft.shared.computer.blocks.TileComputer;
|
|
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
public final class ComputerItemFactory
|
|
{
|
|
private ComputerItemFactory() {}
|
|
|
|
@Nonnull
|
|
public static ItemStack create( TileComputer tile )
|
|
{
|
|
return create( tile.getComputerID(), tile.getLabel(), tile.getFamily() );
|
|
}
|
|
|
|
@Nonnull
|
|
public static ItemStack create( int id, String label, ComputerFamily family )
|
|
{
|
|
switch( family )
|
|
{
|
|
case NORMAL:
|
|
return ComputerCraftRegistry.ModItems.COMPUTER_NORMAL.create( id, label );
|
|
case ADVANCED:
|
|
return ComputerCraftRegistry.ModItems.COMPUTER_ADVANCED.create( id, label );
|
|
case COMMAND:
|
|
return ComputerCraftRegistry.ModItems.COMPUTER_COMMAND.create( id, label );
|
|
default:
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}
|
|
}
|