本文整理了Java中net.minecraft.client.Minecraft.isCallingFromMinecraftThread()
方法的一些代码示例,展示了Minecraft.isCallingFromMinecraftThread()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Minecraft.isCallingFromMinecraftThread()
方法的具体详情如下:
包路径:net.minecraft.client.Minecraft
类名称:Minecraft
方法名:isCallingFromMinecraftThread
暂无
代码示例来源:origin: mezz/JustEnoughItems
@SuppressWarnings("ConstantConditions")
public static void assertMainThread() {
Minecraft minecraft = Minecraft.getMinecraft();
if (minecraft != null && !minecraft.isCallingFromMinecraftThread()) {
Thread currentThread = Thread.currentThread();
throw new IllegalStateException(
"A JEI API method is being called by another mod from the wrong thread:\n" +
currentThread + "\n" +
"It must be called on the main thread by using Minecraft.addScheduledTask."
);
}
}
代码示例来源:origin: elucent/Albedo
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event){
postedLights = false;
if (Minecraft.getMinecraft().isCallingFromMinecraftThread()){
GlStateManager.disableLighting();
ShaderUtil.useProgram(0);
}
}
代码示例来源:origin: DimensionalDevelopment/VanillaFix
public static void outputReport(CrashReport report) {
try {
if (report.getFile() == null) {
String reportName = "crash-";
reportName += new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss").format(new Date());
reportName += Minecraft.getMinecraft().isCallingFromMinecraftThread() ? "-client" : "-server";
reportName += ".txt";
File reportsDir = isClient() ? new File(Minecraft.getMinecraft().gameDir, "crash-reports") : new File("crash-reports");
File reportFile = new File(reportsDir, reportName);
report.saveToFile(reportFile);
}
} catch (Throwable e) {
log.fatal("Failed saving report", e);
}
log.fatal("Minecraft ran into a problem! " + (report.getFile() != null ? "Report saved to: " + report.getFile() : "Crash report could not be saved.")
+ "\n" + report.getCompleteReport());
}
代码示例来源:origin: Lunatrius/Schematica
@Override
public ListenableFuture<Object> uploadChunk(final BlockRenderLayer layer, final BufferBuilder buffer, final RenderChunk renderChunk, final CompiledChunk compiledChunk, final double distanceSq) {
if (!Minecraft.getMinecraft().isCallingFromMinecraftThread() || OpenGlHelper.useVbo()) {
return super.uploadChunk(layer, buffer, renderChunk, compiledChunk, distanceSq);
}
uploadDisplayList(buffer, ((RenderOverlayList) renderChunk).getDisplayList(layer, compiledChunk), renderChunk);
buffer.setTranslation(0.0, 0.0, 0.0);
return Futures.immediateFuture(null);
}
}
代码示例来源:origin: cabaletta/baritone
public BlockStateInterface(World world, WorldData worldData, boolean copyLoadedChunks) {
this.worldData = worldData;
Long2ObjectMap<Chunk> worldLoaded = ((IChunkProviderClient) world.getChunkProvider()).loadedChunks();
if (copyLoadedChunks) {
this.loadedChunks = new Long2ObjectOpenHashMap<>(worldLoaded); // make a copy that we can safely access from another thread
} else {
this.loadedChunks = worldLoaded; // this will only be used on the main thread
}
this.useTheRealWorld = !Baritone.settings().pathThroughCachedOnly.get();
if (!Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
throw new IllegalStateException();
}
}
代码示例来源:origin: DimensionalDevelopment/VanillaFix
if (minecraft.isCallingFromMinecraftThread() && ((IPatchedMinecraft) minecraft).isDoneLoading()) {
update();
代码示例来源:origin: SquidDev-CC/plethora
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(final MessageMinecartSlot message, final MessageContext ctx) {
// We schedule this to run on the main thread so the entity is actually
// loaded by this point.
// After all, this is what the S0EPacketSpawnObject packet does.
Minecraft mc = Minecraft.getMinecraft();
if (!mc.isCallingFromMinecraftThread()) {
mc.addScheduledTask((Runnable) () -> onMessage(message, ctx));
}
World world = Minecraft.getMinecraft().world;
if (world == null) return null;
Entity entity = world.getEntityByID(message.entityId);
if (entity instanceof EntityMinecartComputer) {
EntityMinecartComputer computer = ((EntityMinecartComputer) entity);
if (message.hasStack()) computer.itemHandler.setStackInSlot(message.slot, message.stack);
if (message.hasTag()) computer.accesses[message.slot].compound = message.tag;
}
return null;
}
}
代码示例来源:origin: elucent/Albedo
if (Minecraft.getMinecraft().isCallingFromMinecraftThread()){
ShaderUtil.useProgram(ShaderUtil.entityLightProgram);
int lightPos = GL20.glGetUniformLocation(ShaderUtil.currentProgram, "lightingEnabled");
if (Minecraft.getMinecraft().isCallingFromMinecraftThread()){
ShaderUtil.useProgram(ShaderUtil.entityLightProgram);
int lightPos = GL20.glGetUniformLocation(ShaderUtil.currentProgram, "lightingEnabled");
内容来源于网络,如有侵权,请联系作者删除!