Compare commits

..
4 Commits
Author SHA1 Message Date
miozune d0be7d5e25 Fix NPE with matchItem (#33) 2022-09-28 19:12:51 +02:00
Kiwi a52b5b53e3 Update zh_CN.lang (#32) 2022-09-24 12:44:41 +02:00
miozune 82d7520944 Add estimated amount display for meteor NEI (#31) 2022-09-02 13:52:12 +02:00
miozune 3994b2510e Meteor NEI improvements (#30) 2022-08-19 09:40:43 +02:00
3 changed files with 15 additions and 6 deletions

No files matched your search

@@ -51,8 +51,11 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
stack = new ItemStack(Blocks.fire);
tooltips.add(String.format("no entries found for oredict \"%s\"", component.getOreDictName()));
}
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(component.getChance() / totalMeteorWeight)));
float chance = component.getChance() / totalMeteorWeight;
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance)));
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius)));
this.outputs.add(new TooltipStack(stack, xPos, yPos, tooltips));
col++;
if (col > 8) {
col = 0;
@@ -126,6 +129,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
}
private boolean matchItem(ItemStack compared, ItemStack compareTo) {
if (compared == null || compareTo == null) return false;
if (NEIServerUtils.areStacksSameTypeCrafting(compared, compareTo)) {
return true;
}
@@ -197,7 +201,11 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
.collect(Collectors.toList());
}
private String getFormattedChance(double chance) {
private String getFormattedChance(float chance) {
return new DecimalFormat("0.##").format(chance * 100);
}
private int getEstimatedAmount(float chance, int radius) {
return (int) Math.ceil(3f / 4 * Math.PI * Math.pow(radius, 3) * chance);
}
}
@@ -265,6 +265,7 @@ nei.recipe.meteor.category=Meteor Ritual
nei.recipe.meteor.cost=Cost: %s LP
nei.recipe.meteor.radius=Radius: %s
nei.recipe.meteor.chance=Chance: %s%%
nei.recipe.meteor.amount=Estimated amount: %s
#Rituals
ritual.AW001Water.name=Ritual of the Full Spring
@@ -265,6 +265,7 @@ nei.recipe.meteor.category=陨星仪式
nei.recipe.meteor.cost=消耗: %s LP
nei.recipe.meteor.radius=半径: %s
nei.recipe.meteor.chance=几率: %s%%
nei.recipe.meteor.amount=期望数量: %s
#Rituals
ritual.AW001Water.name=涌泉仪式
@@ -360,9 +361,9 @@ commands.network.fill.success=成功填充 %s 的LP网络.
commands.network.cap.help=将指定玩家的LP网络填充到其持有的最高级气血宝珠可以存储的最大值。
commands.network.cap.success=成功锁定了 %s 的LP网络.
commands.bind.usage=/bind <玩家>
commands.bind.usage=/bloodmagic bind [true|false] [玩家]
commands.bind.help=尝试将手持物品绑定(解绑)
commands.bind.success=物品成功绑定!
commands.bind.success=绑定成功
commands.bind.remove.success=解绑成功
commands.orb.usage=/bloodmagic orb [set|get] player [等级]
@@ -607,5 +608,4 @@ bm.versioning.doneDownloading=已完成下载 %s 重新加载您的游戏以进
bm.versioning.error=下载mod时出错!
bm.versioning.downloadedAlready=你已经拥有最新版本,重新加载游戏以进行更新!
bm.versioning.downloadingAlready=正在下载! 耐心点!
bm.versioning.disabled=此功能已禁用.
bm.versioning.disabled=此功能已禁用.