<commit_before>package founderio.taam.blocks.multinet;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeDirection;
import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput;
import codechicken.lib.lighting.LazyLightMatrix;
import codechicken.lib.render.CCModel;
import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3;
import codechicken.multipart.TMultiPart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import founderio.taam.Taam;

public class MultinetCable extends TMultiPart {

	/**
	 * 0-5 == Block Sides, 6 == Cable Rack
	 */
	private int face;
	/**
	 * Layer index, 0-layerCount
	 */
	private int layer = -1;
	
	private String part;

	private static final int layerCount = 6;
	private static final float cableWidth = 2f / 16f;
	private static CCModel ccm = CCModel.newModel(7, 24);

	@Override
	public String getType() {
		return Taam.MULTIPART_MULTINET_CABLE + "." + part;
	}

	public void init(BlockCoord blockCoords, int face, Vector3 hit, String part) {
		
		this.part = part;
		
		ForgeDirection dir = ForgeDirection.getOrientation(face).getOpposite();
		this.face = dir.ordinal();
		
		
		switch(dir) {
		case DOWN:
		case UP:
			if(hit.x > hit.z) {
				layer = (int)(hit.x * layerCount);
			} else {
				layer = (int)(hit.z * layerCount);
			}
			break;
		case NORTH:
		case SOUTH:
			if(hit.y > hit.z) {
				layer = (int)(hit.y * layerCount);
			} else {
				layer = (int)(hit.z * layerCount);
			}
			break;
		case WEST:
		case EAST:
			if(hit.y > hit.x) {
				layer = (int)(hit.y * layerCount);
			} else {
				layer = (int)(hit.x * layerCount);
			}
			break;
		default:
			break;
		}
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void renderStatic(Vector3 pos, LazyLightMatrix olm, int pass) {
		ForgeDirection dir = ForgeDirection.getOrientation(face);

		float layerOffset = (float)layer/(float)layerCount;
		float ox1 = 0;
		float oy1 = 0;
		float oz1 = 0;
		float ox2 = 0;
		float oy2 = 0;
		float oz2 = 0;
		
		switch(dir) {
		case DOWN:
			ox1 = layerOffset;
			oy1 = 0;
			oz1 = 0;
			ox2 = layerOffset + cableWidth;
			oy2 = cableWidth;
			oz2 = 1;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 0;
			oy1 = 0;
			oz1 = layerOffset;
			ox2 = 1;
			oy2 = cableWidth;
			oz2 = layerOffset + cableWidth;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		case UP:
			ox1 = layerOffset;
			oy1 = 1 - cableWidth;
			oz1 = 0;
			ox2 = layerOffset + cableWidth;
			oy2 = 1;
			oz2 = 1;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 0;
			oy1 = 1f - cableWidth;
			oz1 = layerOffset;
			ox2 = 1;
			oy2 = 1;
			oz2 = layerOffset + cableWidth;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		case NORTH:
			ox1 = layerOffset;
			oy1 = 0;
			oz1 = 0;
			ox2 = layerOffset + cableWidth;
			oy2 = 1;
			oz2 = cableWidth;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 0;
			oy1 = layerOffset;
			oz1 = 0;
			ox2 = 1;
			oy2 = layerOffset + cableWidth;
			oz2 = cableWidth;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		case SOUTH:
			ox1 = layerOffset;
			oy1 = 0;
			oz1 = 1 - cableWidth;
			ox2 = layerOffset + cableWidth;
			oy2 = 1;
			oz2 = 1;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 0;
			oy1 = layerOffset;
			oz1 = 1 - cableWidth;
			ox2 = 1;
			oy2 = layerOffset + cableWidth;
			oz2 = 1;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		case WEST:
		case EAST:
			
			break;
		default:
			break;
		}
	}<commit_msg>Fixed Cable Placement & Rendering<commit_after>package founderio.taam.blocks.multinet;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeDirection;
import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput;
import codechicken.lib.lighting.LazyLightMatrix;
import codechicken.lib.render.CCModel;
import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3;
import codechicken.multipart.TMultiPart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import founderio.taam.Taam;

public class MultinetCable extends TMultiPart {

	/**
	 * 0-5 == Block Sides, 6 == Cable Rack
	 */
	private int face;
	/**
	 * Layer index, 0-layerCount
	 */
	private int layer = -1;
	
	private String part;

	private static final int layerCount = 6;
	private static final float cableWidth = 2f / 16f;
	private static CCModel ccm = CCModel.newModel(7, 24);

	@Override
	public String getType() {
		return Taam.MULTIPART_MULTINET_CABLE + "." + part;
	}

	public void init(BlockCoord blockCoords, int face, Vector3 hit, String part) {
		
		this.part = part;
		
		ForgeDirection dir = ForgeDirection.getOrientation(face).getOpposite();
		this.face = dir.ordinal();
		
		
		switch(dir) {
		case DOWN:
		case UP:
			if(hit.x > hit.z) {
				layer = (int)(hit.x * layerCount);
			} else {
				layer = (int)(hit.z * layerCount);
			}
			break;
		case NORTH:
		case SOUTH:
			if(hit.y > hit.x) {
				layer = (int)(hit.y * layerCount);
			} else {
				layer = (int)(hit.x * layerCount);
			}
			break;
		case WEST:
		case EAST:
			if(hit.y > hit.z) {
				layer = (int)(hit.y * layerCount);
			} else {
				layer = (int)(hit.z * layerCount);
			}
			break;
		default:
			break;
		}
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void renderStatic(Vector3 pos, LazyLightMatrix olm, int pass) {
		ForgeDirection dir = ForgeDirection.getOrientation(face);

		float layerOffset = (float)layer/(float)layerCount;
		float ox1 = 0;
		float oy1 = 0;
		float oz1 = 0;
		float ox2 = 0;
		float oy2 = 0;
		float oz2 = 0;
		
		switch(dir) {
		case DOWN:
			ox1 = layerOffset;
			oy1 = 0;
			oz1 = 0;
			ox2 = layerOffset + cableWidth;
			oy2 = cableWidth;
			oz2 = 1;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 0;
			oy1 = 0;
			oz1 = layerOffset;
			ox2 = 1;
			oy2 = cableWidth;
			oz2 = layerOffset + cableWidth;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		case UP:
			ox1 = layerOffset;
			oy1 = 1 - cableWidth;
			oz1 = 0;
			ox2 = layerOffset + cableWidth;
			oy2 = 1;
			oz2 = 1;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 0;
			oy1 = 1f - cableWidth;
			oz1 = layerOffset;
			ox2 = 1;
			oy2 = 1;
			oz2 = layerOffset + cableWidth;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		case NORTH:
			ox1 = layerOffset;
			oy1 = 0;
			oz1 = 0;
			ox2 = layerOffset + cableWidth;
			oy2 = 1;
			oz2 = cableWidth;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 0;
			oy1 = layerOffset;
			oz1 = 0;
			ox2 = 1;
			oy2 = layerOffset + cableWidth;
			oz2 = cableWidth;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		case SOUTH:
			ox1 = layerOffset;
			oy1 = 0;
			oz1 = 1 - cableWidth;
			ox2 = layerOffset + cableWidth;
			oy2 = 1;
			oz2 = 1;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 0;
			oy1 = layerOffset;
			oz1 = 1 - cableWidth;
			ox2 = 1;
			oy2 = layerOffset + cableWidth;
			oz2 = 1;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		case WEST:
			ox1 = 0;
			oy1 = 0;
			oz1 = layerOffset;
			ox2 = cableWidth;
			oy2 = 1;
			oz2 = layerOffset + cableWidth;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 0;
			oy1 = layerOffset;
			oz1 = 0;
			ox2 = cableWidth;
			oy2 = layerOffset + cableWidth;
			oz2 = 1;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		case EAST:
			ox1 = 1 - cableWidth;
			oy1 = 0;
			oz1 = layerOffset;
			ox2 = 1;
			oy2 = 1;
			oz2 = layerOffset + cableWidth;
			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			ox1 = 1 - cableWidth;
			oy1 = layerOffset;
			oz1 = 0;
			ox2 = 1;
			oy2 = layerOffset + cableWidth;
			oz2 = 1;

			ccm.generateBlock(0, pos.x + ox1, pos.y + oy1, pos.z + oz1,
								 pos.x + ox2, pos.y + oy2, pos.z + oz2).render();
			break;
		default:
			break;
		}
	}
	
{'fraction_non_alphanumeric': 0.14205283672585534, 'fraction_numerical': 0.04157644001732352, 'mean_word_length': 2.513503233168505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3311574', 'n_tokens_mistral': 4575, 'n_tokens_neox': 3763, 'n_words': 918}