Reformat src/main/java

Removes several pointless imports. And, more importantly, fixes the
build.
This commit is contained in:
Jonathan Coates 2021-01-14 09:09:02 +00:00
parent 1255bd00fd
commit 58054ad2d1
37 changed files with 41 additions and 93 deletions

View File

@ -89,9 +89,9 @@ public final String[] list( String path ) throws LuaException
*
* @param arguments The paths to combine.
* @return The new path, with separators added between parts as needed.
* @throws LuaException On argument errors.
* @cc.tparam string path The first part of the path. For example, a parent directory path.
* @cc.tparam string ... Additional parts of the path to combine.
* @throws LuaException On argument errors.
*/
@LuaFunction
public final String combine( IArguments arguments ) throws LuaException

View File

@ -180,7 +180,7 @@ public final void queueEvent( String name, IArguments args )
*
* @param timer The number of seconds until the timer fires.
* @return The ID of the new timer. This can be used to filter the
* {@code timer} event, or {@link #cancelTimer cancel the timer}.
* {@code timer} event, or {@link #cancelTimer cancel the timer}.
* @throws LuaException If the time is below zero.
* @see #cancelTimer To cancel a timer.
*/
@ -210,7 +210,7 @@ public final void cancelTimer( int token )
*
* @param time The time at which to fire the alarm, in the range [0.0, 24.0).
* @return The ID of the new alarm. This can be used to filter the
* {@code alarm} event, or {@link #cancelAlarm cancel the alarm}.
* {@code alarm} event, or {@link #cancelAlarm cancel the alarm}.
* @throws LuaException If the time is out of range.
* @see #cancelAlarm To cancel an alarm.
*/
@ -312,10 +312,10 @@ public final double clock()
* always be in the range [0.0, 24.0).
*
* * If called with {@code ingame}, the current world time will be returned.
* This is the default if nothing is passed.
* This is the default if nothing is passed.
* * If called with {@code utc}, returns the hour of the day in UTC time.
* * If called with {@code local}, returns the hour of the day in the
* timezone the server is located in.
* timezone the server is located in.
*
* This function can also be called with a table returned from {@link #date},
* which will convert the date fields into a UNIX timestamp (number of
@ -323,9 +323,9 @@ public final double clock()
*
* @param args The locale of the time, or a table filled by {@code os.date("*t")} to decode. Defaults to {@code ingame} locale if not specified.
* @return The hour of the selected locale, or a UNIX timestamp from the table, depending on the argument passed in.
* @throws LuaException If an invalid locale is passed.
* @cc.tparam [opt] string|table locale The locale of the time, or a table filled by {@code os.date("*t")} to decode. Defaults to {@code ingame} locale if not specified.
* @see #date To get a date table that can be converted with this function.
* @throws LuaException If an invalid locale is passed.
*/
@LuaFunction
public final Object time( IArguments args ) throws LuaException
@ -351,11 +351,11 @@ public final Object time( IArguments args ) throws LuaException
* Returns the day depending on the locale specified.
*
* * If called with {@code ingame}, returns the number of days since the
* world was created. This is the default.
* world was created. This is the default.
* * If called with {@code utc}, returns the number of days since 1 January
* 1970 in the UTC timezone.
* 1970 in the UTC timezone.
* * If called with {@code local}, returns the number of days since 1
* January 1970 in the server's local timezone.
* January 1970 in the server's local timezone.
*
* @param args The locale to get the day for. Defaults to {@code ingame} if not set.
* @return The day depending on the selected locale.
@ -381,11 +381,11 @@ public final int day( Optional<String> args ) throws LuaException
* Returns the number of milliseconds since an epoch depending on the locale.
*
* * If called with {@code ingame}, returns the number of milliseconds since the
* world was created. This is the default.
* world was created. This is the default.
* * If called with {@code utc}, returns the number of milliseconds since 1
* January 1970 in the UTC timezone.
* January 1970 in the UTC timezone.
* * If called with {@code local}, returns the number of milliseconds since 1
* January 1970 in the server's local timezone.
* January 1970 in the server's local timezone.
*
* @param args The locale to get the milliseconds for. Defaults to {@code ingame} if not set.
* @return The milliseconds since the epoch depending on the selected locale.
@ -435,7 +435,7 @@ public final long epoch( Optional<String> args ) throws LuaException
* timestamp (days since 1 January 1970) with {@link #date}.
*
* @param formatA The format of the string to return. This defaults to {@code %c}, which expands to a string similar to "Sat Dec 24 16:58:00 2011".
* @param timeA The time to convert to a string. This defaults to the current time.
* @param timeA The time to convert to a string. This defaults to the current time.
* @return The resulting format string.
* @throws LuaException If an invalid format is passed.
*/

View File

@ -10,7 +10,6 @@
import dan200.computercraft.core.filesystem.TrackingCloseable;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;

View File

@ -11,7 +11,6 @@
import dan200.computercraft.api.lua.LuaValues;
import dan200.computercraft.core.filesystem.TrackingCloseable;
import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

View File

@ -11,7 +11,6 @@
import javax.annotation.Nonnull;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;

View File

@ -13,7 +13,6 @@
import javax.annotation.Nonnull;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.IOException;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;

View File

@ -20,8 +20,6 @@
import java.util.Arrays;
import java.util.Iterator;
import dan200.computercraft.core.apis.IAPIEnvironment.IPeripheralChangeListener;
/**
* Represents the "environment" that a {@link Computer} exists in.
*

View File

@ -1,3 +1,8 @@
/*
* 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.core.filesystem;
import java.io.Closeable;

View File

@ -16,6 +16,8 @@
import dan200.computercraft.core.apis.http.options.AddressRuleConfig;
import dan200.computercraft.shared.peripheral.monitor.MonitorRenderer;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.Builder;
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
@ -28,12 +30,6 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static net.minecraftforge.common.ForgeConfigSpec.Builder;
import static net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
import net.minecraftforge.common.ForgeConfigSpec.Builder;
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD )
public final class Config
{

View File

@ -24,8 +24,6 @@
import javax.annotation.Nullable;
import java.util.Random;
import net.minecraft.block.Block.Properties;
public abstract class BlockGeneric extends Block
{
private final RegistryObject<? extends TileEntityType<? extends TileGeneric>> type;

View File

@ -23,8 +23,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block.Properties;
public class BlockComputer extends BlockComputerBase<TileComputer>
{
public static final EnumProperty<ComputerState> STATE = EnumProperty.create( "state", ComputerState.class );

View File

@ -34,8 +34,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block.Properties;
public abstract class BlockComputerBase<T extends TileComputerBase> extends BlockGeneric implements IBundledRedstoneBlock
{
private static final ResourceLocation DROP = new ResourceLocation( ComputerCraft.MOD_ID, "computer" );

View File

@ -12,8 +12,6 @@
import javax.annotation.Nonnull;
import net.minecraft.item.Item.Properties;
public class ItemComputer extends ItemComputerBase
{
public ItemComputer( BlockComputer block, Properties settings )

View File

@ -24,8 +24,6 @@
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.item.Item.Properties;
public abstract class ItemComputerBase extends BlockItem implements IComputerItem, IMedia
{
private final ComputerFamily family;

View File

@ -15,8 +15,6 @@
import javax.annotation.Nonnull;
import dan200.computercraft.shared.computer.recipe.ComputerFamilyRecipe.Serializer;
public class ComputerUpgradeRecipe extends ComputerFamilyRecipe
{
public ComputerUpgradeRecipe( ResourceLocation identifier, String group, int width, int height, NonNullList<Ingredient> ingredients, ItemStack result, ComputerFamily family )

View File

@ -16,8 +16,6 @@
import java.util.Collections;
import java.util.Set;
import net.minecraft.world.storage.loot.conditions.ILootCondition.IBuilder;
/**
* A loot condition which checks if the tile entity has a name.
*/

View File

@ -16,8 +16,6 @@
import java.util.Collections;
import java.util.Set;
import net.minecraft.world.storage.loot.conditions.ILootCondition.IBuilder;
/**
* A loot condition which checks if the tile entity has has a non-0 ID.
*/

View File

@ -16,8 +16,6 @@
import java.util.Collections;
import java.util.Set;
import net.minecraft.world.storage.loot.conditions.ILootCondition.IBuilder;
/**
* A loot condition which checks if the entity is in creative mode.
*/

View File

@ -31,8 +31,6 @@
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.item.Item.Properties;
public class ItemDisk extends Item implements IMedia, IColouredItem
{
private static final String NBT_ID = "DiskId";

View File

@ -23,8 +23,6 @@
import javax.annotation.Nonnull;
import java.util.List;
import net.minecraft.item.Item.Properties;
public class ItemPrintout extends Item
{
private static final String NBT_TITLE = "Title";

View File

@ -29,8 +29,6 @@
import java.io.IOException;
import java.util.List;
import net.minecraft.item.Item.Properties;
public class ItemTreasureDisk extends Item implements IMedia
{
private static final String NBT_TITLE = "Title";

View File

@ -27,8 +27,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block.Properties;
public class BlockDiskDrive extends BlockGeneric
{
static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;

View File

@ -90,7 +90,7 @@ public static int size( IItemHandler inventory )
* Get detailed information about an item.
*
* @param inventory The current inventory.
* @param slot The slot to get information about.
* @param slot The slot to get information about.
* @return Information about the item in this slot, or {@code nil} if not present.
* @throws LuaException If the slot is out of range.
* @cc.treturn table Information about the item in this slot, or {@code nil} if not present.
@ -111,17 +111,16 @@ public static int size( IItemHandler inventory )
* This allows you to push an item in an inventory to another inventory <em>on the same wired network</em>. Both
* inventories must attached to wired modems which are connected via a cable.
*
* @param from Inventory to move items from.
* @param from Inventory to move items from.
* @param computer The current computer.
* @param toName The name of the peripheral/inventory to push to. This is the string given to @{peripheral.wrap},
* and displayed by the wired modem.
* @param toName The name of the peripheral/inventory to push to. This is the string given to @{peripheral.wrap},
* and displayed by the wired modem.
* @param fromSlot The slot in the current inventory to move items to.
* @param limit The maximum number of items to move. Defaults to the current stack limit.
* @param toSlot The slot in the target inventory to move to. If not given, the item will be inserted into any slot.
* @param limit The maximum number of items to move. Defaults to the current stack limit.
* @param toSlot The slot in the target inventory to move to. If not given, the item will be inserted into any slot.
* @return The number of transferred items.
* @throws LuaException If the peripheral to transfer to doesn't exist or isn't an inventory.
* @throws LuaException If either source or destination slot is out of range.
*
* @cc.see peripheral.getName Allows you to get the name of a @{peripheral.wrap|wrapped} peripheral.
* @cc.usage Wrap two chests, and push an item from one to another.
* <pre>{@code
@ -159,17 +158,16 @@ public static int pushItems(
* This allows you to transfer items between inventories <em>on the same wired network</em>. Both this and the source
* inventory must attached to wired modems which are connected via a cable.
*
* @param to Inventory to move items to.
* @param to Inventory to move items to.
* @param computer The current computer.
* @param fromName The name of the peripheral/inventory to pull from. This is the string given to @{peripheral.wrap},
* and displayed by the wired modem.
* and displayed by the wired modem.
* @param fromSlot The slot in the source inventory to move items from.
* @param limit The maximum number of items to move. Defaults to the current stack limit.
* @param toSlot The slot in current inventory to move to. If not given, the item will be inserted into any slot.
* @param limit The maximum number of items to move. Defaults to the current stack limit.
* @param toSlot The slot in current inventory to move to. If not given, the item will be inserted into any slot.
* @return The number of transferred items.
* @throws LuaException If the peripheral to transfer to doesn't exist or isn't an inventory.
* @throws LuaException If either source or destination slot is out of range.
*
* @cc.see peripheral.getName Allows you to get the name of a @{peripheral.wrap|wrapped} peripheral.
* @cc.usage Wrap two chests, and push an item from one to another.
* <pre>{@code

View File

@ -40,8 +40,6 @@
import static dan200.computercraft.shared.util.WaterloggableHelpers.*;
import net.minecraft.block.Block.Properties;
public class BlockCable extends BlockGeneric implements IWaterLoggable
{
public static final EnumProperty<CableModemVariant> MODEM = EnumProperty.create( "modem", CableModemVariant.class );

View File

@ -12,8 +12,6 @@
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.block.Block.Properties;
public class BlockWiredModemFull extends BlockGeneric
{
public static final BooleanProperty MODEM_ON = BooleanProperty.create( "modem" );

View File

@ -23,8 +23,6 @@
import static dan200.computercraft.shared.peripheral.modem.wired.BlockCable.*;
import net.minecraft.item.Item.Properties;
public abstract class ItemBlockCable extends BlockItem
{
private String translationKey;

View File

@ -31,8 +31,6 @@
import static dan200.computercraft.shared.util.WaterloggableHelpers.*;
import net.minecraft.block.Block.Properties;
public class BlockWirelessModem extends BlockGeneric implements IWaterLoggable
{
public static final DirectionProperty FACING = BlockStateProperties.FACING;

View File

@ -25,8 +25,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block.Properties;
public class BlockMonitor extends BlockGeneric
{
public static final DirectionProperty ORIENTATION = DirectionProperty.create( "orientation",

View File

@ -27,8 +27,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block.Properties;
public class BlockPrinter extends BlockGeneric
{
private static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;

View File

@ -46,8 +46,8 @@ public String getType()
* Writes text to the current page.
*
* @param arguments The values to write to the page.
* @cc.tparam string|number ... The values to write to the page.
* @throws LuaException If any values couldn't be converted to a string, or if no page is started.
* @cc.tparam string|number ... The values to write to the page.
*/
@LuaFunction
public final void write( IArguments arguments ) throws LuaException
@ -62,9 +62,9 @@ public final void write( IArguments arguments ) throws LuaException
* Returns the current position of the cursor on the page.
*
* @return The position of the cursor.
* @throws LuaException If a page isn't being printed.
* @cc.treturn number The X position of the cursor.
* @cc.treturn number The Y position of the cursor.
* @throws LuaException If a page isn't being printed.
*/
@LuaFunction
public final Object[] getCursorPos() throws LuaException
@ -93,9 +93,9 @@ public final void setCursorPos( int x, int y ) throws LuaException
* Returns the size of the current page.
*
* @return The size of the page.
* @throws LuaException If a page isn't being printed.
* @cc.treturn number The width of the page.
* @cc.treturn number The height of the page.
* @throws LuaException If a page isn't being printed.
*/
@LuaFunction
public final Object[] getPageSize() throws LuaException

View File

@ -17,7 +17,10 @@
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.*;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.*;

View File

@ -17,8 +17,6 @@
import javax.annotation.Nullable;
import net.minecraft.block.Block.Properties;
public class BlockSpeaker extends BlockGeneric
{
private static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;

View File

@ -66,9 +66,9 @@ public String getType()
* with an optional volume and speed multiplier, and plays it through the speaker.
*
* @param context The Lua context
* @param name The name of the sound to play.
* @param name The name of the sound to play.
* @param volumeA The volume to play the sound at, from 0.0 to 3.0. Defaults to 1.0.
* @param pitchA The speed to play the sound at, from 0.5 to 2.0. Defaults to 1.0.
* @param pitchA The speed to play the sound at, from 0.5 to 2.0. Defaults to 1.0.
* @return Whether the sound could be played.
* @throws LuaException If the sound name couldn't be decoded.
*/
@ -102,9 +102,9 @@ public final boolean playSound( ILuaContext context, String name, Optional<Doubl
* and 6 and 18 map to C.
*
* @param context The Lua context
* @param name The name of the note to play.
* @param name The name of the note to play.
* @param volumeA The volume to play the note at, from 0.0 to 3.0. Defaults to 1.0.
* @param pitchA The pitch to play the note at in semitones, from 0 to 24. Defaults to 12.
* @param pitchA The pitch to play the note at in semitones, from 0 to 24. Defaults to 12.
* @return Whether the note could be played.
* @throws LuaException If the instrument doesn't exist.
*/

View File

@ -45,8 +45,6 @@
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.item.Item.Properties;
public class ItemPocketComputer extends Item implements IComputerItem, IMedia, IColouredItem
{
private static final String NBT_UPGRADE = "Upgrade";

View File

@ -44,8 +44,6 @@
import static dan200.computercraft.shared.util.WaterloggableHelpers.*;
import static net.minecraft.state.properties.BlockStateProperties.WATERLOGGED;
import net.minecraft.block.Block.Properties;
public class BlockTurtle extends BlockComputerBase<TileTurtle> implements IWaterLoggable
{
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;

View File

@ -27,8 +27,6 @@
import static dan200.computercraft.shared.turtle.core.TurtleBrain.*;
import net.minecraft.item.Item.Properties;
public class ItemTurtle extends ItemComputerBase implements ITurtleItem
{
public ItemTurtle( BlockTurtle block, Properties settings )

View File

@ -17,8 +17,6 @@
import javax.annotation.Nonnull;
import dan200.computercraft.shared.computer.recipe.ComputerFamilyRecipe.Serializer;
public final class TurtleRecipe extends ComputerFamilyRecipe
{
private TurtleRecipe( ResourceLocation identifier, String group, int width, int height, NonNullList<Ingredient> ingredients, ItemStack result, ComputerFamily family )