Rough reborn core client port
This commit is contained in:
parent
876c6154e1
commit
4e0ea809c6
16 changed files with 209 additions and 239 deletions
|
@ -49,7 +49,7 @@ public class BlockOutlineRenderer implements WorldRenderEvents.BlockOutline {
|
||||||
public boolean onBlockOutline(WorldRenderContext worldRenderContext, WorldRenderContext.BlockOutlineContext context) {
|
public boolean onBlockOutline(WorldRenderContext worldRenderContext, WorldRenderContext.BlockOutlineContext context) {
|
||||||
List<VoxelShape> shapes = new ArrayList<>();
|
List<VoxelShape> shapes = new ArrayList<>();
|
||||||
|
|
||||||
World world = context.entity().world;
|
World world = context.entity().getWorld();
|
||||||
BlockPos targetPos = context.blockPos();
|
BlockPos targetPos = context.blockPos();
|
||||||
|
|
||||||
if (context.entity() == MinecraftClient.getInstance().player) {
|
if (context.entity() == MinecraftClient.getInstance().player) {
|
||||||
|
@ -61,7 +61,7 @@ public class BlockOutlineRenderer implements WorldRenderEvents.BlockOutline {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getItem() instanceof MultiBlockBreakingTool) {
|
if (stack.getItem() instanceof MultiBlockBreakingTool) {
|
||||||
Set<BlockPos> blockPosList = ((MultiBlockBreakingTool) stack.getItem()).getBlocksToBreak(stack, clientPlayerEntity.world, targetPos, clientPlayerEntity);
|
Set<BlockPos> blockPosList = ((MultiBlockBreakingTool) stack.getItem()).getBlocksToBreak(stack, clientPlayerEntity.getWorld(), targetPos, clientPlayerEntity);
|
||||||
|
|
||||||
for (BlockPos pos : blockPosList) {
|
for (BlockPos pos : blockPosList) {
|
||||||
if (pos.equals(targetPos)) {
|
if (pos.equals(targetPos)) {
|
||||||
|
@ -82,7 +82,7 @@ public class BlockOutlineRenderer implements WorldRenderEvents.BlockOutline {
|
||||||
shape = VoxelShapes.union(shape, voxelShape);
|
shape = VoxelShapes.union(shape, voxelShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldRenderer.drawShapeOutline(worldRenderContext.matrixStack(), worldRenderContext.consumers().getBuffer(RenderLayer.getLines()), shape, (double)targetPos.getX() - context.cameraX(), (double)targetPos.getY() - context.cameraY(), (double)targetPos.getZ() - context.cameraZ(), 0.0F, 0.0F, 0.0F, 0.4F);
|
WorldRenderer.drawShapeOutline(worldRenderContext.matrixStack(), worldRenderContext.consumers().getBuffer(RenderLayer.getLines()), shape, (double)targetPos.getX() - context.cameraX(), (double)targetPos.getY() - context.cameraY(), (double)targetPos.getZ() - context.cameraZ(), 0.0F, 0.0F, 0.0F, 0.4F, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -31,6 +31,7 @@ import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gl.Framebuffer;
|
import net.minecraft.client.gl.Framebuffer;
|
||||||
import net.minecraft.client.gl.SimpleFramebuffer;
|
import net.minecraft.client.gl.SimpleFramebuffer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.render.DiffuseLighting;
|
import net.minecraft.client.render.DiffuseLighting;
|
||||||
import net.minecraft.client.texture.NativeImage;
|
import net.minecraft.client.texture.NativeImage;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
@ -53,18 +54,18 @@ public class ItemStackRenderer implements HudRenderCallback {
|
||||||
private static final int SIZE = 512;
|
private static final int SIZE = 512;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHudRender(MatrixStack matrixStack, float v) {
|
public void onHudRender(DrawContext drawContext, float v) {
|
||||||
if (!ItemStackRenderManager.RENDER_QUEUE.isEmpty()) {
|
if (!ItemStackRenderManager.RENDER_QUEUE.isEmpty()) {
|
||||||
ItemStack itemStack = ItemStackRenderManager.RENDER_QUEUE.remove();
|
ItemStack itemStack = ItemStackRenderManager.RENDER_QUEUE.remove();
|
||||||
Identifier id = Registries.ITEM.getId(itemStack.getItem());
|
Identifier id = Registries.ITEM.getId(itemStack.getItem());
|
||||||
MinecraftClient.getInstance().textRenderer.draw(matrixStack, "Rendering " + id + ", " + ItemStackRenderManager.RENDER_QUEUE.size() + " items left", 5, 5, -1);
|
drawContext.drawText(MinecraftClient.getInstance().textRenderer, "Rendering " + id + ", " + ItemStackRenderManager.RENDER_QUEUE.size() + " items left", 5, 5, -1, true);
|
||||||
export(id, itemStack);
|
export(id, itemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void export(Identifier identifier, ItemStack item) {
|
private void export(Identifier identifier, ItemStack item) {
|
||||||
Matrix4f matrix4f = new Matrix4f().setOrtho(0, 16, 0, 16, 1000, 3000);
|
Matrix4f matrix4f = new Matrix4f().setOrtho(0, 16, 0, 16, 1000, 3000);
|
||||||
RenderSystem.setProjectionMatrix(matrix4f);
|
RenderSystem.setProjectionMatrix(matrix4f, null); // TODO 1.20
|
||||||
MatrixStack stack = RenderSystem.getModelViewStack();
|
MatrixStack stack = RenderSystem.getModelViewStack();
|
||||||
stack.loadIdentity();
|
stack.loadIdentity();
|
||||||
stack.translate(0, 0, -2000);
|
stack.translate(0, 0, -2000);
|
||||||
|
@ -79,7 +80,7 @@ public class ItemStackRenderer implements HudRenderCallback {
|
||||||
|
|
||||||
framebuffer.beginWrite(true);
|
framebuffer.beginWrite(true);
|
||||||
GlStateManager._clear(GL12.GL_COLOR_BUFFER_BIT | GL12.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC);
|
GlStateManager._clear(GL12.GL_COLOR_BUFFER_BIT | GL12.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC);
|
||||||
MinecraftClient.getInstance().getItemRenderer().renderInGui(stack, item, 0, 0);
|
// MinecraftClient.getInstance().getItemRenderer().renderInGui(stack, item, 0, 0); // TODO 1.20
|
||||||
framebuffer.endWrite();
|
framebuffer.endWrite();
|
||||||
|
|
||||||
framebuffer.beginRead();
|
framebuffer.beginRead();
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.Selectable;
|
import net.minecraft.client.gui.Selectable;
|
||||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||||
|
@ -150,39 +151,39 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
||||||
return backgroundWidth;
|
return backgroundWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawSlot(MatrixStack matrixStack, int x, int y, Layer layer) {
|
public void drawSlot(DrawContext drawContext, int x, int y, Layer layer) {
|
||||||
if (layer == Layer.BACKGROUND) {
|
if (layer == Layer.BACKGROUND) {
|
||||||
x += this.x;
|
x += this.x;
|
||||||
y += this.y;
|
y += this.y;
|
||||||
}
|
}
|
||||||
builder.drawSlot(matrixStack, this, x - 1, y - 1);
|
builder.drawSlot(drawContext, this, x - 1, y - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawOutputSlotBar(MatrixStack matrixStack, int x, int y, int count, Layer layer) {
|
public void drawOutputSlotBar(DrawContext drawContext, int x, int y, int count, Layer layer) {
|
||||||
if (layer == Layer.BACKGROUND) {
|
if (layer == Layer.BACKGROUND) {
|
||||||
x += this.x;
|
x += this.x;
|
||||||
y += this.y;
|
y += this.y;
|
||||||
}
|
}
|
||||||
builder.drawOutputSlotBar(matrixStack, this, x - 4, y - 4, count);
|
builder.drawOutputSlotBar(drawContext, this, x - 4, y - 4, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawArmourSlots(MatrixStack matrixStack, int x, int y, Layer layer) {
|
public void drawArmourSlots(DrawContext drawContext, int x, int y, Layer layer) {
|
||||||
if (layer == Layer.BACKGROUND) {
|
if (layer == Layer.BACKGROUND) {
|
||||||
x += this.x;
|
x += this.x;
|
||||||
y += this.y;
|
y += this.y;
|
||||||
}
|
}
|
||||||
builder.drawSlot(matrixStack, this, x - 1, y - 1);
|
builder.drawSlot(drawContext, this, x - 1, y - 1);
|
||||||
builder.drawSlot(matrixStack, this, x - 1, y - 1 + 18);
|
builder.drawSlot(drawContext, this, x - 1, y - 1 + 18);
|
||||||
builder.drawSlot(matrixStack, this, x - 1, y - 1 + 18 + 18);
|
builder.drawSlot(drawContext, this, x - 1, y - 1 + 18 + 18);
|
||||||
builder.drawSlot(matrixStack, this, x - 1, y - 1 + 18 + 18 + 18);
|
builder.drawSlot(drawContext, this, x - 1, y - 1 + 18 + 18 + 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawOutputSlot(MatrixStack matrixStack, int x, int y, Layer layer) {
|
public void drawOutputSlot(DrawContext drawContext, int x, int y, Layer layer) {
|
||||||
if (layer == Layer.BACKGROUND) {
|
if (layer == Layer.BACKGROUND) {
|
||||||
x += this.x;
|
x += this.x;
|
||||||
y += this.y;
|
y += this.y;
|
||||||
}
|
}
|
||||||
builder.drawOutputSlot(matrixStack, this, x - 5, y - 5);
|
builder.drawOutputSlot(drawContext, this, x - 5, y - 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -197,31 +198,31 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawBackground(MatrixStack matrixStack, float lastFrameDuration, int mouseX, int mouseY) {
|
protected void drawBackground(DrawContext drawContext, float lastFrameDuration, int mouseX, int mouseY) {
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
renderBackground(matrixStack);
|
renderBackground(drawContext);
|
||||||
boolean drawPlayerSlots = selectedTab == null && drawPlayerSlots();
|
boolean drawPlayerSlots = selectedTab == null && drawPlayerSlots();
|
||||||
updateSlotDraw(drawPlayerSlots);
|
updateSlotDraw(drawPlayerSlots);
|
||||||
builder.drawDefaultBackground(matrixStack, this, x, y, xSize, ySize);
|
builder.drawDefaultBackground(drawContext, this, x, y, xSize, ySize);
|
||||||
if (drawPlayerSlots) {
|
if (drawPlayerSlots) {
|
||||||
builder.drawPlayerSlots(matrixStack, this, x + backgroundWidth / 2, y + 93, true);
|
builder.drawPlayerSlots(drawContext, this, x + backgroundWidth / 2, y + 93, true);
|
||||||
}
|
}
|
||||||
if (tryAddUpgrades() && be instanceof IUpgradeable upgradeable) {
|
if (tryAddUpgrades() && be instanceof IUpgradeable upgradeable) {
|
||||||
if (upgradeable.canBeUpgraded()) {
|
if (upgradeable.canBeUpgraded()) {
|
||||||
builder.drawUpgrades(matrixStack, this, x - 24, y + 6);
|
builder.drawUpgrades(drawContext, this, x - 24, y + 6);
|
||||||
upgrades = true;
|
upgrades = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int offset = upgrades ? 86 : 6;
|
int offset = upgrades ? 86 : 6;
|
||||||
for (GuiTab slot : tabs) {
|
for (GuiTab slot : tabs) {
|
||||||
if (slot.enabled()) {
|
if (slot.enabled()) {
|
||||||
builder.drawSlotTab(matrixStack, this, x - 24, y + offset, slot.stack());
|
builder.drawSlotTab(drawContext, this, x - 24, y + offset, slot.stack());
|
||||||
offset += 24;
|
offset += 24;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final GuiBase<T> gui = this;
|
final GuiBase<T> gui = this;
|
||||||
getTab().ifPresent(guiTab -> builder.drawSlotConfigTips(matrixStack, gui, x + backgroundWidth / 2, y + 93, mouseX, mouseY, guiTab));
|
getTab().ifPresent(guiTab -> builder.drawSlotConfigTips(drawContext, gui, x + backgroundWidth / 2, y + 93, mouseX, mouseY, guiTab));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,29 +246,29 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
|
protected void drawForeground(DrawContext drawContext, int mouseX, int mouseY) {
|
||||||
drawTitle(matrixStack);
|
drawTitle(drawContext);
|
||||||
getTab().ifPresent(guiTab -> guiTab.draw(matrixStack, mouseX, mouseY));
|
getTab().ifPresent(guiTab -> guiTab.draw(drawContext, mouseX, mouseY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
public void render(DrawContext drawContext, int mouseX, int mouseY, float partialTicks) {
|
||||||
super.render(matrixStack, mouseX, mouseY, partialTicks);
|
super.render(drawContext, mouseX, mouseY, partialTicks);
|
||||||
this.drawMouseoverTooltip(matrixStack, mouseX, mouseY);
|
this.drawMouseoverTooltip(drawContext, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawMouseoverTooltip(MatrixStack matrixStack, int mouseX, int mouseY) {
|
protected void drawMouseoverTooltip(DrawContext drawContext, int mouseX, int mouseY) {
|
||||||
if (isPointWithinBounds(-25, 6, 24, 80, mouseX, mouseY) && upgrades
|
if (isPointWithinBounds(-25, 6, 24, 80, mouseX, mouseY) && upgrades
|
||||||
&& this.focusedSlot != null && !this.focusedSlot.hasStack()) {
|
&& this.focusedSlot != null && !this.focusedSlot.hasStack()) {
|
||||||
List<Text> list = new ArrayList<>();
|
List<Text> list = new ArrayList<>();
|
||||||
list.add(Text.translatable("reborncore.gui.tooltip.upgrades"));
|
list.add(Text.translatable("reborncore.gui.tooltip.upgrades"));
|
||||||
renderTooltip(matrixStack, list, mouseX, mouseY);
|
drawContext.drawTooltip(MinecraftClient.getInstance().textRenderer, list, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
int offset = upgrades ? 82 : 0;
|
int offset = upgrades ? 82 : 0;
|
||||||
for (GuiTab tab : tabs) {
|
for (GuiTab tab : tabs) {
|
||||||
if (isPointWithinBounds(-26, 6 + offset, 24, 23, mouseX, mouseY)) {
|
if (isPointWithinBounds(-26, 6 + offset, 24, 23, mouseX, mouseY)) {
|
||||||
renderTooltip(matrixStack, Collections.singletonList(Text.translatable(tab.name())), mouseX, mouseY);
|
drawContext.drawTooltip(MinecraftClient.getInstance().textRenderer, Collections.singletonList(Text.translatable(tab.name())), mouseX, mouseY);
|
||||||
}
|
}
|
||||||
offset += 24;
|
offset += 24;
|
||||||
}
|
}
|
||||||
|
@ -282,29 +283,29 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
super.drawMouseoverTooltip(matrixStack, mouseX, mouseY);
|
super.drawMouseoverTooltip(drawContext, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawTitle(MatrixStack matrixStack) {
|
protected void drawTitle(DrawContext drawContext) {
|
||||||
drawCentredText(matrixStack, Text.translatable(be.getCachedState().getBlock().getTranslationKey()), 6, 4210752, Layer.FOREGROUND);
|
drawCentredText(drawContext, Text.translatable(be.getCachedState().getBlock().getTranslationKey()), 6, 4210752, Layer.FOREGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawCentredText(MatrixStack matrixStack, Text text, int y, int colour, Layer layer) {
|
public void drawCentredText(DrawContext drawContext, Text text, int y, int colour, Layer layer) {
|
||||||
drawText(matrixStack, text, (backgroundWidth / 2 - getTextRenderer().getWidth(text) / 2), y, colour, layer);
|
drawText(drawContext, text, (backgroundWidth / 2 - getTextRenderer().getWidth(text) / 2), y, colour, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawCentredText(MatrixStack matrixStack, Text text, int y, int colour, int modifier, Layer layer) {
|
protected void drawCentredText(DrawContext drawContext, Text text, int y, int colour, int modifier, Layer layer) {
|
||||||
drawText(matrixStack, text, (backgroundWidth / 2 - (getTextRenderer().getWidth(text)) / 2) + modifier, y, colour, layer);
|
drawText(drawContext, text, (backgroundWidth / 2 - (getTextRenderer().getWidth(text)) / 2) + modifier, y, colour, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawText(MatrixStack matrixStack, Text text, int x, int y, int colour, Layer layer) {
|
public void drawText(DrawContext drawContext, Text text, int x, int y, int colour, Layer layer) {
|
||||||
int factorX = 0;
|
int factorX = 0;
|
||||||
int factorY = 0;
|
int factorY = 0;
|
||||||
if (layer == Layer.BACKGROUND) {
|
if (layer == Layer.BACKGROUND) {
|
||||||
factorX = this.x;
|
factorX = this.x;
|
||||||
factorY = this.y;
|
factorY = this.y;
|
||||||
}
|
}
|
||||||
getTextRenderer().draw(matrixStack, text, x + factorX, y + factorY, colour);
|
drawContext.drawText(MinecraftClient.getInstance().textRenderer, text, x + factorX, y + factorY, colour, true);
|
||||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
|
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
package reborncore.client.gui.builder;
|
package reborncore.client.gui.builder;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
@ -38,7 +39,7 @@ import java.util.Locale;
|
||||||
|
|
||||||
public class RedstoneConfigGui {
|
public class RedstoneConfigGui {
|
||||||
|
|
||||||
public static void draw(MatrixStack matrixStack, GuiBase<?> guiBase, int mouseX, int mouseY) {
|
public static void draw(DrawContext drawContext, GuiBase<?> guiBase, int mouseX, int mouseY) {
|
||||||
if (guiBase.getMachine() == null) return;
|
if (guiBase.getMachine() == null) return;
|
||||||
RedstoneConfiguration configuration = guiBase.getMachine().getRedstoneConfiguration();
|
RedstoneConfiguration configuration = guiBase.getMachine().getRedstoneConfiguration();
|
||||||
GuiBuilder builder = guiBase.builder;
|
GuiBuilder builder = guiBase.builder;
|
||||||
|
@ -50,16 +51,15 @@ public class RedstoneConfigGui {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int spread = configuration.getElements().size() == 3 ? 27 : 18;
|
int spread = configuration.getElements().size() == 3 ? 27 : 18;
|
||||||
for (RedstoneConfiguration.Element element : configuration.getElements()) {
|
for (RedstoneConfiguration.Element element : configuration.getElements()) {
|
||||||
itemRenderer.renderInGuiWithOverrides(matrixStack, element.getIcon(), x - 3, y + (i * spread) - 5);
|
drawContext.drawItem(element.getIcon(), x - 3, y + (i * spread) - 5);
|
||||||
|
drawContext.drawText(guiBase.getTextRenderer(), Text.translatable("reborncore.gui.fluidconfig." + element.getName()), x + 15, y + (i * spread), -1, true);
|
||||||
guiBase.getTextRenderer().draw(matrixStack, Text.translatable("reborncore.gui.fluidconfig." + element.getName()), x + 15, y + (i * spread), -1);
|
|
||||||
|
|
||||||
boolean hovered = withinBounds(guiBase, mouseX, mouseY, x + 92, y + (i * spread) - 2, 63, 15);
|
boolean hovered = withinBounds(guiBase, mouseX, mouseY, x + 92, y + (i * spread) - 2, 63, 15);
|
||||||
int color = hovered ? 0xFF8b8b8b : 0x668b8b8b;
|
int color = hovered ? 0xFF8b8b8b : 0x668b8b8b;
|
||||||
RenderUtil.drawGradientRect(matrixStack, 0, x + 91, y + (i * spread) - 2, x + 93 + 65, y + (i * spread) + 10, color, color);
|
RenderUtil.drawGradientRect(drawContext.getMatrices(), 0, x + 91, y + (i * spread) - 2, x + 93 + 65, y + (i * spread) + 10, color, color);
|
||||||
|
|
||||||
Text name = Text.translatable("reborncore.gui.fluidconfig." + configuration.getState(element).name().toLowerCase(Locale.ROOT));
|
Text name = Text.translatable("reborncore.gui.fluidconfig." + configuration.getState(element).name().toLowerCase(Locale.ROOT));
|
||||||
guiBase.drawCentredText(matrixStack, name, y + (i * spread), -1, x + 37, GuiBase.Layer.FOREGROUND);
|
guiBase.drawCentredText(drawContext, name, y + (i * spread), -1, x + 37, GuiBase.Layer.FOREGROUND);
|
||||||
//guiBase.getTextRenderer().drawWithShadow(name, x + 92, y + (i * spread), -1);
|
//guiBase.getTextRenderer().drawWithShadow(name, x + 92, y + (i * spread), -1);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ package reborncore.client.gui.builder.slot;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
@ -45,8 +46,8 @@ public class FluidConfigGui {
|
||||||
fluidConfigElement = new ConfigFluidElement(guiBase.getMachine().getTank(), SlotType.NORMAL, 35 - guiBase.getGuiLeft() + 50, 35 - guiBase.getGuiTop() - 25, guiBase);
|
fluidConfigElement = new ConfigFluidElement(guiBase.getMachine().getTank(), SlotType.NORMAL, 35 - guiBase.getGuiLeft() + 50, 35 - guiBase.getGuiTop() - 25, guiBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void draw(MatrixStack matrixStack, GuiBase<?> guiBase, int mouseX, int mouseY) {
|
public static void draw(DrawContext drawContext, GuiBase<?> guiBase, int mouseX, int mouseY) {
|
||||||
fluidConfigElement.draw(matrixStack, guiBase);
|
fluidConfigElement.draw(drawContext, guiBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ConfigFluidElement> getVisibleElements() {
|
public static List<ConfigFluidElement> getVisibleElements() {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
package reborncore.client.gui.builder.slot;
|
package reborncore.client.gui.builder.slot;
|
||||||
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
@ -63,8 +63,8 @@ public class GuiTab {
|
||||||
return machineBaseBlockEntity;
|
return machineBaseBlockEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(MatrixStack matrixStack, int x, int y) {
|
public void draw(DrawContext drawContext, int x, int y) {
|
||||||
builder.draw.draw(matrixStack, guiBase, x, y);
|
builder.draw.draw(drawContext, guiBase, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean click(double mouseX, double mouseY, int mouseButton) {
|
public boolean click(double mouseX, double mouseY, int mouseButton) {
|
||||||
|
@ -162,7 +162,7 @@ public class GuiTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Draw {
|
public interface Draw {
|
||||||
void draw(MatrixStack matrixStack, GuiBase<?> guiBase, int mouseX, int mouseY);
|
void draw(DrawContext drawContext, GuiBase<?> guiBase, int mouseX, int mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Click {
|
public interface Click {
|
||||||
|
|
|
@ -27,6 +27,7 @@ package reborncore.client.gui.builder.slot;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.screen.slot.Slot;
|
import net.minecraft.screen.slot.Slot;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
@ -74,7 +75,7 @@ public class SlotConfigGui {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void draw(MatrixStack matrixStack, GuiBase<?> guiBase, int mouseX, int mouseY) {
|
public static void draw(DrawContext drawContext, GuiBase<?> guiBase, int mouseX, int mouseY) {
|
||||||
BuiltScreenHandler container = guiBase.builtScreenHandler;
|
BuiltScreenHandler container = guiBase.builtScreenHandler;
|
||||||
for (Slot slot : container.slots) {
|
for (Slot slot : container.slots) {
|
||||||
if (guiBase.be != slot.inventory) {
|
if (guiBase.be != slot.inventory) {
|
||||||
|
@ -82,13 +83,13 @@ public class SlotConfigGui {
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderColor(1.0F, 0, 0, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 0, 0, 1.0F);
|
||||||
Color color = new Color(255, 0, 0, 128);
|
Color color = new Color(255, 0, 0, 128);
|
||||||
GuiUtil.drawGradientRect(matrixStack, slot.x - 1, slot.y - 1, 18, 18, color.getColor(), color.getColor());
|
GuiUtil.drawGradientRect(drawContext.getMatrices(), slot.x - 1, slot.y - 1, 18, 18, color.getColor(), color.getColor());
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedSlot != -1) {
|
if (selectedSlot != -1) {
|
||||||
|
|
||||||
slotElementMap.get(selectedSlot).draw(matrixStack, guiBase);
|
slotElementMap.get(selectedSlot).draw(drawContext, guiBase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
package reborncore.client.gui.builder.slot.elements;
|
package reborncore.client.gui.builder.slot.elements;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
@ -65,14 +66,14 @@ public class CheckBoxElement extends ElementBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(MatrixStack matrixStack, GuiBase<?> gui) {
|
public void draw(DrawContext drawContext, GuiBase<?> gui) {
|
||||||
// super.draw(gui);
|
// super.draw(gui);
|
||||||
ISprite sprite = checkBoxSprite.normal();
|
ISprite sprite = checkBoxSprite.normal();
|
||||||
if (ticked.test(this)) {
|
if (ticked.test(this)) {
|
||||||
sprite = checkBoxSprite.ticked();
|
sprite = checkBoxSprite.ticked();
|
||||||
}
|
}
|
||||||
drawSprite(matrixStack, gui, sprite, x, y);
|
drawSprite(drawContext, gui, sprite, x, y);
|
||||||
drawText(matrixStack, gui, label, x + checkBoxSprite.normal().width + 5, ((y + getHeight(gui.getMachine()) / 2) - (gui.getTextRenderer().fontHeight / 2)), labelColor);
|
drawText(drawContext, gui, label, x + checkBoxSprite.normal().width + 5, ((y + getHeight(gui.getMachine()) / 2) - (gui.getTextRenderer().fontHeight / 2)), labelColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
package reborncore.client.gui.builder.slot.elements;
|
package reborncore.client.gui.builder.slot.elements;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
@ -67,12 +68,12 @@ public class ConfigFluidElement extends ElementBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(MatrixStack matrixStack, GuiBase<?> gui) {
|
public void draw(DrawContext drawContext, GuiBase<?> gui) {
|
||||||
super.draw(matrixStack, gui);
|
super.draw(drawContext, gui);
|
||||||
if (isHovering) {
|
if (isHovering) {
|
||||||
drawSprite(matrixStack, gui, type.getButtonHoverOverlay(), x, y);
|
drawSprite(drawContext, gui, type.getButtonHoverOverlay(), x, y);
|
||||||
}
|
}
|
||||||
elements.forEach(elementBase -> elementBase.draw(matrixStack, gui));
|
elements.forEach(elementBase -> elementBase.draw(drawContext, gui));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SlotType getType() {
|
public SlotType getType() {
|
||||||
|
|
|
@ -27,6 +27,7 @@ package reborncore.client.gui.builder.slot.elements;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.inventory.Inventory;
|
import net.minecraft.inventory.Inventory;
|
||||||
|
@ -103,25 +104,18 @@ public class ConfigSlotElement extends ElementBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(MatrixStack matrixStack, GuiBase<?> gui) {
|
public void draw(DrawContext drawContext, GuiBase<?> gui) {
|
||||||
super.draw(matrixStack, gui);
|
super.draw(drawContext, gui);
|
||||||
ItemStack stack = inventory.getStack(id);
|
ItemStack stack = inventory.getStack(id);
|
||||||
int xPos = x + 1 + gui.getGuiLeft();
|
int xPos = x + 1 + gui.getGuiLeft();
|
||||||
int yPos = y + 1 + gui.getGuiTop();
|
int yPos = y + 1 + gui.getGuiTop();
|
||||||
|
|
||||||
RenderSystem.enableDepthTest();
|
drawContext.drawItemInSlot(gui.getTextRenderer(), stack, xPos, yPos);
|
||||||
matrixStack.push();
|
|
||||||
RenderSystem.enableBlend();
|
|
||||||
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
|
||||||
ItemRenderer renderItem = MinecraftClient.getInstance().getItemRenderer();
|
|
||||||
renderItem.renderInGuiWithOverrides(matrixStack, stack, xPos, yPos);
|
|
||||||
renderItem.renderGuiItemOverlay(matrixStack, gui.getTextRenderer(), stack, xPos, yPos, null);
|
|
||||||
RenderSystem.disableDepthTest();
|
|
||||||
matrixStack.pop();
|
|
||||||
if (isHovering) {
|
if (isHovering) {
|
||||||
drawSprite(matrixStack, gui, type.getButtonHoverOverlay(), x, y);
|
drawSprite(drawContext, gui, type.getButtonHoverOverlay(), x, y);
|
||||||
}
|
}
|
||||||
elements.forEach(elementBase -> elementBase.draw(matrixStack, gui));
|
elements.forEach(elementBase -> elementBase.draw(drawContext, gui));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SlotType getType() {
|
public SlotType getType() {
|
||||||
|
|
|
@ -27,6 +27,7 @@ package reborncore.client.gui.builder.slot.elements;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
@ -125,9 +126,9 @@ public class ElementBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(MatrixStack matrixStack, GuiBase<?> gui) {
|
public void draw(DrawContext drawContext, GuiBase<?> gui) {
|
||||||
for (OffsetSprite sprite : getSpriteContainer().offsetSprites) {
|
for (OffsetSprite sprite : getSpriteContainer().offsetSprites) {
|
||||||
drawSprite(matrixStack, gui, sprite.getSprite(), x + sprite.getOffsetX(gui.getMachine()), y + sprite.getOffsetY(gui.getMachine()));
|
drawSprite(drawContext, gui, sprite.getSprite(), x + sprite.getOffsetX(gui.getMachine()), y + sprite.getOffsetY(gui.getMachine()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,33 +295,21 @@ public class ElementBase {
|
||||||
return gui.isPointInRect(x + gui.getGuiLeft(), y + gui.getGuiTop(), xSize, ySize, mouseX, mouseY);
|
return gui.isPointInRect(x + gui.getGuiLeft(), y + gui.getGuiTop(), xSize, ySize, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawText(MatrixStack matrixStack, GuiBase<?> gui, Text text, int x, int y, int color) {
|
public void drawText(DrawContext drawContext, GuiBase<?> gui, Text text, int x, int y, int color) {
|
||||||
x = adjustX(gui, x);
|
x = adjustX(gui, x);
|
||||||
y = adjustY(gui, y);
|
y = adjustY(gui, y);
|
||||||
gui.getTextRenderer().draw(matrixStack, text, x, y, color);
|
drawContext.drawText(gui.getTextRenderer(), text, x, y, color, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextureSheet(Identifier textureLocation) {
|
public void drawSprite(DrawContext drawContext, GuiBase<?> gui, ISprite iSprite, int x, int y) {
|
||||||
RenderSystem.setShaderTexture(0, textureLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void drawSprite(MatrixStack matrixStack, GuiBase<?> gui, ISprite iSprite, int x, int y) {
|
|
||||||
Sprite sprite = iSprite.getSprite(gui.getMachine());
|
Sprite sprite = iSprite.getSprite(gui.getMachine());
|
||||||
if (sprite != null) {
|
if (sprite != null) {
|
||||||
if (sprite.hasTextureInfo()) {
|
if (sprite.hasTextureInfo()) {
|
||||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
|
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
|
||||||
setTextureSheet(sprite.textureLocation);
|
drawContext.drawTexture(sprite.textureLocation, x + gui.getGuiLeft(), y + gui.getGuiTop(), sprite.x, sprite.y, sprite.width, sprite.height);
|
||||||
gui.drawTexture(matrixStack, x + gui.getGuiLeft(), y + gui.getGuiTop(), sprite.x, sprite.y, sprite.width, sprite.height);
|
|
||||||
}
|
}
|
||||||
if (sprite.hasStack()) {
|
if (sprite.hasStack()) {
|
||||||
matrixStack.push();
|
drawContext.drawItem(sprite.itemStack, x + gui.getGuiLeft(), y + gui.getGuiTop());
|
||||||
RenderSystem.enableBlend();
|
|
||||||
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
ItemRenderer itemRenderer = MinecraftClient.getInstance().getItemRenderer();
|
|
||||||
itemRenderer.renderInGuiWithOverrides(matrixStack, sprite.itemStack, x + gui.getGuiLeft(), y + gui.getGuiTop());
|
|
||||||
|
|
||||||
matrixStack.pop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,12 +325,10 @@ public class ElementBase {
|
||||||
return (int) ((CurrentValue * 100.0f) / MaxValue);
|
return (int) ((CurrentValue * 100.0f) / MaxValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawDefaultBackground(MatrixStack matrixStack, Screen gui, int x, int y, int width, int height) {
|
public void drawDefaultBackground(DrawContext drawContext, Screen gui, int x, int y, int width, int height) {
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y, 0, 0, width / 2, height / 2);
|
||||||
RenderSystem.setShaderTexture(0, GuiBuilder.defaultTextureSheet);
|
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x + width / 2, y, 150 - width / 2, 0, width / 2, height / 2);
|
||||||
gui.drawTexture(matrixStack, x, y, 0, 0, width / 2, height / 2);
|
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y + height / 2, 0, 150 - height / 2, width / 2, height / 2);
|
||||||
gui.drawTexture(matrixStack, x + width / 2, y, 150 - width / 2, 0, width / 2, height / 2);
|
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x + width / 2, y + height / 2, 150 - width / 2, 150 - height / 2, width / 2, height / 2);
|
||||||
gui.drawTexture(matrixStack, x, y + height / 2, 0, 150 - height / 2, width / 2, height / 2);
|
|
||||||
gui.drawTexture(matrixStack, x + width / 2, y + height / 2, 150 - width / 2, 150 - height / 2, width / 2, height / 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ package reborncore.client.gui.builder.slot.elements;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.Tessellator;
|
import net.minecraft.client.render.Tessellator;
|
||||||
|
@ -63,9 +64,9 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(MatrixStack matrixStack, GuiBase<?> gui) {
|
public void draw(DrawContext drawContext, GuiBase<?> gui) {
|
||||||
drawDefaultBackground(matrixStack, gui, adjustX(gui, getX() - 8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0));
|
drawDefaultBackground(drawContext, gui, adjustX(gui, getX() - 8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0));
|
||||||
super.draw(matrixStack, gui);
|
super.draw(drawContext, gui);
|
||||||
|
|
||||||
MachineBaseBlockEntity machine = ((MachineBaseBlockEntity) gui.be);
|
MachineBaseBlockEntity machine = ((MachineBaseBlockEntity) gui.be);
|
||||||
World world = machine.getWorld();
|
World world = machine.getWorld();
|
||||||
|
@ -82,12 +83,12 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
|
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, RotationAxis.POSITIVE_Y.rotationDegrees(180F)); //back
|
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, RotationAxis.POSITIVE_Y.rotationDegrees(180F)); //back
|
||||||
|
|
||||||
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.UP.getFacing(machine), 22, -1, gui);
|
drawSateColor(drawContext, gui.getMachine(), MachineFacing.UP.getFacing(machine), 22, -1, gui);
|
||||||
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), 22, 18, gui);
|
drawSateColor(drawContext, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), 22, 18, gui);
|
||||||
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.DOWN.getFacing(machine), 22, 37, gui);
|
drawSateColor(drawContext, gui.getMachine(), MachineFacing.DOWN.getFacing(machine), 22, 37, gui);
|
||||||
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.RIGHT.getFacing(machine), 41, 18, gui);
|
drawSateColor(drawContext, gui.getMachine(), MachineFacing.RIGHT.getFacing(machine), 41, 18, gui);
|
||||||
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.BACK.getFacing(machine), 41, 37, gui);
|
drawSateColor(drawContext, gui.getMachine(), MachineFacing.BACK.getFacing(machine), 41, 37, gui);
|
||||||
drawSateColor(matrixStack, gui.getMachine(), MachineFacing.LEFT.getFacing(machine), 3, 18, gui);
|
drawSateColor(drawContext, gui.getMachine(), MachineFacing.LEFT.getFacing(machine), 3, 18, gui);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -142,7 +143,7 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
return super.onHover(provider, gui, mouseX, mouseY);
|
return super.onHover(provider, gui, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSateColor(MatrixStack matrices, MachineBaseBlockEntity machineBase, Direction side, int inx, int iny, GuiBase<?> gui) {
|
private void drawSateColor(DrawContext drawContext, MachineBaseBlockEntity machineBase, Direction side, int inx, int iny, GuiBase<?> gui) {
|
||||||
iny += 4;
|
iny += 4;
|
||||||
int sx = inx + getX() + gui.getGuiLeft();
|
int sx = inx + getX() + gui.getGuiLeft();
|
||||||
int sy = iny + getY() + gui.getGuiTop();
|
int sy = iny + getY() + gui.getGuiTop();
|
||||||
|
@ -159,7 +160,7 @@ public class FluidConfigPopupElement extends ElementBase {
|
||||||
case ALL -> new Color(52, 255, 30, 128);
|
case ALL -> new Color(52, 255, 30, 128);
|
||||||
};
|
};
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
GuiUtil.drawGradientRect(matrices, sx, sy, 18, 18, color.getColor(), color.getColor());
|
GuiUtil.drawGradientRect(drawContext.getMatrices(), sx, sy, 18, 18, color.getColor(), color.getColor());
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ package reborncore.client.gui.builder.slot.elements;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.Tessellator;
|
import net.minecraft.client.render.Tessellator;
|
||||||
|
@ -67,9 +68,9 @@ public class SlotConfigPopupElement extends ElementBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(MatrixStack matrixStack, GuiBase<?> gui) {
|
public void draw(DrawContext drawContext, GuiBase<?> gui) {
|
||||||
drawDefaultBackground(matrixStack, gui, adjustX(gui, getX() - 8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0));
|
drawDefaultBackground(drawContext, gui, adjustX(gui, getX() - 8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0));
|
||||||
super.draw(matrixStack, gui);
|
super.draw(drawContext, gui);
|
||||||
|
|
||||||
MachineBaseBlockEntity machine = ((MachineBaseBlockEntity) gui.be);
|
MachineBaseBlockEntity machine = ((MachineBaseBlockEntity) gui.be);
|
||||||
World world = machine.getWorld();
|
World world = machine.getWorld();
|
||||||
|
@ -86,12 +87,12 @@ public class SlotConfigPopupElement extends ElementBase {
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
|
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, RotationAxis.POSITIVE_Y.rotationDegrees(90F)); //right
|
||||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, RotationAxis.POSITIVE_Y.rotationDegrees(180F)); //back
|
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, RotationAxis.POSITIVE_Y.rotationDegrees(180F)); //back
|
||||||
|
|
||||||
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.UP.getFacing(machine), id, 22, -1, gui);
|
drawSlotSateColor(drawContext, gui.getMachine(), MachineFacing.UP.getFacing(machine), id, 22, -1, gui);
|
||||||
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), id, 22, 18, gui);
|
drawSlotSateColor(drawContext, gui.getMachine(), MachineFacing.FRONT.getFacing(machine), id, 22, 18, gui);
|
||||||
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.DOWN.getFacing(machine), id, 22, 37, gui);
|
drawSlotSateColor(drawContext, gui.getMachine(), MachineFacing.DOWN.getFacing(machine), id, 22, 37, gui);
|
||||||
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.RIGHT.getFacing(machine), id, 41, 18, gui);
|
drawSlotSateColor(drawContext, gui.getMachine(), MachineFacing.RIGHT.getFacing(machine), id, 41, 18, gui);
|
||||||
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.BACK.getFacing(machine), id, 41, 37, gui);
|
drawSlotSateColor(drawContext, gui.getMachine(), MachineFacing.BACK.getFacing(machine), id, 41, 37, gui);
|
||||||
drawSlotSateColor(matrixStack, gui.getMachine(), MachineFacing.LEFT.getFacing(machine), id, 3, 18, gui);
|
drawSlotSateColor(drawContext, gui.getMachine(), MachineFacing.LEFT.getFacing(machine), id, 3, 18, gui);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -148,7 +149,7 @@ public class SlotConfigPopupElement extends ElementBase {
|
||||||
ClientNetworkManager.sendToServer(packetSlotSave);
|
ClientNetworkManager.sendToServer(packetSlotSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSlotSateColor(MatrixStack matrices, MachineBaseBlockEntity machineBase, Direction side, int slotID, int inx, int iny, GuiBase<?> gui) {
|
private void drawSlotSateColor(DrawContext drawContext, MachineBaseBlockEntity machineBase, Direction side, int slotID, int inx, int iny, GuiBase<?> gui) {
|
||||||
iny += 4;
|
iny += 4;
|
||||||
int sx = inx + getX() + gui.getGuiLeft();
|
int sx = inx + getX() + gui.getGuiLeft();
|
||||||
int sy = iny + getY() + gui.getGuiTop();
|
int sy = iny + getY() + gui.getGuiTop();
|
||||||
|
@ -164,7 +165,7 @@ public class SlotConfigPopupElement extends ElementBase {
|
||||||
default -> new Color(0, 0, 0, 0);
|
default -> new Color(0, 0, 0, 0);
|
||||||
};
|
};
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GuiUtil.drawGradientRect(matrices, sx, sy, 18, 18, color.getColor(), color.getColor());
|
GuiUtil.drawGradientRect(drawContext.getMatrices(), sx, sy, 18, 18, color.getColor(), color.getColor());
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
package reborncore.client.gui.builder.widget;
|
package reborncore.client.gui.builder.widget;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
@ -44,7 +45,7 @@ public class GuiButtonHologram extends GuiButtonExtended {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
public void render(DrawContext drawContext, int mouseX, int mouseY, float partialTicks) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,8 @@
|
||||||
|
|
||||||
package reborncore.client.gui.builder.widget;
|
package reborncore.client.gui.builder.widget;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
|
||||||
|
@ -45,24 +44,13 @@ public class GuiButtonUpDown extends GuiButtonExtended {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
public void renderButton(DrawContext drawContext, int mouseX, int mouseY, float partialTicks) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
RenderSystem.setShaderTexture(0, gui.builder.getResourceLocation());
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FASTFORWARD:
|
case FASTFORWARD -> drawContext.drawTexture(gui.builder.getResourceLocation(), getX(), getY(), 174, 74, 12, 12);
|
||||||
gui.drawTexture(matrixStack, getX(), getY(), 174, 74, 12, 12);
|
case FORWARD -> drawContext.drawTexture(gui.builder.getResourceLocation(), getX(), getY(), 174, 86, 12, 12);
|
||||||
break;
|
case REWIND -> drawContext.drawTexture(gui.builder.getResourceLocation(), getX(), getY(), 174, 98, 12, 12);
|
||||||
case FORWARD:
|
case FASTREWIND -> drawContext.drawTexture(gui.builder.getResourceLocation(), getX(), getY(), 174, 110, 12, 12);
|
||||||
gui.drawTexture(matrixStack, getX(), getY(), 174, 86, 12, 12);
|
|
||||||
break;
|
|
||||||
case REWIND:
|
|
||||||
gui.drawTexture(matrixStack, getX(), getY(), 174, 98, 12, 12);
|
|
||||||
break;
|
|
||||||
case FASTREWIND:
|
|
||||||
gui.drawTexture(matrixStack, getX(), getY(), 174, 110, 12, 12);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRendering;
|
import net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRendering;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawableHelper;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||||
import net.minecraft.client.gui.widget.EntryListWidget;
|
import net.minecraft.client.gui.widget.EntryListWidget;
|
||||||
|
@ -38,7 +38,6 @@ import net.minecraft.client.render.Tessellator;
|
||||||
import net.minecraft.client.render.VertexFormat;
|
import net.minecraft.client.render.VertexFormat;
|
||||||
import net.minecraft.client.render.VertexFormats;
|
import net.minecraft.client.render.VertexFormats;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
|
@ -80,17 +79,15 @@ public class GuiBuilder {
|
||||||
return resourceLocation;
|
return resourceLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawDefaultBackground(MatrixStack matrixStack, Screen gui, int x, int y, int width, int height) {
|
public void drawDefaultBackground(DrawContext drawContext, Screen gui, int x, int y, int width, int height) {
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
drawContext.drawTexture(resourceLocation, x, y, 0, 0, width / 2, height / 2);
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
drawContext.drawTexture(resourceLocation, x + width / 2, y, 150 - width / 2, 0, width / 2, height / 2);
|
||||||
gui.drawTexture(matrixStack, x, y, 0, 0, width / 2, height / 2);
|
drawContext.drawTexture(resourceLocation, x, y + height / 2, 0, 150 - height / 2, width / 2, height / 2);
|
||||||
gui.drawTexture(matrixStack, x + width / 2, y, 150 - width / 2, 0, width / 2, height / 2);
|
drawContext.drawTexture(resourceLocation, x + width / 2, y + height / 2, 150 - width / 2, 150 - height / 2, width / 2,
|
||||||
gui.drawTexture(matrixStack, x, y + height / 2, 0, 150 - height / 2, width / 2, height / 2);
|
|
||||||
gui.drawTexture(matrixStack, x + width / 2, y + height / 2, 150 - width / 2, 150 - height / 2, width / 2,
|
|
||||||
height / 2);
|
height / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawPlayerSlots(MatrixStack matrixStack, Screen gui, int posX, int posY, boolean center) {
|
public void drawPlayerSlots(DrawContext drawContext, Screen gui, int posX, int posY, boolean center) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
|
|
||||||
if (center) {
|
if (center) {
|
||||||
|
@ -99,36 +96,36 @@ public class GuiBuilder {
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
for (int y = 0; y < 3; y++) {
|
||||||
for (int x = 0; x < 9; x++) {
|
for (int x = 0; x < 9; x++) {
|
||||||
gui.drawTexture(matrixStack, posX + x * 18, posY + y * 18, 150, 0, 18, 18);
|
drawContext.drawTexture(resourceLocation, posX + x * 18, posY + y * 18, 150, 0, 18, 18);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < 9; x++) {
|
for (int x = 0; x < 9; x++) {
|
||||||
gui.drawTexture(matrixStack, posX + x * 18, posY + 58, 150, 0, 18, 18);
|
drawContext.drawTexture(resourceLocation, posX + x * 18, posY + 58, 150, 0, 18, 18);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawSlot(MatrixStack matrixStack, Screen gui, int posX, int posY) {
|
public void drawSlot(DrawContext drawContext, Screen gui, int posX, int posY) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, posX, posY, 150, 0, 18, 18);
|
drawContext.drawTexture(resourceLocation, posX, posY, 150, 0, 18, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawText(MatrixStack matrixStack, GuiBase<?> gui, Text text, int x, int y, int color) {
|
public void drawText(DrawContext drawContext, GuiBase<?> gui, Text text, int x, int y, int color) {
|
||||||
gui.getTextRenderer().draw(matrixStack, text, x, y, color);
|
drawContext.drawText(gui.getTextRenderer(), text, x, y, color, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawProgressBar(MatrixStack matrixStack, GuiBase<?> gui, double progress, int x, int y) {
|
public void drawProgressBar(DrawContext drawContext, GuiBase<?> gui, double progress, int x, int y) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 150, 18, 22, 15);
|
drawContext.drawTexture(resourceLocation, x, y, 150, 18, 22, 15);
|
||||||
int j = (int) (progress);
|
int j = (int) (progress);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
gui.drawTexture(matrixStack, x, y, 150, 34, j + 1, 15);
|
drawContext.drawTexture(resourceLocation, x, y, 150, 34, j + 1, 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawOutputSlot(MatrixStack matrixStack, GuiBase<?> gui, int x, int y) {
|
public void drawOutputSlot(DrawContext drawContext, GuiBase<?> gui, int x, int y) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 174, 0, 26, 26);
|
drawContext.drawTexture(resourceLocation, x, y, 174, 0, 26, 26);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +136,7 @@ public class GuiBuilder {
|
||||||
* @param y {@code int} Top left corner where to place button
|
* @param y {@code int} Top left corner where to place button
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawJEIButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, GuiBase.Layer layer) {
|
public void drawJEIButton(DrawContext drawContext, GuiBase<?> gui, int x, int y, GuiBase.Layer layer) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
if (FabricLoader.getInstance().isModLoaded("jei")) {
|
if (FabricLoader.getInstance().isModLoaded("jei")) {
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
|
@ -147,7 +144,7 @@ public class GuiBuilder {
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 202, 0, 12, 12);
|
drawContext.drawTexture(resourceLocation, x, y, 202, 0, 12, 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,14 +159,14 @@ public class GuiBuilder {
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
* @param locked {@code boolean} Set to true if it is in locked state
|
* @param locked {@code boolean} Set to true if it is in locked state
|
||||||
*/
|
*/
|
||||||
public void drawLockButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer, boolean locked) {
|
public void drawLockButton(DrawContext drawContext, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer, boolean locked) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 174, 26 + (locked ? 12 : 0), 20, 12);
|
drawContext.drawTexture(resourceLocation, x, y, 174, 26 + (locked ? 12 : 0), 20, 12);
|
||||||
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
|
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
|
||||||
List<Text> list = new ArrayList<>();
|
List<Text> list = new ArrayList<>();
|
||||||
if (locked) {
|
if (locked) {
|
||||||
|
@ -177,9 +174,7 @@ public class GuiBuilder {
|
||||||
} else {
|
} else {
|
||||||
list.add(Text.translatable("reborncore.gui.tooltip.lock_items"));
|
list.add(Text.translatable("reborncore.gui.tooltip.lock_items"));
|
||||||
}
|
}
|
||||||
matrixStack.push();
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
gui.renderTooltip(matrixStack, list, mouseX, mouseY);
|
|
||||||
matrixStack.pop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +188,7 @@ public class GuiBuilder {
|
||||||
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawHologramButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
|
public void drawHologramButton(DrawContext drawContext, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
|
||||||
if (gui.isTabOpen()) return;
|
if (gui.isTabOpen()) return;
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
|
@ -201,20 +196,18 @@ public class GuiBuilder {
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
if (gui.getMachine().renderMultiblock) {
|
if (gui.getMachine().renderMultiblock) {
|
||||||
gui.drawTexture(matrixStack, x, y, 174, 62, 20, 12);
|
drawContext.drawTexture(resourceLocation, x, y, 174, 62, 20, 12);
|
||||||
} else {
|
} else {
|
||||||
gui.drawTexture(matrixStack, x, y, 174, 50, 20, 12);
|
drawContext.drawTexture(resourceLocation, x, y, 174, 50, 20, 12);
|
||||||
}
|
}
|
||||||
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
|
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
|
||||||
List<Text> list = new ArrayList<>();
|
List<Text> list = new ArrayList<>();
|
||||||
list.add(Text.translatable("reborncore.gui.tooltip.hologram"));
|
list.add(Text.translatable("reborncore.gui.tooltip.hologram"));
|
||||||
matrixStack.push();
|
|
||||||
if (layer == GuiBase.Layer.FOREGROUND) {
|
if (layer == GuiBase.Layer.FOREGROUND) {
|
||||||
mouseX -= gui.getGuiLeft();
|
mouseX -= gui.getGuiLeft();
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
gui.renderTooltip(matrixStack, list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
matrixStack.pop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,25 +221,25 @@ public class GuiBuilder {
|
||||||
* @param max {@code int} Maximum heat value
|
* @param max {@code int} Maximum heat value
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawBigHeatBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, GuiBase.Layer layer) {
|
public void drawBigHeatBar(DrawContext drawContext, GuiBase<?> gui, int x, int y, int value, int max, GuiBase.Layer layer) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 26, 218, 114, 18);
|
drawContext.drawTexture(resourceLocation, x, y, 26, 218, 114, 18);
|
||||||
if (value != 0) {
|
if (value != 0) {
|
||||||
int j = (int) ((double) value / (double) max * 106);
|
int j = (int) ((double) value / (double) max * 106);
|
||||||
if (j < 0) {
|
if (j < 0) {
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
gui.drawTexture(matrixStack, x + 4, y + 4, 26, 246, j, 10);
|
drawContext.drawTexture(resourceLocation, x + 4, y + 4, 26, 246, j, 10);
|
||||||
|
|
||||||
Text text = Text.literal(String.valueOf(value))
|
Text text = Text.literal(String.valueOf(value))
|
||||||
.append(Text.translatable("reborncore.gui.heat"));
|
.append(Text.translatable("reborncore.gui.heat"));
|
||||||
|
|
||||||
gui.drawCentredText(matrixStack, text, y + 5, 0xFFFFFF, layer);
|
gui.drawCentredText(drawContext, text, y + 5, 0xFFFFFF, layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +258,7 @@ public class GuiBuilder {
|
||||||
* @param format {@link String} Formatted value to put on the bar
|
* @param format {@link String} Formatted value to put on the bar
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawBigBlueBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, Text line2, String format, GuiBase.Layer layer) {
|
public void drawBigBlueBar(DrawContext drawContext, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, Text line2, String format, GuiBase.Layer layer) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
|
@ -276,11 +269,11 @@ public class GuiBuilder {
|
||||||
if (j < 0) {
|
if (j < 0) {
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
gui.drawTexture(matrixStack, x + 4, y + 4, 0, 236, j, 10);
|
drawContext.drawTexture(resourceLocation, x + 4, y + 4, 0, 236, j, 10);
|
||||||
if (!suffix.equals("")) {
|
if (!suffix.equals("")) {
|
||||||
suffix = " " + suffix;
|
suffix = " " + suffix;
|
||||||
}
|
}
|
||||||
gui.drawCentredText(matrixStack, Text.literal(format).append(suffix), y + 5, 0xFFFFFF, layer);
|
gui.drawCentredText(drawContext, Text.literal(format).append(suffix), y + 5, 0xFFFFFF, layer);
|
||||||
if (gui.isPointInRect(x, y, 114, 18, mouseX, mouseY)) {
|
if (gui.isPointInRect(x, y, 114, 18, mouseX, mouseY)) {
|
||||||
int percentage = percentage(max, value);
|
int percentage = percentage(max, value);
|
||||||
List<Text> list = new ArrayList<>();
|
List<Text> list = new ArrayList<>();
|
||||||
|
@ -323,19 +316,19 @@ public class GuiBuilder {
|
||||||
mouseX -= gui.getGuiLeft();
|
mouseX -= gui.getGuiLeft();
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
gui.renderTooltip(matrixStack, list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
//RenderSystem.disableLighting();
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawBigBlueBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) {
|
public void drawBigBlueBar(DrawContext drawContext, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) {
|
||||||
drawBigBlueBar(matrixStack, gui, x, y, value, max, mouseX, mouseY, suffix, Text.empty(), Integer.toString(value), layer);
|
drawBigBlueBar(drawContext, gui, x, y, value, max, mouseX, mouseY, suffix, Text.empty(), Integer.toString(value), layer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawBigBlueBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, GuiBase.Layer layer) {
|
public void drawBigBlueBar(DrawContext drawContext, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, GuiBase.Layer layer) {
|
||||||
drawBigBlueBar(matrixStack, gui, x, y, value, max, mouseX, mouseY, "", Text.empty(), "", layer);
|
drawBigBlueBar(drawContext, gui, x, y, value, max, mouseX, mouseY, "", Text.empty(), "", layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -344,7 +337,7 @@ public class GuiBuilder {
|
||||||
* @param gui {@link GuiBase} The GUI to draw on
|
* @param gui {@link GuiBase} The GUI to draw on
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawMultiblockMissingBar(MatrixStack matrixStack, GuiBase<?> gui, GuiBase.Layer layer) {
|
public void drawMultiblockMissingBar(DrawContext drawContext, GuiBase<?> gui, GuiBase.Layer layer) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 4;
|
int y = 4;
|
||||||
|
@ -355,12 +348,12 @@ public class GuiBuilder {
|
||||||
//RenderSystem.disableLighting();
|
//RenderSystem.disableLighting();
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest();
|
||||||
RenderSystem.colorMask(true, true, true, false);
|
RenderSystem.colorMask(true, true, true, false);
|
||||||
RenderUtil.drawGradientRect(matrixStack, 0, x, y, x + 176, y + 20, 0x000000, 0xC0000000);
|
RenderUtil.drawGradientRect(drawContext.getMatrices(), 0, x, y, x + 176, y + 20, 0x000000, 0xC0000000);
|
||||||
RenderUtil.drawGradientRect(matrixStack, 0, x, y + 20, x + 176, y + 20 + 48, 0xC0000000, 0xC0000000);
|
RenderUtil.drawGradientRect(drawContext.getMatrices(), 0, x, y + 20, x + 176, y + 20 + 48, 0xC0000000, 0xC0000000);
|
||||||
RenderUtil.drawGradientRect(matrixStack, 0, x, y + 68, x + 176, y + 70 + 20, 0xC0000000, 0x00000000);
|
RenderUtil.drawGradientRect(drawContext.getMatrices(), 0, x, y + 68, x + 176, y + 70 + 20, 0xC0000000, 0x00000000);
|
||||||
RenderSystem.colorMask(true, true, true, true);
|
RenderSystem.colorMask(true, true, true, true);
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
gui.drawCentredText(matrixStack, Text.translatable("reborncore.gui.missingmultiblock"), 43, 0xFFFFFF, layer);
|
gui.drawCentredText(drawContext, Text.translatable("reborncore.gui.missingmultiblock"), 43, 0xFFFFFF, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,9 +364,9 @@ public class GuiBuilder {
|
||||||
* @param x {@code int} Top left corner where to place slots
|
* @param x {@code int} Top left corner where to place slots
|
||||||
* @param y {@code int} Top left corner where to place slots
|
* @param y {@code int} Top left corner where to place slots
|
||||||
*/
|
*/
|
||||||
public void drawUpgrades(MatrixStack matrixStack, GuiBase<?> gui, int x, int y) {
|
public void drawUpgrades(DrawContext drawContext, GuiBase<?> gui, int x, int y) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 217, 0, 24, 81);
|
drawContext.drawTexture(resourceLocation, x, y, 217, 0, 24, 81);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -384,10 +377,9 @@ public class GuiBuilder {
|
||||||
* @param y {@code int} Top left corner where to place tab
|
* @param y {@code int} Top left corner where to place tab
|
||||||
* @param stack {@link ItemStack} Item to show as tab icon
|
* @param stack {@link ItemStack} Item to show as tab icon
|
||||||
*/
|
*/
|
||||||
public void drawSlotTab(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, ItemStack stack) {
|
public void drawSlotTab(DrawContext drawContext, GuiBase<?> gui, int x, int y, ItemStack stack) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
drawContext.drawTexture(resourceLocation, x, y, 217, 82, 24, 24);
|
||||||
gui.drawTexture(matrixStack, x, y, 217, 82, 24, 24);
|
drawContext.drawItem(stack, x + 5, y + 4);
|
||||||
gui.getMinecraft().getItemRenderer().renderInGuiWithOverrides(matrixStack, stack, x + 5, y + 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -400,14 +392,14 @@ public class GuiBuilder {
|
||||||
* @param mouseX {@code int} Mouse cursor position
|
* @param mouseX {@code int} Mouse cursor position
|
||||||
* @param mouseY {@code int} Mouse cursor position
|
* @param mouseY {@code int} Mouse cursor position
|
||||||
*/
|
*/
|
||||||
public void drawSlotConfigTips(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiTab guiTab) {
|
public void drawSlotConfigTips(DrawContext drawContext, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiTab guiTab) {
|
||||||
List<Text> tips = guiTab.getTips().stream()
|
List<Text> tips = guiTab.getTips().stream()
|
||||||
.map(Text::translatable)
|
.map(Text::translatable)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
TipsListWidget explanation = new TipsListWidget(gui, gui.getScreenWidth() - 14, 54, y, y + 76, 9 + 2, tips);
|
TipsListWidget explanation = new TipsListWidget(gui, gui.getScreenWidth() - 14, 54, y, y + 76, 9 + 2, tips);
|
||||||
explanation.setLeftPos(x - 81);
|
explanation.setLeftPos(x - 81);
|
||||||
explanation.render(matrixStack, mouseX, mouseY, 1.0f);
|
explanation.render(drawContext, mouseX, mouseY, 1.0f);
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,15 +419,15 @@ public class GuiBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBackground(MatrixStack matrixStack) {
|
protected void renderBackground(DrawContext drawContext) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||||
RenderSystem.setShaderTexture(0, OPTIONS_BACKGROUND_TEXTURE);
|
RenderSystem.setShaderTexture(0, Screen.OPTIONS_BACKGROUND_TEXTURE);
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
||||||
bufferBuilder.vertex(this.left, this.bottom, 0.0D).texture((float) this.left / 32.0F, (float) (this.bottom + (int) this.getScrollAmount()) / 32.0F).color(32, 32, 32, 255).next();
|
bufferBuilder.vertex(this.left, this.bottom, 0.0D).texture((float) this.left / 32.0F, (float) (this.bottom + (int) this.getScrollAmount()) / 32.0F).color(32, 32, 32, 255).next();
|
||||||
|
@ -444,7 +436,7 @@ public class GuiBuilder {
|
||||||
bufferBuilder.vertex(this.left, this.top, 0.0D).texture((float) this.left / 32.0F, (float) (this.top + (int) this.getScrollAmount()) / 32.0F).color(32, 32, 32, 255).next();
|
bufferBuilder.vertex(this.left, this.top, 0.0D).texture((float) this.left / 32.0F, (float) (this.top + (int) this.getScrollAmount()) / 32.0F).color(32, 32, 32, 255).next();
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
|
|
||||||
super.renderList(matrices, mouseX, mouseY, delta);
|
super.renderList(drawContext, mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -460,8 +452,8 @@ public class GuiBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrixStack, int index, int y, int x, int width, int height, int mouseX, int mouseY, boolean hovering, float delta) {
|
public void render(DrawContext drawContext, int index, int y, int x, int width, int height, int mouseX, int mouseY, boolean hovering, float delta) {
|
||||||
MinecraftClient.getInstance().textRenderer.drawTrimmed(matrixStack, tip, x, y, width, 11184810);
|
drawContext.drawTooltip(MinecraftClient.getInstance().textRenderer, tip, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,7 +469,7 @@ public class GuiBuilder {
|
||||||
* @param maxOutput {@code int} Energy output value
|
* @param maxOutput {@code int} Energy output value
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawEnergyOutput(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int maxOutput, GuiBase.Layer layer) {
|
public void drawEnergyOutput(DrawContext drawContext, GuiBase<?> gui, int x, int y, int maxOutput, GuiBase.Layer layer) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(maxOutput))
|
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(maxOutput))
|
||||||
.append(SPACE_TEXT)
|
.append(SPACE_TEXT)
|
||||||
|
@ -485,13 +477,13 @@ public class GuiBuilder {
|
||||||
.append("\t");
|
.append("\t");
|
||||||
|
|
||||||
int width = gui.getTextRenderer().getWidth(text);
|
int width = gui.getTextRenderer().getWidth(text);
|
||||||
gui.drawText(matrixStack, text, x - width - 2, y + 5, 0, layer);
|
gui.drawText(drawContext, text, x - width - 2, y + 5, 0, layer);
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 150, 91, 16, 16);
|
drawContext.drawTexture(resourceLocation, x, y, 150, 91, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -507,7 +499,7 @@ public class GuiBuilder {
|
||||||
* @param direction {@link ProgressDirection} Direction of the progress arrow
|
* @param direction {@link ProgressDirection} Direction of the progress arrow
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawProgressBar(MatrixStack matrixStack, GuiBase<?> gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, ProgressDirection direction, GuiBase.Layer layer) {
|
public void drawProgressBar(DrawContext drawContext, GuiBase<?> gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, ProgressDirection direction, GuiBase.Layer layer) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
|
@ -515,7 +507,7 @@ public class GuiBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, direction.x, direction.y, direction.width, direction.height);
|
drawContext.drawTexture(resourceLocation, x, y, direction.x, direction.y, direction.width, direction.height);
|
||||||
int j = (int) ((double) progress / (double) maxProgress * 16);
|
int j = (int) ((double) progress / (double) maxProgress * 16);
|
||||||
if (j < 0) {
|
if (j < 0) {
|
||||||
j = 0;
|
j = 0;
|
||||||
|
@ -523,16 +515,16 @@ public class GuiBuilder {
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
gui.drawTexture(matrixStack, x, y, direction.xActive, direction.yActive, j, 10);
|
drawContext.drawTexture(resourceLocation, x, y, direction.xActive, direction.yActive, j, 10);
|
||||||
break;
|
break;
|
||||||
case LEFT:
|
case LEFT:
|
||||||
gui.drawTexture(matrixStack, x + 16 - j, y, direction.xActive + 16 - j, direction.yActive, j, 10);
|
drawContext.drawTexture(resourceLocation, x + 16 - j, y, direction.xActive + 16 - j, direction.yActive, j, 10);
|
||||||
break;
|
break;
|
||||||
case UP:
|
case UP:
|
||||||
gui.drawTexture(matrixStack, x, y + 16 - j, direction.xActive, direction.yActive + 16 - j, 10, j);
|
drawContext.drawTexture(resourceLocation, x, y + 16 - j, direction.xActive, direction.yActive + 16 - j, 10, j);
|
||||||
break;
|
break;
|
||||||
case DOWN:
|
case DOWN:
|
||||||
gui.drawTexture(matrixStack, x, y, direction.xActive, direction.yActive, 10, j);
|
drawContext.drawTexture(resourceLocation, x, y, direction.xActive, direction.yActive, 10, j);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
@ -550,7 +542,7 @@ public class GuiBuilder {
|
||||||
mouseX -= gui.getGuiLeft();
|
mouseX -= gui.getGuiLeft();
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
gui.renderTooltip(matrixStack, list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
//RenderSystem.disableLighting();
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -569,7 +561,7 @@ public class GuiBuilder {
|
||||||
* @param buttonID {@code int} Button ID used to switch energy systems
|
* @param buttonID {@code int} Button ID used to switch energy systems
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawMultiEnergyBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, long energyStored, long maxEnergyStored, int mouseX,
|
public void drawMultiEnergyBar(DrawContext drawContext, GuiBase<?> gui, int x, int y, long energyStored, long maxEnergyStored, int mouseX,
|
||||||
int mouseY, int buttonID, GuiBase.Layer layer) {
|
int mouseY, int buttonID, GuiBase.Layer layer) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
|
@ -579,12 +571,12 @@ public class GuiBuilder {
|
||||||
|
|
||||||
EnergySystem displayPower = PowerSystem.getDisplayPower();
|
EnergySystem displayPower = PowerSystem.getDisplayPower();
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, displayPower.xBar - 15, displayPower.yBar - 1, 14, 50);
|
drawContext.drawTexture(resourceLocation, x, y, displayPower.xBar - 15, displayPower.yBar - 1, 14, 50);
|
||||||
int draw = (int) ((double) energyStored / (double) maxEnergyStored * (48));
|
int draw = (int) ((double) energyStored / (double) maxEnergyStored * (48));
|
||||||
if (energyStored > maxEnergyStored) {
|
if (energyStored > maxEnergyStored) {
|
||||||
draw = 48;
|
draw = 48;
|
||||||
}
|
}
|
||||||
gui.drawTexture(matrixStack, x + 1, y + 49 - draw, displayPower.xBar, 48 + displayPower.yBar - draw, 12, draw);
|
drawContext.drawTexture(resourceLocation, x + 1, y + 49 - draw, displayPower.xBar, 48 + displayPower.yBar - draw, 12, draw);
|
||||||
int percentage = percentage(maxEnergyStored, energyStored);
|
int percentage = percentage(maxEnergyStored, energyStored);
|
||||||
if (gui.isPointInRect(x + 1, y + 1, 11, 48, mouseX, mouseY)) {
|
if (gui.isPointInRect(x + 1, y + 1, 11, 48, mouseX, mouseY)) {
|
||||||
List<Text> list = Lists.newArrayList();
|
List<Text> list = Lists.newArrayList();
|
||||||
|
@ -631,7 +623,7 @@ public class GuiBuilder {
|
||||||
mouseX -= gui.getGuiLeft();
|
mouseX -= gui.getGuiLeft();
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
gui.renderTooltip(matrixStack, list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
//RenderSystem.disableLighting();
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -650,7 +642,7 @@ public class GuiBuilder {
|
||||||
* @param isTankEmpty {@code boolean} True if tank is empty
|
* @param isTankEmpty {@code boolean} True if tank is empty
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawTank(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, FluidInstance fluid, FluidValue maxCapacity, boolean isTankEmpty, GuiBase.Layer layer) {
|
public void drawTank(DrawContext drawContext, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, FluidInstance fluid, FluidValue maxCapacity, boolean isTankEmpty, GuiBase.Layer layer) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
|
@ -664,11 +656,11 @@ public class GuiBuilder {
|
||||||
percentage = percentage(maxCapacity.getRawValue(), amount.getRawValue());
|
percentage = percentage(maxCapacity.getRawValue(), amount.getRawValue());
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 194, 26, 22, 56);
|
drawContext.drawTexture(resourceLocation, x, y, 194, 26, 22, 56);
|
||||||
if (!isTankEmpty) {
|
if (!isTankEmpty) {
|
||||||
drawFluid(matrixStack, gui, fluid, x + 4, y + 4, 14, 48, maxCapacity.getRawValue());
|
drawFluid(drawContext, gui, fluid, x + 4, y + 4, 14, 48, maxCapacity.getRawValue());
|
||||||
}
|
}
|
||||||
gui.drawTexture(matrixStack, x + 3, y + 3, 194, 82, 16, 50);
|
drawContext.drawTexture(resourceLocation, x + 3, y + 3, 194, 82, 16, 50);
|
||||||
|
|
||||||
if (gui.isPointInRect(x, y, 22, 56, mouseX, mouseY)) {
|
if (gui.isPointInRect(x, y, 22, 56, mouseX, mouseY)) {
|
||||||
List<Text> list = new ArrayList<>();
|
List<Text> list = new ArrayList<>();
|
||||||
|
@ -694,7 +686,7 @@ public class GuiBuilder {
|
||||||
mouseX -= gui.getGuiLeft();
|
mouseX -= gui.getGuiLeft();
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
gui.renderTooltip(matrixStack, list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
//RenderSystem.disableLighting();
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -711,7 +703,7 @@ public class GuiBuilder {
|
||||||
* @param height {@code int} Height of fluid to draw
|
* @param height {@code int} Height of fluid to draw
|
||||||
* @param maxCapacity {@code int} Maximum capacity of tank
|
* @param maxCapacity {@code int} Maximum capacity of tank
|
||||||
*/
|
*/
|
||||||
public void drawFluid(MatrixStack matrixStack, GuiBase<?> gui, FluidInstance fluid, int x, int y, int width, int height, long maxCapacity) {
|
public void drawFluid(DrawContext drawContext, GuiBase<?> gui, FluidInstance fluid, int x, int y, int width, int height, long maxCapacity) {
|
||||||
if (fluid.getFluid() == Fluids.EMPTY) {
|
if (fluid.getFluid() == Fluids.EMPTY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -730,7 +722,7 @@ public class GuiBuilder {
|
||||||
while (offsetHeight != 0) {
|
while (offsetHeight != 0) {
|
||||||
final int curHeight = offsetHeight < iconHeight ? offsetHeight : iconHeight;
|
final int curHeight = offsetHeight < iconHeight ? offsetHeight : iconHeight;
|
||||||
|
|
||||||
DrawableHelper.drawSprite(matrixStack, x, y - offsetHeight, 0, width, curHeight, sprite);
|
drawContext.drawSprite(x, y - offsetHeight, 0, width, curHeight, sprite);
|
||||||
offsetHeight -= curHeight;
|
offsetHeight -= curHeight;
|
||||||
iteration++;
|
iteration++;
|
||||||
if (iteration > 50) {
|
if (iteration > 50) {
|
||||||
|
@ -754,17 +746,17 @@ public class GuiBuilder {
|
||||||
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
||||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||||
*/
|
*/
|
||||||
public void drawBurnBar(MatrixStack matrixStack, GuiBase<?> gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
|
public void drawBurnBar(DrawContext drawContext, GuiBase<?> gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
|
||||||
if (gui.hideGuiElements()) return;
|
if (gui.hideGuiElements()) return;
|
||||||
if (layer == GuiBase.Layer.BACKGROUND) {
|
if (layer == GuiBase.Layer.BACKGROUND) {
|
||||||
x += gui.getGuiLeft();
|
x += gui.getGuiLeft();
|
||||||
y += gui.getGuiTop();
|
y += gui.getGuiTop();
|
||||||
}
|
}
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 150, 64, 13, 13);
|
drawContext.drawTexture(resourceLocation, x, y, 150, 64, 13, 13);
|
||||||
int j = 13 - (int) ((double) progress / (double) maxProgress * 13);
|
int j = 13 - (int) ((double) progress / (double) maxProgress * 13);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
gui.drawTexture(matrixStack, x, y + j, 150, 51 + j, 13, 13 - j);
|
drawContext.drawTexture(resourceLocation, x, y + j, 150, 51 + j, 13, 13 - j);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (gui.isPointInRect(x, y, 12, 12, mouseX, mouseY)) {
|
if (gui.isPointInRect(x, y, 12, 12, mouseX, mouseY)) {
|
||||||
|
@ -775,7 +767,7 @@ public class GuiBuilder {
|
||||||
mouseX -= gui.getGuiLeft();
|
mouseX -= gui.getGuiLeft();
|
||||||
mouseY -= gui.getGuiTop();
|
mouseY -= gui.getGuiTop();
|
||||||
}
|
}
|
||||||
gui.renderTooltip(matrixStack, list, mouseX, mouseY);
|
drawContext.drawTooltip(gui.getTextRenderer(), list, mouseX, mouseY);
|
||||||
//RenderSystem.disableLighting();
|
//RenderSystem.disableLighting();
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -789,15 +781,15 @@ public class GuiBuilder {
|
||||||
* @param y {@code int} Top left corner where to place slots bar
|
* @param y {@code int} Top left corner where to place slots bar
|
||||||
* @param count {@code int} Number of output slots
|
* @param count {@code int} Number of output slots
|
||||||
*/
|
*/
|
||||||
public void drawOutputSlotBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int count) {
|
public void drawOutputSlotBar(DrawContext drawContext, GuiBase<?> gui, int x, int y, int count) {
|
||||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||||
gui.drawTexture(matrixStack, x, y, 150, 122, 3, 26);
|
drawContext.drawTexture(resourceLocation, x, y, 150, 122, 3, 26);
|
||||||
x += 3;
|
x += 3;
|
||||||
for (int i = 1; i <= count; i++) {
|
for (int i = 1; i <= count; i++) {
|
||||||
gui.drawTexture(matrixStack, x, y, 150 + 3, 122, 20, 26);
|
drawContext.drawTexture(resourceLocation, x, y, 150 + 3, 122, 20, 26);
|
||||||
x += 20;
|
x += 20;
|
||||||
}
|
}
|
||||||
gui.drawTexture(matrixStack, x, y, 150 + 23, 122, 3, 26);
|
drawContext.drawTexture(resourceLocation, x, y, 150 + 23, 122, 3, 26);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int percentage(long MaxValue, long CurrentValue) {
|
protected int percentage(long MaxValue, long CurrentValue) {
|
||||||
|
|
Loading…
Reference in a new issue