Fixed items with colored tooltip are uncolored in grid, fixes #446

This commit is contained in:
Raoul Van den Berge
2016-10-09 16:30:52 +02:00
parent aded4c9408
commit 642e511cdd
2 changed files with 15 additions and 2 deletions

View File

@@ -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

View File

@@ -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)) {