1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-06 08:22:59 +00:00

Remove most raw types

This means we can remove even more casts and what not.
This commit is contained in:
SquidDev
2017-05-07 01:16:08 +01:00
parent 9af15d1e30
commit db9cd15fb3
38 changed files with 106 additions and 141 deletions

View File

@@ -26,8 +26,12 @@ import net.minecraft.entity.Entity;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.*;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
@@ -573,8 +577,7 @@ public class TurtleBrain implements ITurtleAccess
@Override
public float getVisualYaw( float f )
{
float forward = DirectionUtil.toYawAngle( getDirection() );
float yaw = forward;
float yaw = DirectionUtil.toYawAngle( getDirection() );
switch( m_animation )
{
case TurnLeft:
@@ -1133,19 +1136,16 @@ public class TurtleBrain implements ITurtleAccess
}
AxisAlignedBB aabb = new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
List list = world.getEntitiesWithinAABBExcludingEntity( null, aabb );
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;
for (Object aList : list)
for (Entity entity : list)
{
Entity entity = (Entity) aList;
entity.moveEntity(
pushStepX, pushStepY, pushStepZ
);
entity.moveEntity( pushStepX, pushStepY, pushStepZ );
}
}
}

View File

@@ -58,9 +58,8 @@ public class TurtleInspectCommand implements ITurtleCommand
table.put( "metadata", metadata );
Map<Object, Object> stateTable = new HashMap<Object, Object>();
for( Object o : state.getActualState( world, newPosition ).getProperties().entrySet() )
for( ImmutableMap.Entry<IProperty<?>, ?> entry : state.getActualState( world, newPosition ).getProperties().entrySet() )
{
ImmutableMap.Entry<IProperty, Object> entry = (ImmutableMap.Entry<IProperty, Object>)o;
String propertyName = entry.getKey().getName();
Object value = entry.getValue();
if( value instanceof String || value instanceof Number || value instanceof Boolean )

View File

@@ -72,10 +72,9 @@ public class TurtleMoveCommand implements ITurtleCommand
if( ComputerCraft.turtlesCanPush && m_direction != MoveDirection.Up && m_direction != MoveDirection.Down )
{
// Check there is space for all the pushable entities to be pushed
List list = oldWorld.getEntitiesWithinAABBExcludingEntity( null, aabb );
for( Object aList : list )
List<Entity> list = oldWorld.getEntitiesWithinAABBExcludingEntity( null, aabb );
for( Entity entity : list )
{
Entity entity = (Entity) aList;
if( !entity.isDead && entity.preventEntitySpawning )
{
AxisAlignedBB entityBB = entity.getEntityBoundingBox();

View File

@@ -208,8 +208,7 @@ public class TurtlePlaceCommand implements ITurtleCommand
final BlockPos position = turtle.getPosition();
Vec3d turtlePos = new Vec3d( turtlePlayer.posX, turtlePlayer.posY, turtlePlayer.posZ );
Vec3d rayDir = turtlePlayer.getLook( 1.0f );
Vec3d rayStart = turtlePos;
Pair<Entity, Vec3d> hit = WorldUtil.rayTraceEntities( world, rayStart, rayDir, 1.5 );
Pair<Entity, Vec3d> hit = WorldUtil.rayTraceEntities( world, turtlePos, rayDir, 1.5 );
if( hit == null )
{
return stack;

View File

@@ -90,14 +90,13 @@ public class TurtleSuckCommand implements ITurtleCommand
newPosition.getX(), newPosition.getY(), newPosition.getZ(),
newPosition.getX() + 1.0, newPosition.getY() + 1.0, newPosition.getZ() + 1.0
);
List list = world.getEntitiesWithinAABBExcludingEntity( null, aabb );
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity( null, aabb );
if( list.size() > 0 )
{
boolean foundItems = false;
boolean storedItems = false;
for( Object aList : list )
for( Entity entity : list )
{
Entity entity = (Entity) aList;
if( entity != null && entity instanceof EntityItem && !entity.isDead )
{
// Suck up the item

View File

@@ -43,7 +43,7 @@ public abstract class ItemTurtleBase extends ItemComputerBase implements ITurtle
public abstract ItemStack create( int id, String label, Colour colour, ITurtleUpgrade leftUpgrade, ITurtleUpgrade rightUpgrade, int fuelLevel, ResourceLocation overlay );
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
List<ItemStack> all = new ArrayList<ItemStack>();
ComputerCraft.addAllUpgradedTurtles( all );

View File

@@ -170,8 +170,7 @@ public class TurtleTool implements ITurtleUpgrade
// See if there is an entity present
Vec3d turtlePos = new Vec3d( turtlePlayer.posX, turtlePlayer.posY, turtlePlayer.posZ );
Vec3d rayDir = turtlePlayer.getLook( 1.0f );
Vec3d rayStart = turtlePos;
Pair<Entity, Vec3d> hit = WorldUtil.rayTraceEntities( world, rayStart, rayDir, 1.5 );
Pair<Entity, Vec3d> hit = WorldUtil.rayTraceEntities( world, turtlePos, rayDir, 1.5 );
if( hit != null )
{
// Load up the turtle's inventory