mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-09-17 06:41:22 +00:00
Reformat everything
It's been a long time comin' But tonight is the end of the war, my friend Tomorrow only one style will remain.
This commit is contained in:
@@ -31,12 +31,13 @@ public enum Colour
|
||||
{
|
||||
if( colour >= 0 && colour < 16 )
|
||||
{
|
||||
return Colour.VALUES[ colour ];
|
||||
return Colour.VALUES[colour];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Colour fromHex(int colour) {
|
||||
|
||||
public static Colour fromHex( int colour )
|
||||
{
|
||||
for( Colour entry : VALUES )
|
||||
{
|
||||
if( entry.getHex() == colour ) return entry;
|
||||
@@ -53,19 +54,19 @@ public enum Colour
|
||||
m_hex = hex;
|
||||
m_rgb = new float[] {
|
||||
((hex >> 16) & 0xFF) / 255.0f,
|
||||
((hex >> 8 ) & 0xFF) / 255.0f,
|
||||
((hex ) & 0xFF) / 255.0f,
|
||||
((hex >> 8) & 0xFF) / 255.0f,
|
||||
((hex) & 0xFF) / 255.0f,
|
||||
};
|
||||
}
|
||||
|
||||
public Colour getNext()
|
||||
{
|
||||
return Colour.VALUES[ (ordinal() + 1) % 16 ];
|
||||
return Colour.VALUES[(ordinal() + 1) % 16];
|
||||
}
|
||||
|
||||
public Colour getPrevious()
|
||||
{
|
||||
return Colour.VALUES[ (ordinal() + 15) % 16 ];
|
||||
return Colour.VALUES[(ordinal() + 15) % 16];
|
||||
}
|
||||
|
||||
public int getHex()
|
||||
|
||||
@@ -23,10 +23,10 @@ public final class ColourUtils
|
||||
{
|
||||
if( ids == null )
|
||||
{
|
||||
int ids[] = ColourUtils.ids = new int[ DYES.length ];
|
||||
int ids[] = ColourUtils.ids = new int[DYES.length];
|
||||
for( int i = 0; i < DYES.length; i++ )
|
||||
{
|
||||
ids[ i ] = OreDictionary.getOreID( DYES[ i ] );
|
||||
ids[i] = OreDictionary.getOreID( DYES[i] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class ColourUtils
|
||||
{
|
||||
if( tag.hasKey( "colourIndex", Constants.NBT.TAG_ANY_NUMERIC ) )
|
||||
{
|
||||
return Colour.VALUES[ tag.getInteger( "colourIndex" ) & 0xF ].getHex();
|
||||
return Colour.VALUES[tag.getInteger( "colourIndex" ) & 0xF].getHex();
|
||||
}
|
||||
else if( tag.hasKey( "colour", Constants.NBT.TAG_ANY_NUMERIC ) )
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ public class CreativeTabMain extends CreativeTabs
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly( Side.CLIENT )
|
||||
public ItemStack createIcon()
|
||||
{
|
||||
return new ItemStack( ComputerCraft.Blocks.computer );
|
||||
@@ -31,7 +31,7 @@ public class CreativeTabMain extends CreativeTabs
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly( Side.CLIENT )
|
||||
public String getTranslationKey()
|
||||
{
|
||||
return getTabLabel();
|
||||
|
||||
@@ -18,14 +18,14 @@ public class CreativeTabTreasure extends CreativeTabs
|
||||
{
|
||||
super( i, "Treasure Disks" );
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack createIcon()
|
||||
{
|
||||
return new ItemStack( ComputerCraft.Items.treasureDisk );
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTranslationKey()
|
||||
|
||||
@@ -88,12 +88,17 @@ public class DirectionUtil
|
||||
|
||||
public static EnumFacing fromEntityRot( EntityLivingBase player )
|
||||
{
|
||||
int rot = MathHelper.floor( ( player.rotationYaw / 90.0f ) + 0.5f ) & 0x3;
|
||||
switch( rot ) {
|
||||
case 0: return EnumFacing.NORTH;
|
||||
case 1: return EnumFacing.EAST;
|
||||
case 2: return EnumFacing.SOUTH;
|
||||
case 3: return EnumFacing.WEST;
|
||||
int rot = MathHelper.floor( (player.rotationYaw / 90.0f) + 0.5f ) & 0x3;
|
||||
switch( rot )
|
||||
{
|
||||
case 0:
|
||||
return EnumFacing.NORTH;
|
||||
case 1:
|
||||
return EnumFacing.EAST;
|
||||
case 2:
|
||||
return EnumFacing.SOUTH;
|
||||
case 3:
|
||||
return EnumFacing.WEST;
|
||||
}
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
@@ -102,11 +107,16 @@ public class DirectionUtil
|
||||
{
|
||||
switch( dir )
|
||||
{
|
||||
case NORTH: return 180.0f;
|
||||
case SOUTH: return 0.0f;
|
||||
case WEST: return 90.0f;
|
||||
case EAST: return 270.0f;
|
||||
default: return 0.0f;
|
||||
case NORTH:
|
||||
return 180.0f;
|
||||
case SOUTH:
|
||||
return 0.0f;
|
||||
case WEST:
|
||||
return 90.0f;
|
||||
case EAST:
|
||||
return 270.0f;
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,9 +124,12 @@ public class DirectionUtil
|
||||
{
|
||||
switch( dir )
|
||||
{
|
||||
case DOWN: return 90.0f;
|
||||
case UP: return 270.0f;
|
||||
default: return 0.0f;
|
||||
case DOWN:
|
||||
return 90.0f;
|
||||
case UP:
|
||||
return 270.0f;
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,17 +9,17 @@ public class IDAssigner
|
||||
private IDAssigner()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public static int getNextIDFromDirectory( File dir )
|
||||
{
|
||||
return getNextID( dir, true );
|
||||
}
|
||||
|
||||
|
||||
public static int getNextIDFromFile( File file )
|
||||
{
|
||||
return getNextID( file, false );
|
||||
}
|
||||
|
||||
|
||||
private static int getNextID( File location, boolean directory )
|
||||
{
|
||||
// Determine where to locate ID file
|
||||
@@ -34,7 +34,7 @@ public class IDAssigner
|
||||
location.getParentFile().mkdirs();
|
||||
lastidFile = location;
|
||||
}
|
||||
|
||||
|
||||
// Try to determine the id
|
||||
int id = 0;
|
||||
if( !lastidFile.exists() )
|
||||
@@ -94,7 +94,7 @@ public class IDAssigner
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Write the lastID file out with the new value
|
||||
try
|
||||
{
|
||||
@@ -107,7 +107,7 @@ public class IDAssigner
|
||||
{
|
||||
ComputerCraft.log.error( "An error occured while trying to create the computer folder. Please check you have relevant permissions.", e );
|
||||
}
|
||||
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ImpostorRecipe extends ShapedRecipes
|
||||
{
|
||||
super( group, width, height, ingredients, result );
|
||||
}
|
||||
|
||||
|
||||
public ImpostorRecipe( @Nonnull String group, int width, int height, ItemStack[] ingredients, @Nonnull ItemStack result )
|
||||
{
|
||||
super( group, width, height, convert( ingredients ), result );
|
||||
@@ -36,7 +36,7 @@ public class ImpostorRecipe extends ShapedRecipes
|
||||
private static NonNullList<Ingredient> convert( ItemStack[] items )
|
||||
{
|
||||
NonNullList<Ingredient> ingredients = NonNullList.withSize( items.length, Ingredient.EMPTY );
|
||||
for( int i = 0; i < items.length; i++ ) ingredients.set( i, Ingredient.fromStacks( items[ i ] ) );
|
||||
for( int i = 0; i < items.length; i++ ) ingredients.set( i, Ingredient.fromStacks( items[i] ) );
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ImpostorShapelessRecipe extends ShapelessRecipes
|
||||
private static NonNullList<Ingredient> convert( ItemStack[] items )
|
||||
{
|
||||
NonNullList<Ingredient> ingredients = NonNullList.withSize( items.length, Ingredient.EMPTY );
|
||||
for( int i = 0; i < items.length; i++ ) ingredients.set( i, Ingredient.fromStacks( items[ i ] ) );
|
||||
for( int i = 0; i < items.length; i++ ) ingredients.set( i, Ingredient.fromStacks( items[i] ) );
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ public class NBTUtil
|
||||
if( object instanceof Boolean )
|
||||
{
|
||||
boolean b = (Boolean) object;
|
||||
return new NBTTagByte( b ? (byte)1 : (byte)0 );
|
||||
return new NBTTagByte( b ? (byte) 1 : (byte) 0 );
|
||||
}
|
||||
else if( object instanceof Number )
|
||||
{
|
||||
Double d = ((Number)object).doubleValue();
|
||||
Double d = ((Number) object).doubleValue();
|
||||
return new NBTTagDouble( d );
|
||||
}
|
||||
else if( object instanceof String )
|
||||
@@ -35,9 +35,9 @@ public class NBTUtil
|
||||
}
|
||||
else if( object instanceof Map )
|
||||
{
|
||||
Map<?, ?> m = (Map<?, ?>)object;
|
||||
Map<?, ?> m = (Map<?, ?>) object;
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
int i=0;
|
||||
int i = 0;
|
||||
for( Map.Entry<?, ?> entry : m.entrySet() )
|
||||
{
|
||||
NBTBase key = toNBTTag( entry.getKey() );
|
||||
@@ -46,7 +46,7 @@ public class NBTUtil
|
||||
{
|
||||
nbt.setTag( "k" + Integer.toString( i ), key );
|
||||
nbt.setTag( "v" + Integer.toString( i ), value );
|
||||
++i;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
nbt.setInteger( "len", m.size() );
|
||||
@@ -62,7 +62,7 @@ public class NBTUtil
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setInteger( "len", objects.length );
|
||||
for( int i=0; i<objects.length; ++i )
|
||||
for( int i = 0; i < objects.length; i++ )
|
||||
{
|
||||
Object object = objects[i];
|
||||
NBTBase tag = toNBTTag( object );
|
||||
@@ -85,22 +85,22 @@ public class NBTUtil
|
||||
{
|
||||
case Constants.NBT.TAG_BYTE: // byte
|
||||
{
|
||||
return (((NBTTagByte)tag).getByte() > 0);
|
||||
return (((NBTTagByte) tag).getByte() > 0);
|
||||
}
|
||||
case Constants.NBT.TAG_DOUBLE: // Double
|
||||
{
|
||||
return ((NBTTagDouble)tag).getDouble();
|
||||
return ((NBTTagDouble) tag).getDouble();
|
||||
}
|
||||
case Constants.NBT.TAG_STRING: // String
|
||||
{
|
||||
return ((NBTTagString)tag).getString();
|
||||
return ((NBTTagString) tag).getString();
|
||||
}
|
||||
case Constants.NBT.TAG_COMPOUND: // Compound
|
||||
{
|
||||
NBTTagCompound c = (NBTTagCompound)tag;
|
||||
NBTTagCompound c = (NBTTagCompound) tag;
|
||||
int len = c.getInteger( "len" );
|
||||
Map<Object, Object> map = new HashMap<>( len );
|
||||
for( int i=0; i<len; ++i )
|
||||
for( int i = 0; i < len; i++ )
|
||||
{
|
||||
Object key = fromNBTTag( c.getTag( "k" + Integer.toString( i ) ) );
|
||||
Object value = fromNBTTag( c.getTag( "v" + Integer.toString( i ) ) );
|
||||
@@ -122,7 +122,7 @@ public class NBTUtil
|
||||
if( len > 0 )
|
||||
{
|
||||
Object[] objects = new Object[len];
|
||||
for( int i=0; i<len; ++i )
|
||||
for( int i = 0; i < len; i++ )
|
||||
{
|
||||
String key = Integer.toString( i );
|
||||
if( tagCompound.hasKey( key ) )
|
||||
|
||||
@@ -15,7 +15,7 @@ public class Palette
|
||||
resetColours();
|
||||
}
|
||||
|
||||
public void setColour(int i, double r, double g, double b)
|
||||
public void setColour( int i, double r, double g, double b )
|
||||
{
|
||||
if( i >= 0 && i < colours.length )
|
||||
{
|
||||
@@ -25,7 +25,7 @@ public class Palette
|
||||
}
|
||||
}
|
||||
|
||||
public void setColour(int i, Colour colour)
|
||||
public void setColour( int i, Colour colour )
|
||||
{
|
||||
setColour( i, colour.getR(), colour.getG(), colour.getB() );
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class Palette
|
||||
|
||||
public void resetColours()
|
||||
{
|
||||
for(int i = 0; i < Colour.values().length; ++i)
|
||||
for( int i = 0; i < Colour.values().length; i++ )
|
||||
{
|
||||
resetColour( i );
|
||||
}
|
||||
@@ -57,28 +57,28 @@ public class Palette
|
||||
|
||||
public static int encodeRGB8( double[] rgb )
|
||||
{
|
||||
int r = (int)( rgb[0] * 255 ) & 0xFF;
|
||||
int g = (int)( rgb[1] * 255 ) & 0xFF;
|
||||
int b = (int)( rgb[2] * 255 ) & 0xFF;
|
||||
int r = (int) (rgb[0] * 255) & 0xFF;
|
||||
int g = (int) (rgb[1] * 255) & 0xFF;
|
||||
int b = (int) (rgb[2] * 255) & 0xFF;
|
||||
|
||||
return ( r << 16 ) | ( g << 8 ) | b;
|
||||
return (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
public static double[] decodeRGB8( int rgb )
|
||||
{
|
||||
return new double[]
|
||||
{
|
||||
(( rgb >> 16 ) & 0xFF) / 255.0f,
|
||||
(( rgb >> 8 ) & 0xFF) / 255.0f,
|
||||
( rgb & 0xFF ) / 255.0f
|
||||
};
|
||||
{
|
||||
((rgb >> 16) & 0xFF) / 255.0f,
|
||||
((rgb >> 8) & 0xFF) / 255.0f,
|
||||
(rgb & 0xFF) / 255.0f
|
||||
};
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT( NBTTagCompound nbt )
|
||||
{
|
||||
int[] rgb8 = new int[colours.length];
|
||||
|
||||
for(int i = 0; i < colours.length; ++i)
|
||||
for( int i = 0; i < colours.length; i++ )
|
||||
{
|
||||
rgb8[i] = encodeRGB8( colours[i] );
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class Palette
|
||||
|
||||
if( rgb8.length != colours.length ) return;
|
||||
|
||||
for(int i = 0; i < colours.length; ++i)
|
||||
for( int i = 0; i < colours.length; i++ )
|
||||
{
|
||||
colours[i] = decodeRGB8( rgb8[i] );
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package dan200.computercraft.shared.util;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PeripheralUtil
|
||||
|
||||
@@ -43,21 +43,23 @@ public class RecipeUtil
|
||||
JsonArray patternJ = JsonUtils.getJsonArray( json, "pattern" );
|
||||
|
||||
if( patternJ.size() == 0 )
|
||||
{
|
||||
throw new JsonSyntaxException( "Invalid pattern: empty pattern not allowed" );
|
||||
}
|
||||
|
||||
String[] pattern = new String[ patternJ.size() ];
|
||||
for( int x = 0; x < pattern.length; ++x )
|
||||
String[] pattern = new String[patternJ.size()];
|
||||
for( int x = 0; x < pattern.length; x++ )
|
||||
{
|
||||
String line = JsonUtils.getString( patternJ.get( x ), "pattern[" + x + "]" );
|
||||
if( x > 0 && pattern[ 0 ].length() != line.length() )
|
||||
if( x > 0 && pattern[0].length() != line.length() )
|
||||
{
|
||||
throw new JsonSyntaxException( "Invalid pattern: each row must be the same width" );
|
||||
}
|
||||
pattern[ x ] = line;
|
||||
pattern[x] = line;
|
||||
}
|
||||
|
||||
CraftingHelper.ShapedPrimer primer = new CraftingHelper.ShapedPrimer();
|
||||
primer.width = pattern[ 0 ].length();
|
||||
primer.width = pattern[0].length();
|
||||
primer.height = pattern.length;
|
||||
primer.mirrored = false;
|
||||
primer.input = NonNullList.withSize( primer.width * primer.height, Ingredient.EMPTY );
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ReflectionUtil
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public static <T> T safeInvoke( Method method, Object object, Object[] arguments, Class<T> resultClass )
|
||||
{
|
||||
if( method != null )
|
||||
@@ -171,7 +171,7 @@ public class ReflectionUtil
|
||||
Object result = method.invoke( object, arguments );
|
||||
if( result != null && resultClass.isInstance( result ) )
|
||||
{
|
||||
return (T)result;
|
||||
return (T) result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class ReflectionUtil
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public static <T> T safeGet( Field field, Object object, Class<T> resultClass )
|
||||
{
|
||||
if( field != null )
|
||||
@@ -196,7 +196,7 @@ public class ReflectionUtil
|
||||
Object result = field.get( object );
|
||||
if( result != null && resultClass.isInstance( result ) )
|
||||
{
|
||||
return (T)result;
|
||||
return (T) result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public class StringUtil
|
||||
|
||||
int length = Math.min( 32, label.length() );
|
||||
StringBuilder builder = new StringBuilder( length );
|
||||
for (int i = 0; i < length; i++)
|
||||
for( int i = 0; i < length; i++ )
|
||||
{
|
||||
char c = label.charAt( i );
|
||||
if( (c >= ' ' && c <= '~') || (c >= 161 && c <= 172) || (c >= 174 && c <= 255) )
|
||||
@@ -27,7 +27,7 @@ public class StringUtil
|
||||
/**
|
||||
* Translates a Stat name
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public static String translateToLocal( String key )
|
||||
{
|
||||
return net.minecraft.util.text.translation.I18n.translateToLocal( key );
|
||||
@@ -36,7 +36,7 @@ public class StringUtil
|
||||
/**
|
||||
* Translates a Stat name with format args
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public static String translateToLocalFormatted( String key, Object... format )
|
||||
{
|
||||
return net.minecraft.util.text.translation.I18n.translateToLocalFormatted( key, format );
|
||||
@@ -44,12 +44,12 @@ public class StringUtil
|
||||
|
||||
public static byte[] encodeString( String string )
|
||||
{
|
||||
byte[] chars = new byte[ string.length() ];
|
||||
byte[] chars = new byte[string.length()];
|
||||
|
||||
for( int i = 0; i < chars.length; ++i )
|
||||
for( int i = 0; i < chars.length; i++ )
|
||||
{
|
||||
char c = string.charAt( i );
|
||||
chars[ i ] = c < 256 ? (byte) c : 63;
|
||||
chars[i] = c < 256 ? (byte) c : 63;
|
||||
}
|
||||
|
||||
return chars;
|
||||
|
||||
@@ -6,12 +6,10 @@
|
||||
|
||||
package dan200.computercraft.shared.util;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
@@ -54,16 +52,16 @@ public class WorldUtil
|
||||
}
|
||||
|
||||
// Check for entities
|
||||
float xStretch = Math.abs(vecDir.x) > 0.25f ? 0.0f : 1.0f;
|
||||
float yStretch = Math.abs(vecDir.y) > 0.25f ? 0.0f : 1.0f;
|
||||
float zStretch = Math.abs(vecDir.z) > 0.25f ? 0.0f : 1.0f;
|
||||
float xStretch = Math.abs( vecDir.x ) > 0.25f ? 0.0f : 1.0f;
|
||||
float yStretch = Math.abs( vecDir.y ) > 0.25f ? 0.0f : 1.0f;
|
||||
float zStretch = Math.abs( vecDir.z ) > 0.25f ? 0.0f : 1.0f;
|
||||
AxisAlignedBB bigBox = new AxisAlignedBB(
|
||||
Math.min(vecStart.x, vecEnd.x) - 0.375f * xStretch,
|
||||
Math.min(vecStart.y, vecEnd.y) - 0.375f * yStretch,
|
||||
Math.min(vecStart.z, vecEnd.z) - 0.375f * zStretch,
|
||||
Math.max(vecStart.x, vecEnd.x) + 0.375f * xStretch,
|
||||
Math.max(vecStart.y, vecEnd.y) + 0.375f * yStretch,
|
||||
Math.max(vecStart.z, vecEnd.z) + 0.375f * zStretch
|
||||
Math.min( vecStart.x, vecEnd.x ) - 0.375f * xStretch,
|
||||
Math.min( vecStart.y, vecEnd.y ) - 0.375f * yStretch,
|
||||
Math.min( vecStart.z, vecEnd.z ) - 0.375f * zStretch,
|
||||
Math.max( vecStart.x, vecEnd.x ) + 0.375f * xStretch,
|
||||
Math.max( vecStart.y, vecEnd.y ) + 0.375f * yStretch,
|
||||
Math.max( vecStart.z, vecEnd.z ) + 0.375f * zStretch
|
||||
);
|
||||
|
||||
Entity closest = null;
|
||||
@@ -124,14 +122,16 @@ public class WorldUtil
|
||||
{
|
||||
return new Vec3d( entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ );
|
||||
}
|
||||
|
||||
public static Vec3d getRayEnd( EntityPlayer player) {
|
||||
double reach = player.getEntityAttribute(EntityPlayer.REACH_DISTANCE).getAttributeValue();
|
||||
|
||||
public static Vec3d getRayEnd( EntityPlayer player )
|
||||
{
|
||||
double reach = player.getEntityAttribute( EntityPlayer.REACH_DISTANCE ).getAttributeValue();
|
||||
Vec3d look = player.getLookVec();
|
||||
return getRayStart( player ).add( look.x * reach, look.y * reach, look.z * reach );
|
||||
}
|
||||
|
||||
public static boolean isVecInsideInclusive(AxisAlignedBB bb , Vec3d vec) {
|
||||
|
||||
public static boolean isVecInsideInclusive( AxisAlignedBB bb, Vec3d vec )
|
||||
{
|
||||
return vec.x >= bb.minX && vec.x <= bb.maxX && vec.y >= bb.minY && vec.y <= bb.maxY && vec.z >= bb.minZ && vec.z <= bb.maxZ;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user