-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from KatatsumuriPan/develop
v1.4.0へ更新
- Loading branch information
Showing
14 changed files
with
153 additions
and
39 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
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
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
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
65 changes: 65 additions & 0 deletions
65
src/main/java/kpan/uti_alsofluids/asm/hook/integration/gregtech/HK_MaterialFluid.java
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,65 @@ | ||
package kpan.uti_alsofluids.asm.hook.integration.gregtech; | ||
|
||
import bre.nti.LanguageMapUs; | ||
import gregtech.api.fluids.MaterialFluid; | ||
import kpan.uti_alsofluids.ModMain; | ||
import net.minecraft.client.resources.I18n; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
public class HK_MaterialFluid { | ||
|
||
public static String getLocalizedName(MaterialFluid self, FluidStack stack) { | ||
if (ModMain.proxy.hasClientSide()) { | ||
return ClientOnly.getLocalizedName(self); | ||
} else { | ||
return getLocalizedName(self); | ||
} | ||
} | ||
|
||
private static class ClientOnly { | ||
|
||
private static LanguageMapUs langmapus = LanguageMapUs.getInstanceUs(); | ||
private static int recursion = 0; | ||
|
||
public static String getLocalizedName(MaterialFluid materialFluid) { | ||
String s = materialFluid.getUnlocalizedName(); | ||
if (s == null) | ||
return ""; | ||
synchronized (langmapus.getDisplayNameLock) { | ||
try { | ||
if (langmapus.getDisplayNameThread != null) { | ||
recursion++; | ||
} else { | ||
langmapus.getDisplayNameThread = Thread.currentThread(); | ||
} | ||
return HK_MaterialFluid.getLocalizedName(materialFluid); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
return s; | ||
} finally { | ||
if (recursion == 0) { | ||
langmapus.getDisplayNameThread = null; | ||
} else { | ||
recursion--; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
private static String getLocalizedName(MaterialFluid materialFluid) { | ||
String localizedName; | ||
String customTranslationKey = "fluid." + materialFluid.getMaterial().getUnlocalizedName(); | ||
|
||
if (I18n.hasKey(customTranslationKey)) { | ||
localizedName = I18n.format(customTranslationKey); | ||
} else { | ||
localizedName = I18n.format(materialFluid.getUnlocalizedName()); | ||
} | ||
|
||
if (materialFluid.getFluidType() != null) { | ||
return I18n.format(materialFluid.getFluidType().getLocalization(), localizedName); | ||
} | ||
return localizedName; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/kpan/uti_alsofluids/asm/tf/integration/gregtech/TF_MaterialFluid.java
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,22 @@ | ||
package kpan.uti_alsofluids.asm.tf.integration.gregtech; | ||
|
||
import kpan.uti_alsofluids.asm.core.AsmTypes; | ||
import kpan.uti_alsofluids.asm.core.AsmUtil; | ||
import kpan.uti_alsofluids.asm.core.adapters.MyClassVisitor; | ||
import kpan.uti_alsofluids.asm.core.adapters.ReplaceRefMethodAdapter; | ||
import org.objectweb.asm.ClassVisitor; | ||
|
||
public class TF_MaterialFluid { | ||
|
||
private static final String TARGET = "gregtech.api.fluids.MaterialFluid"; | ||
private static final String HOOK = AsmTypes.HOOK + "integration/gregtech/" + "HK_" + "MaterialFluid"; | ||
|
||
public static ClassVisitor appendVisitor(ClassVisitor cv, String className) { | ||
if (TARGET.equals(className)) { | ||
MyClassVisitor newcv = new ReplaceRefMethodAdapter(cv, HOOK, TARGET, "getLocalizedName", AsmUtil.toMethodDesc(AsmTypes.STRING, AsmTypes.FLUIDSTACK)); | ||
newcv.setSuccessExpectedMin(0);//サーバーだと見つからない | ||
return newcv; | ||
} | ||
return cv; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
untranslateditems_alsofluids.version=1.3.2 | ||
te.version=${version} |
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,8 @@ | ||
package kpan.uti_alsofluids; | ||
|
||
public class BuildInfo { | ||
public static final String VERSION = "${version}"; | ||
public static final String MAJOR_VERSION = "${majorVersion}"; | ||
public static final String MINOR_VERSION = "${minorVersion}"; | ||
public static final String PATCH_VERSION = "${patchVersion}"; | ||
} |
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,3 @@ | ||
majorVersion=1 | ||
minorVersion=4 | ||
patchVersion=0 |