Fixed items with colored tooltip are uncolored in grid, fixes #446
This commit is contained in:
@@ -6,9 +6,11 @@ import net.minecraft.client.Minecraft;
|
|||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||||
import refinedstorage.gui.GuiBase;
|
import refinedstorage.gui.GuiBase;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class ClientStackItem implements IClientStack {
|
public class ClientStackItem implements IClientStack {
|
||||||
@@ -48,7 +50,18 @@ public class ClientStackItem implements IClientStack {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip() {
|
public String getTooltip() {
|
||||||
return Strings.join(stack.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips), "\n");
|
List<String> lines = stack.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
|
||||||
|
|
||||||
|
// From GuiScreen#renderToolTip
|
||||||
|
for (int i = 0; i < lines.size(); ++i) {
|
||||||
|
if (i == 0) {
|
||||||
|
lines.set(i, stack.getRarity().rarityColor + lines.get(i));
|
||||||
|
} else {
|
||||||
|
lines.set(i, TextFormatting.GRAY + lines.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Strings.join(lines, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
|
|||||||
|
|
||||||
worldObj.setBlockState(front, state, 1 | 2);
|
worldObj.setBlockState(front, state, 1 | 2);
|
||||||
|
|
||||||
// From ItemBlock.onItemUse
|
// From ItemBlock#onItemUse
|
||||||
SoundType blockSound = block.getBlock().getSoundType(state, worldObj, pos, null);
|
SoundType blockSound = block.getBlock().getSoundType(state, worldObj, pos, null);
|
||||||
worldObj.playSound(null, front, blockSound.getPlaceSound(), SoundCategory.BLOCKS, (blockSound.getVolume() + 1.0F) / 2.0F, blockSound.getPitch() * 0.8F);
|
worldObj.playSound(null, front, blockSound.getPlaceSound(), SoundCategory.BLOCKS, (blockSound.getVolume() + 1.0F) / 2.0F, blockSound.getPitch() * 0.8F);
|
||||||
} else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
|
} else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user