From 8be48ebcf05401b0690d0bf3889a2e47967b29ca Mon Sep 17 00:00:00 2001 From: Joseph Charamut <12399761+joecharamut@users.noreply.github.com> Date: Sun, 31 Oct 2021 10:55:50 -0400 Subject: [PATCH] Fix drag-and-drop file uploading --- .../dan200/computercraft/client/gui/ComputerScreenBase.java | 2 -- .../shared/computer/inventory/ContainerComputerBase.java | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java b/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java index 1373bbc61..fdab4ce8e 100644 --- a/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java +++ b/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java @@ -117,8 +117,6 @@ public abstract class ComputerScreenBase extend @Override public void filesDragged( @Nonnull List files ) { - // TODO: this thing doesn't work in Tweaked at this moment - if ( true ) return; if( files.isEmpty() ) return; if( computer == null || !computer.isOn() ) diff --git a/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerComputerBase.java b/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerComputerBase.java index e1d42bd5e..8ea9bbc7e 100644 --- a/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerComputerBase.java +++ b/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerComputerBase.java @@ -213,6 +213,7 @@ public abstract class ContainerComputerBase extends ScreenHandler implements ICo { try( FileSystemWrapper channel = fs.openForWrite( file.getName(), false, Function.identity() ) ) { + file.getBytes().rewind(); channel.get().write( file.getBytes() ); } }