diff --git a/codeInspectionSettings.xml b/codeInspectionSettings.xml
index 0e6f45b64..2862d72b4 100644
--- a/codeInspectionSettings.xml
+++ b/codeInspectionSettings.xml
@@ -1290,12 +1290,12 @@
-
+
-
+
@@ -1490,7 +1490,7 @@
-
+
@@ -1657,10 +1657,10 @@
-
+
-
+
diff --git a/gradle.properties b/gradle.properties
index 37d5ad43b..0c76c812c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,5 +1,5 @@
# Mod properties
-mod_version=1.81.1
+mod_version=1.82.0
# Minecraft properties
mc_version=1.12.2
diff --git a/src/main/java/dan200/computercraft/ComputerCraft.java b/src/main/java/dan200/computercraft/ComputerCraft.java
index c506d8e3d..ae6fca8f4 100644
--- a/src/main/java/dan200/computercraft/ComputerCraft.java
+++ b/src/main/java/dan200/computercraft/ComputerCraft.java
@@ -51,7 +51,7 @@ import dan200.computercraft.shared.peripheral.modem.wireless.WirelessNetwork;
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
import dan200.computercraft.shared.pocket.peripherals.PocketModem;
import dan200.computercraft.shared.pocket.peripherals.PocketSpeaker;
-import dan200.computercraft.shared.proxy.IComputerCraftProxy;
+import dan200.computercraft.shared.proxy.ComputerCraftProxyCommon;
import dan200.computercraft.shared.turtle.blocks.BlockTurtle;
import dan200.computercraft.shared.turtle.items.ItemTurtleAdvanced;
import dan200.computercraft.shared.turtle.items.ItemTurtleLegacy;
@@ -248,7 +248,7 @@ public class ComputerCraft
clientSide = "dan200.computercraft.client.proxy.ComputerCraftProxyClient",
serverSide = "dan200.computercraft.shared.proxy.ComputerCraftProxyCommon"
)
- private static IComputerCraftProxy proxy;
+ private static ComputerCraftProxyCommon proxy;
@Mod.EventHandler
public void preInit( FMLPreInitializationEvent event )
@@ -270,7 +270,7 @@ public class ComputerCraft
@Mod.EventHandler
public void onServerStarting( FMLServerStartingEvent event )
{
- proxy.initServer( event.getServer() );
+ ComputerCraftProxyCommon.initServer( event.getServer() );
}
@Mod.EventHandler
diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/AbstractTurtleUpgrade.java b/src/main/java/dan200/computercraft/api/AbstractTurtleUpgrade.java
similarity index 67%
rename from src/main/java/dan200/computercraft/shared/turtle/upgrades/AbstractTurtleUpgrade.java
rename to src/main/java/dan200/computercraft/api/AbstractTurtleUpgrade.java
index 531eba445..ab9f86b50 100644
--- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/AbstractTurtleUpgrade.java
+++ b/src/main/java/dan200/computercraft/api/AbstractTurtleUpgrade.java
@@ -4,7 +4,7 @@
* Send enquiries to dratcliffe@gmail.com
*/
-package dan200.computercraft.shared.turtle.upgrades;
+package dan200.computercraft.api;
import dan200.computercraft.api.turtle.ITurtleUpgrade;
import dan200.computercraft.api.turtle.TurtleUpgradeType;
@@ -15,6 +15,11 @@ import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
+/**
+ * A base class for {@link ITurtleUpgrade}s.
+ *
+ * One does not have to use this, but it does provide a convenient template.
+ */
public abstract class AbstractTurtleUpgrade implements ITurtleUpgrade
{
private final ResourceLocation id;
@@ -23,7 +28,7 @@ public abstract class AbstractTurtleUpgrade implements ITurtleUpgrade
private final String adjective;
private final ItemStack stack;
- public AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, String adjective, ItemStack stack )
+ protected AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, String adjective, ItemStack stack )
{
this.id = id;
this.legacyId = legacyId;
@@ -32,27 +37,27 @@ public abstract class AbstractTurtleUpgrade implements ITurtleUpgrade
this.stack = stack;
}
- public AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, String adjective, Item item )
+ protected AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, String adjective, Item item )
{
this( id, legacyId, type, adjective, new ItemStack( item ) );
}
- public AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, String adjective, Block block )
+ protected AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, String adjective, Block block )
{
this( id, legacyId, type, adjective, new ItemStack( block ) );
}
- public AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, ItemStack stack )
+ protected AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, ItemStack stack )
{
this( id, legacyId, type, "upgrade." + id + ".adjective", stack );
}
- public AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, Item item )
+ protected AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, Item item )
{
this( id, legacyId, type, new ItemStack( item ) );
}
- public AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, Block block )
+ protected AbstractTurtleUpgrade( ResourceLocation id, int legacyId, TurtleUpgradeType type, Block block )
{
this( id, legacyId, type, new ItemStack( block ) );
}
diff --git a/src/main/java/dan200/computercraft/api/media/IMedia.java b/src/main/java/dan200/computercraft/api/media/IMedia.java
index 35682e1fa..efc752d7f 100644
--- a/src/main/java/dan200/computercraft/api/media/IMedia.java
+++ b/src/main/java/dan200/computercraft/api/media/IMedia.java
@@ -46,7 +46,7 @@ public interface IMedia
/**
* If this disk represents an item with audio (like a record), get the readable name of the audio track. ie:
- * "Jonathon Coulton - Still Alive"
+ * "Jonathan Coulton - Still Alive"
*
* @param stack The {@link ItemStack} to modify.
* @return The name, or null if this item does not represent an item with audio.
diff --git a/src/main/java/dan200/computercraft/shared/pocket/peripherals/AbstractPocketUpgrade.java b/src/main/java/dan200/computercraft/api/pocket/AbstractPocketUpgrade.java
similarity index 87%
rename from src/main/java/dan200/computercraft/shared/pocket/peripherals/AbstractPocketUpgrade.java
rename to src/main/java/dan200/computercraft/api/pocket/AbstractPocketUpgrade.java
index e696dc0ee..5f345a894 100644
--- a/src/main/java/dan200/computercraft/shared/pocket/peripherals/AbstractPocketUpgrade.java
+++ b/src/main/java/dan200/computercraft/api/pocket/AbstractPocketUpgrade.java
@@ -4,14 +4,18 @@
* Send enquiries to dratcliffe@gmail.com
*/
-package dan200.computercraft.shared.pocket.peripherals;
+package dan200.computercraft.api.pocket;
-import dan200.computercraft.api.pocket.IPocketUpgrade;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
+/**
+ * A base class for {@link IPocketUpgrade}s.
+ *
+ * One does not have to use this, but it does provide a convenient template.
+ */
public abstract class AbstractPocketUpgrade implements IPocketUpgrade
{
private final ResourceLocation id;
diff --git a/src/main/java/dan200/computercraft/api/turtle/event/TurtleInventoryEvent.java b/src/main/java/dan200/computercraft/api/turtle/event/TurtleInventoryEvent.java
index c5151fcd9..9e1ecf693 100644
--- a/src/main/java/dan200/computercraft/api/turtle/event/TurtleInventoryEvent.java
+++ b/src/main/java/dan200/computercraft/api/turtle/event/TurtleInventoryEvent.java
@@ -11,7 +11,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
-import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nonnull;
@@ -21,7 +20,6 @@ import java.util.Objects;
/**
* Fired when a turtle attempts to interact with an inventory.
*/
-@Cancelable
public abstract class TurtleInventoryEvent extends TurtleBlockEvent
{
private final IItemHandler handler;
diff --git a/src/main/java/dan200/computercraft/client/ClientRegistry.java b/src/main/java/dan200/computercraft/client/ClientRegistry.java
index bfc841c6c..da81a77bb 100644
--- a/src/main/java/dan200/computercraft/client/ClientRegistry.java
+++ b/src/main/java/dan200/computercraft/client/ClientRegistry.java
@@ -11,6 +11,7 @@ import dan200.computercraft.client.render.TurtleModelLoader;
import dan200.computercraft.shared.media.items.ItemDiskLegacy;
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
import dan200.computercraft.shared.turtle.items.ItemTurtleBase;
+import dan200.computercraft.shared.util.Colour;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.IBakedModel;
@@ -132,7 +133,10 @@ public final class ClientRegistry
case 1: // Frame colour
return ComputerCraft.Items.pocketComputer.getColour( stack );
case 2: // Light colour
- return ItemPocketComputer.getLightState( stack );
+ {
+ int light = ItemPocketComputer.getLightState( stack );
+ return light == -1 ? Colour.Black.getHex() : light;
+ }
}
}, ComputerCraft.Items.pocketComputer );
diff --git a/src/main/java/dan200/computercraft/client/render/TileEntityCableRenderer.java b/src/main/java/dan200/computercraft/client/render/TileEntityCableRenderer.java
index 2af954ba8..16eb83c45 100644
--- a/src/main/java/dan200/computercraft/client/render/TileEntityCableRenderer.java
+++ b/src/main/java/dan200/computercraft/client/render/TileEntityCableRenderer.java
@@ -61,11 +61,11 @@ public class TileEntityCableRenderer extends TileEntitySpecialRenderer m_mounts = new HashSet<>();
- protected ComputerAccess( IAPIEnvironment m_environment )
+ protected ComputerAccess( IAPIEnvironment environment )
{
- this.m_environment = m_environment;
+ this.m_environment = environment;
}
public void unmountAll()
{
FileSystem fileSystem = m_environment.getFileSystem();
- for( String m_mount : m_mounts )
+ for( String mount : m_mounts )
{
- fileSystem.unmount( m_mount );
+ fileSystem.unmount( mount );
}
m_mounts.clear();
}
diff --git a/src/main/java/dan200/computercraft/core/apis/FSAPI.java b/src/main/java/dan200/computercraft/core/apis/FSAPI.java
index b52d65672..2f1f92299 100644
--- a/src/main/java/dan200/computercraft/core/apis/FSAPI.java
+++ b/src/main/java/dan200/computercraft/core/apis/FSAPI.java
@@ -34,9 +34,9 @@ public class FSAPI implements ILuaAPI
private IAPIEnvironment m_env;
private FileSystem m_fileSystem;
- public FSAPI( IAPIEnvironment _env )
+ public FSAPI( IAPIEnvironment env )
{
- m_env = _env;
+ m_env = env;
m_fileSystem = null;
}
diff --git a/src/main/java/dan200/computercraft/core/apis/PeripheralAPI.java b/src/main/java/dan200/computercraft/core/apis/PeripheralAPI.java
index 6b0f817b1..6066cc7b0 100644
--- a/src/main/java/dan200/computercraft/core/apis/PeripheralAPI.java
+++ b/src/main/java/dan200/computercraft/core/apis/PeripheralAPI.java
@@ -228,9 +228,9 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
private final PeripheralWrapper[] m_peripherals;
private boolean m_running;
- public PeripheralAPI( IAPIEnvironment _environment )
+ public PeripheralAPI( IAPIEnvironment environment )
{
- m_environment = _environment;
+ m_environment = environment;
m_environment.setPeripheralChangeListener( this );
m_peripherals = new PeripheralWrapper[6];
diff --git a/src/main/java/dan200/computercraft/core/apis/TermAPI.java b/src/main/java/dan200/computercraft/core/apis/TermAPI.java
index eab698832..70460d3ed 100644
--- a/src/main/java/dan200/computercraft/core/apis/TermAPI.java
+++ b/src/main/java/dan200/computercraft/core/apis/TermAPI.java
@@ -24,10 +24,10 @@ public class TermAPI implements ILuaAPI
private final Terminal m_terminal;
private final IComputerEnvironment m_environment;
- public TermAPI( IAPIEnvironment _environment )
+ public TermAPI( IAPIEnvironment environment )
{
- m_terminal = _environment.getTerminal();
- m_environment = _environment.getComputerEnvironment();
+ m_terminal = environment.getTerminal();
+ m_environment = environment.getComputerEnvironment();
}
@Override
diff --git a/src/main/java/dan200/computercraft/core/computer/ComputerSystem.java b/src/main/java/dan200/computercraft/core/computer/ComputerSystem.java
index f6847202e..e6c39ec83 100644
--- a/src/main/java/dan200/computercraft/core/computer/ComputerSystem.java
+++ b/src/main/java/dan200/computercraft/core/computer/ComputerSystem.java
@@ -28,10 +28,10 @@ public class ComputerSystem extends ComputerAccess implements IComputerSystem
{
private final IAPIEnvironment m_environment;
- ComputerSystem( IAPIEnvironment m_environment )
+ ComputerSystem( IAPIEnvironment environment )
{
- super( m_environment );
- this.m_environment = m_environment;
+ super( environment );
+ this.m_environment = environment;
}
@Nonnull
diff --git a/src/main/java/dan200/computercraft/core/computer/MainThreadExecutor.java b/src/main/java/dan200/computercraft/core/computer/MainThreadExecutor.java
index 6fde7fcec..8d12d6dbd 100644
--- a/src/main/java/dan200/computercraft/core/computer/MainThreadExecutor.java
+++ b/src/main/java/dan200/computercraft/core/computer/MainThreadExecutor.java
@@ -26,8 +26,8 @@ import java.util.concurrent.TimeUnit;
* the executor goes through three stages:
*
* When {@link State#COOL}, the computer is allocated {@link ComputerCraft#maxMainComputerTime}ns to execute any work
- * this tick. At the beginning of the tick, we execute as many {@link MainThread} tasks as possible, until our timeframe
- * or the global time frame has expired.
+ * this tick. At the beginning of the tick, we execute as many {@link MainThread} tasks as possible, until our
+ * time-frame or the global time frame has expired.
*
* Then, when other objects (such as {@link TileEntity}) are ticked, we update how much time we've used using
* {@link IWorkMonitor#trackWork(long, TimeUnit)}.
diff --git a/src/main/java/dan200/computercraft/core/filesystem/FileSystemWrapperMount.java b/src/main/java/dan200/computercraft/core/filesystem/FileSystemWrapperMount.java
index dc0bd6b7e..01b110dc3 100644
--- a/src/main/java/dan200/computercraft/core/filesystem/FileSystemWrapperMount.java
+++ b/src/main/java/dan200/computercraft/core/filesystem/FileSystemWrapperMount.java
@@ -23,9 +23,9 @@ public class FileSystemWrapperMount implements IFileSystem
{
private final FileSystem m_filesystem;
- public FileSystemWrapperMount( FileSystem m_filesystem )
+ public FileSystemWrapperMount( FileSystem filesystem )
{
- this.m_filesystem = m_filesystem;
+ this.m_filesystem = filesystem;
}
@Override
diff --git a/src/main/java/dan200/computercraft/shared/BundledRedstone.java b/src/main/java/dan200/computercraft/shared/BundledRedstone.java
index a2a3ab774..1cf8dbdeb 100644
--- a/src/main/java/dan200/computercraft/shared/BundledRedstone.java
+++ b/src/main/java/dan200/computercraft/shared/BundledRedstone.java
@@ -22,6 +22,8 @@ public final class BundledRedstone
{
private static final Set providers = new LinkedHashSet<>();
+ private BundledRedstone() {}
+
public static void register( @Nonnull IBundledRedstoneProvider provider )
{
Preconditions.checkNotNull( provider, "provider cannot be null" );
diff --git a/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java b/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java
index 3a33e7296..bc60d2f0e 100644
--- a/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java
+++ b/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java
@@ -52,10 +52,10 @@ public abstract class BlockGeneric extends Block implements ITileEntityProvider
@Override
@Deprecated
@SuppressWarnings( "deprecation" )
- public final void neighborChanged( IBlockState state, World world, BlockPos pos, Block block, BlockPos neighbour )
+ public final void neighborChanged( IBlockState state, World world, BlockPos pos, Block neighbourBlock, BlockPos neighbourPos )
{
TileEntity tile = world.getTileEntity( pos );
- if( tile instanceof TileGeneric ) ((TileGeneric) tile).onNeighbourChange( neighbour );
+ if( tile instanceof TileGeneric ) ((TileGeneric) tile).onNeighbourChange( neighbourPos );
}
@Override
@@ -91,11 +91,7 @@ public abstract class BlockGeneric extends Block implements ITileEntityProvider
public final int getStrongPower( IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing oppositeSide )
{
TileEntity tile = world.getTileEntity( pos );
- if( tile instanceof TileGeneric && tile.hasWorld() )
- {
- return ((TileGeneric) tile).getRedstoneOutput( oppositeSide.getOpposite() );
- }
- return 0;
+ return tile instanceof TileGeneric && tile.hasWorld() ? ((TileGeneric) tile).getRedstoneOutput( oppositeSide.getOpposite() ) : 0;
}
@Override
@@ -114,11 +110,7 @@ public abstract class BlockGeneric extends Block implements ITileEntityProvider
public int getBundledRedstoneOutput( World world, BlockPos pos, EnumFacing side )
{
TileEntity tile = world.getTileEntity( pos );
- if( tile instanceof TileGeneric && tile.hasWorld() )
- {
- return ((TileGeneric) tile).getBundledRedstoneOutput( side );
- }
- return 0;
+ return tile instanceof TileGeneric && tile.hasWorld() ? ((TileGeneric) tile).getBundledRedstoneOutput( side ) : 0;
}
@Nonnull
diff --git a/src/main/java/dan200/computercraft/shared/common/ColourableRecipe.java b/src/main/java/dan200/computercraft/shared/common/ColourableRecipe.java
index 0233059c8..c975b259a 100644
--- a/src/main/java/dan200/computercraft/shared/common/ColourableRecipe.java
+++ b/src/main/java/dan200/computercraft/shared/common/ColourableRecipe.java
@@ -78,11 +78,7 @@ public class ColourableRecipe extends IForgeRegistryEntry.Impl implemen
}
}
- if( colourable.isEmpty() )
- {
- return ItemStack.EMPTY;
- }
-
+ if( colourable.isEmpty() ) return ItemStack.EMPTY;
return ((IColouredItem) colourable.getItem()).withColour( colourable, tracker.getColour() );
}
diff --git a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java b/src/main/java/dan200/computercraft/shared/common/TileGeneric.java
index cc7856373..850bf844c 100644
--- a/src/main/java/dan200/computercraft/shared/common/TileGeneric.java
+++ b/src/main/java/dan200/computercraft/shared/common/TileGeneric.java
@@ -130,7 +130,6 @@ public abstract class TileGeneric extends TileEntity
@Override
public final SPacketUpdateTileEntity getUpdatePacket()
{
- // Communicate properties
NBTTagCompound nbt = new NBTTagCompound();
writeDescription( nbt );
return new SPacketUpdateTileEntity( getPos(), 0, nbt );
diff --git a/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java b/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java
index 0e8b334cc..5ebf305c9 100644
--- a/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java
+++ b/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java
@@ -26,6 +26,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -67,38 +68,30 @@ public class CommandAPI implements ILuaAPI
private static Map