Fixes #4453: Avoid using clientside methods serverside.
This commit is contained in:
@@ -23,7 +23,11 @@
|
|||||||
|
|
||||||
package appeng.api.config;
|
package appeng.api.config;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@@ -34,6 +38,7 @@ import net.minecraft.item.BlockItem;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.IItemProvider;
|
import net.minecraft.util.IItemProvider;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
|
||||||
public enum Upgrades {
|
public enum Upgrades {
|
||||||
/**
|
/**
|
||||||
@@ -76,7 +81,7 @@ public enum Upgrades {
|
|||||||
* items have different maxSupported values, the highest
|
* items have different maxSupported values, the highest
|
||||||
* will be shown.
|
* will be shown.
|
||||||
*/
|
*/
|
||||||
public void registerItem(final IItemProvider item, final int maxSupported, @Nullable ITextComponent tooltipGroup) {
|
public void registerItem(final IItemProvider item, final int maxSupported, @Nullable String tooltipGroup) {
|
||||||
Preconditions.checkNotNull(item);
|
Preconditions.checkNotNull(item);
|
||||||
this.supported.add(new Supported(item.asItem(), maxSupported, tooltipGroup));
|
this.supported.add(new Supported(item.asItem(), maxSupported, tooltipGroup));
|
||||||
supportedTooltipLines = null; // Reset tooltip
|
supportedTooltipLines = null; // Reset tooltip
|
||||||
@@ -95,17 +100,17 @@ public enum Upgrades {
|
|||||||
ITextComponent name = supported.item.getName();
|
ITextComponent name = supported.item.getName();
|
||||||
|
|
||||||
// If the group was already added by a previous item, skip this
|
// If the group was already added by a previous item, skip this
|
||||||
if (supported.tooltipGroup != null && namesAdded.contains(supported.tooltipGroup)) {
|
if (supported.getTooltipGroup() != null && namesAdded.contains(supported.getTooltipGroup())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If any of the following items would be of the same group, use the group name
|
// If any of the following items would be of the same group, use the group name
|
||||||
// instead
|
// instead
|
||||||
if (supported.tooltipGroup != null) {
|
if (supported.getTooltipGroup() != null) {
|
||||||
for (int j = i + 1; j < this.supported.size(); j++) {
|
for (int j = i + 1; j < this.supported.size(); j++) {
|
||||||
ITextComponent otherGroup = this.supported.get(j).tooltipGroup;
|
ITextComponent otherGroup = this.supported.get(j).getTooltipGroup();
|
||||||
if (supported.tooltipGroup.equals(otherGroup)) {
|
if (supported.getTooltipGroup().equals(otherGroup)) {
|
||||||
name = supported.tooltipGroup;
|
name = supported.getTooltipGroup();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,9 +138,9 @@ public enum Upgrades {
|
|||||||
private final Block block;
|
private final Block block;
|
||||||
private final int maxCount;
|
private final int maxCount;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final ITextComponent tooltipGroup;
|
private final String tooltipGroup;
|
||||||
|
|
||||||
public Supported(Item item, int maxCount, @Nullable ITextComponent tooltipGroup) {
|
public Supported(Item item, int maxCount, @Nullable String tooltipGroup) {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
if (item.getItem() instanceof BlockItem) {
|
if (item.getItem() instanceof BlockItem) {
|
||||||
this.block = ((BlockItem) item.getItem()).getBlock();
|
this.block = ((BlockItem) item.getItem()).getBlock();
|
||||||
@@ -158,6 +163,10 @@ public enum Upgrades {
|
|||||||
return item != null && this.item == item;
|
return item != null && this.item == item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ITextComponent getTooltipGroup() {
|
||||||
|
return this.tooltipGroup != null ? new TranslationTextComponent(this.tooltipGroup) : null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -383,10 +383,10 @@ final class Registration {
|
|||||||
|
|
||||||
// Block and part interface have different translation keys, but support the
|
// Block and part interface have different translation keys, but support the
|
||||||
// same upgrades
|
// same upgrades
|
||||||
ITextComponent interfaceGroup = parts.iface().asItem().getName();
|
String interfaceGroup = parts.iface().asItem().getTranslationKey();
|
||||||
ITextComponent itemIoBusGroup = GuiText.IOBuses.textComponent();
|
String itemIoBusGroup = GuiText.IOBuses.getTranslationKey();
|
||||||
ITextComponent fluidIoBusGroup = GuiText.IOBusesFluids.textComponent();
|
String fluidIoBusGroup = GuiText.IOBusesFluids.getTranslationKey();
|
||||||
ITextComponent storageCellGroup = GuiText.IOBusesFluids.textComponent();
|
String storageCellGroup = GuiText.IOBusesFluids.getTranslationKey();
|
||||||
|
|
||||||
// default settings..
|
// default settings..
|
||||||
((P2PTunnelRegistry) registries.p2pTunnel()).configure();
|
((P2PTunnelRegistry) registries.p2pTunnel()).configure();
|
||||||
|
|||||||
Reference in New Issue
Block a user