/** Adds the trait to be added if the specified stats are used. */ public Material addTrait(ITrait materialTrait, String dependency) { // register unregistered traits if (TinkerRegistry.checkMaterialTrait(this, materialTrait, dependency)) { getStatTraits(dependency).add(materialTrait); } return this; }
public void setOutput(ItemStack stack) { if (stack == null) { return; } // ensure that the output is valid for (ItemStack candidate : TinkerRegistry.getStencilTableCrafting()) { // NBT sensitive if (ItemStack.areItemStacksEqual(stack, candidate)) { // yay output = stack; updateResult(); return; } } }
public static void addModifierTooltips(ItemStack stack, List<String> tooltips) { NBTTagList tagList = TagUtil.getModifiersTagList(stack); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); ModifierNBT data = ModifierNBT.readTag(tag); // get matching modifier IModifier modifier = TinkerRegistry.getModifier(data.identifier); if (modifier == null || modifier.isHidden()) { continue; } tooltips.add(data.getColorString() + modifier.getTooltip(tag, false)); } }
public TooltipBuilder addModifierInfo() { NBTTagList tagList = TagUtil.getModifiersTagList(stack); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); ModifierNBT data = ModifierNBT.readTag(tag); // get matching modifier IModifier modifier = TinkerRegistry.getModifier(data.identifier); if (modifier == null || modifier.isHidden()) { continue; } for (String string : modifier.getExtraInfo(stack, tag)) { if (!string.isEmpty()) { tips.add(data.getColorString() + string); } } } return this; }
static { RenderMaterials = new Material[4]; RenderMaterials[0] = new MaterialGUI("_internal_render1"); RenderMaterials[0].setRenderInfo(0x684e1e); RenderMaterials[1] = new MaterialGUI("_internal_render2"); RenderMaterials[1].setRenderInfo(0xc1c1c1); RenderMaterials[2] = new MaterialGUI("_internal_render3"); RenderMaterials[2].setRenderInfo(0x2376dd); RenderMaterials[3] = new MaterialGUI("_internal_render4"); RenderMaterials[3].setRenderInfo(0x7146b0); for (Material mat : RenderMaterials) { // yes, these will only be registered clientside // but it shouldn't matter because they're never used serverside and we don't use indices TinkerRegistry.addMaterial(mat); } TinkerRegistry.tabTools.setDisplayIcon( TinkerTools.pickaxe.buildItemForRendering( ImmutableList.of(RenderMaterials[0], RenderMaterials[1], RenderMaterials[2]))); TinkerRegistry.tabParts.setDisplayIcon( TinkerTools.pickHead.getItemstackWithMaterial(RenderMaterials[2])); }
@Override public void transform(BookData book, SectionData data) { data.source = BookRepository.DUMMY; data.parent = book; Collection<Material> materialList = TinkerRegistry.getAllMaterials(); // calculate pages needed int count = materialList.size(); List<ContentPageIconList> listPages = Lists.newArrayList(); while (count > 0) { ContentPageIconList overview = new ContentPageIconList(20); PageData page = new PageData(true); page.source = data.source; page.parent = data; page.content = overview; page.load(); data.pages.add(page); overview.title = book.translate("materials"); listPages.add(overview); count -= overview.getMaxIconCount(); } ListIterator<ContentPageIconList> iter = listPages.listIterator(1); while (iter.hasNext()) { // same scale if multiple pages iter.next().maxScale = 1f; } iter = listPages.listIterator(); ContentPageIconList overview = iter.next(); for (Material material : TinkerRegistry.getAllMaterials()) { if (material.isHidden() || material.getAllStats().isEmpty() || !material.hasItems()) { continue; } if (!material.hasStats(MaterialTypes.HEAD) && !material.hasStats(MaterialTypes.HEAD) && !material.hasStats(MaterialTypes.HEAD)) { continue; } PageData page = new PageData(true); page.source = data.source; page.parent = data; page.name = material.getIdentifier(); page.type = ContentMaterial.ID; page.content = new ContentMaterial(material); page.load(); SizedBookElement icon; if (material.getRepresentativeItem() != null) { icon = new ElementItem(0, 0, 1f, material.getRepresentativeItem()); } else { icon = new ElementImage(ImageData.MISSING); } if (!overview.addLink(icon, material.getLocalizedNameColored(), page)) { overview = iter.next(); } data.pages.add(page); } }