Fix some deprecations and some formatting fixes.

This commit is contained in:
raoulvdberge
2020-09-05 14:36:43 +02:00
parent dcbf838c70
commit d3818bcb98
39 changed files with 93 additions and 131 deletions

View File

@@ -1,6 +1,5 @@
package com.refinedmods.refinedstorage.api.render;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;

View File

@@ -4,7 +4,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import javax.annotation.Nonnull;
import java.util.function.Supplier;
/**
* Provides an external storage handler to the external storage block.

View File

@@ -27,8 +27,8 @@ public class CraftingMonitorElementList implements ICraftingMonitorElementList {
if (craftingElements != null) {
ICraftingMonitorElement existingElement = craftingElements.get(element.baseElementHashCode());
if (existingElement != null) {
if(existingElement instanceof ErrorCraftingMonitorElement){
((ErrorCraftingMonitorElement)existingElement).mergeBases(element);
if (existingElement instanceof ErrorCraftingMonitorElement) {
((ErrorCraftingMonitorElement) existingElement).mergeBases(element);
} else {
existingElement.merge(element);
}
@@ -38,8 +38,8 @@ public class CraftingMonitorElementList implements ICraftingMonitorElementList {
if (processingElements != null) {
ICraftingMonitorElement existingElement = processingElements.get(element.baseElementHashCode());
if (existingElement != null) {
if(existingElement instanceof ErrorCraftingMonitorElement){
((ErrorCraftingMonitorElement)existingElement).mergeBases(element);
if (existingElement instanceof ErrorCraftingMonitorElement) {
((ErrorCraftingMonitorElement) existingElement).mergeBases(element);
} else {
existingElement.merge(element);
}
@@ -114,7 +114,7 @@ public class CraftingMonitorElementList implements ICraftingMonitorElementList {
@Override
public List<ICraftingMonitorElement> getElements() {
if (!currentLists.isEmpty()||!currentCraftingLists.isEmpty() || !currentProcessingLists.isEmpty() || !currentStorageLists.isEmpty()) {
if (!currentLists.isEmpty() || !currentCraftingLists.isEmpty() || !currentProcessingLists.isEmpty() || !currentStorageLists.isEmpty()) {
commit();
}

View File

@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
import com.refinedmods.refinedstorage.api.render.IElementDrawers;
@@ -61,8 +60,8 @@ public class FluidCraftingMonitorElement implements ICraftingMonitorElement {
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
RenderSystem.pushMatrix();
RenderSystem.scalef(scale, scale, 1);
matrixStack.push();
matrixStack.scale(scale, scale, 1);
int yy = y + 7;
@@ -94,7 +93,7 @@ public class FluidCraftingMonitorElement implements ICraftingMonitorElement {
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.crafting", API.instance().getQuantityFormatter().formatInBucketForm(crafting)));
}
RenderSystem.popMatrix();
matrixStack.pop();
}
@Override

View File

@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
import com.refinedmods.refinedstorage.api.render.IElementDrawers;
@@ -61,8 +60,8 @@ public class ItemCraftingMonitorElement implements ICraftingMonitorElement {
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
RenderSystem.pushMatrix();
RenderSystem.scalef(scale, scale, 1);
matrixStack.push();
matrixStack.scale(scale, scale, 1);
int yy = y + 7;
@@ -94,7 +93,7 @@ public class ItemCraftingMonitorElement implements ICraftingMonitorElement {
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.crafting", crafting));
}
RenderSystem.popMatrix();
matrixStack.pop();
}
@Override

View File

@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
import com.refinedmods.refinedstorage.api.render.IElementDrawers;
@@ -15,8 +14,6 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack;
import java.util.Map;
public class FluidCraftingPreviewElement implements ICraftingPreviewElement<FluidStack> {
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "fluid");
@@ -75,8 +72,8 @@ public class FluidCraftingPreviewElement implements ICraftingPreviewElement<Flui
y += 2;
RenderSystem.pushMatrix();
RenderSystem.scalef(scale, scale, 1);
matrixStack.push();
matrixStack.scale(scale, scale, 1);
if (getToCraft() > 0) {
String format = hasMissing() ? "gui.refinedstorage.crafting_preview.missing" : "gui.refinedstorage.crafting_preview.to_craft";
@@ -89,7 +86,7 @@ public class FluidCraftingPreviewElement implements ICraftingPreviewElement<Flui
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format("gui.refinedstorage.crafting_preview.available", API.instance().getQuantityFormatter().formatInBucketForm(getAvailable())));
}
RenderSystem.popMatrix();
matrixStack.pop();
}
public void addAvailable(int amount) {

View File

@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
import com.refinedmods.refinedstorage.api.render.IElementDrawers;
@@ -73,8 +72,8 @@ public class ItemCraftingPreviewElement implements ICraftingPreviewElement<ItemS
y += 2;
RenderSystem.pushMatrix();
RenderSystem.scalef(scale, scale, 1);
matrixStack.push();
matrixStack.scale(scale, scale, 1);
if (getToCraft() > 0) {
String format = hasMissing() ? "gui.refinedstorage.crafting_preview.missing" : "gui.refinedstorage.crafting_preview.to_craft";
@@ -87,7 +86,7 @@ public class ItemCraftingPreviewElement implements ICraftingPreviewElement<ItemS
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format("gui.refinedstorage.crafting_preview.available", getAvailable()));
}
RenderSystem.popMatrix();
matrixStack.pop();
}
public void addAvailable(int amount) {

View File

@@ -56,7 +56,10 @@ import net.minecraftforge.items.wrapper.InvWrapper;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, IType {
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "grid");

View File

@@ -10,7 +10,6 @@ import net.minecraft.util.Direction;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import java.util.function.Supplier;
public class FluidExternalStorageProvider implements IExternalStorageProvider<FluidStack> {
@Override

View File

@@ -13,7 +13,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import javax.annotation.Nonnull;
import java.util.function.Supplier;
public class ItemExternalStorageProvider implements IExternalStorageProvider<ItemStack> {
@Override

View File

@@ -1,6 +1,5 @@
package com.refinedmods.refinedstorage.block;
import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.network.grid.GridType;
import com.refinedmods.refinedstorage.apiimpl.API;
import com.refinedmods.refinedstorage.apiimpl.network.grid.factory.GridBlockGridFactory;

View File

@@ -2,7 +2,6 @@ package com.refinedmods.refinedstorage.integration.jei;
import com.refinedmods.refinedstorage.container.BaseContainer;
import com.refinedmods.refinedstorage.container.slot.filter.FluidFilterSlot;
import com.refinedmods.refinedstorage.screen.BaseScreen;
import com.refinedmods.refinedstorage.screen.grid.GridScreen;
import com.refinedmods.refinedstorage.util.RenderUtils;
import mezz.jei.api.gui.handlers.IGuiContainerHandler;

View File

@@ -14,7 +14,6 @@ import net.minecraft.util.math.vector.Matrix4f;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**

View File

@@ -12,7 +12,6 @@ import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import javax.annotation.Nullable;

View File

@@ -15,7 +15,6 @@ import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

View File

@@ -5,7 +5,6 @@ import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.render.RenderSettings;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.util.text.ITextComponent;

View File

@@ -305,16 +305,16 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
public void renderQuantity(MatrixStack matrixStack, int x, int y, String qty, int color) {
boolean large = minecraft.getForceUnicodeFont() || RS.CLIENT_CONFIG.getGrid().getLargeFont();
RenderSystem.pushMatrix();
RenderSystem.translatef(x, y, Z_LEVEL_QTY);
matrixStack.push();
matrixStack.translate(x, y, Z_LEVEL_QTY);
if (!large) {
RenderSystem.scalef(0.5f, 0.5f, 1);
matrixStack.scale(0.5F, 0.5F, 1);
}
font.drawStringWithShadow(matrixStack, qty, (large ? 16 : 30) - font.getStringWidth(qty), large ? 8 : 22, color);
RenderSystem.popMatrix();
matrixStack.pop();
}
public void renderString(MatrixStack matrixStack, int x, int y, String message) {

View File

@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.screen;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.apiimpl.network.Network;
import com.refinedmods.refinedstorage.container.ControllerContainer;
@@ -103,8 +102,8 @@ public class ControllerScreen extends BaseScreen<ControllerContainer> {
float scale = minecraft.getForceUnicodeFont() ? 1F : 0.5F;
RenderSystem.pushMatrix();
RenderSystem.scalef(scale, scale, 1);
matrixStack.push();
matrixStack.scale(scale, scale, 1);
renderString(
matrixStack,
@@ -114,7 +113,7 @@ public class ControllerScreen extends BaseScreen<ControllerContainer> {
);
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 21, scale), RenderUtils.getOffsetOnScale(y + 10, scale), node.getAmount() + "x");
RenderSystem.popMatrix();
matrixStack.pop();
if (RenderUtils.inBounds(x, y, 16, 16, mouseX, mouseY)) {
hoveringNode = node;

View File

@@ -5,7 +5,6 @@ import com.refinedmods.refinedstorage.container.FluidAmountContainer;
import com.refinedmods.refinedstorage.network.SetFluidFilterSlotMessage;
import com.refinedmods.refinedstorage.util.StackUtils;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;

View File

@@ -4,7 +4,6 @@ import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.container.AmountContainer;
import com.refinedmods.refinedstorage.network.SetFilterSlotMessage;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;

View File

@@ -2,7 +2,6 @@ package com.refinedmods.refinedstorage.screen;
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;

View File

@@ -14,7 +14,6 @@ import com.refinedmods.refinedstorage.tile.grid.GridTile;
import com.refinedmods.refinedstorage.util.RenderUtils;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
@@ -284,7 +283,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
@Override
public void render(MatrixStack matrixStack, int x, int y) {
RenderSystem.color4f(1,1,1,1);
RenderSystem.color4f(1, 1, 1, 1);
renderItem(matrixStack, x + 3, y + 2, item);
renderString(matrixStack, x + 4 + 19, y + 7, item.getDisplayName().getString());
}

View File

@@ -117,8 +117,8 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
if (getErrorType() != null) {
RenderSystem.pushMatrix();
RenderSystem.scalef(scale, scale, 1);
matrixStack.push();
matrixStack.scale(scale, scale, 1);
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 11, scale), I18n.format("gui.refinedstorage.crafting_preview.error"));
@@ -136,10 +136,10 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
int yy = 83;
for (ItemStack output : pattern.getOutputs()) {
if (output != null) {
RenderSystem.pushMatrix();
RenderSystem.scalef(scale, scale, 1);
matrixStack.push();
matrixStack.scale(scale, scale, 1);
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy + 6, scale), output.getDisplayName().getString());
RenderSystem.popMatrix();
matrixStack.pop();
RenderHelper.setupGui3DDiffuseLighting();
RenderSystem.enableDepthTest();
@@ -160,7 +160,7 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
}
}
RenderSystem.popMatrix();
matrixStack.pop();
} else {
int slot = scrollbar != null ? (scrollbar.getOffset() * 3) : 0;

View File

@@ -7,7 +7,6 @@ import com.refinedmods.refinedstorage.screen.AmountSpecifyingScreen;
import com.refinedmods.refinedstorage.screen.BaseScreen;
import com.refinedmods.refinedstorage.screen.grid.stack.FluidGridStack;
import com.refinedmods.refinedstorage.screen.grid.stack.IGridStack;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;

View File

@@ -372,13 +372,13 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
if (RenderUtils.inBounds(x, y, 16, 16, mouseX, mouseY) || !grid.isGridActive()) {
int color = grid.isGridActive() ? -2130706433 : 0xFF5B5B5B;
RenderSystem.pushMatrix();
matrixStack.push();
RenderSystem.disableLighting();
RenderSystem.disableDepthTest();
RenderSystem.colorMask(true, true, true, false);
fillGradient(matrixStack, x, y, x + 16, y + 16, color, color);
RenderSystem.colorMask(true, true, true, true);
RenderSystem.popMatrix();
matrixStack.pop();
}
slot++;

View File

@@ -7,7 +7,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.widget.button.CheckboxButton;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import java.util.function.Consumer;

View File

@@ -8,8 +8,6 @@ import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import javax.annotation.Nullable;
public abstract class BaseTile extends TileEntity {
protected final TileDataManager dataManager = new TileDataManager(this);

View File

@@ -4,8 +4,6 @@ import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public enum RedstoneMode {
IGNORE, HIGH, LOW;

View File

@@ -12,7 +12,6 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IReorderingProcessor;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.text.*;
import net.minecraftforge.client.event.RenderTooltipEvent;

View File

@@ -24,8 +24,7 @@ public class TemporaryPortingUtils {
@Nonnull
private static ItemStack cachedTooltipStack = ItemStack.EMPTY;
public static void drawHoveringText(MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
{
public static void drawHoveringText(MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) {
drawHoveringText(mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, GuiUtils.DEFAULT_BACKGROUND_COLOR, GuiUtils.DEFAULT_BORDER_COLOR_START, GuiUtils.DEFAULT_BORDER_COLOR_END, font);
}
@@ -49,13 +48,11 @@ public class TemporaryPortingUtils {
* @param font the font for drawing the text in the tooltip box
*/
public static void drawHoveringText(MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight,
int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font)
{
int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font) {
drawHoveringText(cachedTooltipStack, mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, backgroundColor, borderColorStart, borderColorEnd, font);
}
public static void drawHoveringText(@Nonnull final ItemStack stack, MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
{
public static void drawHoveringText(@Nonnull final ItemStack stack, MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) {
drawHoveringText(stack, mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, GuiUtils.DEFAULT_BACKGROUND_COLOR, GuiUtils.DEFAULT_BORDER_COLOR_START, GuiUtils.DEFAULT_BORDER_COLOR_END, font);
}
@@ -66,10 +63,8 @@ public class TemporaryPortingUtils {
*/
public static void drawHoveringText(@Nonnull final ItemStack stack, MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY,
int screenWidth, int screenHeight, int maxTextWidth,
int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font)
{
if (!textLines.isEmpty())
{
int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font) {
if (!textLines.isEmpty()) {
RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mStack, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font);
if (MinecraftForge.EVENT_BUS.post(event))
return;
@@ -84,8 +79,7 @@ public class TemporaryPortingUtils {
RenderSystem.disableDepthTest();
int tooltipTextWidth = 0;
for (ITextProperties textLine : textLines)
{
for (ITextProperties textLine : textLines) {
int textLineWidth = font.func_238414_a_(textLine);
if (textLineWidth > tooltipTextWidth)
tooltipTextWidth = textLineWidth;
@@ -95,8 +89,7 @@ public class TemporaryPortingUtils {
int titleLinesCount = 1;
int tooltipX = mouseX + 12;
if (tooltipX + tooltipTextWidth + 4 > screenWidth)
{
if (tooltipX + tooltipTextWidth + 4 > screenWidth) {
tooltipX = mouseX - 16 - tooltipTextWidth;
if (tooltipX < 4) // if the tooltip doesn't fit on the screen
{
@@ -108,25 +101,21 @@ public class TemporaryPortingUtils {
}
}
if (maxTextWidth > 0 && tooltipTextWidth > maxTextWidth)
{
if (maxTextWidth > 0 && tooltipTextWidth > maxTextWidth) {
tooltipTextWidth = maxTextWidth;
needsWrap = true;
}
if (needsWrap)
{
if (needsWrap) {
int wrappedTooltipWidth = 0;
List<ITextProperties> wrappedTextLines = new ArrayList<>();
for (int i = 0; i < textLines.size(); i++)
{
for (int i = 0; i < textLines.size(); i++) {
ITextProperties textLine = textLines.get(i);
List<ITextProperties> wrappedLine = font.func_238420_b_().func_238362_b_(textLine, tooltipTextWidth, Style.EMPTY);
if (i == 0)
titleLinesCount = wrappedLine.size();
for (ITextProperties line : wrappedLine)
{
for (ITextProperties line : wrappedLine) {
int lineWidth = font.func_238414_a_(line);
if (lineWidth > wrappedTooltipWidth)
wrappedTooltipWidth = lineWidth;
@@ -145,8 +134,7 @@ public class TemporaryPortingUtils {
int tooltipY = mouseY - 12;
int tooltipHeight = 8;
if (textLines.size() > 1)
{
if (textLines.size() > 1) {
tooltipHeight += (textLines.size() - 1) * 10;
if (textLines.size() > titleLinesCount)
tooltipHeight += 2; // gap between title lines and next lines
@@ -184,11 +172,10 @@ public class TemporaryPortingUtils {
int tooltipTop = tooltipY;
for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber)
{
for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
ITextProperties line = textLines.get(lineNumber);
if (line != null)
font.func_238416_a_(LanguageMap.getInstance().func_241870_a(line), (float)tooltipX, (float)tooltipY, -1, true, mat, renderType, false, 0, 15728880);
font.func_238416_a_(LanguageMap.getInstance().func_241870_a(line), (float) tooltipX, (float) tooltipY, -1, true, mat, renderType, false, 0, 15728880);
if (lineNumber + 1 == titleLinesCount)
tooltipY += 2;