<commit_before>package com.phylogeny.extrabitmanipulation.item;

import java.util.List;

import com.phylogeny.extrabitmanipulation.api.ChiselsAndBitsAPIAccess;
import com.phylogeny.extrabitmanipulation.config.ConfigProperty;
import com.phylogeny.extrabitmanipulation.reference.Configs;
import com.phylogeny.extrabitmanipulation.reference.NBTKeys;

import mod.chiselsandbits.api.APIExceptions.CannotBeChiseled;
import mod.chiselsandbits.api.APIExceptions.SpaceOccupied;
import mod.chiselsandbits.api.IBitAccess;
import mod.chiselsandbits.api.IBitBrush;
import mod.chiselsandbits.api.IChiselAndBitsAPI;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;

public class ItemBitWrench extends ItemBitToolBase
{
	private static final String[] modeText = new String[]{"rotate", "mirror", "translate", "invert"};
	
	public ItemBitWrench(String name)
	{
		super(name);
		modeTitles = new String[]{"Rotation", "Mirroring", "Translation", "Inversion"};
	}
	
	public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
			EnumFacing side, float hitX, float hitY, float hitZ)
    {
		initialize(stack);
		IChiselAndBitsAPI api = ChiselsAndBitsAPIAccess.apiInstance;
		int mode = !stack.hasTagCompound() ? 0 : stack.getTagCompound().getInteger(NBTKeys.MODE);
		if ((player.capabilities.isCreativeMode || mode != 3) && api.isBlockChiseled(world, pos))
		{
			IBitAccess bitAccess;
			try
			{
				bitAccess = api.getBitAccess(world, pos);
			}
			catch (CannotBeChiseled e)
			{
				e.printStackTrace();
				return false;
			}
			IBitBrush[][][] bitArray = new IBitBrush[16][16][16];
			int increment = 1; //currently fixed
			boolean invertDirection = player.isSneaking();
			int s = (player.isSneaking() ? (mode == 1 ? (side.rotateAround((side.getAxis().isHorizontal()
					? EnumFacing.UP : player.getHorizontalFacing()).getAxis())) : side.getOpposite()) : side).ordinal();
			boolean canTranslate = true;
			boolean canInvert = false;
			IBitBrush invertbit = null;
			int removalLayer = s % 2 == 1 ? -1 : 16;
			if (mode >= 2)
			{
				for (int i = 0; i < 16; i++)
				{
					for (int j = 0; j < 16; j++)
					{
						for (int k = 0; k < 16; k++)
						{
							IBitBrush bit = bitAccess.getBitAt(i, j, k);
							bitArray[i][j][k] = bit;
							if (mode == 2)
							{
								if (!bit.isAir() && ((s == 4 && i == 16 - increment)
										|| (s == 0 && j == 16 - increment)
										|| (s == 2 && k == 16 - increment)
										|| (s == 5 && i == increment - 1)
										|| (s == 1 && j == increment - 1)
										|| (s == 3 && k == increment - 1)))
								{
									canTranslate = false;
								}
								if (!bit.isAir())
								{
									if ((s == 4 && i < removalLayer) || (s == 5 && i > removalLayer))	
									{
										removalLayer = i;
									}
									else if ((s == 0 && j < removalLayer) || (s == 1 && j > removalLayer))
									{
										removalLayer = j;
									}
									else if ((s == 2 && k < removalLayer) || (s == 3 && k > removalLayer))
									{
										removalLayer = k;
									}
								}
							}
							else
							{
								if (bit.isAir())
								{
									canInvert = true;
								}
								else
								{
									invertbit = bit;
								}
							}
						}
					}
				}
			}
			int increment2 = invertDirection ? -increment : increment;
			if (!(mode == 2 && !canTranslate) || !(mode == 3 && !canInvert))
			{
				int x, y, z;
				for (int i = 0; i < 16; i++)
				{
					for (int j = 0; j < 16; j++)
					{<commit_msg>Fixed bug prevent rotation/mirroring from working.<commit_after>package com.phylogeny.extrabitmanipulation.item;

import java.util.List;

import com.phylogeny.extrabitmanipulation.api.ChiselsAndBitsAPIAccess;
import com.phylogeny.extrabitmanipulation.config.ConfigProperty;
import com.phylogeny.extrabitmanipulation.reference.Configs;
import com.phylogeny.extrabitmanipulation.reference.NBTKeys;

import mod.chiselsandbits.api.APIExceptions.CannotBeChiseled;
import mod.chiselsandbits.api.APIExceptions.SpaceOccupied;
import mod.chiselsandbits.api.IBitAccess;
import mod.chiselsandbits.api.IBitBrush;
import mod.chiselsandbits.api.IChiselAndBitsAPI;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;

public class ItemBitWrench extends ItemBitToolBase
{
	private static final String[] modeText = new String[]{"rotate", "mirror", "translate", "invert"};
	
	public ItemBitWrench(String name)
	{
		super(name);
		modeTitles = new String[]{"Rotation", "Mirroring", "Translation", "Inversion"};
	}
	
	public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
			EnumFacing side, float hitX, float hitY, float hitZ)
    {
		initialize(stack);
		IChiselAndBitsAPI api = ChiselsAndBitsAPIAccess.apiInstance;
		int mode = !stack.hasTagCompound() ? 0 : stack.getTagCompound().getInteger(NBTKeys.MODE);
		if ((player.capabilities.isCreativeMode || mode != 3) && api.isBlockChiseled(world, pos))
		{
			IBitAccess bitAccess;
			try
			{
				bitAccess = api.getBitAccess(world, pos);
			}
			catch (CannotBeChiseled e)
			{
				e.printStackTrace();
				return false;
			}
			IBitBrush[][][] bitArray = new IBitBrush[16][16][16];
			int increment = 1; //currently fixed
			boolean invertDirection = player.isSneaking();
			int s = (player.isSneaking() ? (mode == 1 ? (side.rotateAround((side.getAxis().isHorizontal()
					? EnumFacing.UP : player.getHorizontalFacing()).getAxis())) : side.getOpposite()) : side).ordinal();
			boolean canTranslate = true;
			boolean canInvert = false;
			IBitBrush invertbit = null;
			int removalLayer = s % 2 == 1 ? -1 : 16;
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					for (int k = 0; k < 16; k++)
					{
						IBitBrush bit = bitAccess.getBitAt(i, j, k);
						bitArray[i][j][k] = bit;
						if (mode == 2)
						{
							if (!bit.isAir() && ((s == 4 && i == 16 - increment)
									|| (s == 0 && j == 16 - increment)
									|| (s == 2 && k == 16 - increment)
									|| (s == 5 && i == increment - 1)
									|| (s == 1 && j == increment - 1)
									|| (s == 3 && k == increment - 1)))
							{
								canTranslate = false;
							}
							if (!bit.isAir())
							{
								if ((s == 4 && i < removalLayer) || (s == 5 && i > removalLayer))	
								{
									removalLayer = i;
								}
								else if ((s == 0 && j < removalLayer) || (s == 1 && j > removalLayer))
								{
									removalLayer = j;
								}
								else if ((s == 2 && k < removalLayer) || (s == 3 && k > removalLayer))
								{
									removalLayer = k;
								}
							}
						}
						else if (mode == 3)
						{
							if (bit.isAir())
							{
								canInvert = true;
							}
							else
							{
								invertbit = bit;
							}
						}
					}
				}
			}
			int increment2 = invertDirection ? -increment : increment;
			if (!(mode == 2 && !canTranslate) && !(mode == 3 && !canInvert))
			{
				int x, y, z;
				for (int i = 0; i < 16; i++)
				{
					for (int j = 0; j < 16; j++)
					{
{'fraction_non_alphanumeric': 0.14680648236415633, 'fraction_numerical': 0.015252621544327931, 'mean_word_length': 2.607072691552063, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 10, 'https://': 0, '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': '535010', 'n_tokens_mistral': 3375, 'n_tokens_neox': 2471, 'n_words': 575}