mirror of
https://github.com/GTNewHorizons/NotEnoughCharacters.git
synced 2026-11-25 14:44:21 +00:00
添加了模糊音的配置
This commit is contained in:
1 parent
f4b9b206c3
commit
dab3bd65f2
6 files changed
+98
-82
No files matched your search
+56
-60
@@ -1,21 +1,21 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven {
|
||||
name = "github"
|
||||
url = "https://github.com/juanmuscaria/maven/raw/master"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-1.4.0-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-1.4.0-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'forge'
|
||||
@@ -28,43 +28,40 @@ group = mod_group
|
||||
archivesBaseName = mod_archives_name
|
||||
|
||||
minecraft {
|
||||
version = "1.7.10-10.13.4.1614-1.7.10"
|
||||
runDir = "eclipse"
|
||||
replace "@VERSION@", project.version
|
||||
version = "1.7.10-10.13.4.1614-1.7.10"
|
||||
runDir = "eclipse"
|
||||
replace "@VERSION@", project.version
|
||||
}
|
||||
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name 'chickenbones'
|
||||
url 'http://chickenbones.net/maven'
|
||||
}
|
||||
maven {
|
||||
name 'cursemaven'
|
||||
url "https://www.cursemaven.com"
|
||||
}
|
||||
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
mavenCentral()
|
||||
maven {
|
||||
name 'chickenbones'
|
||||
url 'http://chickenbones.net/maven'
|
||||
}
|
||||
maven {
|
||||
name 'cursemaven'
|
||||
url "https://www.cursemaven.com"
|
||||
}
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
// configuration that holds jars to include in the jar
|
||||
shade
|
||||
compile.extendsFrom shade
|
||||
// configuration that holds jars to include in the jar
|
||||
shade
|
||||
compile.extendsFrom shade
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
compile 'codechicken:NotEnoughItems:1.7.10-2.1.6-GTNH:dev'
|
||||
compile 'codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev'
|
||||
compile 'codechicken:CodeChickenCore:1.7.10-1.0.7.+:dev'
|
||||
compile 'me.towdium:PinIn:1.2.0-all'
|
||||
|
||||
shade 'me.towdium:PinIn:1.2.0-all'
|
||||
compile 'codechicken:NotEnoughItems:1.7.10-2.0.0-GTNH:dev'
|
||||
compile 'codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev'
|
||||
compile 'codechicken:CodeChickenCore:1.7.10-1.0.7.+:dev'
|
||||
|
||||
shade 'me.towdium:PinIn:1.2.0-all'
|
||||
|
||||
}
|
||||
|
||||
@@ -73,13 +70,13 @@ processResources {
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
expand 'version': project.version,
|
||||
'mod_id': mod_id,
|
||||
'mod_name': mod_name,
|
||||
'mod_author': mod_author,
|
||||
'mod_description': mod_description,
|
||||
'mc_version': mc_version,
|
||||
'mod_credits': mod_credits,
|
||||
'mod_version': mod_version
|
||||
'mod_id': mod_id,
|
||||
'mod_name': mod_name,
|
||||
'mod_author': mod_author,
|
||||
'mod_description': mod_description,
|
||||
'mc_version': mc_version,
|
||||
'mod_credits': mod_credits,
|
||||
'mod_version': mod_version
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
@@ -88,33 +85,32 @@ processResources {
|
||||
}
|
||||
|
||||
task devJar(type: Jar) {
|
||||
classifier = 'dev'
|
||||
from sourceSets.main.output
|
||||
classifier = 'dev'
|
||||
from sourceSets.main.output
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives devJar
|
||||
archives sourcesJar
|
||||
archives devJar
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
jar {
|
||||
configurations.shade.copyRecursive().setTransitive(false).each { artifact ->
|
||||
from(zipTree(artifact)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
configurations.shade.copyRecursive().setTransitive(false).each { artifact ->
|
||||
from(zipTree(artifact)) {
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
|
||||
manifest.attributes(
|
||||
'FMLCorePlugin': 'net.vfyjxf.nechar.core.NechCorePlugin',
|
||||
'FMLCorePluginContainsFMLMod': 'true',
|
||||
'ForceLoadAsMod': 'true'
|
||||
)
|
||||
|
||||
appendix project.minecraft.version
|
||||
}
|
||||
manifest.attributes(
|
||||
'FMLCorePlugin': 'net.vfyjxf.nechar.core.NechCorePlugin',
|
||||
'FMLCorePluginContainsFMLMod': 'true',
|
||||
'ForceLoadAsMod': 'true'
|
||||
)
|
||||
|
||||
appendix project.minecraft.version
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@ org.gradle.daemon=false
|
||||
|
||||
# General Specifications
|
||||
mc_version=1.7.10
|
||||
mod_version=1.4
|
||||
mod_version=1.4.1
|
||||
forge_version=10.13.4.1614
|
||||
mod_group=com.github.vfyjxf.nechar
|
||||
mod_id=nechar
|
||||
|
||||
@@ -3,21 +3,16 @@ package net.moecraft.nechar;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import me.towdium.pinin.PinIn;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import static net.moecraft.nechar.NotEnoughCharacters.context;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class NecharSearchFilter implements ItemFilter {
|
||||
// TODO: provide settings for fuzzy pinyin
|
||||
protected static final PinIn context = new PinIn();
|
||||
|
||||
static {
|
||||
context.config().fU2V(true).commit();
|
||||
}
|
||||
|
||||
protected boolean invalid = false;
|
||||
|
||||
@@ -125,4 +120,5 @@ public class NecharSearchFilter implements ItemFilter {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package net.moecraft.nechar;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import me.towdium.pinin.PinIn;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.vfyjxf.nechar.NechConfig;
|
||||
import net.vfyjxf.nechar.utils.Match;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -16,9 +18,23 @@ public class NotEnoughCharacters {
|
||||
public static final String VERSION = NotEnoughCharacters.class.getPackage().getImplementationVersion();
|
||||
public static final Logger logger = LogManager.getLogger("NotEnoughCharacters");
|
||||
|
||||
public static final PinIn context = new PinIn().config().accelerate(true).commit();
|
||||
|
||||
private static void onConfigChange() {
|
||||
context.config()
|
||||
.fZh2Z(NechConfig.EnableFZh2Z)
|
||||
.fSh2S(NechConfig.EnableFSh2S)
|
||||
.fCh2C(NechConfig.EnableFCh2C)
|
||||
.fAng2An(NechConfig.EnableFAng2An)
|
||||
.fIng2In(NechConfig.EnableFIng2In)
|
||||
.fEng2En(NechConfig.EnableFEng2En)
|
||||
.fU2V(NechConfig.EnableFU2V).commit();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
logger.info("Not Enough Characters - v" + VERSION);
|
||||
NechConfig.loadConfig(new File(Minecraft.getMinecraft().mcDataDir, "config/NotEnoughCharacters.cfg"));
|
||||
onConfigChange();
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,17 @@ import java.io.File;
|
||||
|
||||
public class NechConfig {
|
||||
|
||||
private static Configuration config;
|
||||
|
||||
public static boolean EnableFZh2Z = false;
|
||||
public static boolean EnableFSh2S = false;
|
||||
public static boolean EnableFCh2C = false;
|
||||
public static boolean EnableFAng2An = false;
|
||||
public static boolean EnableFIng2In = false;
|
||||
public static boolean EnableFEng2En = false;
|
||||
public static boolean EnableFU2V = false;
|
||||
|
||||
public static String[] transformerRegExpAdditionalList = new String[0];
|
||||
public static String[] transformerStringAdditionalList = new String[0];
|
||||
public static String[] transformerMethodBlackList = new String[0];
|
||||
|
||||
public static String[] defaultTransformerRegExp = new String[]{
|
||||
"appeng.client.me.ItemRepo:updateView",//Applied-Energistics-2 search
|
||||
"net.p455w0rd.wirelesscraftingterminal.client.me.ItemRepo:updateView"//WirelessCraftingTerminal search
|
||||
@@ -30,7 +34,7 @@ public class NechConfig {
|
||||
};
|
||||
|
||||
public static void loadConfig(File configFile) {
|
||||
config = new Configuration(configFile);
|
||||
Configuration config = new Configuration(configFile);
|
||||
config.load();
|
||||
config.get("transformers", "DefaultTransformerRegExp", defaultTransformerRegExp,
|
||||
"Default list of methods to transform, of which uses regular expression to match.\n" +
|
||||
@@ -42,17 +46,26 @@ public class NechConfig {
|
||||
config.getCategory("transformers").get("DefaultTransformerRegExp").set(defaultTransformerRegExp);
|
||||
config.getCategory("transformers").get("DefaultTransformerString").set(defaultTransformerStringList);
|
||||
|
||||
transformerRegExpAdditionalList = config.get("additional","AdditionalTransformerRegExpList",new String[0],
|
||||
transformerRegExpAdditionalList = config.get("transformers", "AdditionalTransformerRegExpList", new String[0],
|
||||
"Additional list of methods to transform, of which uses regular expression to match.\n" +
|
||||
"The format is \"full.class.path$InnerClass:methodName\"").getStringList();
|
||||
"The format is \"full.class.path$InnerClass:methodName\"").getStringList();
|
||||
|
||||
transformerStringAdditionalList = config.get("additional","AdditionalTransformerStringList",new String[0],
|
||||
transformerStringAdditionalList = config.get("transformers", "AdditionalTransformerStringList", new String[0],
|
||||
"Additional list of methods to transform, of which uses \"String.contains\" to match.\n" +
|
||||
"The format is \"full.class.path$InnerClass:methodName\"").getStringList();
|
||||
|
||||
transformerMethodBlackList = config.get("blacklist","transformerMethodBlackList",new String[0],
|
||||
transformerMethodBlackList = config.get("transformers", "transformerMethodBlackList", new String[0],
|
||||
"Blacklist of methods to transform\n" +
|
||||
"The format is \"full.class.path$InnerClass:methodName\"").getStringList();
|
||||
if(config.hasChanged()) config.save();
|
||||
|
||||
//Fuzzy config
|
||||
EnableFU2V = config.get("fuzzy", "EnableFU2V", false, "Set to true to enable fuzzy U <=> V").getBoolean();
|
||||
EnableFZh2Z = config.get("fuzzy", "EnableFZh2Z", false, "Set to true to enable fuzzy Zh <=> Z").getBoolean();
|
||||
EnableFSh2S = config.get("fuzzy", "EnableFSh2S", false, "Set to true to enable fuzzy Sh <=> S").getBoolean();
|
||||
EnableFCh2C = config.get("fuzzy", "EnableFCh2C", false, "Set to true to enable fuzzy Ch <=> C").getBoolean();
|
||||
EnableFAng2An = config.get("fuzzy", "EnableFAng2An", false, "Set to true to enable fuzzy Ang <=> An").getBoolean();
|
||||
EnableFIng2In = config.get("fuzzy", "EnableFIng2In", false, "Set to true to enable fuzzy Ing <=> In").getBoolean();
|
||||
EnableFEng2En = config.get("fuzzy", "EnableFEng2En", false, "Set to true to enable fuzzy Eng <=> En").getBoolean();
|
||||
if (config.hasChanged()) config.save();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package net.vfyjxf.nechar.utils;
|
||||
|
||||
import me.towdium.pinin.PinIn;
|
||||
import static net.moecraft.nechar.NotEnoughCharacters.context;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -13,11 +13,6 @@ import java.util.regex.Pattern;
|
||||
public class Match {
|
||||
|
||||
static final Pattern p = Pattern.compile("a");
|
||||
public static final PinIn context = new PinIn();
|
||||
|
||||
static {
|
||||
context.config().fU2V(true).commit();
|
||||
}
|
||||
|
||||
public static boolean isChinese(CharSequence s) {
|
||||
for (int i = s.length() - 1; i >= 0; i--) {
|
||||
|
||||
Reference in new issue
Block a user