Skip to content

Commit 9400b37

Browse files
committed
优化显示效果
1 parent c4a4b67 commit 9400b37

2 files changed

Lines changed: 9 additions & 19 deletions

File tree

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
11
package ink.myumoon.ibp;
22

3-
import net.minecraft.client.Minecraft;
43
import net.neoforged.api.distmarker.Dist;
5-
import net.neoforged.bus.api.SubscribeEvent;
6-
import net.neoforged.fml.ModContainer;
7-
import net.neoforged.fml.common.EventBusSubscriber;
84
import net.neoforged.fml.common.Mod;
9-
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
10-
import net.neoforged.neoforge.client.gui.ConfigurationScreen;
11-
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
125

13-
// This class will not load on dedicated servers. Accessing client side code from here is safe.
146
@Mod(value = InteractiveBlockPrompt.MODID, dist = Dist.CLIENT)
15-
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
16-
//@EventBusSubscriber(modid = InteractiveBlockPrompt.MODID, value = Dist.CLIENT)
177
public class InteractiveBlockPromptClient {
18-
//public InteractiveBlockPromptClient(ModContainer container) {
19-
// Allows NeoForge to create a config screen for this mod's configs.
20-
// The config screen is accessed by going to the Mods screen > clicking on your mod > clicking on config.
21-
// Do not forget to add translations for your config options to the en_us.json file.
22-
//container.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);
23-
//}
248
}

src/main/java/ink/myumoon/ibp/RenderEvent.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package ink.myumoon.ibp;
22

3+
import com.mojang.blaze3d.platform.GlStateManager;
34
import com.mojang.blaze3d.systems.RenderSystem;
45
import net.minecraft.client.Minecraft;
56
import net.minecraft.client.gui.GuiGraphics;
@@ -49,10 +50,14 @@ public static void onInteractiveBlock(RenderGuiEvent.Pre event){
4950
}
5051
}
5152

52-
//图标渲染
5353
private static void drawIcon(GuiGraphics guiGraphics,int x, int y){
5454
RenderSystem.enableBlend();
55-
RenderSystem.setShaderColor(1,1,1,0.8F);
55+
RenderSystem.blendFuncSeparate(
56+
GlStateManager.SourceFactor.ONE_MINUS_DST_COLOR,
57+
GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR,
58+
GlStateManager.SourceFactor.ONE,
59+
GlStateManager.DestFactor.ZERO
60+
);
5661

5762
guiGraphics.blit(
5863
INTERACTIVE_ICON,
@@ -62,7 +67,8 @@ private static void drawIcon(GuiGraphics guiGraphics,int x, int y){
6267
ICON_SIZE,ICON_SIZE
6368
);
6469

70+
// 恢复默认混合模式
71+
RenderSystem.defaultBlendFunc();
6572
RenderSystem.disableBlend();
66-
RenderSystem.setShaderColor(1,1,1,1);
6773
}
6874
}

0 commit comments

Comments
 (0)