本文整理汇总了Java中net.minecraft.network.ServerStatusResponse.func_151320_a方法的典型用法代码示例。如果您正苦于以下问题:Java ServerStatusResponse.func_151320_a方法的具体用法?Java ServerStatusResponse.func_151320_a怎么用?Java ServerStatusResponse.func_151320_a使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.network.ServerStatusResponse
的用法示例。
在下文中一共展示了ServerStatusResponse.func_151320_a方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_147138_a
import net.minecraft.network.ServerStatusResponse; //导入方法依赖的package包/类
private void func_147138_a(ServerStatusResponse p_147138_1_)
{
File var2 = this.getFile("server-icon.png");
if (var2.isFile())
{
ByteBuf var3 = Unpooled.buffer();
try
{
BufferedImage var4 = ImageIO.read(var2);
Validate.validState(var4.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
Validate.validState(var4.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
ImageIO.write(var4, "PNG", new ByteBufOutputStream(var3));
ByteBuf var5 = Base64.encode(var3);
p_147138_1_.func_151320_a("data:image/png;base64," + var5.toString(Charsets.UTF_8));
}
catch (Exception var6)
{
logger.error("Couldn\'t load server icon", var6);
}
}
}
示例2: func_147138_a
import net.minecraft.network.ServerStatusResponse; //导入方法依赖的package包/类
private void func_147138_a(ServerStatusResponse p_147138_1_)
{
File file1 = this.getFile("server-icon.png");
if (file1.isFile())
{
ByteBuf bytebuf = Unpooled.buffer();
try
{
BufferedImage bufferedimage = ImageIO.read(file1);
Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
ByteBuf bytebuf1 = Base64.encode(bytebuf);
p_147138_1_.func_151320_a("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
}
catch (Exception exception)
{
logger.error("Couldn\'t load server icon", exception);
}
finally
{
bytebuf.release();
}
}
}