Skip to content

Commit fb85a4f

Browse files
committed
Merge remote-tracking branch 'github/main' into 1.20.1
2 parents 7477fb9 + 80f1104 commit fb85a4f

5 files changed

Lines changed: 40 additions & 4 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.github.argon4w.acceleratedrendering.core;
2+
3+
import com.github.argon4w.acceleratedrendering.AcceleratedRenderingModEntry;
4+
import com.github.argon4w.acceleratedrendering.core.utils.AvailabilityUtils;
5+
import net.minecraft.ChatFormatting;
6+
import net.minecraft.network.chat.Component;
7+
import net.neoforged.api.distmarker.Dist;
8+
import net.neoforged.bus.api.SubscribeEvent;
9+
import net.neoforged.fml.common.EventBusSubscriber;
10+
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
11+
12+
@EventBusSubscriber(
13+
modid = AcceleratedRenderingModEntry .MOD_ID,
14+
bus = EventBusSubscriber.Bus .MOD,
15+
value = Dist .CLIENT
16+
)
17+
public class CoreEvents {
18+
19+
@SubscribeEvent
20+
public static void onClientPlayerLoggedIn(ClientPlayerNetworkEvent.LoggingIn event) {
21+
if (!AvailabilityUtils.isAvailable()) {
22+
event.getPlayer().displayClientMessage(Component.translatable("acceleratedrendering.component.not_available").withStyle(ChatFormatting.DARK_RED, ChatFormatting.BOLD), false);
23+
}
24+
}
25+
}

src/main/java/com/github/argon4w/acceleratedrendering/core/utils/AvailabilityUtils.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.mojang.blaze3d.systems.RenderSystem;
44
import org.lwjgl.opengl.GL;
5+
import org.lwjgl.opengl.GL11;
56

67
public class AvailabilityUtils {
78

@@ -28,6 +29,14 @@ public static boolean isAvailable() {
2829
&& cap.GL_ARB_buffer_storage
2930
&& cap.GL_ARB_shader_atomic_counters;
3031

32+
var renderer = GL11.glGetString(GL11.GL_RENDERER);
33+
34+
if (renderer != null) {
35+
AVAILABILITY &= !renderer.contains("MobileGlues")
36+
&& !renderer.contains("gl4es")
37+
&& !renderer.contains("LTW");
38+
}
39+
3140
return AVAILABILITY;
3241
}
3342
}

src/main/java/com/github/argon4w/acceleratedrendering/features/items/mixins/models/SimpleBakedModelMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ public void render(
128128
return;
129129
}
130130

131-
var meshCollectors = new Int2ObjectOpenHashMap <IMeshCollector> ();
132-
layers = new Int2ObjectAVLTreeMap <> ();
131+
var meshCollectors = new Int2ObjectAVLTreeMap<IMeshCollector> ();
132+
layers = new Int2ObjectAVLTreeMap<> ();
133133

134134
meshes.put(extension, layers);
135135

src/main/resources/assets/acceleratedrendering/lang/en_us.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,5 +187,6 @@
187187
"acceleratedrendering.configuration.mods_compatibility.ftb_feature_status.tooltip": "- DISABLED: Accelerations of UI driven by FTB Library will be disabled.\n- ENABLED: Accelerations of UI driven by FTB Library will be enabled.",
188188
"acceleratedrendering.configuration.mods_compatibility.sophisticated_feature_status": "Enable Sophisticated Core Compatibility",
189189
"acceleratedrendering.configuration.mods_compatibility.sophisticated_feature_status.tooltip": "- DISABLED: Accelerations of UI driven by Sophisticated Core will be disabled.\n- ENABLED: Accelerations of UI driven by Sophisticated Core will be enabled.",
190-
"acceleratedrendering.configuration.mods_compatibility.button": "Configure"
190+
"acceleratedrendering.configuration.mods_compatibility.button": "Configure",
191+
"acceleratedrendering.component.not_available": "Accelerated Rendering is currently running in an unsupported environment. Accelerated Rendering will not take effect."
191192
}

src/main/resources/assets/acceleratedrendering/lang/zh_cn.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,5 +187,6 @@
187187
"acceleratedrendering.configuration.mods_compatibility.ftb_feature_status.tooltip": "- DISABLED: 禁止加速渲染对FTB Library驱动的UI界面(如FTB Quests)进行加速.\n- ENABLED: 加速渲染将会对FTB Library驱动的UI界面进行加速.",
188188
"acceleratedrendering.configuration.mods_compatibility.sophisticated_feature_status": "启用精妙核心兼容",
189189
"acceleratedrendering.configuration.mods_compatibility.sophisticated_feature_status.tooltip": "- DISABLED: 禁止加速渲染对精妙核心驱动的UI界面(如精妙存储)进行加速.\n- ENABLED: 加速渲染将会对精妙核心驱动的UI界面进行加速.",
190-
"acceleratedrendering.configuration.mods_compatibility.button": "配置"
190+
"acceleratedrendering.configuration.mods_compatibility.button": "配置",
191+
"acceleratedrendering.component.not_available": "加速渲染正运行在不受支持的环境中, 加速渲染将不会生效."
191192
}

0 commit comments

Comments
 (0)