mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-07-07 20:02:45 +00:00
Handle file transfers inside CraftOS (#1190)
- Add a new file_transfer event. This has the signature "file_transfer", TransferredFiles. TransferredFiles has a single method getFiles(), which returns a list of all transferred files. - Add a new "import" program which waits for a file_transfer event and writes files to the current directory. - If a file_transfer event is not handled (i.e. its getFiles() method is not called) within 5 seconds on the client, we display a toast informing the user on how to upload a file.
This commit is contained in:
@@ -28,6 +28,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.server.SPlayerPositionLookPacket;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
@@ -225,7 +226,7 @@ public final class CommandComputerCraft
|
||||
.executes( context -> {
|
||||
ServerPlayerEntity player = context.getSource().getPlayerOrException();
|
||||
ServerComputer computer = getComputerArgument( context, "computer" );
|
||||
new ComputerContainerData( computer ).open( player, new INamedContainerProvider()
|
||||
new ComputerContainerData( computer, ItemStack.EMPTY ).open( player, new INamedContainerProvider()
|
||||
{
|
||||
@Nonnull
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user