net.minecraft.launchwrapper.IClassTransformer Java Examples
The following examples show how to use
net.minecraft.launchwrapper.IClassTransformer.
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: MixinServiceLaunchWrapper.java From Mixin with MIT License | 6 votes |
@Override public Collection<ITransformer> getTransformers() { List<IClassTransformer> transformers = Launch.classLoader.getTransformers(); List<ITransformer> wrapped = new ArrayList<ITransformer>(transformers.size()); for (IClassTransformer transformer : transformers) { if (transformer instanceof ITransformer) { wrapped.add((ITransformer)transformer); } else { wrapped.add(new LegacyTransformerHandle(transformer)); } if (transformer instanceof IClassNameTransformer) { MixinServiceAbstract.logger.debug("Found name transformer: {}", transformer.getClass().getName()); this.nameTransformer = (IClassNameTransformer)transformer; } } return wrapped; }
Example #2
Source File: MixinServiceLaunchWrapper.java From Mixin with MIT License | 5 votes |
private void findNameTransformer() { List<IClassTransformer> transformers = Launch.classLoader.getTransformers(); for (IClassTransformer transformer : transformers) { if (transformer instanceof IClassNameTransformer) { MixinServiceAbstract.logger.debug("Found name transformer: {}", transformer.getClass().getName()); this.nameTransformer = (IClassNameTransformer) transformer; } } }
Example #3
Source File: MCPDeobfuscationTransformer.java From CodeChickenCore with MIT License | 5 votes |
public static void loadCallback() { if (ObfMapping.obfuscated) { //move ourselves to the end List<IClassTransformer> transformers = getTransformers(); transformers.remove(instance); transformers.add(instance); } else { //remap access transformers for (IClassTransformer t : getTransformers()) if (t instanceof AccessTransformer) remapAccessTransformer(t); } }
Example #4
Source File: MCPDeobfuscationTransformer.java From CodeChickenCore with MIT License | 5 votes |
@SuppressWarnings("unchecked") private static void remapAccessTransformer(IClassTransformer t) { Multimap<String, ?> modifiers = (Multimap<String, ?>) get(f_modifiers, t); Multimap<String, Object> t_modifiers = HashMultimap.create(); for (Entry<String, ?> entry : modifiers.entries()) { Object mod = entry.getValue(); String m_owner = entry.getKey().replace('.', '/'); String m_name = (String) get(f_Modifier_name, mod); String m_desc = ((String) get(f_Modifier_desc, mod)).replace('.', '/'); ObfMapping map; if (m_name.equals("*")) { map = new ObfMapping(m_owner); map.s_name = m_name; map.s_desc = m_desc; } else { try { map = new ObfMapping(m_owner, m_name, m_desc).toClassloading(); } catch (Exception e) { new Object(); continue; } } set(f_Modifier_name, mod, map.s_name); set(f_Modifier_desc, mod, map.s_desc); t_modifiers.put(map.javaClass(), mod); } set(f_modifiers, t, t_modifiers); }
Example #5
Source File: DelegatedTransformer.java From CodeChickenCore with MIT License | 5 votes |
public DelegatedTransformer() { delegatedTransformers = new ArrayList<IClassTransformer>(); try { m_defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE); m_defineClass.setAccessible(true); f_cachedClasses = LaunchClassLoader.class.getDeclaredField("cachedClasses"); f_cachedClasses.setAccessible(true); } catch(Exception e) { throw new RuntimeException(e); } }
Example #6
Source File: DelegatedTransformer.java From CodeChickenCore with MIT License | 5 votes |
@Override public byte[] transform(String name, String tname, byte[] bytes) { if (bytes == null) return null; for(IClassTransformer trans : delegatedTransformers) bytes = trans.transform(name, tname, bytes); return bytes; }
Example #7
Source File: LegacyTransformerHandle.java From Mixin with MIT License | 4 votes |
LegacyTransformerHandle(IClassTransformer transformer) { this.transformer = transformer; }
Example #8
Source File: MCPDeobfuscationTransformer.java From CodeChickenCore with MIT License | 4 votes |
@SuppressWarnings("unchecked") private static List<IClassTransformer> getTransformers() { return (List<IClassTransformer>) get(f_transformers, Launch.classLoader); }