diff --git a/build.gradle b/build.gradle
index b831ba06c..e9a807c54 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,7 @@ plugins {
id 'fabric-loom' version '0.9-SNAPSHOT'
id 'maven-publish'
id "checkstyle"
- id "com.github.hierynomus.license" version "0.15.0"
+ id "com.github.hierynomus.license" version "0.16.1"
}
java {
@@ -37,7 +37,7 @@ configurations {
}
dependencies {
- checkstyle "com.puppycrawl.tools:checkstyle:8.25"
+ checkstyle 'com.puppycrawl.tools:checkstyle:8.45.1'
minecraft "com.mojang:minecraft:${mc_version}"
mappings "net.fabricmc:yarn:${mc_version}+build.${mappings_version}:v2"
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
index aaafdfd01..ebc62360c 100644
--- a/config/checkstyle/checkstyle.xml
+++ b/config/checkstyle/checkstyle.xml
@@ -58,13 +58,13 @@
-
+
-
+
diff --git a/src/main/java/dan200/computercraft/api/turtle/FakePlayer.java b/src/main/java/dan200/computercraft/api/turtle/FakePlayer.java
index 3d1aa1585..e534e648e 100644
--- a/src/main/java/dan200/computercraft/api/turtle/FakePlayer.java
+++ b/src/main/java/dan200/computercraft/api/turtle/FakePlayer.java
@@ -133,30 +133,30 @@ public class FakePlayer extends ServerPlayerEntity
{
}
-// @Override
-// public void onSlotUpdate( ScreenHandler container, int slot, ItemStack stack )
-// {
-// }
-//
-// @Override
-// public void onHandlerRegistered( ScreenHandler container, DefaultedList defaultedList )
-// {
-// }
-//
-// @Override
-// public void onPropertyUpdate( ScreenHandler container, int key, int value )
-// {
-// }
+ // @Override
+ // public void onSlotUpdate( ScreenHandler container, int slot, ItemStack stack )
+ // {
+ // }
+ //
+ // @Override
+ // public void onHandlerRegistered( ScreenHandler container, DefaultedList defaultedList )
+ // {
+ // }
+ //
+ // @Override
+ // public void onPropertyUpdate( ScreenHandler container, int key, int value )
+ // {
+ // }
@Override
public void closeHandledScreen()
{
}
-// @Override
-// public void updateCursorStack()
-// {
-// }
+ // @Override
+ // public void updateCursorStack()
+ // {
+ // }
@Override
public int unlockRecipes( Collection> recipes )
@@ -211,10 +211,10 @@ public class FakePlayer extends ServerPlayerEntity
{
}
-// @Override
-// public void setGameMode( GameMode gameMode )
-// {
-// }
+ // @Override
+ // public void setGameMode( GameMode gameMode )
+ // {
+ // }
@Override
public void sendMessage( Text message, MessageType type, UUID senderUuid )
@@ -228,15 +228,15 @@ public class FakePlayer extends ServerPlayerEntity
return "[Fake Player]";
}
-// @Override
-// public void sendResourcePackUrl( String url, String hash )
-// {
-// }
+ // @Override
+ // public void sendResourcePackUrl( String url, String hash )
+ // {
+ // }
-// @Override
-// public void onStoppedTracking( Entity entity )
-// {
-// }
+ // @Override
+ // public void onStoppedTracking( Entity entity )
+ // {
+ // }
@Override
public void setCameraEntity( Entity entity )
diff --git a/src/main/java/dan200/computercraft/client/ClientTableFormatter.java b/src/main/java/dan200/computercraft/client/ClientTableFormatter.java
index 8a0fdb581..194c23689 100644
--- a/src/main/java/dan200/computercraft/client/ClientTableFormatter.java
+++ b/src/main/java/dan200/computercraft/client/ClientTableFormatter.java
@@ -21,10 +21,6 @@ import org.apache.commons.lang3.StringUtils;
import javax.annotation.Nullable;
-@SuppressWarnings( {
- "MethodCallSideOnly",
- "LocalVariableDeclarationSideOnly"
-} )
public class ClientTableFormatter implements TableFormatter
{
public static final ClientTableFormatter INSTANCE = new ClientTableFormatter();
diff --git a/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java b/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java
index 48a1b67e5..1373bbc61 100644
--- a/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java
+++ b/src/main/java/dan200/computercraft/client/gui/ComputerScreenBase.java
@@ -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.client.gui;
import dan200.computercraft.ComputerCraft;
@@ -100,8 +105,7 @@ public abstract class ComputerScreenBase extend
@Override
public final boolean mouseDragged( double x, double y, int button, double deltaX, double deltaY )
{
- return (getFocused() != null && getFocused().mouseDragged( x, y, button, deltaX, deltaY ))
- || super.mouseDragged( x, y, button, deltaX, deltaY );
+ return getFocused() != null && getFocused().mouseDragged( x, y, button, deltaX, deltaY ) || super.mouseDragged( x, y, button, deltaX, deltaY );
}
@Override
diff --git a/src/main/java/dan200/computercraft/client/render/ComputerBorderRenderer.java b/src/main/java/dan200/computercraft/client/render/ComputerBorderRenderer.java
index ec2d1149a..c36acd10e 100644
--- a/src/main/java/dan200/computercraft/client/render/ComputerBorderRenderer.java
+++ b/src/main/java/dan200/computercraft/client/render/ComputerBorderRenderer.java
@@ -5,13 +5,14 @@
*/
package dan200.computercraft.client.render;
-import com.mojang.blaze3d.systems.RenderSystem;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.shared.computer.core.ComputerFamily;
-import net.minecraft.client.render.*;
+import net.minecraft.client.render.RenderLayer;
+import net.minecraft.client.render.Tessellator;
+import net.minecraft.client.render.VertexConsumer;
+import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Matrix4f;
-import org.lwjgl.opengl.GL11;
import javax.annotation.Nonnull;
@@ -81,10 +82,10 @@ public class ComputerBorderRenderer
}
}
- public static void render(Identifier location, int x, int y, int z, int light, int width, int height )
+ public static void render( Identifier location, int x, int y, int z, int light, int width, int height )
{
- VertexConsumerProvider.Immediate source = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
- render( IDENTITY, source.getBuffer(RenderLayer.getText(location)), x, y, z, light, width, height, false, 1, 1, 1 );
+ VertexConsumerProvider.Immediate source = VertexConsumerProvider.immediate( Tessellator.getInstance().getBuffer() );
+ render( IDENTITY, source.getBuffer( RenderLayer.getText( location ) ), x, y, z, light, width, height, false, 1, 1, 1 );
source.draw();
}
@@ -144,22 +145,22 @@ public class ComputerBorderRenderer
builder.vertex( transform, x, y + height, z )
.color( r, g, b, 1.0f )
.texture( u * TEX_SCALE, (v + textureHeight) * TEX_SCALE )
- .light(light)
+ .light( light )
.next();
builder.vertex( transform, x + width, y + height, z )
.color( r, g, b, 1.0f )
.texture( (u + textureWidth) * TEX_SCALE, (v + textureHeight) * TEX_SCALE )
- .light(light)
+ .light( light )
.next();
builder.vertex( transform, x + width, y, z )
.color( r, g, b, 1.0f )
.texture( (u + textureWidth) * TEX_SCALE, v * TEX_SCALE )
- .light(light)
+ .light( light )
.next();
builder.vertex( transform, x, y, z )
.color( r, g, b, 1.0f )
.texture( u * TEX_SCALE, v * TEX_SCALE )
- .light(light)
+ .light( light )
.next();
}
}
diff --git a/src/main/java/dan200/computercraft/client/render/ItemMapLikeRenderer.java b/src/main/java/dan200/computercraft/client/render/ItemMapLikeRenderer.java
index 162579acd..f1ef584c5 100644
--- a/src/main/java/dan200/computercraft/client/render/ItemMapLikeRenderer.java
+++ b/src/main/java/dan200/computercraft/client/render/ItemMapLikeRenderer.java
@@ -144,6 +144,7 @@ public abstract class ItemMapLikeRenderer
* @param transform The matrix transformation stack
* @param render The buffer to render to
* @param stack The stack to render
+ * @param light TODO rebase
*/
protected abstract void renderItem( MatrixStack transform, VertexConsumerProvider render, ItemStack stack, int light );
}
diff --git a/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java b/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java
index 558ee3e40..23982f3a9 100644
--- a/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java
+++ b/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java
@@ -19,9 +19,8 @@ import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
-import net.minecraft.util.math.Vec3f;
import net.minecraft.util.math.Matrix4f;
-import org.lwjgl.opengl.GL11;
+import net.minecraft.util.math.Vec3f;
import static dan200.computercraft.client.gui.FixedWidthFontRenderer.FONT_HEIGHT;
import static dan200.computercraft.client.gui.FixedWidthFontRenderer.FONT_WIDTH;
@@ -104,7 +103,7 @@ public final class ItemPocketRenderer extends ItemMapLikeRenderer
transform.pop();
}
- private static void renderFrame( Matrix4f transform, VertexConsumerProvider render, ComputerFamily family, int colour, int light, int width, int height )
+ private static void renderFrame( Matrix4f transform, VertexConsumerProvider render, ComputerFamily family, int colour, int light, int width, int height )
{
RenderSystem.enableBlend();
MinecraftClient.getInstance()
diff --git a/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java b/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java
index 1d3d5383e..d4083c67f 100644
--- a/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java
+++ b/src/main/java/dan200/computercraft/client/render/MonitorHighlightRenderer.java
@@ -12,7 +12,6 @@ import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
@@ -20,7 +19,6 @@ import net.minecraft.util.math.*;
import net.minecraft.world.World;
import java.util.EnumSet;
-
import static net.minecraft.util.math.Direction.*;
/**
@@ -34,9 +32,7 @@ public final class MonitorHighlightRenderer
{
}
- public static boolean drawHighlight(
- MatrixStack matrixStack, VertexConsumer vertexConsumer, Entity entity, double d, double e, double f, BlockPos pos, BlockState blockState
- )
+ public static boolean drawHighlight( MatrixStack matrixStack, VertexConsumer vertexConsumer, Entity entity, double d, double e, double f, BlockPos pos, BlockState blockState )
{
// Preserve normal behaviour when crouching.
if( entity.isInSneakingPose() )
@@ -142,11 +138,11 @@ public final class MonitorHighlightRenderer
{
buffer.vertex( transform, x, y, z )
.color( 0, 0, 0, 0.4f )
- .normal(normal, direction.getOffsetX(), direction.getOffsetY(), direction.getOffsetZ())
+ .normal( normal, direction.getOffsetX(), direction.getOffsetY(), direction.getOffsetZ() )
.next();
buffer.vertex( transform, x + direction.getOffsetX(), y + direction.getOffsetY(), z + direction.getOffsetZ() )
.color( 0, 0, 0, 0.4f )
- .normal(normal, direction.getOffsetX(), direction.getOffsetY(), direction.getOffsetZ())
+ .normal( normal, direction.getOffsetX(), direction.getOffsetY(), direction.getOffsetZ() )
.next();
}
}
diff --git a/src/main/java/dan200/computercraft/client/render/MonitorTextureBufferShader.java b/src/main/java/dan200/computercraft/client/render/MonitorTextureBufferShader.java
index f78e134e0..bd14234a0 100644
--- a/src/main/java/dan200/computercraft/client/render/MonitorTextureBufferShader.java
+++ b/src/main/java/dan200/computercraft/client/render/MonitorTextureBufferShader.java
@@ -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.client.render;
import dan200.computercraft.client.gui.FixedWidthFontRenderer;
@@ -24,8 +29,9 @@ public class MonitorTextureBufferShader extends Shader
private final GlUniform width;
private final GlUniform height;
- public MonitorTextureBufferShader(ResourceFactory factory, String name, VertexFormat format) throws IOException {
- super(factory, name, format);
+ public MonitorTextureBufferShader( ResourceFactory factory, String name, VertexFormat format ) throws IOException
+ {
+ super( factory, name, format );
width = getUniformChecked( "Width" );
height = getUniformChecked( "Height" );
diff --git a/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java b/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java
index 3c13436d1..7b8c809a5 100644
--- a/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java
+++ b/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java
@@ -9,11 +9,9 @@ package dan200.computercraft.client.render;
import dan200.computercraft.client.gui.FixedWidthFontRenderer;
import dan200.computercraft.core.terminal.TextBuffer;
import dan200.computercraft.shared.util.Palette;
-import net.minecraft.client.render.*;
-import net.minecraft.client.render.VertexFormat.DrawMode;
-import net.minecraft.util.Identifier;
+import net.minecraft.client.render.VertexConsumer;
+import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.util.math.Matrix4f;
-import org.lwjgl.opengl.GL11;
import static dan200.computercraft.client.gui.FixedWidthFontRenderer.FONT_HEIGHT;
import static dan200.computercraft.shared.media.items.ItemPrintout.LINES_PER_PAGE;
@@ -95,7 +93,7 @@ public final class PrintoutRenderer
int leftPages = page;
int rightPages = pages - page - 1;
- VertexConsumer buffer = renderer.getBuffer(RenderTypes.PRINTOUT_BACKGROUND);
+ VertexConsumer buffer = renderer.getBuffer( RenderTypes.PRINTOUT_BACKGROUND );
if( isBook )
{
diff --git a/src/main/java/dan200/computercraft/client/render/RenderTypes.java b/src/main/java/dan200/computercraft/client/render/RenderTypes.java
index d85ae9f04..cabc1c870 100644
--- a/src/main/java/dan200/computercraft/client/render/RenderTypes.java
+++ b/src/main/java/dan200/computercraft/client/render/RenderTypes.java
@@ -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.client.render;
import dan200.computercraft.client.gui.FixedWidthFontRenderer;
@@ -7,7 +12,8 @@ import net.minecraft.util.Identifier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-public class RenderTypes {
+public class RenderTypes
+{
public static final int FULL_BRIGHT_LIGHTMAP = (0xF << 4) | (0xF << 20);
@@ -23,7 +29,7 @@ public class RenderTypes {
public static final RenderLayer TERMINAL_WITH_DEPTH = Types.TERMINAL_WITH_DEPTH;
public static final RenderLayer PRINTOUT_TEXT = Types.PRINTOUT_TEXT;
- public static final RenderLayer PRINTOUT_BACKGROUND = RenderLayer.getText(new Identifier( "computercraft", "textures/gui/printout.png" ));
+ public static final RenderLayer PRINTOUT_BACKGROUND = RenderLayer.getText( new Identifier( "computercraft", "textures/gui/printout.png" ) );
public static final RenderLayer POSITION_COLOR = Types.POSITION_COLOR;
@@ -54,8 +60,8 @@ public class RenderTypes {
public static final RenderLayer MONITOR_TBO = RenderLayer.of( "monitor_tbo", VertexFormats.POSITION_TEXTURE, VertexFormat.DrawMode.TRIANGLE_STRIP, 128, false, false, // useDelegate, needsSorting
RenderLayer.MultiPhaseParameters.builder()
- .texture(TERM_FONT_TEXTURE ) // blur, minimap
- .shader(new RenderPhase.Shader(RenderTypes::getMonitorTextureBufferShader))
+ .texture( TERM_FONT_TEXTURE ) // blur, minimap
+ .shader( new RenderPhase.Shader( RenderTypes::getMonitorTextureBufferShader ) )
.writeMaskState( RenderLayer.ALL_MASK )
.build( false ) );
@@ -72,7 +78,7 @@ public class RenderTypes {
static final RenderLayer BLOCKER = RenderLayer.of( "terminal_blocker", FORMAT, GL_MODE, 256, false, false, // useDelegate, needsSorting
RenderLayer.MultiPhaseParameters.builder()
.texture( TERM_FONT_TEXTURE )
- .shader(TERM_SHADER)
+ .shader( TERM_SHADER )
.writeMaskState( DEPTH_MASK )
.build( false ) );
@@ -91,7 +97,7 @@ public class RenderTypes {
RenderLayer.MultiPhaseParameters.builder()
.texture( TERM_FONT_TEXTURE )
.shader( RenderPhase.TEXT_SHADER )
- .lightmap(RenderPhase.ENABLE_LIGHTMAP)
+ .lightmap( RenderPhase.ENABLE_LIGHTMAP )
.build( false )
);
diff --git a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java b/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java
index 4ff55ab67..788af6805 100644
--- a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java
+++ b/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java
@@ -20,24 +20,15 @@ import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.DirectionUtil;
import net.minecraft.client.gl.VertexBuffer;
import net.minecraft.client.render.*;
-import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
-import net.minecraft.client.util.GlAllocationUtils;
-import net.minecraft.util.math.AffineTransformation;
import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.util.math.Vec3f;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.Direction;
-import net.minecraft.util.math.Matrix4f;
+import net.minecraft.util.math.*;
import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL31;
import javax.annotation.Nonnull;
-
-import java.nio.Buffer;
import java.nio.ByteBuffer;
import static dan200.computercraft.client.gui.FixedWidthFontRenderer.*;
@@ -55,7 +46,7 @@ public class TileEntityMonitorRenderer implements BlockEntityRenderer rules, String domain, InetSocketAddress socketAddress )
diff --git a/src/main/java/dan200/computercraft/core/apis/http/websocket/Websocket.java b/src/main/java/dan200/computercraft/core/apis/http/websocket/Websocket.java
index d0712a9dc..046efe79d 100644
--- a/src/main/java/dan200/computercraft/core/apis/http/websocket/Websocket.java
+++ b/src/main/java/dan200/computercraft/core/apis/http/websocket/Websocket.java
@@ -28,7 +28,6 @@ import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker;
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
import io.netty.handler.codec.http.websocketx.WebSocketVersion;
-import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketClientCompressionHandler;
import io.netty.handler.ssl.SslContext;
import java.lang.ref.WeakReference;
diff --git a/src/main/java/dan200/computercraft/core/computer/Environment.java b/src/main/java/dan200/computercraft/core/computer/Environment.java
index 3931629f1..ecc8aea80 100644
--- a/src/main/java/dan200/computercraft/core/computer/Environment.java
+++ b/src/main/java/dan200/computercraft/core/computer/Environment.java
@@ -309,9 +309,9 @@ public final class Environment implements IAPIEnvironment
{
int index = side.ordinal();
IPeripheral existing = peripherals[index];
- if( (existing == null && peripheral != null) ||
- (existing != null && peripheral == null) ||
- (existing != null && !existing.equals( peripheral )) )
+ if( existing == null && peripheral != null ||
+ existing != null && peripheral == null ||
+ existing != null && !existing.equals( peripheral ) )
{
peripherals[index] = peripheral;
if( peripheralListener != null ) peripheralListener.onPeripheralChanged( side, peripheral );
diff --git a/src/main/java/dan200/computercraft/core/filesystem/ResourceMount.java b/src/main/java/dan200/computercraft/core/filesystem/ResourceMount.java
index 8361554e8..75932953a 100644
--- a/src/main/java/dan200/computercraft/core/filesystem/ResourceMount.java
+++ b/src/main/java/dan200/computercraft/core/filesystem/ResourceMount.java
@@ -13,11 +13,12 @@ import dan200.computercraft.ComputerCraft;
import dan200.computercraft.api.filesystem.IMount;
import dan200.computercraft.core.apis.handles.ArrayByteChannel;
import dan200.computercraft.shared.util.IoUtil;
-import net.minecraft.resource.*;
-import net.minecraft.resource.ResourceReloader.Synchronizer;
+import net.minecraft.resource.ReloadableResourceManager;
+import net.minecraft.resource.Resource;
+import net.minecraft.resource.ResourceManager;
+import net.minecraft.resource.SynchronousResourceReloader;
import net.minecraft.util.Identifier;
import net.minecraft.util.InvalidIdentifierException;
-import net.minecraft.util.profiler.Profiler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -27,8 +28,6 @@ import java.io.InputStream;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.*;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
public final class ResourceMount implements IMount
diff --git a/src/main/java/dan200/computercraft/fabric/mixin/GameRendererMixin.java b/src/main/java/dan200/computercraft/fabric/mixin/GameRendererMixin.java
index ecc5957ef..a5cdf6581 100644
--- a/src/main/java/dan200/computercraft/fabric/mixin/GameRendererMixin.java
+++ b/src/main/java/dan200/computercraft/fabric/mixin/GameRendererMixin.java
@@ -1,17 +1,18 @@
+/*
+ * 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.fabric.mixin;
import com.mojang.datafixers.util.Pair;
-import dan200.computercraft.ComputerCraft;
-import dan200.computercraft.client.gui.FixedWidthFontRenderer;
import dan200.computercraft.client.render.MonitorTextureBufferShader;
import dan200.computercraft.client.render.RenderTypes;
import net.minecraft.client.gl.Program;
import net.minecraft.client.render.GameRenderer;
-import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.Shader;
-import net.minecraft.client.render.VertexFormats;
import net.minecraft.resource.ResourceManager;
-import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -22,20 +23,22 @@ import java.io.IOException;
import java.util.List;
import java.util.function.Consumer;
-@Mixin(GameRenderer.class)
-public class GameRendererMixin {
- @SuppressWarnings("UnresolvedMixinReference")
- @Inject(method = "loadShaders", at = @At(value = "INVOKE_ASSIGN", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 53), locals = LocalCapture.CAPTURE_FAILSOFT)
- private void loadShaders(ResourceManager manager, CallbackInfo info, List list, List>> list2) throws IOException {
- list2.add(Pair.of(new Shader(
+@Mixin( GameRenderer.class )
+public class GameRendererMixin
+{
+ @SuppressWarnings( "UnresolvedMixinReference" )
+ @Inject( method = "loadShaders", at = @At( value = "INVOKE_ASSIGN", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 53 ), locals = LocalCapture.CAPTURE_FAILSOFT )
+ private void loadShaders( ResourceManager manager, CallbackInfo info, List list, List>> list2 ) throws IOException
+ {
+ list2.add( Pair.of( new Shader(
manager,
"terminal",
RenderTypes.TERMINAL_WITHOUT_DEPTH.getVertexFormat()
- ), (shader) -> RenderTypes.terminalShader = shader));
- list2.add(Pair.of(new MonitorTextureBufferShader(
+ ), shader -> RenderTypes.terminalShader = shader ) );
+ list2.add( Pair.of( new MonitorTextureBufferShader(
manager,
"monitor_tbo",
RenderTypes.MONITOR_TBO.getVertexFormat()
- ), (shader) -> RenderTypes.monitorTboShader = (MonitorTextureBufferShader) shader));
+ ), shader -> RenderTypes.monitorTboShader = (MonitorTextureBufferShader) shader ) );
}
}
diff --git a/src/main/java/dan200/computercraft/fabric/mixin/MixinBlockEntity.java b/src/main/java/dan200/computercraft/fabric/mixin/MixinBlockEntity.java
index afad930e0..3c8b42876 100644
--- a/src/main/java/dan200/computercraft/fabric/mixin/MixinBlockEntity.java
+++ b/src/main/java/dan200/computercraft/fabric/mixin/MixinBlockEntity.java
@@ -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.fabric.mixin;
import org.spongepowered.asm.mixin.Final;
diff --git a/src/main/java/dan200/computercraft/fabric/mixin/MixinItemFrameEntityRenderer.java b/src/main/java/dan200/computercraft/fabric/mixin/MixinItemFrameEntityRenderer.java
index d948d3d34..0f1dd7818 100644
--- a/src/main/java/dan200/computercraft/fabric/mixin/MixinItemFrameEntityRenderer.java
+++ b/src/main/java/dan200/computercraft/fabric/mixin/MixinItemFrameEntityRenderer.java
@@ -18,7 +18,6 @@ import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin( ItemFrameEntityRenderer.class )
diff --git a/src/main/java/dan200/computercraft/fabric/mixin/MixinWorld.java b/src/main/java/dan200/computercraft/fabric/mixin/MixinWorld.java
index 5c3383929..d264ca983 100644
--- a/src/main/java/dan200/computercraft/fabric/mixin/MixinWorld.java
+++ b/src/main/java/dan200/computercraft/fabric/mixin/MixinWorld.java
@@ -7,7 +7,6 @@ package dan200.computercraft.fabric.mixin;
import dan200.computercraft.shared.common.TileGeneric;
import net.minecraft.block.entity.BlockEntity;
-import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -32,7 +31,7 @@ public class MixinWorld
@Inject( method = "addBlockEntity", at = @At( "HEAD" ) )
public void addBlockEntity( @Nullable BlockEntity entity, CallbackInfo info )
{
- if( entity != null && !entity.isRemoved() && entity.getWorld().isInBuildLimit(entity.getPos()) && iteratingTickingBlockEntities )
+ if( entity != null && !entity.isRemoved() && entity.getWorld().isInBuildLimit( entity.getPos() ) && iteratingTickingBlockEntities )
{
setWorld( entity, this );
}
@@ -46,7 +45,7 @@ public class MixinWorld
}
}
-// @Inject( method = "addBlockEntities", at = @At( "HEAD" ) )
+ // @Inject( method = "addBlockEntities", at = @At( "HEAD" ) )
public void addBlockEntities( Collection entities, CallbackInfo info )
{
if( iteratingTickingBlockEntities )
diff --git a/src/main/java/dan200/computercraft/fabric/mixin/RenderLayerAccessor.java b/src/main/java/dan200/computercraft/fabric/mixin/RenderLayerAccessor.java
deleted file mode 100644
index b24efc1bd..000000000
--- a/src/main/java/dan200/computercraft/fabric/mixin/RenderLayerAccessor.java
+++ /dev/null
@@ -1,18 +0,0 @@
-//package dan200.computercraft.fabric.mixin;
-//
-//import org.spongepowered.asm.mixin.Mixin;
-//import org.spongepowered.asm.mixin.gen.Accessor;
-//import org.spongepowered.asm.mixin.gen.Invoker;
-//
-//import net.minecraft.client.render.RenderLayer;
-//import net.minecraft.client.render.VertexFormat;
-//
-//@Mixin(RenderLayer.class)
-//public interface RenderLayerAccessor {
-//
-// @Accessor
-// static RenderLayer.MultiPhaseParameters callOf(String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, int expectedBufferSize, boolean hasCrumbling, boolean translucent, RenderLayer.MultiPhaseParameters phases) {
-// throw new UnsupportedOperationException();
-// }
-//
-//}
diff --git a/src/main/java/dan200/computercraft/shared/ComputerCraftRegistry.java b/src/main/java/dan200/computercraft/shared/ComputerCraftRegistry.java
index 8941f5208..969577732 100644
--- a/src/main/java/dan200/computercraft/shared/ComputerCraftRegistry.java
+++ b/src/main/java/dan200/computercraft/shared/ComputerCraftRegistry.java
@@ -150,46 +150,46 @@ public final class ComputerCraftRegistry
public static final BlockEntityType MONITOR_NORMAL = ofBlock( ModBlocks.MONITOR_NORMAL,
"monitor_normal",
- (blockPos, blockState) -> new TileMonitor(ModTiles.MONITOR_NORMAL, false, blockPos, blockState) );
+ ( blockPos, blockState ) -> new TileMonitor( ModTiles.MONITOR_NORMAL, false, blockPos, blockState ) );
public static final BlockEntityType MONITOR_ADVANCED = ofBlock( ModBlocks.MONITOR_ADVANCED,
"monitor_advanced",
- (blockPos, blockState) -> new TileMonitor(ModTiles.MONITOR_ADVANCED, true, blockPos, blockState) );
+ ( blockPos, blockState ) -> new TileMonitor( ModTiles.MONITOR_ADVANCED, true, blockPos, blockState ) );
public static final BlockEntityType COMPUTER_NORMAL = ofBlock( ModBlocks.COMPUTER_NORMAL,
"computer_normal",
- (blockPos, blockState) -> new TileComputer(ComputerFamily.NORMAL, ModTiles.COMPUTER_NORMAL, blockPos, blockState) );
+ ( blockPos, blockState ) -> new TileComputer( ComputerFamily.NORMAL, ModTiles.COMPUTER_NORMAL, blockPos, blockState ) );
public static final BlockEntityType COMPUTER_ADVANCED = ofBlock( ModBlocks.COMPUTER_ADVANCED,
"computer_advanced",
- (blockPos, blockState) -> new TileComputer(ComputerFamily.ADVANCED, ModTiles.COMPUTER_ADVANCED, blockPos, blockState) );
+ ( blockPos, blockState ) -> new TileComputer( ComputerFamily.ADVANCED, ModTiles.COMPUTER_ADVANCED, blockPos, blockState ) );
public static final BlockEntityType COMPUTER_COMMAND = ofBlock( ModBlocks.COMPUTER_COMMAND,
"computer_command",
- (blockPos, blockState) -> new TileCommandComputer(ComputerFamily.COMMAND, ModTiles.COMPUTER_COMMAND, blockPos, blockState) );
+ ( blockPos, blockState ) -> new TileCommandComputer( ComputerFamily.COMMAND, ModTiles.COMPUTER_COMMAND, blockPos, blockState ) );
public static final BlockEntityType TURTLE_NORMAL = ofBlock( ModBlocks.TURTLE_NORMAL,
"turtle_normal",
- (blockPos, blockState) -> new TileTurtle(ModTiles.TURTLE_NORMAL, blockPos, blockState, ComputerFamily.NORMAL ) );
+ ( blockPos, blockState ) -> new TileTurtle( ModTiles.TURTLE_NORMAL, blockPos, blockState, ComputerFamily.NORMAL ) );
public static final BlockEntityType TURTLE_ADVANCED = ofBlock( ModBlocks.TURTLE_ADVANCED,
"turtle_advanced",
- (blockPos, blockState) -> new TileTurtle(ModTiles.TURTLE_ADVANCED, blockPos, blockState, ComputerFamily.ADVANCED ) );
+ ( blockPos, blockState ) -> new TileTurtle( ModTiles.TURTLE_ADVANCED, blockPos, blockState, ComputerFamily.ADVANCED ) );
public static final BlockEntityType SPEAKER = ofBlock( ModBlocks.SPEAKER, "speaker",
- (blockPos, blockState) -> new TileSpeaker(ModTiles.SPEAKER, blockPos, blockState ) );
+ ( blockPos, blockState ) -> new TileSpeaker( ModTiles.SPEAKER, blockPos, blockState ) );
public static final BlockEntityType DISK_DRIVE = ofBlock( ModBlocks.DISK_DRIVE, "disk_drive",
- (blockPos, blockState) -> new TileDiskDrive(ModTiles.DISK_DRIVE, blockPos, blockState ) );
+ ( blockPos, blockState ) -> new TileDiskDrive( ModTiles.DISK_DRIVE, blockPos, blockState ) );
public static final BlockEntityType PRINTER = ofBlock( ModBlocks.PRINTER, "printer",
- (blockPos, blockState) -> new TilePrinter(ModTiles.PRINTER, blockPos, blockState ) );
+ ( blockPos, blockState ) -> new TilePrinter( ModTiles.PRINTER, blockPos, blockState ) );
public static final BlockEntityType WIRED_MODEM_FULL = ofBlock( ModBlocks.WIRED_MODEM_FULL,
"wired_modem_full",
- (blockPos, blockState) -> new TileWiredModemFull(ModTiles.WIRED_MODEM_FULL, blockPos, blockState ) );
+ ( blockPos, blockState ) -> new TileWiredModemFull( ModTiles.WIRED_MODEM_FULL, blockPos, blockState ) );
public static final BlockEntityType CABLE = ofBlock( ModBlocks.CABLE, "cable",
- (blockPos, blockState) -> new TileCable(ModTiles.CABLE, blockPos, blockState ) );
+ ( blockPos, blockState ) -> new TileCable( ModTiles.CABLE, blockPos, blockState ) );
public static final BlockEntityType WIRELESS_MODEM_NORMAL = ofBlock( ModBlocks.WIRELESS_MODEM_NORMAL,
"wireless_modem_normal",
- (blockPos, blockState) -> new TileWirelessModem(ModTiles.WIRELESS_MODEM_NORMAL, false, blockPos, blockState) );
+ ( blockPos, blockState ) -> new TileWirelessModem( ModTiles.WIRELESS_MODEM_NORMAL, false, blockPos, blockState ) );
public static final BlockEntityType WIRELESS_MODEM_ADVANCED = ofBlock( ModBlocks.WIRELESS_MODEM_ADVANCED,
"wireless_modem_advanced",
- (blockPos, blockState) -> new TileWirelessModem(ModTiles.WIRELESS_MODEM_ADVANCED, true, blockPos, blockState) );
+ ( blockPos, blockState ) -> new TileWirelessModem( ModTiles.WIRELESS_MODEM_ADVANCED, true, blockPos, blockState ) );
private static BlockEntityType ofBlock( Block block, String id, BiFunction factory )
{
- BlockEntityType blockEntityType = FabricBlockEntityTypeBuilder.create(factory::apply, block).build();
+ BlockEntityType blockEntityType = FabricBlockEntityTypeBuilder.create( factory::apply, block ).build();
return Registry.register( BLOCK_ENTITY_TYPE,
new Identifier( MOD_ID, id ),
blockEntityType
@@ -257,7 +257,7 @@ public final class ComputerCraftRegistry
public static class ModContainers
{
- public static final ScreenHandlerType COMPUTER = ContainerData.toType(new Identifier( MOD_ID, "computer" ), ModContainers.COMPUTER, ComputerContainerData::new, ComputerMenuWithoutInventory::new );
+ public static final ScreenHandlerType COMPUTER = ContainerData.toType( new Identifier( MOD_ID, "computer" ), ModContainers.COMPUTER, ComputerContainerData::new, ComputerMenuWithoutInventory::new );
public static final ScreenHandlerType POCKET_COMPUTER = ContainerData.toType( new Identifier( MOD_ID, "pocket_computer" ), ModContainers.POCKET_COMPUTER, ComputerContainerData::new, ComputerMenuWithoutInventory::new );
public static final ScreenHandlerType POCKET_COMPUTER_NO_TERM = ContainerData.toType( new Identifier( MOD_ID, "pocket_computer_no_term" ), ModContainers.POCKET_COMPUTER_NO_TERM, ComputerContainerData::new, ComputerMenuWithoutInventory::new );
public static final ScreenHandlerType TURTLE = ContainerData.toType( new Identifier( MOD_ID, "turtle" ), ComputerContainerData::new, ContainerTurtle::new );
diff --git a/src/main/java/dan200/computercraft/shared/TurtlePermissions.java b/src/main/java/dan200/computercraft/shared/TurtlePermissions.java
index f6236a770..59419fc41 100644
--- a/src/main/java/dan200/computercraft/shared/TurtlePermissions.java
+++ b/src/main/java/dan200/computercraft/shared/TurtlePermissions.java
@@ -25,7 +25,7 @@ public final class TurtlePermissions
public static boolean isBlockEnterable( World world, BlockPos pos, PlayerEntity player )
{
MinecraftServer server = world.getServer();
- return server == null || world.isClient || (world instanceof ServerWorld && !server.isSpawnProtected( (ServerWorld) world, pos, player ));
+ return server == null || world.isClient || world instanceof ServerWorld && !server.isSpawnProtected( (ServerWorld) world, pos, player );
}
@Subscribe
diff --git a/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java b/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java
index 26b744131..8150b6ec2 100644
--- a/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java
+++ b/src/main/java/dan200/computercraft/shared/common/BlockGeneric.java
@@ -18,7 +18,6 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
@@ -35,7 +34,8 @@ public abstract class BlockGeneric extends BlockWithEntity
this.type = type;
}
- public BlockEntityType extends TileGeneric> getType() {
+ public BlockEntityType extends TileGeneric> getType()
+ {
return type;
}
@@ -98,10 +98,11 @@ public abstract class BlockGeneric extends BlockWithEntity
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- if (this.type != null) {
- return type.instantiate(pos, state);
+ if ( this.type != null )
+ {
+ return type.instantiate( pos, state );
}
return null;
}
diff --git a/src/main/java/dan200/computercraft/shared/common/ClientTerminal.java b/src/main/java/dan200/computercraft/shared/common/ClientTerminal.java
index ae0433e11..45601a8bc 100644
--- a/src/main/java/dan200/computercraft/shared/common/ClientTerminal.java
+++ b/src/main/java/dan200/computercraft/shared/common/ClientTerminal.java
@@ -85,7 +85,7 @@ public class ClientTerminal implements ITerminal
colour = nbt.getBoolean( "colour" );
if( nbt.contains( "terminal" ) )
{
- NbtCompound terminal = nbt.getCompound( "terminal" );
+ NbtCompound terminal = nbt.getCompound( "terminal" );
resizeTerminal( terminal.getInt( "term_width" ), terminal.getInt( "term_height" ) );
this.terminal.readFromNBT( terminal );
}
diff --git a/src/main/java/dan200/computercraft/shared/common/IColouredItem.java b/src/main/java/dan200/computercraft/shared/common/IColouredItem.java
index 6d6b44f4d..d3e5041ec 100644
--- a/src/main/java/dan200/computercraft/shared/common/IColouredItem.java
+++ b/src/main/java/dan200/computercraft/shared/common/IColouredItem.java
@@ -20,7 +20,7 @@ public interface IColouredItem
static int getColourBasic( ItemStack stack )
{
- NbtCompound tag = stack.getNbt();
+ NbtCompound tag = stack.getNbt();
return tag != null && tag.contains( NBT_COLOUR ) ? tag.getInt( NBT_COLOUR ) : -1;
}
@@ -35,7 +35,7 @@ public interface IColouredItem
{
if( colour == -1 )
{
- NbtCompound tag = stack.getNbt();
+ NbtCompound tag = stack.getNbt();
if( tag != null )
{
tag.remove( NBT_COLOUR );
diff --git a/src/main/java/dan200/computercraft/shared/common/ServerTerminal.java b/src/main/java/dan200/computercraft/shared/common/ServerTerminal.java
index b53b4963f..1adb7207e 100644
--- a/src/main/java/dan200/computercraft/shared/common/ServerTerminal.java
+++ b/src/main/java/dan200/computercraft/shared/common/ServerTerminal.java
@@ -90,7 +90,7 @@ public class ServerTerminal implements ITerminal
nbt.putBoolean( "colour", colour );
if( terminal != null )
{
- NbtCompound terminal = new NbtCompound();
+ NbtCompound terminal = new NbtCompound();
terminal.putInt( "term_width", this.terminal.getWidth() );
terminal.putInt( "term_height", this.terminal.getHeight() );
this.terminal.writeToNBT( terminal );
diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java b/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java
index 3f1e872c8..39b725791 100644
--- a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java
+++ b/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputer.java
@@ -7,15 +7,12 @@
package dan200.computercraft.shared.computer.blocks;
import dan200.computercraft.shared.ComputerCraftRegistry;
-import dan200.computercraft.shared.common.TileGeneric;
import dan200.computercraft.shared.computer.core.ComputerFamily;
-import dan200.computercraft.shared.computer.core.ComputerRegistry;
import dan200.computercraft.shared.computer.core.ComputerState;
import dan200.computercraft.shared.computer.items.ComputerItemFactory;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
-import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
@@ -25,7 +22,6 @@ import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
-import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -64,9 +60,10 @@ public class BlockComputer extends BlockComputerBase
return tile instanceof TileComputer ? ComputerItemFactory.create( (TileComputer) tile ) : ItemStack.EMPTY;
}
- public BlockEntityType extends TileComputer> getTypeByFamily(ComputerFamily family)
+ public BlockEntityType extends TileComputer> getTypeByFamily( ComputerFamily family )
{
- return switch (family) {
+ return switch ( family )
+ {
case COMMAND -> ComputerCraftRegistry.ModTiles.COMPUTER_COMMAND;
case ADVANCED -> ComputerCraftRegistry.ModTiles.COMPUTER_ADVANCED;
default -> ComputerCraftRegistry.ModTiles.COMPUTER_NORMAL;
@@ -75,8 +72,8 @@ public class BlockComputer extends BlockComputerBase
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- return new TileComputer(getFamily(), getTypeByFamily(getFamily()), pos, state);
+ return new TileComputer( getFamily(), getTypeByFamily( getFamily() ), pos, state );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java b/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java
index c9b293e70..7a366c74a 100644
--- a/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java
+++ b/src/main/java/dan200/computercraft/shared/computer/blocks/BlockComputerBase.java
@@ -8,14 +8,11 @@ package dan200.computercraft.shared.computer.blocks;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.core.computer.ComputerSide;
-import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.BlockGeneric;
import dan200.computercraft.shared.common.IBundledRedstoneBlock;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.computer.core.ServerComputer;
import dan200.computercraft.shared.computer.items.IComputerItem;
-import dan200.computercraft.shared.turtle.blocks.BlockTurtle;
-import dan200.computercraft.shared.turtle.blocks.TileTurtle;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
@@ -218,9 +215,11 @@ public abstract class BlockComputerBase extends Bloc
@Nullable
@Override
- public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) {
- return world.isClient ? null : (world1, pos, state1, tile) -> {
- if (tile instanceof TileComputerBase computer) {
+ public BlockEntityTicker getTicker( World world, BlockState state, BlockEntityType type )
+ {
+ return world.isClient ? null : ( world1, pos, state1, tile ) -> {
+ if ( tile instanceof TileComputerBase computer )
+ {
computer.serverTick();
}
};
diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java b/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java
index 801d71187..ae99ad33d 100644
--- a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java
+++ b/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java
@@ -279,7 +279,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
}
// If the computer isn't on and should be, then turn it on
- if( startOn || (fresh && on) )
+ if( startOn || fresh && on )
{
computer.turnOn();
startOn = false;
diff --git a/src/main/java/dan200/computercraft/shared/computer/core/IContainerComputer.java b/src/main/java/dan200/computercraft/shared/computer/core/IContainerComputer.java
index 549e21994..d3ff52edf 100644
--- a/src/main/java/dan200/computercraft/shared/computer/core/IContainerComputer.java
+++ b/src/main/java/dan200/computercraft/shared/computer/core/IContainerComputer.java
@@ -45,7 +45,7 @@ public interface IContainerComputer
* @param uploadId The unique ID of this upload.
* @param files The files to upload.
*/
- void startUpload(@Nonnull UUID uploadId, @Nonnull List files );
+ void startUpload( @Nonnull UUID uploadId, @Nonnull List files );
/**
* Append more data to partially uploaded files.
@@ -61,7 +61,7 @@ public interface IContainerComputer
* @param uploader The player uploading files.
* @param uploadId The unique ID of this upload.
*/
- void finishUpload(@Nonnull ServerPlayerEntity uploader, @Nonnull UUID uploadId );
+ void finishUpload( @Nonnull ServerPlayerEntity uploader, @Nonnull UUID uploadId );
/**
* Continue an upload.
diff --git a/src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java b/src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java
index b23b37ce4..f3384de72 100644
--- a/src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java
+++ b/src/main/java/dan200/computercraft/shared/computer/inventory/ComputerMenuWithoutInventory.java
@@ -22,7 +22,7 @@ import java.util.function.Predicate;
*/
public class ComputerMenuWithoutInventory extends ContainerComputerBase
{
- public ComputerMenuWithoutInventory(ScreenHandlerType extends ContainerComputerBase> type, int id, PlayerInventory player, Predicate canUse, IComputer computer, ComputerFamily family )
+ public ComputerMenuWithoutInventory( ScreenHandlerType extends ContainerComputerBase> type, int id, PlayerInventory player, Predicate canUse, IComputer computer, ComputerFamily family )
{
super( type, id, canUse, computer, family );
addSlots( player );
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 53644a6e4..e1d42bd5e 100644
--- a/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerComputerBase.java
+++ b/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerComputerBase.java
@@ -19,7 +19,6 @@ import dan200.computercraft.shared.network.client.UploadResultMessage;
import dan200.computercraft.shared.network.container.ComputerContainerData;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.network.PacketByteBuf;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.server.network.ServerPlayerEntity;
@@ -113,7 +112,7 @@ public abstract class ContainerComputerBase extends ScreenHandler implements ICo
}
@Override
- public void startUpload(@Nonnull UUID uuid, @Nonnull List files )
+ public void startUpload( @Nonnull UUID uuid, @Nonnull List files )
{
toUploadId = uuid;
toUpload = files;
@@ -132,7 +131,7 @@ public abstract class ContainerComputerBase extends ScreenHandler implements ICo
}
@Override
- public void finishUpload(@Nonnull ServerPlayerEntity uploader, @Nonnull UUID uploadId )
+ public void finishUpload( @Nonnull ServerPlayerEntity uploader, @Nonnull UUID uploadId )
{
if( toUploadId == null || toUpload == null || toUpload.isEmpty() || !toUploadId.equals( uploadId ) )
{
diff --git a/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerViewComputer.java b/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerViewComputer.java
index ceb48ce74..341908650 100644
--- a/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerViewComputer.java
+++ b/src/main/java/dan200/computercraft/shared/computer/inventory/ContainerViewComputer.java
@@ -14,7 +14,6 @@ import dan200.computercraft.shared.computer.core.ServerComputer;
import dan200.computercraft.shared.network.container.ViewComputerContainerData;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.network.PacketByteBuf;
import javax.annotation.Nonnull;
diff --git a/src/main/java/dan200/computercraft/shared/computer/items/IComputerItem.java b/src/main/java/dan200/computercraft/shared/computer/items/IComputerItem.java
index 43c4d3f0e..e887dbb6b 100644
--- a/src/main/java/dan200/computercraft/shared/computer/items/IComputerItem.java
+++ b/src/main/java/dan200/computercraft/shared/computer/items/IComputerItem.java
@@ -18,7 +18,7 @@ public interface IComputerItem
default int getComputerID( @Nonnull ItemStack stack )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
return nbt != null && nbt.contains( NBT_ID ) ? nbt.getInt( NBT_ID ) : -1;
}
diff --git a/src/main/java/dan200/computercraft/shared/media/items/ItemDisk.java b/src/main/java/dan200/computercraft/shared/media/items/ItemDisk.java
index 43767e9e3..3d656c87a 100644
--- a/src/main/java/dan200/computercraft/shared/media/items/ItemDisk.java
+++ b/src/main/java/dan200/computercraft/shared/media/items/ItemDisk.java
@@ -85,7 +85,7 @@ public class ItemDisk extends Item implements IMedia, IColouredItem
public static int getDiskID( @Nonnull ItemStack stack )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
return nbt != null && nbt.contains( NBT_ID ) ? nbt.getInt( NBT_ID ) : -1;
}
diff --git a/src/main/java/dan200/computercraft/shared/media/items/ItemPrintout.java b/src/main/java/dan200/computercraft/shared/media/items/ItemPrintout.java
index c83398086..07ecffb99 100644
--- a/src/main/java/dan200/computercraft/shared/media/items/ItemPrintout.java
+++ b/src/main/java/dan200/computercraft/shared/media/items/ItemPrintout.java
@@ -60,7 +60,7 @@ public class ItemPrintout extends Item
}
if( text != null )
{
- NbtCompound tag = stack.getOrCreateNbt();
+ NbtCompound tag = stack.getOrCreateNbt();
tag.putInt( NBT_PAGES, text.length / LINES_PER_PAGE );
for( int i = 0; i < text.length; i++ )
{
@@ -72,7 +72,7 @@ public class ItemPrintout extends Item
}
if( colours != null )
{
- NbtCompound tag = stack.getOrCreateNbt();
+ NbtCompound tag = stack.getOrCreateNbt();
for( int i = 0; i < colours.length; i++ )
{
if( colours[i] != null )
@@ -105,7 +105,7 @@ public class ItemPrintout extends Item
private static String[] getLines( @Nonnull ItemStack stack, String prefix )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
int numLines = getPageCount( stack ) * LINES_PER_PAGE;
String[] lines = new String[numLines];
for( int i = 0; i < lines.length; i++ )
@@ -117,7 +117,7 @@ public class ItemPrintout extends Item
public static int getPageCount( @Nonnull ItemStack stack )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
return nbt != null && nbt.contains( NBT_PAGES ) ? nbt.getInt( NBT_PAGES ) : 1;
}
@@ -152,7 +152,7 @@ public class ItemPrintout extends Item
public static String getTitle( @Nonnull ItemStack stack )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
return nbt != null && nbt.contains( NBT_TITLE ) ? nbt.getString( NBT_TITLE ) : null;
}
diff --git a/src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java b/src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java
index 975484e25..ae4e6e990 100644
--- a/src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java
+++ b/src/main/java/dan200/computercraft/shared/media/items/ItemTreasureDisk.java
@@ -62,7 +62,7 @@ public class ItemTreasureDisk extends Item implements IMedia
public static int getColour( @Nonnull ItemStack stack )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
return nbt != null && nbt.contains( NBT_COLOUR ) ? nbt.getInt( NBT_COLOUR ) : Colour.BLUE.getHex();
}
@@ -84,7 +84,7 @@ public class ItemTreasureDisk extends Item implements IMedia
@Nonnull
private static String getTitle( @Nonnull ItemStack stack )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
return nbt != null && nbt.contains( NBT_TITLE ) ? nbt.getString( NBT_TITLE ) : "'alongtimeago' by dan200";
}
@@ -128,7 +128,7 @@ public class ItemTreasureDisk extends Item implements IMedia
@Nonnull
private static String getSubPath( @Nonnull ItemStack stack )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
return nbt != null && nbt.contains( NBT_SUB_PATH ) ? nbt.getString( NBT_SUB_PATH ) : "dan200/alongtimeago";
}
}
diff --git a/src/main/java/dan200/computercraft/shared/network/NetworkHandler.java b/src/main/java/dan200/computercraft/shared/network/NetworkHandler.java
index 5b0af2829..743a82c26 100644
--- a/src/main/java/dan200/computercraft/shared/network/NetworkHandler.java
+++ b/src/main/java/dan200/computercraft/shared/network/NetworkHandler.java
@@ -153,8 +153,10 @@ public final class NetworkHandler
public static void sendToAllTracking( NetworkMessage packet, WorldChunk chunk )
{
// maybe bug with worlds
- for(PlayerEntity player : chunk.getWorld().getPlayers()) {
- if (player.getChunkPos().equals(chunk.getPos())) {
+ for( PlayerEntity player : chunk.getWorld().getPlayers() )
+ {
+ if ( player.getChunkPos().equals( chunk.getPos() ) )
+ {
((ServerPlayerEntity) player).networkHandler.sendPacket( new CustomPayloadS2CPacket( ID, encode( packet ) ) );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java
index 20ced154a..c21f60edf 100644
--- a/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java
+++ b/src/main/java/dan200/computercraft/shared/network/client/ChatTableClientMessage.java
@@ -30,7 +30,7 @@ public class ChatTableClientMessage implements NetworkMessage
this.table = table;
}
- public ChatTableClientMessage(@Nonnull PacketByteBuf buf)
+ public ChatTableClientMessage( @Nonnull PacketByteBuf buf )
{
int id = buf.readVarInt();
int columns = buf.readVarInt();
diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java
index 32b0169d6..97e8d3b69 100644
--- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java
+++ b/src/main/java/dan200/computercraft/shared/network/client/SpeakerPlayClientMessage.java
@@ -12,7 +12,6 @@ import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.network.PacketContext;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.sound.SoundEvent;
-import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3d;
@@ -68,7 +67,7 @@ public class SpeakerPlayClientMessage implements NetworkMessage
@Environment( EnvType.CLIENT )
public void handle( PacketContext context )
{
- SoundEvent sound = new SoundEvent(this.sound);
+ SoundEvent sound = new SoundEvent( this.sound );
SoundManager.playSound( source, pos, sound, volume, pitch );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java b/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java
index d322928a6..bdc630244 100644
--- a/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java
+++ b/src/main/java/dan200/computercraft/shared/network/client/SpeakerStopClientMessage.java
@@ -43,7 +43,7 @@ public class SpeakerStopClientMessage implements NetworkMessage
}
@Override
- @Environment(EnvType.CLIENT)
+ @Environment( EnvType.CLIENT )
public void handle( PacketContext context )
{
SoundManager.stopSound( source );
diff --git a/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java b/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java
index ada6aa1fe..c29d774b8 100644
--- a/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java
+++ b/src/main/java/dan200/computercraft/shared/network/container/ContainerData.java
@@ -6,7 +6,6 @@
package dan200.computercraft.shared.network.container;
-import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
@@ -24,7 +23,7 @@ import java.util.function.Function;
*/
public interface ContainerData
{
- static ScreenHandlerType toType(Identifier identifier, Function reader,
+ static ScreenHandlerType toType( Identifier identifier, Function reader,
Factory factory )
{
return ScreenHandlerRegistry.registerExtended( identifier,
@@ -32,7 +31,7 @@ public interface ContainerData
playerInventory,
reader.apply( packetByteBuf ) ) );
}
- static ScreenHandlerType toType(Identifier identifier, ScreenHandlerType type, Function reader,
+ static ScreenHandlerType toType( Identifier identifier, ScreenHandlerType type, Function reader,
FixedFactory factory )
{
return ScreenHandlerRegistry.registerExtended( identifier,
@@ -45,7 +44,7 @@ public interface ContainerData
default void open( PlayerEntity player, NamedScreenHandlerFactory owner )
{
- if (player.world.isClient) return;
+ if ( player.world.isClient ) return;
player.openHandledScreen( owner );
}
diff --git a/src/main/java/dan200/computercraft/shared/network/container/ViewComputerContainerData.java b/src/main/java/dan200/computercraft/shared/network/container/ViewComputerContainerData.java
index da455ef1d..7999ca681 100644
--- a/src/main/java/dan200/computercraft/shared/network/container/ViewComputerContainerData.java
+++ b/src/main/java/dan200/computercraft/shared/network/container/ViewComputerContainerData.java
@@ -6,11 +6,9 @@
package dan200.computercraft.shared.network.container;
-import dan200.computercraft.ComputerCraft;
import dan200.computercraft.core.terminal.Terminal;
import dan200.computercraft.shared.computer.core.ServerComputer;
import net.minecraft.network.PacketByteBuf;
-import net.minecraft.util.Identifier;
import javax.annotation.Nonnull;
diff --git a/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java
index c8a9c28f8..00395bbca 100644
--- a/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java
+++ b/src/main/java/dan200/computercraft/shared/network/server/ComputerActionServerMessage.java
@@ -37,7 +37,7 @@ public class ComputerActionServerMessage extends ComputerServerMessage
}
@Override
- protected void handle(PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
+ protected void handle( PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
{
switch( action )
{
diff --git a/src/main/java/dan200/computercraft/shared/network/server/ContinueUploadMessage.java b/src/main/java/dan200/computercraft/shared/network/server/ContinueUploadMessage.java
index c4f75737a..557433f63 100644
--- a/src/main/java/dan200/computercraft/shared/network/server/ContinueUploadMessage.java
+++ b/src/main/java/dan200/computercraft/shared/network/server/ContinueUploadMessage.java
@@ -8,7 +8,6 @@ package dan200.computercraft.shared.network.server;
import dan200.computercraft.shared.computer.core.IContainerComputer;
import dan200.computercraft.shared.computer.core.ServerComputer;
import net.fabricmc.fabric.api.network.PacketContext;
-import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
@@ -38,7 +37,7 @@ public class ContinueUploadMessage extends ComputerServerMessage
}
@Override
- protected void handle(PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
+ protected void handle( PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
{
ServerPlayerEntity player = (ServerPlayerEntity) context.getPlayer();
if( player != null ) container.confirmUpload( player, overwrite );
diff --git a/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java
index 7bc967978..cf00e23f0 100644
--- a/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java
+++ b/src/main/java/dan200/computercraft/shared/network/server/KeyEventServerMessage.java
@@ -46,7 +46,7 @@ public class KeyEventServerMessage extends ComputerServerMessage
}
@Override
- protected void handle(PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
+ protected void handle( PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
{
InputState input = container.getInput();
if( type == TYPE_UP )
diff --git a/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java
index a6ab05771..872f168ed 100644
--- a/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java
+++ b/src/main/java/dan200/computercraft/shared/network/server/MouseEventServerMessage.java
@@ -55,7 +55,7 @@ public class MouseEventServerMessage extends ComputerServerMessage
}
@Override
- protected void handle(PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
+ protected void handle( PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
{
InputState input = container.getInput();
switch( type )
diff --git a/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java b/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java
index 85243f2ce..730d7b6f9 100644
--- a/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java
+++ b/src/main/java/dan200/computercraft/shared/network/server/QueueEventServerMessage.java
@@ -52,7 +52,7 @@ public class QueueEventServerMessage extends ComputerServerMessage
}
@Override
- protected void handle(PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
+ protected void handle( PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
{
computer.queueEvent( event, args );
}
diff --git a/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java b/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java
index 6f3ba7e86..136ce08bb 100644
--- a/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java
+++ b/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java
@@ -13,7 +13,6 @@ import dan200.computercraft.shared.computer.upload.FileUpload;
import dan200.computercraft.shared.network.NetworkHandler;
import io.netty.handler.codec.DecoderException;
import net.fabricmc.fabric.api.network.PacketContext;
-import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
@@ -174,7 +173,7 @@ public class UploadFileMessage extends ComputerServerMessage
}
@Override
- protected void handle(PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
+ protected void handle( PacketContext context, @Nonnull ServerComputer computer, @Nonnull IContainerComputer container )
{
ServerPlayerEntity player = (ServerPlayerEntity) context.getPlayer();
if( player != null )
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/BlockDiskDrive.java b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/BlockDiskDrive.java
index 124b0516d..295054c01 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/BlockDiskDrive.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/BlockDiskDrive.java
@@ -8,9 +8,6 @@ package dan200.computercraft.shared.peripheral.diskdrive;
import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.BlockGeneric;
-import dan200.computercraft.shared.computer.blocks.TileComputer;
-import dan200.computercraft.shared.peripheral.speaker.BlockSpeaker;
-import dan200.computercraft.shared.peripheral.speaker.TileSpeaker;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
@@ -57,8 +54,9 @@ public class BlockDiskDrive extends BlockGeneric
@Nullable
@Override
- public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type){
- return world.isClient ? null : BlockDiskDrive.checkType( type, ComputerCraftRegistry.ModTiles.DISK_DRIVE, TileDiskDrive::tick );
+ public BlockEntityTicker getTicker( World world, BlockState state, BlockEntityType type )
+ {
+ return world.isClient ? null : BlockDiskDrive.checkType( type, ComputerCraftRegistry.ModTiles.DISK_DRIVE, TileDiskDrive::tick );
}
@Override
@@ -102,8 +100,8 @@ public class BlockDiskDrive extends BlockGeneric
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- return new TileDiskDrive(ComputerCraftRegistry.ModTiles.DISK_DRIVE, pos, state);
+ return new TileDiskDrive( ComputerCraftRegistry.ModTiles.DISK_DRIVE, pos, state );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java
index bc2cabb6d..4bb75b4a9 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/diskdrive/TileDiskDrive.java
@@ -114,7 +114,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
customName = nbt.contains( NBT_NAME ) ? Text.Serializer.fromJson( nbt.getString( NBT_NAME ) ) : null;
if( nbt.contains( NBT_ITEM ) )
{
- NbtCompound item = nbt.getCompound( NBT_ITEM );
+ NbtCompound item = nbt.getCompound( NBT_ITEM );
diskStack = ItemStack.fromNbt( item );
diskMount = null;
}
@@ -132,7 +132,7 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
if( !diskStack.isEmpty() )
{
- NbtCompound item = new NbtCompound();
+ NbtCompound item = new NbtCompound();
diskStack.writeNbt( item );
nbt.put( NBT_ITEM, item );
}
@@ -149,13 +149,13 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
super.markDirty();
}
- public static void tick( World world, BlockPos pos, BlockState state, TileDiskDrive tileDiskDrive)
+ public static void tick( World world, BlockPos pos, BlockState state, TileDiskDrive tileDiskDrive )
{
// Ejection
if( tileDiskDrive.ejectQueued )
{
- tileDiskDrive.ejectContents( false );
- tileDiskDrive.ejectQueued = false;
+ tileDiskDrive.ejectContents( false );
+ tileDiskDrive.ejectQueued = false;
}
// Music
@@ -163,24 +163,24 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
{
if( !world.isClient && tileDiskDrive.recordPlaying != tileDiskDrive.recordQueued || tileDiskDrive.restartRecord )
{
- tileDiskDrive.restartRecord = false;
+ tileDiskDrive.restartRecord = false;
if( tileDiskDrive.recordQueued )
{
IMedia contents = tileDiskDrive.getDiskMedia();
SoundEvent record = contents != null ? contents.getAudio( tileDiskDrive.diskStack ) : null;
if( record != null )
{
- tileDiskDrive.recordPlaying = true;
- tileDiskDrive.playRecord();
+ tileDiskDrive.recordPlaying = true;
+ tileDiskDrive.playRecord();
}
else
{
- tileDiskDrive.recordQueued = false;
+ tileDiskDrive.recordQueued = false;
}
}
else
{
- tileDiskDrive.stopRecord();
+ tileDiskDrive.stopRecord();
tileDiskDrive.recordPlaying = false;
}
}
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java b/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java
index 02cce692c..a5781483a 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/generic/data/ItemData.java
@@ -72,7 +72,7 @@ public class ItemData
// requireNonNull is safe because we got the Identifiers out of the TagGroup to start with. Would be nicer
// to stream the tags directly but TagGroup isn't a collection :(
- TagGroup- itemTags = ServerTagManagerHolder.getTagManager().getOrCreateTagGroup(Registry.ITEM_KEY);
+ TagGroup
- itemTags = ServerTagManagerHolder.getTagManager().getOrCreateTagGroup( Registry.ITEM_KEY );
data.put( "tags", DataHelpers.getTags( itemTags.getTagIds().stream()
.filter( id -> Objects.requireNonNull( itemTags.getTag( id ) ).contains( stack.getItem() ) )
.collect( Collectors.toList() )
@@ -81,7 +81,7 @@ public class ItemData
NbtCompound tag = stack.getNbt();
if( tag != null && tag.contains( "display", NBTUtil.TAG_COMPOUND ) )
{
- NbtCompound displayTag = tag.getCompound( "display" );
+ NbtCompound displayTag = tag.getCompound( "display" );
if( displayTag.contains( "Lore", NBTUtil.TAG_LIST ) )
{
NbtList loreTag = displayTag.getList( "Lore", NBTUtil.TAG_STRING );
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java
index a622f63f9..6388751e5 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockCable.java
@@ -10,7 +10,6 @@ import com.google.common.collect.ImmutableMap;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.BlockGeneric;
-import dan200.computercraft.shared.peripheral.printer.TilePrinter;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
@@ -275,8 +274,8 @@ public class BlockCable extends BlockGeneric implements Waterloggable
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- return new TileCable(ComputerCraftRegistry.ModTiles.CABLE, pos, state);
+ return new TileCable( ComputerCraftRegistry.ModTiles.CABLE, pos, state );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockWiredModemFull.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockWiredModemFull.java
index 47b8adea5..a14875443 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockWiredModemFull.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/BlockWiredModemFull.java
@@ -8,7 +8,6 @@ package dan200.computercraft.shared.peripheral.modem.wired;
import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.BlockGeneric;
-import dan200.computercraft.shared.peripheral.speaker.TileSpeaker;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
@@ -40,8 +39,8 @@ public class BlockWiredModemFull extends BlockGeneric
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- return new TileWiredModemFull(ComputerCraftRegistry.ModTiles.WIRED_MODEM_FULL, pos, state);
+ return new TileWiredModemFull( ComputerCraftRegistry.ModTiles.WIRED_MODEM_FULL, pos, state );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java
index 63e76d74f..b4853b3e7 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileCable.java
@@ -388,7 +388,7 @@ public class TileCable extends TileGeneric implements IPeripheralTile
@Override
public NbtCompound writeNbt( NbtCompound nbt )
{
- super.writeNbt( nbt );
+ super.writeNbt( nbt );
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
peripheral.write( nbt, "" );
return nbt;
@@ -409,10 +409,10 @@ public class TileCable extends TileGeneric implements IPeripheralTile
}
@Override
- public void setCachedState(BlockState state)
+ public void setCachedState( BlockState state )
{
- super.setCachedState(state);
- if(state != null) return;
+ super.setCachedState( state );
+ if( state != null ) return;
hasModemDirection = false;
if( !world.isClient )
{
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java
index 590af1c7c..0de7d306a 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wired/TileWiredModemFull.java
@@ -329,7 +329,7 @@ public class TileWiredModemFull extends TileGeneric implements IPeripheralTile
@Override
public NbtCompound writeNbt( NbtCompound nbt )
{
- super.writeNbt( nbt );
+ super.writeNbt( nbt );
nbt.putBoolean( NBT_PERIPHERAL_ENABLED, peripheralAccessAllowed );
for( int i = 0; i < peripherals.length; i++ )
{
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java
index 8bbc686d2..c6ebe3809 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/BlockWirelessModem.java
@@ -8,10 +8,8 @@ package dan200.computercraft.shared.peripheral.modem.wireless;
import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.BlockGeneric;
-import dan200.computercraft.shared.computer.blocks.TileComputer;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.peripheral.modem.ModemShapes;
-import dan200.computercraft.shared.peripheral.modem.wired.TileWiredModemFull;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
@@ -43,7 +41,7 @@ public class BlockWirelessModem extends BlockGeneric implements Waterloggable
private final ComputerFamily family;
- public BlockWirelessModem(Settings settings, BlockEntityType extends TileWirelessModem> type, ComputerFamily family)
+ public BlockWirelessModem( Settings settings, BlockEntityType extends TileWirelessModem> type, ComputerFamily family )
{
super( settings, type );
this.family = family;
@@ -104,9 +102,10 @@ public class BlockWirelessModem extends BlockGeneric implements Waterloggable
builder.add( FACING, ON, WATERLOGGED );
}
- public BlockEntityType extends TileWirelessModem> getTypeByFamily(ComputerFamily family)
+ public BlockEntityType extends TileWirelessModem> getTypeByFamily( ComputerFamily family )
{
- return switch (family) {
+ return switch ( family )
+ {
case ADVANCED -> ComputerCraftRegistry.ModTiles.WIRELESS_MODEM_ADVANCED;
default -> ComputerCraftRegistry.ModTiles.WIRELESS_MODEM_NORMAL;
};
@@ -114,8 +113,8 @@ public class BlockWirelessModem extends BlockGeneric implements Waterloggable
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- return new TileWirelessModem(getTypeByFamily(family), family == ComputerFamily.ADVANCED, pos, state);
+ return new TileWirelessModem( getTypeByFamily( family ), family == ComputerFamily.ADVANCED, pos, state );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/TileWirelessModem.java b/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/TileWirelessModem.java
index e79b0053d..82d584a5b 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/TileWirelessModem.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/modem/wireless/TileWirelessModem.java
@@ -8,7 +8,6 @@ package dan200.computercraft.shared.peripheral.modem.wireless;
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.api.peripheral.IPeripheralTile;
-import dan200.computercraft.shared.ComputerCraftRegistry.ModTiles;
import dan200.computercraft.shared.common.TileGeneric;
import dan200.computercraft.shared.peripheral.modem.ModemPeripheral;
import dan200.computercraft.shared.peripheral.modem.ModemState;
@@ -45,10 +44,10 @@ public class TileWirelessModem extends TileGeneric implements IPeripheralTile
}
@Override
- public void setCachedState(BlockState state)
+ public void setCachedState( BlockState state )
{
- super.setCachedState(state);
- if(state != null) return;
+ super.setCachedState( state );
+ if( state != null ) return;
hasModemDirection = false;
world.getBlockTickScheduler()
.schedule( getPos(),
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java
index 0373c5ad1..22b3175e1 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/BlockMonitor.java
@@ -9,7 +9,6 @@ package dan200.computercraft.shared.peripheral.monitor;
import dan200.computercraft.api.turtle.FakePlayer;
import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.BlockGeneric;
-import dan200.computercraft.shared.computer.blocks.TileComputer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
@@ -104,8 +103,8 @@ public class BlockMonitor extends BlockGeneric
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- return new TileMonitor(advanced ? ComputerCraftRegistry.ModTiles.MONITOR_ADVANCED : ComputerCraftRegistry.ModTiles.MONITOR_NORMAL, advanced, pos, state);
+ return new TileMonitor( advanced ? ComputerCraftRegistry.ModTiles.MONITOR_ADVANCED : ComputerCraftRegistry.ModTiles.MONITOR_NORMAL, advanced, pos, state );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java
index 7477aad25..db226210e 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/ClientMonitor.java
@@ -8,7 +8,6 @@ package dan200.computercraft.shared.peripheral.monitor;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
-import dan200.computercraft.client.gui.FixedWidthFontRenderer;
import dan200.computercraft.shared.common.ClientTerminal;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java
index e521e2f08..b94cd8bd8 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java
@@ -259,7 +259,7 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile
{
if( pos.equals( getPos() ) )
{
- return MonitorState.present(this);
+ return MonitorState.present( this );
}
World world = getWorld();
@@ -309,7 +309,7 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile
@Override
public NbtCompound writeNbt( NbtCompound tag )
{
- super.writeNbt( tag );
+ super.writeNbt( tag );
tag.putInt( NBT_X, xIndex );
tag.putInt( NBT_Y, yIndex );
tag.putInt( NBT_WIDTH, width );
@@ -317,11 +317,11 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile
return tag;
}
-// @Override //TODO: make BlockEntityRenderer work with this, i guess.
-// public double getRenderDistance()
-// {
-// return ComputerCraft.monitorDistanceSq;
-// }
+ // @Override //TODO: make BlockEntityRenderer work with this, i guess.
+ // public double getRenderDistance()
+ // {
+ // return ComputerCraft.monitorDistanceSq;
+ // }
// Sizing and placement stuff
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/printer/BlockPrinter.java b/src/main/java/dan200/computercraft/shared/peripheral/printer/BlockPrinter.java
index d92624ba1..d906fb391 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/printer/BlockPrinter.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/printer/BlockPrinter.java
@@ -8,7 +8,6 @@ package dan200.computercraft.shared.peripheral.printer;
import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.BlockGeneric;
-import dan200.computercraft.shared.computer.blocks.TileComputer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
@@ -92,8 +91,8 @@ public class BlockPrinter extends BlockGeneric
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- return new TilePrinter(ComputerCraftRegistry.ModTiles.PRINTER, pos, state);
+ return new TilePrinter( ComputerCraftRegistry.ModTiles.PRINTER, pos, state );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/BlockSpeaker.java b/src/main/java/dan200/computercraft/shared/peripheral/speaker/BlockSpeaker.java
index 9db4ca54b..34405b92b 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/speaker/BlockSpeaker.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/speaker/BlockSpeaker.java
@@ -8,7 +8,6 @@ package dan200.computercraft.shared.peripheral.speaker;
import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.BlockGeneric;
-import dan200.computercraft.shared.turtle.blocks.TileTurtle;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
@@ -52,15 +51,16 @@ public class BlockSpeaker extends BlockGeneric
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- return new TileSpeaker(ComputerCraftRegistry.ModTiles.SPEAKER, pos, state);
+ return new TileSpeaker( ComputerCraftRegistry.ModTiles.SPEAKER, pos, state );
}
@Nullable
@Override
- public BlockEntityTicker getTicker( World world, BlockState state, BlockEntityType type){
- return world.isClient ? null : BlockSpeaker.checkType( type, ComputerCraftRegistry.ModTiles.SPEAKER, TileSpeaker::tick );
+ public BlockEntityTicker getTicker( World world, BlockState state, BlockEntityType type )
+ {
+ return world.isClient ? null : BlockSpeaker.checkType( type, ComputerCraftRegistry.ModTiles.SPEAKER, TileSpeaker::tick );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java b/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java
index 433b6ceec..c943fd2f7 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/speaker/SpeakerPeripheral.java
@@ -147,7 +147,9 @@ public abstract class SpeakerPeripheral implements IPeripheral
null, pos.x, pos.y, pos.z, range, world.getRegistryKey(),
new PlaySoundIdS2CPacket( name, SoundCategory.RECORDS, pos, actualVolume, pitch )
);
- } else {
+ }
+ else
+ {
NetworkHandler.sendToAllAround(
new SpeakerPlayClientMessage( getSource(), pos, name, actualVolume, pitch ),
world, pos, range
diff --git a/src/main/java/dan200/computercraft/shared/peripheral/speaker/TileSpeaker.java b/src/main/java/dan200/computercraft/shared/peripheral/speaker/TileSpeaker.java
index 8df1eee47..2a0de631e 100644
--- a/src/main/java/dan200/computercraft/shared/peripheral/speaker/TileSpeaker.java
+++ b/src/main/java/dan200/computercraft/shared/peripheral/speaker/TileSpeaker.java
@@ -9,7 +9,6 @@ package dan200.computercraft.shared.peripheral.speaker;
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.api.peripheral.IPeripheralTile;
import dan200.computercraft.shared.common.TileGeneric;
-import dan200.computercraft.shared.computer.blocks.TileComputerBase;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.math.BlockPos;
diff --git a/src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java b/src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java
index 9f8e19108..56b2e615a 100644
--- a/src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java
+++ b/src/main/java/dan200/computercraft/shared/pocket/core/PocketServerComputer.java
@@ -87,14 +87,14 @@ public class PocketServerComputer extends ServerComputer implements IPocketAcces
@Override
public int getLight()
{
- NbtCompound tag = getUserData();
+ NbtCompound tag = getUserData();
return tag.contains( NBT_LIGHT, NBTUtil.TAG_ANY_NUMERIC ) ? tag.getInt( NBT_LIGHT ) : -1;
}
@Override
public void setLight( int colour )
{
- NbtCompound tag = getUserData();
+ NbtCompound tag = getUserData();
if( colour >= 0 && colour <= 0xFFFFFF )
{
if( !tag.contains( NBT_LIGHT, NBTUtil.TAG_ANY_NUMERIC ) || tag.getInt( NBT_LIGHT ) != colour )
diff --git a/src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java b/src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java
index 9e99eb56c..2e1a066c2 100644
--- a/src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java
+++ b/src/main/java/dan200/computercraft/shared/pocket/inventory/PocketComputerMenuProvider.java
@@ -6,7 +6,6 @@
package dan200.computercraft.shared.pocket.inventory;
import dan200.computercraft.shared.ComputerCraftRegistry;
-import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.computer.core.ServerComputer;
import dan200.computercraft.shared.computer.inventory.ComputerMenuWithoutInventory;
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
@@ -32,7 +31,7 @@ public class PocketComputerMenuProvider implements NamedScreenHandlerFactory, Ex
private final Hand hand;
private final boolean isTypingOnly;
- public PocketComputerMenuProvider(ServerComputer computer, ItemStack stack, ItemPocketComputer item, Hand hand, boolean isTypingOnly )
+ public PocketComputerMenuProvider( ServerComputer computer, ItemStack stack, ItemPocketComputer item, Hand hand, boolean isTypingOnly )
{
this.computer = computer;
name = stack.getName();
@@ -51,7 +50,7 @@ public class PocketComputerMenuProvider implements NamedScreenHandlerFactory, Ex
@Nullable
@Override
- public ScreenHandler createMenu(int id, @Nonnull PlayerInventory inventory, @Nonnull PlayerEntity entity )
+ public ScreenHandler createMenu( int id, @Nonnull PlayerInventory inventory, @Nonnull PlayerEntity entity )
{
return new ComputerMenuWithoutInventory(
isTypingOnly ? ComputerCraftRegistry.ModContainers.POCKET_COMPUTER_NO_TERM : ComputerCraftRegistry.ModContainers.POCKET_COMPUTER, id, inventory,
@@ -64,8 +63,9 @@ public class PocketComputerMenuProvider implements NamedScreenHandlerFactory, Ex
}
@Override
- public void writeScreenOpeningData(ServerPlayerEntity player, PacketByteBuf packetByteBuf) {
- packetByteBuf.writeInt(computer.getInstanceID());
- packetByteBuf.writeEnumConstant(computer.getFamily());
+ public void writeScreenOpeningData( ServerPlayerEntity player, PacketByteBuf packetByteBuf )
+ {
+ packetByteBuf.writeInt( computer.getInstanceID() );
+ packetByteBuf.writeEnumConstant( computer.getFamily() );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java b/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java
index e51652b5f..69d586869 100644
--- a/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java
+++ b/src/main/java/dan200/computercraft/shared/pocket/items/ItemPocketComputer.java
@@ -92,7 +92,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I
ClientComputer computer = getClientComputer( stack );
if( computer != null && computer.isOn() )
{
- NbtCompound computerNBT = computer.getUserData();
+ NbtCompound computerNBT = computer.getUserData();
if( computerNBT != null && computerNBT.contains( NBT_LIGHT ) )
{
return computerNBT.getInt( NBT_LIGHT );
@@ -103,7 +103,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I
public static void setUpgrade( @Nonnull ItemStack stack, IPocketUpgrade upgrade )
{
- NbtCompound compound = stack.getOrCreateNbt();
+ NbtCompound compound = stack.getOrCreateNbt();
if( upgrade == null )
{
@@ -164,7 +164,6 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I
if( !stop && computer != null )
{
-// computer.sendTerminalState( player );
boolean isTypingOnly = hand == Hand.OFF_HAND;
new ComputerContainerData( computer ).open( player, new PocketComputerMenuProvider( computer, stack, this, hand, isTypingOnly ) );
}
@@ -342,7 +341,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I
public static IPocketUpgrade getUpgrade( @Nonnull ItemStack stack )
{
- NbtCompound compound = stack.getNbt();
+ NbtCompound compound = stack.getNbt();
return compound != null && compound.contains( NBT_UPGRADE ) ? PocketUpgrades.get( compound.getString( NBT_UPGRADE ) ) : null;
}
@@ -403,13 +402,13 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I
private static int getInstanceID( @Nonnull ItemStack stack )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
return nbt != null && nbt.contains( NBT_INSTANCE ) ? nbt.getInt( NBT_INSTANCE ) : -1;
}
private static int getSessionID( @Nonnull ItemStack stack )
{
- NbtCompound nbt = stack.getNbt();
+ NbtCompound nbt = stack.getNbt();
return nbt != null && nbt.contains( NBT_SESSION ) ? nbt.getInt( NBT_SESSION ) : -1;
}
diff --git a/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeakerPeripheral.java b/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeakerPeripheral.java
index 0583edbb2..315abd72c 100644
--- a/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeakerPeripheral.java
+++ b/src/main/java/dan200/computercraft/shared/pocket/peripherals/PocketSpeakerPeripheral.java
@@ -7,7 +7,6 @@
package dan200.computercraft.shared.pocket.peripherals;
import dan200.computercraft.api.peripheral.IPeripheral;
-import dan200.computercraft.shared.peripheral.speaker.SpeakerPeripheral;
import dan200.computercraft.shared.peripheral.speaker.UpgradeSpeakerPeripheral;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
diff --git a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java b/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java
index d2e378c6e..942214057 100644
--- a/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java
+++ b/src/main/java/dan200/computercraft/shared/turtle/blocks/BlockTurtle.java
@@ -9,11 +9,8 @@ package dan200.computercraft.shared.turtle.blocks;
import dan200.computercraft.api.turtle.TurtleSide;
import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.computer.blocks.BlockComputerBase;
-import dan200.computercraft.shared.computer.blocks.TileComputer;
import dan200.computercraft.shared.computer.blocks.TileComputerBase;
import dan200.computercraft.shared.computer.core.ComputerFamily;
-import dan200.computercraft.shared.peripheral.diskdrive.BlockDiskDrive;
-import dan200.computercraft.shared.peripheral.diskdrive.TileDiskDrive;
import dan200.computercraft.shared.turtle.core.TurtleBrain;
import dan200.computercraft.shared.turtle.items.ITurtleItem;
import dan200.computercraft.shared.turtle.items.TurtleItemFactory;
@@ -181,9 +178,10 @@ public class BlockTurtle extends BlockComputerBase implements Waterl
}
}
- public BlockEntityType extends TileTurtle> getTypeByFamily(ComputerFamily family)
+ public BlockEntityType extends TileTurtle> getTypeByFamily( ComputerFamily family )
{
- if (family == ComputerFamily.ADVANCED) {
+ if ( family == ComputerFamily.ADVANCED )
+ {
return ComputerCraftRegistry.ModTiles.TURTLE_ADVANCED;
}
return ComputerCraftRegistry.ModTiles.TURTLE_NORMAL;
@@ -191,14 +189,15 @@ public class BlockTurtle extends BlockComputerBase implements Waterl
@Nullable
@Override
- public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
+ public BlockEntity createBlockEntity( BlockPos pos, BlockState state )
{
- return new TileTurtle(getTypeByFamily(getFamily()), pos, state, getFamily());
+ return new TileTurtle( getTypeByFamily( getFamily() ), pos, state, getFamily() );
}
@Nullable
@Override
- public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type){
- return world.isClient ? BlockTurtle.checkType( type, getTypeByFamily(getFamily()), ( world1, pos, state1, computer ) -> computer.clientTick() ) : super.getTicker(world, state, type);
+ public BlockEntityTicker getTicker( World world, BlockState state, BlockEntityType type )
+ {
+ return world.isClient ? BlockTurtle.checkType( type, getTypeByFamily( getFamily() ), ( world1, pos, state1, computer ) -> computer.clientTick() ) : super.getTicker( world, state, type );
}
}
diff --git a/src/main/java/dan200/computercraft/shared/turtle/blocks/TileTurtle.java b/src/main/java/dan200/computercraft/shared/turtle/blocks/TileTurtle.java
index e6a8a4bab..ba6112a82 100644
--- a/src/main/java/dan200/computercraft/shared/turtle/blocks/TileTurtle.java
+++ b/src/main/java/dan200/computercraft/shared/turtle/blocks/TileTurtle.java
@@ -12,21 +12,17 @@ import dan200.computercraft.api.turtle.ITurtleAccess;
import dan200.computercraft.api.turtle.ITurtleUpgrade;
import dan200.computercraft.api.turtle.TurtleSide;
import dan200.computercraft.core.computer.ComputerSide;
-import dan200.computercraft.fabric.mixin.MixinBlockEntity;
-import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.TileGeneric;
import dan200.computercraft.shared.computer.blocks.ComputerProxy;
import dan200.computercraft.shared.computer.blocks.TileComputerBase;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.computer.core.ComputerState;
import dan200.computercraft.shared.computer.core.ServerComputer;
-import dan200.computercraft.shared.peripheral.diskdrive.TileDiskDrive;
import dan200.computercraft.shared.turtle.apis.TurtleAPI;
import dan200.computercraft.shared.turtle.core.TurtleBrain;
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
import dan200.computercraft.shared.util.*;
import net.minecraft.block.BlockState;
-import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
@@ -45,7 +41,6 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
-import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -67,7 +62,7 @@ public class TileTurtle extends TileComputerBase
public TileTurtle( BlockEntityType extends TileGeneric> type, BlockPos pos, BlockState state, ComputerFamily family )
{
- super(type, family, pos, state );
+ super( type, family, pos, state );
}
@Override
@@ -279,7 +274,7 @@ public class TileTurtle extends TileComputerBase
public void serverTick( )
{
super.serverTick();
- brain.update();
+ brain.update();
if( inventoryChanged )
{
ServerComputer computer = getServerComputer();
@@ -303,7 +298,7 @@ public class TileTurtle extends TileComputerBase
@Override
protected void updateBlockState( ComputerState newState )
- {}
+ { }
@Nonnull
@Override
diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java
index 70677fd41..ea6c02a5a 100644
--- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java
+++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlaceCommand.java
@@ -193,14 +193,14 @@ public class TurtlePlaceCommand implements ITurtleCommand
if( direction.getAxis() != Direction.Axis.Y )
{
- turtlePlayer.setYaw(direction.asRotation());
- turtlePlayer.setPitch(0.0f);
+ turtlePlayer.setYaw( direction.asRotation() );
+ turtlePlayer.setPitch( 0.0f );
}
else
{
- turtlePlayer.setYaw(turtle.getDirection()
- .asRotation());
- turtlePlayer.setPitch(DirectionUtil.toPitchAngle( direction ));
+ turtlePlayer.setYaw( turtle.getDirection()
+ .asRotation() );
+ turtlePlayer.setPitch( DirectionUtil.toPitchAngle( direction ) );
}
turtlePlayer.setPos( posX, posY, posZ );
diff --git a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java
index 76170b7f8..896ade7a6 100644
--- a/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java
+++ b/src/main/java/dan200/computercraft/shared/turtle/core/TurtlePlayer.java
@@ -26,7 +26,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
-import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
@@ -84,9 +83,9 @@ public final class TurtlePlayer extends FakePlayer
BlockPos position = turtle.getPosition();
setPos( position.getX() + 0.5, position.getY() + 0.5, position.getZ() + 0.5 );
- setYaw(turtle.getDirection()
- .asRotation());
- setPitch(0.0f);
+ setYaw( turtle.getDirection()
+ .asRotation() );
+ setPitch( 0.0f );
getInventory().clear();
}
@@ -211,7 +210,7 @@ public final class TurtlePlayer extends FakePlayer
public void closeHandledScreen()
{
}
-
+
@Override
protected void onStatusEffectRemoved( @Nonnull StatusEffectInstance effect )
{
diff --git a/src/main/java/dan200/computercraft/shared/turtle/inventory/ContainerTurtle.java b/src/main/java/dan200/computercraft/shared/turtle/inventory/ContainerTurtle.java
index 96e79af68..17a06de7c 100644
--- a/src/main/java/dan200/computercraft/shared/turtle/inventory/ContainerTurtle.java
+++ b/src/main/java/dan200/computercraft/shared/turtle/inventory/ContainerTurtle.java
@@ -24,11 +24,6 @@ import net.minecraft.network.PacketByteBuf;
import net.minecraft.screen.ArrayPropertyDelegate;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.slot.Slot;
-import net.minecraft.screen.slot.SlotActionType;
-import net.minecraft.util.crash.CrashException;
-import net.minecraft.util.crash.CrashReport;
-import net.minecraft.util.crash.CrashReportSection;
-import net.minecraft.util.registry.Registry;
import javax.annotation.Nonnull;
import java.util.function.Predicate;
diff --git a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSpeaker.java b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSpeaker.java
index d0ecbf7f9..fe87ef4a3 100644
--- a/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSpeaker.java
+++ b/src/main/java/dan200/computercraft/shared/turtle/upgrades/TurtleSpeaker.java
@@ -12,7 +12,6 @@ import dan200.computercraft.api.turtle.ITurtleAccess;
import dan200.computercraft.api.turtle.TurtleSide;
import dan200.computercraft.api.turtle.TurtleUpgradeType;
import dan200.computercraft.shared.ComputerCraftRegistry;
-import dan200.computercraft.shared.peripheral.speaker.SpeakerPeripheral;
import dan200.computercraft.shared.peripheral.speaker.UpgradeSpeakerPeripheral;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
diff --git a/src/main/java/dan200/computercraft/shared/util/FakeNetHandler.java b/src/main/java/dan200/computercraft/shared/util/FakeNetHandler.java
index 0b7637542..c955ae361 100644
--- a/src/main/java/dan200/computercraft/shared/util/FakeNetHandler.java
+++ b/src/main/java/dan200/computercraft/shared/util/FakeNetHandler.java
@@ -242,10 +242,10 @@ public class FakeNetHandler extends ServerPlayNetworkHandler
{
}
-// @Override
-// public void onConfirmScreenAction( ConfirmScreenActionC2SPacket packet )
-// {
-// }
+ // @Override
+ // public void onConfirmScreenAction( ConfirmScreenActionC2SPacket packet )
+ // {
+ // }
@Override
public void onSignUpdate( @Nonnull UpdateSignC2SPacket packet )
diff --git a/src/main/java/dan200/computercraft/shared/util/InvisibleSlot.java b/src/main/java/dan200/computercraft/shared/util/InvisibleSlot.java
index 4a31bc522..1e36de8ca 100644
--- a/src/main/java/dan200/computercraft/shared/util/InvisibleSlot.java
+++ b/src/main/java/dan200/computercraft/shared/util/InvisibleSlot.java
@@ -14,7 +14,7 @@ import javax.annotation.Nonnull;
public class InvisibleSlot extends Slot
{
- public InvisibleSlot(Inventory container, int slot )
+ public InvisibleSlot( Inventory container, int slot )
{
super( container, slot, 0, 0 );
}
diff --git a/src/main/java/dan200/computercraft/shared/util/NBTUtil.java b/src/main/java/dan200/computercraft/shared/util/NBTUtil.java
index 38e8ecddf..38d4fb494 100644
--- a/src/main/java/dan200/computercraft/shared/util/NBTUtil.java
+++ b/src/main/java/dan200/computercraft/shared/util/NBTUtil.java
@@ -65,8 +65,8 @@ public final class NBTUtil
int i = 0;
for( Map.Entry, ?> entry : m.entrySet() )
{
- NbtElement key = toNBTTag( entry.getKey() );
- NbtElement value = toNBTTag( entry.getKey() );
+ NbtElement key = toNBTTag( entry.getKey() );
+ NbtElement value = toNBTTag( entry.getKey() );
if( key != null && value != null )
{
nbt.put( "k" + i, key );
@@ -155,7 +155,7 @@ public final class NBTUtil
return tag.asString();
case TAG_COMPOUND: // Compound
{
- NbtCompound compound = (NbtCompound) tag;
+ NbtCompound compound = (NbtCompound) tag;
Map map = new HashMap<>( compound.getSize() );
for( String key : compound.getKeys() )
{
diff --git a/src/main/java/dan200/computercraft/shared/util/NonNullSupplier.java b/src/main/java/dan200/computercraft/shared/util/NonNullSupplier.java
index ad23cceb1..44979fbe9 100644
--- a/src/main/java/dan200/computercraft/shared/util/NonNullSupplier.java
+++ b/src/main/java/dan200/computercraft/shared/util/NonNullSupplier.java
@@ -1,12 +1,12 @@
+/*
+ * 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.shared.util;
import javax.annotation.Nonnull;
-/**
- * Equivalent to {@link Supplier}, except with nonnull contract.
- *
- * @see Supplier
- */
@FunctionalInterface
public interface NonNullSupplier
{