net.fabricmc.mapping.tree.TinyTree Java Examples
The following examples show how to use
net.fabricmc.mapping.tree.TinyTree.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FabricMappingResolver.java From fabric-loader with Apache License 2.0 | 6 votes |
protected final NamespaceData getNamespaceData(String namespace) { return namespaceDataMap.computeIfAbsent(namespace, (fromNamespace) -> { if (!namespaces.contains(namespace)) { throw new IllegalArgumentException("Unknown namespace: " + namespace); } NamespaceData data = new NamespaceData(); TinyTree mappings = mappingsSupplier.get(); Map<String, String> classNameMap = new HashMap<>(); for (ClassDef classEntry : mappings.getClasses()) { String fromClass = mapClassName(classNameMap, classEntry.getName(fromNamespace)); String toClass = mapClassName(classNameMap, classEntry.getName(targetNamespace)); data.classNames.put(fromClass, toClass); data.classNamesInverse.put(toClass, fromClass); String mappedClassName = mapClassName(classNameMap, fromClass); recordMember(fromNamespace, classEntry.getFields(), data.fieldNames, mappedClassName); recordMember(fromNamespace, classEntry.getMethods(), data.methodNames, mappedClassName); } return data; }); }
Example #2
Source File: TinyRemapperMappingsHelper.java From fabric-loader with Apache License 2.0 | 6 votes |
public static IMappingProvider create(TinyTree mappings, String from, String to) { return (acceptor) -> { for (ClassDef classDef : mappings.getClasses()) { String className = classDef.getName(from); acceptor.acceptClass(className, classDef.getName(to)); for (FieldDef field : classDef.getFields()) { acceptor.acceptField(memberOf(className, field.getName(from), field.getDescriptor(from)), field.getName(to)); } for (MethodDef method : classDef.getMethods()) { IMappingProvider.Member methodIdentifier = memberOf(className, method.getName(from), method.getDescriptor(from)); acceptor.acceptMethod(methodIdentifier, method.getName(to)); } } }; }
Example #3
Source File: OptifineSetup.java From OptiFabric with Mozilla Public License 2.0 | 5 votes |
IMappingProvider createMappings(String from, String to) { //In dev if (fabricLauncher.isDevelopment()) { try { File fullMappings = extractMappings(); return (out) -> { RemapUtils.getTinyRemapper(fullMappings, from, to).load(out); //TODO use the mappings API here to stop neededing to change this each version out.acceptField(new IMappingProvider.Member("dbq", "CLOUDS", "Ldbe;"), "CLOUDS_OF"); out.acceptField(new IMappingProvider.Member("dqr", "renderDistance", "I"), "renderDistance_OF"); }; } catch (Exception e) { throw new RuntimeException(e); } } //In prod TinyTree mappingsNew = new TinyTree() { private final TinyTree mappings = mappingConfiguration.getMappings(); @Override public TinyMetadata getMetadata() { return mappings.getMetadata(); } @Override public Map<String, ClassDef> getDefaultNamespaceClassMap() { return mappings.getDefaultNamespaceClassMap(); } @Override public Collection<ClassDef> getClasses() { return mappings.getClasses(); } }; return TinyRemapperMappingsHelper.create(mappingsNew, from, to); }
Example #4
Source File: FabricMixinBootstrap.java From fabric-loader with Apache License 2.0 | 5 votes |
public static void init(EnvType side, FabricLoader loader) { if (initialized) { throw new RuntimeException("FabricMixinBootstrap has already been initialized!"); } if (FabricLauncherBase.getLauncher().isDevelopment()) { MappingConfiguration mappingConfiguration = FabricLauncherBase.getLauncher().getMappingConfiguration(); TinyTree mappings = mappingConfiguration.getMappings(); if (mappings != null) { List<String> namespaces = mappings.getMetadata().getNamespaces(); if (namespaces.contains("intermediary") && namespaces.contains(mappingConfiguration.getTargetNamespace())) { System.setProperty("mixin.env.remapRefMap", "true"); try { MixinIntermediaryDevRemapper remapper = new MixinIntermediaryDevRemapper(mappings, "intermediary", mappingConfiguration.getTargetNamespace()); MixinEnvironment.getDefaultEnvironment().getRemappers().add(remapper); LOGGER.info("Loaded Fabric development mappings for mixin remapper!"); } catch (Exception e) { LOGGER.error("Fabric development environment setup error - the game will probably crash soon!"); e.printStackTrace(); } } } } MixinBootstrap.init(); getMixinConfigs(loader, side).forEach(FabricMixinBootstrap::addConfiguration); initialized = true; }
Example #5
Source File: MixinIntermediaryDevRemapper.java From fabric-loader with Apache License 2.0 | 5 votes |
public MixinIntermediaryDevRemapper(TinyTree mappings, String from, String to) { super(mappings, from, to); for (ClassDef classDef : mappings.getClasses()) { allPossibleClassNames.add(classDef.getName(from)); allPossibleClassNames.add(classDef.getName(to)); putMemberInLookup(from, to, classDef.getFields(), nameFieldLookup, nameDescFieldLookup); putMemberInLookup(from, to, classDef.getMethods(), nameMethodLookup, nameDescMethodLookup); } }
Example #6
Source File: FabricMappingResolver.java From fabric-loader with Apache License 2.0 | 4 votes |
FabricMappingResolver(Supplier<TinyTree> mappingsSupplier, String targetNamespace) { this.mappingsSupplier = mappingsSupplier; this.targetNamespace = targetNamespace; namespaces = Collections.unmodifiableSet(new HashSet<>(mappingsSupplier.get().getMetadata().getNamespaces())); }