mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-07-06 20:12:52 +00:00

Most of the port is pretty simple. The main problems are regarding changes to Minecraft's rendering system. - Remove several rendering tweaks until Forge's compatibility it brought up-to-date - Map rendering for pocket computers and printouts - Item frame rendering for printouts - Custom block outlines for monitors and cables/wired modems - Custom breaking progress for cables/wired modems - Turtle "Dinnerbone" rendering is currently broken, as normals are not correctly transformed. - Rewrite FixedWidthFontRenderer to to the buffer in a single sweep. In order to do this, the term_font now also bundles a "background" section, which is just a blank region of the screen. - Render monitors using a VBO instead of a call list. I haven't compared performance yet, but it manages to render a 6x5 array of _static_ monitors at almost 60fps, which seems pretty reasonable.
51 lines
1.9 KiB
Java
51 lines
1.9 KiB
Java
/*
|
|
* This file is part of ComputerCraft - http://www.computercraft.info
|
|
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
|
|
* Send enquiries to dratcliffe@gmail.com
|
|
*/
|
|
package dan200.computercraft.client.gui;
|
|
|
|
import com.mojang.blaze3d.systems.RenderSystem;
|
|
import dan200.computercraft.shared.peripheral.printer.ContainerPrinter;
|
|
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
|
import net.minecraft.client.resources.I18n;
|
|
import net.minecraft.entity.player.PlayerInventory;
|
|
import net.minecraft.util.ResourceLocation;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
|
|
public class GuiPrinter extends ContainerScreen<ContainerPrinter>
|
|
{
|
|
private static final ResourceLocation BACKGROUND = new ResourceLocation( "computercraft", "textures/gui/printer.png" );
|
|
|
|
public GuiPrinter( ContainerPrinter container, PlayerInventory player, ITextComponent title )
|
|
{
|
|
super( container, player, title );
|
|
}
|
|
|
|
@Override
|
|
protected void drawGuiContainerForegroundLayer( int mouseX, int mouseY )
|
|
{
|
|
String title = getTitle().getFormattedText();
|
|
font.drawString( title, (xSize - font.getStringWidth( title )) / 2.0f, 6, 0x404040 );
|
|
font.drawString( I18n.format( "container.inventory" ), 8, ySize - 96 + 2, 0x404040 );
|
|
}
|
|
|
|
@Override
|
|
protected void drawGuiContainerBackgroundLayer( float partialTicks, int mouseX, int mouseY )
|
|
{
|
|
RenderSystem.color4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
|
minecraft.getTextureManager().bindTexture( BACKGROUND );
|
|
blit( guiLeft, guiTop, 0, 0, xSize, ySize );
|
|
|
|
if( getContainer().isPrinting() ) blit( guiLeft + 34, guiTop + 21, 176, 0, 25, 45 );
|
|
}
|
|
|
|
@Override
|
|
public void render( int mouseX, int mouseY, float partialTicks )
|
|
{
|
|
renderBackground();
|
|
super.render( mouseX, mouseY, partialTicks );
|
|
renderHoveredToolTip( mouseX, mouseY );
|
|
}
|
|
}
|