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; package com.refinedmods.refinedstorage.api.render;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;

View File

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

View File

@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor; package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement; import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
import com.refinedmods.refinedstorage.api.render.IElementDrawers; import com.refinedmods.refinedstorage.api.render.IElementDrawers;
@@ -61,8 +60,8 @@ public class FluidCraftingMonitorElement implements ICraftingMonitorElement {
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F; float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.scalef(scale, scale, 1); matrixStack.scale(scale, scale, 1);
int yy = y + 7; 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))); 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 @Override

View File

@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor; package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement; import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
import com.refinedmods.refinedstorage.api.render.IElementDrawers; import com.refinedmods.refinedstorage.api.render.IElementDrawers;
@@ -61,8 +60,8 @@ public class ItemCraftingMonitorElement implements ICraftingMonitorElement {
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F; float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.scalef(scale, scale, 1); matrixStack.scale(scale, scale, 1);
int yy = y + 7; 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)); 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 @Override

View File

@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview; package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement; import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
import com.refinedmods.refinedstorage.api.render.IElementDrawers; 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.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import java.util.Map;
public class FluidCraftingPreviewElement implements ICraftingPreviewElement<FluidStack> { public class FluidCraftingPreviewElement implements ICraftingPreviewElement<FluidStack> {
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "fluid"); public static final ResourceLocation ID = new ResourceLocation(RS.ID, "fluid");
@@ -75,8 +72,8 @@ public class FluidCraftingPreviewElement implements ICraftingPreviewElement<Flui
y += 2; y += 2;
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.scalef(scale, scale, 1); matrixStack.scale(scale, scale, 1);
if (getToCraft() > 0) { if (getToCraft() > 0) {
String format = hasMissing() ? "gui.refinedstorage.crafting_preview.missing" : "gui.refinedstorage.crafting_preview.to_craft"; 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()))); 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) { public void addAvailable(int amount) {

View File

@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview; package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement; import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
import com.refinedmods.refinedstorage.api.render.IElementDrawers; import com.refinedmods.refinedstorage.api.render.IElementDrawers;
@@ -73,8 +72,8 @@ public class ItemCraftingPreviewElement implements ICraftingPreviewElement<ItemS
y += 2; y += 2;
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.scalef(scale, scale, 1); matrixStack.scale(scale, scale, 1);
if (getToCraft() > 0) { if (getToCraft() > 0) {
String format = hasMissing() ? "gui.refinedstorage.crafting_preview.missing" : "gui.refinedstorage.crafting_preview.to_craft"; 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())); 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) { public void addAvailable(int amount) {

View File

@@ -56,7 +56,10 @@ import net.minecraftforge.items.wrapper.InvWrapper;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; 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 class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, IType {
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "grid"); 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 net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.function.Supplier;
public class FluidExternalStorageProvider implements IExternalStorageProvider<FluidStack> { public class FluidExternalStorageProvider implements IExternalStorageProvider<FluidStack> {
@Override @Override

View File

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

View File

@@ -1,6 +1,5 @@
package com.refinedmods.refinedstorage.block; package com.refinedmods.refinedstorage.block;
import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.api.network.grid.GridType; import com.refinedmods.refinedstorage.api.network.grid.GridType;
import com.refinedmods.refinedstorage.apiimpl.API; import com.refinedmods.refinedstorage.apiimpl.API;
import com.refinedmods.refinedstorage.apiimpl.network.grid.factory.GridBlockGridFactory; 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.BaseContainer;
import com.refinedmods.refinedstorage.container.slot.filter.FluidFilterSlot; 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.screen.grid.GridScreen;
import com.refinedmods.refinedstorage.util.RenderUtils; import com.refinedmods.refinedstorage.util.RenderUtils;
import mezz.jei.api.gui.handlers.IGuiContainerHandler; 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.FluidAttributes;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; 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.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View File

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

View File

@@ -5,7 +5,6 @@ import com.refinedmods.refinedstorage.RS;
import com.refinedmods.refinedstorage.render.RenderSettings; import com.refinedmods.refinedstorage.render.RenderSettings;
import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.util.text.ITextComponent; 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) { public void renderQuantity(MatrixStack matrixStack, int x, int y, String qty, int color) {
boolean large = minecraft.getForceUnicodeFont() || RS.CLIENT_CONFIG.getGrid().getLargeFont(); boolean large = minecraft.getForceUnicodeFont() || RS.CLIENT_CONFIG.getGrid().getLargeFont();
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translatef(x, y, Z_LEVEL_QTY); matrixStack.translate(x, y, Z_LEVEL_QTY);
if (!large) { 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); 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) { public void renderString(MatrixStack matrixStack, int x, int y, String message) {

View File

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

View File

@@ -5,7 +5,6 @@ import com.refinedmods.refinedstorage.container.FluidAmountContainer;
import com.refinedmods.refinedstorage.network.SetFluidFilterSlotMessage; import com.refinedmods.refinedstorage.network.SetFluidFilterSlotMessage;
import com.refinedmods.refinedstorage.util.StackUtils; import com.refinedmods.refinedstorage.util.StackUtils;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent; 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.container.AmountContainer;
import com.refinedmods.refinedstorage.network.SetFilterSlotMessage; import com.refinedmods.refinedstorage.network.SetFilterSlotMessage;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent; 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.TileDataManager;
import com.refinedmods.refinedstorage.tile.data.TileDataParameter; import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container; 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 com.refinedmods.refinedstorage.util.RenderUtils;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item; import net.minecraft.item.Item;

View File

@@ -117,8 +117,8 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F; float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
if (getErrorType() != null) { if (getErrorType() != null) {
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.scalef(scale, scale, 1); matrixStack.scale(scale, scale, 1);
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 11, scale), I18n.format("gui.refinedstorage.crafting_preview.error")); 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; int yy = 83;
for (ItemStack output : pattern.getOutputs()) { for (ItemStack output : pattern.getOutputs()) {
if (output != null) { if (output != null) {
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.scalef(scale, scale, 1); matrixStack.scale(scale, scale, 1);
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy + 6, scale), output.getDisplayName().getString()); renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy + 6, scale), output.getDisplayName().getString());
RenderSystem.popMatrix(); matrixStack.pop();
RenderHelper.setupGui3DDiffuseLighting(); RenderHelper.setupGui3DDiffuseLighting();
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
@@ -160,7 +160,7 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
} }
} }
RenderSystem.popMatrix(); matrixStack.pop();
} else { } else {
int slot = scrollbar != null ? (scrollbar.getOffset() * 3) : 0; 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.BaseScreen;
import com.refinedmods.refinedstorage.screen.grid.stack.FluidGridStack; import com.refinedmods.refinedstorage.screen.grid.stack.FluidGridStack;
import com.refinedmods.refinedstorage.screen.grid.stack.IGridStack; import com.refinedmods.refinedstorage.screen.grid.stack.IGridStack;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent; 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()) { if (RenderUtils.inBounds(x, y, 16, 16, mouseX, mouseY) || !grid.isGridActive()) {
int color = grid.isGridActive() ? -2130706433 : 0xFF5B5B5B; int color = grid.isGridActive() ? -2130706433 : 0xFF5B5B5B;
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.disableLighting(); RenderSystem.disableLighting();
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
RenderSystem.colorMask(true, true, true, false); RenderSystem.colorMask(true, true, true, false);
fillGradient(matrixStack, x, y, x + 16, y + 16, color, color); fillGradient(matrixStack, x, y, x + 16, y + 16, color, color);
RenderSystem.colorMask(true, true, true, true); RenderSystem.colorMask(true, true, true, true);
RenderSystem.popMatrix(); matrixStack.pop();
} }
slot++; slot++;

View File

@@ -7,7 +7,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.widget.button.CheckboxButton; import net.minecraft.client.gui.widget.button.CheckboxButton;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import java.util.function.Consumer; 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.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import javax.annotation.Nullable;
public abstract class BaseTile extends TileEntity { public abstract class BaseTile extends TileEntity {
protected final TileDataManager dataManager = new TileDataManager(this); 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.nbt.CompoundNBT;
import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public enum RedstoneMode { public enum RedstoneMode {
IGNORE, HIGH, LOW; 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.renderer.Tessellator;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IReorderingProcessor;
import net.minecraft.util.math.vector.Matrix4f; import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.text.*; import net.minecraft.util.text.*;
import net.minecraftforge.client.event.RenderTooltipEvent; import net.minecraftforge.client.event.RenderTooltipEvent;

View File

@@ -24,8 +24,7 @@ public class TemporaryPortingUtils {
@Nonnull @Nonnull
private static ItemStack cachedTooltipStack = ItemStack.EMPTY; 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); 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 * @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, 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); 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); 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, 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 screenWidth, int screenHeight, int maxTextWidth,
int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font) int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font) {
{ if (!textLines.isEmpty()) {
if (!textLines.isEmpty())
{
RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mStack, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font); RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mStack, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font);
if (MinecraftForge.EVENT_BUS.post(event)) if (MinecraftForge.EVENT_BUS.post(event))
return; return;
@@ -84,8 +79,7 @@ public class TemporaryPortingUtils {
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
int tooltipTextWidth = 0; int tooltipTextWidth = 0;
for (ITextProperties textLine : textLines) for (ITextProperties textLine : textLines) {
{
int textLineWidth = font.func_238414_a_(textLine); int textLineWidth = font.func_238414_a_(textLine);
if (textLineWidth > tooltipTextWidth) if (textLineWidth > tooltipTextWidth)
tooltipTextWidth = textLineWidth; tooltipTextWidth = textLineWidth;
@@ -95,8 +89,7 @@ public class TemporaryPortingUtils {
int titleLinesCount = 1; int titleLinesCount = 1;
int tooltipX = mouseX + 12; int tooltipX = mouseX + 12;
if (tooltipX + tooltipTextWidth + 4 > screenWidth) if (tooltipX + tooltipTextWidth + 4 > screenWidth) {
{
tooltipX = mouseX - 16 - tooltipTextWidth; tooltipX = mouseX - 16 - tooltipTextWidth;
if (tooltipX < 4) // if the tooltip doesn't fit on the screen 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; tooltipTextWidth = maxTextWidth;
needsWrap = true; needsWrap = true;
} }
if (needsWrap) if (needsWrap) {
{
int wrappedTooltipWidth = 0; int wrappedTooltipWidth = 0;
List<ITextProperties> wrappedTextLines = new ArrayList<>(); 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); ITextProperties textLine = textLines.get(i);
List<ITextProperties> wrappedLine = font.func_238420_b_().func_238362_b_(textLine, tooltipTextWidth, Style.EMPTY); List<ITextProperties> wrappedLine = font.func_238420_b_().func_238362_b_(textLine, tooltipTextWidth, Style.EMPTY);
if (i == 0) if (i == 0)
titleLinesCount = wrappedLine.size(); titleLinesCount = wrappedLine.size();
for (ITextProperties line : wrappedLine) for (ITextProperties line : wrappedLine) {
{
int lineWidth = font.func_238414_a_(line); int lineWidth = font.func_238414_a_(line);
if (lineWidth > wrappedTooltipWidth) if (lineWidth > wrappedTooltipWidth)
wrappedTooltipWidth = lineWidth; wrappedTooltipWidth = lineWidth;
@@ -145,8 +134,7 @@ public class TemporaryPortingUtils {
int tooltipY = mouseY - 12; int tooltipY = mouseY - 12;
int tooltipHeight = 8; int tooltipHeight = 8;
if (textLines.size() > 1) if (textLines.size() > 1) {
{
tooltipHeight += (textLines.size() - 1) * 10; tooltipHeight += (textLines.size() - 1) * 10;
if (textLines.size() > titleLinesCount) if (textLines.size() > titleLinesCount)
tooltipHeight += 2; // gap between title lines and next lines tooltipHeight += 2; // gap between title lines and next lines
@@ -184,8 +172,7 @@ public class TemporaryPortingUtils {
int tooltipTop = tooltipY; int tooltipTop = tooltipY;
for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
{
ITextProperties line = textLines.get(lineNumber); ITextProperties line = textLines.get(lineNumber);
if (line != null) 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);