use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class DimletWorkbenchTileEntity method startExtracting.
private void startExtracting() {
if (extracting > 0) {
// Already extracting
return;
}
ItemStack stack = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_INPUT);
if (!stack.isEmpty()) {
if (ModItems.knownDimletItem.equals(stack.getItem())) {
DimletKey key = KnownDimletConfiguration.getDimletKey(stack);
Settings settings = KnownDimletConfiguration.getSettings(key);
if (settings != null && settings.isDimlet()) {
if (!KnownDimletConfiguration.isCraftable(key)) {
extracting = 64;
idToExtract = key;
inventoryHelper.decrStackSize(DimletWorkbenchContainer.SLOT_INPUT, 1);
markDirty();
}
}
}
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class GuiDimletWorkbench method suggestParts.
private void suggestParts() {
int selected = itemList.getSelected();
if (selected == -1) {
return;
}
Widget widget = itemList.getChild(selected);
Object userObject = widget.getUserObject();
if (userObject instanceof DimletKey) {
DimletKey key = (DimletKey) userObject;
sendServerCommand(RFToolsDimMessages.INSTANCE, DimletWorkbenchTileEntity.CMD_SUGGESTPARTS, new Argument("type", key.getType().dimletType.getName()), new Argument("id", key.getId()));
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class CmdCreateDimension method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (!(sender instanceof EntityPlayer)) {
sender.sendMessage(new TextComponentString(TextFormatting.RED + "You must be a player to use this command!"));
return;
}
EntityPlayer player = (EntityPlayer) sender;
if (args.length < 2) {
player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "The name parameter is missing!"), false);
return;
} else if (args.length > 4) {
player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Too many parameters!"), false);
return;
}
String name = fetchString(player, args, 1, "");
String terrainName = fetchString(player, args, 2, "Void");
List<DimletKey> descriptors;
if (terrainName.charAt(0) == '@') {
descriptors = DimensionDescriptor.parseDescriptionString(terrainName);
for (DimletKey key : descriptors) {
if (key.getType() == null) {
player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Invalid descriptor!"), false);
return;
}
}
} else {
TerrainType terrainType = TerrainType.getTerrainById(terrainName);
if (terrainType == null) {
player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Unknown terrain type!"), false);
return;
}
descriptors = new ArrayList<>(1);
descriptors.add(new DimletKey(DimletType.DIMLET_TERRAIN, terrainType.getId()));
}
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(player.getEntityWorld());
DimensionDescriptor descriptor = new DimensionDescriptor(descriptors, fetchInt(player, args, 3, 0));
Integer dim = dimensionManager.getDimensionID(descriptor);
if (dim != null) {
player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "A dimension with that descriptor already exists: " + dim), false);
return;
}
dim = dimensionManager.createNewDimension(player.getEntityWorld(), descriptor, name, player.getName(), player.getPersistentID());
player.sendStatusMessage(new TextComponentString(TextFormatting.GREEN + "Created dimension: " + dim), false);
dimensionManager.save(player.getEntityWorld());
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class CmdCreateDimlet method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (!(sender instanceof EntityPlayer)) {
sender.sendMessage(new TextComponentString(TextFormatting.RED + "This command only works as a player!"));
return;
}
EntityPlayer player = (EntityPlayer) sender;
if (args.length != 3) {
player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Bad parameters!"), false);
return;
}
String typeString = fetchString(player, args, 1, "material");
String name = fetchString(player, args, 2, "");
DimletType type = DimletType.getTypeByName(typeString);
if (type == null) {
player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Bad type!"), false);
return;
}
ItemStack dimlet = KnownDimletConfiguration.getDimletStack(new DimletKey(type, name));
InventoryHelper.mergeItemStack(player.inventory, false, dimlet, 0, 35, null);
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class DimensionInformation method getMaterialAndFluidModifiers.
public static void getMaterialAndFluidModifiers(List<DimletKey> modifiers, List<IBlockState> blocks, List<Block> fluids) {
if (modifiers != null) {
for (DimletKey modifier : modifiers) {
if (modifier.getType() == DimletType.DIMLET_MATERIAL) {
IBlockState block = DimletObjectMapping.getBlock(modifier);
blocks.add(block);
} else if (modifier.getType() == DimletType.DIMLET_LIQUID) {
Block fluid = DimletObjectMapping.getFluid(modifier);
fluids.add(fluid);
}
}
}
}
Aggregations