mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-28 16:22:18 +00:00
Final checkstyle cleanup
This commit is contained in:
parent
59266fe6e9
commit
0bf7f3de89
@ -59,19 +59,29 @@ public class FakePlayer extends ServerPlayerEntity
|
||||
|
||||
// region Direct networkHandler access
|
||||
@Override
|
||||
public void enterCombat() { }
|
||||
public void enterCombat()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endCombat() { }
|
||||
public void endCombat()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() { }
|
||||
public void tick()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerTick() { }
|
||||
public void playerTick()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath( DamageSource damage ) { }
|
||||
public void onDeath( DamageSource damage )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity moveToWorld( ServerWorld destination )
|
||||
@ -92,10 +102,14 @@ public class FakePlayer extends ServerPlayerEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopRiding() { }
|
||||
public void stopRiding()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openEditSignScreen( SignBlockEntity tile ) { }
|
||||
public void openEditSignScreen( SignBlockEntity tile )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public OptionalInt openHandledScreen( @Nullable NamedScreenHandlerFactory container )
|
||||
@ -104,31 +118,49 @@ public class FakePlayer extends ServerPlayerEntity
|
||||
}
|
||||
|
||||
@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
|
||||
public void openHorseInventory( HorseBaseEntity horse, Inventory inventory ) { }
|
||||
public void openHorseInventory( HorseBaseEntity horse, Inventory inventory )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openEditBookScreen( ItemStack stack, Hand hand ) { }
|
||||
public void openEditBookScreen( ItemStack stack, Hand hand )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openCommandBlockScreen( CommandBlockBlockEntity block ) { }
|
||||
public void openCommandBlockScreen( CommandBlockBlockEntity block )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotUpdate( ScreenHandler container, int slot, ItemStack stack ) { }
|
||||
public void onSlotUpdate( ScreenHandler container, int slot, ItemStack stack )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHandlerRegistered( ScreenHandler container, DefaultedList<ItemStack> defaultedList ) { }
|
||||
public void onHandlerRegistered( ScreenHandler container, DefaultedList<ItemStack> defaultedList )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPropertyUpdate( ScreenHandler container, int key, int value ) { }
|
||||
public void onPropertyUpdate( ScreenHandler container, int key, int value )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeHandledScreen() { }
|
||||
public void closeHandledScreen()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCursorStack() { }
|
||||
public void updateCursorStack()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int unlockRecipes( Collection<Recipe<?>> recipes )
|
||||
@ -144,31 +176,49 @@ public class FakePlayer extends ServerPlayerEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage( Text textComponent, boolean status ) { }
|
||||
public void sendMessage( Text textComponent, boolean status )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void consumeItem() { }
|
||||
protected void consumeItem()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lookAt( EntityAnchorArgumentType.EntityAnchor anchor, Vec3d vec3d ) {}
|
||||
public void lookAt( EntityAnchorArgumentType.EntityAnchor anchor, Vec3d vec3d )
|
||||
{
|
||||
}
|
||||
|
||||
@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
|
||||
protected void onStatusEffectApplied( StatusEffectInstance statusEffectInstance ) { }
|
||||
protected void onStatusEffectApplied( StatusEffectInstance statusEffectInstance )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStatusEffectUpgraded( StatusEffectInstance statusEffectInstance, boolean particles ) { }
|
||||
protected void onStatusEffectUpgraded( StatusEffectInstance statusEffectInstance, boolean particles )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStatusEffectRemoved( StatusEffectInstance statusEffectInstance ) { }
|
||||
protected void onStatusEffectRemoved( StatusEffectInstance statusEffectInstance )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestTeleport( double x, double y, double z ) { }
|
||||
public void requestTeleport( double x, double y, double z )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGameMode( GameMode gameMode ) { }
|
||||
public void setGameMode( GameMode gameMode )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage( Text message, MessageType type, UUID senderUuid )
|
||||
@ -183,25 +233,39 @@ public class FakePlayer extends ServerPlayerEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendResourcePackUrl( String url, String hash ) { }
|
||||
public void sendResourcePackUrl( String url, String hash )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStoppedTracking( Entity entity ) { }
|
||||
public void onStoppedTracking( Entity entity )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCameraEntity( Entity entity ) { }
|
||||
public void setCameraEntity( Entity entity )
|
||||
{
|
||||
}
|
||||
|
||||
@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
|
||||
public void sendInitialChunkPackets( ChunkPos chunkPos, Packet<?> packet, Packet<?> packet2 ) { }
|
||||
public void sendInitialChunkPackets( ChunkPos chunkPos, Packet<?> packet, Packet<?> packet2 )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUnloadChunkPacket( ChunkPos chunkPos ) { }
|
||||
public void sendUnloadChunkPacket( ChunkPos chunkPos )
|
||||
{
|
||||
}
|
||||
|
||||
@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
|
||||
{
|
||||
@ -211,16 +275,24 @@ public class FakePlayer extends ServerPlayerEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnect( Text message ) { }
|
||||
public void disconnect( Text message )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVehicleMove( VehicleMoveC2SPacket move ) { }
|
||||
public void onVehicleMove( VehicleMoveC2SPacket move )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestCommandCompletions( RequestCommandCompletionsC2SPacket packet ) { }
|
||||
public void onRequestCommandCompletions( RequestCommandCompletionsC2SPacket packet )
|
||||
{
|
||||
}
|
||||
|
||||
@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
|
||||
|
@ -13,11 +13,6 @@ public final class FrameInfo
|
||||
private static int tick;
|
||||
private static long renderFrame;
|
||||
|
||||
static
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private FrameInfo()
|
||||
{
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Environment( EnvType.CLIENT )
|
||||
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,
|
||||
BlockState state )
|
||||
{
|
||||
World world = entity.getEntityWorld();
|
||||
Camera info = MinecraftClient.getInstance().gameRenderer.getCamera();
|
||||
|
||||
// We only care about instances with both cable and modem.
|
||||
|
@ -23,14 +23,15 @@ import net.minecraft.util.math.MathHelper;
|
||||
@Environment( EnvType.CLIENT )
|
||||
public abstract class ItemMapLikeRenderer
|
||||
{
|
||||
public void renderItemFirstPerson( MatrixStack transform, VertexConsumerProvider render, int lightTexture, Hand hand, float pitch, float equipProgress
|
||||
, float swingProgress, ItemStack stack )
|
||||
public void renderItemFirstPerson(
|
||||
MatrixStack transform, VertexConsumerProvider render, int lightTexture, Hand hand, float pitch, float equipProgress,
|
||||
float swingProgress, ItemStack stack
|
||||
)
|
||||
{
|
||||
PlayerEntity player = MinecraftClient.getInstance().player;
|
||||
|
||||
transform.push();
|
||||
if( hand == Hand.MAIN_HAND && player.getOffHandStack()
|
||||
.isEmpty() )
|
||||
if( hand == Hand.MAIN_HAND && player.getOffHandStack().isEmpty() )
|
||||
{
|
||||
this.renderItemFirstPersonCenter( transform, render, lightTexture, pitch, equipProgress, swingProgress, stack );
|
||||
}
|
||||
@ -39,8 +40,7 @@ public abstract class ItemMapLikeRenderer
|
||||
this.renderItemFirstPersonSide( transform,
|
||||
render,
|
||||
lightTexture,
|
||||
hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm()
|
||||
.getOpposite(),
|
||||
hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite(),
|
||||
equipProgress,
|
||||
swingProgress,
|
||||
stack );
|
||||
|
@ -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
|
||||
, 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() )
|
||||
|
@ -99,21 +99,11 @@ public class TileEntityTurtleRenderer extends BlockEntityRenderer<TileTurtle>
|
||||
float f2 = (float) (tint & 255) / 255.0F;
|
||||
buffer.quad( matrix,
|
||||
bakedquad,
|
||||
new float[] {
|
||||
1.0F,
|
||||
1.0F,
|
||||
1.0F,
|
||||
1.0F
|
||||
},
|
||||
new float[] { 1.0F, 1.0F, 1.0F, 1.0F },
|
||||
f,
|
||||
f1,
|
||||
f2,
|
||||
new int[] {
|
||||
lightmapCoord,
|
||||
lightmapCoord,
|
||||
lightmapCoord,
|
||||
lightmapCoord
|
||||
},
|
||||
new int[] { lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord },
|
||||
overlayLight,
|
||||
true );
|
||||
}
|
||||
|
@ -67,7 +67,10 @@ public final class TurtleModelLoader
|
||||
{
|
||||
private final Identifier family;
|
||||
|
||||
private TurtleModel( Identifier family ) {this.family = family;}
|
||||
private TurtleModel( Identifier family )
|
||||
{
|
||||
this.family = family;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<SpriteIdentifier> getTextureDependencies( Function<Identifier, UnbakedModel> modelGetter,
|
||||
|
@ -11,7 +11,10 @@ import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.primitives.Primitives;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
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.MethodVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
|
@ -16,6 +16,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* Captures block drops.
|
||||
*
|
||||
* @see Block#dropStack(World, BlockPos, ItemStack)
|
||||
*/
|
||||
@Mixin( Block.class )
|
||||
|
@ -15,6 +15,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
/**
|
||||
* Captures entities.
|
||||
*
|
||||
* @see Entity#dropStack(ItemStack, float)
|
||||
*/
|
||||
@Mixin( Entity.class )
|
||||
|
@ -45,9 +45,11 @@ public class MixinHeldItemRenderer
|
||||
"Lnet/minecraft/client/render/VertexConsumerProvider;I)V",
|
||||
at = @At( "HEAD" ),
|
||||
cancellable = true )
|
||||
public void renderFirstPersonItem_Injected( AbstractClientPlayerEntity player, float var2, float pitch, Hand hand, float swingProgress,
|
||||
ItemStack stack, float equipProgress, MatrixStack matrixStack, VertexConsumerProvider provider, int light,
|
||||
CallbackInfo callback )
|
||||
public void renderFirstPersonItem(
|
||||
AbstractClientPlayerEntity player, float var2, float pitch, Hand hand, float swingProgress,
|
||||
ItemStack stack, float equipProgress, MatrixStack matrixStack, VertexConsumerProvider provider, int light,
|
||||
CallbackInfo callback
|
||||
)
|
||||
{
|
||||
if( stack.getItem() instanceof ItemPrintout )
|
||||
{
|
||||
|
@ -24,8 +24,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
public class MixinItemFrameEntityRenderer
|
||||
{
|
||||
@Inject( method = "render", at = @At( "HEAD" ), cancellable = true )
|
||||
private void renderItem_Injected( ItemFrameEntity itemFrameEntity, float f, float g, MatrixStack matrixStack,
|
||||
VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo info )
|
||||
private void renderItem(
|
||||
ItemFrameEntity itemFrameEntity, float f, float g, MatrixStack matrixStack,
|
||||
VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo info
|
||||
)
|
||||
{
|
||||
ItemStack stack = itemFrameEntity.getHeldItemStack();
|
||||
if( stack.getItem() instanceof ItemPrintout )
|
||||
|
@ -14,6 +14,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
/**
|
||||
* Captures item stacks spawned into the world.
|
||||
*
|
||||
* @see ServerWorld#spawnEntity(Entity)
|
||||
*/
|
||||
@Mixin( ServerWorld.class )
|
||||
|
@ -13,5 +13,8 @@ import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
public interface WorldSavePathAccess
|
||||
{
|
||||
@Invoker( "<init>" )
|
||||
static WorldSavePath createWorldSavePath( String relativePath ) { throw new UnsupportedOperationException(); }
|
||||
static WorldSavePath createWorldSavePath( String relativePath )
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
@ -70,10 +70,7 @@ public class CommandAPI implements ILuaAPI
|
||||
.getServer();
|
||||
if( server == null || !server.areCommandBlocksEnabled() )
|
||||
{
|
||||
return new Object[] {
|
||||
false,
|
||||
createOutput( "Command blocks disabled by server" )
|
||||
};
|
||||
return new Object[] { false, createOutput( "Command blocks disabled by server" ) };
|
||||
}
|
||||
|
||||
CommandManager commandManager = server.getCommandManager();
|
||||
@ -82,11 +79,7 @@ public class CommandAPI implements ILuaAPI
|
||||
{
|
||||
receiver.clearOutput();
|
||||
int result = commandManager.execute( this.computer.getSource(), command );
|
||||
return new Object[] {
|
||||
result > 0,
|
||||
receiver.copyOutput(),
|
||||
result
|
||||
};
|
||||
return new Object[] { result > 0, receiver.copyOutput(), result };
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
@ -94,10 +87,7 @@ public class CommandAPI implements ILuaAPI
|
||||
{
|
||||
ComputerCraft.log.error( "Error running command.", t );
|
||||
}
|
||||
return new Object[] {
|
||||
false,
|
||||
createOutput( "Java Exception Thrown: " + t )
|
||||
};
|
||||
return new Object[] { 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.
|
||||
BlockPos pos = this.computer.getPos();
|
||||
return new Object[] {
|
||||
pos.getX(),
|
||||
pos.getY(),
|
||||
pos.getZ()
|
||||
};
|
||||
return new Object[] { pos.getX(), pos.getY(), pos.getZ() };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,14 +238,11 @@ public class CommandAPI implements ILuaAPI
|
||||
Block block = state.getBlock();
|
||||
|
||||
Map<Object, Object> table = new HashMap<>();
|
||||
table.put( "name",
|
||||
Registry.BLOCK.getId( block )
|
||||
.toString() );
|
||||
table.put( "name", Registry.BLOCK.getId( block ).toString() );
|
||||
table.put( "world", world.getRegistryKey() );
|
||||
|
||||
Map<Object, Object> stateTable = new HashMap<>();
|
||||
for( ImmutableMap.Entry<Property<?>, Comparable<?>> entry : state.getEntries()
|
||||
.entrySet() )
|
||||
for( ImmutableMap.Entry<Property<?>, Comparable<?>> entry : state.getEntries().entrySet() )
|
||||
{
|
||||
Property<?> property = entry.getKey();
|
||||
stateTable.put( property.getName(), getPropertyValue( property, entry.getValue() ) );
|
||||
|
@ -3,7 +3,6 @@
|
||||
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
|
||||
package dan200.computercraft.shared.computer.core;
|
||||
|
||||
/**
|
||||
@ -14,59 +13,35 @@ package dan200.computercraft.shared.computer.core;
|
||||
*/
|
||||
public interface InputHandler
|
||||
{
|
||||
void queueEvent( String event, Object[] arguments );
|
||||
|
||||
default void keyDown( int key, boolean repeat )
|
||||
{
|
||||
this.queueEvent( "key",
|
||||
new Object[] {
|
||||
key,
|
||||
repeat
|
||||
} );
|
||||
queueEvent( "key", new Object[] { key, repeat } );
|
||||
}
|
||||
|
||||
void queueEvent( String event, Object[] arguments );
|
||||
|
||||
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 )
|
||||
{
|
||||
this.queueEvent( "mouse_click",
|
||||
new Object[] {
|
||||
button,
|
||||
x,
|
||||
y
|
||||
} );
|
||||
queueEvent( "mouse_click", new Object[] { button, x, y } );
|
||||
}
|
||||
|
||||
default void mouseUp( int button, int x, int y )
|
||||
{
|
||||
this.queueEvent( "mouse_up",
|
||||
new Object[] {
|
||||
button,
|
||||
x,
|
||||
y
|
||||
} );
|
||||
queueEvent( "mouse_up", new Object[] { button, x, y } );
|
||||
}
|
||||
|
||||
default void mouseDrag( int button, int x, int y )
|
||||
{
|
||||
this.queueEvent( "mouse_drag",
|
||||
new Object[] {
|
||||
button,
|
||||
x,
|
||||
y
|
||||
} );
|
||||
queueEvent( "mouse_drag", new Object[] { button, x, y } );
|
||||
}
|
||||
|
||||
default void mouseScroll( int direction, int x, int y )
|
||||
{
|
||||
this.queueEvent( "mouse_scroll",
|
||||
new Object[] {
|
||||
direction,
|
||||
x,
|
||||
y
|
||||
} );
|
||||
queueEvent( "mouse_scroll", new Object[] { direction, x, y } );
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ public final class NetworkHandler
|
||||
/**
|
||||
* /** 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 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.
|
||||
*
|
||||
* @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 decoder The factory for this type of packet.
|
||||
*/
|
||||
|
@ -95,9 +95,6 @@ public class CommandBlockPeripheral implements IPeripheral
|
||||
.execute( this.commandBlock.getWorld() );
|
||||
int result = this.commandBlock.getCommandExecutor()
|
||||
.getSuccessCount();
|
||||
return result > 0 ? new Object[] { true } : new Object[] {
|
||||
false,
|
||||
"Command failed"
|
||||
};
|
||||
return result > 0 ? new Object[] { true } : new Object[] { false, "Command failed" };
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,9 @@ public class BlockDiskDrive extends BlockGeneric
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBreak( @Nonnull World world, @Nonnull PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable BlockEntity te
|
||||
, @Nonnull ItemStack stack )
|
||||
public void afterBreak(
|
||||
@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() )
|
||||
{
|
||||
|
@ -654,9 +654,7 @@ public class TileMonitor extends TileGeneric implements IPeripheralTile
|
||||
@SuppressWarnings( "StatementWithEmptyBody" )
|
||||
void expand()
|
||||
{
|
||||
while( this.mergeLeft() || this.mergeRight() || this.mergeUp() || this.mergeDown() )
|
||||
{
|
||||
}
|
||||
while( this.mergeLeft() || this.mergeRight() || this.mergeUp() || this.mergeDown() ) ;
|
||||
}
|
||||
|
||||
void contractNeighbours()
|
||||
|
@ -53,8 +53,7 @@ public class BlockPrinter extends BlockGeneric
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBreak( @Nonnull World world, @Nonnull PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable BlockEntity te
|
||||
, @Nonnull ItemStack stack )
|
||||
public void afterBreak( @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() )
|
||||
{
|
||||
|
@ -97,10 +97,7 @@ public class PrinterPeripheral implements IPeripheral
|
||||
Terminal page = this.getCurrentPage();
|
||||
int x = page.getCursorX();
|
||||
int y = page.getCursorY();
|
||||
return new Object[] {
|
||||
x + 1,
|
||||
y + 1
|
||||
};
|
||||
return new Object[] { x + 1, y + 1 };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,10 +128,7 @@ public class PrinterPeripheral implements IPeripheral
|
||||
Terminal page = this.getCurrentPage();
|
||||
int width = page.getWidth();
|
||||
int height = page.getHeight();
|
||||
return new Object[] {
|
||||
width,
|
||||
height
|
||||
};
|
||||
return new Object[] { width, height };
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +52,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12
|
||||
12,
|
||||
};
|
||||
private static final int[] TOP_SLOTS = new int[] {
|
||||
1,
|
||||
@ -60,7 +60,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6
|
||||
6,
|
||||
};
|
||||
private static final int[] SIDE_SLOTS = new int[] { 0 };
|
||||
private final DefaultedList<ItemStack> inventory = DefaultedList.ofSize( SLOTS, ItemStack.EMPTY );
|
||||
|
@ -65,10 +65,7 @@ public class PocketAPI implements ILuaAPI
|
||||
Entity entity = this.computer.getEntity();
|
||||
if( !(entity instanceof PlayerEntity) )
|
||||
{
|
||||
return new Object[] {
|
||||
false,
|
||||
"Cannot find player"
|
||||
};
|
||||
return new Object[] { false, "Cannot find player" };
|
||||
}
|
||||
PlayerEntity player = (PlayerEntity) entity;
|
||||
PlayerInventory inventory = player.inventory;
|
||||
@ -83,10 +80,7 @@ public class PocketAPI implements ILuaAPI
|
||||
}
|
||||
if( newUpgrade == null )
|
||||
{
|
||||
return new Object[] {
|
||||
false,
|
||||
"Cannot find a valid upgrade"
|
||||
};
|
||||
return new Object[] { false, "Cannot find a valid upgrade" };
|
||||
}
|
||||
|
||||
// Remove the current upgrade
|
||||
@ -146,10 +140,7 @@ public class PocketAPI implements ILuaAPI
|
||||
Entity entity = this.computer.getEntity();
|
||||
if( !(entity instanceof PlayerEntity) )
|
||||
{
|
||||
return new Object[] {
|
||||
false,
|
||||
"Cannot find player"
|
||||
};
|
||||
return new Object[] { false, "Cannot find player" };
|
||||
}
|
||||
PlayerEntity player = (PlayerEntity) entity;
|
||||
PlayerInventory inventory = player.inventory;
|
||||
@ -157,10 +148,7 @@ public class PocketAPI implements ILuaAPI
|
||||
|
||||
if( previousUpgrade == null )
|
||||
{
|
||||
return new Object[] {
|
||||
false,
|
||||
"Nothing to unequip"
|
||||
};
|
||||
return new Object[] { false, "Nothing to unequip" };
|
||||
}
|
||||
|
||||
this.computer.setUpgrade( null );
|
||||
|
@ -523,8 +523,8 @@ public class TurtleAPI implements ILuaAPI
|
||||
* Get the maximum amount of fuel this turtle currently holds.
|
||||
*
|
||||
* @return The fuel level, or "unlimited".
|
||||
* @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 [1] number The current amount of fuel a turtle this turtle has.
|
||||
* @cc.treturn [2] "unlimited" If turtles do not consume fuel when moving.
|
||||
* @see #getFuelLimit()
|
||||
* @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.
|
||||
* @return If this turtle could be refuelled.
|
||||
* @throws LuaException If the refuel count is out of range.
|
||||
* @cc.treturn[1] true If the turtle was refuelled.
|
||||
* @cc.treturn[2] false If the turtle was not refuelled.
|
||||
* @cc.treturn[2] string The reason the turtle was not refuelled (
|
||||
* @cc.treturn [1] true If the turtle was refuelled.
|
||||
* @cc.treturn [2] false If 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.
|
||||
* <pre>{@code
|
||||
* 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.
|
||||
*
|
||||
* @return The limit, or "unlimited".
|
||||
* @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 [1] number The maximum amount of fuel a turtle can hold.
|
||||
* @cc.treturn [2] "unlimited" If turtles do not consume fuel when moving.
|
||||
* @see #getFuelLevel()
|
||||
* @see #refuel(Optional)
|
||||
*/
|
||||
@ -650,9 +650,9 @@ public class TurtleAPI implements ILuaAPI
|
||||
* upgrade is removed, but no new one is equipped.
|
||||
*
|
||||
* @return Whether an item was equiped or not.
|
||||
* @cc.treturn[1] true If the item was equipped.
|
||||
* @cc.treturn[2] false If we could not equip the item.
|
||||
* @cc.treturn[2] string The reason equipping this item failed.
|
||||
* @cc.treturn [1] true If the item was equipped.
|
||||
* @cc.treturn [2] false If we could not equip the item.
|
||||
* @cc.treturn [2] string The reason equipping this item failed.
|
||||
* @see #equipRight()
|
||||
*/
|
||||
@LuaFunction
|
||||
@ -669,9 +669,9 @@ public class TurtleAPI implements ILuaAPI
|
||||
* upgrade is removed, but no new one is equipped.
|
||||
*
|
||||
* @return Whether an item was equiped or not.
|
||||
* @cc.treturn[1] true If the item was equipped.
|
||||
* @cc.treturn[2] false If we could not equip the item.
|
||||
* @cc.treturn[2] string The reason equipping this item failed.
|
||||
* @cc.treturn [1] true If the item was equipped.
|
||||
* @cc.treturn [2] false If we could not equip the item.
|
||||
* @cc.treturn [2] string The reason equipping this item failed.
|
||||
* @see #equipRight()
|
||||
*/
|
||||
@LuaFunction
|
||||
@ -776,10 +776,7 @@ public class TurtleAPI implements ILuaAPI
|
||||
TurtleActionEvent event = new TurtleInspectItemEvent( this.turtle, stack, table, detailed );
|
||||
if( TurtleEvent.post( event ) )
|
||||
{
|
||||
return new Object[] {
|
||||
false,
|
||||
event.getFailureMessage()
|
||||
};
|
||||
return new Object[] { false, event.getFailureMessage() };
|
||||
}
|
||||
|
||||
return new Object[] { table };
|
||||
|
@ -24,8 +24,7 @@ public final class TurtleRecipe extends ComputerFamilyRecipe
|
||||
new dan200.computercraft.shared.computer.recipe.ComputerFamilyRecipe.Serializer<TurtleRecipe>()
|
||||
{
|
||||
@Override
|
||||
protected TurtleRecipe create( Identifier identifier, String group, int width, int height, DefaultedList<Ingredient> ingredients, ItemStack result
|
||||
, ComputerFamily family )
|
||||
protected TurtleRecipe create( Identifier identifier, String group, int width, int height, DefaultedList<Ingredient> ingredients, ItemStack result, ComputerFamily family )
|
||||
{
|
||||
return new TurtleRecipe( identifier, group, width, height, ingredients, result, family );
|
||||
}
|
||||
|
@ -144,10 +144,7 @@ public final class TurtleUpgradeRecipe extends SpecialCraftingRecipe
|
||||
};
|
||||
|
||||
// Get the upgrades for the new items
|
||||
ItemStack[] items = new ItemStack[] {
|
||||
rightItem,
|
||||
leftItem
|
||||
};
|
||||
ItemStack[] items = new ItemStack[] { rightItem, leftItem };
|
||||
for( int i = 0; i < 2; i++ )
|
||||
{
|
||||
if( !items[i].isEmpty() )
|
||||
|
@ -31,7 +31,8 @@ public class CommentedConfigSpec extends ConfigSpec
|
||||
|
||||
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 )
|
||||
|
@ -30,7 +30,7 @@ import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Config
|
||||
public final class Config
|
||||
{
|
||||
private static final int MODEM_MAX_RANGE = 100000;
|
||||
|
||||
|
@ -31,7 +31,9 @@ public final class IDAssigner
|
||||
private static final WorldSavePath FOLDER = WorldSavePathAccess.createWorldSavePath( ComputerCraft.MOD_ID );
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting()
|
||||
.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 WeakReference<MinecraftServer> server;
|
||||
private static Path idFile;
|
||||
|
Loading…
x
Reference in New Issue
Block a user