private void loadTweaks(ItemStack stack, IPowerModule module) { NBTTagCompound itemTag = MuseItemUtils.getMuseItemTag(stack); NBTTagCompound moduleTag = itemTag.getCompoundTag(module.getDataName()); propertyStrings = new HashMap(); Set<String> tweaks = new HashSet<String>(); Map<String, List<IPropertyModifier>> propertyModifiers = module.getPropertyModifiers(); for (Map.Entry<String, List<IPropertyModifier>> property : propertyModifiers.entrySet()) { double currValue = 0; for (IPropertyModifier modifier : property.getValue()) { currValue = modifier.applyModifier(moduleTag, currValue); if (modifier instanceof PropertyModifierLinearAdditive) { tweaks.add(((PropertyModifierLinearAdditive) modifier).getTradeoffName()); } } propertyStrings.put(property.getKey(), currValue); } sliders = new LinkedList(); int y = 0; for (String tweak : tweaks) { y += 20; MusePoint2D center = new MusePoint2D((border.left() + border.right()) / 2, border.top() + y); ClickableTinkerSlider slider = new ClickableTinkerSlider(center, border.right() - border.left() - 8, moduleTag, tweak); sliders.add(slider); if (selectedSlider != null && slider.hitBox(center.x(), center.y())) { selectedSlider = slider; } } }
public ModuleTweakFrame( EntityClientPlayerMP player, MusePoint2D topleft, MusePoint2D bottomright, Colour borderColour, Colour insideColour, ItemSelectionFrame itemTarget, ModuleSelectionFrame moduleTarget) { super( topleft.times(1 / SCALERATIO), bottomright.times(1 / SCALERATIO), borderColour, insideColour); this.itemTarget = itemTarget; this.moduleTarget = moduleTarget; this.player = player; }