mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-11-04 07:32:59 +00:00 
			
		
		
		
	Merge branch 'master' into mc-1.13.x
This commit is contained in:
		@@ -345,6 +345,11 @@ githubRelease {
 | 
				
			|||||||
    releaseAssets.from(jar.archivePath)
 | 
					    releaseAssets.from(jar.archivePath)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					task uploadAll(dependsOn: [uploadArchives, "curseforge", "githubRelease"]) {
 | 
				
			||||||
 | 
					    group "upload"
 | 
				
			||||||
 | 
					    description "Uploads to all repositories (Maven, Curse, GitHub release)"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test {
 | 
					test {
 | 
				
			||||||
    useJUnitPlatform()
 | 
					    useJUnitPlatform()
 | 
				
			||||||
    testLogging {
 | 
					    testLogging {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
# Mod properties
 | 
					# Mod properties
 | 
				
			||||||
mod_version=1.82.1
 | 
					mod_version=1.82.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Minecraft properties
 | 
					# Minecraft properties
 | 
				
			||||||
mc_version=1.13.2
 | 
					mc_version=1.13.2
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,7 @@ public class JarMount implements IMount
 | 
				
			|||||||
        // Cleanup any old mounts. It's unlikely that there will be any, but it's best to be safe.
 | 
					        // Cleanup any old mounts. It's unlikely that there will be any, but it's best to be safe.
 | 
				
			||||||
        cleanup();
 | 
					        cleanup();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if( !jarFile.exists() || jarFile.isDirectory() ) throw new FileNotFoundException();
 | 
					        if( !jarFile.exists() || jarFile.isDirectory() ) throw new FileNotFoundException( "Cannot find " + jarFile );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Open the zip file
 | 
					        // Open the zip file
 | 
				
			||||||
        try
 | 
					        try
 | 
				
			||||||
@@ -85,7 +85,7 @@ public class JarMount implements IMount
 | 
				
			|||||||
        if( zip.getEntry( subPath ) == null )
 | 
					        if( zip.getEntry( subPath ) == null )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            zip.close();
 | 
					            zip.close();
 | 
				
			||||||
            throw new IOException( "Zip does not contain path" );
 | 
					            throw new FileNotFoundException( "Zip does not contain path" );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // We now create a weak reference to this mount. This is automatically added to the appropriate queue.
 | 
					        // We now create a weak reference to this mount. This is automatically added to the appropriate queue.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -242,7 +242,7 @@ public class CobaltLuaMachine implements ILuaMachine
 | 
				
			|||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        catch( InterruptedException e )
 | 
					                        catch( InterruptedException e )
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            throw new OrphanedThread();
 | 
					                            throw new InterruptedError( e );
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        catch( LuaException e )
 | 
					                        catch( LuaException e )
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,7 +67,7 @@ public abstract class BlockComputerBase<T extends TileComputerBase> extends Bloc
 | 
				
			|||||||
        if( computer == null ) return 0;
 | 
					        if( computer == null ) return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ComputerSide localSide = computerEntity.remapToLocalSide( incomingSide.getOpposite() );
 | 
					        ComputerSide localSide = computerEntity.remapToLocalSide( incomingSide.getOpposite() );
 | 
				
			||||||
        return computerEntity.isRedstoneBlockedOnSide( localSide ) ? 0 : computer.getRedstoneOutput( localSide );
 | 
					        return computer.getRedstoneOutput( localSide );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Nonnull
 | 
					    @Nonnull
 | 
				
			||||||
@@ -88,11 +88,7 @@ public abstract class BlockComputerBase<T extends TileComputerBase> extends Bloc
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean getBundledRedstoneConnectivity( World world, BlockPos pos, EnumFacing side )
 | 
					    public boolean getBundledRedstoneConnectivity( World world, BlockPos pos, EnumFacing side )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        TileEntity entity = world.getTileEntity( pos );
 | 
					        return true;
 | 
				
			||||||
        if( !(entity instanceof TileComputerBase) ) return false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        TileComputerBase computerEntity = (TileComputerBase) entity;
 | 
					 | 
				
			||||||
        return !computerEntity.isRedstoneBlockedOnSide( computerEntity.remapToLocalSide( side ) );
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
@@ -106,7 +102,7 @@ public abstract class BlockComputerBase<T extends TileComputerBase> extends Bloc
 | 
				
			|||||||
        if( computer == null ) return 0;
 | 
					        if( computer == null ) return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ComputerSide localSide = computerEntity.remapToLocalSide( side );
 | 
					        ComputerSide localSide = computerEntity.remapToLocalSide( side );
 | 
				
			||||||
        return computerEntity.isRedstoneBlockedOnSide( localSide ) ? 0 : computer.getBundledRedstoneOutput( localSide );
 | 
					        return computer.getBundledRedstoneOutput( localSide );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Nonnull
 | 
					    @Nonnull
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,10 @@ import dan200.computercraft.shared.computer.core.ServerComputer;
 | 
				
			|||||||
import dan200.computercraft.shared.util.DirectionUtil;
 | 
					import dan200.computercraft.shared.util.DirectionUtil;
 | 
				
			||||||
import dan200.computercraft.shared.util.RedstoneUtil;
 | 
					import dan200.computercraft.shared.util.RedstoneUtil;
 | 
				
			||||||
import joptsimple.internal.Strings;
 | 
					import joptsimple.internal.Strings;
 | 
				
			||||||
 | 
					import net.minecraft.block.BlockRedstoneWire;
 | 
				
			||||||
 | 
					import net.minecraft.block.state.IBlockState;
 | 
				
			||||||
import net.minecraft.entity.player.EntityPlayer;
 | 
					import net.minecraft.entity.player.EntityPlayer;
 | 
				
			||||||
 | 
					import net.minecraft.init.Blocks;
 | 
				
			||||||
import net.minecraft.init.Items;
 | 
					import net.minecraft.init.Items;
 | 
				
			||||||
import net.minecraft.item.ItemStack;
 | 
					import net.minecraft.item.ItemStack;
 | 
				
			||||||
import net.minecraft.nbt.NBTTagCompound;
 | 
					import net.minecraft.nbt.NBTTagCompound;
 | 
				
			||||||
@@ -32,6 +35,7 @@ import net.minecraft.util.ITickable;
 | 
				
			|||||||
import net.minecraft.util.math.BlockPos;
 | 
					import net.minecraft.util.math.BlockPos;
 | 
				
			||||||
import net.minecraft.util.text.ITextComponent;
 | 
					import net.minecraft.util.text.ITextComponent;
 | 
				
			||||||
import net.minecraft.util.text.TextComponentString;
 | 
					import net.minecraft.util.text.TextComponentString;
 | 
				
			||||||
 | 
					import net.minecraft.world.World;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.annotation.Nonnull;
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
import javax.annotation.Nullable;
 | 
					import javax.annotation.Nullable;
 | 
				
			||||||
@@ -204,11 +208,6 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
 | 
				
			|||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected boolean isRedstoneBlockedOnSide( ComputerSide localSide )
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    protected abstract EnumFacing getDirection();
 | 
					    protected abstract EnumFacing getDirection();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected ComputerSide remapToLocalSide( EnumFacing globalSide )
 | 
					    protected ComputerSide remapToLocalSide( EnumFacing globalSide )
 | 
				
			||||||
@@ -225,17 +224,35 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        EnumFacing offsetSide = dir.getOpposite();
 | 
					        EnumFacing offsetSide = dir.getOpposite();
 | 
				
			||||||
        ComputerSide localDir = remapToLocalSide( dir );
 | 
					        ComputerSide localDir = remapToLocalSide( dir );
 | 
				
			||||||
        if( !isRedstoneBlockedOnSide( localDir ) )
 | 
					
 | 
				
			||||||
        {
 | 
					        computer.setRedstoneInput( localDir, getRedstoneInput( world, offset, dir ) );
 | 
				
			||||||
            computer.setRedstoneInput( localDir, getWorld().getRedstonePower( offset, dir ) );
 | 
					        computer.setBundledRedstoneInput( localDir, BundledRedstone.getOutput( getWorld(), offset, offsetSide ) );
 | 
				
			||||||
            computer.setBundledRedstoneInput( localDir, BundledRedstone.getOutput( getWorld(), offset, offsetSide ) );
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if( !isPeripheralBlockedOnSide( localDir ) )
 | 
					        if( !isPeripheralBlockedOnSide( localDir ) )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            computer.setPeripheral( localDir, Peripherals.getPeripheral( getWorld(), offset, offsetSide ) );
 | 
					            computer.setPeripheral( localDir, Peripherals.getPeripheral( getWorld(), offset, offsetSide ) );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets the redstone input for an adjacent block
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param world The world we exist in
 | 
				
			||||||
 | 
					     * @param pos   The position of the neighbour
 | 
				
			||||||
 | 
					     * @param side  The side we are reading from
 | 
				
			||||||
 | 
					     * @return The effective redstone power
 | 
				
			||||||
 | 
					     * @see net.minecraft.block.BlockRedstoneDiode#calculateInputStrength(World, BlockPos, IBlockState)
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    protected static int getRedstoneInput( World world, BlockPos pos, EnumFacing side )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        int power = world.getRedstonePower( pos, side );
 | 
				
			||||||
 | 
					        if( power >= 15 ) return power;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        IBlockState neighbour = world.getBlockState( pos );
 | 
				
			||||||
 | 
					        return neighbour.getBlock() == Blocks.REDSTONE_WIRE
 | 
				
			||||||
 | 
					            ? Math.max( power, neighbour.get( BlockRedstoneWire.POWER ) )
 | 
				
			||||||
 | 
					            : power;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void updateInput()
 | 
					    public void updateInput()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if( getWorld() == null || getWorld().isRemote ) return;
 | 
					        if( getWorld() == null || getWorld().isRemote ) return;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,8 +10,10 @@ import dan200.computercraft.ComputerCraft;
 | 
				
			|||||||
import dan200.computercraft.api.ComputerCraftAPI;
 | 
					import dan200.computercraft.api.ComputerCraftAPI;
 | 
				
			||||||
import dan200.computercraft.api.peripheral.IPeripheral;
 | 
					import dan200.computercraft.api.peripheral.IPeripheral;
 | 
				
			||||||
import dan200.computercraft.api.peripheral.IPeripheralTile;
 | 
					import dan200.computercraft.api.peripheral.IPeripheralTile;
 | 
				
			||||||
 | 
					import dan200.computercraft.shared.peripheral.common.TilePeripheralBase;
 | 
				
			||||||
import dan200.computercraft.shared.peripheral.modem.wireless.TileAdvancedModem;
 | 
					import dan200.computercraft.shared.peripheral.modem.wireless.TileAdvancedModem;
 | 
				
			||||||
import dan200.computercraft.shared.peripheral.modem.wireless.TileWirelessModem;
 | 
					import dan200.computercraft.shared.peripheral.modem.wireless.TileWirelessModem;
 | 
				
			||||||
 | 
					import dan200.computercraft.shared.peripheral.monitor.TileMonitor;
 | 
				
			||||||
import mcmultipart.api.addon.IMCMPAddon;
 | 
					import mcmultipart.api.addon.IMCMPAddon;
 | 
				
			||||||
import mcmultipart.api.addon.MCMPAddon;
 | 
					import mcmultipart.api.addon.MCMPAddon;
 | 
				
			||||||
import mcmultipart.api.container.IMultipartContainer;
 | 
					import mcmultipart.api.container.IMultipartContainer;
 | 
				
			||||||
@@ -52,7 +54,7 @@ public class MCMPIntegration implements IMCMPAddon
 | 
				
			|||||||
    public void registerParts( IMultipartRegistry registry )
 | 
					    public void registerParts( IMultipartRegistry registry )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // Setup all parts
 | 
					        // Setup all parts
 | 
				
			||||||
        register( registry, ComputerCraft.Blocks.peripheral, new PartNormalModem() );
 | 
					        register( registry, ComputerCraft.Blocks.peripheral, new PartPeripheral() );
 | 
				
			||||||
        register( registry, ComputerCraft.Blocks.advancedModem, new PartAdvancedModem() );
 | 
					        register( registry, ComputerCraft.Blocks.advancedModem, new PartAdvancedModem() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Subscribe to capability events
 | 
					        // Subscribe to capability events
 | 
				
			||||||
@@ -83,8 +85,11 @@ public class MCMPIntegration implements IMCMPAddon
 | 
				
			|||||||
    public static void attach( AttachCapabilitiesEvent<TileEntity> event )
 | 
					    public static void attach( AttachCapabilitiesEvent<TileEntity> event )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        TileEntity tile = event.getObject();
 | 
					        TileEntity tile = event.getObject();
 | 
				
			||||||
        if( tile instanceof TileAdvancedModem || tile instanceof TileWirelessModem )
 | 
					        if( tile instanceof TileAdvancedModem || tile instanceof TileWirelessModem
 | 
				
			||||||
 | 
					            || tile instanceof TilePeripheralBase || tile instanceof TileMonitor )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            // We need to attach to modems (obviously), but also any other tile created by BlockPeripheral. Otherwise
 | 
				
			||||||
 | 
					            // IMultipart.convertToMultipartTile will error.
 | 
				
			||||||
            event.addCapability( CAPABILITY_KEY, new BasicMultipart( tile ) );
 | 
					            event.addCapability( CAPABILITY_KEY, new BasicMultipart( tile ) );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -94,7 +99,10 @@ public class MCMPIntegration implements IMCMPAddon
 | 
				
			|||||||
        private final TileEntity tile;
 | 
					        private final TileEntity tile;
 | 
				
			||||||
        private IMultipartTile wrapped;
 | 
					        private IMultipartTile wrapped;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private BasicMultipart( TileEntity tile ) {this.tile = tile;}
 | 
					        private BasicMultipart( TileEntity tile )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            this.tile = tile;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @Override
 | 
					        @Override
 | 
				
			||||||
        public boolean hasCapability( @Nonnull Capability<?> capability, @Nullable EnumFacing facing )
 | 
					        public boolean hasCapability( @Nonnull Capability<?> capability, @Nullable EnumFacing facing )
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,6 +10,7 @@ import dan200.computercraft.ComputerCraft;
 | 
				
			|||||||
import dan200.computercraft.shared.peripheral.common.BlockPeripheral;
 | 
					import dan200.computercraft.shared.peripheral.common.BlockPeripheral;
 | 
				
			||||||
import dan200.computercraft.shared.peripheral.common.BlockPeripheralVariant;
 | 
					import dan200.computercraft.shared.peripheral.common.BlockPeripheralVariant;
 | 
				
			||||||
import mcmultipart.api.multipart.IMultipart;
 | 
					import mcmultipart.api.multipart.IMultipart;
 | 
				
			||||||
 | 
					import mcmultipart.api.slot.EnumCenterSlot;
 | 
				
			||||||
import mcmultipart.api.slot.EnumFaceSlot;
 | 
					import mcmultipart.api.slot.EnumFaceSlot;
 | 
				
			||||||
import mcmultipart.api.slot.IPartSlot;
 | 
					import mcmultipart.api.slot.IPartSlot;
 | 
				
			||||||
import net.minecraft.block.Block;
 | 
					import net.minecraft.block.Block;
 | 
				
			||||||
@@ -20,34 +21,41 @@ import net.minecraft.util.math.BlockPos;
 | 
				
			|||||||
import net.minecraft.world.IBlockAccess;
 | 
					import net.minecraft.world.IBlockAccess;
 | 
				
			||||||
import net.minecraft.world.World;
 | 
					import net.minecraft.world.World;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class PartNormalModem implements IMultipart
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class PartPeripheral implements IMultipart
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public IPartSlot getSlotForPlacement( World world, BlockPos pos, IBlockState state, EnumFacing facing, float hitX, float hitY, float hitZ, EntityLivingBase placer )
 | 
					    public IPartSlot getSlotForPlacement( World world, BlockPos pos, IBlockState state, EnumFacing facing, float hitX, float hitY, float hitZ, EntityLivingBase placer )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return EnumFaceSlot.fromFace( getFacing( state ) );
 | 
					        return getSlot( state );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public IPartSlot getSlotFromWorld( IBlockAccess world, BlockPos pos, IBlockState state )
 | 
					    public IPartSlot getSlotFromWorld( IBlockAccess world, BlockPos pos, IBlockState state )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return EnumFaceSlot.fromFace( getFacing( state ) );
 | 
					        return getSlot( state );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private EnumFacing getFacing( IBlockState state )
 | 
					    @Nonnull
 | 
				
			||||||
 | 
					    private static IPartSlot getSlot( IBlockState state )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        BlockPeripheralVariant type = state.getValue( BlockPeripheral.VARIANT );
 | 
					        BlockPeripheralVariant type = state.getValue( BlockPeripheral.VARIANT );
 | 
				
			||||||
        if( type == BlockPeripheralVariant.WirelessModemUpOn || type == BlockPeripheralVariant.WirelessModemUpOff )
 | 
					        if( type == BlockPeripheralVariant.WirelessModemUpOn || type == BlockPeripheralVariant.WirelessModemUpOff )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return EnumFacing.UP;
 | 
					            return EnumFaceSlot.UP;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else if( type == BlockPeripheralVariant.WirelessModemDownOn || type == BlockPeripheralVariant.WirelessModemDownOff )
 | 
					        else if( type == BlockPeripheralVariant.WirelessModemDownOn || type == BlockPeripheralVariant.WirelessModemDownOff )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return EnumFacing.UP;
 | 
					            return EnumFaceSlot.DOWN;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if( type == BlockPeripheralVariant.WirelessModemOff || type == BlockPeripheralVariant.WirelessModemOn )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return EnumFaceSlot.fromFace( state.getValue( BlockPeripheral.FACING ) );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return state.getValue( BlockPeripheral.FACING );
 | 
					            return EnumCenterSlot.CENTER;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -304,7 +304,8 @@ public class TurtleAPI implements ILuaAPI
 | 
				
			|||||||
            case 31:
 | 
					            case 31:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                // refuel
 | 
					                // refuel
 | 
				
			||||||
                int count = parseCount( args, 0 );
 | 
					                int count = optInt( args, 0, Integer.MAX_VALUE );
 | 
				
			||||||
 | 
					                if( count < 0 ) throw new LuaException( "Refuel count " + count + " out of range" );
 | 
				
			||||||
                return tryCommand( context, new TurtleRefuelCommand( count ) );
 | 
					                return tryCommand( context, new TurtleRefuelCommand( count ) );
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            case 32:
 | 
					            case 32:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -338,12 +338,6 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
 | 
				
			|||||||
        return hasPeripheralUpgradeOnSide( localSide );
 | 
					        return hasPeripheralUpgradeOnSide( localSide );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    protected boolean isRedstoneBlockedOnSide( ComputerSide localSide )
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // IDirectionalTile
 | 
					    // IDirectionalTile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,8 +16,10 @@ import net.minecraft.util.EnumFacing;
 | 
				
			|||||||
import net.minecraft.util.NonNullList;
 | 
					import net.minecraft.util.NonNullList;
 | 
				
			||||||
import net.minecraft.util.math.BlockPos;
 | 
					import net.minecraft.util.math.BlockPos;
 | 
				
			||||||
import net.minecraft.world.World;
 | 
					import net.minecraft.world.World;
 | 
				
			||||||
 | 
					import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.annotation.Nonnull;
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class TurtleCompareCommand implements ITurtleCommand
 | 
					public class TurtleCompareCommand implements ITurtleCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -50,24 +52,18 @@ public class TurtleCompareCommand implements ITurtleCommand
 | 
				
			|||||||
            Block lookAtBlock = lookAtState.getBlock();
 | 
					            Block lookAtBlock = lookAtState.getBlock();
 | 
				
			||||||
            if( !lookAtBlock.isAir( lookAtState, world, newPosition ) )
 | 
					            if( !lookAtBlock.isAir( lookAtState, world, newPosition ) )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                // Try createStackedBlock first
 | 
					                // Try getSilkTouchDrop first
 | 
				
			||||||
                /*
 | 
					 | 
				
			||||||
                if( !lookAtBlock.hasTileEntity( lookAtState ) )
 | 
					                if( !lookAtBlock.hasTileEntity( lookAtState ) )
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    try
 | 
					                    try
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        Method method = ReflectionHelper.findMethod(
 | 
					                        Method method = ObfuscationReflectionHelper.findMethod( Block.class, "func_180643_i", IBlockState.class );
 | 
				
			||||||
                            Block.class,
 | 
					 | 
				
			||||||
                            "func_180643_i", "getSilkTouchDrop",
 | 
					 | 
				
			||||||
                            IBlockState.class
 | 
					 | 
				
			||||||
                        );
 | 
					 | 
				
			||||||
                        lookAtStack = (ItemStack) method.invoke( lookAtBlock, lookAtState );
 | 
					                        lookAtStack = (ItemStack) method.invoke( lookAtBlock, lookAtState );
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    catch( ReflectiveOperationException ignored )
 | 
					                    catch( ReflectiveOperationException | RuntimeException ignored )
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // See if the block drops anything with the same ID as itself
 | 
					                // See if the block drops anything with the same ID as itself
 | 
				
			||||||
                // (try 5 times to try and beat random number generators)
 | 
					                // (try 5 times to try and beat random number generators)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,19 +6,27 @@ if #tArgs > 1 then
 | 
				
			|||||||
    return
 | 
					    return
 | 
				
			||||||
elseif #tArgs > 0 then
 | 
					elseif #tArgs > 0 then
 | 
				
			||||||
    if tArgs[1] == "all" then
 | 
					    if tArgs[1] == "all" then
 | 
				
			||||||
        nLimit = 64 * 16
 | 
					        nLimit = nil
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        nLimit = tonumber( tArgs[1] )
 | 
					        nLimit = tonumber( tArgs[1] )
 | 
				
			||||||
 | 
					        if not nLimit then
 | 
				
			||||||
 | 
					            print("Invalid limit, expected a number or \"all\"")
 | 
				
			||||||
 | 
					            return
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if turtle.getFuelLevel() ~= "unlimited" then
 | 
					if turtle.getFuelLevel() ~= "unlimited" then
 | 
				
			||||||
    for n=1,16 do
 | 
					    for n = 1, 16 do
 | 
				
			||||||
 | 
					        -- Stop if we've reached the limit, or are fully refuelled.
 | 
				
			||||||
 | 
					        if (nLimit and nLimit <= 0) or turtle.getFuelLevel() >= turtle.getFuelLimit() then
 | 
				
			||||||
 | 
					            break
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        local nCount = turtle.getItemCount(n)
 | 
					        local nCount = turtle.getItemCount(n)
 | 
				
			||||||
        if nLimit > 0 and nCount > 0 and turtle.getFuelLevel() < turtle.getFuelLimit() then
 | 
					        if nCount > 0 then
 | 
				
			||||||
            local nBurn = math.min( nLimit, nCount )
 | 
					 | 
				
			||||||
            turtle.select( n )
 | 
					            turtle.select( n )
 | 
				
			||||||
            if turtle.refuel( nBurn ) then
 | 
					            if turtle.refuel( nLimit ) and nLimit then
 | 
				
			||||||
                local nNewCount = turtle.getItemCount(n)
 | 
					                local nNewCount = turtle.getItemCount(n)
 | 
				
			||||||
                nLimit = nLimit - (nCount - nNewCount)
 | 
					                nLimit = nLimit - (nCount - nNewCount)
 | 
				
			||||||
            end
 | 
					            end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user