mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-19 16:07:38 +00:00
Compare commits
3 Commits
v1.80pr1.9
...
v1.80pr1.1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
14c9558ee6 | ||
![]() |
d53a73e7e7 | ||
![]() |
7e334bd4a5 |
@@ -23,7 +23,7 @@ apply plugin: 'org.ajoberstar.grgit'
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
|
|
||||||
version = "1.80pr1.9"
|
version = "1.80pr1.10"
|
||||||
group = "org.squiddev"
|
group = "org.squiddev"
|
||||||
archivesBaseName = "cc-tweaked"
|
archivesBaseName = "cc-tweaked"
|
||||||
|
|
||||||
|
@@ -928,7 +928,7 @@ public class ComputerCraft
|
|||||||
FileSystem fs = FileSystems.newFileSystem( modJar.toPath(), ComputerCraft.class.getClassLoader() );
|
FileSystem fs = FileSystems.newFileSystem( modJar.toPath(), ComputerCraft.class.getClassLoader() );
|
||||||
mounts.add( new FileSystemMount( fs, subPath ) );
|
mounts.add( new FileSystemMount( fs, subPath ) );
|
||||||
}
|
}
|
||||||
catch( IOException | ProviderNotFoundException | ServiceConfigurationError e )
|
catch( IOException | RuntimeException | ServiceConfigurationError e )
|
||||||
{
|
{
|
||||||
ComputerCraft.log.error( "Could not load mount from mod jar", e );
|
ComputerCraft.log.error( "Could not load mount from mod jar", e );
|
||||||
// Ignore
|
// Ignore
|
||||||
@@ -940,16 +940,16 @@ public class ComputerCraft
|
|||||||
if( resourcePackDir.exists() && resourcePackDir.isDirectory() )
|
if( resourcePackDir.exists() && resourcePackDir.isDirectory() )
|
||||||
{
|
{
|
||||||
String[] resourcePacks = resourcePackDir.list();
|
String[] resourcePacks = resourcePackDir.list();
|
||||||
for( String resourcePack1 : resourcePacks )
|
for( String resourcePackName : resourcePacks )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File resourcePack = new File( resourcePackDir, resourcePack1 );
|
File resourcePack = new File( resourcePackDir, resourcePackName );
|
||||||
if( !resourcePack.isDirectory() )
|
if( !resourcePack.isDirectory() )
|
||||||
{
|
{
|
||||||
// Mount a resource pack from a jar
|
// Mount a resource pack from a jar
|
||||||
IMount resourcePackMount = new FileSystemMount( FileSystems.getFileSystem( resourcePack.toURI() ), subPath );
|
FileSystem fs = FileSystems.newFileSystem( resourcePack.toPath(), ComputerCraft.class.getClassLoader() );
|
||||||
mounts.add( resourcePackMount );
|
mounts.add( new FileSystemMount( fs, subPath ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -962,9 +962,9 @@ public class ComputerCraft
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( IOException e )
|
catch( IOException | RuntimeException | ServiceConfigurationError e )
|
||||||
{
|
{
|
||||||
ComputerCraft.log.error( "Could not load resource pack '" + resourcePack1 + "'", e );
|
ComputerCraft.log.error( "Could not load resource pack '" + resourcePackName + "'", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ public class BinaryReadableHandle extends HandleGeneric
|
|||||||
{
|
{
|
||||||
super( closeable );
|
super( closeable );
|
||||||
this.m_reader = channel;
|
this.m_reader = channel;
|
||||||
this.m_seekable = channel instanceof SeekableByteChannel ? (SeekableByteChannel) channel : null;
|
this.m_seekable = asSeekable( channel );
|
||||||
}
|
}
|
||||||
|
|
||||||
public BinaryReadableHandle( ReadableByteChannel channel )
|
public BinaryReadableHandle( ReadableByteChannel channel )
|
||||||
@@ -118,7 +118,7 @@ public class BinaryReadableHandle extends HandleGeneric
|
|||||||
{
|
{
|
||||||
single.clear();
|
single.clear();
|
||||||
int b = m_reader.read( single );
|
int b = m_reader.read( single );
|
||||||
return b == -1 ? null : new Object[] { single.get( 0 ) };
|
return b == -1 ? null : new Object[] { single.get( 0 ) & 0xFF };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( IOException e )
|
catch( IOException e )
|
||||||
|
@@ -27,7 +27,7 @@ public class BinaryWritableHandle extends HandleGeneric
|
|||||||
{
|
{
|
||||||
super( closeable );
|
super( closeable );
|
||||||
this.m_writer = channel;
|
this.m_writer = channel;
|
||||||
this.m_seekable = channel instanceof SeekableByteChannel ? (SeekableByteChannel) channel : null;
|
this.m_seekable = asSeekable( channel );
|
||||||
}
|
}
|
||||||
|
|
||||||
public BinaryWritableHandle( WritableByteChannel channel )
|
public BinaryWritableHandle( WritableByteChannel channel )
|
||||||
|
@@ -6,6 +6,7 @@ import dan200.computercraft.api.lua.LuaException;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.channels.Channel;
|
||||||
import java.nio.channels.SeekableByteChannel;
|
import java.nio.channels.SeekableByteChannel;
|
||||||
|
|
||||||
import static dan200.computercraft.core.apis.ArgumentHelper.optInt;
|
import static dan200.computercraft.core.apis.ArgumentHelper.optInt;
|
||||||
@@ -69,15 +70,31 @@ public abstract class HandleGeneric implements ILuaObject
|
|||||||
throw new LuaException( "bad argument #1 to 'seek' (invalid option '" + whence + "'" );
|
throw new LuaException( "bad argument #1 to 'seek' (invalid option '" + whence + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Object[] { channel.position() };
|
return new Object[]{ channel.position() };
|
||||||
}
|
}
|
||||||
catch( IllegalArgumentException e )
|
catch( IllegalArgumentException e )
|
||||||
{
|
{
|
||||||
return new Object[] { false, "Position is negative" };
|
return new Object[]{ false, "Position is negative" };
|
||||||
}
|
}
|
||||||
catch( IOException e )
|
catch( IOException e )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static SeekableByteChannel asSeekable( Channel channel )
|
||||||
|
{
|
||||||
|
if( !(channel instanceof SeekableByteChannel) ) return null;
|
||||||
|
|
||||||
|
SeekableByteChannel seekable = (SeekableByteChannel) channel;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
seekable.position( seekable.position() );
|
||||||
|
return seekable;
|
||||||
|
}
|
||||||
|
catch( IOException | UnsupportedOperationException e )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ handleMetatable = {
|
|||||||
if self._closed then error("attempt to use a closed file", 2) end
|
if self._closed then error("attempt to use a closed file", 2) end
|
||||||
|
|
||||||
local handle = self._handle
|
local handle = self._handle
|
||||||
if not handle.read then return nil, "Not opened for reading" end
|
if not handle.read and not handle.readLine then return nil, "Not opened for reading" end
|
||||||
|
|
||||||
local n = select('#', ...)
|
local n = select('#', ...)
|
||||||
local output = {}
|
local output = {}
|
||||||
|
Reference in New Issue
Block a user