<commit_before>package mcjty.xnet.cables;

import com.google.common.collect.Lists;
import elec332.core.world.WorldHelper;
import mcjty.xnet.api.IXNetCable;
import mcjty.xnet.api.IXNetComponent;
import mcjty.xnet.api.XNetAPI;
import mcjty.xnet.api.XNetAPIHelper;
import mcjty.xnet.varia.UniversalUnlistedProperty;
import mcmultipart.MCMultiPartMod;
import mcmultipart.client.multipart.ICustomHighlightPart;
import mcmultipart.multipart.*;
import mcmultipart.raytrace.PartMOP;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;

import java.util.EnumSet;
import java.util.List;

/**
 * Created by Elec332 on 1-3-2016.
 */
public abstract class AbstractCableMultiPart extends Multipart implements ISlottedPart, IXNetCable, INormallyOccludingPart, ICustomHighlightPart {

    // Properties that indicate if there is a connection to certain direction.
    public static final IUnlistedProperty<Boolean> NORTH = new UniversalUnlistedProperty<>("north", Boolean.class);
    public static final IUnlistedProperty<Boolean> SOUTH = new UniversalUnlistedProperty<>("south", Boolean.class);
    public static final IUnlistedProperty<Boolean> WEST = new UniversalUnlistedProperty<>("west", Boolean.class);
    public static final IUnlistedProperty<Boolean> EAST = new UniversalUnlistedProperty<>("east", Boolean.class);
    public static final IUnlistedProperty<Boolean> UP = new UniversalUnlistedProperty<>("up", Boolean.class);
    public static final IUnlistedProperty<Boolean> DOWN = new UniversalUnlistedProperty<>("down", Boolean.class);

    public AbstractCableMultiPart(){
        this.connectedSides = EnumSet.noneOf(EnumFacing.class);
    }

    private final EnumSet<EnumFacing> connectedSides;

    public abstract boolean isAdvanced();

    @Override
    public EnumSet<PartSlot> getSlotMask() {
        return EnumSet.of(PartSlot.CENTER);
    }

    @Override
    public void onNeighborBlockChange(Block block) {
        super.onNeighborBlockChange(block);
        if (checkConnections()) {
            WorldHelper.markBlockForRenderUpdate(getWorld(), getPos());
        }
    }

    @Override
    public void onPartChanged(IMultipart part) {
        super.onPartChanged(part);
        if (checkConnections()) {
            WorldHelper.markBlockForRenderUpdate(getWorld(), getPos());
        }
    }

    @Override
    public void onNeighborTileChange(EnumFacing facing) {
        super.onNeighborTileChange(facing);
        if (checkConnections()) {
            WorldHelper.markBlockForRenderUpdate(getWorld(), getPos());
        }
    }

    @Override
    public BlockStateContainer createBlockState() {
        return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[0], new IUnlistedProperty[] { NORTH, SOUTH, WEST, EAST, UP, DOWN });
    }

    @Override
    public IBlockState getExtendedState(IBlockState state) {
        IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
        //checkConnections();
        boolean north = isConnected(EnumFacing.NORTH);
        boolean south = isConnected(EnumFacing.SOUTH);
        boolean west = isConnected(EnumFacing.WEST);
        boolean east = isConnected(EnumFacing.EAST);
        boolean up = isConnected(EnumFacing.UP);
        boolean down = isConnected(EnumFacing.DOWN);

        return extendedBlockState.withProperty(NORTH, north).withProperty(SOUTH, south).withProperty(WEST, west).withProperty(EAST, east).withProperty(UP, up).withProperty(DOWN, down);
    }

    private boolean isConnected(EnumFacing facing){
        return connectedSides.contains(facing);
    }<commit_msg>Heavy rendering<commit_after>package mcjty.xnet.cables;

import com.google.common.collect.Lists;
import elec332.core.world.WorldHelper;
import mcjty.xnet.api.IXNetCable;
import mcjty.xnet.api.IXNetComponent;
import mcjty.xnet.api.XNetAPI;
import mcjty.xnet.api.XNetAPIHelper;
import mcjty.xnet.varia.UniversalUnlistedProperty;
import mcmultipart.MCMultiPartMod;
import mcmultipart.client.multipart.ICustomHighlightPart;
import mcmultipart.multipart.*;
import mcmultipart.raytrace.PartMOP;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;

import java.util.EnumSet;
import java.util.List;

/**
 * Created by Elec332 on 1-3-2016.
 */
public abstract class AbstractCableMultiPart extends Multipart implements ISlottedPart, IXNetCable, INormallyOccludingPart, ICustomHighlightPart {

    // Properties that indicate if there is a connection to certain direction.
    public static final IUnlistedProperty<Boolean> NORTH = new UniversalUnlistedProperty<>("north", Boolean.class);
    public static final IUnlistedProperty<Boolean> SOUTH = new UniversalUnlistedProperty<>("south", Boolean.class);
    public static final IUnlistedProperty<Boolean> WEST = new UniversalUnlistedProperty<>("west", Boolean.class);
    public static final IUnlistedProperty<Boolean> EAST = new UniversalUnlistedProperty<>("east", Boolean.class);
    public static final IUnlistedProperty<Boolean> UP = new UniversalUnlistedProperty<>("up", Boolean.class);
    public static final IUnlistedProperty<Boolean> DOWN = new UniversalUnlistedProperty<>("down", Boolean.class);

    public AbstractCableMultiPart(){
        this.connectedSides = EnumSet.noneOf(EnumFacing.class);
    }

    private final EnumSet<EnumFacing> connectedSides;

    public abstract boolean isAdvanced();

    @Override
    public EnumSet<PartSlot> getSlotMask() {
        return EnumSet.of(PartSlot.CENTER);
    }

    @Override
    public void onNeighborBlockChange(Block block) {
        super.onNeighborBlockChange(block);
        if (checkConnections()) {
            WorldHelper.markBlockForRenderUpdate(getWorld(), getPos());
        }
    }

    @Override
    public void onPartChanged(IMultipart part) {
        super.onPartChanged(part);
        if (checkConnections()) {
            WorldHelper.markBlockForRenderUpdate(getWorld(), getPos());
        }
    }

    @Override
    public void onNeighborTileChange(EnumFacing facing) {
        super.onNeighborTileChange(facing);
        if (checkConnections()) {
            WorldHelper.markBlockForRenderUpdate(getWorld(), getPos());
        }
    }

    @Override
    public BlockStateContainer createBlockState() {
        return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[0], new IUnlistedProperty[] { NORTH, SOUTH, WEST, EAST, UP, DOWN });
    }

    @Override
    public IBlockState getExtendedState(IBlockState state) {
        IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
        checkConnections();
        boolean north = isConnected(EnumFacing.NORTH);
        boolean south = isConnected(EnumFacing.SOUTH);
        boolean west = isConnected(EnumFacing.WEST);
        boolean east = isConnected(EnumFacing.EAST);
        boolean up = isConnected(EnumFacing.UP);
        boolean down = isConnected(EnumFacing.DOWN);

        return extendedBlockState.withProperty(NORTH, north).withProperty(SOUTH, south).withProperty(WEST, west).withProperty(EAST, east).withProperty(UP, up).withProperty(DOWN, down);
    }

    private boolean isConnected(EnumFacing facing){
        return connectedSides.contains(facing);
    }
{'fraction_non_alphanumeric': 0.09701159678858162, 'fraction_numerical': 0.003345227475468332, 'mean_word_length': 4.647984886649874, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '1562221', 'n_tokens_mistral': 2658, 'n_tokens_neox': 2592, 'n_words': 501}