mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-12 10:20:28 +00:00
Merge pull request #464 from josephcsible/ComputerCraft/unnecessary
Remove unnecessary code
This commit is contained in:
commit
11d8253d9c
@ -141,10 +141,10 @@ public class FixedWidthFontRenderer
|
||||
}
|
||||
|
||||
// Draw char
|
||||
int index = (int)s.charAt( i );
|
||||
int index = s.charAt( i );
|
||||
if( index < 0 || index > 255 )
|
||||
{
|
||||
index = (int)'?';
|
||||
index = '?';
|
||||
}
|
||||
drawChar( renderer, x + i * FONT_WIDTH, y, index, colour, p, greyScale );
|
||||
}
|
||||
|
@ -175,10 +175,10 @@ public abstract class Widget extends Gui
|
||||
{
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
tessellator.getBuffer().begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX );
|
||||
tessellator.getBuffer().pos( (double) ( x + 0 ), (double) ( y + h ), (double) this.zLevel ).tex( 0.0, 1.0 ).endVertex();
|
||||
tessellator.getBuffer().pos( (double) ( x + w ), (double) ( y + h ), (double) this.zLevel ).tex( 1.0, 1.0 ).endVertex();
|
||||
tessellator.getBuffer().pos( (double) ( x + w ), (double) ( y + 0 ), (double) this.zLevel ).tex( 1.0, 0.0 ).endVertex();
|
||||
tessellator.getBuffer().pos( (double) ( x + 0 ), (double) ( y + 0 ), (double) this.zLevel ).tex( 0.0, 0.0 ).endVertex();
|
||||
tessellator.getBuffer().pos( x + 0, y + h, this.zLevel ).tex( 0.0, 1.0 ).endVertex();
|
||||
tessellator.getBuffer().pos( x + w, y + h, this.zLevel ).tex( 1.0, 1.0 ).endVertex();
|
||||
tessellator.getBuffer().pos( x + w, y + 0, this.zLevel ).tex( 1.0, 0.0 ).endVertex();
|
||||
tessellator.getBuffer().pos( x + 0, y + 0, this.zLevel ).tex( 0.0, 0.0 ).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
@ -82,11 +82,11 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
|
||||
GlStateManager.rotate( pitch, 1.0f, 0.0f, 0.0f );
|
||||
GlStateManager.translate(
|
||||
-0.5 + TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN,
|
||||
((double)origin.getHeight() - 0.5) - (TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN),
|
||||
(origin.getHeight() - 0.5) - (TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN),
|
||||
0.5
|
||||
);
|
||||
double xSize = (double)origin.getWidth() - 2.0 * ( TileMonitor.RENDER_MARGIN + TileMonitor.RENDER_BORDER );
|
||||
double ySize = (double)origin.getHeight() - 2.0 * ( TileMonitor.RENDER_MARGIN + TileMonitor.RENDER_BORDER );
|
||||
double xSize = origin.getWidth() - 2.0 * ( TileMonitor.RENDER_MARGIN + TileMonitor.RENDER_BORDER );
|
||||
double ySize = origin.getHeight() - 2.0 * ( TileMonitor.RENDER_MARGIN + TileMonitor.RENDER_BORDER );
|
||||
|
||||
// Get renderers
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@ -126,8 +126,8 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
|
||||
GlStateManager.pushMatrix();
|
||||
try
|
||||
{
|
||||
double xScale = xSize / (double) ( width * FixedWidthFontRenderer.FONT_WIDTH );
|
||||
double yScale = ySize / (double) ( height * FixedWidthFontRenderer.FONT_HEIGHT );
|
||||
double xScale = xSize / ( width * FixedWidthFontRenderer.FONT_WIDTH );
|
||||
double yScale = ySize / ( height * FixedWidthFontRenderer.FONT_HEIGHT );
|
||||
GlStateManager.scale( xScale, -yScale, 1.0 );
|
||||
|
||||
// Draw background
|
||||
@ -140,7 +140,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
|
||||
{
|
||||
double marginXSize = TileMonitor.RENDER_MARGIN / xScale;
|
||||
double marginYSize = TileMonitor.RENDER_MARGIN / yScale;
|
||||
double marginSquash = marginYSize / (double) FixedWidthFontRenderer.FONT_HEIGHT;
|
||||
double marginSquash = marginYSize / FixedWidthFontRenderer.FONT_HEIGHT;
|
||||
|
||||
// Top and bottom margins
|
||||
GlStateManager.pushMatrix();
|
||||
|
@ -310,10 +310,10 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder renderer = tessellator.getBuffer();
|
||||
renderer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR );
|
||||
renderer.pos( (double) ( -xOffset - 1 ), (double) ( -1 + yOffset ), 0.0D ).color( 0.0F, 0.0F, 0.0F, 0.25F ).endVertex();
|
||||
renderer.pos( (double) ( -xOffset - 1 ), (double) ( 8 + yOffset ), 0.0D ).color( 0.0F, 0.0F, 0.0F, 0.25F ).endVertex();
|
||||
renderer.pos( (double) ( xOffset + 1 ), (double) ( 8 + yOffset ), 0.0D ).color( 0.0F, 0.0F, 0.0F, 0.25F ).endVertex();
|
||||
renderer.pos( (double) ( xOffset + 1 ), (double) ( -1 + yOffset ), 0.0D ).color( 0.0F, 0.0F, 0.0F, 0.25F ).endVertex();
|
||||
renderer.pos( -xOffset - 1, -1 + yOffset, 0.0D ).color( 0.0F, 0.0F, 0.0F, 0.25F ).endVertex();
|
||||
renderer.pos( -xOffset - 1, 8 + yOffset, 0.0D ).color( 0.0F, 0.0F, 0.0F, 0.25F ).endVertex();
|
||||
renderer.pos( xOffset + 1, 8 + yOffset, 0.0D ).color( 0.0F, 0.0F, 0.0F, 0.25F ).endVertex();
|
||||
renderer.pos( xOffset + 1, -1 + yOffset, 0.0D ).color( 0.0F, 0.0F, 0.0F, 0.25F ).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
finally
|
||||
|
@ -45,8 +45,8 @@ public class AddressPredicate
|
||||
|
||||
public AddressPredicate( String... filters )
|
||||
{
|
||||
List<Pattern> wildcards = this.wildcards = new ArrayList<Pattern>();
|
||||
List<HostRange> ranges = this.ranges = new ArrayList<HostRange>();
|
||||
List<Pattern> wildcards = this.wildcards = new ArrayList<>();
|
||||
List<HostRange> ranges = this.ranges = new ArrayList<>();
|
||||
|
||||
for( String filter : filters )
|
||||
{
|
||||
|
@ -52,8 +52,8 @@ public class OSAPI implements ILuaAPI
|
||||
@Override
|
||||
public int compareTo( @Nonnull Alarm o )
|
||||
{
|
||||
double t = (double)m_day * 24.0 + m_time;
|
||||
double ot = (double)m_day * 24.0 + m_time;
|
||||
double t = m_day * 24.0 + m_time;
|
||||
double ot = m_day * 24.0 + m_time;
|
||||
if( t < ot ) {
|
||||
return -1;
|
||||
} else if( t > ot ) {
|
||||
@ -135,13 +135,13 @@ public class OSAPI implements ILuaAPI
|
||||
|
||||
if( time > previousTime || day > previousDay )
|
||||
{
|
||||
double now = (double)m_day * 24.0 + m_time;
|
||||
double now = m_day * 24.0 + m_time;
|
||||
Iterator<Map.Entry<Integer, Alarm>> it = m_alarms.entrySet().iterator();
|
||||
while( it.hasNext() )
|
||||
{
|
||||
Map.Entry<Integer, Alarm> entry = it.next();
|
||||
Alarm alarm = entry.getValue();
|
||||
double t = (double)alarm.m_day * 24.0 + alarm.m_time;
|
||||
double t = alarm.m_day * 24.0 + alarm.m_time;
|
||||
if( now >= t )
|
||||
{
|
||||
queueLuaEvent( "alarm", new Object[]{ entry.getKey() } );
|
||||
@ -196,8 +196,8 @@ public class OSAPI implements ILuaAPI
|
||||
private float getTimeForCalendar(Calendar c)
|
||||
{
|
||||
float time = c.get(Calendar.HOUR_OF_DAY);
|
||||
time += (float)c.get(Calendar.MINUTE) / 60.0f;
|
||||
time += (float)c.get(Calendar.SECOND) / (60.0f * 60.0f);
|
||||
time += c.get(Calendar.MINUTE) / 60.0f;
|
||||
time += c.get(Calendar.SECOND) / (60.0f * 60.0f);
|
||||
return time;
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ public class OSAPI implements ILuaAPI
|
||||
// clock
|
||||
synchronized( m_timers )
|
||||
{
|
||||
return new Object[] { (double)m_clock * 0.05 };
|
||||
return new Object[] { m_clock * 0.05 };
|
||||
}
|
||||
}
|
||||
case 11:
|
||||
|
@ -193,7 +193,7 @@ public class HTTPRequest implements HTTPTask.IHTTPTask
|
||||
m_encoding = connection.getContentEncoding();
|
||||
|
||||
Joiner joiner = Joiner.on( ',' );
|
||||
Map<String, String> headers = m_responseHeaders = new HashMap<String, String>();
|
||||
Map<String, String> headers = m_responseHeaders = new HashMap<>();
|
||||
for( Map.Entry<String, List<String>> header : connection.getHeaderFields().entrySet() )
|
||||
{
|
||||
headers.put( header.getKey(), joiner.join( header.getValue() ) );
|
||||
|
@ -452,7 +452,7 @@ public class Computer
|
||||
private boolean initFileSystem()
|
||||
{
|
||||
// Create the file system
|
||||
int id = assignID();
|
||||
assignID();
|
||||
try
|
||||
{
|
||||
m_fileSystem = new FileSystem( "hdd", getRootMount() );
|
||||
|
@ -9,7 +9,6 @@ package dan200.computercraft.core.filesystem;
|
||||
import dan200.computercraft.api.filesystem.IMount;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
@ -22,31 +21,31 @@ public class EmptyMount implements IMount
|
||||
// IMount implementation
|
||||
|
||||
@Override
|
||||
public boolean exists( @Nonnull String path ) throws IOException
|
||||
public boolean exists( @Nonnull String path )
|
||||
{
|
||||
return path.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirectory( @Nonnull String path ) throws IOException
|
||||
public boolean isDirectory( @Nonnull String path )
|
||||
{
|
||||
return path.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void list( @Nonnull String path, @Nonnull List<String> contents ) throws IOException
|
||||
public void list( @Nonnull String path, @Nonnull List<String> contents )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize( @Nonnull String path ) throws IOException
|
||||
public long getSize( @Nonnull String path )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public InputStream openForRead( @Nonnull String path ) throws IOException
|
||||
public InputStream openForRead( @Nonnull String path )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class FileMount implements IWritableMount
|
||||
// IMount implementation
|
||||
|
||||
@Override
|
||||
public boolean exists( @Nonnull String path ) throws IOException
|
||||
public boolean exists( @Nonnull String path )
|
||||
{
|
||||
if( !created() )
|
||||
{
|
||||
@ -109,7 +109,7 @@ public class FileMount implements IWritableMount
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirectory( @Nonnull String path ) throws IOException
|
||||
public boolean isDirectory( @Nonnull String path )
|
||||
{
|
||||
if( !created() )
|
||||
{
|
||||
@ -339,7 +339,7 @@ public class FileMount implements IWritableMount
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRemainingSpace() throws IOException
|
||||
public long getRemainingSpace()
|
||||
{
|
||||
return Math.max( m_capacity - m_usedSpace, 0 );
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class FileSystem
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isReadOnly( String path ) throws FileSystemException
|
||||
public boolean isReadOnly( String path )
|
||||
{
|
||||
return (m_writableMount == null);
|
||||
}
|
||||
@ -347,7 +347,7 @@ public class FileSystem
|
||||
mount( new MountWrapper( label, location, mount ) );
|
||||
}
|
||||
|
||||
private synchronized void mount( MountWrapper wrapper ) throws FileSystemException
|
||||
private synchronized void mount( MountWrapper wrapper )
|
||||
{
|
||||
String location = wrapper.getLocation();
|
||||
if( m_mounts.containsKey( location ) )
|
||||
|
@ -176,14 +176,14 @@ public class JarMount implements IMount
|
||||
// IMount implementation
|
||||
|
||||
@Override
|
||||
public boolean exists( @Nonnull String path ) throws IOException
|
||||
public boolean exists( @Nonnull String path )
|
||||
{
|
||||
FileInZip file = m_root.getFile( path );
|
||||
return file != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirectory( @Nonnull String path ) throws IOException
|
||||
public boolean isDirectory( @Nonnull String path )
|
||||
{
|
||||
FileInZip file = m_root.getFile( path );
|
||||
if( file != null )
|
||||
|
@ -159,7 +159,7 @@ public abstract class TileGeneric extends TileEntity
|
||||
double range = getInteractRange( player );
|
||||
BlockPos pos = getPos();
|
||||
return player.getEntityWorld() == getWorld() &&
|
||||
player.getDistanceSq( (double)pos.getX() + 0.5, (double)pos.getY() + 0.5, (double)pos.getZ() + 0.5 ) <= ( range * range );
|
||||
player.getDistanceSq( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 ) <= ( range * range );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
package dan200.computercraft.shared.computer.blocks;
|
||||
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
@ -50,7 +49,7 @@ public class ComputerPeripheral
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments ) throws LuaException
|
||||
public Object[] callMethod( @Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull Object[] arguments )
|
||||
{
|
||||
switch( method )
|
||||
{
|
||||
|
@ -19,7 +19,6 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class TileComputer extends TileComputerBase
|
||||
{
|
||||
|
@ -328,7 +328,7 @@ public class ServerComputer extends ServerTerminal
|
||||
@Override
|
||||
public double getTimeOfDay()
|
||||
{
|
||||
return (double)((m_world.getWorldTime() + 6000) % 24000) / 1000.0;
|
||||
return (m_world.getWorldTime() + 6000) % 24000 / 1000.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,7 +7,6 @@
|
||||
package dan200.computercraft.shared.peripheral.common;
|
||||
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.shared.common.IDirectionalTile;
|
||||
import dan200.computercraft.shared.common.TileGeneric;
|
||||
import dan200.computercraft.shared.peripheral.PeripheralType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -20,7 +19,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class TilePeripheralBase extends TileGeneric
|
||||
implements IPeripheralTile, IDirectionalTile, ITickable
|
||||
implements IPeripheralTile, ITickable
|
||||
{
|
||||
// Statics
|
||||
|
||||
|
@ -24,7 +24,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
@ -44,7 +43,7 @@ import java.util.Set;
|
||||
import static net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
|
||||
|
||||
public class TileDiskDrive extends TilePeripheralBase
|
||||
implements IInventory, ITickable
|
||||
implements IInventory
|
||||
{
|
||||
private static class MountInfo
|
||||
{
|
||||
@ -610,13 +609,13 @@ public class TileDiskDrive extends TilePeripheralBase
|
||||
}
|
||||
|
||||
BlockPos pos = getPos();
|
||||
double x = (double)pos.getX() + 0.5 + ((double)xOff * 0.5);
|
||||
double y = (double)pos.getY() + 0.75;
|
||||
double z = (double)pos.getZ() + 0.5 + ((double)zOff * 0.5);
|
||||
double x = pos.getX() + 0.5 + (xOff * 0.5);
|
||||
double y = pos.getY() + 0.75;
|
||||
double z = pos.getZ() + 0.5 + (zOff * 0.5);
|
||||
EntityItem entityitem = new EntityItem( getWorld(), x, y, z, disks );
|
||||
entityitem.motionX = (double)xOff * 0.15;
|
||||
entityitem.motionX = xOff * 0.15;
|
||||
entityitem.motionY = 0.0;
|
||||
entityitem.motionZ = (double)zOff * 0.15;
|
||||
entityitem.motionZ = zOff * 0.15;
|
||||
|
||||
getWorld().spawnEntity(entityitem);
|
||||
if( !destroyed )
|
||||
|
@ -41,7 +41,7 @@ public class TileAdvancedModem extends TileModemBase
|
||||
public Vec3d getPosition()
|
||||
{
|
||||
BlockPos pos = m_entity.getPos().offset( m_entity.getDirection() );
|
||||
return new Vec3d( (double)pos.getX(), (double)pos.getY(), (double)pos.getZ() );
|
||||
return new Vec3d( pos.getX(), pos.getY(), pos.getZ() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,7 +101,7 @@ public class TileCable extends TileModemBase
|
||||
{
|
||||
EnumFacing direction = m_entity.getDirection();
|
||||
BlockPos pos = m_entity.getPos().offset( direction );
|
||||
return new Vec3d( (double)pos.getX() + 0.5, (double)pos.getY() + 0.5, (double)pos.getZ() + 0.5 );
|
||||
return new Vec3d( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@ -1056,12 +1056,12 @@ public class TileCable extends TileModemBase
|
||||
Queue<SearchLoc> queue = new LinkedList<>();
|
||||
enqueue( queue, getWorld(), getPos(), 1 );
|
||||
|
||||
int visited = 0;
|
||||
//int visited = 0;
|
||||
while( queue.peek() != null )
|
||||
{
|
||||
SearchLoc loc = queue.remove();
|
||||
visitBlock( queue, loc, searchID, visitor );
|
||||
visited++;
|
||||
//visited++;
|
||||
}
|
||||
//System.out.println( "Visited "+visited+" common" );
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class TileWirelessModem extends TileModemBase
|
||||
public Vec3d getPosition()
|
||||
{
|
||||
BlockPos pos = m_entity.getPos().offset( m_entity.getDirection() );
|
||||
return new Vec3d( (double)pos.getX(), (double)pos.getY(), (double)pos.getZ() );
|
||||
return new Vec3d( pos.getX(), pos.getY(), pos.getZ() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +31,7 @@ public abstract class WirelessModemPeripheral extends ModemPeripheral
|
||||
{
|
||||
if( m_advanced )
|
||||
{
|
||||
return (double)Integer.MAX_VALUE;
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -39,12 +39,12 @@ public abstract class WirelessModemPeripheral extends ModemPeripheral
|
||||
if( world != null )
|
||||
{
|
||||
Vec3d position = getPosition();
|
||||
double minRange = (double) ComputerCraft.modem_range;
|
||||
double maxRange = (double) ComputerCraft.modem_highAltitudeRange;
|
||||
double minRange = ComputerCraft.modem_range;
|
||||
double maxRange = ComputerCraft.modem_highAltitudeRange;
|
||||
if( world.isRaining() && world.isThundering() )
|
||||
{
|
||||
minRange = (double) ComputerCraft.modem_rangeDuringStorm;
|
||||
maxRange = (double) ComputerCraft.modem_highAltitudeRangeDuringStorm;
|
||||
minRange = ComputerCraft.modem_rangeDuringStorm;
|
||||
maxRange = ComputerCraft.modem_highAltitudeRangeDuringStorm;
|
||||
}
|
||||
if( position.y > 96.0 && maxRange > minRange )
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ public class TileMonitor extends TilePeripheralBase
|
||||
|
||||
public double getTextScale()
|
||||
{
|
||||
return (double)m_textScale * 0.5;
|
||||
return m_textScale * 0.5;
|
||||
}
|
||||
|
||||
private void rebuildTerminal()
|
||||
@ -301,11 +301,11 @@ public class TileMonitor extends TilePeripheralBase
|
||||
|
||||
double textScale = getTextScale();
|
||||
int termWidth = (int)Math.max(
|
||||
Math.round( ((double)m_width - 2.0 * ( TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN )) / (textScale * 6.0 * TileMonitor.RENDER_PIXEL_SCALE) ),
|
||||
Math.round( (m_width - 2.0 * ( TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN )) / (textScale * 6.0 * TileMonitor.RENDER_PIXEL_SCALE) ),
|
||||
1.0
|
||||
);
|
||||
int termHeight = (int)Math.max(
|
||||
Math.round( ((double)m_height - 2.0 * ( TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN )) / (textScale * 9.0 * TileMonitor.RENDER_PIXEL_SCALE) ),
|
||||
Math.round( (m_height - 2.0 * ( TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN )) / (textScale * 9.0 * TileMonitor.RENDER_PIXEL_SCALE) ),
|
||||
1.0
|
||||
);
|
||||
((ServerTerminal)getLocalTerminal()).resize( termWidth, termHeight );
|
||||
@ -709,11 +709,11 @@ public class TileMonitor extends TilePeripheralBase
|
||||
return;
|
||||
}
|
||||
|
||||
double xCharWidth = ((double)m_width - ((RENDER_BORDER + RENDER_MARGIN) * 2.0)) / ((double)originTerminal.getWidth());
|
||||
double yCharHeight = ((double)m_height - ((RENDER_BORDER + RENDER_MARGIN) * 2.0)) / ((double)originTerminal.getHeight());
|
||||
double xCharWidth = (m_width - ((RENDER_BORDER + RENDER_MARGIN) * 2.0)) / (originTerminal.getWidth());
|
||||
double yCharHeight = (m_height - ((RENDER_BORDER + RENDER_MARGIN) * 2.0)) / (originTerminal.getHeight());
|
||||
|
||||
int xCharPos = (int)Math.min((double)originTerminal.getWidth(), Math.max(((pair.x - RENDER_BORDER - RENDER_MARGIN) / xCharWidth) + 1.0, 1.0));
|
||||
int yCharPos = (int)Math.min((double)originTerminal.getHeight(), Math.max(((pair.y - RENDER_BORDER - RENDER_MARGIN) / yCharHeight) + 1.0, 1.0));
|
||||
int xCharPos = (int)Math.min(originTerminal.getWidth(), Math.max(((pair.x - RENDER_BORDER - RENDER_MARGIN) / xCharWidth) + 1.0, 1.0));
|
||||
int yCharPos = (int)Math.min(originTerminal.getHeight(), Math.max(((pair.y - RENDER_BORDER - RENDER_MARGIN) / yCharHeight) + 1.0, 1.0));
|
||||
|
||||
for( int y=0; y<m_height; ++y )
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -42,7 +41,7 @@ import javax.annotation.Nullable;
|
||||
import static net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
|
||||
|
||||
public class TilePrinter extends TilePeripheralBase
|
||||
implements IInventory, ISidedInventory
|
||||
implements ISidedInventory
|
||||
{
|
||||
// Statics
|
||||
|
||||
@ -583,9 +582,9 @@ public class TilePrinter extends TilePeripheralBase
|
||||
|
||||
// Spawn the item in the world
|
||||
BlockPos pos = getPos();
|
||||
double x = (double)pos.getX() + 0.5;
|
||||
double y = (double)pos.getY() + 0.75;
|
||||
double z = (double)pos.getZ() + 0.5;
|
||||
double x = pos.getX() + 0.5;
|
||||
double y = pos.getY() + 0.75;
|
||||
double z = pos.getZ() + 0.5;
|
||||
EntityItem entityitem = new EntityItem( getWorld(), x, y, z, stack );
|
||||
entityitem.motionX = getWorld().rand.nextFloat() * 0.2 - 0.1;
|
||||
entityitem.motionY = getWorld().rand.nextFloat() * 0.2 - 0.1;
|
||||
|
@ -175,7 +175,7 @@ public class SpeakerPeripheral implements IPeripheral {
|
||||
{
|
||||
@Nullable
|
||||
@Override
|
||||
public Object[] execute() throws LuaException
|
||||
public Object[] execute()
|
||||
{
|
||||
world.playSound( null, pos, SoundEvent.REGISTRY.getObject( resource ), SoundCategory.RECORDS, Math.min( vol, 3f ), soundPitch );
|
||||
return null;
|
||||
|
@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -52,9 +52,9 @@ public enum Colour
|
||||
{
|
||||
m_hex = hex;
|
||||
m_rgb = new float[] {
|
||||
(float)((hex >> 16) & 0xFF) / 255.0f,
|
||||
(float)((hex >> 8 ) & 0xFF) / 255.0f,
|
||||
(float)((hex ) & 0xFF) / 255.0f,
|
||||
((hex >> 16) & 0xFF) / 255.0f,
|
||||
((hex >> 8 ) & 0xFF) / 255.0f,
|
||||
((hex ) & 0xFF) / 255.0f,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class ColourTracker
|
||||
int avgB = totalB / count;
|
||||
|
||||
float avgTotal = (float) total / (float) count;
|
||||
float avgMax = (float) Math.max( avgR, Math.max( avgG, avgB ) );
|
||||
float avgMax = Math.max( avgR, Math.max( avgG, avgB ) );
|
||||
avgR = (int) (avgR * avgTotal / avgMax);
|
||||
avgG = (int) (avgG * avgTotal / avgMax);
|
||||
avgB = (int) (avgB * avgTotal / avgMax);
|
||||
|
@ -161,9 +161,9 @@ public class WorldUtil
|
||||
double zDir;
|
||||
if( direction != null )
|
||||
{
|
||||
xDir = (double)direction.getFrontOffsetX();
|
||||
yDir = (double)direction.getFrontOffsetY();
|
||||
zDir = (double)direction.getFrontOffsetZ();
|
||||
xDir = direction.getFrontOffsetX();
|
||||
yDir = direction.getFrontOffsetY();
|
||||
zDir = direction.getFrontOffsetZ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user