Skip to content

Commit

Permalink
Merge branch '1.20-Unified' into unintrusive-vanilla
Browse files Browse the repository at this point in the history
  • Loading branch information
Madis0 committed Dec 8, 2023
2 parents 45035e4 + 644bb6b commit d9adaea
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 171 deletions.
14 changes: 4 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ dependencies {
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

include(fabricApi.module("fabric-api-base", project.fabric_version))
modImplementation include(fabricApi.module("fabric-networking-api-v1", project.fabric_version))
modImplementation include(fabricApi.module("fabric-screen-api-v1", project.fabric_version))
modImplementation include(fabricApi.module("fabric-rendering-v1", project.fabric_version))
modImplementation include(fabricApi.module("fabric-resource-loader-v0", project.fabric_version))
}

sourceSets.remove(sourceSets.test)
Expand Down Expand Up @@ -152,13 +146,13 @@ curseforge {
changelog = file('docs/CHANGELOG.md')
mainArtifact(remapJar)

addGameVersion "1.20.2"
addGameVersion project.minecraft_version
addGameVersion 'Quilt'
addGameVersion 'Fabric'
addGameVersion 'Java 17'

relations {
embeddedLibrary 'fabric-api'
requiredDependency 'fabric-api'
optionalDependency 'modmenu'
optionalDependency 'cloth-config'
}
Expand All @@ -185,12 +179,12 @@ modrinth {
versionType = "${version_type}"
changelog = rootProject.file("docs/CHANGELOG.md").text
uploadFile = remapJar
gameVersions = [ "1.20.2" ]
gameVersions = [ project.minecraft_version ]
loaders = ['fabric', 'quilt']

dependencies {
// The scope can be `required`, `optional`, or `incompatible`
embedded.project "fabric-api"
required.project "fabric-api"
optional.project "modmenu"
optional.project "cloth-config"
}
Expand Down
11 changes: 11 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
#### **\[Build 1.20.4-v2.5.0\]:**

- Initial 1.20.4 port.


#### **\[Build 1.20.3-v2.4.0\]:**

- Initial 1.20.3 port.


#### **\[Build 1.20.2-v2.3.1\]:**

- Fixed verified server icon not rendering correctly ([#438](https://github.com/Aizistral-Studios/No-Chat-Reports/issues/438));
- Fixed incorrect handling of chat messages that exceed vanilla's limit of 256 characters upon encryption ([thanks festino, #429](https://github.com/Aizistral-Studios/No-Chat-Reports/pull/429));
- Updated Ukrainian translation ([thanks bettercalldelta, #422](https://github.com/Aizistral-Studios/No-Chat-Reports/pull/422));
- Updated Simplified and Traditional Chinese translation ([thanks IlyaYezerovsky, #430](https://github.com/Aizistral-Studios/No-Chat-Reports/pull/430)).


#### **\[Build 1.20.2-v2.3.0\]:**

- Initial 1.20.2 port;
Expand Down
6 changes: 3 additions & 3 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildscript {
}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.0.+', changing: true
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.4.0'
classpath 'org.spongepowered:mixingradle:0.7.+'
}
Expand Down Expand Up @@ -193,7 +193,7 @@ curseforge {
changelogType = 'markdown'
changelog = rootProject.file('docs/CHANGELOG.md')

addGameVersion "1.20.2"
addGameVersion project.minecraft_version
addGameVersion "Java 17"
addGameVersion "Forge"

Expand All @@ -210,7 +210,7 @@ modrinth {
versionType = "${version_type}"
changelog = rootProject.file("docs/CHANGELOG.md").text
uploadFile = jar
gameVersions = [ "1.20.2"]
gameVersions = [ project.minecraft_version ]

syncBodyFrom = rootProject.file("docs/README.md").text
}
Expand Down
8 changes: 5 additions & 3 deletions forge/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ public net.minecraft.client.gui.screens.Screen f_96541_ #minecraft
public net.minecraft.client.gui.screens.Screen f_96542_ #itemRenderer
public net.minecraft.client.gui.screens.Screen f_96547_ #font
public net.minecraft.client.gui.components.AbstractWidget f_256816_ #tooltip
public net.minecraft.client.gui.components.AbstractWidget f_256936_ #tooltipMsDelay
#public net.minecraft.client.gui.components.AbstractWidget f_256936_ #tooltipMsDelay
public net.minecraft.client.gui.screens.OptionsScreen f_260594_ #TELEMETRY

public net.minecraft.client.gui.components.Tooltip <init>(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;)V #<init>
public-f net.minecraft.client.gui.components.AbstractWidget m_257936_()V #updateTooltip
public-f net.minecraft.client.gui.components.CycleButton m_257795_()V #updateTooltip
#public-f net.minecraft.client.gui.components.AbstractWidget m_257936_()V #updateTooltip
#public-f net.minecraft.client.gui.components.CycleButton m_257795_()V #updateTooltip

public-f net.minecraft.client.gui.components.AbstractWidget m_88315_(Lnet/minecraft/client/gui/GuiGraphics;IIF)V #render
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ modId="nochatreports"
version="1.0.0"
displayName="No Chat Reports"
authors="Aizistral"
logoFile="NCR_logo.png"
logoFile="ncr_logo.png"
description='''
None
'''
20 changes: 10 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false

# Toolchain Properties
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.1
fabric_loader_version=0.14.22
forge_version=1.20.2-48.0.7
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.1
fabric_loader_version=0.15.0
forge_version=1.20.4-49.0.3

# Mod Properties
mod_version=1.20.2-v2.3.1
mod_version=1.20.4-v2.5.0
maven_group=com.aizistral.nochatreports
archives_base_name=NoChatReports-FABRIC
mod_id=nochatreports
Expand All @@ -18,17 +18,17 @@ mod_url=https://www.curseforge.com/minecraft/mc-mods/no-chat-reports
issue_tracker_url=https://github.com/Aizistral-Studios/No-Chat-Reports/issues
mod_author=Aizistral
mod_description=Strips cryptographic signatures from player messages, making it impossible to track and associate them with your Mojang/Microsoft account, as well as use Player Chat Reporting feature.
mod_icon=assets/nochatreports/textures/misc/NCR_logo.png
mod_icon=assets/nochatreports/textures/misc/ncr_logo.png
mod_license=WTFPL

# Dependencies
fabric_version=0.89.2+1.20.2
mod_menu_version=8.0.0
cloth_config_version=12.0.109
fabric_version=0.91.1+1.20.4
mod_menu_version=9.0.0-pre.1
cloth_config_version=12.0.111

# Dependencies in mods.toml
dep_forge=[37,)
dep_minecraft=[1.19.4,)
dep_minecraft=[1.20.3,)

# Publishing
curse_id=634062
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentContents;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.contents.LiteralContents;
import net.minecraft.network.chat.contents.PlainTextContents.LiteralContents;
import net.minecraft.network.chat.contents.TranslatableContents;

public class EncryptionUtil {
Expand Down Expand Up @@ -72,7 +72,7 @@ public static Optional<String> tryDecrypt(String message, Encryptor<?> encryptor
}

public static Component recreate(Component component) {
return Component.Serializer.fromJson(Component.Serializer.toStableJson(component));
return Component.Serializer.fromJson(Component.Serializer.toJson(component));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Checkbox;
import net.minecraft.client.gui.components.Checkbox.OnValueChange;
import net.minecraft.client.gui.components.MultiLineLabel;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -43,7 +44,8 @@ protected void init() {
int j = this.font.width(this.check);

if (this.check != null) {
this.stopShowing = new Checkbox(this.width / 2 - j / 2 - 8, checkY + i, j + 24, 20, this.check, false);
this.stopShowing = Checkbox.builder(this.check, this.font).pos(this.width / 2 - j / 2 - 8, checkY + i)
.build();
this.addRenderableWidget(this.stopShowing);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,14 @@ public ResourceLocation getCurrentTexture() {
return this.switchable.getCurrent().get(this.isActive(), this.isHoveredOrFocused());
}

@Override
public void updateTooltip() {
if (this.tooltip instanceof AdvancedTooltip tooltip && tooltip.hasCustomRender())
return;

super.updateTooltip();
}

@Override
public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
graphics.blitSprite(this.getCurrentTexture(), this.getX(), this.getY(), this.width, this.height);

if (this.isHovered)
if (this.tooltip instanceof AdvancedTooltip tooltip && tooltip.hasCustomRender()) {
tooltip.doCustomRender(this.parent, graphics, mouseX, mouseY, this.createTooltipPositioner());
tooltip.doCustomRender(this.parent, graphics, mouseX, mouseY, tooltip.createTooltipPositioner(
this.isHovered(), this.isFocused(), this.getRectangle()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.client.gui.navigation.ScreenRectangle;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.tooltip.BelowOrAboveWidgetTooltipPositioner;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner;
import net.minecraft.client.gui.screens.inventory.tooltip.DefaultTooltipPositioner;
import net.minecraft.client.gui.screens.inventory.tooltip.MenuTooltipPositioner;
import net.minecraft.client.gui.screens.inventory.tooltip.TooltipRenderUtil;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.MultiBufferSource;
Expand Down Expand Up @@ -134,4 +137,17 @@ protected void renderTooltipInternalNoGap(Screen screen, GuiGraphics graphics, L
graphics.pose().popPose();
}

@Override
public ClientTooltipPositioner createTooltipPositioner(boolean hovered, boolean focused, ScreenRectangle rectangle) {
return super.createTooltipPositioner(hovered, focused, rectangle);
}

@Override // ideally tooltip shouldn't control it's own render like this, but for now it does
public void refreshTooltipForNextRenderPass(boolean hovered, boolean focused, ScreenRectangle screenRectangle) {
if (this.hasCustomRender())
return;

super.refreshTooltipForNextRenderPass(hovered, focused, screenRectangle);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ protected void init() {
this.addRenderableOnly(button);

int checkWidth = this.font.width(ENCRYPT_PUBLIC);
this.encryptPublicCheck = new Checkbox(this.width / 2 - checkWidth / 2 - 8, this.passField.getY() + 24, checkWidth + 24, 20,
ENCRYPT_PUBLIC, NCRConfig.getEncryption().shouldEncryptPublic());
this.encryptPublicCheck = Checkbox.builder(ENCRYPT_PUBLIC, this.font).pos(this.width / 2 - checkWidth / 2 - 8,
this.passField.getY() + 24).selected(NCRConfig.getEncryption().shouldEncryptPublic()).build();
this.addRenderableWidget(this.encryptPublicCheck);

this.addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, btn -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private synchronized GuiMessageTag modifyGUITag(GuiMessageTag tag) {
private FormattedText modifyGUIMessage(FormattedText msg) {
if (NCRConfig.getCommon().enableDebugLog()) {
NCRCore.LOGGER.info("Adding chat message, structure: " +
Component.Serializer.toStableJson((Component) msg));
Component.Serializer.toJson((Component) msg));
}

var decrypted = EncryptionUtil.tryDecrypt((Component) msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private void onEvaluateTrustLevel(PlayerChatMessage playerChatMessage, Component
// Debug never dies
if (NCRConfig.getCommon().enableDebugLog()) {
NCRCore.LOGGER.info("Received message: {}, from: {}, signature: {}",
Component.Serializer.toStableJson(playerChatMessage.unsignedContent()),
Component.Serializer.toJson(playerChatMessage.unsignedContent()),
playerChatMessage.link().sender(),
Base64.getEncoder().encodeToString(playerChatMessage.signature() != null ? playerChatMessage.signature().bytes() : new byte[0]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.aizistral.nochatreports.common.config.NCRConfig;

import net.minecraft.client.gui.components.toasts.SystemToast;
import net.minecraft.client.gui.components.toasts.SystemToast.SystemToastIds;
import net.minecraft.client.gui.components.toasts.SystemToast.SystemToastId;
import net.minecraft.client.gui.components.toasts.Toast;
import net.minecraft.client.gui.components.toasts.ToastComponent;

Expand All @@ -18,7 +18,7 @@ public class MixinToastComponent {
@Inject(method = "addToast", at = @At("HEAD"), cancellable = true)
private void onAddToast(Toast toast, CallbackInfo info) {
if (NCRConfig.getClient().hideWarningToast())
if (toast instanceof SystemToast sys && sys.getToken() == SystemToastIds.UNSECURE_SERVER_WARNING) {
if (toast instanceof SystemToast sys && sys.getToken() == SystemToastId.UNSECURE_SERVER_WARNING) {
info.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public abstract class MixinFriendlyByteBuf {
private static Gson GSON;

@Inject(method = "readJsonWithCodec", at = @At("HEAD"), cancellable = true)
private void onReadJsonWithCodec(Codec codec, CallbackInfoReturnable info) throws Exception {
private void onReadJsonWithCodec(Codec codec, CallbackInfoReturnable info) throws Throwable {
if (codec == ServerStatus.CODEC) {
info.cancel();

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/nochatreports/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"gui.nochatreports.encryption_state_on": "§a§lEnabled§r",
"gui.nochatreports.encryption_state_off": "§c§lDisabled§r",
"gui.nochatreports.encryption_warning.header": "About Encryption",
"gui.nochatreports.encryption_warning.contents": "You can encrypt your messages using a secret key. Only people who know this key will be able to decrypt them. No Chat Reports will automatically decrypt all encrypted messages when a suitable key is provided and the feature is enabled.\nHowever, be aware that encryption is not a \"magic wand\" kind of solution. Moderators on third-party servers can mute or ban you for sending what will appear to them as a garbled mess in chat. Futhermore, it is recommended that you generate a custom encryption key and communicate it to other people only via secure channels. Click \"Learn More\" to learn more about how and when you should use encryption.",
"gui.nochatreports.encryption_warning.contents": "You can encrypt your messages using a secret key. Only people who know this key will be able to decrypt them. No Chat Reports will automatically decrypt all encrypted messages when a suitable key is provided and the feature is enabled.\nHowever, be aware that encryption is not a \"magic wand\" kind of solution. Moderators on third-party servers can mute or ban you for sending what will appear to them as a garbled mess in chat. Furthermore, it is recommended that you generate a custom encryption key and communicate it to other people only via secure channels. Click \"Learn More\" to learn more about how and when you should use encryption.",
"gui.nochatreports.encryption_warning.check": "Don't show again",
"gui.nochatreports.encryption_warning.learn_more": "Learn More",
"gui.nochatreports.encryption_config.header": "Encryption Settings",
Expand Down
Loading

0 comments on commit d9adaea

Please sign in to comment.