<commit_before>package noxzet.fluxindustry.core.block.electric;

import java.util.Random;

import net.darkhax.tesla.capability.TeslaCapabilities;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.energy.CapabilityEnergy;
import noxzet.fluxindustry.core.FluxIndustry;
import noxzet.fluxindustry.core.block.BlockFlux;
import noxzet.fluxindustry.core.block.ITileEntityClassProvider;
import noxzet.fluxindustry.core.item.FluxItems;
import noxzet.fluxindustry.core.tileentity.TileFluxCable;

public class BlockFluxCable extends BlockFlux implements ITileEntityClassProvider {

	public final static PropertyEnum<CableVariant> VARIANT = PropertyEnum.<CableVariant>create("variant", CableVariant.class);
    public static final PropertyBool DOWN = PropertyBool.create("down");
    public static final PropertyBool UP = PropertyBool.create("up");
    public static final PropertyBool NORTH = PropertyBool.create("north");
    public static final PropertyBool SOUTH = PropertyBool.create("south");
    public static final PropertyBool WEST = PropertyBool.create("west");
    public static final PropertyBool EAST = PropertyBool.create("east");
    
	public BlockFluxCable(String unlocalizedName)
	{
		super(Material.CLOTH, unlocalizedName);
		this.setResistance(30);
		this.setHardness(1);
		this.setSoundType(SoundType.CLOTH);
		this.setIsCube(false);
	}
	
	public void registerItemModel(ItemBlock itemBlock)
	{
		FluxIndustry.proxy.registerItemRenderer(itemBlock, 0, "down=false,east=true,north=false,south=false,up=false,variant=copper,west=true");
	}
	
	public Class getTileEntityClass()
	{
		return TileFluxCable.class;
	}
	
	public TileEntity getTileEntity (IBlockAccess world, BlockPos pos)
	{
		return (TileEntity)world.getTileEntity(pos);
	}

	@Override
	public boolean hasTileEntity(IBlockState state)
	{
		return true;
	}
	
	@Override
	public TileEntity createTileEntity(World worldIn, IBlockState state)
	{
		return createNewTileEntity(worldIn, this.getMetaFromState(state));
	}
	
	@Override
	public TileEntity createNewTileEntity(World worldIn, int meta)
	{
		return new TileFluxCable();
	}
	
    @Override
    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, VARIANT, DOWN, UP, NORTH, SOUTH, WEST, EAST);
    }

	@Override
	public IBlockState getStateFromMeta(int meta)
	{
		return this.getDefaultState().withProperty(VARIANT, CableVariant.fromMeta(meta));
	}
	
	@Override
	public int getMetaFromState(IBlockState state)
	{
		return this.getDefaultState().getValue(VARIANT).getMeta();
	}
	
	public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
	{
		return state.withProperty(DOWN, connectToSide(EnumFacing.DOWN, world, pos))
				.withProperty(UP, connectToSide(EnumFacing.UP, world, pos))
				.withProperty(NORTH, connectToSide(EnumFacing.NORTH, world, pos))
				.withProperty(SOUTH, connectToSide(EnumFacing.SOUTH, world, pos))
				.withProperty(WEST, connectToSide(EnumFacing.WEST, world, pos))
				.withProperty(EAST, connectToSide(EnumFacing.EAST, world, pos));
	}
	
	public boolean connectToSide(EnumFacing facing, IBlockAccess world, BlockPos pos)
	{
		TileEntity entity = world.getTileEntity(pos.offset(facing));
		EnumFacing opposite = facing.getOpposite();
		if (entity != null)<commit_msg>Fixed saving cable type<commit_after>package noxzet.fluxindustry.core.block.electric;

import java.util.Random;

import net.darkhax.tesla.capability.TeslaCapabilities;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.energy.CapabilityEnergy;
import noxzet.fluxindustry.core.FluxIndustry;
import noxzet.fluxindustry.core.block.BlockFlux;
import noxzet.fluxindustry.core.block.ITileEntityClassProvider;
import noxzet.fluxindustry.core.item.FluxItems;
import noxzet.fluxindustry.core.tileentity.TileFluxCable;

public class BlockFluxCable extends BlockFlux implements ITileEntityClassProvider {

	public final static PropertyEnum<CableVariant> VARIANT = PropertyEnum.<CableVariant>create("variant", CableVariant.class);
    public static final PropertyBool DOWN = PropertyBool.create("down");
    public static final PropertyBool UP = PropertyBool.create("up");
    public static final PropertyBool NORTH = PropertyBool.create("north");
    public static final PropertyBool SOUTH = PropertyBool.create("south");
    public static final PropertyBool WEST = PropertyBool.create("west");
    public static final PropertyBool EAST = PropertyBool.create("east");
    
	public BlockFluxCable(String unlocalizedName)
	{
		super(Material.CLOTH, unlocalizedName);
		this.setResistance(30);
		this.setHardness(1);
		this.setSoundType(SoundType.CLOTH);
		this.setIsCube(false);
	}
	
	public void registerItemModel(ItemBlock itemBlock)
	{
		FluxIndustry.proxy.registerItemRenderer(itemBlock, 0, "down=false,east=true,north=false,south=false,up=false,variant=copper,west=true");
	}
	
	public Class getTileEntityClass()
	{
		return TileFluxCable.class;
	}
	
	public TileEntity getTileEntity (IBlockAccess world, BlockPos pos)
	{
		return (TileEntity)world.getTileEntity(pos);
	}

	@Override
	public boolean hasTileEntity(IBlockState state)
	{
		return true;
	}
	
	@Override
	public TileEntity createTileEntity(World worldIn, IBlockState state)
	{
		return createNewTileEntity(worldIn, this.getMetaFromState(state));
	}
	
	@Override
	public TileEntity createNewTileEntity(World worldIn, int meta)
	{
		return new TileFluxCable();
	}
	
    @Override
    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, VARIANT, DOWN, UP, NORTH, SOUTH, WEST, EAST);
    }

	@Override
	public IBlockState getStateFromMeta(int meta)
	{
		return this.getDefaultState().withProperty(VARIANT, CableVariant.fromMeta(meta));
	}
	
	@Override
	public int getMetaFromState(IBlockState state)
	{
		return state.getValue(VARIANT).getMeta();
	}
	
	public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
	{
		return state.withProperty(DOWN, connectToSide(EnumFacing.DOWN, world, pos))
				.withProperty(UP, connectToSide(EnumFacing.UP, world, pos))
				.withProperty(NORTH, connectToSide(EnumFacing.NORTH, world, pos))
				.withProperty(SOUTH, connectToSide(EnumFacing.SOUTH, world, pos))
				.withProperty(WEST, connectToSide(EnumFacing.WEST, world, pos))
				.withProperty(EAST, connectToSide(EnumFacing.EAST, world, pos));
	}
	
	public boolean connectToSide(EnumFacing facing, IBlockAccess world, BlockPos pos)
	{
		TileEntity entity = world.getTileEntity(pos.offset(facing));
		EnumFacing opposite = facing.getOpposite();
		if (entity != null)
{'fraction_non_alphanumeric': 0.10054578532443906, 'fraction_numerical': 0.0009702850212249849, 'mean_word_length': 5.994062765055132, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3958517', 'n_tokens_mistral': 2709, 'n_tokens_neox': 2588, 'n_words': 490}