Change some int displays to Roman Numerals
May not be 100% accurate if you somehow manage to get these really, really high, but it's good enough.
This commit is contained in:
parent
d71f181729
commit
a4f55d88b6
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.util.helper.NumeralHelper;
|
||||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -30,7 +31,7 @@ public class AltarRecipeJEI extends BlankRecipeWrapper
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
|
|
||||||
this.infoString = new String[] { TextHelper.localize("jei.BloodMagic.recipe.requiredTier", tier), TextHelper.localize("jei.BloodMagic.recipe.requiredLP", requiredLP) };
|
this.infoString = new String[] { TextHelper.localize("jei.BloodMagic.recipe.requiredTier", NumeralHelper.toRoman(tier)), TextHelper.localize("jei.BloodMagic.recipe.requiredLP", requiredLP) };
|
||||||
this.consumptionRate = consumptionRate;
|
this.consumptionRate = consumptionRate;
|
||||||
this.drainRate = drainRate;
|
this.drainRate = drainRate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.util.helper.NumeralHelper;
|
||||||
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -80,7 +81,7 @@ public class ShapedOrbRecipeJEI implements IShapedCraftingRecipeWrapper
|
||||||
@Override
|
@Override
|
||||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
|
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
String draw = TextHelper.localize("jei.BloodMagic.recipe.requiredTier", tier);
|
String draw = TextHelper.localize("jei.BloodMagic.recipe.requiredTier", NumeralHelper.toRoman(tier));
|
||||||
minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB());
|
minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.util.helper.NumeralHelper;
|
||||||
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
|
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -68,7 +69,7 @@ public class ShapelessOrbRecipeJEI implements ICraftingRecipeWrapper
|
||||||
@Override
|
@Override
|
||||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
|
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
String draw = TextHelper.localize("jei.BloodMagic.recipe.requiredTier", tier);
|
String draw = TextHelper.localize("jei.BloodMagic.recipe.requiredTier", NumeralHelper.toRoman(tier));
|
||||||
minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB());
|
minecraft.fontRendererObj.drawString(draw, 72 - minecraft.fontRendererObj.getStringWidth(draw) / 2, 10, Color.gray.getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.item;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.util.helper.NumeralHelper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -76,7 +77,7 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
|
||||||
stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1);
|
stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1);
|
||||||
|
|
||||||
setTierToBuild(EnumAltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]);
|
setTierToBuild(EnumAltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]);
|
||||||
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.setTier", stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1));
|
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.setTier", NumeralHelper.toRoman(stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1)));
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
|
||||||
|
|
||||||
if (mop.typeOfHit == RayTraceResult.Type.BLOCK && world.getBlockState(mop.getBlockPos()).getBlock() instanceof BlockAltar)
|
if (mop.typeOfHit == RayTraceResult.Type.BLOCK && world.getBlockState(mop.getBlockPos()).getBlock() instanceof BlockAltar)
|
||||||
{
|
{
|
||||||
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.building", tierToBuild));
|
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.BloodMagic.altarMaker.building", NumeralHelper.toRoman(tierToBuild.toInt())));
|
||||||
buildAltar(world, mop.getBlockPos());
|
buildAltar(world, mop.getBlockPos());
|
||||||
IBlockState state = world.getBlockState(mop.getBlockPos());
|
IBlockState state = world.getBlockState(mop.getBlockPos());
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.item.sigil;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.util.helper.NumeralHelper;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -57,7 +58,7 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
||||||
int currentEssence = altar.getCurrentBlood();
|
int currentEssence = altar.getCurrentBlood();
|
||||||
int capacity = altar.getCapacity();
|
int capacity = altar.getCapacity();
|
||||||
altar.checkTier();
|
altar.checkTier();
|
||||||
ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentAltarTier", tier), new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence), new TextComponentTranslation(tooltipBase + "currentAltarCapacity", capacity));
|
ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentAltarTier", NumeralHelper.toRoman(tier)), new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence), new TextComponentTranslation(tooltipBase + "currentAltarCapacity", capacity));
|
||||||
} else if (tile != null && tile instanceof TileIncenseAltar)
|
} else if (tile != null && tile instanceof TileIncenseAltar)
|
||||||
{
|
{
|
||||||
TileIncenseAltar altar = (TileIncenseAltar) tile;
|
TileIncenseAltar altar = (TileIncenseAltar) tile;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.item.sigil;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.util.helper.NumeralHelper;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -70,7 +71,7 @@ public class ItemSigilSeer extends ItemSigilBase implements IAltarReader
|
||||||
ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentAltarProgress", progress, totalLiquidRequired), new TextComponentTranslation(tooltipBase + "currentAltarConsumptionRate", consumptionRate), new TextComponentTranslation(tooltipBase + "currentAltarTier", tier), new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence), new TextComponentTranslation(tooltipBase + "currentAltarCapacity", capacity), new TextComponentTranslation(tooltipBase + "currentCharge", charge));
|
ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentAltarProgress", progress, totalLiquidRequired), new TextComponentTranslation(tooltipBase + "currentAltarConsumptionRate", consumptionRate), new TextComponentTranslation(tooltipBase + "currentAltarTier", tier), new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence), new TextComponentTranslation(tooltipBase + "currentAltarCapacity", capacity), new TextComponentTranslation(tooltipBase + "currentCharge", charge));
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentAltarTier", tier), new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence), new TextComponentTranslation(tooltipBase + "currentAltarCapacity", capacity), new TextComponentTranslation(tooltipBase + "currentCharge", charge));
|
ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentAltarTier", NumeralHelper.toRoman(tier)), new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence), new TextComponentTranslation(tooltipBase + "currentAltarCapacity", capacity), new TextComponentTranslation(tooltipBase + "currentCharge", charge));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (tile != null && tile instanceof TileIncenseAltar)
|
} else if (tile != null && tile instanceof TileIncenseAltar)
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package WayofTime.bloodmagic.util.helper;
|
||||||
|
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
public class NumeralHelper {
|
||||||
|
|
||||||
|
private static final TreeMap<Integer, String> romanNumerals = new TreeMap<Integer, String>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
romanNumerals.put(1000, "M" );
|
||||||
|
romanNumerals.put(900 , "CM");
|
||||||
|
romanNumerals.put(500 , "D" );
|
||||||
|
romanNumerals.put(400 , "CD");
|
||||||
|
romanNumerals.put(100 , "C" );
|
||||||
|
romanNumerals.put(90 , "XC");
|
||||||
|
romanNumerals.put(50 , "L" );
|
||||||
|
romanNumerals.put(40 , "XL");
|
||||||
|
romanNumerals.put(10 , "X" );
|
||||||
|
romanNumerals.put(9 , "IX");
|
||||||
|
romanNumerals.put(5 , "V" );
|
||||||
|
romanNumerals.put(4 , "IV");
|
||||||
|
romanNumerals.put(1 , "I" );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toRoman(int arabic) {
|
||||||
|
int convert = romanNumerals.floorKey(arabic);
|
||||||
|
if (arabic == convert)
|
||||||
|
return romanNumerals.get(convert);
|
||||||
|
|
||||||
|
return romanNumerals.get(convert) + toRoman(arabic - convert);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue