mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-21 00:47:39 +00:00
Switch to Mojang mappings
ForgeGradle (probably sensibly) yells at me about doing this. However: - There's a reasonable number of mods doing this, which establishes some optimistic precedent. - The licence update in Aug 2020 now allows you to use them for "development purposes". I guess source code counts?? - I'm fairly sure this is also compatible with the CCPL - there's an exception for Minecraft code. The main motivation for this is to make the Fabric port a little easier. Hopefully folks (maybe me in the future, we'll see) will no longer have to deal with mapping hell when merging - only mod loader hell.
This commit is contained in:
@@ -29,7 +29,7 @@ public class ClientTableFormatter implements TableFormatter
|
||||
|
||||
private static FontRenderer renderer()
|
||||
{
|
||||
return Minecraft.getInstance().fontRenderer;
|
||||
return Minecraft.getInstance().font;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,7 +41,7 @@ public class ClientTableFormatter implements TableFormatter
|
||||
|
||||
FontRenderer renderer = renderer();
|
||||
|
||||
float spaceWidth = renderer.getStringWidth( " " );
|
||||
float spaceWidth = renderer.width( " " );
|
||||
int spaces = MathHelper.floor( extraWidth / spaceWidth );
|
||||
int extra = extraWidth - (int) (spaces * spaceWidth);
|
||||
|
||||
@@ -57,32 +57,32 @@ public class ClientTableFormatter implements TableFormatter
|
||||
@Override
|
||||
public int getWidth( ITextComponent component )
|
||||
{
|
||||
return renderer().getStringWidth( component.getFormattedText() );
|
||||
return renderer().width( component.getColoredString() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeLine( int id, ITextComponent component )
|
||||
{
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
NewChatGui chat = mc.ingameGUI.getChatGUI();
|
||||
NewChatGui chat = mc.gui.getChat();
|
||||
|
||||
// Trim the text if it goes over the allowed length
|
||||
int maxWidth = MathHelper.floor( chat.getChatWidth() / chat.getScale() );
|
||||
List<ITextComponent> list = RenderComponentsUtil.splitText( component, maxWidth, mc.fontRenderer, false, false );
|
||||
if( !list.isEmpty() ) chat.printChatMessageWithOptionalDeletion( list.get( 0 ), id );
|
||||
int maxWidth = MathHelper.floor( chat.getWidth() / chat.getScale() );
|
||||
List<ITextComponent> list = RenderComponentsUtil.wrapComponents( component, maxWidth, mc.font, false, false );
|
||||
if( !list.isEmpty() ) chat.addMessage( list.get( 0 ), id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int display( TableBuilder table )
|
||||
{
|
||||
NewChatGui chat = Minecraft.getInstance().ingameGUI.getChatGUI();
|
||||
NewChatGui chat = Minecraft.getInstance().gui.getChat();
|
||||
|
||||
int lastHeight = lastHeights.get( table.getId() );
|
||||
|
||||
int height = TableFormatter.super.display( table );
|
||||
lastHeights.put( table.getId(), height );
|
||||
|
||||
for( int i = height; i < lastHeight; i++ ) chat.deleteChatLine( i + table.getId() );
|
||||
for( int i = height; i < lastHeight; i++ ) chat.removeById( i + table.getId() );
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user