Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 56 additions & 37 deletions src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import top.fpsmaster.features.impl.interfaces.BetterScreen;
import top.fpsmaster.utils.math.anim.AnimMath;
import top.fpsmaster.utils.render.effects.Blur;
import top.fpsmaster.utils.system.OptifineUtil;

import java.awt.*;
import java.io.IOException;
Expand Down Expand Up @@ -54,53 +55,71 @@ public void handleKeyboardInput() throws IOException {
mc.dispatchKeypresses();
}

@Unique
float arch$alpha = 0;
@Unique
int v1_8_9$iteration = 0;

/**
* @author SuperSkidder
* @reason 自定义背景
*/
@Overwrite
public void drawWorldBackground(int tint) {
if (mc.theWorld != null) {
if (BetterScreen.using) {
if (BetterScreen.useBG.getValue()) {
if (BetterScreen.backgroundAnimation.getValue()) {
arch$alpha = (float) AnimMath.base(arch$alpha, 170, 0.2f);
} else {
arch$alpha = 170;
}
this.drawGradientRect(0, 0, this.width, this.height, Colors.alpha(Colors.toColor(-1072689136), ((int) arch$alpha)).getRGB(), Colors.alpha(Colors.toColor(-804253680), ((int) arch$alpha)).getRGB());
@Unique
float arch$alpha = 0;

@Unique
int v1_8_9$iteration = 0;

/**
* @author SuperSkidder
* @reason 自定义背景
*/
@Overwrite
public void drawWorldBackground(int tint) {
if (mc.theWorld != null) {
if (BetterScreen.using) {
if (BetterScreen.useBG.getValue()) {
if (BetterScreen.backgroundAnimation.getValue()) {
arch$alpha = (float) AnimMath.base(arch$alpha, 170, 0.2f);
} else {
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
}
if (BetterScreen.blur.getValue()) {
v1_8_9$iteration = Math.min(++v1_8_9$iteration, 3);
Blur.area(0, 0, width, height, 1, new Color(255, 255, 255), v1_8_9$iteration, v1_8_9$iteration);
arch$alpha = 170;
}

this.drawGradientRect(
0,
0,
this.width,
this.height,
Colors.alpha(Colors.toColor(-1072689136), ((int) arch$alpha)).getRGB(),
Colors.alpha(Colors.toColor(-804253680), ((int) arch$alpha)).getRGB()
);
} else {
this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
}

if (BetterScreen.blur.getValue() && !OptifineUtil.isFastRender()) {
v1_8_9$iteration = Math.min(++v1_8_9$iteration, 3);
Blur.area(
0,
0,
width,
height,
1,
new Color(255, 255, 255),
v1_8_9$iteration,
v1_8_9$iteration
);
}
} else {
this.drawBackground(tint);
this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
}
} else {
this.drawBackground(tint);
}
}

@Inject(method = "sendChatMessage(Ljava/lang/String;Z)V", at = @At("HEAD"), cancellable = true)
public void sendChat(String msg, boolean addToChat, CallbackInfo ci) {
EventSendChatMessage eventSendChatMessage = new EventSendChatMessage(msg);
EventDispatcher.dispatchEvent(eventSendChatMessage);
if (eventSendChatMessage.isCanceled()) {
ci.cancel();
}
@Inject(method = "sendChatMessage(Ljava/lang/String;Z)V", at = @At("HEAD"), cancellable = true)
public void sendChat(String msg, boolean addToChat, CallbackInfo ci) {
EventSendChatMessage eventSendChatMessage = new EventSendChatMessage(msg);
EventDispatcher.dispatchEvent(eventSendChatMessage);
if (eventSendChatMessage.isCanceled()) {
ci.cancel();
}
}

}



Loading
Loading