1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-15 11:45:42 +00:00

Fix usage of a client-only method

Should probably run forge-lint on this at some point, but it's a good
start.

Fixes #255
This commit is contained in:
SquidDev 2019-06-21 21:01:40 +01:00
parent b4aa554279
commit 0741daa7eb
3 changed files with 8 additions and 3 deletions

View File

@ -38,6 +38,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
@ -413,7 +414,9 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
@Override
public ITextComponent getName()
{
return hasCustomName() ? new StringTextComponent( label ) : getBlockState().getBlock().getNameTextComponent();
return hasCustomName()
? new StringTextComponent( label )
: new TranslationTextComponent(getBlockState().getBlock().getTranslationKey());
}
@Override

View File

@ -33,6 +33,7 @@ import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.network.NetworkHooks;
@ -580,7 +581,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
@Override
public ITextComponent getName()
{
return customName != null ? customName : getBlockState().getBlock().getNameTextComponent();
return customName != null ? customName : new TranslationTextComponent(getBlockState().getBlock().getTranslationKey());
}
@Nonnull

View File

@ -29,6 +29,7 @@ import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.network.NetworkHooks;
@ -573,7 +574,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
@Override
public ITextComponent getName()
{
return customName != null ? customName : getBlockState().getBlock().getNameTextComponent();
return customName != null ? customName : new TranslationTextComponent(getBlockState().getBlock().getTranslationKey());
}
@Override