mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-21 07:44:49 +00:00
Remove unnecessary code
- Remove unnecessary casts - Use the diamond operator where possible - Remove "throws" declarations that aren't actually thrown - Remove unused local variables - Remove unused imports - Remove redundant superinterfaces
This commit is contained in:
@@ -48,7 +48,7 @@ import java.util.List;
|
||||
import static net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
|
||||
|
||||
public class TileTurtle extends TileComputerBase
|
||||
implements ITurtleTile, IInventory, ITickable
|
||||
implements ITurtleTile, IInventory
|
||||
{
|
||||
// Statics
|
||||
|
||||
|
||||
@@ -936,11 +936,11 @@ public class TurtleBrain implements ITurtleAccess
|
||||
}
|
||||
}
|
||||
|
||||
double distance = -1.0 + (double)getAnimationFraction( f );
|
||||
double distance = -1.0 + getAnimationFraction( f );
|
||||
return new Vec3d(
|
||||
distance * (double)dir.getFrontOffsetX(),
|
||||
distance * (double)dir.getFrontOffsetY(),
|
||||
distance * (double)dir.getFrontOffsetZ()
|
||||
distance * dir.getFrontOffsetX(),
|
||||
distance * dir.getFrontOffsetY(),
|
||||
distance * dir.getFrontOffsetZ()
|
||||
);
|
||||
}
|
||||
default:
|
||||
@@ -955,7 +955,7 @@ public class TurtleBrain implements ITurtleAccess
|
||||
if( (side == TurtleSide.Left && m_animation == TurtleAnimation.SwingLeftTool) ||
|
||||
(side == TurtleSide.Right && m_animation == TurtleAnimation.SwingRightTool) )
|
||||
{
|
||||
return 45.0f * (float)Math.sin( (double) getAnimationFraction( f ) * Math.PI );
|
||||
return 45.0f * (float)Math.sin( getAnimationFraction( f ) * Math.PI );
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
@@ -1126,39 +1126,39 @@ public class TurtleBrain implements ITurtleAccess
|
||||
float push = Math.max( pushFrac + 0.0125f, 0.0f );
|
||||
if (moveDir.getFrontOffsetX() < 0)
|
||||
{
|
||||
minX += (double)((float)moveDir.getFrontOffsetX() * push);
|
||||
minX += moveDir.getFrontOffsetX() * push;
|
||||
}
|
||||
else
|
||||
{
|
||||
maxX -= (double)((float)moveDir.getFrontOffsetX() * push);
|
||||
maxX -= moveDir.getFrontOffsetX() * push;
|
||||
}
|
||||
|
||||
if (moveDir.getFrontOffsetY() < 0)
|
||||
{
|
||||
minY += (double)((float)moveDir.getFrontOffsetY() * push);
|
||||
minY += moveDir.getFrontOffsetY() * push;
|
||||
}
|
||||
else
|
||||
{
|
||||
maxY -= (double)((float)moveDir.getFrontOffsetY() * push);
|
||||
maxY -= moveDir.getFrontOffsetY() * push;
|
||||
}
|
||||
|
||||
if (moveDir.getFrontOffsetZ() < 0)
|
||||
{
|
||||
minZ += (double)((float)moveDir.getFrontOffsetZ() * push);
|
||||
minZ += moveDir.getFrontOffsetZ() * push;
|
||||
}
|
||||
else
|
||||
{
|
||||
maxZ -= (double)((float)moveDir.getFrontOffsetZ() * push);
|
||||
maxZ -= moveDir.getFrontOffsetZ() * push;
|
||||
}
|
||||
|
||||
AxisAlignedBB aabb = new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
|
||||
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity( null, aabb );
|
||||
if( !list.isEmpty() )
|
||||
{
|
||||
double pushStep = 1.0f / (float) ANIM_DURATION;
|
||||
double pushStepX = (double) moveDir.getFrontOffsetX() * pushStep;
|
||||
double pushStepY = (double) moveDir.getFrontOffsetY() * pushStep;
|
||||
double pushStepZ = (double) moveDir.getFrontOffsetZ() * pushStep;
|
||||
double pushStep = 1.0f / ANIM_DURATION;
|
||||
double pushStepX = moveDir.getFrontOffsetX() * pushStep;
|
||||
double pushStepY = moveDir.getFrontOffsetY() * pushStep;
|
||||
double pushStepZ = moveDir.getFrontOffsetZ() * pushStep;
|
||||
for (Entity entity : list)
|
||||
{
|
||||
entity.move( MoverType.PISTON, pushStepX, pushStepY, pushStepZ );
|
||||
|
||||
@@ -85,9 +85,9 @@ public class TurtleMoveCommand implements ITurtleCommand
|
||||
if( entityBB != null )
|
||||
{
|
||||
AxisAlignedBB pushedBB = entityBB.offset(
|
||||
(double) direction.getFrontOffsetX(),
|
||||
(double) direction.getFrontOffsetY(),
|
||||
(double) direction.getFrontOffsetZ()
|
||||
direction.getFrontOffsetX(),
|
||||
direction.getFrontOffsetY(),
|
||||
direction.getFrontOffsetZ()
|
||||
);
|
||||
if( !oldWorld.getCollisionBoxes( null, pushedBB ).isEmpty() )
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ package dan200.computercraft.shared.turtle.items;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import dan200.computercraft.api.turtle.TurtleSide;
|
||||
import dan200.computercraft.shared.common.IColouredItem;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.util.ColourUtils;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -20,7 +19,7 @@ import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ItemTurtleNormal extends ItemTurtleBase implements IColouredItem
|
||||
public class ItemTurtleNormal extends ItemTurtleBase
|
||||
{
|
||||
public ItemTurtleNormal( Block block )
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ import javax.vecmath.Matrix4f;
|
||||
public class TurtleModem implements ITurtleUpgrade
|
||||
{
|
||||
private static class Peripheral extends WirelessModemPeripheral
|
||||
implements IPeripheral
|
||||
{
|
||||
private final ITurtleAccess m_turtle;
|
||||
|
||||
@@ -55,9 +54,9 @@ public class TurtleModem implements ITurtleUpgrade
|
||||
{
|
||||
BlockPos turtlePos = m_turtle.getPosition();
|
||||
return new Vec3d(
|
||||
(double)turtlePos.getX(),
|
||||
(double)turtlePos.getY(),
|
||||
(double)turtlePos.getZ()
|
||||
turtlePos.getX(),
|
||||
turtlePos.getY(),
|
||||
turtlePos.getZ()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user