@Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setString("SpellScript", Strings.join(script.getChant(), " ")); compound.setFloat("MagicEnergy", energy); NBTUtils.convertFacingToTag(compound, this.direction); }
protected void resolve() { // resolve fields baseName = resolve(baseName, true); appendix = resolve(appendix, true); version = resolve(version, true); classifier = resolve(classifier, true); extension = resolve(extension, true); // resolve classpath if (classpath != null) classpath = project.files(classpath); // skip if its already been set by the user. if (archiveSet) return; StringBuilder builder = new StringBuilder(); builder.append(baseName); if (!Strings.isNullOrEmpty((String) appendix)) { builder.append('-'); builder.append(appendix); } if (!Strings.isNullOrEmpty((String) version)) { builder.append('-'); builder.append(version); } if (!Strings.isNullOrEmpty((String) classifier)) { builder.append('-'); builder.append(classifier); } builder.append('.'); builder.append(extension); archiveName = builder.toString(); }
public static String createPeripheralHelpText( Class<? extends Object> cls, String type, IMethodMap methods) { StringBuilder builder = new StringBuilder(); builder.append("----OpenPeripheral doc----\n"); builder.append("Peripheral type: "); builder.append(type); builder.append("\n\n"); final String docText = DOC_TEXT_CACHE.getOrCreate(cls); if (!Strings.isNullOrEmpty(docText)) { builder.append(docText); builder.append("\n\n"); } builder.append("---Methods---\n"); listMethods(builder, methods); return builder.toString(); }
private static String createDocString(IMethodDescription desc) { // (arg:type[, optionArg:type]):resultType -- Description List<String> args = Lists.newArrayList(); for (IArgumentDescription arg : desc.arguments()) args.add(arg.name() + ":" + decorate(arg.type().describe(), arg)); final IScriptType returnTypes = desc.returnTypes(); String argsJoined = Joiner.on(',').join(args); String argsAndResult; if (TypeHelper.isVoid(returnTypes)) { argsAndResult = String.format("(%s)", argsJoined); } else { final String ret = returnTypes.describe(); argsAndResult = String.format("(%s):%s", argsJoined, ret); } return !Strings.isNullOrEmpty(desc.description()) ? argsAndResult + " -- " + desc.description() : argsAndResult; }