Fix some deprecations and some formatting fixes.
This commit is contained in:
@@ -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;
|
||||
|
@@ -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.
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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) {
|
||||
|
@@ -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) {
|
||||
|
@@ -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");
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -142,25 +142,25 @@ public class StorageMonitorTileRenderer extends TileEntityRenderer<StorageMonito
|
||||
final int colorAlpha = fluidColor >> 24 & 0xFF;
|
||||
|
||||
buffer.pos(matrixStack.getLast().getMatrix(), -0.5F, -0.5F, 0F)
|
||||
.color(colorRed, colorGreen, colorBlue, colorAlpha)
|
||||
.tex(sprite.getMinU(), sprite.getMinV())
|
||||
.lightmap(light)
|
||||
.endVertex();
|
||||
.color(colorRed, colorGreen, colorBlue, colorAlpha)
|
||||
.tex(sprite.getMinU(), sprite.getMinV())
|
||||
.lightmap(light)
|
||||
.endVertex();
|
||||
buffer.pos(matrixStack.getLast().getMatrix(), 0.5F, -0.5F, 0F)
|
||||
.color(colorRed, colorGreen, colorBlue, colorAlpha)
|
||||
.tex(sprite.getMaxU(), sprite.getMinV())
|
||||
.lightmap(light)
|
||||
.endVertex();
|
||||
.color(colorRed, colorGreen, colorBlue, colorAlpha)
|
||||
.tex(sprite.getMaxU(), sprite.getMinV())
|
||||
.lightmap(light)
|
||||
.endVertex();
|
||||
buffer.pos(matrixStack.getLast().getMatrix(), 0.5F, -1.5F, 0F)
|
||||
.color(colorRed, colorGreen, colorBlue, colorAlpha)
|
||||
.tex(sprite.getMaxU(), sprite.getMaxV())
|
||||
.lightmap(light)
|
||||
.endVertex();
|
||||
.color(colorRed, colorGreen, colorBlue, colorAlpha)
|
||||
.tex(sprite.getMaxU(), sprite.getMaxV())
|
||||
.lightmap(light)
|
||||
.endVertex();
|
||||
buffer.pos(matrixStack.getLast().getMatrix(), -0.5F, -1.5F, 0F)
|
||||
.color(colorRed, colorGreen, colorBlue, colorAlpha)
|
||||
.tex(sprite.getMinU(), sprite.getMaxV())
|
||||
.lightmap(light)
|
||||
.endVertex();
|
||||
.color(colorRed, colorGreen, colorBlue, colorAlpha)
|
||||
.tex(sprite.getMinU(), sprite.getMaxV())
|
||||
.lightmap(light)
|
||||
.endVertex();
|
||||
|
||||
matrixStack.pop();
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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());
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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++;
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
@@ -119,7 +118,7 @@ public final class RenderUtils {
|
||||
RenderSystem.disableDepthTest();
|
||||
int tooltipTextWidth = 0;
|
||||
|
||||
for (ITextProperties textLine : textLines) {
|
||||
for (ITextProperties textLine : textLines) {
|
||||
int textLineWidth = font.getStringWidth(textLine.getString());
|
||||
if (textLineWidth > tooltipTextWidth)
|
||||
tooltipTextWidth = textLineWidth;
|
||||
@@ -162,8 +161,8 @@ public final class RenderUtils {
|
||||
int wrappedTooltipWidth = 0;
|
||||
List<ITextProperties> wrappedTextLines = new ArrayList<>();
|
||||
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);
|
||||
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();
|
||||
|
||||
|
@@ -24,38 +24,35 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a tooltip box on the screen with text in it.
|
||||
* Automatically positions the box relative to the mouse to match Mojang's implementation.
|
||||
* Automatically wraps text when there is not enough space on the screen to display the text without wrapping.
|
||||
* Can have a maximum width set to avoid creating very wide tooltips.
|
||||
* Draws a tooltip box on the screen with text in it.
|
||||
* Automatically positions the box relative to the mouse to match Mojang's implementation.
|
||||
* Automatically wraps text when there is not enough space on the screen to display the text without wrapping.
|
||||
* Can have a maximum width set to avoid creating very wide tooltips.
|
||||
*
|
||||
* @param textLines the lines of text to be drawn in a hovering tooltip box.
|
||||
* @param mouseX the mouse X position
|
||||
* @param mouseY the mouse Y position
|
||||
* @param screenWidth the available screen width for the tooltip to drawn in
|
||||
* @param screenHeight the available screen height for the tooltip to drawn in
|
||||
* @param maxTextWidth the maximum width of the text in the tooltip box.
|
||||
* Set to a negative number to have no max width.
|
||||
* @param backgroundColor The background color of the box
|
||||
* @param textLines the lines of text to be drawn in a hovering tooltip box.
|
||||
* @param mouseX the mouse X position
|
||||
* @param mouseY the mouse Y position
|
||||
* @param screenWidth the available screen width for the tooltip to drawn in
|
||||
* @param screenHeight the available screen height for the tooltip to drawn in
|
||||
* @param maxTextWidth the maximum width of the text in the tooltip box.
|
||||
* Set to a negative number to have no max width.
|
||||
* @param backgroundColor The background color of the box
|
||||
* @param borderColorStart The starting color of the box border
|
||||
* @param borderColorEnd The ending color of the box border. The border color will be smoothly interpolated
|
||||
* between the start and end values.
|
||||
* @param font the font for drawing the text in the tooltip box
|
||||
* @param borderColorEnd The ending color of the box border. The border color will be smoothly interpolated
|
||||
* between the start and end values.
|
||||
* @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;
|
||||
|
Reference in New Issue
Block a user