mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-17 10:55:10 +00:00
Rituals Localization (#24)
* Rituals Localization * Fix breaking change * Update zh_CN.lang Co-authored-by: Kiwi <[email protected]> Co-authored-by: Kiwi <[email protected]>
This commit is contained in:
1 parent
209fed5f81
commit
f2cba48db8
4 files changed
+108
-2
No files matched your search
@@ -8,6 +8,7 @@ import java.util.Map;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import WayofTime.alchemicalWizardry.api.event.RitualRunEvent;
|
||||
@@ -21,6 +22,7 @@ public class Rituals
|
||||
public final int actCost;
|
||||
public final RitualEffect effect;
|
||||
public final String name;
|
||||
public String localizedName = "";
|
||||
|
||||
public final MRSRenderer customRenderer;
|
||||
|
||||
@@ -64,6 +66,7 @@ public class Rituals
|
||||
ritual.removeRitualFromList();
|
||||
ritualMap.put(key, ritual);
|
||||
keyList.add(key);
|
||||
ritual.setRitualLocalizedName(StatCollector.translateToLocal("ritual." + key + ".name"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -79,6 +82,7 @@ public class Rituals
|
||||
ritual.removeRitualFromList();
|
||||
ritualMap.put(key, ritual);
|
||||
keyList.add(key);
|
||||
ritual.setRitualLocalizedName(StatCollector.translateToLocal("ritual." + key + ".name"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -291,6 +295,15 @@ public class Rituals
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setRitualLocalizedName(String localizedName)
|
||||
{
|
||||
this.localizedName = localizedName;
|
||||
}
|
||||
public String getRitualLocalizedName()
|
||||
{
|
||||
return localizedName.isEmpty() ? this.name : localizedName;
|
||||
}
|
||||
|
||||
public static String getNameOfRitual(String id)
|
||||
{
|
||||
@@ -305,6 +318,20 @@ public class Rituals
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getLocalizedNameOfRitual(String id)
|
||||
{
|
||||
if (ritualMap.containsKey(id))
|
||||
{
|
||||
Rituals ritual = ritualMap.get(id);
|
||||
if (ritual != null)
|
||||
{
|
||||
return ritual.getRitualLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getNextRitualKey(String key)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -158,7 +159,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
|
||||
{
|
||||
return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
return "Ritual: " + Rituals.getNameOfRitual(ritualID);
|
||||
return I18n.format("bm.string.ritualDiviner", Rituals.getLocalizedNameOfRitual(ritualID));
|
||||
} else
|
||||
{
|
||||
return super.getItemStackDisplayName(stack);
|
||||
@@ -412,7 +413,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
IChatComponent chatmessagecomponent = new ChatComponentText(StatCollector.translateToLocal("message.ritual.currentritual") + " " + Rituals.getNameOfRitual(this.getCurrentRitual(stack)));
|
||||
IChatComponent chatmessagecomponent = new ChatComponentText(StatCollector.translateToLocal("message.ritual.currentritual") + " " + Rituals.getLocalizedNameOfRitual(this.getCurrentRitual(stack)));
|
||||
player.addChatComponentMessage(chatmessagecomponent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user