1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-29 00:32:18 +00:00

Final checkstyle cleanup

This commit is contained in:
Jonathan Coates 2021-06-09 09:04:40 +01:00
parent 59266fe6e9
commit 0bf7f3de89
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
30 changed files with 199 additions and 193 deletions

View File

@ -59,19 +59,29 @@ public class FakePlayer extends ServerPlayerEntity
// region Direct networkHandler access // region Direct networkHandler access
@Override @Override
public void enterCombat() { } public void enterCombat()
{
}
@Override @Override
public void endCombat() { } public void endCombat()
{
}
@Override @Override
public void tick() { } public void tick()
{
}
@Override @Override
public void playerTick() { } public void playerTick()
{
}
@Override @Override
public void onDeath( DamageSource damage ) { } public void onDeath( DamageSource damage )
{
}
@Override @Override
public Entity moveToWorld( ServerWorld destination ) public Entity moveToWorld( ServerWorld destination )
@ -92,10 +102,14 @@ public class FakePlayer extends ServerPlayerEntity
} }
@Override @Override
public void stopRiding() { } public void stopRiding()
{
}
@Override @Override
public void openEditSignScreen( SignBlockEntity tile ) { } public void openEditSignScreen( SignBlockEntity tile )
{
}
@Override @Override
public OptionalInt openHandledScreen( @Nullable NamedScreenHandlerFactory container ) public OptionalInt openHandledScreen( @Nullable NamedScreenHandlerFactory container )
@ -104,31 +118,49 @@ public class FakePlayer extends ServerPlayerEntity
} }
@Override @Override
public void sendTradeOffers( int id, TradeOfferList list, int level, int experience, boolean levelled, boolean refreshable ) { } public void sendTradeOffers( int id, TradeOfferList list, int level, int experience, boolean levelled, boolean refreshable )
{
}
@Override @Override
public void openHorseInventory( HorseBaseEntity horse, Inventory inventory ) { } public void openHorseInventory( HorseBaseEntity horse, Inventory inventory )
{
}
@Override @Override
public void openEditBookScreen( ItemStack stack, Hand hand ) { } public void openEditBookScreen( ItemStack stack, Hand hand )
{
}
@Override @Override
public void openCommandBlockScreen( CommandBlockBlockEntity block ) { } public void openCommandBlockScreen( CommandBlockBlockEntity block )
{
}
@Override @Override
public void onSlotUpdate( ScreenHandler container, int slot, ItemStack stack ) { } public void onSlotUpdate( ScreenHandler container, int slot, ItemStack stack )
{
}
@Override @Override
public void onHandlerRegistered( ScreenHandler container, DefaultedList<ItemStack> defaultedList ) { } public void onHandlerRegistered( ScreenHandler container, DefaultedList<ItemStack> defaultedList )
{
}
@Override @Override
public void onPropertyUpdate( ScreenHandler container, int key, int value ) { } public void onPropertyUpdate( ScreenHandler container, int key, int value )
{
}
@Override @Override
public void closeHandledScreen() { } public void closeHandledScreen()
{
}
@Override @Override
public void updateCursorStack() { } public void updateCursorStack()
{
}
@Override @Override
public int unlockRecipes( Collection<Recipe<?>> recipes ) public int unlockRecipes( Collection<Recipe<?>> recipes )
@ -144,31 +176,49 @@ public class FakePlayer extends ServerPlayerEntity
} }
@Override @Override
public void sendMessage( Text textComponent, boolean status ) { } public void sendMessage( Text textComponent, boolean status )
{
}
@Override @Override
protected void consumeItem() { } protected void consumeItem()
{
}
@Override @Override
public void lookAt( EntityAnchorArgumentType.EntityAnchor anchor, Vec3d vec3d ) {} public void lookAt( EntityAnchorArgumentType.EntityAnchor anchor, Vec3d vec3d )
{
}
@Override @Override
public void method_14222( EntityAnchorArgumentType.EntityAnchor self, Entity entity, EntityAnchorArgumentType.EntityAnchor target ) { } public void method_14222( EntityAnchorArgumentType.EntityAnchor self, Entity entity, EntityAnchorArgumentType.EntityAnchor target )
{
}
@Override @Override
protected void onStatusEffectApplied( StatusEffectInstance statusEffectInstance ) { } protected void onStatusEffectApplied( StatusEffectInstance statusEffectInstance )
{
}
@Override @Override
protected void onStatusEffectUpgraded( StatusEffectInstance statusEffectInstance, boolean particles ) { } protected void onStatusEffectUpgraded( StatusEffectInstance statusEffectInstance, boolean particles )
{
}
@Override @Override
protected void onStatusEffectRemoved( StatusEffectInstance statusEffectInstance ) { } protected void onStatusEffectRemoved( StatusEffectInstance statusEffectInstance )
{
}
@Override @Override
public void requestTeleport( double x, double y, double z ) { } public void requestTeleport( double x, double y, double z )
{
}
@Override @Override
public void setGameMode( GameMode gameMode ) { } public void setGameMode( GameMode gameMode )
{
}
@Override @Override
public void sendMessage( Text message, MessageType type, UUID senderUuid ) public void sendMessage( Text message, MessageType type, UUID senderUuid )
@ -183,25 +233,39 @@ public class FakePlayer extends ServerPlayerEntity
} }
@Override @Override
public void sendResourcePackUrl( String url, String hash ) { } public void sendResourcePackUrl( String url, String hash )
{
}
@Override @Override
public void onStoppedTracking( Entity entity ) { } public void onStoppedTracking( Entity entity )
{
}
@Override @Override
public void setCameraEntity( Entity entity ) { } public void setCameraEntity( Entity entity )
{
}
@Override @Override
public void teleport( ServerWorld serverWorld, double x, double y, double z, float pitch, float yaw ) { } public void teleport( ServerWorld serverWorld, double x, double y, double z, float pitch, float yaw )
{
}
@Override @Override
public void sendInitialChunkPackets( ChunkPos chunkPos, Packet<?> packet, Packet<?> packet2 ) { } public void sendInitialChunkPackets( ChunkPos chunkPos, Packet<?> packet, Packet<?> packet2 )
{
}
@Override @Override
public void sendUnloadChunkPacket( ChunkPos chunkPos ) { } public void sendUnloadChunkPacket( ChunkPos chunkPos )
{
}
@Override @Override
public void playSound( SoundEvent soundEvent, SoundCategory soundCategory, float volume, float pitch ) { } public void playSound( SoundEvent soundEvent, SoundCategory soundCategory, float volume, float pitch )
{
}
private static class FakeNetHandler extends ServerPlayNetworkHandler private static class FakeNetHandler extends ServerPlayNetworkHandler
{ {
@ -211,16 +275,24 @@ public class FakePlayer extends ServerPlayerEntity
} }
@Override @Override
public void disconnect( Text message ) { } public void disconnect( Text message )
{
}
@Override @Override
public void onVehicleMove( VehicleMoveC2SPacket move ) { } public void onVehicleMove( VehicleMoveC2SPacket move )
{
}
@Override @Override
public void onRequestCommandCompletions( RequestCommandCompletionsC2SPacket packet ) { } public void onRequestCommandCompletions( RequestCommandCompletionsC2SPacket packet )
{
}
@Override @Override
public void sendPacket( Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> listener ) { } public void sendPacket( Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> listener )
{
}
} }
private static class FakeConnection extends ClientConnection private static class FakeConnection extends ClientConnection

View File

@ -13,11 +13,6 @@ public final class FrameInfo
private static int tick; private static int tick;
private static long renderFrame; private static long renderFrame;
static
{
}
private FrameInfo() private FrameInfo()
{ {
} }

View File

@ -22,7 +22,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Matrix4f; import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.World;
@Environment( EnvType.CLIENT ) @Environment( EnvType.CLIENT )
public final class CableHighlightRenderer public final class CableHighlightRenderer
@ -31,13 +30,9 @@ public final class CableHighlightRenderer
{ {
} }
/**
* Draw an outline for a specific part of a cable "Multipart".
*/
public static boolean drawHighlight( MatrixStack stack, VertexConsumer consumer, Entity entity, double d, double e, double f, BlockPos pos, public static boolean drawHighlight( MatrixStack stack, VertexConsumer consumer, Entity entity, double d, double e, double f, BlockPos pos,
BlockState state ) BlockState state )
{ {
World world = entity.getEntityWorld();
Camera info = MinecraftClient.getInstance().gameRenderer.getCamera(); Camera info = MinecraftClient.getInstance().gameRenderer.getCamera();
// We only care about instances with both cable and modem. // We only care about instances with both cable and modem.

View File

@ -23,14 +23,15 @@ import net.minecraft.util.math.MathHelper;
@Environment( EnvType.CLIENT ) @Environment( EnvType.CLIENT )
public abstract class ItemMapLikeRenderer public abstract class ItemMapLikeRenderer
{ {
public void renderItemFirstPerson( MatrixStack transform, VertexConsumerProvider render, int lightTexture, Hand hand, float pitch, float equipProgress public void renderItemFirstPerson(
, float swingProgress, ItemStack stack ) MatrixStack transform, VertexConsumerProvider render, int lightTexture, Hand hand, float pitch, float equipProgress,
float swingProgress, ItemStack stack
)
{ {
PlayerEntity player = MinecraftClient.getInstance().player; PlayerEntity player = MinecraftClient.getInstance().player;
transform.push(); transform.push();
if( hand == Hand.MAIN_HAND && player.getOffHandStack() if( hand == Hand.MAIN_HAND && player.getOffHandStack().isEmpty() )
.isEmpty() )
{ {
this.renderItemFirstPersonCenter( transform, render, lightTexture, pitch, equipProgress, swingProgress, stack ); this.renderItemFirstPersonCenter( transform, render, lightTexture, pitch, equipProgress, swingProgress, stack );
} }
@ -39,8 +40,7 @@ public abstract class ItemMapLikeRenderer
this.renderItemFirstPersonSide( transform, this.renderItemFirstPersonSide( transform,
render, render,
lightTexture, lightTexture,
hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm() hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite(),
.getOpposite(),
equipProgress, equipProgress,
swingProgress, swingProgress,
stack ); stack );

View File

@ -36,8 +36,9 @@ public final class MonitorHighlightRenderer
{ {
} }
public static boolean drawHighlight( MatrixStack matrixStack, VertexConsumer vertexConsumer, Entity entity, double d, double e, double f, BlockPos pos public static boolean drawHighlight(
, BlockState blockState ) MatrixStack matrixStack, VertexConsumer vertexConsumer, Entity entity, double d, double e, double f, BlockPos pos, BlockState blockState
)
{ {
// Preserve normal behaviour when crouching. // Preserve normal behaviour when crouching.
if( entity.isInSneakingPose() ) if( entity.isInSneakingPose() )

View File

@ -99,21 +99,11 @@ public class TileEntityTurtleRenderer extends BlockEntityRenderer<TileTurtle>
float f2 = (float) (tint & 255) / 255.0F; float f2 = (float) (tint & 255) / 255.0F;
buffer.quad( matrix, buffer.quad( matrix,
bakedquad, bakedquad,
new float[] { new float[] { 1.0F, 1.0F, 1.0F, 1.0F },
1.0F,
1.0F,
1.0F,
1.0F
},
f, f,
f1, f1,
f2, f2,
new int[] { new int[] { lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord },
lightmapCoord,
lightmapCoord,
lightmapCoord,
lightmapCoord
},
overlayLight, overlayLight,
true ); true );
} }

View File

@ -67,7 +67,10 @@ public final class TurtleModelLoader
{ {
private final Identifier family; private final Identifier family;
private TurtleModel( Identifier family ) {this.family = family;} private TurtleModel( Identifier family )
{
this.family = family;
}
@Override @Override
public Collection<SpriteIdentifier> getTextureDependencies( Function<Identifier, UnbakedModel> modelGetter, public Collection<SpriteIdentifier> getTextureDependencies( Function<Identifier, UnbakedModel> modelGetter,

View File

@ -11,7 +11,10 @@ import com.google.common.cache.LoadingCache;
import com.google.common.primitives.Primitives; import com.google.common.primitives.Primitives;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import dan200.computercraft.ComputerCraft; import dan200.computercraft.ComputerCraft;
import dan200.computercraft.api.lua.*; import dan200.computercraft.api.lua.IArguments;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.api.lua.MethodResult;
import org.objectweb.asm.ClassWriter; import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Type; import org.objectweb.asm.Type;

View File

@ -16,6 +16,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/** /**
* Captures block drops.
*
* @see Block#dropStack(World, BlockPos, ItemStack) * @see Block#dropStack(World, BlockPos, ItemStack)
*/ */
@Mixin( Block.class ) @Mixin( Block.class )

View File

@ -15,6 +15,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
/** /**
* Captures entities.
*
* @see Entity#dropStack(ItemStack, float) * @see Entity#dropStack(ItemStack, float)
*/ */
@Mixin( Entity.class ) @Mixin( Entity.class )

View File

@ -45,9 +45,11 @@ public class MixinHeldItemRenderer
"Lnet/minecraft/client/render/VertexConsumerProvider;I)V", "Lnet/minecraft/client/render/VertexConsumerProvider;I)V",
at = @At( "HEAD" ), at = @At( "HEAD" ),
cancellable = true ) cancellable = true )
public void renderFirstPersonItem_Injected( AbstractClientPlayerEntity player, float var2, float pitch, Hand hand, float swingProgress, public void renderFirstPersonItem(
ItemStack stack, float equipProgress, MatrixStack matrixStack, VertexConsumerProvider provider, int light, AbstractClientPlayerEntity player, float var2, float pitch, Hand hand, float swingProgress,
CallbackInfo callback ) ItemStack stack, float equipProgress, MatrixStack matrixStack, VertexConsumerProvider provider, int light,
CallbackInfo callback
)
{ {
if( stack.getItem() instanceof ItemPrintout ) if( stack.getItem() instanceof ItemPrintout )
{ {

View File

@ -24,8 +24,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class MixinItemFrameEntityRenderer public class MixinItemFrameEntityRenderer
{ {
@Inject( method = "render", at = @At( "HEAD" ), cancellable = true ) @Inject( method = "render", at = @At( "HEAD" ), cancellable = true )
private void renderItem_Injected( ItemFrameEntity itemFrameEntity, float f, float g, MatrixStack matrixStack, private void renderItem(
VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo info ) ItemFrameEntity itemFrameEntity, float f, float g, MatrixStack matrixStack,
VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo info
)
{ {
ItemStack stack = itemFrameEntity.getHeldItemStack(); ItemStack stack = itemFrameEntity.getHeldItemStack();
if( stack.getItem() instanceof ItemPrintout ) if( stack.getItem() instanceof ItemPrintout )

View File

@ -14,6 +14,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
/** /**
* Captures item stacks spawned into the world.
*
* @see ServerWorld#spawnEntity(Entity) * @see ServerWorld#spawnEntity(Entity)
*/ */
@Mixin( ServerWorld.class ) @Mixin( ServerWorld.class )

View File

@ -13,5 +13,8 @@ import org.spongepowered.asm.mixin.gen.Invoker;
public interface WorldSavePathAccess public interface WorldSavePathAccess
{ {
@Invoker( "<init>" ) @Invoker( "<init>" )
static WorldSavePath createWorldSavePath( String relativePath ) { throw new UnsupportedOperationException(); } static WorldSavePath createWorldSavePath( String relativePath )
{
throw new UnsupportedOperationException();
}
} }

View File

@ -70,10 +70,7 @@ public class CommandAPI implements ILuaAPI
.getServer(); .getServer();
if( server == null || !server.areCommandBlocksEnabled() ) if( server == null || !server.areCommandBlocksEnabled() )
{ {
return new Object[] { return new Object[] { false, createOutput( "Command blocks disabled by server" ) };
false,
createOutput( "Command blocks disabled by server" )
};
} }
CommandManager commandManager = server.getCommandManager(); CommandManager commandManager = server.getCommandManager();
@ -82,11 +79,7 @@ public class CommandAPI implements ILuaAPI
{ {
receiver.clearOutput(); receiver.clearOutput();
int result = commandManager.execute( this.computer.getSource(), command ); int result = commandManager.execute( this.computer.getSource(), command );
return new Object[] { return new Object[] { result > 0, receiver.copyOutput(), result };
result > 0,
receiver.copyOutput(),
result
};
} }
catch( Throwable t ) catch( Throwable t )
{ {
@ -94,10 +87,7 @@ public class CommandAPI implements ILuaAPI
{ {
ComputerCraft.log.error( "Error running command.", t ); ComputerCraft.log.error( "Error running command.", t );
} }
return new Object[] { return new Object[] { false, createOutput( "Java Exception Thrown: " + t ) };
false,
createOutput( "Java Exception Thrown: " + t )
};
} }
} }
@ -187,11 +177,7 @@ public class CommandAPI implements ILuaAPI
{ {
// This is probably safe to do on the Lua thread. Probably. // This is probably safe to do on the Lua thread. Probably.
BlockPos pos = this.computer.getPos(); BlockPos pos = this.computer.getPos();
return new Object[] { return new Object[] { pos.getX(), pos.getY(), pos.getZ() };
pos.getX(),
pos.getY(),
pos.getZ()
};
} }
/** /**
@ -252,14 +238,11 @@ public class CommandAPI implements ILuaAPI
Block block = state.getBlock(); Block block = state.getBlock();
Map<Object, Object> table = new HashMap<>(); Map<Object, Object> table = new HashMap<>();
table.put( "name", table.put( "name", Registry.BLOCK.getId( block ).toString() );
Registry.BLOCK.getId( block )
.toString() );
table.put( "world", world.getRegistryKey() ); table.put( "world", world.getRegistryKey() );
Map<Object, Object> stateTable = new HashMap<>(); Map<Object, Object> stateTable = new HashMap<>();
for( ImmutableMap.Entry<Property<?>, Comparable<?>> entry : state.getEntries() for( ImmutableMap.Entry<Property<?>, Comparable<?>> entry : state.getEntries().entrySet() )
.entrySet() )
{ {
Property<?> property = entry.getKey(); Property<?> property = entry.getKey();
stateTable.put( property.getName(), getPropertyValue( property, entry.getValue() ) ); stateTable.put( property.getName(), getPropertyValue( property, entry.getValue() ) );

View File

@ -3,7 +3,6 @@
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.shared.computer.core; package dan200.computercraft.shared.computer.core;
/** /**
@ -14,59 +13,35 @@ package dan200.computercraft.shared.computer.core;
*/ */
public interface InputHandler public interface InputHandler
{ {
void queueEvent( String event, Object[] arguments );
default void keyDown( int key, boolean repeat ) default void keyDown( int key, boolean repeat )
{ {
this.queueEvent( "key", queueEvent( "key", new Object[] { key, repeat } );
new Object[] {
key,
repeat
} );
} }
void queueEvent( String event, Object[] arguments );
default void keyUp( int key ) default void keyUp( int key )
{ {
this.queueEvent( "key_up", new Object[] { key } ); queueEvent( "key_up", new Object[] { key } );
} }
default void mouseClick( int button, int x, int y ) default void mouseClick( int button, int x, int y )
{ {
this.queueEvent( "mouse_click", queueEvent( "mouse_click", new Object[] { button, x, y } );
new Object[] {
button,
x,
y
} );
} }
default void mouseUp( int button, int x, int y ) default void mouseUp( int button, int x, int y )
{ {
this.queueEvent( "mouse_up", queueEvent( "mouse_up", new Object[] { button, x, y } );
new Object[] {
button,
x,
y
} );
} }
default void mouseDrag( int button, int x, int y ) default void mouseDrag( int button, int x, int y )
{ {
this.queueEvent( "mouse_drag", queueEvent( "mouse_drag", new Object[] { button, x, y } );
new Object[] {
button,
x,
y
} );
} }
default void mouseScroll( int direction, int x, int y ) default void mouseScroll( int direction, int x, int y )
{ {
this.queueEvent( "mouse_scroll", queueEvent( "mouse_scroll", new Object[] { direction, x, y } );
new Object[] {
direction,
x,
y
} );
} }
} }

View File

@ -80,6 +80,7 @@ public final class NetworkHandler
/** /**
* /** Register packet, and a thread-unsafe handler for it. * /** Register packet, and a thread-unsafe handler for it.
* *
* @param <T> The type of the packet to send.
* @param id The identifier for this packet type * @param id The identifier for this packet type
* @param factory The factory for this type of packet. * @param factory The factory for this type of packet.
*/ */
@ -95,6 +96,8 @@ public final class NetworkHandler
/** /**
* /** Register packet, and a thread-unsafe handler for it. * /** Register packet, and a thread-unsafe handler for it.
* *
* @param <T> The type of the packet to send.
* @param type The class of the type of packet to send.
* @param id The identifier for this packet type * @param id The identifier for this packet type
* @param decoder The factory for this type of packet. * @param decoder The factory for this type of packet.
*/ */

View File

@ -95,9 +95,6 @@ public class CommandBlockPeripheral implements IPeripheral
.execute( this.commandBlock.getWorld() ); .execute( this.commandBlock.getWorld() );
int result = this.commandBlock.getCommandExecutor() int result = this.commandBlock.getCommandExecutor()
.getSuccessCount(); .getSuccessCount();
return result > 0 ? new Object[] { true } : new Object[] { return result > 0 ? new Object[] { true } : new Object[] { false, "Command failed" };
false,
"Command failed"
};
} }
} }

View File

@ -51,8 +51,9 @@ public class BlockDiskDrive extends BlockGeneric
} }
@Override @Override
public void afterBreak( @Nonnull World world, @Nonnull PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable BlockEntity te public void afterBreak(
, @Nonnull ItemStack stack ) @Nonnull World world, @Nonnull PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable BlockEntity te, @Nonnull ItemStack stack
)
{ {
if( te instanceof Nameable && ((Nameable) te).hasCustomName() ) if( te instanceof Nameable && ((Nameable) te).hasCustomName() )
{ {

View File

@ -654,9 +654,7 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile
@SuppressWarnings( "StatementWithEmptyBody" ) @SuppressWarnings( "StatementWithEmptyBody" )
void expand() void expand()
{ {
while( this.mergeLeft() || this.mergeRight() || this.mergeUp() || this.mergeDown() ) while( this.mergeLeft() || this.mergeRight() || this.mergeUp() || this.mergeDown() ) ;
{
}
} }
void contractNeighbours() void contractNeighbours()

View File

@ -53,8 +53,7 @@ public class BlockPrinter extends BlockGeneric
} }
@Override @Override
public void afterBreak( @Nonnull World world, @Nonnull PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable BlockEntity te public void afterBreak( @Nonnull World world, @Nonnull PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable BlockEntity te, @Nonnull ItemStack stack )
, @Nonnull ItemStack stack )
{ {
if( te instanceof Nameable && ((Nameable) te).hasCustomName() ) if( te instanceof Nameable && ((Nameable) te).hasCustomName() )
{ {

View File

@ -97,10 +97,7 @@ public class PrinterPeripheral implements IPeripheral
Terminal page = this.getCurrentPage(); Terminal page = this.getCurrentPage();
int x = page.getCursorX(); int x = page.getCursorX();
int y = page.getCursorY(); int y = page.getCursorY();
return new Object[] { return new Object[] { x + 1, y + 1 };
x + 1,
y + 1
};
} }
/** /**
@ -131,10 +128,7 @@ public class PrinterPeripheral implements IPeripheral
Terminal page = this.getCurrentPage(); Terminal page = this.getCurrentPage();
int width = page.getWidth(); int width = page.getWidth();
int height = page.getHeight(); int height = page.getHeight();
return new Object[] { return new Object[] { width, height };
width,
height
};
} }
/** /**

View File

@ -52,7 +52,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
9, 9,
10, 10,
11, 11,
12 12,
}; };
private static final int[] TOP_SLOTS = new int[] { private static final int[] TOP_SLOTS = new int[] {
1, 1,
@ -60,7 +60,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
3, 3,
4, 4,
5, 5,
6 6,
}; };
private static final int[] SIDE_SLOTS = new int[] { 0 }; private static final int[] SIDE_SLOTS = new int[] { 0 };
private final DefaultedList<ItemStack> inventory = DefaultedList.ofSize( SLOTS, ItemStack.EMPTY ); private final DefaultedList<ItemStack> inventory = DefaultedList.ofSize( SLOTS, ItemStack.EMPTY );

View File

@ -65,10 +65,7 @@ public class PocketAPI implements ILuaAPI
Entity entity = this.computer.getEntity(); Entity entity = this.computer.getEntity();
if( !(entity instanceof PlayerEntity) ) if( !(entity instanceof PlayerEntity) )
{ {
return new Object[] { return new Object[] { false, "Cannot find player" };
false,
"Cannot find player"
};
} }
PlayerEntity player = (PlayerEntity) entity; PlayerEntity player = (PlayerEntity) entity;
PlayerInventory inventory = player.inventory; PlayerInventory inventory = player.inventory;
@ -83,10 +80,7 @@ public class PocketAPI implements ILuaAPI
} }
if( newUpgrade == null ) if( newUpgrade == null )
{ {
return new Object[] { return new Object[] { false, "Cannot find a valid upgrade" };
false,
"Cannot find a valid upgrade"
};
} }
// Remove the current upgrade // Remove the current upgrade
@ -146,10 +140,7 @@ public class PocketAPI implements ILuaAPI
Entity entity = this.computer.getEntity(); Entity entity = this.computer.getEntity();
if( !(entity instanceof PlayerEntity) ) if( !(entity instanceof PlayerEntity) )
{ {
return new Object[] { return new Object[] { false, "Cannot find player" };
false,
"Cannot find player"
};
} }
PlayerEntity player = (PlayerEntity) entity; PlayerEntity player = (PlayerEntity) entity;
PlayerInventory inventory = player.inventory; PlayerInventory inventory = player.inventory;
@ -157,10 +148,7 @@ public class PocketAPI implements ILuaAPI
if( previousUpgrade == null ) if( previousUpgrade == null )
{ {
return new Object[] { return new Object[] { false, "Nothing to unequip" };
false,
"Nothing to unequip"
};
} }
this.computer.setUpgrade( null ); this.computer.setUpgrade( null );

View File

@ -523,8 +523,8 @@ public class TurtleAPI implements ILuaAPI
* Get the maximum amount of fuel this turtle currently holds. * Get the maximum amount of fuel this turtle currently holds.
* *
* @return The fuel level, or "unlimited". * @return The fuel level, or "unlimited".
* @cc.treturn[1] number The current amount of fuel a turtle this turtle has. * @cc.treturn [1] number The current amount of fuel a turtle this turtle has.
* @cc.treturn[2] "unlimited" If turtles do not consume fuel when moving. * @cc.treturn [2] "unlimited" If turtles do not consume fuel when moving.
* @see #getFuelLimit() * @see #getFuelLimit()
* @see #refuel(Optional) * @see #refuel(Optional)
*/ */
@ -547,9 +547,9 @@ public class TurtleAPI implements ILuaAPI
* @param countA The maximum number of items to consume. One can pass `0` to check if an item is combustable or not. * @param countA The maximum number of items to consume. One can pass `0` to check if an item is combustable or not.
* @return If this turtle could be refuelled. * @return If this turtle could be refuelled.
* @throws LuaException If the refuel count is out of range. * @throws LuaException If the refuel count is out of range.
* @cc.treturn[1] true If the turtle was refuelled. * @cc.treturn [1] true If the turtle was refuelled.
* @cc.treturn[2] false If the turtle was not refuelled. * @cc.treturn [2] false If the turtle was not refuelled.
* @cc.treturn[2] string The reason the turtle was not refuelled ( * @cc.treturn [2] string The reason the turtle was not refuelled (
* @cc.usage Refuel a turtle from the currently selected slot. * @cc.usage Refuel a turtle from the currently selected slot.
* <pre>{@code * <pre>{@code
* local level = turtle.getFuelLevel() * local level = turtle.getFuelLevel()
@ -631,8 +631,8 @@ public class TurtleAPI implements ILuaAPI
* By default, normal turtles have a limit of 20,000 and advanced turtles of 100,000. * By default, normal turtles have a limit of 20,000 and advanced turtles of 100,000.
* *
* @return The limit, or "unlimited". * @return The limit, or "unlimited".
* @cc.treturn[1] number The maximum amount of fuel a turtle can hold. * @cc.treturn [1] number The maximum amount of fuel a turtle can hold.
* @cc.treturn[2] "unlimited" If turtles do not consume fuel when moving. * @cc.treturn [2] "unlimited" If turtles do not consume fuel when moving.
* @see #getFuelLevel() * @see #getFuelLevel()
* @see #refuel(Optional) * @see #refuel(Optional)
*/ */
@ -650,9 +650,9 @@ public class TurtleAPI implements ILuaAPI
* upgrade is removed, but no new one is equipped. * upgrade is removed, but no new one is equipped.
* *
* @return Whether an item was equiped or not. * @return Whether an item was equiped or not.
* @cc.treturn[1] true If the item was equipped. * @cc.treturn [1] true If the item was equipped.
* @cc.treturn[2] false If we could not equip the item. * @cc.treturn [2] false If we could not equip the item.
* @cc.treturn[2] string The reason equipping this item failed. * @cc.treturn [2] string The reason equipping this item failed.
* @see #equipRight() * @see #equipRight()
*/ */
@LuaFunction @LuaFunction
@ -669,9 +669,9 @@ public class TurtleAPI implements ILuaAPI
* upgrade is removed, but no new one is equipped. * upgrade is removed, but no new one is equipped.
* *
* @return Whether an item was equiped or not. * @return Whether an item was equiped or not.
* @cc.treturn[1] true If the item was equipped. * @cc.treturn [1] true If the item was equipped.
* @cc.treturn[2] false If we could not equip the item. * @cc.treturn [2] false If we could not equip the item.
* @cc.treturn[2] string The reason equipping this item failed. * @cc.treturn [2] string The reason equipping this item failed.
* @see #equipRight() * @see #equipRight()
*/ */
@LuaFunction @LuaFunction
@ -776,10 +776,7 @@ public class TurtleAPI implements ILuaAPI
TurtleActionEvent event = new TurtleInspectItemEvent( this.turtle, stack, table, detailed ); TurtleActionEvent event = new TurtleInspectItemEvent( this.turtle, stack, table, detailed );
if( TurtleEvent.post( event ) ) if( TurtleEvent.post( event ) )
{ {
return new Object[] { return new Object[] { false, event.getFailureMessage() };
false,
event.getFailureMessage()
};
} }
return new Object[] { table }; return new Object[] { table };

View File

@ -24,8 +24,7 @@ public final class TurtleRecipe extends ComputerFamilyRecipe
new dan200.computercraft.shared.computer.recipe.ComputerFamilyRecipe.Serializer<TurtleRecipe>() new dan200.computercraft.shared.computer.recipe.ComputerFamilyRecipe.Serializer<TurtleRecipe>()
{ {
@Override @Override
protected TurtleRecipe create( Identifier identifier, String group, int width, int height, DefaultedList<Ingredient> ingredients, ItemStack result protected TurtleRecipe create( Identifier identifier, String group, int width, int height, DefaultedList<Ingredient> ingredients, ItemStack result, ComputerFamily family )
, ComputerFamily family )
{ {
return new TurtleRecipe( identifier, group, width, height, ingredients, result, family ); return new TurtleRecipe( identifier, group, width, height, ingredients, result, family );
} }

View File

@ -144,10 +144,7 @@ public final class TurtleUpgradeRecipe extends SpecialCraftingRecipe
}; };
// Get the upgrades for the new items // Get the upgrades for the new items
ItemStack[] items = new ItemStack[] { ItemStack[] items = new ItemStack[] { rightItem, leftItem };
rightItem,
leftItem
};
for( int i = 0; i < 2; i++ ) for( int i = 0; i < 2; i++ )
{ {
if( !items[i].isEmpty() ) if( !items[i].isEmpty() )

View File

@ -31,7 +31,8 @@ public class CommentedConfigSpec extends ConfigSpec
public int correct( Config config ) public int correct( Config config )
{ {
return correct( config, ( action, path, incorrectValue, correctedValue ) -> {} ); return correct( config, ( action, path, incorrectValue, correctedValue ) -> {
} );
} }
public int correct( Config config, ConfigSpec.CorrectionListener listener ) public int correct( Config config, ConfigSpec.CorrectionListener listener )

View File

@ -30,7 +30,7 @@ import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class Config public final class Config
{ {
private static final int MODEM_MAX_RANGE = 100000; private static final int MODEM_MAX_RANGE = 100000;

View File

@ -31,7 +31,9 @@ public final class IDAssigner
private static final WorldSavePath FOLDER = WorldSavePathAccess.createWorldSavePath( ComputerCraft.MOD_ID ); private static final WorldSavePath FOLDER = WorldSavePathAccess.createWorldSavePath( ComputerCraft.MOD_ID );
private static final Gson GSON = new GsonBuilder().setPrettyPrinting() private static final Gson GSON = new GsonBuilder().setPrettyPrinting()
.create(); .create();
private static final Type ID_TOKEN = new TypeToken<Map<String, Integer>>() {}.getType(); private static final Type ID_TOKEN = new TypeToken<Map<String, Integer>>()
{
}.getType();
private static Map<String, Integer> ids; private static Map<String, Integer> ids;
private static WeakReference<MinecraftServer> server; private static WeakReference<MinecraftServer> server;
private static Path idFile; private static Path idFile;