mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Fix #2177
The original hotfix is no longer necessary, as all remaning calls to getFullName are fully client-side
This commit is contained in:
parent
38c6b4691d
commit
00c73d63c0
@ -1,6 +1,6 @@
|
||||
package com.hbm.handler.ability;
|
||||
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
public interface IBaseAbility extends Comparable<IBaseAbility> {
|
||||
public String getName();
|
||||
@ -9,9 +9,9 @@ public interface IBaseAbility extends Comparable<IBaseAbility> {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Note: only usable client-side. Server-side, use ChatComponentTranslation manually instead
|
||||
public default String getFullName(int level) {
|
||||
//bandaid fix so it doesn't crash servers instantly, TODO: use ChatComponentTranslation
|
||||
return I18nUtil.format(getName()) + getExtension(level);
|
||||
return I18n.format(getName()) + getExtension(level);
|
||||
}
|
||||
|
||||
public default boolean isAllowed() {
|
||||
|
||||
@ -27,26 +27,32 @@ public class ToolPreset {
|
||||
this.harvestAbilityLevel = harvestAbilityLevel;
|
||||
}
|
||||
|
||||
public ChatComponentText getMessage() {
|
||||
if(isNone())
|
||||
return ChatBuilder.start("[Tool ability deactivated]").color(EnumChatFormatting.GOLD).flush();
|
||||
public ChatComponentText getMessage() {
|
||||
if (isNone()) {
|
||||
return ChatBuilder.start("[Tool ability deactivated]").color(EnumChatFormatting.GOLD).flush();
|
||||
}
|
||||
|
||||
String areaPart = areaAbility.getFullName(areaAbilityLevel);
|
||||
String harvestPart = harvestAbility.getFullName(harvestAbilityLevel);
|
||||
boolean hasArea = areaAbility != IToolAreaAbility.NONE;
|
||||
boolean hasHarvest = harvestAbility != IToolHarvestAbility.NONE;
|
||||
|
||||
ChatBuilder builder = ChatBuilder.start("[Enabled ");
|
||||
|
||||
ChatBuilder builder = ChatBuilder.start("[Enabled ");
|
||||
if (hasArea) {
|
||||
builder.nextTranslation(areaAbility.getName());
|
||||
builder.next(areaAbility.getExtension(areaAbilityLevel));
|
||||
}
|
||||
|
||||
if(!areaPart.isEmpty())
|
||||
builder.next(areaPart);
|
||||
if (hasArea && hasHarvest) {
|
||||
builder.next(" + ");
|
||||
}
|
||||
|
||||
if(!areaPart.isEmpty() && !harvestPart.isEmpty())
|
||||
builder.next(" + ");
|
||||
|
||||
if(!harvestPart.isEmpty())
|
||||
builder.next(harvestPart);
|
||||
|
||||
return builder.colorAll(EnumChatFormatting.YELLOW).flush();
|
||||
}
|
||||
if (hasHarvest) {
|
||||
builder.nextTranslation(harvestAbility.getName());
|
||||
builder.next(harvestAbility.getExtension(harvestAbilityLevel));
|
||||
}
|
||||
|
||||
return builder.colorAll(EnumChatFormatting.YELLOW).flush();
|
||||
}
|
||||
|
||||
public boolean isNone() {
|
||||
return areaAbility == IToolAreaAbility.NONE && harvestAbility == IToolHarvestAbility.NONE;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user