本文整理汇总了Java中net.minecraft.launchwrapper.ITweaker类的典型用法代码示例。如果您正苦于以下问题:Java ITweaker类的具体用法?Java ITweaker怎么用?Java ITweaker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ITweaker类属于net.minecraft.launchwrapper包,在下文中一共展示了ITweaker类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LegacyJavaFixer
import net.minecraft.launchwrapper.ITweaker; //导入依赖的package包/类
public LegacyJavaFixer()
{
@SuppressWarnings("unchecked")
ListIterator<ITweaker> itr = ((List<ITweaker>)Launch.blackboard.get("Tweaks")).listIterator();
ITweaker replacement = new SortReplacement();
while (itr.hasNext())
{
ITweaker t = itr.next();
FMLRelaunchLog.log.info("[LegacyJavaFixer] Tweaker: " + t);
if (t instanceof FMLInjectionAndSortingTweaker)
{
itr.set(replacement);
FMLRelaunchLog.info("[LegacyJavaFixer] Replacing tweaker %s with %s", t, replacement);
}
}
}
示例2: injectCoreModTweaks
import net.minecraft.launchwrapper.ITweaker; //导入依赖的package包/类
public static void injectCoreModTweaks(FMLInjectionAndSortingTweaker fmlInjectionAndSortingTweaker)
{
@SuppressWarnings("unchecked")
List<ITweaker> tweakers = (List<ITweaker>) Launch.blackboard.get("Tweaks");
// Add the sorting tweaker first- it'll appear twice in the list
tweakers.add(0, fmlInjectionAndSortingTweaker);
for (FMLPluginWrapper wrapper : loadPlugins)
{
tweakers.add(wrapper);
}
}
示例3: sort
import net.minecraft.launchwrapper.ITweaker; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void sort()
{
List<ITweaker> tweakers = (List<ITweaker>) Launch.blackboard.get("Tweaks");
// Basically a copy of Collections.sort pre 8u20, optimized as we know we're an array list.
// Thanks unhelpful fixer of http://bugs.java.com/view_bug.do?bug_id=8032636
ITweaker[] toSort = tweakers.toArray(new ITweaker[tweakers.size()]);
Arrays.sort(toSort, new Comparator<ITweaker>()
{
@Override
public int compare(ITweaker o1, ITweaker o2)
{
return Ints.saturatedCast((long)getIndex(o1) - (long)getIndex(o2));
}
private int getIndex(ITweaker t)
{
try
{
if (t instanceof SortReplacement) return Integer.MIN_VALUE;
if (wrapperCls.isInstance(t)) return wrapperField.getInt(t);
if (tweakSorting.containsKey(t.getClass().getName())) return tweakSorting.get(t.getClass().getName());
}
catch (Exception e)
{
Throwables.propagate(e);
}
return 0;
}
});
// Basically a copy of Collections.sort, optimized as we know we're an array list.
// Thanks unhelpful fixer of http://bugs.java.com/view_bug.do?bug_id=8032636
for (int j = 0; j < toSort.length; j++) {
tweakers.set(j, toSort[j]);
}
}
示例4: injectCoreModTweaks
import net.minecraft.launchwrapper.ITweaker; //导入依赖的package包/类
public static void injectCoreModTweaks(FMLInjectionAndSortingTweaker fmlInjectionAndSortingTweaker)
{
List<ITweaker> tweakers = (List<ITweaker>) Launch.blackboard.get("Tweaks");
// Add the sorting tweaker first- it'll appear twice in the list
tweakers.add(0, fmlInjectionAndSortingTweaker);
for (FMLPluginWrapper wrapper : loadPlugins)
{
tweakers.add(wrapper);
}
}
示例5: sortTweakList
import net.minecraft.launchwrapper.ITweaker; //导入依赖的package包/类
public static void sortTweakList()
{
@SuppressWarnings("unchecked")
List<ITweaker> tweakers = (List<ITweaker>) Launch.blackboard.get("Tweaks");
// Basically a copy of Collections.sort pre 8u20, optimized as we know we're an array list.
// Thanks unhelpful fixer of http://bugs.java.com/view_bug.do?bug_id=8032636
ITweaker[] toSort = tweakers.toArray(new ITweaker[tweakers.size()]);
Arrays.sort(toSort, new Comparator<ITweaker>() {
@Override
public int compare(ITweaker o1, ITweaker o2)
{
Integer first = null;
Integer second = null;
if (o1 instanceof FMLInjectionAndSortingTweaker)
{
first = Integer.MIN_VALUE;
}
if (o2 instanceof FMLInjectionAndSortingTweaker)
{
second = Integer.MIN_VALUE;
}
if (o1 instanceof FMLPluginWrapper)
{
first = ((FMLPluginWrapper) o1).sortIndex;
}
else if (first == null)
{
first = tweakSorting.get(o1.getClass().getName());
}
if (o2 instanceof FMLPluginWrapper)
{
second = ((FMLPluginWrapper) o2).sortIndex;
}
else if (second == null)
{
second = tweakSorting.get(o2.getClass().getName());
}
if (first == null)
{
first = 0;
}
if (second == null)
{
second = 0;
}
return Ints.saturatedCast((long)first - (long)second);
}
});
// Basically a copy of Collections.sort, optimized as we know we're an array list.
// Thanks unhelpful fixer of http://bugs.java.com/view_bug.do?bug_id=8032636
for (int j = 0; j < toSort.length; j++) {
tweakers.set(j, toSort[j]);
}
}
示例6: sortTweakList
import net.minecraft.launchwrapper.ITweaker; //导入依赖的package包/类
public static void sortTweakList()
{
@SuppressWarnings("unchecked")
List<ITweaker> tweakers = (List<ITweaker>) Launch.blackboard.get("Tweaks");
Collections.sort(tweakers, new Comparator<ITweaker>() {
@Override
public int compare(ITweaker o1, ITweaker o2)
{
Integer first = null;
Integer second = null;
if (o1 instanceof FMLInjectionAndSortingTweaker)
{
first = Integer.MIN_VALUE;
}
if (o2 instanceof FMLInjectionAndSortingTweaker)
{
second = Integer.MIN_VALUE;
}
if (o1 instanceof FMLPluginWrapper)
{
first = ((FMLPluginWrapper) o1).sortIndex;
}
else if (first == null)
{
first = tweakSorting.get(o1.getClass().getName());
}
if (o2 instanceof FMLPluginWrapper)
{
second = ((FMLPluginWrapper) o2).sortIndex;
}
else if (second == null)
{
second = tweakSorting.get(o2.getClass().getName());
}
if (first == null)
{
first = 0;
}
if (second == null)
{
second = 0;
}
return Ints.saturatedCast((long)first - (long)second);
}
});
}
示例7: sortTweakList
import net.minecraft.launchwrapper.ITweaker; //导入依赖的package包/类
public static void sortTweakList()
{
List<ITweaker> tweakers = (List<ITweaker>) Launch.blackboard.get("Tweaks");
Collections.sort(tweakers, new Comparator<ITweaker>() {
@Override
public int compare(ITweaker o1, ITweaker o2)
{
Integer first = null;
Integer second = null;
if (o1 instanceof FMLInjectionAndSortingTweaker)
{
first = Integer.MIN_VALUE;
}
if (o2 instanceof FMLInjectionAndSortingTweaker)
{
second = Integer.MIN_VALUE;
}
if (o1 instanceof FMLPluginWrapper)
{
first = ((FMLPluginWrapper) o1).sortIndex;
}
else if (first == null)
{
first = tweakSorting.get(o1.getClass().getName());
}
if (o2 instanceof FMLPluginWrapper)
{
second = ((FMLPluginWrapper) o2).sortIndex;
}
else if (second == null)
{
second = tweakSorting.get(o2.getClass().getName());
}
if (first == null)
{
first = 0;
}
if (second == null)
{
second = 0;
}
return Ints.saturatedCast((long)first - (long)second);
}
});
}
示例8: MCITweaker
import net.minecraft.launchwrapper.ITweaker; //导入依赖的package包/类
public MCITweaker(ITweaker parent, List<Injector> injectors) {
MCITransformer.injectors.addAll(injectors);
this.parent = parent;
}