<commit_before>/** Helper Class */
package org.cubedservers.cstweaks.helpers;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;

public class Utils {
	public static MovingObjectPosition getMovingObjectPosition(EntityPlayer player){
		Vec3 posVec = Vec3.createVectorHelper(player.posX, player.posY, player.posZ);
		Vec3 lookVec = player.getLook(1);
		posVec.yCoord += player.getEyeHeight();
		lookVec = posVec.addVector(lookVec.xCoord * 4.5F, lookVec.yCoord * 4.5F, lookVec.zCoord * 4.5F);
		return player.worldObj.rayTraceBlocks(posVec, lookVec);
	}
	
	public static Block getTargetBlock(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null){
			int x = mop.blockX;
			int y = mop.blockY;
			int z = mop.blockZ;
			Block b = player.worldObj.getBlock(x, y, z);
			if(b != null){
				return b;
			}
		}
		return null;
	}
	
	public static TileEntity getTargetTile(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null){
			int x = mop.blockX;
			int y = mop.blockY;
			int z = mop.blockZ;
			TileEntity t = player.worldObj.getTileEntity(x, y, z);
			if(t != null){
				return t;
			}
		}
		return null;
	}
	
	public static int getTargetBlockMeta(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null){
			int x = mop.blockX;
			int y = mop.blockY;
			int z = mop.blockZ;
			Block b = player.worldObj.getBlock(x, y, z);
			int meta = player.worldObj.getBlockMetadata(x, y, z);
			if(b != null){
				return meta;
			}
		}
		return 0;
	}
	
	public static int getTargetX(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null)
			return mop.blockX;
		return 0;
	}

	public static int getTargetY(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null)
			return mop.blockY;
		return 0;
	}
	
	public static int getTargetZ(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null)
			return mop.blockZ;
		return 0;
	}
	
	public static int getTargetBlockSide(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null){
			return mop.sideHit;
		}
		return 0;
	}
	
	public static Minecraft getMinecraft(){
		return Minecraft.getMinecraft();
	}
}<commit_msg>Some work on Utils.class/ also added @author tags on it since i used some code from BlockHelper from CoFHLib, with permission of KingLemming<commit_after>/** Helper Class */
package org.cubedservers.cstweaks.helpers;

import java.awt.Desktop;
import java.net.URL;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;

public class Utils {
	/**
	 * Copied from CoFHLib BlockHelper.class (https://github.com/CoFH/CoFHLib/blob/master/src/main/java/cofh/util/BlockHelper.java), with KingLemmings permission!
	 * @author <NAME>
	 */
	public static MovingObjectPosition getMovingObjectPosition(EntityPlayer player){
		Vec3 posVec = Vec3.createVectorHelper(player.posX, player.posY, player.posZ);
		Vec3 lookVec = player.getLook(1);
		posVec.yCoord += player.getEyeHeight();
		lookVec = posVec.addVector(lookVec.xCoord * 4.5F, lookVec.yCoord * 4.5F, lookVec.zCoord * 4.5F);
		return player.worldObj.rayTraceBlocks(posVec, lookVec);
	}
	
	/** @author wasliebob */
	public static Block getTargetBlock(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null){
			int x = mop.blockX;
			int y = mop.blockY;
			int z = mop.blockZ;
			Block b = player.worldObj.getBlock(x, y, z);
			if(b != null){
				return b;
			}
		}
		return null;
	}
	
	/** @author wasliebob */
	public static TileEntity getTargetTile(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null){
			int x = mop.blockX;
			int y = mop.blockY;
			int z = mop.blockZ;
			TileEntity t = player.worldObj.getTileEntity(x, y, z);
			if(t != null){
				return t;
			}
		}
		return null;
	}
	
	/** @author wasliebob */
	public static int getTargetBlockMeta(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null){
			int x = mop.blockX;
			int y = mop.blockY;
			int z = mop.blockZ;
			Block b = player.worldObj.getBlock(x, y, z);
			int meta = player.worldObj.getBlockMetadata(x, y, z);
			if(b != null){
				return meta;
			}
		}
		return 0;
	}
	
	/** @author wasliebob */
	public static int getTargetX(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null)
			return mop.blockX;
		return 0;
	}

	/** @author wasliebob */
	public static int getTargetY(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null)
			return mop.blockY;
		return 0;
	}
	
	/** @author wasliebob */
	public static int getTargetZ(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null)
			return mop.blockZ;
		return 0;
	}
	
	/** @author wasliebob */
	public static int getTargetBlockSide(EntityPlayer player){
		MovingObjectPosition mop = getMovingObjectPosition(player);
		if(mop != null){
			return mop.sideHit;
		}
		return 0;
	}
	
	/** @author wasliebob */
	public static Minecraft getMinecraft(){
		return Minecraft.getMinecraft();
	}
	
	/** @author wasliebob */
	public static void openURL(String url){
		try{
			Desktop.getDesktop().browse(new URL(url).toURI());
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
{'fraction_non_alphanumeric': 0.11634631740091853, 'fraction_numerical': 0.005443102568464024, 'mean_word_length': 4.0602409638554215, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7389344', 'n_tokens_mistral': 2266, 'n_tokens_neox': 1998, 'n_words': 469}