mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-09-07 04:47:55 +00:00
Center printout rendering, fix printout gui not responding to page turning inputs.
Fixes: - Printouts being drawn slightly offset to the left in all cases, noticeable mainly when in item frames. - Printout text two pixels off center within the background. - Printout GUI not responding to left/right arrows. Scrolling seemed to work but same fix was added there for consistency.
This commit is contained in:
@@ -7,7 +7,7 @@ mod_version=1.100.0
|
|||||||
# Minecraft properties
|
# Minecraft properties
|
||||||
mc_version=1.18.1
|
mc_version=1.18.1
|
||||||
fabric_api_version=0.44.0+1.18
|
fabric_api_version=0.44.0+1.18
|
||||||
fabric_loader_version=0.12.11
|
fabric_loader_version=0.12.12
|
||||||
|
|
||||||
cloth_api_version=2.0.54
|
cloth_api_version=2.0.54
|
||||||
cloth_config_version=6.0.42
|
cloth_config_version=6.0.42
|
||||||
|
@@ -53,8 +53,7 @@ public class GuiPrintout extends AbstractContainerScreen<ContainerHeldItem>
|
|||||||
@Override
|
@Override
|
||||||
public boolean keyPressed( int key, int scancode, int modifiers )
|
public boolean keyPressed( int key, int scancode, int modifiers )
|
||||||
{
|
{
|
||||||
if( super.keyPressed( key, scancode, modifiers ) ) return true;
|
// Check for key presses.
|
||||||
|
|
||||||
if( key == GLFW.GLFW_KEY_RIGHT )
|
if( key == GLFW.GLFW_KEY_RIGHT )
|
||||||
{
|
{
|
||||||
if( page < pages - 1 ) page++;
|
if( page < pages - 1 ) page++;
|
||||||
@@ -67,13 +66,16 @@ public class GuiPrintout extends AbstractContainerScreen<ContainerHeldItem>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Otherwise, default to parent function
|
||||||
|
if( super.keyPressed( key, scancode, modifiers ) ) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseScrolled( double x, double y, double delta )
|
public boolean mouseScrolled( double x, double y, double delta )
|
||||||
{
|
{
|
||||||
if( super.mouseScrolled( x, y, delta ) ) return true;
|
// Check for key presses.
|
||||||
if( delta < 0 )
|
if( delta < 0 )
|
||||||
{
|
{
|
||||||
// Scroll up goes to the next page
|
// Scroll up goes to the next page
|
||||||
@@ -88,6 +90,9 @@ public class GuiPrintout extends AbstractContainerScreen<ContainerHeldItem>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Otherwise, default to parent function
|
||||||
|
if( super.mouseScrolled( x, y, delta ) ) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer
|
|||||||
double height = LINES_PER_PAGE * FONT_HEIGHT + Y_TEXT_MARGIN * 2;
|
double height = LINES_PER_PAGE * FONT_HEIGHT + Y_TEXT_MARGIN * 2;
|
||||||
|
|
||||||
// Non-books will be left aligned
|
// Non-books will be left aligned
|
||||||
if( !book ) width += offsetAt( pages );
|
if( !book ) width += offsetAt( pages - 1 );
|
||||||
|
|
||||||
double visualWidth = width, visualHeight = height;
|
double visualWidth = width, visualHeight = height;
|
||||||
|
|
||||||
|
@@ -32,12 +32,12 @@ public final class PrintoutRenderer
|
|||||||
/**
|
/**
|
||||||
* Padding between the left and right of a page and the text.
|
* Padding between the left and right of a page and the text.
|
||||||
*/
|
*/
|
||||||
public static final int X_TEXT_MARGIN = 13;
|
public static final int X_TEXT_MARGIN = 11;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Padding between the top and bottom of a page and the text.
|
* Padding between the top and bottom of a page and the text.
|
||||||
*/
|
*/
|
||||||
public static final int Y_TEXT_MARGIN = 11;
|
public static final int Y_TEXT_MARGIN = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Width of the extra page texture.
|
* Width of the extra page texture.
|
||||||
|
Reference in New Issue
Block a user