mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-20 23:34:48 +00:00
remap
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
|
||||
package dan200.computercraft.shared.peripheral.monitor;
|
||||
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
public class XYPair
|
||||
{
|
||||
public final float x;
|
||||
public final float y;
|
||||
|
||||
public XYPair( float x, float y )
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public XYPair add( float x, float y )
|
||||
{
|
||||
return new XYPair( this.x + x, this.y + y );
|
||||
}
|
||||
|
||||
public static XYPair of( float xPos, float yPos, float zPos, Direction facing, Direction orientation )
|
||||
{
|
||||
switch( orientation )
|
||||
{
|
||||
case NORTH:
|
||||
switch( facing )
|
||||
{
|
||||
case NORTH:
|
||||
return new XYPair( 1 - xPos, 1 - yPos );
|
||||
case SOUTH:
|
||||
return new XYPair( xPos, 1 - yPos );
|
||||
case WEST:
|
||||
return new XYPair( zPos, 1 - yPos );
|
||||
case EAST:
|
||||
return new XYPair( 1 - zPos, 1 - yPos );
|
||||
}
|
||||
break;
|
||||
case DOWN:
|
||||
switch( facing )
|
||||
{
|
||||
case NORTH:
|
||||
return new XYPair( 1 - xPos, zPos );
|
||||
case SOUTH:
|
||||
return new XYPair( xPos, 1 - zPos );
|
||||
case WEST:
|
||||
return new XYPair( zPos, xPos );
|
||||
case EAST:
|
||||
return new XYPair( 1 - zPos, 1 - xPos );
|
||||
}
|
||||
break;
|
||||
case UP:
|
||||
switch( facing )
|
||||
{
|
||||
case NORTH:
|
||||
return new XYPair( 1 - xPos, 1 - zPos );
|
||||
case SOUTH:
|
||||
return new XYPair( xPos, zPos );
|
||||
case WEST:
|
||||
return new XYPair( zPos, 1 - xPos );
|
||||
case EAST:
|
||||
return new XYPair( 1 - zPos, xPos );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return new XYPair( xPos, zPos );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user