本文整理汇总了Java中net.minecraft.launchwrapper.LogWrapper类的典型用法代码示例。如果您正苦于以下问题:Java LogWrapper类的具体用法?Java LogWrapper怎么用?Java LogWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogWrapper类属于net.minecraft.launchwrapper包,在下文中一共展示了LogWrapper类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readFromFile
import net.minecraft.launchwrapper.LogWrapper; //导入依赖的package包/类
static CacheState readFromFile(File file) {
if (!file.exists())
return null;
try {
try (val is = new ObjectInputStream(new FileInputStream(file))) {
return (CacheState) is.readObject();
}
} catch (Throwable t) {
LogWrapper.log(Level.WARN, t, "Error occured trying to read cache state from " + file);
return null;
}
}
开发者ID:nallar,项目名称:CachingClassLoader,代码行数:14,代码来源:CacheState.java
示例2: writeToFile
import net.minecraft.launchwrapper.LogWrapper; //导入依赖的package包/类
void writeToFile(File file) {
val temp = new File(file.getParentFile(), file.getName() + ".temp");
try {
try (val os = new ObjectOutputStream(new FileOutputStream(temp))) {
os.writeObject(this);
}
Files.move(temp.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
} catch (Throwable t) {
LogWrapper.log(Level.WARN, t, "Error occured trying to write cache state to " + file);
}
}
开发者ID:nallar,项目名称:CachingClassLoader,代码行数:12,代码来源:CacheState.java
示例3: closeCurrentCache
import net.minecraft.launchwrapper.LogWrapper; //导入依赖的package包/类
@SneakyThrows
private synchronized void closeCurrentCache() {
if (nextCache == null)
return;
nextCache.close();
cachedClasses = 0;
nextCache = null;
val current = nextCacheLocation();
val dest = new File(current.getParentFile(), current.getName().replace(".temp", ".jar"));
if (!current.renameTo(dest))
LogWrapper.severe("Unable to rename complete class cached from '%s' to '%s'", current, dest);
cacheZipCount++;
}
开发者ID:nallar,项目名称:CachingClassLoader,代码行数:15,代码来源:Cache.java
示例4: tryEnableItemStackRenderer
import net.minecraft.launchwrapper.LogWrapper; //导入依赖的package包/类
@Override
public void tryEnableItemStackRenderer()
{
if (gl32_enabled)
{
TickRegistry.registerTickHandler( new RenderTickHandler(),
Side.CLIENT );
}
else
{
LogWrapper.severe( "OpenGL 3.2 not detected, mod data dump for images and item/block JSON data will not work!" );
}
}
开发者ID:Maxwolf,项目名称:MC-MineAPI.Java,代码行数:14,代码来源:ClientProxy.java
示例5: invalidFingerprint
import net.minecraft.launchwrapper.LogWrapper; //导入依赖的package包/类
@EventHandler
public void invalidFingerprint(FMLFingerprintViolationEvent event) // NO_UCD (unused code)
{
// Check to see if fingerprint matches what we expect.
if (ModMetadata.FINGERPRINT.equals( ModMetadata.FINGERPRINT ))
{
LogWrapper.warning( "The copy of " + ModMetadata.NAME +
" that you are running passesd all verification and fingerprint checks. It has not been modified from original." );
}
else
{
LogWrapper.severe( "The copy of " + ModMetadata.NAME +
" that you are running has been modified from the original, and unpredictable things may happen. Please consider re-downloading the original version of the mod." );
}
}
开发者ID:Maxwolf,项目名称:MC-MineAPI.Java,代码行数:16,代码来源:ForgeMod.java
示例6: Cache
import net.minecraft.launchwrapper.LogWrapper; //导入依赖的package包/类
@SneakyThrows
public Cache(File dir) {
if (!dir.isDirectory() && !dir.mkdirs())
throw new IOException("Can't create directory: " + dir.getCanonicalPath());
dir = dir.getCanonicalFile();
this.dir = dir;
enabled = PropertyLoader.enableCaching();
if (!enabled)
return;
val cacheStateFile = new File(dir, "cachestate.obj");
val oldState = CacheState.readFromFile(cacheStateFile);
val newState = new CacheState(dir.getParentFile());
val removeOld = isFreshStart = oldState == null || !oldState.equals(newState);
if (removeOld && cacheStateFile.exists() && !cacheStateFile.delete())
throw new IOException("Failed to delete cache state at " + cacheStateFile);
List<ZipFile> cacheZips = new ArrayList<>();
val files = dir.listFiles();
if (files != null)
for (val f : files) {
val name = f.getName().toLowerCase();
if (name.endsWith(".jar")) {
if (removeOld) {
if (!f.delete()) {
LogWrapper.severe("Unable to remove old cached classes %s", f);
}
} else {
cacheZips.add(new ZipFile(f));
cacheZipCount++;
}
} else if (name.endsWith(".tempjar") && !f.delete()) {
throw new IOException("Failed to delete old temporary cached classes jar: " + f);
}
}
for (val zipFile : cacheZips)
for (val zipEntry : Collections.list(zipFile.entries()))
classes.put(zipEntry.getName(), () -> zipFile.getInputStream(zipEntry));
if (removeOld) {
newState.writeToFile(cacheStateFile);
LogWrapper.info("Cleared cached transformed classes as cache states did not match.\nBefore: " + oldState + "\nAfter: " + newState);
}
LogWrapper.info("Loaded " + classes.size() + " cached transformed classes from " + cacheZipCount + " jar" + (cacheZipCount == 1 ? "" : "s") + ".");
Runtime.getRuntime().addShutdownHook(new Thread(this::closeCurrentCache, "CachingClassLoader saver"));
}
开发者ID:nallar,项目名称:CachingClassLoader,代码行数:53,代码来源:Cache.java
示例7: writeToLog
import net.minecraft.launchwrapper.LogWrapper; //导入依赖的package包/类
public static void writeToLog(String msg, Object... args) {
LogWrapper.log(FusionReactor.MODID, Level.INFO, msg, args);
}
开发者ID:TeamFRM,项目名称:FusionReactor,代码行数:4,代码来源:Tools.java
示例8: configureLogging
import net.minecraft.launchwrapper.LogWrapper; //导入依赖的package包/类
/**
* Configure the FML logger
*/
private static void configureLogging()
{
LogManager.getLogManager().reset();
Logger globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
globalLogger.setLevel(Level.OFF);
log.myLog = Logger.getLogger("ForgeModLoader");
LogWrapper.retarget(log.myLog);
Logger stdOut = Logger.getLogger("STDOUT");
stdOut.setParent(log.myLog);
Logger stdErr = Logger.getLogger("STDERR");
stdErr.setParent(log.myLog);
log.myLog.setLevel(Level.ALL);
log.myLog.setUseParentHandlers(false);
consoleLogThread = new Thread(new ConsoleLogThread());
consoleLogThread.setDaemon(true);
consoleLogThread.start();
formatter = new FMLLogFormatter();
try
{
File logPath = new File(minecraftHome, logFileNamePattern);
fileHandler = new FileHandler(logPath.getPath(), 0, 3)
{
public synchronized void close() throws SecurityException {
// We don't want this handler to reset
}
};
}
catch (Throwable t)
{
throw Throwables.propagate(t);
}
resetLoggingHandlers();
// Set system out to a log stream
errCache = System.err;
System.setOut(new PrintStream(new LoggingOutStream(stdOut), true));
System.setErr(new PrintStream(new LoggingOutStream(stdErr), true));
configured = true;
}
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:48,代码来源:FMLRelaunchLog.java
注:本文中的net.minecraft.launchwrapper.LogWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论