1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-25 22:53:22 +00:00

Update to 1.19.1

This commit is contained in:
Jonathan Coates 2022-07-28 08:51:10 +01:00
parent 25a44bea6e
commit c3615d9c5b
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
13 changed files with 52 additions and 56 deletions

View File

@ -149,9 +149,9 @@ accessTransformer file('src/testMod/resources/META-INF/accesstransformer.cfg')
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
annotationProcessor 'org.spongepowered:mixin:0.8.4:processor'
extraModsCompileOnly fg.deobf("mezz.jei:jei-1.19-forge-api:11.0.0.211")
extraModsCompileOnly fg.deobf("mezz.jei:jei-1.19-common-api:11.0.0.211")
extraModsRuntimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.0.0.211")
extraModsCompileOnly fg.deobf("mezz.jei:jei-1.19-forge-api:11.1.1.236")
extraModsCompileOnly fg.deobf("mezz.jei:jei-1.19-common-api:11.1.1.236")
extraModsRuntimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.1.1.236")
shade 'org.squiddev:Cobalt:0.5.5'
shade 'io.netty:netty-codec-http:4.1.76.Final'

View File

@ -5,7 +5,7 @@ kotlin.stdlib.default.dependency=false
mod_version=1.100.8
# Minecraft properties (update mods.toml when changing)
mc_version=1.19
mc_version=1.19.1
mapping_version=1.18.2-2022.07.03
forge_version=41.0.105
forge_version=42.0.0
# NO SERIOUSLY, UPDATE mods.toml WHEN CHANGING

View File

@ -8,8 +8,8 @@
import dan200.computercraft.shared.command.text.ChatHelpers;
import dan200.computercraft.shared.command.text.TableBuilder;
import dan200.computercraft.shared.command.text.TableFormatter;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import net.minecraft.ChatFormatting;
import net.minecraft.client.GuiMessageTag;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.ChatComponent;
@ -18,13 +18,12 @@
import org.apache.commons.lang3.StringUtils;
import javax.annotation.Nullable;
import java.util.Objects;
public class ClientTableFormatter implements TableFormatter
{
public static final ClientTableFormatter INSTANCE = new ClientTableFormatter();
private static final Int2IntOpenHashMap lastHeights = new Int2IntOpenHashMap();
private static Font renderer()
{
return Minecraft.getInstance().font;
@ -59,7 +58,7 @@ public int getWidth( Component component )
}
@Override
public void writeLine( int id, Component component )
public void writeLine( String label, Component component )
{
Minecraft mc = Minecraft.getInstance();
ChatComponent chat = mc.gui.getChat();
@ -68,20 +67,25 @@ public void writeLine( int id, Component component )
// int maxWidth = MathHelper.floor( chat.getChatWidth() / chat.getScale() );
// List<ITextProperties> list = RenderComponentsUtil.wrapComponents( component, maxWidth, mc.fontRenderer );
// if( !list.isEmpty() ) chat.printChatMessageWithOptionalDeletion( list.get( 0 ), id );
chat.addMessage( component, id );
chat.addMessage( component, null, createTag( label ) );
}
@Override
public int display( TableBuilder table )
public void display( TableBuilder table )
{
ChatComponent chat = Minecraft.getInstance().gui.getChat();
int lastHeight = lastHeights.get( table.getId() );
var tag = createTag( table.getId() );
if( chat.allMessages.removeIf( guiMessage -> guiMessage.tag() != null && Objects.equals( guiMessage.tag().logTag(), tag.logTag() ) ) )
{
chat.refreshTrimmedMessage();
}
int height = TableFormatter.super.display( table );
lastHeights.put( table.getId(), height );
TableFormatter.super.display( table );
}
for( int i = height; i < lastHeight; i++ ) chat.removeById( i + table.getId() );
return height;
private static GuiMessageTag createTag( String id )
{
return new GuiMessageTag( 0xa0a0a0, null, null, "ComputerCraft/" + id );
}
}

View File

@ -14,7 +14,7 @@
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.BakedModelWrapper;
import net.minecraftforge.client.model.IQuadTransformer;
import net.minecraftforge.client.model.QuadTransformers;
import net.minecraftforge.client.model.data.ModelData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -50,7 +50,7 @@ public List<BakedQuad> getQuads( @Nullable BlockState state, @Nullable Direction
public @NotNull List<BakedQuad> getQuads( @Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull ModelData extraData, @Nullable RenderType renderType )
{
List<BakedQuad> quads = originalModel.getQuads( state, side, rand, extraData, renderType );
return isIdentity ? quads : IQuadTransformer.applying( transformation ).process( quads );
return isIdentity ? quads : QuadTransformers.applying( transformation ).process( quads );
}
public TransformedBakedModel composeWith( Transformation other )

View File

@ -56,10 +56,6 @@ public final class CommandComputerCraft
{
public static final UUID SYSTEM_UUID = new UUID( 0, 0 );
private static final int DUMP_LIST_ID = 5373952;
private static final int DUMP_SINGLE_ID = 1844510720;
private static final int TRACK_ID = 373882880;
private CommandComputerCraft()
{
}
@ -70,7 +66,7 @@ public static void register( CommandDispatcher<CommandSourceStack> dispatcher )
.then( literal( "dump" )
.requires( UserLevel.OWNER_OP )
.executes( context -> {
TableBuilder table = new TableBuilder( DUMP_LIST_ID, "Computer", "On", "Position" );
TableBuilder table = new TableBuilder( "DumpAll", "Computer", "On", "Position" );
CommandSourceStack source = context.getSource();
List<ServerComputer> computers = new ArrayList<>( ComputerCraft.serverComputerRegistry.getComputers() );
@ -115,7 +111,7 @@ else if( b.getLevel() == world )
.executes( context -> {
ServerComputer computer = getComputerArgument( context, "computer" );
TableBuilder table = new TableBuilder( DUMP_SINGLE_ID );
TableBuilder table = new TableBuilder( "Dump" );
table.row( header( "Instance" ), text( Integer.toString( computer.getInstanceID() ) ) );
table.row( header( "Id" ), text( Integer.toString( computer.getID() ) ) );
table.row( header( "Label" ), text( computer.getLabel() ) );
@ -392,7 +388,7 @@ private static int displayTimings( CommandSourceStack source, @Nonnull List<Comp
Component[] headers = new Component[1 + fields.size()];
headers[0] = translate( "commands.computercraft.track.dump.computer" );
for( int i = 0; i < fields.size(); i++ ) headers[i + 1] = translate( fields.get( i ).translationKey() );
TableBuilder table = new TableBuilder( TRACK_ID, headers );
TableBuilder table = new TableBuilder( "Metrics", headers );
for( ComputerTracker entry : timings )
{

View File

@ -10,9 +10,9 @@
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.commands.synchronization.ArgumentTypeInfo;
import net.minecraft.core.Registry;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.Objects;
@ -27,7 +27,7 @@ public static <A extends ArgumentType<?>> JsonObject serializeToJson( ArgumentTy
{
JsonObject object = new JsonObject();
object.addProperty( "type", "argument" );
object.addProperty( "parser", Registry.COMMAND_ARGUMENT_TYPE.getKey( template.type() ).toString() );
object.addProperty( "parser", ForgeRegistries.COMMAND_ARGUMENT_TYPES.getKey( template.type() ).toString() );
var properties = new JsonObject();
serializeToJson( properties, template.type(), template );
@ -50,13 +50,13 @@ public static <A extends ArgumentType<?>> void serializeToNetwork( FriendlyByteB
@SuppressWarnings( "unchecked" )
private static <A extends ArgumentType<?>, T extends ArgumentTypeInfo.Template<A>> void serializeToNetwork( FriendlyByteBuf buffer, ArgumentTypeInfo<A, T> type, ArgumentTypeInfo.Template<A> template )
{
buffer.writeVarInt( Registry.COMMAND_ARGUMENT_TYPE.getId( type ) );
buffer.writeRegistryIdUnsafe( ForgeRegistries.COMMAND_ARGUMENT_TYPES, type );
type.serializeToNetwork( (T) template, buffer );
}
public static ArgumentTypeInfo.Template<?> deserialize( FriendlyByteBuf buffer )
{
var type = Registry.COMMAND_ARGUMENT_TYPE.byId( buffer.readVarInt() );
var type = buffer.readRegistryIdUnsafe( ForgeRegistries.COMMAND_ARGUMENT_TYPES );
Objects.requireNonNull( type, "Unknown argument type" );
return type.deserializeFromNetwork( buffer );
}

View File

@ -42,7 +42,7 @@ public int getWidth( Component component )
}
@Override
public void writeLine( int id, Component component )
public void writeLine( String label, Component component )
{
source.sendSuccess( component, false );
}

View File

@ -19,30 +19,27 @@
public class TableBuilder
{
private final int id;
private final String id;
private int columns = -1;
private final Component[] headers;
private final ArrayList<Component[]> rows = new ArrayList<>();
private int additional;
public TableBuilder( int id, @Nonnull Component... headers )
public TableBuilder( @Nonnull String id, @Nonnull Component... headers )
{
if( id < 0 ) throw new IllegalArgumentException( "ID must be positive" );
this.id = id;
this.headers = headers;
columns = headers.length;
}
public TableBuilder( int id )
public TableBuilder( @Nonnull String id )
{
if( id < 0 ) throw new IllegalArgumentException( "ID must be positive" );
this.id = id;
headers = null;
}
public TableBuilder( int id, @Nonnull String... headers )
public TableBuilder( @Nonnull String id, @Nonnull String... headers )
{
if( id < 0 ) throw new IllegalArgumentException( "ID must be positive" );
this.id = id;
this.headers = new Component[headers.length];
columns = headers.length;
@ -65,7 +62,7 @@ public void row( @Nonnull Component... row )
*
* @return This table's type.
*/
public int getId()
public String getId()
{
return id;
}

View File

@ -39,13 +39,13 @@ public interface TableFormatter
int getWidth( Component component );
void writeLine( int id, Component component );
void writeLine( String label, Component component );
default int display( TableBuilder table )
default void display( TableBuilder table )
{
if( table.getColumns() <= 0 ) return 0;
if( table.getColumns() <= 0 ) return;
int rowId = table.getId();
String id = table.getId();
int columns = table.getColumns();
int[] maxWidths = new int[columns];
@ -86,13 +86,13 @@ default int display( TableBuilder table )
}
line.append( headers[columns - 1] );
writeLine( rowId++, line );
writeLine( id, line );
// Write a separator line. We round the width up rather than down to make
// it a tad prettier.
int rowCharWidth = getWidth( HEADER );
int rowWidth = totalWidth / rowCharWidth + (totalWidth % rowCharWidth == 0 ? 0 : 1);
writeLine( rowId++, coloured( StringUtils.repeat( HEADER.getString(), rowWidth ), ChatFormatting.GRAY ) );
writeLine( id, coloured( StringUtils.repeat( HEADER.getString(), rowWidth ), ChatFormatting.GRAY ) );
}
for( Component[] row : table.getRows() )
@ -106,14 +106,12 @@ default int display( TableBuilder table )
line.append( SEPARATOR );
}
line.append( row[columns - 1] );
writeLine( rowId++, line );
writeLine( id, line );
}
if( table.getAdditional() > 0 )
{
writeLine( rowId++, coloured( translate( "commands.computercraft.generic.additional_rows", table.getAdditional() ), ChatFormatting.AQUA ) );
writeLine( id, coloured( translate( "commands.computercraft.generic.additional_rows", table.getAdditional() ), ChatFormatting.AQUA ) );
}
return rowId - table.getId();
}
}

View File

@ -63,7 +63,7 @@ private Object[] doCommand( String command )
try
{
receiver.clearOutput();
int result = commandManager.performCommand( computer.getSource(), command );
int result = commandManager.performPrefixedCommand( computer.getSource(), command );
return new Object[] { result > 0, receiver.copyOutput(), result };
}
catch( Throwable t )

View File

@ -16,6 +16,7 @@
public class ChatTableClientMessage implements NetworkMessage
{
private static final int MAX_LEN = 16;
private final TableBuilder table;
public ChatTableClientMessage( TableBuilder table )
@ -26,7 +27,7 @@ public ChatTableClientMessage( TableBuilder table )
public ChatTableClientMessage( @Nonnull FriendlyByteBuf buf )
{
int id = buf.readVarInt();
String id = buf.readUtf( MAX_LEN );
int columns = buf.readVarInt();
TableBuilder table;
if( buf.readBoolean() )
@ -55,7 +56,7 @@ public ChatTableClientMessage( @Nonnull FriendlyByteBuf buf )
@Override
public void toBytes( @Nonnull FriendlyByteBuf buf )
{
buf.writeVarInt( table.getId() );
buf.writeUtf( table.getId(), MAX_LEN );
buf.writeVarInt( table.getColumns() );
buf.writeBoolean( table.getHeaders() != null );
if( table.getHeaders() != null )

View File

@ -3,8 +3,8 @@ public net.minecraft.client.renderer.ItemInHandRenderer m_109312_(F)F # calculat
public net.minecraft.client.renderer.ItemInHandRenderer m_109361_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/HumanoidArm;)V # renderMapHand
public net.minecraft.client.renderer.ItemInHandRenderer m_109346_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;IFFLnet/minecraft/world/entity/HumanoidArm;)V # renderPlayerArm
# ClientTableFormatter
public net.minecraft.client.gui.components.ChatComponent m_93787_(Lnet/minecraft/network/chat/Component;I)V # addMessage
public net.minecraft.client.gui.components.ChatComponent m_93803_(I)V # removeById
public net.minecraft.client.gui.components.ChatComponent f_93760_ # allMessages
public net.minecraft.client.gui.components.ChatComponent m_241120_()V # refreshTrimmedMessage
# NoTermComputerScreen
public net.minecraft.client.Minecraft f_91080_ # screen
@ -18,4 +18,4 @@ protected com.mojang.blaze3d.vertex.VertexBuffer f_166861_ # indexType
protected com.mojang.blaze3d.vertex.VertexBuffer f_166863_ # indexCount
protected com.mojang.blaze3d.vertex.VertexBuffer f_166864_ # mode
protected com.mojang.blaze3d.vertex.VertexBuffer f_166865_ # sequentialIndices
protected com.mojang.blaze3d.vertex.VertexBuffer f_85917_ # format
protected com.mojang.blaze3d.vertex.VertexBuffer f_85917_ # format

View File

@ -1,5 +1,5 @@
modLoader="javafml"
loaderVersion="[41,42)"
loaderVersion="[42,43)"
issueTrackerURL="https://github.com/cc-tweaked/CC-Tweaked/issues"
logoFile="pack.png"
@ -21,6 +21,6 @@ CC: Tweaked is a fork of ComputerCraft, adding programmable computers, turtles a
[[dependencies.computercraft]]
modId="forge"
mandatory=true
versionRange="[41.0.105,42)"
versionRange="[42.0.0,43)"
ordering="NONE"
side="BOTH"