-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug causing styles to not work properly
- Loading branch information
Showing
5 changed files
with
110 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"> | ||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="BetterForgeChat"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="cpw.mods.bootstraplauncher.BootstrapLauncher"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dforge.logging.console.level=debug -Dforge.logging.markers=REGISTRIES -DlegacyClassPath.file=/home/jeremiah/Programming/BetterForgeChat/build/classpath/runClient_minecraftClasspath.txt -DignoreList=bootstraplauncher,securejarhandler,asm-commons,asm-util,asm-analysis,asm-tree,asm,client-extra,fmlcore,javafmllanguage,lowcodelanguage,mclanguage,forge- -DnativesDirectory=/home/jeremiah/Programming/BetterForgeChat/build/natives -DmergeModules=jna-5.10.0.jar,jna-platform-5.10.0.jar,java-objc-bridge-1.0.0.jar -Dforge.enabledGameTestNamespaces=bfcmod -Dforge.enableGameTest=true -Djava.net.preferIPv6Addresses=system -p /home/jeremiah/.gradle/caches/modules-2/files-2.1/cpw.mods/bootstraplauncher/1.0.0/f55ddbb35612c6745cefc47d1a0d6dbfb25d3982/bootstraplauncher-1.0.0.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/cpw.mods/securejarhandler/1.0.3/acbf5e3c8a38fb8bf824a54fe45eee121c510392/securejarhandler-1.0.3.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.2/f4d7f0fc9054386f2893b602454d48e07d4fbead/asm-commons-9.2.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.2/fbc178fc5ba3dab50fd7e8a5317b8b647c8e8946/asm-util-9.2.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.2/7487dd756daf96cab9986e44b9d7bcb796a61c10/asm-analysis-9.2.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.2/d96c99a30f5e1a19b0e609dbb19a44d8518ac01e/asm-tree-9.2.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.2/81a03f76019c67362299c40e0ba13405f5467bff/asm-9.2.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar=cpw.mods.securejarhandler --add-exports java.base/sun.security.util=cpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--launchTarget forgeclientuserdev --version MOD_DEV --assetIndex 1.18 --assetsDir /home/jeremiah/.gradle/caches/forge_gradle/assets --gameDir . --fml.forgeVersion 40.1.74 --fml.mcVersion 1.18.2 --fml.forgeGroup net.minecraftforge --fml.mcpVersion 20220404.173914"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="/home/jeremiah/Programming/BetterForgeChat/run"/> | ||
<mapAttribute key="org.eclipse.debug.core.environmentVariables"> | ||
<mapEntry key="MOD_CLASSES" value="bfcmod%%/home/jeremiah/Programming/BetterForgeChat/bin/main:bfcmod%%/home/jeremiah/Programming/BetterForgeChat/bin/main"/> | ||
<mapEntry key="MCP_MAPPINGS" value="official_1.18.2"/> | ||
</mapAttribute> | ||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> | ||
<listEntry value="/BetterForgeChat"/> | ||
</listAttribute> | ||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> | ||
<listEntry value="4"/> | ||
</listAttribute> | ||
<mapAttribute key="org.eclipse.debug.core.environmentVariables"> | ||
<mapEntry key="MCP_MAPPINGS" value="official_1.18.2"/> | ||
<mapEntry key="MOD_CLASSES" value="bfcmod%%/home/jeremiah/Programming/BetterForgeChat/bin/main:bfcmod%%/home/jeremiah/Programming/BetterForgeChat/bin/main"/> | ||
</mapAttribute> | ||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/> | ||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/> | ||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="cpw.mods.bootstraplauncher.BootstrapLauncher"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="BetterForgeChat"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--launchTarget forgeclientuserdev --version MOD_DEV --assetIndex 1.18 --assetsDir /home/jeremiah/.gradle/caches/forge_gradle/assets --gameDir . --fml.forgeVersion 40.1.74 --fml.mcVersion 1.18.2 --fml.forgeGroup net.minecraftforge --fml.mcpVersion 20220404.173914"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="BetterForgeChat"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dforge.logging.console.level=debug -Dforge.logging.markers=REGISTRIES -DlegacyClassPath.file=/home/jeremiah/Programming/BetterForgeChat/build/classpath/runClient_minecraftClasspath.txt -DignoreList=bootstraplauncher,securejarhandler,asm-commons,asm-util,asm-analysis,asm-tree,asm,client-extra,fmlcore,javafmllanguage,lowcodelanguage,mclanguage,forge- -DnativesDirectory=/home/jeremiah/Programming/BetterForgeChat/build/natives -DmergeModules=jna-5.10.0.jar,jna-platform-5.10.0.jar,java-objc-bridge-1.0.0.jar -Dforge.enabledGameTestNamespaces=bfcmod -Dforge.enableGameTest=true -Djava.net.preferIPv6Addresses=system -p /home/jeremiah/.gradle/caches/modules-2/files-2.1/cpw.mods/bootstraplauncher/1.0.0/f55ddbb35612c6745cefc47d1a0d6dbfb25d3982/bootstraplauncher-1.0.0.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/cpw.mods/securejarhandler/1.0.3/acbf5e3c8a38fb8bf824a54fe45eee121c510392/securejarhandler-1.0.3.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.2/f4d7f0fc9054386f2893b602454d48e07d4fbead/asm-commons-9.2.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.2/fbc178fc5ba3dab50fd7e8a5317b8b647c8e8946/asm-util-9.2.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.2/7487dd756daf96cab9986e44b9d7bcb796a61c10/asm-analysis-9.2.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.2/d96c99a30f5e1a19b0e609dbb19a44d8518ac01e/asm-tree-9.2.jar:/home/jeremiah/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.2/81a03f76019c67362299c40e0ba13405f5467bff/asm-9.2.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar=cpw.mods.securejarhandler --add-exports java.base/sun.security.util=cpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming"/> | ||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="/home/jeremiah/Programming/BetterForgeChat/run"/> | ||
</launchConfiguration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.jeremiahbl.bfcmod; | ||
|
||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.network.chat.TextComponent; | ||
|
||
public class BitwiseStyling { | ||
public static final byte BOLD_BIT = 1; | ||
public static final byte UNDERLINE_BIT = 2; | ||
public static final byte ITALIC_BIT = 4; | ||
public static final byte OBFUSCATED_BIT = 8; | ||
public static final byte STRIKETHROUGH_BIT = 16; | ||
|
||
public static final byte NO_STYLE = 0; | ||
public static final byte ALL_STYLES = | ||
BOLD_BIT | UNDERLINE_BIT | ITALIC_BIT | OBFUSCATED_BIT | STRIKETHROUGH_BIT; | ||
|
||
public static final String styleString(byte mask) { | ||
String out = ""; | ||
if((mask & BitwiseStyling.BOLD_BIT) != 0) out += TextFormatter.BOLD_FORMAT; | ||
if((mask & BitwiseStyling.ITALIC_BIT) != 0) out += TextFormatter.ITALIC_FORMAT; | ||
if((mask & BitwiseStyling.UNDERLINE_BIT) != 0) out += TextFormatter.UNDERLINE_FORMAT; | ||
if((mask & BitwiseStyling.STRIKETHROUGH_BIT) != 0) out += TextFormatter.STRIKETHROUGH_FORMAT; | ||
if((mask & BitwiseStyling.OBFUSCATED_BIT) != 0) out += TextFormatter.OBFUSCATED_FORMAT; | ||
return out; | ||
} | ||
public static final TextComponent makeEncapsulatingTextComponent(String msg, byte mask) { | ||
TextComponent out = new TextComponent(msg); | ||
if((mask & BitwiseStyling.BOLD_BIT) != 0) out.withStyle(ChatFormatting.BOLD); | ||
if((mask & BitwiseStyling.ITALIC_BIT) != 0) out.withStyle(ChatFormatting.ITALIC); | ||
if((mask & BitwiseStyling.UNDERLINE_BIT) != 0) out.withStyle(ChatFormatting.UNDERLINE); | ||
if((mask & BitwiseStyling.STRIKETHROUGH_BIT) != 0) out.withStyle(ChatFormatting.STRIKETHROUGH); | ||
if((mask & BitwiseStyling.OBFUSCATED_BIT) != 0) out.withStyle(ChatFormatting.OBFUSCATED); | ||
return out; | ||
} | ||
public static final byte getStyleBit(char c) { | ||
switch(c) { | ||
case 'l': return BOLD_BIT; | ||
case 'n': return UNDERLINE_BIT; | ||
case 'o': return ITALIC_BIT; | ||
case 'k': return OBFUSCATED_BIT; | ||
case 'm': return STRIKETHROUGH_BIT; | ||
default: return 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters