Skip to content
This repository has been archived by the owner on Sep 17, 2022. It is now read-only.

Fix getItemStackDisplayName on Servers #578

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package gregicadditions.blocks;

import gregtech.api.unification.material.type.Material;
import gregtech.api.util.LocalisationUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class GAMetalCasingItemBlock extends ItemBlock {

private final GAMetalCasing metalCasingBlock;
Expand All @@ -30,10 +27,10 @@ public IBlockState getBlockState(ItemStack stack) {
}

@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public String getItemStackDisplayName(ItemStack stack) {
Material material = getBlockState(stack).getValue(metalCasingBlock.variantProperty);
return I18n.format("tile.ga_metal_casing.material.name", material.getLocalizedName());
return LocalisationUtils.format("tile.ga_metal_casing.material.name", material.getLocalizedName());
}


Expand Down
1 change: 0 additions & 1 deletion src/main/java/gregicadditions/blocks/GAOreItemBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public GAOreItemBlock(GABlockOre oreBlock) {
}

@Override
@SideOnly(Side.CLIENT)
public String getItemStackDisplayName(ItemStack stack) {
IBlockState blockState = getBlockState(stack);
StoneType stoneType = blockState.getValue(oreBlock.STONE_TYPE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import com.blakebr0.cucumber.iface.IColoredItem;
import com.blakebr0.cucumber.item.ItemBase;
import gregtech.api.unification.material.type.Material;
import net.minecraft.client.resources.I18n;
import gregtech.api.util.LocalisationUtils;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class ItemEssence extends ItemBase implements IColoredItem {

Expand All @@ -18,9 +16,9 @@ public ItemEssence(Material material) {
}

@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public String getItemStackDisplayName(ItemStack stack) {
return I18n.format("item.ga_essence.material.name", material.getLocalizedName());
return LocalisationUtils.format("item.ga_essence.material.name", material.getLocalizedName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.blakebr0.mysticalagriculture.items.ItemSeed;
import com.blakebr0.mysticalagriculture.lib.Tooltips;
import gregtech.api.unification.material.type.Material;
import gregtech.api.util.LocalisationUtils;
import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
Expand All @@ -31,9 +32,9 @@ public ItemTierSeed(Block crops, Material material, int tier) {
}

@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public String getItemStackDisplayName(ItemStack stack) {
return I18n.format("item.ga_seed.material.name", material.getLocalizedName());
return LocalisationUtils.format("item.ga_seed.material.name", material.getLocalizedName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import gregtech.api.items.metaitem.stats.IItemColorProvider;
import gregtech.api.items.metaitem.stats.IItemNameProvider;
import gregtech.api.unification.material.type.Material;
import gregtech.api.util.LocalisationUtils;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class WasteBehavior implements IItemColorProvider, IItemNameProvider {

Expand Down Expand Up @@ -41,11 +40,11 @@ public int getItemStackColor(ItemStack itemStack, int i) {
}

@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public String getItemStackDisplayName(ItemStack itemStack, String unlocalizedName) {
if (material != null)
return I18n.format(unlocalizedName, material.getLocalizedName());
return LocalisationUtils.format(unlocalizedName, material.getLocalizedName());
else
return I18n.format(unlocalizedName, I18n.format(this.unlocalizedName));
return LocalisationUtils.format(unlocalizedName, LocalisationUtils.format(this.unlocalizedName));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import gregtech.api.GTValues;
import gregtech.api.pipenet.block.ItemBlockPipe;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.api.util.GTUtility;
import gregtech.api.util.LocalisationUtils;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
Expand All @@ -21,12 +21,12 @@ public ItemBlockOpticalFiber(BlockOpticalFiber block) {
super(block);
}

@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public String getItemStackDisplayName(ItemStack stack) {
OpticalFiberSize pipeType = blockPipe.getItemPipeType(stack);
OrePrefix orePrefix = pipeType.getOrePrefix();
String specfiedUnlocalized = "item.oreprefix." + orePrefix.name();
return I18n.format(specfiedUnlocalized);
return LocalisationUtils.format(specfiedUnlocalized);
}

@Override
Expand Down