Porting
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Refined Storage [](https://ci.refinedmods.com/job/refinedstorage-mc1.15/) [](http://minecraft.curseforge.com/projects/refined-storage)
|
||||
# Refined Storage [](https://ci.refinedmods.com/job/refinedstorage-mc1.16/) [](http://minecraft.curseforge.com/projects/refined-storage)
|
||||
|
||||
**Refined Storage is a mass storage mod for Minecraft that offers the player a network-based storage system, allowing them to store items and fluids on a massively expandable device network.**
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.api.network.grid;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.render.IElementDrawer;
|
||||
import com.refinedmods.refinedstorage.api.util.IFilter;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
@@ -23,19 +24,21 @@ public interface IGridTab {
|
||||
/**
|
||||
* Draws the tooltip of this tab at the given position.
|
||||
*
|
||||
* @param matrixStack the matrix stack
|
||||
* @param x the x position
|
||||
* @param y the y position
|
||||
* @param screenWidth the screen width
|
||||
* @param screenHeight the screen height
|
||||
* @param fontRenderer the font renderer
|
||||
*/
|
||||
void drawTooltip(int x, int y, int screenWidth, int screenHeight, FontRenderer fontRenderer);
|
||||
void drawTooltip(MatrixStack matrixStack, int x, int y, int screenWidth, int screenHeight, FontRenderer fontRenderer);
|
||||
|
||||
/**
|
||||
* Draws the icon.
|
||||
*
|
||||
* @param matrixStack the matrix stack
|
||||
* @param x the x position
|
||||
* @param y the y position
|
||||
*/
|
||||
void drawIcon(int x, int y, IElementDrawer<ItemStack> itemDrawer, IElementDrawer<FluidStack> fluidDrawer);
|
||||
void drawIcon(MatrixStack matrixStack, int x, int y, IElementDrawer<ItemStack> itemDrawer, IElementDrawer<FluidStack> fluidDrawer);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class CraftingGridBehavior implements ICraftingGridBehavior {
|
||||
|
||||
// If there is no space in the network, just dump it in the world.
|
||||
if (!remainderStack.isEmpty()) {
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), remainderStack);
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosX(), player.getPosY(), player.getPosZ(), remainderStack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class CraftingGridBehavior implements ICraftingGridBehavior {
|
||||
}
|
||||
|
||||
if (!remainder.isEmpty()) {
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), remainder);
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosX(), player.getPosY(), player.getPosZ(), remainder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.refinedmods.refinedstorage.apiimpl.network.grid;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.IGridTab;
|
||||
import com.refinedmods.refinedstorage.api.render.IElementDrawer;
|
||||
import com.refinedmods.refinedstorage.api.util.IFilter;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
|
||||
@@ -35,16 +38,16 @@ public class GridTab implements IGridTab {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTooltip(int x, int y, int screenWidth, int screenHeight, FontRenderer fontRenderer) {
|
||||
public void drawTooltip(MatrixStack matrixStack, int x, int y, int screenWidth, int screenHeight, FontRenderer fontRenderer) {
|
||||
if (!name.trim().equals("")) {
|
||||
GuiUtils.drawHoveringText(Collections.singletonList(name), x, y, screenWidth, screenHeight, -1, fontRenderer);
|
||||
GuiUtils.drawHoveringText(matrixStack, Collections.singletonList(new StringTextComponent(name)), x, y, screenWidth, screenHeight, -1, fontRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawIcon(int x, int y, IElementDrawer<ItemStack> itemDrawer, IElementDrawer<FluidStack> fluidDrawer) {
|
||||
public void drawIcon(MatrixStack matrixStack, int x, int y, IElementDrawer<ItemStack> itemDrawer, IElementDrawer<FluidStack> fluidDrawer) {
|
||||
if (!icon.isEmpty()) {
|
||||
RenderSystem.setupGui3DDiffuseLighting();
|
||||
RenderHelper.setupGui3DDiffuseLighting();
|
||||
|
||||
itemDrawer.draw(x, y, icon);
|
||||
} else {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class FluidGridHandler implements IFluidGridHandler {
|
||||
|
||||
if (shift) {
|
||||
if (!player.inventory.addItemStackToInventory(fluidHandler.getContainer().copy())) {
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), fluidHandler.getContainer());
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosX(), player.getPosY(), player.getPosZ(), fluidHandler.getContainer());
|
||||
}
|
||||
} else {
|
||||
player.inventory.setItemStack(fluidHandler.getContainer());
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PortableFluidGridHandler implements IFluidGridHandler {
|
||||
|
||||
if (shift) {
|
||||
if (!player.inventory.addItemStackToInventory(fluidHandler.getContainer().copy())) {
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), fluidHandler.getContainer());
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosX(), player.getPosY(), player.getPosZ(), fluidHandler.getContainer());
|
||||
}
|
||||
} else {
|
||||
player.inventory.setItemStack(fluidHandler.getContainer());
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.refinedmods.refinedstorage.api.network.item.INetworkItemProvider;
|
||||
import com.refinedmods.refinedstorage.api.network.node.INetworkNode;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -33,7 +33,7 @@ public class NetworkItemManager implements INetworkItemManager {
|
||||
((IWirelessTransmitter) node).getDimension() == player.dimension) {
|
||||
IWirelessTransmitter transmitter = (IWirelessTransmitter) node;
|
||||
|
||||
Vec3d pos = player.getPositionVec();
|
||||
Vector3d pos = player.getPositionVec();
|
||||
|
||||
double distance = Math.sqrt(Math.pow(transmitter.getOrigin().getX() - pos.getX(), 2) + Math.pow(transmitter.getOrigin().getY() - pos.getY(), 2) + Math.pow(transmitter.getOrigin().getZ() - pos.getZ(), 2));
|
||||
|
||||
@@ -46,7 +46,7 @@ public class NetworkItemManager implements INetworkItemManager {
|
||||
}
|
||||
|
||||
if (!inRange) {
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_range"));
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_range"), player.getUniqueID());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,6 +87,6 @@ public class WirelessCraftingMonitorNetworkItem implements INetworkItem {
|
||||
}
|
||||
|
||||
private void sendOutOfEnergyMessage() {
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_energy", new TranslationTextComponent(stack.getItem().getTranslationKey())));
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_energy", new TranslationTextComponent(stack.getItem().getTranslationKey())), player.getUniqueID());
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,6 @@ public class WirelessFluidGridNetworkItem implements INetworkItem {
|
||||
}
|
||||
|
||||
private void sendOutOfEnergyMessage() {
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_energy", new TranslationTextComponent(stack.getItem().getTranslationKey())));
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_energy", new TranslationTextComponent(stack.getItem().getTranslationKey())), player.getUniqueID());
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,6 @@ public class WirelessGridNetworkItem implements INetworkItem {
|
||||
}
|
||||
|
||||
private void sendOutOfEnergyMessage() {
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_energy", new TranslationTextComponent(stack.getItem().getTranslationKey())));
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_energy", new TranslationTextComponent(stack.getItem().getTranslationKey())), player.getUniqueID());
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ import com.refinedmods.refinedstorage.util.StackUtils;
|
||||
import com.refinedmods.refinedstorage.util.WorldUtils;
|
||||
import net.minecraft.dispenser.DefaultDispenseItemBehavior;
|
||||
import net.minecraft.dispenser.Position;
|
||||
import net.minecraft.entity.item.FireworkRocketEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.FireworkRocketEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -29,7 +29,7 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
@@ -114,7 +114,7 @@ public class ConstructorNetworkNode extends NetworkNode implements IComparable,
|
||||
WorldUtils.getFakePlayer((ServerWorld) world, getOwner()),
|
||||
Hand.MAIN_HAND,
|
||||
took,
|
||||
new BlockRayTraceResult(Vec3d.ZERO, getDirection(), pos, false)
|
||||
new BlockRayTraceResult(Vector3d.ZERO, getDirection(), pos, false)
|
||||
);
|
||||
|
||||
ActionResultType result = ForgeHooks.onPlaceItemIntoWorld(ctx);
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
@@ -127,7 +127,7 @@ public class DestructorNetworkNode extends NetworkNode implements IComparable, I
|
||||
Block frontBlock = frontBlockState.getBlock();
|
||||
ItemStack frontStack = frontBlock.getPickBlock(
|
||||
frontBlockState,
|
||||
new BlockRayTraceResult(Vec3d.ZERO, getDirection().getOpposite(), front, false),
|
||||
new BlockRayTraceResult(Vector3d.ZERO, getDirection().getOpposite(), front, false),
|
||||
world,
|
||||
front,
|
||||
WorldUtils.getFakePlayer((ServerWorld) world, getOwner())
|
||||
|
||||
@@ -165,7 +165,7 @@ public class StorageMonitorNetworkNode extends NetworkNode implements IComparabl
|
||||
|
||||
ItemStack container = result.getLeft();
|
||||
if (!player.inventory.addItemStackToInventory(container.copy())) {
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), container);
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosX(), player.getPosY(), player.getPosZ(), container);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class StorageMonitorNetworkNode extends NetworkNode implements IComparabl
|
||||
|
||||
if (!result.isEmpty()) {
|
||||
if (!player.inventory.addItemStackToInventory(result.copy())) {
|
||||
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), result);
|
||||
InventoryHelper.spawnItemStack(world, player.getPosX(), player.getPosY(), player.getPosZ(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ public class StorageMonitorNetworkNode extends NetworkNode implements IComparabl
|
||||
fluidHandler.fill(network.extractFluid(stack, FluidAttributes.BUCKET_VOLUME, Action.PERFORM), IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
if (!player.inventory.addItemStackToInventory(fluidHandler.getContainer().copy())) {
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), fluidHandler.getContainer());
|
||||
InventoryHelper.spawnItemStack(player.getEntityWorld(), player.getPosX(), player.getPosY(), player.getPosZ(), fluidHandler.getContainer());
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ItemStorageTracker implements IStorageTracker<ItemStack> {
|
||||
|
||||
@Override
|
||||
public void changed(PlayerEntity player, ItemStack stack) {
|
||||
changes.put(new Key(stack), new StorageTrackerEntry(System.currentTimeMillis(), player.getName().getFormattedText()));
|
||||
changes.put(new Key(stack), new StorageTrackerEntry(System.currentTimeMillis(), player.getName().getString()));
|
||||
|
||||
listener.run();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.IWaterLoggable;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
@@ -126,12 +126,12 @@ public class CableBlock extends NetworkNodeBlock implements IWaterLoggable {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public IFluidState getFluidState(BlockState state) {
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, IFluidState fluidStateIn) {
|
||||
public boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, FluidState fluidStateIn) {
|
||||
return IWaterLoggable.super.receiveFluid(worldIn, pos, state, fluidStateIn);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ControllerBlock extends BaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ public class UpgradeItem extends Item {
|
||||
if (type.getFortuneLevel() > 0) {
|
||||
tooltip.add(
|
||||
new TranslationTextComponent("enchantment.minecraft.fortune")
|
||||
.appendText(" ")
|
||||
.appendSibling(new TranslationTextComponent("enchantment.level." + type.getFortuneLevel()))
|
||||
.setStyle(Styles.GRAY)
|
||||
.func_240702_b_(" ")
|
||||
.func_230529_a_(new TranslationTextComponent("enchantment.level." + type.getFortuneLevel()))
|
||||
.func_230530_a_(Styles.GRAY)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ import com.refinedmods.refinedstorage.RSBlocks;
|
||||
import com.refinedmods.refinedstorage.apiimpl.network.node.DiskState;
|
||||
import com.refinedmods.refinedstorage.tile.DiskDriveTile;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -8,10 +8,10 @@ import com.refinedmods.refinedstorage.apiimpl.network.node.DiskState;
|
||||
import com.refinedmods.refinedstorage.block.DiskManipulatorBlock;
|
||||
import com.refinedmods.refinedstorage.tile.DiskManipulatorTile;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -2,11 +2,11 @@ package com.refinedmods.refinedstorage.render.model;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.vector.TransformationMatrix;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
|
||||
import net.minecraftforge.client.model.pipeline.TRSRTransformer;
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
@@ -23,6 +22,7 @@ import net.minecraft.inventory.container.PlayerContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraftforge.common.model.TransformationHelper;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.render.RenderSettings;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
@@ -8,6 +9,8 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@@ -24,7 +27,7 @@ public abstract class AmountSpecifyingScreen<T extends Container> extends BaseSc
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
protected abstract String getOkButtonText();
|
||||
protected abstract ITextComponent getOkButtonText();
|
||||
|
||||
protected abstract String getTexture();
|
||||
|
||||
@@ -53,9 +56,9 @@ public abstract class AmountSpecifyingScreen<T extends Container> extends BaseSc
|
||||
Pair<Integer, Integer> pos = getOkCancelPos();
|
||||
|
||||
okButton = addButton(x + pos.getLeft(), y + pos.getRight(), getOkCancelButtonWidth(), 20, getOkButtonText(), true, true, btn -> onOkButtonPressed(hasShiftDown()));
|
||||
cancelButton = addButton(x + pos.getLeft(), y + pos.getRight() + 24, getOkCancelButtonWidth(), 20, I18n.format("gui.cancel"), true, true, btn -> close());
|
||||
cancelButton = addButton(x + pos.getLeft(), y + pos.getRight() + 24, getOkCancelButtonWidth(), 20, new TranslationTextComponent("gui.cancel"), true, true, btn -> close());
|
||||
|
||||
amountField = new TextFieldWidget(font, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6, font.FONT_HEIGHT, "");
|
||||
amountField = new TextFieldWidget(font, x + getAmountPos().getLeft(), y + getAmountPos().getRight(), 69 - 6, font.FONT_HEIGHT, new StringTextComponent(""));
|
||||
amountField.setEnableBackgroundDrawing(false);
|
||||
amountField.setVisible(true);
|
||||
amountField.setText(String.valueOf(getDefaultAmount()));
|
||||
@@ -75,10 +78,9 @@ public abstract class AmountSpecifyingScreen<T extends Container> extends BaseSc
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
int increment = increments[i];
|
||||
|
||||
String text = "+" + increment;
|
||||
|
||||
if (text.equals("+1000")) {
|
||||
text = "+1B";
|
||||
ITextComponent text = new StringTextComponent("+" + increment);
|
||||
if (text.getString().equals("+1000")) {
|
||||
text = new StringTextComponent("+1B");
|
||||
}
|
||||
|
||||
addButton(x + xx, y + 20, width, 20, text, true, true, btn -> onIncrementButtonClicked(increment));
|
||||
@@ -91,10 +93,9 @@ public abstract class AmountSpecifyingScreen<T extends Container> extends BaseSc
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
int increment = increments[i];
|
||||
|
||||
String text = "-" + increment;
|
||||
|
||||
if (text.equals("-1000")) {
|
||||
text = "-1B";
|
||||
ITextComponent text = new StringTextComponent("-" + increment);
|
||||
if (text.getString().equals("-1000")) {
|
||||
text = new StringTextComponent("-1B");
|
||||
}
|
||||
|
||||
addButton(x + xx, y + ySize - 20 - 7, width, 20, text, true, true, btn -> onIncrementButtonClicked(-increment));
|
||||
@@ -154,17 +155,17 @@ public abstract class AmountSpecifyingScreen<T extends Container> extends BaseSc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, getTexture());
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
|
||||
amountField.renderButton(0, 0, 0);
|
||||
amountField.renderButton(matrixStack, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
}
|
||||
|
||||
protected void onOkButtonPressed(boolean shiftDown) {
|
||||
|
||||
@@ -1,5 +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.API;
|
||||
@@ -26,6 +27,7 @@ import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
@@ -37,6 +39,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class BaseScreen<T extends Container> extends ContainerScreen<T> {
|
||||
public static final int Z_LEVEL_ITEMS = 100;
|
||||
@@ -113,19 +116,19 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
renderBackground();
|
||||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
renderBackground(matrixStack);
|
||||
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
super.render(matrixStack, mouseX, mouseY, partialTicks);
|
||||
|
||||
renderHoveredToolTip(mouseX, mouseY);
|
||||
func_230459_a_(matrixStack, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float renderPartialTicks, int mouseX, int mouseY) {
|
||||
@Override // drawGuiContainerBackgroundLayer
|
||||
protected void func_230450_a_(MatrixStack matrixStack, float renderPartialTicks, int mouseX, int mouseY) {
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
renderBackground(guiLeft, guiTop, mouseX, mouseY);
|
||||
renderBackground(matrixStack, guiLeft, guiTop, mouseX, mouseY);
|
||||
|
||||
for (int i = 0; i < this.container.inventorySlots.size(); ++i) {
|
||||
Slot slot = container.inventorySlots.get(i);
|
||||
@@ -137,7 +140,7 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
FluidRenderer.INSTANCE.render(guiLeft + slot.xPos, guiTop + slot.yPos, stack);
|
||||
|
||||
if (((FluidFilterSlot) slot).isSizeAllowed()) {
|
||||
renderQuantity(guiLeft + slot.xPos, guiTop + slot.yPos, API.instance().getQuantityFormatter().formatInBucketForm(stack.getAmount()), RenderSettings.INSTANCE.getSecondaryColor());
|
||||
renderQuantity(matrixStack, guiLeft + slot.xPos, guiTop + slot.yPos, API.instance().getQuantityFormatter().formatInBucketForm(stack.getAmount()), RenderSettings.INSTANCE.getSecondaryColor());
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
}
|
||||
@@ -146,18 +149,18 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
@Override // drawGuiContainerForegroundLayer
|
||||
protected void func_230451_b_(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
mouseX -= guiLeft;
|
||||
mouseY -= guiTop;
|
||||
|
||||
renderForeground(mouseX, mouseY);
|
||||
renderForeground(matrixStack, mouseX, mouseY);
|
||||
|
||||
for (Widget button : this.buttons) {
|
||||
if (button instanceof SideButton && button.isHovered()) {
|
||||
renderTooltip(mouseX, mouseY, ((SideButton) button).getTooltip());
|
||||
renderTooltip(matrixStack, mouseX, mouseY, ((SideButton) button).getTooltip());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +171,7 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
FluidStack stack = ((FluidFilterSlot) slot).getFluidInventory().getFluid(slot.getSlotIndex());
|
||||
|
||||
if (!stack.isEmpty() && RenderUtils.inBounds(slot.xPos, slot.yPos, 17, 17, mouseX, mouseY)) {
|
||||
renderTooltip(mouseX, mouseY, stack.getDisplayName().getFormattedText());
|
||||
renderTooltip(matrixStack, mouseX, mouseY, stack.getDisplayName().getString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,7 +244,7 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
}
|
||||
}
|
||||
|
||||
public CheckboxWidget addCheckBox(int x, int y, String text, boolean checked, Consumer<CheckboxButton> onPress) {
|
||||
public CheckboxWidget addCheckBox(int x, int y, ITextComponent text, boolean checked, Consumer<CheckboxButton> onPress) {
|
||||
CheckboxWidget checkBox = new CheckboxWidget(x, y, text, checked, onPress);
|
||||
|
||||
this.addButton(checkBox);
|
||||
@@ -249,7 +252,7 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
return checkBox;
|
||||
}
|
||||
|
||||
public Button addButton(int x, int y, int w, int h, String text, boolean enabled, boolean visible, Button.IPressable onPress) {
|
||||
public Button addButton(int x, int y, int w, int h, ITextComponent text, boolean enabled, boolean visible, Button.IPressable onPress) {
|
||||
Button button = new Button(x, y, w, h, text, onPress);
|
||||
|
||||
button.active = enabled;
|
||||
@@ -273,11 +276,11 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
minecraft.getTextureManager().bindTexture(TEXTURE_CACHE.computeIfAbsent(namespace + ":" + filenameInTexturesFolder, (newId) -> new ResourceLocation(namespace, "textures/" + filenameInTexturesFolder)));
|
||||
}
|
||||
|
||||
public void renderItem(int x, int y, ItemStack stack) {
|
||||
renderItem(x, y, stack, false, null, 0);
|
||||
public void renderItem(MatrixStack matrixStack, int x, int y, ItemStack stack) {
|
||||
renderItem(matrixStack, x, y, stack, false, null, 0);
|
||||
}
|
||||
|
||||
public void renderItem(int x, int y, ItemStack stack, boolean overlay, @Nullable String text, int textColor) {
|
||||
public void renderItem(MatrixStack matrixStack, int x, int y, ItemStack stack, boolean overlay, @Nullable String text, int textColor) {
|
||||
try {
|
||||
setBlitOffset(Z_LEVEL_ITEMS);
|
||||
itemRenderer.zLevel = Z_LEVEL_ITEMS;
|
||||
@@ -292,14 +295,14 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
itemRenderer.zLevel = 0;
|
||||
|
||||
if (text != null) {
|
||||
renderQuantity(x, y, text, textColor);
|
||||
renderQuantity(matrixStack, x, y, text, textColor);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
logger.warn("Couldn't render stack: " + stack.getItem().toString(), t);
|
||||
}
|
||||
}
|
||||
|
||||
public void renderQuantity(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();
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
@@ -309,29 +312,29 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
RenderSystem.scalef(0.5f, 0.5f, 1);
|
||||
}
|
||||
|
||||
font.drawStringWithShadow(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();
|
||||
}
|
||||
|
||||
public void renderString(int x, int y, String message) {
|
||||
renderString(x, y, message, RenderSettings.INSTANCE.getPrimaryColor());
|
||||
public void renderString(MatrixStack matrixStack, int x, int y, String message) {
|
||||
renderString(matrixStack, x, y, message, RenderSettings.INSTANCE.getPrimaryColor());
|
||||
}
|
||||
|
||||
public void renderString(int x, int y, String message, int color) {
|
||||
font.drawString(message, x, y, color);
|
||||
public void renderString(MatrixStack matrixStack, int x, int y, String message, int color) {
|
||||
font.drawString(matrixStack, message, x, y, color);
|
||||
}
|
||||
|
||||
public void renderTooltip(int x, int y, String lines) {
|
||||
renderTooltip(ItemStack.EMPTY, x, y, lines);
|
||||
public void renderTooltip(MatrixStack matrixStack, int x, int y, String lines) {
|
||||
renderTooltip(matrixStack, ItemStack.EMPTY, x, y, lines);
|
||||
}
|
||||
|
||||
public void renderTooltip(@Nonnull ItemStack stack, int x, int y, String lines) {
|
||||
renderTooltip(stack, x, y, Arrays.asList(lines.split("\n")));
|
||||
public void renderTooltip(MatrixStack matrixStack, @Nonnull ItemStack stack, int x, int y, String lines) {
|
||||
renderTooltip(matrixStack, stack, x, y, Arrays.stream(lines.split("\n")).map(StringTextComponent::new).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public void renderTooltip(@Nonnull ItemStack stack, int x, int y, List<String> lines) {
|
||||
GuiUtils.drawHoveringText(stack, lines, x, y, width, height, -1, font);
|
||||
public void renderTooltip(MatrixStack matrixStack, @Nonnull ItemStack stack, int x, int y, List<ITextComponent> lines) {
|
||||
GuiUtils.drawHoveringText(stack, matrixStack, lines, x, y, width, height, -1, font);
|
||||
}
|
||||
|
||||
protected void onPreInit() {
|
||||
@@ -348,9 +351,9 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
||||
|
||||
public abstract void tick(int x, int y);
|
||||
|
||||
public abstract void renderBackground(int x, int y, int mouseX, int mouseY);
|
||||
public abstract void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY);
|
||||
|
||||
public abstract void renderForeground(int mouseX, int mouseY);
|
||||
public abstract void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY);
|
||||
|
||||
public static <T> void executeLater(Class<T> clazz, Consumer<T> callback) {
|
||||
Queue<Consumer> queue = ACTIONS.get(clazz);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.ConstructorContainer;
|
||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.ConstructorDropSideButton;
|
||||
@@ -31,15 +32,15 @@ public class ConstructorScreen extends BaseScreen<ConstructorContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/constructor.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +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;
|
||||
@@ -9,6 +10,7 @@ import com.refinedmods.refinedstorage.screen.widget.sidebutton.RedstoneModeSideB
|
||||
import com.refinedmods.refinedstorage.tile.ClientNode;
|
||||
import com.refinedmods.refinedstorage.tile.ControllerTile;
|
||||
import com.refinedmods.refinedstorage.util.RenderUtils;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
@@ -43,16 +45,16 @@ public class ControllerScreen extends BaseScreen<ControllerContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/controller.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
|
||||
int energyBarHeightNew = Network.getEnergyScaled(ControllerTile.ENERGY_STORED.getValue(), ControllerTile.ENERGY_CAPACITY.getValue(), ENERGY_BAR_HEIGHT);
|
||||
|
||||
blit(x + ENERGY_BAR_X, y + ENERGY_BAR_Y + ENERGY_BAR_HEIGHT - energyBarHeightNew, 178, ENERGY_BAR_HEIGHT - energyBarHeightNew, ENERGY_BAR_WIDTH, energyBarHeightNew);
|
||||
blit(matrixStack, x + ENERGY_BAR_X, y + ENERGY_BAR_Y + ENERGY_BAR_HEIGHT - energyBarHeightNew, 178, ENERGY_BAR_HEIGHT - energyBarHeightNew, ENERGY_BAR_WIDTH, energyBarHeightNew);
|
||||
|
||||
scrollbar.render();
|
||||
scrollbar.render(matrixStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,16 +80,16 @@ public class ControllerScreen extends BaseScreen<ControllerContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 87, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 87, I18n.format("container.inventory"));
|
||||
|
||||
int x = 33;
|
||||
int y = 26;
|
||||
|
||||
int slot = scrollbar.getOffset() * 2;
|
||||
|
||||
RenderSystem.setupGui3DDiffuseLighting();
|
||||
RenderHelper.setupGui3DDiffuseLighting();
|
||||
|
||||
List<ClientNode> nodes = ControllerTile.NODES.getValue();
|
||||
|
||||
@@ -97,7 +99,7 @@ public class ControllerScreen extends BaseScreen<ControllerContainer> {
|
||||
if (slot < nodes.size()) {
|
||||
ClientNode node = nodes.get(slot);
|
||||
|
||||
renderItem(x, y + 5, node.getStack());
|
||||
renderItem(matrixStack, x, y + 5, node.getStack());
|
||||
|
||||
float scale = minecraft.getForceUnicodeFont() ? 1F : 0.5F;
|
||||
|
||||
@@ -105,11 +107,12 @@ public class ControllerScreen extends BaseScreen<ControllerContainer> {
|
||||
RenderSystem.scalef(scale, scale, 1);
|
||||
|
||||
renderString(
|
||||
matrixStack,
|
||||
RenderUtils.getOffsetOnScale(x + 1, scale),
|
||||
RenderUtils.getOffsetOnScale(y - 2, scale),
|
||||
trimNameIfNeeded(!minecraft.getForceUnicodeFont(), node.getStack().getDisplayName().getString())
|
||||
);
|
||||
renderString(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();
|
||||
|
||||
@@ -129,11 +132,11 @@ public class ControllerScreen extends BaseScreen<ControllerContainer> {
|
||||
}
|
||||
|
||||
if (hoveringNode != null) {
|
||||
renderTooltip(mouseX, mouseY, I18n.format("misc.refinedstorage.energy_usage_minimal", hoveringNode.getEnergyUsage()));
|
||||
renderTooltip(matrixStack, mouseX, mouseY, I18n.format("misc.refinedstorage.energy_usage_minimal", hoveringNode.getEnergyUsage()));
|
||||
}
|
||||
|
||||
if (RenderUtils.inBounds(ENERGY_BAR_X, ENERGY_BAR_Y, ENERGY_BAR_WIDTH, ENERGY_BAR_HEIGHT, mouseX, mouseY)) {
|
||||
renderTooltip(mouseX, mouseY, I18n.format("misc.refinedstorage.energy_usage", ControllerTile.ENERGY_USAGE.getValue()) + "\n" + I18n.format("misc.refinedstorage.energy_stored", ControllerTile.ENERGY_STORED.getValue(), ControllerTile.ENERGY_CAPACITY.getValue()));
|
||||
renderTooltip(matrixStack, mouseX, mouseY, I18n.format("misc.refinedstorage.energy_usage", ControllerTile.ENERGY_USAGE.getValue()) + "\n" + I18n.format("misc.refinedstorage.energy_stored", ControllerTile.ENERGY_STORED.getValue(), ControllerTile.ENERGY_CAPACITY.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +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.api.network.grid.IGrid;
|
||||
@@ -76,10 +77,10 @@ public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/crafter_manager.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, getTopHeight());
|
||||
blit(matrixStack, x, y, 0, 0, xSize, getTopHeight());
|
||||
|
||||
int rows = getVisibleRows();
|
||||
|
||||
@@ -88,30 +89,30 @@ public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> im
|
||||
for (int i = 0; i < rows; ++i) {
|
||||
yy += 18;
|
||||
|
||||
blit(x, yy, 0, getTopHeight() + (i > 0 ? (i == rows - 1 ? 18 * 2 : 18) : 0), xSize, 18);
|
||||
blit(matrixStack, x, yy, 0, getTopHeight() + (i > 0 ? (i == rows - 1 ? 18 * 2 : 18) : 0), xSize, 18);
|
||||
}
|
||||
|
||||
yy += 18;
|
||||
|
||||
blit(x, yy, 0, getTopHeight() + (18 * 3), xSize, getBottomHeight());
|
||||
blit(matrixStack, x, yy, 0, getTopHeight() + (18 * 3), xSize, getBottomHeight());
|
||||
|
||||
if (crafterManager.isActiveOnClient()) {
|
||||
for (Slot slot : container.inventorySlots) {
|
||||
if (slot instanceof CrafterManagerSlot && slot.isEnabled()) {
|
||||
blit(x + slot.xPos - 1, y + slot.yPos - 1, 0, 193, 18, 18);
|
||||
blit(matrixStack, x + slot.xPos - 1, y + slot.yPos - 1, 0, 193, 18, 18);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
searchField.render(0, 0, 0);
|
||||
searchField.render(matrixStack, 0, 0, 0);
|
||||
|
||||
scrollbar.render();
|
||||
scrollbar.render(matrixStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, getYPlayerInventory() - 12, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, getYPlayerInventory() - 12, I18n.format("container.inventory"));
|
||||
|
||||
if (container != null && crafterManager.isActiveOnClient()) {
|
||||
for (Map.Entry<String, Integer> heading : container.getHeadings().entrySet()) {
|
||||
@@ -123,9 +124,9 @@ public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> im
|
||||
|
||||
bindTexture(RS.ID, "gui/crafter_manager.png");
|
||||
|
||||
blit(7, y, 0, 174, 18 * 9, 18);
|
||||
blit(matrixStack, 7, y, 0, 174, 18 * 9, 18);
|
||||
|
||||
renderString(7 + 4, y + 6, RenderUtils.shorten(I18n.format(heading.getKey()), 25));
|
||||
renderString(matrixStack, 7 + 4, y + 6, RenderUtils.shorten(I18n.format(heading.getKey()), 25));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.CrafterContainer;
|
||||
import com.refinedmods.refinedstorage.util.RenderUtils;
|
||||
@@ -21,15 +22,15 @@ public class CrafterScreen extends BaseScreen<CrafterContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/crafter.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, RenderUtils.shorten(title.getFormattedText(), 26));
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, RenderUtils.shorten(title.getString(), 26));
|
||||
renderString(matrixStack, 7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
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;
|
||||
@@ -21,10 +22,12 @@ import com.refinedmods.refinedstorage.tile.craftingmonitor.ICraftingMonitor;
|
||||
import com.refinedmods.refinedstorage.util.RenderUtils;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -52,8 +55,8 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTooltip(int x, int y, int screenWidth, int screenHeight, FontRenderer fontRenderer) {
|
||||
List<String> textLines = Lists.newArrayList(requested.getItem() != null ? requested.getItem().getDisplayName().getFormattedText() : requested.getFluid().getDisplayName().getFormattedText());
|
||||
public void drawTooltip(MatrixStack matrixStack, int x, int y, int screenWidth, int screenHeight, FontRenderer fontRenderer) {
|
||||
List<ITextComponent> textLines = Lists.newArrayList(requested.getItem() != null ? requested.getItem().getDisplayName() : requested.getFluid().getDisplayName());
|
||||
List<String> smallTextLines = Lists.newArrayList();
|
||||
|
||||
int totalSecs = (int) (System.currentTimeMillis() - executionStarted) / 1000;
|
||||
@@ -64,7 +67,7 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
|
||||
smallTextLines.add(String.format("%02d:%02d", minutes, seconds));
|
||||
smallTextLines.add(String.format("%d%%", completionPercentage));
|
||||
|
||||
RenderUtils.drawTooltipWithSmallText(textLines, smallTextLines, true, ItemStack.EMPTY, x, y, screenWidth, screenHeight, fontRenderer);
|
||||
RenderUtils.drawTooltipWithSmallText(matrixStack, textLines, smallTextLines, true, ItemStack.EMPTY, x, y, screenWidth, screenHeight, fontRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,9 +76,9 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawIcon(int x, int y, IElementDrawer<ItemStack> itemDrawer, IElementDrawer<FluidStack> fluidDrawer) {
|
||||
public void drawIcon(MatrixStack matrixStack, int x, int y, IElementDrawer<ItemStack> itemDrawer, IElementDrawer<FluidStack> fluidDrawer) {
|
||||
if (requested.getItem() != null) {
|
||||
RenderSystem.setupGui3DDiffuseLighting();
|
||||
RenderHelper.setupGui3DDiffuseLighting();
|
||||
|
||||
itemDrawer.draw(x, y, requested.getItem());
|
||||
} else {
|
||||
@@ -160,11 +163,11 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
|
||||
addSideButton(new RedstoneModeSideButton(this, craftingMonitor.getRedstoneModeParameter()));
|
||||
}
|
||||
|
||||
String cancel = I18n.format("gui.cancel");
|
||||
String cancelAll = I18n.format("misc.refinedstorage.cancel_all");
|
||||
ITextComponent cancel = new TranslationTextComponent("gui.cancel");
|
||||
ITextComponent cancelAll = new TranslationTextComponent("misc.refinedstorage.cancel_all");
|
||||
|
||||
int cancelButtonWidth = 14 + font.getStringWidth(cancel);
|
||||
int cancelAllButtonWidth = 14 + font.getStringWidth(cancelAll);
|
||||
int cancelButtonWidth = 14 + font.getStringWidth(cancel.getString());
|
||||
int cancelAllButtonWidth = 14 + font.getStringWidth(cancelAll.getString());
|
||||
|
||||
this.cancelButton = addButton(x + 7, y + 201 - 20 - 7, cancelButtonWidth, 20, cancel, false, true, btn -> {
|
||||
if (hasValidTabSelected()) {
|
||||
@@ -233,27 +236,27 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
if (craftingMonitor.isActiveOnClient()) {
|
||||
tabs.drawBackground(x, y - tabs.getHeight());
|
||||
tabs.drawBackground(matrixStack, x, y - tabs.getHeight());
|
||||
}
|
||||
|
||||
bindTexture(RS.ID, "gui/crafting_preview.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
|
||||
scrollbar.render();
|
||||
scrollbar.render(matrixStack);
|
||||
|
||||
tabs.drawForeground(x, y - tabs.getHeight(), mouseX, mouseY, craftingMonitor.isActiveOnClient());
|
||||
tabs.drawForeground(matrixStack, x, y - tabs.getHeight(), mouseX, mouseY, craftingMonitor.isActiveOnClient());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
|
||||
int item = scrollbar != null ? scrollbar.getOffset() * 3 : 0;
|
||||
|
||||
RenderSystem.setupGui3DDiffuseLighting();
|
||||
RenderHelper.setupGui3DDiffuseLighting();
|
||||
|
||||
int x = 7;
|
||||
int y = 20;
|
||||
@@ -282,10 +285,10 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
|
||||
}
|
||||
|
||||
if (itemSelectedTooltip != null && !itemSelectedTooltip.isEmpty()) {
|
||||
renderTooltip(mouseX, mouseY, I18n.format(itemSelectedTooltip));
|
||||
renderTooltip(matrixStack, mouseX, mouseY, I18n.format(itemSelectedTooltip));
|
||||
}
|
||||
|
||||
tabs.drawTooltip(font, mouseX, mouseY);
|
||||
tabs.drawTooltip(matrixStack, font, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.DestructorContainer;
|
||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.*;
|
||||
@@ -31,15 +32,15 @@ public class DestructorScreen extends BaseScreen<DestructorContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/destructor.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.DetectorContainer;
|
||||
import com.refinedmods.refinedstorage.render.RenderSettings;
|
||||
@@ -12,6 +13,7 @@ import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class DetectorScreen extends BaseScreen<DetectorContainer> {
|
||||
@@ -29,7 +31,7 @@ public class DetectorScreen extends BaseScreen<DetectorContainer> {
|
||||
|
||||
addSideButton(new ExactModeSideButton(this, DetectorTile.COMPARE));
|
||||
|
||||
amountField = new TextFieldWidget(font, x + 41 + 1, y + 23 + 1, 50, font.FONT_HEIGHT, "");
|
||||
amountField = new TextFieldWidget(font, x + 41 + 1, y + 23 + 1, 50, font.FONT_HEIGHT, new StringTextComponent(""));
|
||||
amountField.setText(String.valueOf(DetectorTile.AMOUNT.getValue()));
|
||||
amountField.setEnableBackgroundDrawing(false);
|
||||
amountField.setVisible(true);
|
||||
@@ -58,16 +60,16 @@ public class DetectorScreen extends BaseScreen<DetectorContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/detector.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.container.DiskDriveContainer;
|
||||
import com.refinedmods.refinedstorage.tile.DiskDriveTile;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -25,9 +26,9 @@ public class DiskDriveScreen extends StorageScreen<DiskDriveContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(79, 42, I18n.format("gui.refinedstorage.disk_drive.disks"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 79, 42, I18n.format("gui.refinedstorage.disk_drive.disks"));
|
||||
|
||||
super.renderForeground(mouseX, mouseY);
|
||||
super.renderForeground(matrixStack, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.DiskManipulatorContainer;
|
||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.*;
|
||||
@@ -28,17 +29,17 @@ public class DiskManipulatorScreen extends BaseScreen<DiskManipulatorContainer>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/disk_manipulator.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 117, I18n.format("container.inventory"));
|
||||
renderString(43, 45, I18n.format("gui.refinedstorage.disk_manipulator.in"));
|
||||
renderString(115, 45, I18n.format("gui.refinedstorage.disk_manipulator.out"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 117, I18n.format("container.inventory"));
|
||||
renderString(matrixStack, 43, 45, I18n.format("gui.refinedstorage.disk_manipulator.in"));
|
||||
renderString(matrixStack, 115, 45, I18n.format("gui.refinedstorage.disk_manipulator.out"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.ExporterContainer;
|
||||
import com.refinedmods.refinedstorage.item.UpgradeItem;
|
||||
@@ -44,15 +45,15 @@ public class ExporterScreen extends BaseScreen<ExporterContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/exporter.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.api.util.IComparer;
|
||||
import com.refinedmods.refinedstorage.api.util.IFilter;
|
||||
@@ -15,6 +16,8 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class FilterScreen extends BaseScreen<FilterContainer> {
|
||||
@@ -44,19 +47,19 @@ public class FilterScreen extends BaseScreen<FilterContainer> {
|
||||
|
||||
@Override
|
||||
public void onPostInit(int x, int y) {
|
||||
addCheckBox(x + 7, y + 77, I18n.format("gui.refinedstorage.filter.compare_nbt"), (compare & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT, btn -> {
|
||||
addCheckBox(x + 7, y + 77, new TranslationTextComponent("gui.refinedstorage.filter.compare_nbt"), (compare & IComparer.COMPARE_NBT) == IComparer.COMPARE_NBT, btn -> {
|
||||
compare ^= IComparer.COMPARE_NBT;
|
||||
|
||||
sendUpdate();
|
||||
});
|
||||
|
||||
modFilterCheckBox = addCheckBox(0, y + 71 + 25, I18n.format("gui.refinedstorage.filter.mod_filter"), modFilter, btn -> {
|
||||
modFilterCheckBox = addCheckBox(0, y + 71 + 25, new TranslationTextComponent("gui.refinedstorage.filter.mod_filter"), modFilter, btn -> {
|
||||
modFilter = !modFilter;
|
||||
|
||||
sendUpdate();
|
||||
});
|
||||
|
||||
modeButton = addButton(x + 7, y + 71 + 21, 0, 20, "", true, true, btn -> {
|
||||
modeButton = addButton(x + 7, y + 71 + 21, 0, 20, new StringTextComponent(""), true, true, btn -> {
|
||||
mode = mode == IFilter.MODE_WHITELIST ? IFilter.MODE_BLACKLIST : IFilter.MODE_WHITELIST;
|
||||
|
||||
updateModeButton(mode);
|
||||
@@ -66,7 +69,7 @@ public class FilterScreen extends BaseScreen<FilterContainer> {
|
||||
|
||||
updateModeButton(mode);
|
||||
|
||||
nameField = new TextFieldWidget(font, x + 34, y + 121, 137 - 6, font.FONT_HEIGHT, "");
|
||||
nameField = new TextFieldWidget(font, x + 34, y + 121, 137 - 6, font.FONT_HEIGHT, new StringTextComponent(""));
|
||||
nameField.setText(name);
|
||||
nameField.setEnableBackgroundDrawing(false);
|
||||
nameField.setVisible(true);
|
||||
@@ -81,9 +84,11 @@ public class FilterScreen extends BaseScreen<FilterContainer> {
|
||||
}
|
||||
|
||||
private void updateModeButton(int mode) {
|
||||
String text = mode == IFilter.MODE_WHITELIST ? I18n.format("sidebutton.refinedstorage.mode.whitelist") : I18n.format("sidebutton.refinedstorage.mode.blacklist");
|
||||
ITextComponent text = mode == IFilter.MODE_WHITELIST
|
||||
? new TranslationTextComponent("sidebutton.refinedstorage.mode.whitelist")
|
||||
: new TranslationTextComponent("sidebutton.refinedstorage.mode.blacklist");
|
||||
|
||||
modeButton.setWidth(font.getStringWidth(text) + 12);
|
||||
modeButton.setWidth(font.getStringWidth(text.getString()) + 12);
|
||||
modeButton.setMessage(text);
|
||||
modFilterCheckBox.x = modeButton.x + modeButton.getWidth() + 4;
|
||||
}
|
||||
@@ -108,16 +113,16 @@ public class FilterScreen extends BaseScreen<FilterContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/filter.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 137, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 137, I18n.format("container.inventory"));
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -40,7 +41,7 @@ public class FluidAmountScreen extends AmountSpecifyingScreen<FluidAmountContain
|
||||
super.onPostInit(x, y);
|
||||
|
||||
if (alternativesScreenFactory != null) {
|
||||
addButton(x + 114, cancelButton.y + 24, getOkCancelButtonWidth(), 20, I18n.format("gui.refinedstorage.alternatives"), true, true, btn -> minecraft.displayGuiScreen(alternativesScreenFactory.apply(this)));
|
||||
addButton(x + 114, cancelButton.y + 24, getOkCancelButtonWidth(), 20, new TranslationTextComponent("gui.refinedstorage.alternatives"), true, true, btn -> minecraft.displayGuiScreen(alternativesScreenFactory.apply(this)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +70,8 @@ public class FluidAmountScreen extends AmountSpecifyingScreen<FluidAmountContain
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOkButtonText() {
|
||||
return I18n.format("misc.refinedstorage.set");
|
||||
protected ITextComponent getOkButtonText() {
|
||||
return new TranslationTextComponent("misc.refinedstorage.set");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||
import com.refinedmods.refinedstorage.apiimpl.network.node.FluidInterfaceNetworkNode;
|
||||
@@ -30,10 +31,10 @@ public class FluidInterfaceScreen extends BaseScreen<FluidInterfaceContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/fluid_interface.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
|
||||
if (!FluidInterfaceTile.TANK_IN.getValue().isEmpty()) {
|
||||
TANK_RENDERER.render(x + 46, y + 56, FluidInterfaceTile.TANK_IN.getValue());
|
||||
@@ -45,18 +46,18 @@ public class FluidInterfaceScreen extends BaseScreen<FluidInterfaceContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(43 + 4, 20, I18n.format("gui.refinedstorage.fluid_interface.in"));
|
||||
renderString(115 + 1, 20, I18n.format("gui.refinedstorage.fluid_interface.out"));
|
||||
renderString(7, 111, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 43 + 4, 20, I18n.format("gui.refinedstorage.fluid_interface.in"));
|
||||
renderString(matrixStack, 115 + 1, 20, I18n.format("gui.refinedstorage.fluid_interface.out"));
|
||||
renderString(matrixStack, 7, 111, I18n.format("container.inventory"));
|
||||
|
||||
if (RenderUtils.inBounds(46, 56, 12, 47, mouseX, mouseY) && !FluidInterfaceTile.TANK_IN.getValue().isEmpty()) {
|
||||
renderTooltip(mouseX, mouseY, FluidInterfaceTile.TANK_IN.getValue().getDisplayName().getFormattedText() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(FluidInterfaceTile.TANK_IN.getValue().getAmount()) + TextFormatting.RESET);
|
||||
renderTooltip(matrixStack, mouseX, mouseY, FluidInterfaceTile.TANK_IN.getValue().getDisplayName().getString() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(FluidInterfaceTile.TANK_IN.getValue().getAmount()) + TextFormatting.RESET);
|
||||
}
|
||||
|
||||
if (RenderUtils.inBounds(118, 56, 12, 47, mouseX, mouseY) && !FluidInterfaceTile.TANK_OUT.getValue().isEmpty()) {
|
||||
renderTooltip(mouseX, mouseY, FluidInterfaceTile.TANK_OUT.getValue().getDisplayName().getFormattedText() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(FluidInterfaceTile.TANK_OUT.getValue().getAmount()) + TextFormatting.RESET);
|
||||
renderTooltip(matrixStack, mouseX, mouseY, FluidInterfaceTile.TANK_OUT.getValue().getDisplayName().getString() + "\n" + TextFormatting.GRAY + API.instance().getQuantityFormatter().formatInBucketForm(FluidInterfaceTile.TANK_OUT.getValue().getAmount()) + TextFormatting.RESET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.ImporterContainer;
|
||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.ExactModeSideButton;
|
||||
@@ -32,15 +33,15 @@ public class ImporterScreen extends BaseScreen<ImporterContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/importer.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.InterfaceContainer;
|
||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.ExactModeSideButton;
|
||||
@@ -26,16 +27,16 @@ public class InterfaceScreen extends BaseScreen<InterfaceContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/interface.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, I18n.format("gui.refinedstorage.interface.import"));
|
||||
renderString(7, 42, I18n.format("gui.refinedstorage.interface.export"));
|
||||
renderString(7, 122, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, I18n.format("gui.refinedstorage.interface.import"));
|
||||
renderString(matrixStack, 7, 42, I18n.format("gui.refinedstorage.interface.export"));
|
||||
renderString(matrixStack, 7, 122, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -40,7 +41,7 @@ public class ItemAmountScreen extends AmountSpecifyingScreen<AmountContainer> {
|
||||
super.onPostInit(x, y);
|
||||
|
||||
if (alternativesScreenFactory != null) {
|
||||
addButton(x + 114, cancelButton.y + 24, getOkCancelButtonWidth(), 20, I18n.format("gui.refinedstorage.alternatives"), true, true, btn -> minecraft.displayGuiScreen(alternativesScreenFactory.apply(this)));
|
||||
addButton(x + 114, cancelButton.y + 24, getOkCancelButtonWidth(), 20, new TranslationTextComponent("gui.refinedstorage.alternatives"), true, true, btn -> minecraft.displayGuiScreen(alternativesScreenFactory.apply(this)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +70,8 @@ public class ItemAmountScreen extends AmountSpecifyingScreen<AmountContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOkButtonText() {
|
||||
return I18n.format("misc.refinedstorage.set");
|
||||
protected ITextComponent getOkButtonText() {
|
||||
return new TranslationTextComponent("misc.refinedstorage.set");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.client.event.InputEvent;
|
||||
@@ -26,13 +27,13 @@ public class KeyInputListener {
|
||||
PlayerInventory inv = Minecraft.getInstance().player.inventory;
|
||||
|
||||
if (RSKeyBindings.OPEN_WIRELESS_GRID.isKeyDown()) {
|
||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.WIRELESS_GRID, RSItems.CREATIVE_WIRELESS_GRID);
|
||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.WIRELESS_GRID, RSItems.CREATIVE_WIRELESS_GRID);
|
||||
} else if (RSKeyBindings.OPEN_WIRELESS_FLUID_GRID.isKeyDown()) {
|
||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.WIRELESS_FLUID_GRID, RSItems.CREATIVE_WIRELESS_FLUID_GRID);
|
||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.WIRELESS_FLUID_GRID, RSItems.CREATIVE_WIRELESS_FLUID_GRID);
|
||||
} else if (RSKeyBindings.OPEN_PORTABLE_GRID.isKeyDown()) {
|
||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.PORTABLE_GRID, RSItems.CREATIVE_PORTABLE_GRID);
|
||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.PORTABLE_GRID, RSItems.CREATIVE_PORTABLE_GRID);
|
||||
} else if (RSKeyBindings.OPEN_WIRELESS_CRAFTING_MONITOR.isKeyDown()) {
|
||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.WIRELESS_CRAFTING_MONITOR, RSItems.CREATIVE_WIRELESS_CRAFTING_MONITOR);
|
||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.WIRELESS_CRAFTING_MONITOR, RSItems.CREATIVE_WIRELESS_CRAFTING_MONITOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.NetworkTransmitterContainer;
|
||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.RedstoneModeSideButton;
|
||||
@@ -26,15 +27,15 @@ public class NetworkTransmitterScreen extends BaseScreen<NetworkTransmitterConta
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/network_transmitter.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
|
||||
String text;
|
||||
|
||||
@@ -49,7 +50,7 @@ public class NetworkTransmitterScreen extends BaseScreen<NetworkTransmitterConta
|
||||
text = receiverDim.get().toString();
|
||||
}
|
||||
|
||||
renderString(51, 24, text);
|
||||
renderString(7, 42, I18n.format("container.inventory"));
|
||||
renderString(matrixStack, 51, 24, text);
|
||||
renderString(matrixStack, 7, 42, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -29,8 +30,8 @@ public class PriorityScreen extends AmountSpecifyingScreen<Container> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOkButtonText() {
|
||||
return I18n.format("misc.refinedstorage.set");
|
||||
protected ITextComponent getOkButtonText() {
|
||||
return new TranslationTextComponent("misc.refinedstorage.set");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.RelayContainer;
|
||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.RedstoneModeSideButton;
|
||||
@@ -23,15 +24,15 @@ public class RelayScreen extends BaseScreen<RelayContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/relay.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 39, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 39, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.api.network.security.Permission;
|
||||
import com.refinedmods.refinedstorage.container.SecurityManagerContainer;
|
||||
@@ -13,6 +14,7 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
public class SecurityManagerScreen extends BaseScreen<SecurityManagerContainer> {
|
||||
private final SecurityManagerTile securityManager;
|
||||
@@ -30,12 +32,12 @@ public class SecurityManagerScreen extends BaseScreen<SecurityManagerContainer>
|
||||
|
||||
int padding = 15;
|
||||
|
||||
permissions[0] = addCheckBox(x + 7, y + 93, I18n.format("gui.refinedstorage.security_manager.permission.0"), false, btn -> handle(0));
|
||||
permissions[1] = addCheckBox(permissions[0].x, permissions[0].y + padding, I18n.format("gui.refinedstorage.security_manager.permission.1"), false, btn -> handle(1));
|
||||
permissions[2] = addCheckBox(permissions[1].x, permissions[1].y + padding, I18n.format("gui.refinedstorage.security_manager.permission.2"), false, btn -> handle(2));
|
||||
permissions[3] = addCheckBox(permissions[0].x + 90, permissions[0].y, I18n.format("gui.refinedstorage.security_manager.permission.3"), false, btn -> handle(3));
|
||||
permissions[4] = addCheckBox(permissions[3].x, permissions[3].y + padding, I18n.format("gui.refinedstorage.security_manager.permission.4"), false, btn -> handle(4));
|
||||
permissions[5] = addCheckBox(permissions[4].x, permissions[4].y + padding, I18n.format("gui.refinedstorage.security_manager.permission.5"), false, btn -> handle(5));
|
||||
permissions[0] = addCheckBox(x + 7, y + 93, new TranslationTextComponent("gui.refinedstorage.security_manager.permission.0"), false, btn -> handle(0));
|
||||
permissions[1] = addCheckBox(permissions[0].x, permissions[0].y + padding, new TranslationTextComponent("gui.refinedstorage.security_manager.permission.1"), false, btn -> handle(1));
|
||||
permissions[2] = addCheckBox(permissions[1].x, permissions[1].y + padding, new TranslationTextComponent("gui.refinedstorage.security_manager.permission.2"), false, btn -> handle(2));
|
||||
permissions[3] = addCheckBox(permissions[0].x + 90, permissions[0].y, new TranslationTextComponent("gui.refinedstorage.security_manager.permission.3"), false, btn -> handle(3));
|
||||
permissions[4] = addCheckBox(permissions[3].x, permissions[3].y + padding, new TranslationTextComponent("gui.refinedstorage.security_manager.permission.4"), false, btn -> handle(4));
|
||||
permissions[5] = addCheckBox(permissions[4].x, permissions[4].y + padding, new TranslationTextComponent("gui.refinedstorage.security_manager.permission.5"), false, btn -> handle(5));
|
||||
}
|
||||
|
||||
private void handle(int i) {
|
||||
@@ -52,23 +54,23 @@ public class SecurityManagerScreen extends BaseScreen<SecurityManagerContainer>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/security_manager.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 59, I18n.format("gui.refinedstorage.security_manager.configure"));
|
||||
renderString(7, 140, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 59, I18n.format("gui.refinedstorage.security_manager.configure"));
|
||||
renderString(matrixStack, 7, 140, I18n.format("container.inventory"));
|
||||
|
||||
for (int i = 0; i < permissions.length; ++i) {
|
||||
CheckboxWidget permission = permissions[i];
|
||||
|
||||
if (RenderUtils.inBounds(permission.x - guiLeft, permission.y - guiTop, permission.getWidth(), permission.getHeight(), mouseX, mouseY)) {
|
||||
renderTooltip(mouseX, mouseY, I18n.format("gui.refinedstorage.security_manager.permission." + i + ".tooltip"));
|
||||
renderTooltip(matrixStack, mouseX, mouseY, I18n.format("gui.refinedstorage.security_manager.permission." + i + ".tooltip"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.StorageMonitorContainer;
|
||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.ExactModeSideButton;
|
||||
@@ -25,15 +26,15 @@ public class StorageMonitorScreen extends BaseScreen<StorageMonitorContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/storage_monitor.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.api.storage.AccessType;
|
||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||
@@ -11,6 +12,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Supplier;
|
||||
@@ -79,7 +81,7 @@ public class StorageScreen<T extends Container> extends BaseScreen<T> {
|
||||
|
||||
int buttonWidth = 10 + font.getStringWidth(I18n.format("misc.refinedstorage.priority"));
|
||||
|
||||
addButton(x + 169 - buttonWidth, y + 41, buttonWidth, 20, I18n.format("misc.refinedstorage.priority"), true, true, btn -> minecraft.displayGuiScreen(new PriorityScreen(this, priorityParameter, playerInventory)));
|
||||
addButton(x + 169 - buttonWidth, y + 41, buttonWidth, 20, new TranslationTextComponent("misc.refinedstorage.priority"), true, true, btn -> minecraft.displayGuiScreen(new PriorityScreen(this, priorityParameter, playerInventory)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,25 +89,25 @@ public class StorageScreen<T extends Container> extends BaseScreen<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, texture);
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
|
||||
int barHeightNew = (int) ((float) storedSupplier.get() / (float) capacitySupplier.get() * (float) BAR_HEIGHT);
|
||||
|
||||
blit(x + BAR_X, y + BAR_Y + BAR_HEIGHT - barHeightNew, 179, BAR_HEIGHT - barHeightNew, BAR_WIDTH, barHeightNew);
|
||||
blit(matrixStack, x + BAR_X, y + BAR_Y + BAR_HEIGHT - barHeightNew, 179, BAR_HEIGHT - barHeightNew, BAR_WIDTH, barHeightNew);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, 42, capacitySupplier.get() == -1 ?
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, 42, capacitySupplier.get() == -1 ?
|
||||
I18n.format("misc.refinedstorage.storage.stored_minimal", API.instance().getQuantityFormatter().formatWithUnits(storedSupplier.get())) :
|
||||
I18n.format("misc.refinedstorage.storage.stored_capacity_minimal", API.instance().getQuantityFormatter().formatWithUnits(storedSupplier.get()), API.instance().getQuantityFormatter().formatWithUnits(capacitySupplier.get()))
|
||||
);
|
||||
|
||||
renderString(7, 129, I18n.format("container.inventory"));
|
||||
renderString(matrixStack, 7, 129, I18n.format("container.inventory"));
|
||||
|
||||
if (RenderUtils.inBounds(BAR_X, BAR_Y, BAR_WIDTH, BAR_HEIGHT, mouseX, mouseY)) {
|
||||
int full = 0;
|
||||
@@ -114,7 +116,7 @@ public class StorageScreen<T extends Container> extends BaseScreen<T> {
|
||||
full = (int) ((float) storedSupplier.get() / (float) capacitySupplier.get() * 100f);
|
||||
}
|
||||
|
||||
renderTooltip(mouseX, mouseY, (capacitySupplier.get() == -1 ?
|
||||
renderTooltip(matrixStack, mouseX, mouseY, (capacitySupplier.get() == -1 ?
|
||||
I18n.format("misc.refinedstorage.storage.stored_minimal", API.instance().getQuantityFormatter().format(storedSupplier.get())) :
|
||||
I18n.format("misc.refinedstorage.storage.stored_capacity_minimal", API.instance().getQuantityFormatter().format(storedSupplier.get()), API.instance().getQuantityFormatter().format(capacitySupplier.get()))
|
||||
) + "\n" + TextFormatting.GRAY + I18n.format("misc.refinedstorage.storage.full", full));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.WirelessTransmitterContainer;
|
||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.RedstoneModeSideButton;
|
||||
@@ -23,16 +24,16 @@ public class WirelessTransmitterScreen extends BaseScreen<WirelessTransmitterCon
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/wireless_transmitter.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(28, 25, I18n.format("gui.refinedstorage.wireless_transmitter.distance", WirelessTransmitterTile.RANGE.getValue()));
|
||||
renderString(7, 43, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 28, 25, I18n.format("gui.refinedstorage.wireless_transmitter.distance", WirelessTransmitterTile.RANGE.getValue()));
|
||||
renderString(matrixStack, 7, 43, I18n.format("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.grid;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.container.AlternativesContainer;
|
||||
@@ -22,6 +23,8 @@ import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@@ -133,8 +136,8 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
}
|
||||
}
|
||||
|
||||
Button apply = addButton(x + 7, y + 114, 50, 20, I18n.format("gui.refinedstorage.alternatives.apply"), lines.size() > 1, true, btn -> apply());
|
||||
addButton(x + apply.getWidth() + 7 + 4, y + 114, 50, 20, I18n.format("gui.cancel"), true, true, btn -> close());
|
||||
Button apply = addButton(x + 7, y + 114, 50, 20, new TranslationTextComponent("gui.refinedstorage.alternatives.apply"), lines.size() > 1, true, btn -> apply());
|
||||
addButton(x + apply.getWidth() + 7 + 4, y + 114, 50, 20, new TranslationTextComponent("gui.cancel"), true, true, btn -> close());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,17 +155,17 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/alternatives.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
|
||||
scrollbar.render();
|
||||
scrollbar.render(matrixStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
|
||||
int x = 8;
|
||||
int y = 20;
|
||||
@@ -172,7 +175,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
if (visible) {
|
||||
lines.get(i).layoutDependantControls(true, guiLeft + x + 3, guiTop + y + 3);
|
||||
lines.get(i).render(x, y);
|
||||
lines.get(i).render(matrixStack, x, y);
|
||||
|
||||
y += 18;
|
||||
} else {
|
||||
@@ -187,7 +190,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
boolean visible = i >= scrollbar.getOffset() && i < scrollbar.getOffset() + getVisibleRows();
|
||||
|
||||
if (visible) {
|
||||
lines.get(i).renderTooltip(x, y, mouseX, mouseY);
|
||||
lines.get(i).renderTooltip(matrixStack, x, y, mouseX, mouseY);
|
||||
|
||||
y += 18;
|
||||
}
|
||||
@@ -262,10 +265,10 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
}
|
||||
|
||||
private interface Line {
|
||||
default void render(int x, int y) {
|
||||
default void render(MatrixStack matrixStack, int x, int y) {
|
||||
}
|
||||
|
||||
default void renderTooltip(int x, int y, int mx, int my) {
|
||||
default void renderTooltip(MatrixStack matrixStack, int x, int y, int mx, int my) {
|
||||
}
|
||||
|
||||
default void layoutDependantControls(boolean visible, int x, int y) {
|
||||
@@ -280,10 +283,10 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int x, int y) {
|
||||
public void render(MatrixStack matrixStack, int x, int y) {
|
||||
RenderSystem.color4f(1,1,1,1);
|
||||
renderItem(x + 3, y + 2, item);
|
||||
renderString(x + 4 + 19, y + 7, item.getDisplayName().getFormattedText());
|
||||
renderItem(matrixStack, x + 3, y + 2, item);
|
||||
renderString(matrixStack, x + 4 + 19, y + 7, item.getDisplayName().getString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,9 +298,9 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int x, int y) {
|
||||
public void render(MatrixStack matrixStack, int x, int y) {
|
||||
FluidRenderer.INSTANCE.render(x + 3, y + 2, fluid);
|
||||
renderString(x + 4 + 19, y + 7, fluid.getDisplayName().getFormattedText());
|
||||
renderString(matrixStack, x + 4 + 19, y + 7, fluid.getDisplayName().getString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,7 +310,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
public TagLine(ResourceLocation tagName, boolean checked) {
|
||||
this.tagName = tagName;
|
||||
this.widget = addCheckBox(-100, -100, RenderUtils.shorten(tagName.toString(), 22), checked, (btn) -> {
|
||||
this.widget = addCheckBox(-100, -100, new StringTextComponent(RenderUtils.shorten(tagName.toString(), 22)), checked, (btn) -> {
|
||||
});
|
||||
|
||||
widget.setFGColor(0xFF373737);
|
||||
@@ -330,19 +333,19 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int x, int y) {
|
||||
public void render(MatrixStack matrixStack, int x, int y) {
|
||||
for (ItemStack item : items) {
|
||||
renderItem(x + 3, y, item);
|
||||
renderItem(matrixStack, x + 3, y, item);
|
||||
|
||||
x += 17;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTooltip(int x, int y, int mx, int my) {
|
||||
public void renderTooltip(MatrixStack matrixStack, int x, int y, int mx, int my) {
|
||||
for (ItemStack item : items) {
|
||||
if (RenderUtils.inBounds(x + 3, y, 16, 16, mx, my)) {
|
||||
AlternativesScreen.this.renderTooltip(item, mx, my, RenderUtils.getTooltipFromItem(item));
|
||||
AlternativesScreen.this.renderTooltip(matrixStack, item, mx, my, RenderUtils.getTooltipFromItem(item));
|
||||
}
|
||||
|
||||
x += 17;
|
||||
@@ -358,7 +361,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int x, int y) {
|
||||
public void render(MatrixStack matrixStack, int x, int y) {
|
||||
for (FluidStack fluid : fluids) {
|
||||
FluidRenderer.INSTANCE.render(x + 3, y, fluid);
|
||||
|
||||
@@ -367,10 +370,10 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTooltip(int x, int y, int mx, int my) {
|
||||
public void renderTooltip(MatrixStack matrixStack, int x, int y, int mx, int my) {
|
||||
for (FluidStack fluid : fluids) {
|
||||
if (RenderUtils.inBounds(x + 3, y, 16, 16, mx, my)) {
|
||||
AlternativesScreen.this.renderTooltip(mx, my, fluid.getDisplayName().getFormattedText());
|
||||
AlternativesScreen.this.renderTooltip(matrixStack, mx, my, fluid.getDisplayName().getString());
|
||||
}
|
||||
|
||||
x += 17;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.grid;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
@@ -26,6 +27,7 @@ import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@@ -75,9 +77,9 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
|
||||
|
||||
@Override
|
||||
public void onPostInit(int x, int y) {
|
||||
addButton(x + 55, y + 201 - 20 - 7, 50, 20, I18n.format("gui.cancel"), true, true, btn -> close());
|
||||
addButton(x + 55, y + 201 - 20 - 7, 50, 20, new TranslationTextComponent("gui.cancel"), true, true, btn -> close());
|
||||
|
||||
Button startButton = addButton(x + 129, y + 201 - 20 - 7, 50, 20, I18n.format("misc.refinedstorage.start"), true, true, btn -> startRequest());
|
||||
Button startButton = addButton(x + 129, y + 201 - 20 - 7, 50, 20, new TranslationTextComponent("misc.refinedstorage.start"), true, true, btn -> startRequest());
|
||||
startButton.active = stacks.stream().noneMatch(ICraftingPreviewElement::hasMissing) && getErrorType() == null;
|
||||
}
|
||||
|
||||
@@ -97,21 +99,21 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
bindTexture(RS.ID, "gui/crafting_preview.png");
|
||||
|
||||
blit(x, y, 0, 0, xSize, ySize);
|
||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||
|
||||
if (getErrorType() != null) {
|
||||
fill(x + 7, y + 20, x + 228, y + 169, 0xFFDBDBDB);
|
||||
fill(matrixStack, x + 7, y + 20, x + 228, y + 169, 0xFFDBDBDB);
|
||||
}
|
||||
|
||||
scrollbar.render();
|
||||
scrollbar.render(matrixStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
|
||||
int x = 7;
|
||||
int y = 15;
|
||||
@@ -122,16 +124,16 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.scalef(scale, scale, 1);
|
||||
|
||||
renderString(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"));
|
||||
|
||||
switch (getErrorType()) {
|
||||
case RECURSIVE: {
|
||||
renderString(RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 21, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.0"));
|
||||
renderString(RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 31, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.1"));
|
||||
renderString(RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 41, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.2"));
|
||||
renderString(RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 51, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.3"));
|
||||
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 21, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.0"));
|
||||
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 31, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.1"));
|
||||
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 41, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.2"));
|
||||
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 51, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.3"));
|
||||
|
||||
renderString(RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 61, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.4"));
|
||||
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 61, scale), I18n.format("gui.refinedstorage.crafting_preview.error.recursive.4"));
|
||||
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
@@ -142,12 +144,12 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
|
||||
if (output != null) {
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.scalef(scale, scale, 1);
|
||||
renderString(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy + 6, scale), output.getDisplayName().getFormattedText());
|
||||
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy + 6, scale), output.getDisplayName().getString());
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
RenderSystem.setupGui3DDiffuseLighting();
|
||||
RenderHelper.setupGui3DDiffuseLighting();
|
||||
RenderSystem.enableDepthTest();
|
||||
renderItem(x + 5, yy, output);
|
||||
renderItem(matrixStack, x + 5, yy, output);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
yy += 17;
|
||||
@@ -157,8 +159,8 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
|
||||
break;
|
||||
}
|
||||
case TOO_COMPLEX: {
|
||||
renderString(RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 21, scale), I18n.format("gui.refinedstorage.crafting_preview.error.too_complex.0"));
|
||||
renderString(RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 31, scale), I18n.format("gui.refinedstorage.crafting_preview.error.too_complex.1"));
|
||||
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 21, scale), I18n.format("gui.refinedstorage.crafting_preview.error.too_complex.0"));
|
||||
renderString(matrixStack, RenderUtils.getOffsetOnScale(x + 5, scale), RenderUtils.getOffsetOnScale(y + 31, scale), I18n.format("gui.refinedstorage.crafting_preview.error.too_complex.1"));
|
||||
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
@@ -168,7 +170,7 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
|
||||
} else {
|
||||
int slot = scrollbar != null ? (scrollbar.getOffset() * 3) : 0;
|
||||
|
||||
RenderSystem.setupGui3DDiffuseLighting();
|
||||
RenderHelper.setupGui3DDiffuseLighting();
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
this.hoveringStack = null;
|
||||
@@ -202,21 +204,22 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(matrixStack, mouseX, mouseY, partialTicks);
|
||||
|
||||
if (hoveringStack != null) {
|
||||
renderTooltip(
|
||||
matrixStack,
|
||||
hoveringStack,
|
||||
mouseX,
|
||||
mouseY,
|
||||
hoveringStack.getTooltip(
|
||||
Minecraft.getInstance().player,
|
||||
Minecraft.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL
|
||||
).stream().map(ITextComponent::getFormattedText).collect(Collectors.toList())
|
||||
)
|
||||
);
|
||||
} else if (hoveringFluid != null) {
|
||||
renderTooltip(mouseX, mouseY, hoveringFluid.getDisplayName().getFormattedText());
|
||||
renderTooltip(matrixStack, mouseX, mouseY, hoveringFluid.getDisplayName().getString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ 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;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
|
||||
@@ -22,8 +23,8 @@ public class CraftingSettingsScreen extends AmountSpecifyingScreen<CraftingSetti
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOkButtonText() {
|
||||
return I18n.format("misc.refinedstorage.start");
|
||||
protected ITextComponent getOkButtonText() {
|
||||
return new TranslationTextComponent("misc.refinedstorage.start");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.refinedmods.refinedstorage.screen.grid;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.RSKeyBindings;
|
||||
@@ -31,11 +32,13 @@ import com.refinedmods.refinedstorage.tile.grid.portable.PortableGridTile;
|
||||
import com.refinedmods.refinedstorage.util.RenderUtils;
|
||||
import com.refinedmods.refinedstorage.util.TimeUtils;
|
||||
import net.minecraft.client.audio.SimpleSound;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.LinkedList;
|
||||
@@ -125,7 +128,7 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
addSideButton(new GridSizeSideButton(this, () -> grid.getSize(), size -> grid.onSizeChanged(size)));
|
||||
|
||||
if (grid.getGridType() == GridType.PATTERN) {
|
||||
processingPattern = addCheckBox(x + 7, y + getTopHeight() + (getVisibleRows() * 18) + 60, I18n.format("misc.refinedstorage.processing"), GridTile.PROCESSING_PATTERN.getValue(), btn -> {
|
||||
processingPattern = addCheckBox(x + 7, y + getTopHeight() + (getVisibleRows() * 18) + 60, new TranslationTextComponent("misc.refinedstorage.processing"), GridTile.PROCESSING_PATTERN.getValue(), btn -> {
|
||||
// Rebuild the inventory slots before the slot change packet arrives.
|
||||
GridTile.PROCESSING_PATTERN.setValue(false, processingPattern.isChecked());
|
||||
((GridNetworkNode) grid).clearMatrix(); // The server does this but let's do it earlier so the client doesn't notice.
|
||||
@@ -138,7 +141,7 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
exactPattern = addCheckBox(
|
||||
processingPattern.x + processingPattern.getWidth() + 5,
|
||||
y + getTopHeight() + (getVisibleRows() * 18) + 60,
|
||||
I18n.format("misc.refinedstorage.exact"),
|
||||
new TranslationTextComponent("misc.refinedstorage.exact"),
|
||||
GridTile.EXACT_PATTERN.getValue(),
|
||||
btn -> TileDataManager.setParameter(GridTile.EXACT_PATTERN, exactPattern.isChecked())
|
||||
);
|
||||
@@ -279,8 +282,8 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int x, int y, int mouseX, int mouseY) {
|
||||
tabs.drawBackground(x, y - tabs.getHeight());
|
||||
public void renderBackground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY) {
|
||||
tabs.drawBackground(matrixStack, x, y - tabs.getHeight());
|
||||
|
||||
if (grid instanceof IPortableGrid) {
|
||||
bindTexture(RS.ID, "gui/portable_grid.png");
|
||||
@@ -294,22 +297,22 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
|
||||
int yy = y;
|
||||
|
||||
blit(x, yy, 0, 0, xSize - 34, getTopHeight());
|
||||
blit(matrixStack, x, yy, 0, 0, xSize - 34, getTopHeight());
|
||||
|
||||
// Filters and/or portable grid disk
|
||||
blit(x + xSize - 34 + 4, y, 197, 0, 30, grid instanceof IPortableGrid ? 114 : 82);
|
||||
blit(matrixStack, x + xSize - 34 + 4, y, 197, 0, 30, grid instanceof IPortableGrid ? 114 : 82);
|
||||
|
||||
int rows = getVisibleRows();
|
||||
|
||||
for (int i = 0; i < rows; ++i) {
|
||||
yy += 18;
|
||||
|
||||
blit(x, yy, 0, getTopHeight() + (i > 0 ? (i == rows - 1 ? 18 * 2 : 18) : 0), xSize - 34, 18);
|
||||
blit(matrixStack, x, yy, 0, getTopHeight() + (i > 0 ? (i == rows - 1 ? 18 * 2 : 18) : 0), xSize - 34, 18);
|
||||
}
|
||||
|
||||
yy += 18;
|
||||
|
||||
blit(x, yy, 0, getTopHeight() + (18 * 3), xSize - 34, getBottomHeight());
|
||||
blit(matrixStack, x, yy, 0, getTopHeight() + (18 * 3), xSize - 34, getBottomHeight());
|
||||
|
||||
if (grid.getGridType() == GridType.PATTERN) {
|
||||
int ty = 0;
|
||||
@@ -322,31 +325,31 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
ty = 2;
|
||||
}
|
||||
|
||||
blit(x + 172, y + getTopHeight() + (getVisibleRows() * 18) + 22, 240, ty * 16, 16, 16);
|
||||
blit(matrixStack, x + 172, y + getTopHeight() + (getVisibleRows() * 18) + 22, 240, ty * 16, 16, 16);
|
||||
}
|
||||
|
||||
tabs.drawForeground(x, y - tabs.getHeight(), mouseX, mouseY, true);
|
||||
tabs.drawForeground(matrixStack, x, y - tabs.getHeight(), mouseX, mouseY, true);
|
||||
|
||||
searchField.render(0, 0, 0);
|
||||
searchField.render(matrixStack, 0, 0, 0);
|
||||
|
||||
scrollbar.render();
|
||||
scrollbar.render(matrixStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(matrixStack, mouseX, mouseY, partialTicks);
|
||||
|
||||
// Drawn in here for bug #1844 (https://github.com/refinedmods/refinedstorage/issues/1844)
|
||||
// Item tooltips can't be rendered in the foreground layer due to the X offset translation.
|
||||
if (isOverSlotWithStack()) {
|
||||
drawGridTooltip(view.getStacks().get(slotNumber), mouseX, mouseY);
|
||||
drawGridTooltip(matrixStack, view.getStacks().get(slotNumber), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int mouseX, int mouseY) {
|
||||
renderString(7, 7, title.getFormattedText());
|
||||
renderString(7, getYPlayerInventory() - 12, I18n.format("container.inventory"));
|
||||
public void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||
renderString(matrixStack, 7, 7, title.getString());
|
||||
renderString(matrixStack, 7, getYPlayerInventory() - 12, I18n.format("container.inventory"));
|
||||
|
||||
int x = 8;
|
||||
int y = 19;
|
||||
@@ -355,7 +358,7 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
|
||||
int slot = scrollbar != null ? (scrollbar.getOffset() * 9) : 0;
|
||||
|
||||
RenderSystem.setupGui3DDiffuseLighting();
|
||||
RenderHelper.setupGui3DDiffuseLighting();
|
||||
|
||||
for (int i = 0; i < 9 * getVisibleRows(); ++i) {
|
||||
if (RenderUtils.inBounds(x, y, 16, 16, mouseX, mouseY) || !grid.isGridActive()) {
|
||||
@@ -363,7 +366,7 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
}
|
||||
|
||||
if (slot < view.getStacks().size()) {
|
||||
view.getStacks().get(slot).draw(this, x, y);
|
||||
view.getStacks().get(slot).draw(matrixStack, this, x, y);
|
||||
}
|
||||
|
||||
if (RenderUtils.inBounds(x, y, 16, 16, mouseX, mouseY) || !grid.isGridActive()) {
|
||||
@@ -373,7 +376,7 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
RenderSystem.disableLighting();
|
||||
RenderSystem.disableDepthTest();
|
||||
RenderSystem.colorMask(true, true, true, false);
|
||||
fillGradient(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.popMatrix();
|
||||
}
|
||||
@@ -389,18 +392,18 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
}
|
||||
|
||||
if (isOverClear(mouseX, mouseY)) {
|
||||
renderTooltip(mouseX, mouseY, I18n.format("misc.refinedstorage.clear"));
|
||||
renderTooltip(matrixStack, mouseX, mouseY, I18n.format("misc.refinedstorage.clear"));
|
||||
}
|
||||
|
||||
if (isOverCreatePattern(mouseX, mouseY)) {
|
||||
renderTooltip(mouseX, mouseY, I18n.format("gui.refinedstorage.grid.pattern_create"));
|
||||
renderTooltip(matrixStack, mouseX, mouseY, I18n.format("gui.refinedstorage.grid.pattern_create"));
|
||||
}
|
||||
|
||||
tabs.drawTooltip(font, mouseX, mouseY);
|
||||
tabs.drawTooltip(matrixStack, font, mouseX, mouseY);
|
||||
}
|
||||
|
||||
private void drawGridTooltip(IGridStack gridStack, int mouseX, int mouseY) {
|
||||
List<String> textLines = Lists.newArrayList(gridStack.getTooltip().split("\n"));
|
||||
private void drawGridTooltip(MatrixStack matrixStack, IGridStack gridStack, int mouseX, int mouseY) {
|
||||
List<ITextComponent> textLines = gridStack.getTooltip();
|
||||
List<String> smallTextLines = Lists.newArrayList();
|
||||
|
||||
if (!gridStack.isCraftable()) {
|
||||
@@ -413,7 +416,7 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
||||
|
||||
ItemStack stack = gridStack instanceof ItemGridStack ? ((ItemGridStack) gridStack).getStack() : ItemStack.EMPTY;
|
||||
|
||||
RenderUtils.drawTooltipWithSmallText(textLines, smallTextLines, RS.CLIENT_CONFIG.getGrid().getDetailedTooltip(), stack, mouseX, mouseY, width, height, font);
|
||||
RenderUtils.drawTooltipWithSmallText(matrixStack, textLines, smallTextLines, RS.CLIENT_CONFIG.getGrid().getDetailedTooltip(), stack, mouseX, mouseY, width, height, font);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.grid.stack;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.storage.tracker.StorageTrackerEntry;
|
||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||
import com.refinedmods.refinedstorage.render.FluidRenderer;
|
||||
@@ -8,14 +9,14 @@ import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
public class FluidGridStack implements IGridStack {
|
||||
private final Logger logger = LogManager.getLogger(getClass());
|
||||
@@ -31,7 +32,7 @@ public class FluidGridStack implements IGridStack {
|
||||
|
||||
private Set<String> cachedTags;
|
||||
private String cachedName;
|
||||
private String cachedTooltip;
|
||||
private List<ITextComponent> cachedTooltip;
|
||||
private String cachedModId;
|
||||
private String cachedModName;
|
||||
|
||||
@@ -76,7 +77,7 @@ public class FluidGridStack implements IGridStack {
|
||||
public String getName() {
|
||||
if (cachedName == null) {
|
||||
try {
|
||||
cachedName = stack.getDisplayName().getFormattedText();
|
||||
cachedName = stack.getDisplayName().getString();
|
||||
} catch (Throwable t) {
|
||||
logger.warn("Could not retrieve fluid name of " + stack.getFluid().getRegistryName().toString(), t);
|
||||
|
||||
@@ -129,14 +130,14 @@ public class FluidGridStack implements IGridStack {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
public List<ITextComponent> getTooltip() {
|
||||
if (cachedTooltip == null) {
|
||||
try {
|
||||
cachedTooltip = stack.getDisplayName().getFormattedText();
|
||||
cachedTooltip = Arrays.asList(stack.getDisplayName());
|
||||
} catch (Throwable t) {
|
||||
cachedTooltip = "<Error>";
|
||||
|
||||
logger.warn("Could not retrieve fluid tooltip of " + stack.getFluid().getRegistryName().toString(), t);
|
||||
|
||||
cachedTooltip = Arrays.asList(new StringTextComponent("<Error>"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +160,7 @@ public class FluidGridStack implements IGridStack {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(BaseScreen<?> screen, int x, int y) {
|
||||
public void draw(MatrixStack matrixStack, BaseScreen<?> screen, int x, int y) {
|
||||
FluidRenderer.INSTANCE.render(x, y, stack);
|
||||
|
||||
String text;
|
||||
@@ -174,7 +175,7 @@ public class FluidGridStack implements IGridStack {
|
||||
text = API.instance().getQuantityFormatter().formatInBucketFormWithOnlyTrailingDigitsIfZero(getQuantity());
|
||||
}
|
||||
|
||||
screen.renderQuantity(x, y, text, color);
|
||||
screen.renderQuantity(matrixStack, x, y, text, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.refinedmods.refinedstorage.screen.grid.stack;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.storage.tracker.StorageTrackerEntry;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -23,13 +26,13 @@ public interface IGridStack {
|
||||
|
||||
Set<String> getTags();
|
||||
|
||||
String getTooltip();
|
||||
List<ITextComponent> getTooltip();
|
||||
|
||||
int getQuantity();
|
||||
|
||||
String getFormattedFullQuantity();
|
||||
|
||||
void draw(BaseScreen<?> screen, int x, int y);
|
||||
void draw(MatrixStack matrixStack, BaseScreen<?> screen, int x, int y);
|
||||
|
||||
Object getIngredient();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.grid.stack;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.storage.tracker.StorageTrackerEntry;
|
||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||
import com.refinedmods.refinedstorage.render.RenderSettings;
|
||||
@@ -9,16 +10,15 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
public class ItemGridStack implements IGridStack {
|
||||
private final Logger logger = LogManager.getLogger(getClass());
|
||||
@@ -36,7 +36,7 @@ public class ItemGridStack implements IGridStack {
|
||||
private String cachedName;
|
||||
private String cachedModId;
|
||||
private String cachedModName;
|
||||
private String cachedTooltip;
|
||||
private List<ITextComponent> cachedTooltip;
|
||||
|
||||
public ItemGridStack(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
@@ -90,7 +90,7 @@ public class ItemGridStack implements IGridStack {
|
||||
public String getName() {
|
||||
if (cachedName == null) {
|
||||
try {
|
||||
cachedName = stack.getDisplayName().getFormattedText();
|
||||
cachedName = stack.getDisplayName().getString();
|
||||
} catch (Throwable t) {
|
||||
logger.warn("Could not retrieve item name of " + stack.getItem().toString(), t);
|
||||
|
||||
@@ -141,14 +141,15 @@ public class ItemGridStack implements IGridStack {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
public List<ITextComponent> getTooltip() {
|
||||
if (cachedTooltip == null) {
|
||||
try {
|
||||
cachedTooltip = String.join("\n", RenderUtils.getTooltipFromItem(stack));
|
||||
cachedTooltip = RenderUtils.getTooltipFromItem(stack);
|
||||
} catch (Throwable t) {
|
||||
logger.warn("Could not retrieve item tooltip of " + stack.getItem().toString(), t);
|
||||
|
||||
cachedTooltip = "<Error>";
|
||||
cachedTooltip = new ArrayList<>();
|
||||
cachedTooltip.add(new StringTextComponent("<Error>"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +172,7 @@ public class ItemGridStack implements IGridStack {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(BaseScreen<?> screen, int x, int y) {
|
||||
public void draw(MatrixStack matrixStack, BaseScreen<?> screen, int x, int y) {
|
||||
String text = null;
|
||||
int color = RenderSettings.INSTANCE.getSecondaryColor();
|
||||
|
||||
@@ -184,7 +185,7 @@ public class ItemGridStack implements IGridStack {
|
||||
text = API.instance().getQuantityFormatter().formatWithUnits(getQuantity());
|
||||
}
|
||||
|
||||
screen.renderItem(x, y, stack, true, text, color);
|
||||
screen.renderItem(matrixStack, x, y, stack, true, text, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
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;
|
||||
|
||||
@@ -16,11 +19,11 @@ public class CheckboxWidget extends CheckboxButton {
|
||||
private final Consumer<CheckboxButton> onPress;
|
||||
private boolean shadow = true;
|
||||
|
||||
public CheckboxWidget(int x, int y, String text, boolean isChecked, Consumer<CheckboxButton> onPress) {
|
||||
public CheckboxWidget(int x, int y, ITextComponent text, boolean isChecked, Consumer<CheckboxButton> onPress) {
|
||||
super(
|
||||
x,
|
||||
y,
|
||||
Minecraft.getInstance().fontRenderer.getStringWidth(text) + BOX_WIDTH,
|
||||
Minecraft.getInstance().fontRenderer.getStringWidth(text.getString()) + BOX_WIDTH,
|
||||
10,
|
||||
text,
|
||||
isChecked
|
||||
@@ -45,17 +48,17 @@ public class CheckboxWidget extends CheckboxButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(int p_renderButton_1_, int p_renderButton_2_, float p_renderButton_3_) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
mc.getTextureManager().bindTexture(TEXTURE);
|
||||
public void renderButton(MatrixStack matrixStack, int p_230431_2_, int p_230431_3_, float p_230431_4_) {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
minecraft.getTextureManager().bindTexture(TEXTURE);
|
||||
RenderSystem.enableDepthTest();
|
||||
FontRenderer fontRenderer = mc.fontRenderer;
|
||||
FontRenderer fontrenderer = minecraft.fontRenderer;
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
blit(this.x, this.y, 0.0F, this.checked ? 10.0F : 0.0F, 10, this.height, 16, 32);
|
||||
this.renderBg(mc, p_renderButton_1_, p_renderButton_2_);
|
||||
blit(matrixStack, this.x, this.y, this.isFocused() ? 20.0F : 0.0F, this.checked ? 20.0F : 0.0F, 20, this.height, 64, 64);
|
||||
this.renderBg(matrixStack, minecraft, p_230431_2_, p_230431_3_);
|
||||
|
||||
int color = 14737632;
|
||||
|
||||
@@ -66,9 +69,9 @@ public class CheckboxWidget extends CheckboxButton {
|
||||
}
|
||||
|
||||
if (shadow) {
|
||||
super.drawString(fontRenderer, this.getMessage(), this.x + 13, this.y + (this.height - 8) / 2, color);
|
||||
super.drawString(matrixStack, fontrenderer, this.getMessage(), this.x + 13, this.y + (this.height - 8) / 2, color);
|
||||
} else {
|
||||
fontRenderer.drawString(this.getMessage(), this.x + 13, this.y + (this.height - 8) / 2F, color);
|
||||
fontrenderer.drawString(matrixStack, this.getMessage().getString(), this.x + 13, this.y + (this.height - 8) / 2F, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.integration.jei.GridRecipeTransferHandler;
|
||||
@@ -57,11 +58,11 @@ public class ScrollbarWidget implements IGuiEventListener {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void render() {
|
||||
public void render(MatrixStack matrixStack) {
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
screen.bindTexture(RS.ID, "icons.png");
|
||||
screen.blit(screen.getGuiLeft() + x, screen.getGuiTop() + y + (int) Math.min(height - SCROLLER_HEIGHT, (float) offset / (float) maxOffset * (float) (height - SCROLLER_HEIGHT)), isEnabled() ? 232 : 244, 0, 12, 15);
|
||||
screen.blit(matrixStack, screen.getGuiLeft() + x, screen.getGuiTop() + y + (int) Math.min(height - SCROLLER_HEIGHT, (float) offset / (float) maxOffset * (float) (height - SCROLLER_HEIGHT)), isEnabled() ? 232 : 244, 0, 12, 15);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.refinedmods.refinedstorage.render.RenderSettings;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -20,7 +21,7 @@ public class SearchWidget extends TextFieldWidget {
|
||||
private int historyIndex = -1;
|
||||
|
||||
public SearchWidget(FontRenderer fontRenderer, int x, int y, int width) {
|
||||
super(fontRenderer, x, y, width, fontRenderer.FONT_HEIGHT, "");
|
||||
super(fontRenderer, x, y, width, fontRenderer.FONT_HEIGHT, new StringTextComponent(""));
|
||||
|
||||
this.setEnableBackgroundDrawing(false);
|
||||
this.setVisible(true);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.IGridTab;
|
||||
@@ -8,6 +9,7 @@ import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.util.RenderUtils;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -47,22 +49,22 @@ public class TabListWidget {
|
||||
}
|
||||
|
||||
public void init(int width) {
|
||||
this.left = screen.addButton(screen.getGuiLeft(), screen.getGuiTop() - 22, 20, 20, "<", true, pages.get() > 0, btn -> listeners.forEach(t -> t.onPageChanged(page.get() - 1)));
|
||||
this.right = screen.addButton(screen.getGuiLeft() + width - 22, screen.getGuiTop() - 22, 20, 20, ">", true, pages.get() > 0, btn -> listeners.forEach(t -> t.onPageChanged(page.get() + 1)));
|
||||
this.left = screen.addButton(screen.getGuiLeft(), screen.getGuiTop() - 22, 20, 20, new StringTextComponent("<"), true, pages.get() > 0, btn -> listeners.forEach(t -> t.onPageChanged(page.get() - 1)));
|
||||
this.right = screen.addButton(screen.getGuiLeft() + width - 22, screen.getGuiTop() - 22, 20, 20, new StringTextComponent(">"), true, pages.get() > 0, btn -> listeners.forEach(t -> t.onPageChanged(page.get() + 1)));
|
||||
}
|
||||
|
||||
public void addListener(ITabListListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void drawForeground(int x, int y, int mouseX, int mouseY, boolean visible) {
|
||||
public void drawForeground(MatrixStack matrixStack, int x, int y, int mouseX, int mouseY, boolean visible) {
|
||||
this.tabHovering = -1;
|
||||
|
||||
if (visible) {
|
||||
int j = 0;
|
||||
for (int i = page.get() * tabsPerPage; i < (page.get() * tabsPerPage) + tabsPerPage; ++i) {
|
||||
if (i < tabs.get().size()) {
|
||||
drawTab(tabs.get().get(i), true, x, y, i, j);
|
||||
drawTab(matrixStack, tabs.get().get(i), true, x, y, i, j);
|
||||
|
||||
if (RenderUtils.inBounds(x + getXOffset() + ((IGridTab.TAB_WIDTH + 1) * j), y, IGridTab.TAB_WIDTH, IGridTab.TAB_HEIGHT - (i == selected.get() ? 2 : 7), mouseX, mouseY)) {
|
||||
this.tabHovering = i;
|
||||
@@ -94,11 +96,11 @@ public class TabListWidget {
|
||||
right.active = page.get() < pages.get();
|
||||
}
|
||||
|
||||
public void drawBackground(int x, int y) {
|
||||
public void drawBackground(MatrixStack matrixStack, int x, int y) {
|
||||
int j = 0;
|
||||
for (int i = page.get() * tabsPerPage; i < (page.get() * tabsPerPage) + tabsPerPage; ++i) {
|
||||
if (i < tabs.get().size()) {
|
||||
drawTab(tabs.get().get(i), false, x, y, i, j++);
|
||||
drawTab(matrixStack, tabs.get().get(i), false, x, y, i, j++);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,7 +117,7 @@ public class TabListWidget {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void drawTab(IGridTab tab, boolean foregroundLayer, int x, int y, int index, int num) {
|
||||
private void drawTab(MatrixStack matrixStack, IGridTab tab, boolean foregroundLayer, int x, int y, int index, int num) {
|
||||
boolean isSelected = index == selected.get();
|
||||
|
||||
if ((foregroundLayer && !isSelected) || (!foregroundLayer && isSelected)) {
|
||||
@@ -151,14 +153,14 @@ public class TabListWidget {
|
||||
uvx = 199;
|
||||
}
|
||||
|
||||
screen.blit(tx, ty, uvx, uvy, tbw, IGridTab.TAB_HEIGHT);
|
||||
screen.blit(matrixStack, tx, ty, uvx, uvy, tbw, IGridTab.TAB_HEIGHT);
|
||||
|
||||
tab.drawIcon(otx + 6, ty + 9 - (!isSelected ? 3 : 0), drawers.getItemDrawer(), drawers.getFluidDrawer());
|
||||
tab.drawIcon(matrixStack, otx + 6, ty + 9 - (!isSelected ? 3 : 0), drawers.getItemDrawer(), drawers.getFluidDrawer());
|
||||
}
|
||||
|
||||
public void drawTooltip(FontRenderer fontRenderer, int mouseX, int mouseY) {
|
||||
public void drawTooltip(MatrixStack matrixStack, FontRenderer fontRenderer, int mouseX, int mouseY) {
|
||||
if (tabHovering >= 0 && tabHovering < tabs.get().size()) {
|
||||
tabs.get().get(tabHovering).drawTooltip(mouseX, mouseY, screen.width, screen.height, fontRenderer);
|
||||
tabs.get().get(tabHovering).drawTooltip(matrixStack, mouseX, mouseY, screen.width, screen.height, fontRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.storage.AccessType;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
|
||||
@@ -18,8 +19,8 @@ public class AccessTypeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, 16 * parameter.getValue().getId(), 240, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, 16 * parameter.getValue().getId(), 240, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.container.ConstructorContainer;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.tile.ConstructorTile;
|
||||
@@ -13,8 +14,8 @@ public class ConstructorDropSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, 64 + (ConstructorTile.DROP.getValue() ? 16 : 0), 16, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, 64 + (ConstructorTile.DROP.getValue() ? 16 : 0), 16, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.IGrid;
|
||||
import com.refinedmods.refinedstorage.integration.jei.JeiIntegration;
|
||||
import com.refinedmods.refinedstorage.screen.CrafterManagerScreen;
|
||||
@@ -19,10 +20,10 @@ public class CrafterManagerSearchBoxModeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
int mode = ((CrafterManagerScreen) screen).getCrafterManager().getSearchBoxMode();
|
||||
|
||||
screen.blit(x, y, mode == IGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED || mode == IGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED ? 16 : 0, 96, 16, 16);
|
||||
screen.blit(matrixStack, x, y, mode == IGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED || mode == IGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED ? 16 : 0, 96, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.container.CrafterContainer;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.tile.CrafterTile;
|
||||
@@ -18,8 +19,8 @@ public class CrafterModeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, CrafterTile.MODE.getValue() * 16, 0, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, CrafterTile.MODE.getValue() * 16, 0, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.container.DestructorContainer;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.tile.DestructorTile;
|
||||
@@ -13,8 +14,8 @@ public class DestructorPickupSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, 64 + (!DestructorTile.PICKUP.getValue() ? 16 : 0), 0, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, 64 + (!DestructorTile.PICKUP.getValue() ? 16 : 0), 0, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.apiimpl.network.node.DetectorNetworkNode;
|
||||
import com.refinedmods.refinedstorage.container.DetectorContainer;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
@@ -19,8 +20,8 @@ public class DetectorModeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, DetectorTile.MODE.getValue() * 16, 176, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, DetectorTile.MODE.getValue() * 16, 176, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.util.IComparer;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
|
||||
@@ -32,11 +33,11 @@ public class ExactModeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
int ty = 16 * 12;
|
||||
int tx = (parameter.getValue() & MASK) == MASK ? 0 : 16;
|
||||
|
||||
screen.blit(x, y, tx, ty, 16, 16);
|
||||
screen.blit(matrixStack, x, y, tx, ty, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.screen.FilterScreen;
|
||||
import com.refinedmods.refinedstorage.tile.config.IType;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -20,8 +21,8 @@ public class FilterTypeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, 16 * screen.getType(), 128, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, 16 * screen.getType(), 128, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.IGrid;
|
||||
import com.refinedmods.refinedstorage.integration.jei.JeiIntegration;
|
||||
import com.refinedmods.refinedstorage.screen.grid.GridScreen;
|
||||
@@ -17,10 +18,10 @@ public class GridSearchBoxModeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
int mode = ((GridScreen) screen).getGrid().getSearchBoxMode();
|
||||
|
||||
screen.blit(x, y, mode == IGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED || mode == IGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED ? 16 : 0, 96, 16, 16);
|
||||
screen.blit(matrixStack, x, y, mode == IGrid.SEARCH_BOX_MODE_NORMAL_AUTOSELECTED || mode == IGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED ? 16 : 0, 96, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.IGrid;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -24,7 +25,7 @@ public class GridSizeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
int size = this.sizeSupplier.get();
|
||||
|
||||
int tx = 0;
|
||||
@@ -39,7 +40,7 @@ public class GridSizeSideButton extends SideButton {
|
||||
tx = 32;
|
||||
}
|
||||
|
||||
screen.blit(x, y, 64 + tx, 64, 16, 16);
|
||||
screen.blit(matrixStack, x, y, 64 + tx, 64, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.IGrid;
|
||||
import com.refinedmods.refinedstorage.container.GridContainer;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
@@ -21,8 +22,8 @@ public class GridSortingDirectionSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, grid.getSortingDirection() * 16, 16, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, grid.getSortingDirection() * 16, 16, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.GridType;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.IGrid;
|
||||
import com.refinedmods.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
||||
@@ -24,11 +25,11 @@ public class GridSortingTypeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
if (grid.getSortingType() == IGrid.SORTING_TYPE_LAST_MODIFIED) {
|
||||
screen.blit(x, y, 48, 48, 16, 16);
|
||||
screen.blit(matrixStack, x, y, 48, 48, 16, 16);
|
||||
} else {
|
||||
screen.blit(x, y, grid.getSortingType() * 16, 32, 16, 16);
|
||||
screen.blit(matrixStack, x, y, grid.getSortingType() * 16, 32, 16, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.api.network.grid.IGrid;
|
||||
import com.refinedmods.refinedstorage.container.GridContainer;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
@@ -21,8 +22,8 @@ public class GridViewTypeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, (grid.getViewType() - (grid.getViewType() >= 3 ? 3 : 0)) * 16, 112, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, (grid.getViewType() - (grid.getViewType() >= 3 ? 3 : 0)) * 16, 112, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.apiimpl.network.node.diskmanipulator.DiskManipulatorNetworkNode;
|
||||
import com.refinedmods.refinedstorage.container.DiskManipulatorContainer;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
@@ -19,8 +20,8 @@ public class IoModeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, DiskManipulatorTile.IO_MODE.getValue() == DiskManipulatorNetworkNode.IO_MODE_EXTRACT ? 0 : 16, 160, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, DiskManipulatorTile.IO_MODE.getValue() == DiskManipulatorNetworkNode.IO_MODE_EXTRACT ? 0 : 16, 160, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
|
||||
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
|
||||
@@ -21,8 +22,8 @@ public class RedstoneModeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, parameter.getValue() * 16, 0, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, parameter.getValue() * 16, 0, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.refinedmods.refinedstorage.RS;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.util.RenderUtils;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public abstract class SideButton extends Button {
|
||||
@@ -14,34 +16,34 @@ public abstract class SideButton extends Button {
|
||||
protected final BaseScreen<?> screen;
|
||||
|
||||
public SideButton(BaseScreen<?> screen) {
|
||||
super(-1, -1, 18, 18, "", btn -> {
|
||||
super(-1, -1, 18, 18, new StringTextComponent(""), btn -> {
|
||||
});
|
||||
|
||||
this.screen = screen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(int mouseX, int mouseY, float partialTicks) {
|
||||
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.enableAlphaTest();
|
||||
|
||||
isHovered = RenderUtils.inBounds(x, y, width, height, mouseX, mouseY);
|
||||
|
||||
screen.bindTexture(RS.ID, "icons.png");
|
||||
screen.blit(x, y, 238, isHovered ? 35 : 16, 18, 18);
|
||||
screen.blit(matrixStack, x, y, 238, isHovered ? 35 : 16, 18, 18);
|
||||
|
||||
renderButtonIcon(x + 1, y + 1);
|
||||
renderButtonIcon(matrixStack, x + 1, y + 1);
|
||||
|
||||
if (isHovered) {
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.color4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
screen.blit(x, y, 238, 54, 18, 18);
|
||||
screen.blit(matrixStack, x, y, 238, 54, 18, 18);
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void renderButtonIcon(int x, int y);
|
||||
protected abstract void renderButtonIcon(MatrixStack matrixStack, int x, int y);
|
||||
|
||||
public abstract String getTooltip();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.tile.config.IType;
|
||||
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
|
||||
@@ -22,8 +23,8 @@ public class TypeSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, 16 * type.getValue(), 128, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, 16 * type.getValue(), 128, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.screen.widget.sidebutton;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import com.refinedmods.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
|
||||
@@ -22,8 +23,8 @@ public class WhitelistBlacklistSideButton extends SideButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderButtonIcon(int x, int y) {
|
||||
screen.blit(x, y, parameter.getValue() == IWhitelistBlacklist.WHITELIST ? 0 : 16, 64, 16, 16);
|
||||
protected void renderButtonIcon(MatrixStack matrixStack, int x, int y) {
|
||||
screen.blit(matrixStack, x, y, parameter.getValue() == IWhitelistBlacklist.WHITELIST ? 0 : 16, 64, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,11 +2,11 @@ package com.refinedmods.refinedstorage.util;
|
||||
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public final class CollisionUtils {
|
||||
public static boolean isInBounds(VoxelShape shape, BlockPos pos, Vec3d hit) {
|
||||
public static boolean isInBounds(VoxelShape shape, BlockPos pos, Vector3d hit) {
|
||||
AxisAlignedBB aabb = shape.getBoundingBox().offset(pos);
|
||||
|
||||
return hit.x >= aabb.minX
|
||||
|
||||
@@ -7,9 +7,9 @@ import net.minecraft.util.math.BlockPos;
|
||||
public final class DirectionUtils {
|
||||
public static Direction getFacingFromEntity(BlockPos clickedBlock, LivingEntity entity) {
|
||||
return Direction.getFacingFromVector(
|
||||
(float) (entity.getPosition().getX() - clickedBlock.getX()),
|
||||
(float) (entity.getPosition().getY() - clickedBlock.getY()),
|
||||
(float) (entity.getPosition().getZ() - clickedBlock.getZ())
|
||||
(float) (entity.getPosX() - clickedBlock.getX()),
|
||||
(float) (entity.getPosY() - clickedBlock.getY()),
|
||||
(float) (entity.getPosZ() - clickedBlock.getZ())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.refinedmods.refinedstorage.util;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.refinedmods.refinedstorage.api.util.IComparer;
|
||||
@@ -10,13 +9,11 @@ import com.refinedmods.refinedstorage.screen.BaseScreen;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.util.text.*;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -49,7 +46,7 @@ public final class RenderUtils {
|
||||
if (!stacks.get(i).isEmpty() && !combinedIndices.contains(i)) {
|
||||
ItemStack stack = stacks.get(i);
|
||||
|
||||
ITextComponent data = stack.getDisplayName();
|
||||
IFormattableTextComponent data = stack.getDisplayName().copyRaw();
|
||||
|
||||
int amount = stack.getCount();
|
||||
|
||||
@@ -62,10 +59,10 @@ public final class RenderUtils {
|
||||
}
|
||||
|
||||
if (displayAmount) {
|
||||
data = new StringTextComponent(amount + "x ").appendSibling(data);
|
||||
data = new StringTextComponent(amount + "x ").func_230529_a_(data);
|
||||
}
|
||||
|
||||
tooltip.add(data.setStyle(Styles.GRAY));
|
||||
tooltip.add(data.func_230530_a_(Styles.GRAY));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +74,7 @@ public final class RenderUtils {
|
||||
if (!stacks.get(i).isEmpty() && !combinedIndices.contains(i)) {
|
||||
FluidStack stack = stacks.get(i);
|
||||
|
||||
ITextComponent data = stack.getDisplayName();
|
||||
IFormattableTextComponent data = stack.getDisplayName().copyRaw();
|
||||
|
||||
int amount = stack.getAmount();
|
||||
|
||||
@@ -90,16 +87,16 @@ public final class RenderUtils {
|
||||
}
|
||||
|
||||
if (displayMb) {
|
||||
data = new StringTextComponent(API.instance().getQuantityFormatter().formatInBucketForm(amount) + " ").appendSibling(data);
|
||||
data = new StringTextComponent(API.instance().getQuantityFormatter().formatInBucketForm(amount) + " ").func_230529_a_(data);
|
||||
}
|
||||
|
||||
tooltip.add(data.setStyle(Styles.GRAY));
|
||||
tooltip.add(data.func_230530_a_(Styles.GRAY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Volatile: Copied with some tweaks from GuiUtils#drawHoveringText(@Nonnull final ItemStack stack, List<String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
|
||||
public static void drawTooltipWithSmallText(List<String> textLines, List<String> smallTextLines, boolean showSmallText, @Nonnull ItemStack stack, int mouseX, int mouseY, int screenWidth, int screenHeight, FontRenderer fontRenderer) {
|
||||
public static void drawTooltipWithSmallText(MatrixStack matrixStack, List<? extends ITextProperties> textLines, List<String> smallTextLines, boolean showSmallText, @Nonnull ItemStack stack, int mouseX, int mouseY, int screenWidth, int screenHeight, FontRenderer fontRenderer) {
|
||||
// RS begin - definitions
|
||||
int maxTextWidth = -1;
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
@@ -107,7 +104,7 @@ public final class RenderUtils {
|
||||
// RS end
|
||||
|
||||
if (!textLines.isEmpty()) {
|
||||
RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font);
|
||||
RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, matrixStack, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return;
|
||||
mouseX = event.getX();
|
||||
@@ -121,8 +118,8 @@ public final class RenderUtils {
|
||||
RenderSystem.disableDepthTest();
|
||||
int tooltipTextWidth = 0;
|
||||
|
||||
for (String textLine : textLines) {
|
||||
int textLineWidth = font.getStringWidth(textLine);
|
||||
for (ITextProperties textLine : textLines) {
|
||||
int textLineWidth = font.getStringWidth(textLine.getString());
|
||||
if (textLineWidth > tooltipTextWidth)
|
||||
tooltipTextWidth = textLineWidth;
|
||||
}
|
||||
@@ -162,15 +159,15 @@ public final class RenderUtils {
|
||||
|
||||
if (needsWrap) {
|
||||
int wrappedTooltipWidth = 0;
|
||||
List<String> wrappedTextLines = new ArrayList<>();
|
||||
List<ITextProperties> wrappedTextLines = new ArrayList<>();
|
||||
for (int i = 0; i < textLines.size(); i++) {
|
||||
String textLine = textLines.get(i);
|
||||
List<String> wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth);
|
||||
ITextProperties textLine = textLines.get(i);
|
||||
List<ITextProperties> wrappedLine = font.func_238425_b_(textLine, tooltipTextWidth);
|
||||
if (i == 0)
|
||||
titleLinesCount = wrappedLine.size();
|
||||
|
||||
for (String line : wrappedLine) {
|
||||
int lineWidth = font.getStringWidth(line);
|
||||
for (ITextProperties line : wrappedLine) {
|
||||
int lineWidth = font.getStringWidth(line.getString());
|
||||
if (lineWidth > wrappedTooltipWidth)
|
||||
wrappedTooltipWidth = lineWidth;
|
||||
wrappedTextLines.add(line);
|
||||
@@ -209,23 +206,24 @@ public final class RenderUtils {
|
||||
int backgroundColor = 0xF0100010;
|
||||
int borderColorStart = 0x505000FF;
|
||||
int borderColorEnd = (borderColorStart & 0xFEFEFE) >> 1 | borderColorStart & 0xFF000000;
|
||||
RenderTooltipEvent.Color colorEvent = new RenderTooltipEvent.Color(stack, textLines, tooltipX, tooltipY, font, backgroundColor, borderColorStart, borderColorEnd);
|
||||
RenderTooltipEvent.Color colorEvent = new RenderTooltipEvent.Color(stack, textLines, matrixStack, tooltipX, tooltipY, font, backgroundColor, borderColorStart, borderColorEnd);
|
||||
MinecraftForge.EVENT_BUS.post(colorEvent);
|
||||
backgroundColor = colorEvent.getBackground();
|
||||
borderColorStart = colorEvent.getBorderStart();
|
||||
borderColorEnd = colorEvent.getBorderEnd();
|
||||
Matrix4f matrix = matrixStack.getLast().getMatrix();
|
||||
|
||||
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
|
||||
GuiUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
|
||||
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart);
|
||||
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd);
|
||||
GuiUtils.drawGradientRect(matrix, zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(matrix, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(matrix, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(matrix, zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(matrix, zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
|
||||
GuiUtils.drawGradientRect(matrix, zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
|
||||
GuiUtils.drawGradientRect(matrix, zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
|
||||
GuiUtils.drawGradientRect(matrix, zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart);
|
||||
GuiUtils.drawGradientRect(matrix, zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd);
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostBackground(stack, textLines, tooltipX, tooltipY, font, tooltipTextWidth, tooltipHeight));
|
||||
MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostBackground(stack, textLines, matrixStack, tooltipX, tooltipY, font, tooltipTextWidth, tooltipHeight));
|
||||
|
||||
IRenderTypeBuffer.Impl renderType = IRenderTypeBuffer.getImpl(Tessellator.getInstance().getBuffer());
|
||||
MatrixStack textStack = new MatrixStack();
|
||||
@@ -235,9 +233,9 @@ public final class RenderUtils {
|
||||
int tooltipTop = tooltipY;
|
||||
|
||||
for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
|
||||
String line = textLines.get(lineNumber);
|
||||
ITextProperties line = textLines.get(lineNumber);
|
||||
if (line != null)
|
||||
font.renderString(line, (float) tooltipX, (float) tooltipY, -1, true, textLocation, renderType, false, 0, 15728880);
|
||||
font.renderString(line.getString(), (float) tooltipX, (float) tooltipY, -1, true, textLocation, renderType, false, 0, 15728880);
|
||||
|
||||
if (lineNumber + 1 == titleLinesCount)
|
||||
tooltipY += 2;
|
||||
@@ -247,7 +245,7 @@ public final class RenderUtils {
|
||||
|
||||
renderType.finish();
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight));
|
||||
MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, matrixStack, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight));
|
||||
|
||||
// RS BEGIN
|
||||
if (showSmallText) {
|
||||
@@ -290,15 +288,9 @@ public final class RenderUtils {
|
||||
}
|
||||
|
||||
// @Volatile: From Screen#getTooltipFromItem
|
||||
public static List<String> getTooltipFromItem(ItemStack stack) {
|
||||
List<ITextComponent> tooltip = stack.getTooltip(Minecraft.getInstance().player, Minecraft.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
|
||||
List<String> tooltipStrings = Lists.newArrayList();
|
||||
|
||||
for (ITextComponent itextcomponent : tooltip) {
|
||||
tooltipStrings.add(itextcomponent.getFormattedText());
|
||||
}
|
||||
|
||||
return tooltipStrings;
|
||||
public static List<ITextComponent> getTooltipFromItem(ItemStack stack) {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
return stack.getTooltip(minecraft.player, minecraft.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
|
||||
}
|
||||
|
||||
public static boolean inBounds(int x, int y, int w, int h, double ox, double oy) {
|
||||
|
||||
@@ -12,10 +12,11 @@ import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
@@ -77,15 +78,15 @@ public final class WorldUtils {
|
||||
}
|
||||
|
||||
public static void sendNoPermissionMessage(PlayerEntity player) {
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.security.no_permission").setStyle(Styles.RED));
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.security.no_permission").func_230530_a_(Styles.RED), player.getUniqueID());
|
||||
}
|
||||
|
||||
public static RayTraceResult rayTracePlayer(World world, PlayerEntity player) {
|
||||
double reachDistance = player.getAttribute(PlayerEntity.REACH_DISTANCE).getValue();
|
||||
double reachDistance = player.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue();
|
||||
|
||||
Vec3d base = player.getEyePosition(1.0F);
|
||||
Vec3d look = player.getLookVec();
|
||||
Vec3d target = base.add(look.x * reachDistance, look.y * reachDistance, look.z * reachDistance);
|
||||
Vector3d base = player.getEyePosition(1.0F);
|
||||
Vector3d look = player.getLookVec();
|
||||
Vector3d target = base.add(look.x * reachDistance, look.y * reachDistance, look.z * reachDistance);
|
||||
|
||||
return world.rayTraceBlocks(new RayTraceContext(base, target, RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, player));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user