1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-29 00:32:18 +00:00

apply squiddev mojmap patches, temporarily disable checkstyle

This commit is contained in:
Merith 2021-11-27 04:16:29 +00:00
parent dbbbe96df2
commit 73e3e237ad
257 changed files with 734 additions and 693 deletions

View File

@ -1,14 +1,13 @@
plugins { plugins {
id 'fabric-loom' version '0.9-SNAPSHOT' id 'fabric-loom' version '0.9-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
id "checkstyle" //id "checkstyle"
id "com.github.hierynomus.license" version "0.16.1" id "com.github.hierynomus.license" version "0.16.1"
} }
java { java {
toolchain { toolchain {
languageVersion = JavaLanguageVersion.of(16) languageVersion = JavaLanguageVersion.of(16)
vendor = JvmVendorSpec.ADOPTOPENJDK
} }
} }
@ -29,16 +28,16 @@ repositories {
} }
} }
//loom { loom {
// accessWidenerPath = file("src/main/resources/cc.accesswidener") accessWidenerPath = file("src/main/resources/cc.accesswidener")
//} }
configurations { configurations {
implementation.extendsFrom shade implementation.extendsFrom shade
} }
dependencies { dependencies {
checkstyle 'com.puppycrawl.tools:checkstyle:8.45.1' //checkstyle 'com.puppycrawl.tools:checkstyle:8.45.1'
minecraft "com.mojang:minecraft:${mc_version}" minecraft "com.mojang:minecraft:${mc_version}"
//mappings "net.fabricmc:yarn:${mc_version}+build.${mappings_version}:v2" //mappings "net.fabricmc:yarn:${mc_version}+build.${mappings_version}:v2"

View File

@ -40,6 +40,7 @@ import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.io.File; import java.io.File;
@ -61,7 +62,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
MinecraftServer server = GameInstanceUtils.getServer(); MinecraftServer server = GameInstanceUtils.getServer();
if( server != null ) if( server != null )
{ {
ReloadableResourceManager manager = (ReloadableResourceManager) ((MinecraftServerAccess) server).getServerResourceManager().getResourceManager(); ReloadableResourceManager manager = (ReloadableResourceManager) ((MinecraftServerAccess) server).callGetResourceManager();
try try
{ {
return manager.getResource( new ResourceLocation( domain, subPath ) ) return manager.getResource( new ResourceLocation( domain, subPath ) )
@ -116,7 +117,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
MinecraftServer server = GameInstanceUtils.getServer(); MinecraftServer server = GameInstanceUtils.getServer();
if( server != null ) if( server != null )
{ {
ReloadableResourceManager manager = (ReloadableResourceManager) ((MinecraftServerAccess) server).getServerResourceManager().getResourceManager(); ReloadableResourceManager manager = (ReloadableResourceManager) ((MinecraftServerAccess) server).callGetResourceManager();
ResourceMount mount = ResourceMount.get( domain, subPath, manager ); ResourceMount mount = ResourceMount.get( domain, subPath, manager );
return mount.exists( "" ) ? mount : null; return mount.exists( "" ) ? mount : null;
} }

View File

@ -21,13 +21,14 @@ import dan200.computercraft.api.peripheral.IPeripheralProvider;
import dan200.computercraft.api.pocket.IPocketUpgrade; import dan200.computercraft.api.pocket.IPocketUpgrade;
import dan200.computercraft.api.redstone.IBundledRedstoneProvider; import dan200.computercraft.api.redstone.IBundledRedstoneProvider;
import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.ITurtleUpgrade;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/** /**
* The static entry point to the ComputerCraft API. * The static entry point to the ComputerCraft API.
* *

View File

@ -7,11 +7,12 @@ package dan200.computercraft.api;
import dan200.computercraft.api.pocket.IPocketUpgrade; import dan200.computercraft.api.pocket.IPocketUpgrade;
import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.ITurtleUpgrade;
import javax.annotation.Nonnull;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull;
/** /**
* Common functionality between {@link ITurtleUpgrade} and {@link IPocketUpgrade}. * Common functionality between {@link ITurtleUpgrade} and {@link IPocketUpgrade}.
*/ */

View File

@ -6,6 +6,9 @@
package dan200.computercraft.api.client; package dan200.computercraft.api.client;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Transformation;
import com.mojang.math.Vector3f;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -13,10 +16,8 @@ import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.client.resources.model.ModelManager; import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Transformation;
import com.mojang.math.Vector3f;
import java.util.Objects; import java.util.Objects;
/** /**

View File

@ -8,8 +8,9 @@ package dan200.computercraft.api.filesystem;
import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import javax.annotation.Nonnull;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
import java.io.IOException; import java.io.IOException;
import java.nio.channels.ReadableByteChannel; import java.nio.channels.ReadableByteChannel;
import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.BasicFileAttributes;

View File

@ -8,8 +8,9 @@ package dan200.computercraft.api.filesystem;
import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import javax.annotation.Nonnull;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.nio.channels.WritableByteChannel; import java.nio.channels.WritableByteChannel;

View File

@ -9,9 +9,10 @@ import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.api.peripheral.IPeripheralProvider; import dan200.computercraft.api.peripheral.IPeripheralProvider;
import dan200.computercraft.core.asm.LuaMethod; import dan200.computercraft.core.asm.LuaMethod;
import javax.annotation.Nonnull;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import javax.annotation.Nonnull;
/** /**
* A generic source of {@link LuaMethod} functions. * A generic source of {@link LuaMethod} functions.
* *

View File

@ -7,13 +7,14 @@
package dan200.computercraft.api.media; package dan200.computercraft.api.media;
import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.api.filesystem.IMount;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/** /**
* Represents an item that can be placed in a disk drive and used by a Computer. * Represents an item that can be placed in a disk drive and used by a Computer.
* *

View File

@ -6,9 +6,10 @@
package dan200.computercraft.api.media; package dan200.computercraft.api.media;
import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.world.item.ItemStack;
/** /**
* This interface is used to provide {@link IMedia} implementations for {@link ItemStack}. * This interface is used to provide {@link IMedia} implementations for {@link ItemStack}.

View File

@ -6,10 +6,11 @@
package dan200.computercraft.api.network; package dan200.computercraft.api.network;
import javax.annotation.Nonnull;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import javax.annotation.Nonnull;
/** /**
* An object on an {@link IPacketNetwork}, capable of receiving packets. * An object on an {@link IPacketNetwork}, capable of receiving packets.
*/ */

View File

@ -6,10 +6,11 @@
package dan200.computercraft.api.network; package dan200.computercraft.api.network;
import javax.annotation.Nonnull;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import javax.annotation.Nonnull;
/** /**
* An object on a {@link IPacketNetwork}, capable of sending packets. * An object on a {@link IPacketNetwork}, capable of sending packets.
*/ */

View File

@ -13,9 +13,10 @@ import dan200.computercraft.api.lua.ILuaCallback;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.ILuaTask; import dan200.computercraft.api.lua.ILuaTask;
import dan200.computercraft.api.lua.MethodResult; import dan200.computercraft.api.lua.MethodResult;
import net.minecraft.world.level.Level;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.world.level.Level;
import java.util.Map; import java.util.Map;
/** /**

View File

@ -6,11 +6,12 @@
package dan200.computercraft.api.peripheral; package dan200.computercraft.api.peripheral;
import javax.annotation.Nonnull;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import javax.annotation.Nonnull;
import java.util.Optional; import java.util.Optional;
/** /**

View File

@ -5,12 +5,13 @@
*/ */
package dan200.computercraft.api.peripheral; package dan200.computercraft.api.peripheral;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/** /**
* A {@link net.minecraft.world.level.block.entity.BlockEntity} which may act as a peripheral. * A {@link net.minecraft.world.level.block.entity.BlockEntity} which may act as a peripheral.
* *

View File

@ -7,12 +7,13 @@
package dan200.computercraft.api.pocket; package dan200.computercraft.api.pocket;
import dan200.computercraft.shared.util.NonNullSupplier; import dan200.computercraft.shared.util.NonNullSupplier;
import javax.annotation.Nonnull;
import net.minecraft.Util; import net.minecraft.Util;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.ItemLike;
import javax.annotation.Nonnull;
import java.util.function.Supplier; import java.util.function.Supplier;
/** /**

View File

@ -7,11 +7,12 @@
package dan200.computercraft.api.pocket; package dan200.computercraft.api.pocket;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Map; import java.util.Map;
/** /**

View File

@ -9,9 +9,10 @@ package dan200.computercraft.api.pocket;
import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.IUpgradeBase; import dan200.computercraft.api.IUpgradeBase;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
import net.minecraft.world.level.Level;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.world.level.Level;
/** /**
* Additional peripherals for pocket computers. * Additional peripherals for pocket computers.

View File

@ -6,11 +6,12 @@
package dan200.computercraft.api.redstone; package dan200.computercraft.api.redstone;
import javax.annotation.Nonnull;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
/** /**
* This interface is used to provide bundled redstone output for blocks. * This interface is used to provide bundled redstone output for blocks.
* *

View File

@ -7,12 +7,13 @@
package dan200.computercraft.api.turtle; package dan200.computercraft.api.turtle;
import dan200.computercraft.shared.util.NonNullSupplier; import dan200.computercraft.shared.util.NonNullSupplier;
import javax.annotation.Nonnull;
import net.minecraft.Util; import net.minecraft.Util;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.ItemLike;
import javax.annotation.Nonnull;
import java.util.function.Supplier; import java.util.function.Supplier;
/** /**

View File

@ -10,7 +10,8 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener; import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.commands.arguments.EntityAnchorArgument; import net.minecraft.commands.arguments.EntityAnchorArgument;
import net.minecraft.network.*; import net.minecraft.network.Connection;
import net.minecraft.network.ConnectionProtocol;
import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.Packet;
@ -36,6 +37,7 @@ import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.entity.CommandBlockEntity; import net.minecraft.world.level.block.entity.CommandBlockEntity;
import net.minecraft.world.level.block.entity.SignBlockEntity; import net.minecraft.world.level.block.entity.SignBlockEntity;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import java.util.Collection; import java.util.Collection;

View File

@ -11,8 +11,6 @@ import dan200.computercraft.api.lua.ILuaCallback;
import dan200.computercraft.api.lua.MethodResult; import dan200.computercraft.api.lua.MethodResult;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.shared.util.ItemStorage; import dan200.computercraft.shared.util.ItemStorage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -20,6 +18,9 @@ import net.minecraft.world.Container;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/** /**
* The interface passed to turtle by turtles, providing methods that they can call. * The interface passed to turtle by turtles, providing methods that they can call.
* *

View File

@ -13,6 +13,7 @@ import dan200.computercraft.api.peripheral.IPeripheral;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View File

@ -10,8 +10,9 @@ import dan200.computercraft.api.turtle.FakePlayer;
import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.ITurtleAccess;
import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.ITurtleUpgrade;
import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.api.turtle.TurtleSide;
import javax.annotation.Nonnull;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import javax.annotation.Nonnull;
import java.util.Objects; import java.util.Objects;
/** /**

View File

@ -11,11 +11,12 @@ import dan200.computercraft.api.turtle.FakePlayer;
import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.ITurtleAccess;
import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.ITurtleUpgrade;
import dan200.computercraft.api.turtle.TurtleSide; import dan200.computercraft.api.turtle.TurtleSide;
import javax.annotation.Nonnull;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nonnull;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;

View File

@ -8,8 +8,9 @@ package dan200.computercraft.api.turtle.event;
import dan200.computercraft.api.lua.MethodResult; import dan200.computercraft.api.lua.MethodResult;
import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.ITurtleAccess;
import javax.annotation.Nonnull;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;

View File

@ -8,12 +8,13 @@ package dan200.computercraft.api.turtle.event;
import dan200.computercraft.api.turtle.FakePlayer; import dan200.computercraft.api.turtle.FakePlayer;
import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.ITurtleAccess;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.Container; import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Objects; import java.util.Objects;
/** /**

View File

@ -7,9 +7,10 @@
package dan200.computercraft.api.turtle.event; package dan200.computercraft.api.turtle.event;
import dan200.computercraft.api.turtle.ITurtleAccess; import dan200.computercraft.api.turtle.ITurtleAccess;
import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.world.item.ItemStack;
import java.util.Objects; import java.util.Objects;
/** /**

View File

@ -17,13 +17,10 @@ import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback; import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.*;
import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.ResourceManager;
import java.util.HashSet; import java.util.HashSet;
import java.util.function.Consumer; import java.util.function.Consumer;

View File

@ -6,20 +6,20 @@
package dan200.computercraft.client; package dan200.computercraft.client;
import dan200.computercraft.fabric.mixin.ChatHudAccess; import dan200.computercraft.fabric.mixin.ChatComponentAccess;
import dan200.computercraft.shared.command.text.ChatHelpers; import dan200.computercraft.shared.command.text.ChatHelpers;
import dan200.computercraft.shared.command.text.TableBuilder; import dan200.computercraft.shared.command.text.TableBuilder;
import dan200.computercraft.shared.command.text.TableFormatter; import dan200.computercraft.shared.command.text.TableFormatter;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import org.apache.commons.lang3.StringUtils;
import javax.annotation.Nullable;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.ChatComponent; import net.minecraft.client.gui.components.ChatComponent;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import org.apache.commons.lang3.StringUtils;
import javax.annotation.Nullable;
public class ClientTableFormatter implements TableFormatter public class ClientTableFormatter implements TableFormatter
{ {
@ -73,7 +73,7 @@ public class ClientTableFormatter implements TableFormatter
// int maxWidth = MathHelper.floor( chat.getChatWidth() / chat.getScale() ); // int maxWidth = MathHelper.floor( chat.getChatWidth() / chat.getScale() );
// List<ITextProperties> list = RenderComponentsUtil.func_238505_a_( component, maxWidth, mc.fontRenderer ); // List<ITextProperties> list = RenderComponentsUtil.func_238505_a_( component, maxWidth, mc.fontRenderer );
// if( !list.isEmpty() ) chat.printChatMessageWithOptionalDeletion( list.get( 0 ), id ); // if( !list.isEmpty() ) chat.printChatMessageWithOptionalDeletion( list.get( 0 ), id );
((ChatHudAccess) chat).callAddMessage( component, id ); ((ChatComponentAccess) chat).callAddMessage( component, id );
} }
@Override @Override
@ -88,7 +88,7 @@ public class ClientTableFormatter implements TableFormatter
for( int i = height; i < lastHeight; i++ ) for( int i = height; i < lastHeight; i++ )
{ {
((ChatHudAccess) chat).callRemoveMessage( i + table.getId() ); ((ChatComponentAccess) chat).callRemoveById( i + table.getId() );
} }
return height; return height;
} }

View File

@ -5,9 +5,6 @@
*/ */
package dan200.computercraft.client; package dan200.computercraft.client;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.sounds.AbstractSoundInstance; import net.minecraft.client.resources.sounds.AbstractSoundInstance;
import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.client.resources.sounds.SoundInstance;
@ -16,6 +13,10 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class SoundManager public class SoundManager
{ {
private static final Map<UUID, MoveableSound> sounds = new HashMap<>(); private static final Map<UUID, MoveableSound> sounds = new HashMap<>();

View File

@ -17,13 +17,13 @@ import dan200.computercraft.shared.computer.upload.UploadResult;
import dan200.computercraft.shared.network.NetworkHandler; import dan200.computercraft.shared.network.NetworkHandler;
import dan200.computercraft.shared.network.server.ContinueUploadMessage; import dan200.computercraft.shared.network.server.ContinueUploadMessage;
import dan200.computercraft.shared.network.server.UploadFileMessage; import dan200.computercraft.shared.network.server.UploadFileMessage;
import org.lwjgl.glfw.GLFW;
import javax.annotation.Nonnull;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import org.lwjgl.glfw.GLFW;
import javax.annotation.Nonnull;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.SeekableByteChannel; import java.nio.channels.SeekableByteChannel;

View File

@ -6,23 +6,23 @@
package dan200.computercraft.client.gui; package dan200.computercraft.client.gui;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix4f;
import com.mojang.math.Transformation;
import dan200.computercraft.client.FrameInfo; import dan200.computercraft.client.FrameInfo;
import dan200.computercraft.client.render.RenderTypes; import dan200.computercraft.client.render.RenderTypes;
import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.core.terminal.Terminal;
import dan200.computercraft.core.terminal.TextBuffer; import dan200.computercraft.core.terminal.TextBuffer;
import dan200.computercraft.shared.util.Colour; import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.Palette; import dan200.computercraft.shared.util.Palette;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import static dan200.computercraft.client.render.RenderTypes.FULL_BRIGHT_LIGHTMAP; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.mojang.blaze3d.vertex.VertexConsumer; import static dan200.computercraft.client.render.RenderTypes.FULL_BRIGHT_LIGHTMAP;
import com.mojang.math.Matrix4f;
import com.mojang.math.Transformation;
public final class FixedWidthFontRenderer public final class FixedWidthFontRenderer
{ {

View File

@ -6,6 +6,7 @@
package dan200.computercraft.client.gui; package dan200.computercraft.client.gui;
import com.mojang.blaze3d.vertex.PoseStack;
import dan200.computercraft.ComputerCraft; import dan200.computercraft.ComputerCraft;
import dan200.computercraft.client.gui.widgets.ComputerSidebar; import dan200.computercraft.client.gui.widgets.ComputerSidebar;
import dan200.computercraft.client.gui.widgets.WidgetTerminal; import dan200.computercraft.client.gui.widgets.WidgetTerminal;
@ -13,15 +14,14 @@ import dan200.computercraft.client.render.ComputerBorderRenderer;
import dan200.computercraft.client.render.RenderTypes; import dan200.computercraft.client.render.RenderTypes;
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase; import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
import dan200.computercraft.shared.computer.inventory.ContainerViewComputer; import dan200.computercraft.shared.computer.inventory.ContainerViewComputer;
import javax.annotation.Nonnull;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import javax.annotation.Nonnull;
import static dan200.computercraft.client.render.ComputerBorderRenderer.BORDER; import static dan200.computercraft.client.render.ComputerBorderRenderer.BORDER;
import static dan200.computercraft.client.render.ComputerBorderRenderer.getTexture; import static dan200.computercraft.client.render.ComputerBorderRenderer.getTexture;
import com.mojang.blaze3d.vertex.PoseStack;
public final class GuiComputer<T extends ContainerComputerBase> extends ComputerScreenBase<T> public final class GuiComputer<T extends ContainerComputerBase> extends ComputerScreenBase<T>
{ {
private final int termWidth; private final int termWidth;
@ -59,6 +59,7 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Computer
leftPos + ComputerSidebar.WIDTH + BORDER, topPos + BORDER, termWidth, termHeight leftPos + ComputerSidebar.WIDTH + BORDER, topPos + BORDER, termWidth, termHeight
); );
} }
@Override @Override
public void renderBg( @Nonnull PoseStack stack, float partialTicks, int mouseX, int mouseY ) public void renderBg( @Nonnull PoseStack stack, float partialTicks, int mouseX, int mouseY )
{ {

View File

@ -9,13 +9,14 @@ package dan200.computercraft.client.gui;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive; import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive;
import javax.annotation.Nonnull;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import javax.annotation.Nonnull;
public class GuiDiskDrive extends AbstractContainerScreen<ContainerDiskDrive> public class GuiDiskDrive extends AbstractContainerScreen<ContainerDiskDrive>
{ {
private static final ResourceLocation BACKGROUND = new ResourceLocation( "computercraft", "textures/gui/disk_drive.png" ); private static final ResourceLocation BACKGROUND = new ResourceLocation( "computercraft", "textures/gui/disk_drive.png" );

View File

@ -9,12 +9,13 @@ package dan200.computercraft.client.gui;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import dan200.computercraft.shared.peripheral.printer.ContainerPrinter; import dan200.computercraft.shared.peripheral.printer.ContainerPrinter;
import javax.annotation.Nonnull;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import javax.annotation.Nonnull;
public class GuiPrinter extends AbstractContainerScreen<ContainerPrinter> public class GuiPrinter extends AbstractContainerScreen<ContainerPrinter>
{ {
private static final ResourceLocation BACKGROUND = new ResourceLocation( "computercraft", "textures/gui/printer.png" ); private static final ResourceLocation BACKGROUND = new ResourceLocation( "computercraft", "textures/gui/printer.png" );

View File

@ -12,14 +12,14 @@ import com.mojang.math.Matrix4f;
import dan200.computercraft.core.terminal.TextBuffer; import dan200.computercraft.core.terminal.TextBuffer;
import dan200.computercraft.shared.common.ContainerHeldItem; import dan200.computercraft.shared.common.ContainerHeldItem;
import dan200.computercraft.shared.media.items.ItemPrintout; import dan200.computercraft.shared.media.items.ItemPrintout;
import org.lwjgl.glfw.GLFW;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import org.lwjgl.glfw.GLFW;
import javax.annotation.Nonnull;
import static dan200.computercraft.client.render.PrintoutRenderer.*; import static dan200.computercraft.client.render.PrintoutRenderer.*;
import static dan200.computercraft.client.render.RenderTypes.FULL_BRIGHT_LIGHTMAP; import static dan200.computercraft.client.render.RenderTypes.FULL_BRIGHT_LIGHTMAP;

View File

@ -14,11 +14,12 @@ import dan200.computercraft.client.gui.widgets.WidgetTerminal;
import dan200.computercraft.client.render.ComputerBorderRenderer; import dan200.computercraft.client.render.ComputerBorderRenderer;
import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle; import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
import javax.annotation.Nonnull;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import javax.annotation.Nonnull;
import static dan200.computercraft.shared.turtle.inventory.ContainerTurtle.BORDER; import static dan200.computercraft.shared.turtle.inventory.ContainerTurtle.BORDER;
public class GuiTurtle extends ComputerScreenBase<ContainerTurtle> public class GuiTurtle extends ComputerScreenBase<ContainerTurtle>

View File

@ -10,9 +10,6 @@ import dan200.computercraft.ComputerCraft;
import dan200.computercraft.client.gui.widgets.WidgetTerminal; import dan200.computercraft.client.gui.widgets.WidgetTerminal;
import dan200.computercraft.shared.computer.core.ClientComputer; import dan200.computercraft.shared.computer.core.ClientComputer;
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase; import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
import org.lwjgl.glfw.GLFW;
import javax.annotation.Nonnull;
import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.MenuAccess; import net.minecraft.client.gui.screens.inventory.MenuAccess;
@ -20,6 +17,9 @@ import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import org.lwjgl.glfw.GLFW;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class NoTermComputerScreen<T extends ContainerComputerBase> extends Screen implements MenuAccess<T> public class NoTermComputerScreen<T extends ContainerComputerBase> extends Screen implements MenuAccess<T>

View File

@ -7,7 +7,6 @@ package dan200.computercraft.client.gui;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Button;
@ -15,6 +14,8 @@ import net.minecraft.client.gui.components.MultiLineLabel;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public final class OptionScreen extends Screen public final class OptionScreen extends Screen

View File

@ -10,14 +10,15 @@ import dan200.computercraft.ComputerCraft;
import dan200.computercraft.client.render.ComputerBorderRenderer; import dan200.computercraft.client.render.ComputerBorderRenderer;
import dan200.computercraft.shared.command.text.ChatHelpers; import dan200.computercraft.shared.command.text.ChatHelpers;
import dan200.computercraft.shared.computer.core.ClientComputer; import dan200.computercraft.shared.computer.core.ClientComputer;
import java.util.Arrays;
import java.util.function.Consumer;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import java.util.Arrays;
import java.util.function.Consumer;
/** /**
* Registers buttons to interact with a computer. * Registers buttons to interact with a computer.
*/ */

View File

@ -7,12 +7,13 @@ package dan200.computercraft.client.gui.widgets;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import javax.annotation.Nonnull;
import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
import java.util.function.IntSupplier; import java.util.function.IntSupplier;
import java.util.function.Supplier; import java.util.function.Supplier;

View File

@ -6,6 +6,8 @@
package dan200.computercraft.client.gui.widgets; package dan200.computercraft.client.gui.widgets;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import dan200.computercraft.client.gui.FixedWidthFontRenderer; import dan200.computercraft.client.gui.FixedWidthFontRenderer;
import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.core.terminal.Terminal;
import dan200.computercraft.shared.computer.core.ClientComputer; import dan200.computercraft.shared.computer.core.ClientComputer;
@ -23,9 +25,6 @@ import static dan200.computercraft.client.gui.FixedWidthFontRenderer.FONT_HEIGHT
import static dan200.computercraft.client.gui.FixedWidthFontRenderer.FONT_WIDTH; import static dan200.computercraft.client.gui.FixedWidthFontRenderer.FONT_WIDTH;
import static dan200.computercraft.client.render.ComputerBorderRenderer.MARGIN; import static dan200.computercraft.client.render.ComputerBorderRenderer.MARGIN;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
public class WidgetTerminal extends AbstractWidget public class WidgetTerminal extends AbstractWidget
{ {
private static final float TERMINATE_TIME = 0.5f; private static final float TERMINATE_TIME = 0.5f;

View File

@ -44,6 +44,7 @@ import net.minecraft.client.renderer.item.ClampedItemPropertyFunction;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import java.util.function.Supplier; import java.util.function.Supplier;
@Environment( EnvType.CLIENT ) @Environment( EnvType.CLIENT )

View File

@ -20,7 +20,6 @@ import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.math.*;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;

View File

@ -10,11 +10,12 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix4f; import com.mojang.math.Matrix4f;
import dan200.computercraft.ComputerCraft; import dan200.computercraft.ComputerCraft;
import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ComputerFamily;
import javax.annotation.Nonnull;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import javax.annotation.Nonnull;
public class ComputerBorderRenderer public class ComputerBorderRenderer
{ {
public static final ResourceLocation BACKGROUND_NORMAL = new ResourceLocation( ComputerCraft.MOD_ID, "textures/gui/corners_normal.png" ); public static final ResourceLocation BACKGROUND_NORMAL = new ResourceLocation( ComputerCraft.MOD_ID, "textures/gui/corners_normal.png" );

View File

@ -8,7 +8,7 @@ package dan200.computercraft.client.render;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
import dan200.computercraft.fabric.mixin.HeldItemRendererAccess; import dan200.computercraft.fabric.mixin.ItemInHandRendererAccess;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -72,16 +72,16 @@ public abstract class ItemMapLikeRenderer
float tZ = -0.4f * Mth.sin( swingRt * (float) Math.PI ); float tZ = -0.4f * Mth.sin( swingRt * (float) Math.PI );
transform.translate( 0, -tX / 2, tZ ); transform.translate( 0, -tX / 2, tZ );
HeldItemRendererAccess access = (HeldItemRendererAccess) renderer; ItemInHandRendererAccess access = (ItemInHandRendererAccess) renderer;
float pitchAngle = access.callGetMapAngle( pitch ); float pitchAngle = access.callCalculateMapTilt( pitch );
transform.translate( 0, 0.04F + equipProgress * -1.2f + pitchAngle * -0.5f, -0.72f ); transform.translate( 0, 0.04F + equipProgress * -1.2f + pitchAngle * -0.5f, -0.72f );
transform.mulPose( Vector3f.XP.rotationDegrees( pitchAngle * -85.0f ) ); transform.mulPose( Vector3f.XP.rotationDegrees( pitchAngle * -85.0f ) );
if( !minecraft.player.isInvisible() ) if( !minecraft.player.isInvisible() )
{ {
transform.pushPose(); transform.pushPose();
transform.mulPose( Vector3f.YP.rotationDegrees( 90.0F ) ); transform.mulPose( Vector3f.YP.rotationDegrees( 90.0F ) );
access.callRenderArm( transform, render, combinedLight, HumanoidArm.RIGHT ); access.callRenderMapHand( transform, render, combinedLight, HumanoidArm.RIGHT );
access.callRenderArm( transform, render, combinedLight, HumanoidArm.LEFT ); access.callRenderMapHand( transform, render, combinedLight, HumanoidArm.LEFT );
transform.popPose(); transform.popPose();
} }
@ -115,8 +115,8 @@ public abstract class ItemMapLikeRenderer
{ {
transform.pushPose(); transform.pushPose();
transform.mulPose( Vector3f.ZP.rotationDegrees( offset * 10f ) ); transform.mulPose( Vector3f.ZP.rotationDegrees( offset * 10f ) );
((HeldItemRendererAccess) minecraft.getItemInHandRenderer()) ((ItemInHandRendererAccess) minecraft.getItemInHandRenderer())
.callRenderArmHoldingItem( transform, render, combinedLight, equipProgress, swingProgress, side ); .callRenderPlayerArm( transform, render, combinedLight, equipProgress, swingProgress, side );
transform.popPose(); transform.popPose();
} }

View File

@ -7,11 +7,7 @@
package dan200.computercraft.client.render; package dan200.computercraft.client.render;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.*;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.math.Matrix4f; import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
import dan200.computercraft.ComputerCraft; import dan200.computercraft.ComputerCraft;
@ -22,7 +18,6 @@ import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.pocket.items.ItemPocketComputer; import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
import dan200.computercraft.shared.util.Colour; import dan200.computercraft.shared.util.Colour;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.render.*;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;

View File

@ -6,6 +6,9 @@
package dan200.computercraft.client.render; package dan200.computercraft.client.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import dan200.computercraft.shared.media.items.ItemPrintout; import dan200.computercraft.shared.media.items.ItemPrintout;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -16,10 +19,6 @@ import static dan200.computercraft.client.render.PrintoutRenderer.*;
import static dan200.computercraft.shared.media.items.ItemPrintout.LINES_PER_PAGE; import static dan200.computercraft.shared.media.items.ItemPrintout.LINES_PER_PAGE;
import static dan200.computercraft.shared.media.items.ItemPrintout.LINE_MAX_LENGTH; import static dan200.computercraft.shared.media.items.ItemPrintout.LINE_MAX_LENGTH;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
/** /**
* Emulates map and item-frame rendering for printouts. * Emulates map and item-frame rendering for printouts.
*/ */

View File

@ -5,14 +5,15 @@
*/ */
package dan200.computercraft.client.render; package dan200.computercraft.client.render;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.block.model.BakedQuad;
import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.blaze3d.vertex.VertexFormatElement; import com.mojang.blaze3d.vertex.VertexFormatElement;
import com.mojang.math.Matrix4f; import com.mojang.math.Matrix4f;
import com.mojang.math.Vector4f; import com.mojang.math.Vector4f;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.block.model.BakedQuad;
import java.util.List; import java.util.List;
/** /**

View File

@ -6,25 +6,25 @@
package dan200.computercraft.client.render; package dan200.computercraft.client.render;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import dan200.computercraft.shared.peripheral.monitor.TileMonitor; import dan200.computercraft.shared.peripheral.monitor.TileMonitor;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.math.*;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import java.util.EnumSet;
import static net.minecraft.core.Direction.*;
import com.mojang.blaze3d.vertex.PoseStack; import java.util.EnumSet;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f; import static net.minecraft.core.Direction.*;
import com.mojang.math.Matrix4f;
/** /**
* Overrides monitor highlighting to only render the outline of the <em>whole</em> monitor, rather than the current block. This means you do not get an * Overrides monitor highlighting to only render the outline of the <em>whole</em> monitor, rather than the current block. This means you do not get an

View File

@ -9,13 +9,13 @@ import com.mojang.blaze3d.shaders.Uniform;
import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormat;
import dan200.computercraft.client.gui.FixedWidthFontRenderer; import dan200.computercraft.client.gui.FixedWidthFontRenderer;
import dan200.computercraft.shared.util.Palette; import dan200.computercraft.shared.util.Palette;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.server.packs.resources.ResourceProvider;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GL13; import org.lwjgl.opengl.GL13;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.server.packs.resources.ResourceProvider;
import java.io.IOException; import java.io.IOException;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;

View File

@ -6,6 +6,8 @@
package dan200.computercraft.client.render; package dan200.computercraft.client.render;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix4f;
import dan200.computercraft.client.gui.FixedWidthFontRenderer; import dan200.computercraft.client.gui.FixedWidthFontRenderer;
import dan200.computercraft.core.terminal.TextBuffer; import dan200.computercraft.core.terminal.TextBuffer;
import dan200.computercraft.shared.util.Palette; import dan200.computercraft.shared.util.Palette;
@ -14,9 +16,6 @@ import net.minecraft.client.renderer.MultiBufferSource;
import static dan200.computercraft.client.gui.FixedWidthFontRenderer.FONT_HEIGHT; import static dan200.computercraft.client.gui.FixedWidthFontRenderer.FONT_HEIGHT;
import static dan200.computercraft.shared.media.items.ItemPrintout.LINES_PER_PAGE; import static dan200.computercraft.shared.media.items.ItemPrintout.LINES_PER_PAGE;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix4f;
public final class PrintoutRenderer public final class PrintoutRenderer
{ {
/** /**

View File

@ -8,11 +8,11 @@ package dan200.computercraft.client.render;
import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormat;
import dan200.computercraft.client.gui.FixedWidthFontRenderer; import dan200.computercraft.client.gui.FixedWidthFontRenderer;
import net.minecraft.client.render.*;
import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderStateShard;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.ShaderInstance; import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View File

@ -8,11 +8,7 @@ package dan200.computercraft.client.render;
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 com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.*;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.blaze3d.vertex.VertexBuffer;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix4f; import com.mojang.math.Matrix4f;
import com.mojang.math.Transformation; import com.mojang.math.Transformation;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
@ -26,14 +22,12 @@ import dan200.computercraft.shared.peripheral.monitor.MonitorRenderer;
import dan200.computercraft.shared.peripheral.monitor.TileMonitor; import dan200.computercraft.shared.peripheral.monitor.TileMonitor;
import dan200.computercraft.shared.util.Colour; import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.DirectionUtil; import dan200.computercraft.shared.util.DirectionUtil;
import net.minecraft.client.render.*;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.math.*;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL31; import org.lwjgl.opengl.GL31;
@ -41,8 +35,8 @@ import org.lwjgl.opengl.GL31;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import static dan200.computercraft.client.gui.FixedWidthFontRenderer.*;
import static com.mojang.blaze3d.platform.MemoryTracker.create; import static com.mojang.blaze3d.platform.MemoryTracker.create;
import static dan200.computercraft.client.gui.FixedWidthFontRenderer.*;
public class TileEntityMonitorRenderer implements BlockEntityRenderer<TileMonitor> public class TileEntityMonitorRenderer implements BlockEntityRenderer<TileMonitor>
{ {
@ -58,6 +52,7 @@ public class TileEntityMonitorRenderer implements BlockEntityRenderer<TileMonito
{ {
// super( context ); // super( context );
} }
@Override @Override
public void render( @Nonnull TileMonitor monitor, float partialTicks, @Nonnull PoseStack transform, @Nonnull MultiBufferSource renderer, public void render( @Nonnull TileMonitor monitor, float partialTicks, @Nonnull PoseStack transform, @Nonnull MultiBufferSource renderer,
int lightmapCoord, int overlayLight ) int lightmapCoord, int overlayLight )

View File

@ -17,7 +17,6 @@ import dan200.computercraft.shared.turtle.blocks.TileTurtle;
import dan200.computercraft.shared.util.DirectionUtil; import dan200.computercraft.shared.util.DirectionUtil;
import dan200.computercraft.shared.util.Holiday; import dan200.computercraft.shared.util.Holiday;
import dan200.computercraft.shared.util.HolidayUtil; import dan200.computercraft.shared.util.HolidayUtil;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Font;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
@ -34,6 +33,8 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -147,7 +148,7 @@ public class TileEntityTurtleRenderer implements BlockEntityRenderer<TileTurtle>
} }
private void renderUpgrade( @Nonnull PoseStack transform, @Nonnull VertexConsumer renderer, int lightmapCoord, int overlayLight, TileTurtle turtle, private void renderUpgrade( @Nonnull PoseStack transform, @Nonnull VertexConsumer renderer, int lightmapCoord, int overlayLight, TileTurtle turtle,
TurtleSide side, float f ) TurtleSide side, float f )
{ {
ITurtleUpgrade upgrade = turtle.getUpgrade( side ); ITurtleUpgrade upgrade = turtle.getUpgrade( side );
if( upgrade == null ) if( upgrade == null )
@ -170,7 +171,7 @@ public class TileEntityTurtleRenderer implements BlockEntityRenderer<TileTurtle>
} }
private void renderModel( @Nonnull PoseStack transform, @Nonnull VertexConsumer renderer, int lightmapCoord, int overlayLight, private void renderModel( @Nonnull PoseStack transform, @Nonnull VertexConsumer renderer, int lightmapCoord, int overlayLight,
ModelResourceLocation modelLocation, int[] tints ) ModelResourceLocation modelLocation, int[] tints )
{ {
ModelManager modelManager = Minecraft.getInstance() ModelManager modelManager = Minecraft.getInstance()
.getItemRenderer() .getItemRenderer()
@ -180,7 +181,7 @@ public class TileEntityTurtleRenderer implements BlockEntityRenderer<TileTurtle>
} }
private void renderModel( @Nonnull PoseStack transform, @Nonnull VertexConsumer renderer, int lightmapCoord, int overlayLight, BakedModel model, private void renderModel( @Nonnull PoseStack transform, @Nonnull VertexConsumer renderer, int lightmapCoord, int overlayLight, BakedModel model,
int[] tints ) int[] tints )
{ {
random.setSeed( 0 ); random.setSeed( 0 );
renderQuads( transform, renderer, lightmapCoord, overlayLight, model.getQuads( null, null, random ), tints ); renderQuads( transform, renderer, lightmapCoord, overlayLight, model.getQuads( null, null, random ), tints );

View File

@ -11,12 +11,9 @@ import dan200.computercraft.ComputerCraft;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.*;
import net.minecraft.client.resources.model.Material;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelState;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -73,7 +70,7 @@ public final class TurtleModelLoader
@Override @Override
public Collection<Material> getMaterials( Function<ResourceLocation, UnbakedModel> modelGetter, public Collection<Material> getMaterials( Function<ResourceLocation, UnbakedModel> modelGetter,
Set<Pair<String, String>> missingTextureErrors ) Set<Pair<String, String>> missingTextureErrors )
{ {
return getDependencies() return getDependencies()
.stream() .stream()

View File

@ -17,6 +17,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.*; import java.util.*;

View File

@ -7,12 +7,13 @@ package dan200.computercraft.client.render;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import dan200.computercraft.shared.turtle.core.TurtlePlayer; import dan200.computercraft.shared.turtle.core.TurtlePlayer;
import javax.annotation.Nonnull;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import javax.annotation.Nonnull;
public class TurtlePlayerRenderer extends EntityRenderer<TurtlePlayer> public class TurtlePlayerRenderer extends EntityRenderer<TurtlePlayer>
{ //FIXME Make sure this isn't an issue. Context was EntityRenderDispatcher. { //FIXME Make sure this isn't an issue. Context was EntityRenderDispatcher.
public TurtlePlayerRenderer( EntityRendererProvider.Context context ) public TurtlePlayerRenderer( EntityRendererProvider.Context context )
@ -28,7 +29,7 @@ public class TurtlePlayerRenderer extends EntityRenderer<TurtlePlayer>
@Nonnull @Nonnull
@Override @Override
public ResourceLocation getTexture( @Nonnull TurtlePlayer entity ) public ResourceLocation getTextureLocation( @Nonnull TurtlePlayer entity )
{ {
return ComputerBorderRenderer.BACKGROUND_NORMAL; return ComputerBorderRenderer.BACKGROUND_NORMAL;
} }

View File

@ -30,6 +30,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Collections; import java.util.Collections;

View File

@ -5,9 +5,10 @@
*/ */
package dan200.computercraft.core.computer; package dan200.computercraft.core.computer;
import net.minecraft.core.Direction;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.core.Direction;
/** /**
* A side on a computer. Unlike {@link Direction}, this is relative to the direction the computer is * A side on a computer. Unlike {@link Direction}, this is relative to the direction the computer is

View File

@ -9,8 +9,9 @@ import dan200.computercraft.ComputerCraft;
import dan200.computercraft.api.peripheral.IWorkMonitor; import dan200.computercraft.api.peripheral.IWorkMonitor;
import dan200.computercraft.core.tracking.Tracking; import dan200.computercraft.core.tracking.Tracking;
import dan200.computercraft.shared.turtle.core.TurtleBrain; import dan200.computercraft.shared.turtle.core.TurtleBrain;
import javax.annotation.Nonnull;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import javax.annotation.Nonnull;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;

View File

@ -13,14 +13,15 @@ import dan200.computercraft.ComputerCraft;
import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.api.filesystem.IMount;
import dan200.computercraft.core.apis.handles.ArrayByteChannel; import dan200.computercraft.core.apis.handles.ArrayByteChannel;
import dan200.computercraft.shared.util.IoUtil; import dan200.computercraft.shared.util.IoUtil;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.ResourceLocationException; import net.minecraft.ResourceLocationException;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.Resource;
import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.server.packs.resources.ResourceManagerReloadListener; import net.minecraft.server.packs.resources.ResourceManagerReloadListener;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

View File

@ -7,10 +7,11 @@ package dan200.computercraft.core.terminal;
import dan200.computercraft.shared.util.Colour; import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.Palette; import dan200.computercraft.shared.util.Palette;
import javax.annotation.Nonnull;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import javax.annotation.Nonnull;
public class Terminal public class Terminal
{ {
private static final String base16 = "0123456789abcdef"; private static final String base16 = "0123456789abcdef";

View File

@ -11,11 +11,11 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin( ChatComponent.class ) @Mixin( ChatComponent.class )
public interface ChatHudAccess public interface ChatComponentAccess
{ {
@Invoker @Invoker
void callAddMessage( Component text, int messageId ); void callAddMessage( Component text, int messageId );
@Invoker @Invoker
void callRemoveMessage( int messageId ); void callRemoveById( int messageId );
} }

View File

@ -13,14 +13,14 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin( ItemInHandRenderer.class ) @Mixin( ItemInHandRenderer.class )
public interface HeldItemRendererAccess public interface ItemInHandRendererAccess
{ {
@Invoker @Invoker
float callGetMapAngle( float tickDelta ); float callCalculateMapTilt( float tickDelta );
@Invoker @Invoker
void callRenderArm( PoseStack matrices, MultiBufferSource vertexConsumers, int light, HumanoidArm arm ); void callRenderMapHand( PoseStack matrices, MultiBufferSource vertexConsumers, int light, HumanoidArm arm );
@Invoker @Invoker
void callRenderArmHoldingItem( PoseStack matrices, MultiBufferSource vertexConsumers, int light, float equipProgress, float swingProgress, HumanoidArm arm ); void callRenderPlayerArm( PoseStack matrices, MultiBufferSource vertexConsumers, int light, float equipProgress, float swingProgress, HumanoidArm arm );
} }

View File

@ -10,10 +10,10 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin( LevelResource.class ) @Mixin( LevelResource.class )
public interface WorldSavePathAccess public interface LevelResourceAccess
{ {
@Invoker( "<init>" ) @Invoker( "<init>" )
static LevelResource createWorldSavePath( String relativePath ) static LevelResource create( String relativePath )
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -6,13 +6,13 @@
package dan200.computercraft.fabric.mixin; package dan200.computercraft.fabric.mixin;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerResources; import net.minecraft.server.packs.resources.ResourceManager;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin( MinecraftServer.class ) @Mixin( MinecraftServer.class )
public interface MinecraftServerAccess public interface MinecraftServerAccess
{ {
@Accessor @Invoker
ServerResources getServerResourceManager(); ResourceManager callGetResourceManager();
} }

View File

@ -6,8 +6,6 @@
package dan200.computercraft.fabric.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.shared.util.DropConsumer; import dan200.computercraft.shared.util.DropConsumer;
import java.util.function.Supplier;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
@ -18,18 +16,21 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.function.Supplier;
/** /**
* Captures block drops. * Captures block drops.
* *
* @see Block#popResource(Level, BlockPos, ItemStack) * @see Block#popResource(Level, Supplier, ItemStack)
*/ */
@Mixin( Block.class ) @Mixin( Block.class )
public class MixinBlock public class MixinBlock
{ {
@Inject( method = "dropStack(Lnet/minecraft/world/World;Ljava/util/function/Supplier;Lnet/minecraft/item/ItemStack;)V", @Inject(
method = "popResource(Lnet/minecraft/world/level/Level;Ljava/util/function/Supplier;Lnet/minecraft/world/item/ItemStack;)V",
at = @At( at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/entity/ItemEntity;setToDefaultPickupDelay()V" target = "Lnet/minecraft/world/entity/item/ItemEntity;setDefaultPickUpDelay()V"
), ),
locals = LocalCapture.CAPTURE_FAILSOFT, locals = LocalCapture.CAPTURE_FAILSOFT,
cancellable = true ) cancellable = true )

View File

@ -22,10 +22,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin( Entity.class ) @Mixin( Entity.class )
public class MixinEntity public class MixinEntity
{ {
@Inject( method = "dropStack(Lnet/minecraft/item/ItemStack;F)Lnet/minecraft/entity/ItemEntity;", @Inject( method = "spawnAtLocation(Lnet/minecraft/world/item/ItemStack;F)Lnet/minecraft/world/entity/item/ItemEntity;",
at = @At( value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z" ), at = @At( value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z" ),
cancellable = true ) cancellable = true )
public void dropStack( ItemStack stack, float height, CallbackInfoReturnable<ItemEntity> callbackInfo ) public void spawnAtLocation( ItemStack stack, float height, CallbackInfoReturnable<ItemEntity> callbackInfo )
{ {
if( DropConsumer.onLivingDrops( (Entity) (Object) this, stack ) ) if( DropConsumer.onLivingDrops( (Entity) (Object) this, stack ) )
{ {

View File

@ -10,6 +10,9 @@ import com.mojang.blaze3d.shaders.Program;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import dan200.computercraft.client.render.MonitorTextureBufferShader; import dan200.computercraft.client.render.MonitorTextureBufferShader;
import dan200.computercraft.client.render.RenderTypes; import dan200.computercraft.client.render.RenderTypes;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.server.packs.resources.ResourceManager;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
@ -19,15 +22,12 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.server.packs.resources.ResourceManager;
@Mixin( GameRenderer.class ) @Mixin( GameRenderer.class )
public class MixinGameRenderer public class MixinGameRenderer
{ {
@Inject( method = "loadShaders", at = @At( value = "INVOKE_ASSIGN", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 53 ), locals = LocalCapture.CAPTURE_FAILSOFT ) @Inject( method = "reloadShaders", at = @At( value = "INVOKE_ASSIGN", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 53 ), locals = LocalCapture.CAPTURE_FAILSOFT )
private void loadShaders( ResourceManager manager, CallbackInfo info, List<Program> list, List<Pair<ShaderInstance, Consumer<ShaderInstance>>> list2 ) throws IOException private void reloadShaders( ResourceManager manager, CallbackInfo info, List<Program> list, List<Pair<ShaderInstance, Consumer<ShaderInstance>>> list2 ) throws IOException
{ {
list2.add( Pair.of( new ShaderInstance( list2.add( Pair.of( new ShaderInstance(
manager, manager,

View File

@ -1,38 +0,0 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.fabric.mixin;
import dan200.computercraft.client.gui.widgets.WidgetTerminal;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.world.inventory.AbstractContainerMenu;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin( AbstractContainerScreen.class )
public class MixinHandledScreen<T extends AbstractContainerMenu> extends Screen
{
protected MixinHandledScreen( Component title )
{
super( title );
}
@Inject( method = "mouseReleased", at = @At ( "HEAD" ) )
public void mouseReleased( double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir )
{
for ( GuiEventListener child : this.children() )
{
if ( child instanceof WidgetTerminal )
{
child.mouseReleased( mouseX, mouseY, button );
}
}
}
}

View File

@ -22,13 +22,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin( ItemFrameRenderer.class ) @Mixin( ItemFrameRenderer.class )
@Environment( EnvType.CLIENT ) @Environment( EnvType.CLIENT )
public class MixinItemFrameEntityRenderer public class MixinItemFrameRenderer
{ {
@Inject( @Inject(
method = "render", method = "render",
at = @At( at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/client/util/math/MatrixStack;multiply(Lnet/minecraft/util/math/Quaternion;)V", target = "Lcom/mojang/blaze3d/vertex/PoseStack;mulPose(Lcom/mojang/math/Quaternion;)V",
ordinal = 2, ordinal = 2,
shift = At.Shift.AFTER shift = At.Shift.AFTER
), ),

View File

@ -16,35 +16,17 @@ import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.ItemInHandRenderer;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin( ItemInHandRenderer.class ) @Mixin( ItemInHandRenderer.class )
@Environment( EnvType.CLIENT ) @Environment( EnvType.CLIENT )
public class MixinHeldItemRenderer public class MixinItemInHandRenderer
{ {
@Shadow @Inject( method = "renderArmWithItem", at = @At( "HEAD" ), cancellable = true )
private void renderArmHoldingItem( PoseStack matrices, MultiBufferSource vertexConsumers, int light, float equipProgress, float swingProgress,
HumanoidArm arm )
{
}
@Shadow
private float getMapAngle( float pitch )
{
return 0;
}
@Inject( method = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderFirstPersonItem(Lnet/minecraft/client/network/AbstractClientPlayerEntity;" +
"FFLnet/minecraft/util/Hand;FLnet/minecraft/item/ItemStack;FLnet/minecraft/client/util/math/MatrixStack;" +
"Lnet/minecraft/client/render/VertexConsumerProvider;I)V",
at = @At( "HEAD" ),
cancellable = true )
public void renderFirstPersonItem( public void renderFirstPersonItem(
AbstractClientPlayer player, float var2, float pitch, InteractionHand hand, float swingProgress, AbstractClientPlayer player, float var2, float pitch, InteractionHand hand, float swingProgress,
ItemStack stack, float equipProgress, PoseStack matrixStack, MultiBufferSource provider, int light, ItemStack stack, float equipProgress, PoseStack matrixStack, MultiBufferSource provider, int light,

View File

@ -22,7 +22,6 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
/** /**
@ -38,7 +37,7 @@ public class MixinLanguage
private static Logger LOGGER; private static Logger LOGGER;
@Shadow @Shadow
public static void load( InputStream inputStream, BiConsumer<String, String> entryConsumer ) public static void loadFromJson( InputStream inputStream, BiConsumer<String, String> entryConsumer )
{ {
} }
@ -46,21 +45,20 @@ public class MixinLanguage
{ {
String path = "/assets/" + modId + "/lang/en_us.json"; String path = "/assets/" + modId + "/lang/en_us.json";
try ( InputStream inputStream = Language.class.getResourceAsStream( path ) ) try( InputStream inputStream = Language.class.getResourceAsStream( path ) )
{ {
if ( inputStream == null ) return; if( inputStream == null ) return;
load( inputStream, biConsumer ); loadFromJson( inputStream, biConsumer );
} }
catch ( JsonParseException | IOException e ) catch( JsonParseException | IOException e )
{ {
LOGGER.error( "Couldn't read strings from " + path, e ); LOGGER.error( "Couldn't read strings from " + path, e );
} }
} }
@Inject( method = "create", locals = LocalCapture.CAPTURE_FAILSOFT, at = @At( value = "INVOKE", remap = false, target = "Lcom/google/common/collect/ImmutableMap$Builder;build()Lcom/google/common/collect/ImmutableMap;" ) ) @Inject( method = "loadDefault", locals = LocalCapture.CAPTURE_FAILSOFT, at = @At( value = "INVOKE", remap = false, target = "Lcom/google/common/collect/ImmutableMap$Builder;build()Lcom/google/common/collect/ImmutableMap;" ) )
private static void create( CallbackInfoReturnable<Language> cir, ImmutableMap.Builder<String, String> builder ) private static void loadDefault( CallbackInfoReturnable<Language> cir, ImmutableMap.Builder<String, String> builder )
{ {
final Map<String, String> originalTranslation = builder.build();
/* We must ensure that the keys are de-duplicated because we can't catch the error that might otherwise /* We must ensure that the keys are de-duplicated because we can't catch the error that might otherwise
* occur when the injected function calls build() on the ImmutableMap builder. So we use our own hash map and * occur when the injected function calls build() on the ImmutableMap builder. So we use our own hash map and
* exclude "minecraft", as the injected function has already loaded those keys at this point. * exclude "minecraft", as the injected function has already loaded those keys at this point.
@ -72,9 +70,6 @@ public class MixinLanguage
loadModLangFile( id, translations::put ); loadModLangFile( id, translations::put );
} ); } );
// This is needed to remove keys that exist in vanilla Minecraft (Consistency+ does this)
translations.keySet().removeIf( originalTranslation::containsKey );
builder.putAll( translations ); builder.putAll( translations );
} }
} }

View File

@ -6,6 +6,8 @@
package dan200.computercraft.fabric.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.shared.common.TileGeneric; import dan200.computercraft.shared.common.TileGeneric;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
@ -13,9 +15,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import java.util.Collection; import java.util.Collection;
/** /**
@ -24,21 +23,15 @@ import java.util.Collection;
* Forge does this, this is just a bodge to get Fabric in line with that behaviour. * Forge does this, this is just a bodge to get Fabric in line with that behaviour.
*/ */
@Mixin( Level.class ) @Mixin( Level.class )
public class MixinWorld public class MixinLevel
{ {
@Shadow @Shadow
private boolean iteratingTickingBlockEntities; protected boolean tickingBlockEntities;
@Shadow @Inject( method = "setBlockEntity", at = @At( "HEAD" ) )
public boolean isInBuildLimit( BlockPos pos ) public void setBlockEntity( @Nullable BlockEntity entity, CallbackInfo info )
{ {
return false; if( entity != null && !entity.isRemoved() && entity.getLevel().isInWorldBounds( entity.getBlockPos() ) && tickingBlockEntities )
}
@Inject( method = "addBlockEntity", at = @At( "HEAD" ) )
public void addBlockEntity( @Nullable BlockEntity entity, CallbackInfo info )
{
if( entity != null && !entity.isRemoved() && this.isInBuildLimit( entity.getBlockPos() ) && iteratingTickingBlockEntities )
{ {
setWorld( entity, this ); setWorld( entity, this );
} }
@ -48,14 +41,14 @@ public class MixinWorld
{ {
if( entity.getLevel() != world && entity instanceof TileGeneric ) if( entity.getLevel() != world && entity instanceof TileGeneric )
{ {
entity.setLevel( (Level) world ); entity.setLevel( (Level) world ); //TODO why?
} }
} }
// @Inject( method = "addBlockEntities", at = @At( "HEAD" ) ) // @Inject( method = "addBlockEntities", at = @At( "HEAD" ) )
public void addBlockEntities( Collection<BlockEntity> entities, CallbackInfo info ) public void addBlockEntities( Collection<BlockEntity> entities, CallbackInfo info )
{ {
if( iteratingTickingBlockEntities ) if( tickingBlockEntities )
{ {
for( BlockEntity entity : entities ) for( BlockEntity entity : entities )
{ {

View File

@ -22,27 +22,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin( LevelRenderer.class ) @Mixin( LevelRenderer.class )
@Environment( EnvType.CLIENT ) @Environment( EnvType.CLIENT )
public class MixinWorldRenderer public class MixinLevelRenderer
{ {
@Inject( method = "drawBlockOutline", cancellable = true, at = @At( "HEAD" ) ) @Inject( method = "renderHitOutline", cancellable = true, at = @At( "HEAD" ) )
public void drawBlockOutline( PoseStack matrixStack, VertexConsumer vertexConsumer, Entity entity, double d, double e, double f, BlockPos blockPos, public void renderHitOutline( PoseStack matrixStack, VertexConsumer vertexConsumer, Entity entity, double d, double e, double f, BlockPos blockPos,
BlockState blockState, CallbackInfo info ) BlockState blockState, CallbackInfo info )
{ {
if( CableHighlightRenderer.drawHighlight( matrixStack, if( CableHighlightRenderer.drawHighlight( matrixStack, vertexConsumer, entity, d, e, f, blockPos, blockState )
vertexConsumer, || MonitorHighlightRenderer.drawHighlight( matrixStack, vertexConsumer, entity, d, e, f, blockPos, blockState ) )
entity,
d,
e,
f,
blockPos,
blockState ) || MonitorHighlightRenderer.drawHighlight( matrixStack,
vertexConsumer,
entity,
d,
e,
f,
blockPos,
blockState ) )
{ {
info.cancel(); info.cancel();
} }

View File

@ -13,40 +13,57 @@ import org.spongepowered.asm.mixin.Shadow;
@Mixin( Matrix4f.class ) @Mixin( Matrix4f.class )
public class MixinMatrix4f implements IMatrix4f public class MixinMatrix4f implements IMatrix4f
{ {
@Shadow protected float a00; @Shadow
@Shadow protected float a01; protected float m00;
@Shadow protected float a02; @Shadow
@Shadow protected float a03; protected float m01;
@Shadow protected float a10; @Shadow
@Shadow protected float a11; protected float m02;
@Shadow protected float a12; @Shadow
@Shadow protected float a13; protected float m03;
@Shadow protected float a20; @Shadow
@Shadow protected float a21; protected float m10;
@Shadow protected float a22; @Shadow
@Shadow protected float a23; protected float m11;
@Shadow protected float a30; @Shadow
@Shadow protected float a31; protected float m12;
@Shadow protected float a32; @Shadow
@Shadow protected float a33; protected float m13;
@Shadow
protected float m20;
@Shadow
protected float m21;
@Shadow
protected float m22;
@Shadow
protected float m23;
@Shadow
protected float m30;
@Shadow
protected float m31;
@Shadow
protected float m32;
@Shadow
protected float m33;
@Override
public void setFloatArray( float[] values ) public void setFloatArray( float[] values )
{ {
a00 = values[0]; m00 = values[0];
a01 = values[1]; m01 = values[1];
a02 = values[2]; m02 = values[2];
a03 = values[3]; m03 = values[3];
a10 = values[4]; m10 = values[4];
a11 = values[5]; m11 = values[5];
a12 = values[6]; m12 = values[6];
a13 = values[7]; m13 = values[7];
a20 = values[8]; m20 = values[8];
a21 = values[9]; m21 = values[9];
a22 = values[10]; m22 = values[10];
a23 = values[11]; m23 = values[11];
a30 = values[12]; m30 = values[12];
a31 = values[13]; m31 = values[13];
a32 = values[14]; m32 = values[14];
a33 = values[15]; m33 = values[15];
} }
} }

View File

@ -16,22 +16,22 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin( Minecraft.class ) @Mixin( Minecraft.class )
public abstract class MixinMinecraftClient public abstract class MixinMinecraft
{ {
@Inject( method = "render", at = @At( "HEAD" ) ) @Inject( method = "runTick", at = @At( "HEAD" ) )
private void onRender( CallbackInfo info ) private void onRender( CallbackInfo info )
{ {
FrameInfo.onRenderFrame(); FrameInfo.onRenderFrame();
} }
@Inject( method = "disconnect(Lnet/minecraft/client/gui/screen/Screen;)V", at = @At( "RETURN" ) ) @Inject( method = "clearLevel(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At( "RETURN" ) )
private void disconnectAfter( Screen screen, CallbackInfo info ) private void disconnectAfter( Screen screen, CallbackInfo info )
{ {
ClientUnloadWorldEvent.EVENT.invoker().onClientUnloadWorld(); ClientUnloadWorldEvent.EVENT.invoker().onClientUnloadWorld();
} }
@Inject( method = "joinWorld", at = @At( "RETURN" ) ) @Inject( method = "setLevel", at = @At( "RETURN" ) )
private void joinWorldAfter( ClientLevel world, CallbackInfo info ) private void setLevel( ClientLevel world, CallbackInfo info )
{ {
ClientUnloadWorldEvent.EVENT.invoker().onClientUnloadWorld(); ClientUnloadWorldEvent.EVENT.invoker().onClientUnloadWorld();
} }

View File

@ -19,10 +19,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
* @see ServerLevel#addFreshEntity(Entity) * @see ServerLevel#addFreshEntity(Entity)
*/ */
@Mixin( ServerLevel.class ) @Mixin( ServerLevel.class )
public class MixinServerWorld public class MixinServerLevel
{ {
@Inject( method = "spawnEntity", at = @At( "HEAD" ), cancellable = true ) @Inject( method = "addEntity", at = @At( "HEAD" ), cancellable = true )
public void spawnEntity( Entity entity, CallbackInfoReturnable<Boolean> callbackInfo ) public void addEntity( Entity entity, CallbackInfoReturnable<Boolean> callbackInfo )
{ {
if( DropConsumer.onEntitySpawn( entity ) ) if( DropConsumer.onEntitySpawn( entity ) )
{ {

View File

@ -22,10 +22,14 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin( ServerPlayerGameMode.class ) @Mixin( ServerPlayerGameMode.class )
public class MixinServerPlayerInteractionManager public class MixinServerPlayerGameMode
{ {
@Inject( at = @At( value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;copy()Lnet/minecraft/item/ItemStack;", ordinal = 0 ), method = "interactBlock(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;", cancellable = true ) @Inject(
private void interact( ServerPlayer player, Level world, ItemStack stack, InteractionHand hand, BlockHitResult hitResult, CallbackInfoReturnable<InteractionResult> cir ) at = @At( value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;copy()Lnet/minecraft/world/item/ItemStack;", ordinal = 0 ),
method = "useItemOn(Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;)Lnet/minecraft/world/InteractionResult;",
cancellable = true
)
private void useItemOn( ServerPlayer player, Level world, ItemStack stack, InteractionHand hand, BlockHitResult hitResult, CallbackInfoReturnable<InteractionResult> cir )
{ {
BlockPos pos = hitResult.getBlockPos(); BlockPos pos = hitResult.getBlockPos();
BlockState state = world.getBlockState( pos ); BlockState state = world.getBlockState( pos );

View File

@ -1,18 +0,0 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.fabric.mixin;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.block.entity.SignBlockEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin( SignBlockEntity.class )
public interface SignBlockEntityAccess
{
@Accessor
Component[] getTexts();
}

View File

@ -9,10 +9,11 @@ package dan200.computercraft.shared;
import dan200.computercraft.ComputerCraft; import dan200.computercraft.ComputerCraft;
import dan200.computercraft.api.redstone.IBundledRedstoneProvider; import dan200.computercraft.api.redstone.IBundledRedstoneProvider;
import dan200.computercraft.shared.common.DefaultBundledRedstoneProvider; import dan200.computercraft.shared.common.DefaultBundledRedstoneProvider;
import javax.annotation.Nonnull;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;

View File

@ -50,7 +50,6 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry; import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.*;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -70,6 +69,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import static net.minecraft.core.Registry.BLOCK_ENTITY_TYPE; import static net.minecraft.core.Registry.BLOCK_ENTITY_TYPE;
@ -122,7 +122,7 @@ public final class ComputerCraftRegistry
new BlockWiredModemFull( modemProperties(), ComputerCraftRegistry.ModTiles.WIRED_MODEM_FULL ) ); new BlockWiredModemFull( modemProperties(), ComputerCraftRegistry.ModTiles.WIRED_MODEM_FULL ) );
public static final BlockCable CABLE = register( "cable", new BlockCable( modemProperties() ) ); public static final BlockCable CABLE = register( "cable", new BlockCable( modemProperties() ) );
private static Block.Settings properties() private static BlockBehaviour.Properties properties()
{ {
//return FabricBlockSettings.copyOf(Blocks.GLASS) //return FabricBlockSettings.copyOf(Blocks.GLASS)
// .strength(2); // .strength(2);
@ -132,13 +132,13 @@ public final class ComputerCraftRegistry
.noOcclusion(); .noOcclusion();
} }
private static Block.Settings turtleProperties() private static BlockBehaviour.Properties turtleProperties()
{ {
return FabricBlockSettings.copyOf( Blocks.STONE ) return FabricBlockSettings.copyOf( Blocks.STONE )
.strength( 2.5f ); .strength( 2.5f );
} }
private static Block.Settings modemProperties() private static BlockBehaviour.Properties modemProperties()
{ {
return FabricBlockSettings.copyOf( Blocks.STONE ) return FabricBlockSettings.copyOf( Blocks.STONE )
.breakByHand( true ) .breakByHand( true )
@ -274,7 +274,7 @@ public final class ComputerCraftRegistry
public static final MenuType<ContainerViewComputer> VIEW_COMPUTER = ContainerData.toType( new ResourceLocation( MOD_ID, "view_computer" ), ViewComputerContainerData::new, ContainerViewComputer::new ); public static final MenuType<ContainerViewComputer> VIEW_COMPUTER = ContainerData.toType( new ResourceLocation( MOD_ID, "view_computer" ), ViewComputerContainerData::new, ContainerViewComputer::new );
private static <T extends AbstractContainerMenu> MenuType<T> registerSimple( String id, private static <T extends AbstractContainerMenu> MenuType<T> registerSimple( String id,
ScreenHandlerRegistry.SimpleClientHandlerFactory<T> function ) ScreenHandlerRegistry.SimpleClientHandlerFactory<T> function )
{ {
return ScreenHandlerRegistry.registerSimple( new ResourceLocation( MOD_ID, id ), function ); return ScreenHandlerRegistry.registerSimple( new ResourceLocation( MOD_ID, id ), function );
} }

View File

@ -9,8 +9,9 @@ package dan200.computercraft.shared;
import dan200.computercraft.ComputerCraft; import dan200.computercraft.ComputerCraft;
import dan200.computercraft.api.media.IMedia; import dan200.computercraft.api.media.IMedia;
import dan200.computercraft.api.media.IMediaProvider; import dan200.computercraft.api.media.IMediaProvider;
import javax.annotation.Nonnull;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;

View File

@ -10,11 +10,12 @@ import dan200.computercraft.ComputerCraft;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.api.peripheral.IPeripheralProvider; import dan200.computercraft.api.peripheral.IPeripheralProvider;
import dan200.computercraft.shared.peripheral.generic.GenericPeripheralProvider; import dan200.computercraft.shared.peripheral.generic.GenericPeripheralProvider;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Objects; import java.util.Objects;

View File

@ -11,6 +11,7 @@ import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.ModContainer;
import net.minecraft.Util; import net.minecraft.Util;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.*; import java.util.*;

View File

@ -8,9 +8,10 @@ package dan200.computercraft.shared;
import dan200.computercraft.ComputerCraft; import dan200.computercraft.ComputerCraft;
import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.ITurtleUpgrade;
import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ComputerFamily;
import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.world.item.ItemStack;
import java.util.*; import java.util.*;
import java.util.stream.Stream; import java.util.stream.Stream;

View File

@ -6,9 +6,10 @@
package dan200.computercraft.shared.command; package dan200.computercraft.shared.command;
import dan200.computercraft.shared.util.IDAssigner; import dan200.computercraft.shared.util.IDAssigner;
import java.io.File;
import net.minecraft.Util; import net.minecraft.Util;
import java.io.File;
/** /**
* Basic client-side commands. * Basic client-side commands.
* *

View File

@ -37,6 +37,7 @@ import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;

View File

@ -10,15 +10,16 @@ import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder; import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import dan200.computercraft.api.turtle.FakePlayer; import dan200.computercraft.api.turtle.FakePlayer;
import java.util.Arrays;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.SharedSuggestionProvider;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import java.util.Arrays;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
public final class CommandUtils public final class CommandUtils
{ {
private CommandUtils() {} private CommandUtils() {}

View File

@ -9,6 +9,7 @@ import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import java.util.function.Predicate; import java.util.function.Predicate;
/** /**

View File

@ -14,9 +14,10 @@ import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder; import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import dan200.computercraft.shared.command.arguments.ComputersArgumentType.ComputersSupplier; import dan200.computercraft.shared.command.arguments.ComputersArgumentType.ComputersSupplier;
import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.computer.core.ServerComputer;
import net.minecraft.commands.CommandSourceStack;
import java.util.Collection; import java.util.Collection;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import net.minecraft.commands.CommandSourceStack;
import static dan200.computercraft.shared.command.Exceptions.COMPUTER_ARG_MANY; import static dan200.computercraft.shared.command.Exceptions.COMPUTER_ARG_MANY;

View File

@ -16,10 +16,11 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import dan200.computercraft.ComputerCraft; import dan200.computercraft.ComputerCraft;
import dan200.computercraft.shared.computer.core.ComputerFamily; import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.computer.core.ServerComputer; import dan200.computercraft.shared.computer.core.ServerComputer;
import javax.annotation.Nonnull;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.synchronization.ArgumentSerializer; import net.minecraft.commands.synchronization.ArgumentSerializer;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import javax.annotation.Nonnull;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.function.Function; import java.util.function.Function;
@ -194,7 +195,7 @@ public final class ComputersArgumentType implements ArgumentType<ComputersArgume
{ {
@Override @Override
public void toPacket( @Nonnull ComputersArgumentType arg, @Nonnull FriendlyByteBuf buf ) public void serializeToNetwork( @Nonnull ComputersArgumentType arg, @Nonnull FriendlyByteBuf buf )
{ {
buf.writeBoolean( arg.requireSome ); buf.writeBoolean( arg.requireSome );
} }
@ -207,7 +208,7 @@ public final class ComputersArgumentType implements ArgumentType<ComputersArgume
} }
@Override @Override
public void toJson( @Nonnull ComputersArgumentType arg, @Nonnull JsonObject json ) public void serializeToJson( @Nonnull ComputersArgumentType arg, @Nonnull JsonObject json )
{ {
json.addProperty( "requireSome", arg.requireSome ); json.addProperty( "requireSome", arg.requireSome );
} }

View File

@ -15,12 +15,13 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder; import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import javax.annotation.Nonnull;
import net.minecraft.commands.synchronization.ArgumentSerializer; import net.minecraft.commands.synchronization.ArgumentSerializer;
import net.minecraft.commands.synchronization.ArgumentTypes; import net.minecraft.commands.synchronization.ArgumentTypes;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -137,7 +138,7 @@ public final class RepeatArgumentType<T, U> implements ArgumentType<List<T>>
public static class Serializer implements ArgumentSerializer<RepeatArgumentType<?, ?>> public static class Serializer implements ArgumentSerializer<RepeatArgumentType<?, ?>>
{ {
@Override @Override
public void toPacket( @Nonnull RepeatArgumentType<?, ?> arg, @Nonnull FriendlyByteBuf buf ) public void serializeToNetwork( @Nonnull RepeatArgumentType<?, ?> arg, @Nonnull FriendlyByteBuf buf )
{ {
buf.writeBoolean( arg.flatten ); buf.writeBoolean( arg.flatten );
ArgumentTypes.serialize( buf, arg.child ); ArgumentTypes.serialize( buf, arg.child );
@ -160,7 +161,7 @@ public final class RepeatArgumentType<T, U> implements ArgumentType<List<T>>
} }
@Override @Override
public void toJson( @Nonnull RepeatArgumentType<?, ?> arg, @Nonnull JsonObject json ) public void serializeToJson( @Nonnull RepeatArgumentType<?, ?> arg, @Nonnull JsonObject json )
{ {
json.addProperty( "flatten", arg.flatten ); json.addProperty( "flatten", arg.flatten );
json.addProperty( "child", "<<cannot serialize>>" ); // TODO: Potentially serialize this using reflection. json.addProperty( "child", "<<cannot serialize>>" ); // TODO: Potentially serialize this using reflection.

View File

@ -13,12 +13,13 @@ import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.tree.CommandNode; import com.mojang.brigadier.tree.CommandNode;
import dan200.computercraft.shared.command.arguments.RepeatArgumentType; import dan200.computercraft.shared.command.arguments.RepeatArgumentType;
import net.minecraft.commands.CommandSourceStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.function.Supplier; import java.util.function.Supplier;
import net.minecraft.commands.CommandSourceStack;
import static dan200.computercraft.shared.command.Exceptions.ARGUMENT_EXPECTED; import static dan200.computercraft.shared.command.Exceptions.ARGUMENT_EXPECTED;
import static dan200.computercraft.shared.command.builder.HelpingArgumentBuilder.literal; import static dan200.computercraft.shared.command.builder.HelpingArgumentBuilder.literal;

View File

@ -13,13 +13,14 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.tree.CommandNode; import com.mojang.brigadier.tree.CommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
import javax.annotation.Nonnull;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.ClickEvent; import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -165,10 +166,10 @@ public final class HelpingArgumentBuilder extends LiteralArgumentBuilder<Command
// Set up a /... help command // Set up a /... help command
LiteralArgumentBuilder<CommandSourceStack> helpNode = LiteralArgumentBuilder<CommandSourceStack> helpNode =
LiteralArgumentBuilder.<CommandSourceStack>literal( "help" ).requires( x -> getArguments().stream() LiteralArgumentBuilder.<CommandSourceStack>literal( "help" ).requires( x -> getArguments().stream()
.anyMatch( .anyMatch(
y -> y.getRequirement() y -> y.getRequirement()
.test( .test(
x ) ) ) x ) ) )
.executes( helpCommand ); .executes( helpCommand );
// Add all normal command children to this and the help node // Add all normal command children to this and the help node

View File

@ -7,13 +7,7 @@ package dan200.computercraft.shared.command.text;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.ClickEvent; import net.minecraft.network.chat.*;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.text.*;
/** /**
* Various helpers for building chat messages. * Various helpers for building chat messages.

View File

@ -6,12 +6,12 @@
package dan200.computercraft.shared.command.text; package dan200.computercraft.shared.command.text;
import org.apache.commons.lang3.StringUtils;
import javax.annotation.Nullable;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
import org.apache.commons.lang3.StringUtils;
import javax.annotation.Nullable;
public class ServerTableFormatter implements TableFormatter public class ServerTableFormatter implements TableFormatter
{ {

View File

@ -9,11 +9,12 @@ package dan200.computercraft.shared.command.text;
import dan200.computercraft.shared.command.CommandUtils; import dan200.computercraft.shared.command.CommandUtils;
import dan200.computercraft.shared.network.NetworkHandler; import dan200.computercraft.shared.network.NetworkHandler;
import dan200.computercraft.shared.network.client.ChatTableClientMessage; import dan200.computercraft.shared.network.client.ChatTableClientMessage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

Some files were not shown because too many files have changed in this diff Show More