Jump to content

[1.9.4] Custom IBakedModel not calling getQuads for blocks in the world


Guest

Recommended Posts

I have a block that needs to change it's appearance in terms of it's texture. Because I am doing connected textures, I need to use a custom IBakedModel. If I put a log output into the getQuads method and it seems that the method isn't getting called with a non-null IBlockState meaning that I can't determine any special stuff I need for the apearance of the block. This is my custom IBakedModel:

package XFactHD.thermalreactors.client.render.models;

import XFactHD.thermalreactors.client.render.utils.EnumConnection;
import XFactHD.thermalreactors.common.blocks.machine.fissionReactor.BlockReactorComponent;
import XFactHD.thermalreactors.common.utils.LogHelper;
import XFactHD.thermalreactors.common.utils.property.PropertyHolder;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@SuppressWarnings("deprecation")
public class ModelReactorComponent implements IBakedModel
{
    private IBakedModel baseModel;
    private HashMap<EnumConnection, TextureAtlasSprite> baseSprites;
    private HashMap<String, HashMap<EnumConnection, TextureAtlasSprite>> specialSprites;
    private BlockReactorComponent.EnumType type;

    public ModelReactorComponent(IBakedModel baseModel, HashMap<EnumConnection, TextureAtlasSprite> baseSprites, HashMap<String, HashMap<EnumConnection, TextureAtlasSprite>> specialSprites, BlockReactorComponent.EnumType type)
    {
        this.baseModel = baseModel;
        this.baseSprites = baseSprites;
        this.specialSprites = specialSprites;
        this.type = type;
    }

    @Override
    public ItemOverrideList getOverrides()
    {
        return baseModel.getOverrides();
    }

    @Override
    public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand)
    {
        if (state != null && side != null)
        {
            LogHelper.info("Called from a block!");
            List<BakedQuad> quads = new ArrayList<BakedQuad>();
            EnumFacing facing = state.getValue(PropertyHolder.ORIENTATION_CARDINAL);
            boolean north = state.getValue(PropertyHolder.CONNECTED_NORTH);
            boolean east = state.getValue(PropertyHolder.CONNECTED_EAST);
            boolean south = state.getValue(PropertyHolder.CONNECTED_SOUTH);
            boolean west = state.getValue(PropertyHolder.CONNECTED_WEST);
            boolean up = state.getValue(PropertyHolder.CONNECTED_UP);
            boolean down = state.getValue(PropertyHolder.CONNECTED_DOWN);
            EnumConnection connection = EnumConnection.getForBooleansAndFacing(side, up, down, north , east, south, west);
            boolean formed = state.getValue(PropertyHolder.FORMED);
            BakedQuad quad = baseModel.getQuads(state, side, rand).get(0);
            switch (type)
            {
                case CASING:
                {
                    if (formed && connection != EnumConnection.NONE)
                    {
                        quads.add(createNewQuadFromExisting(quad, baseSprites.get(connection)));
                        break;
                    }
                    else
                    {
                        quads.add(quad);
                        break;
                    }
                }
                case CONTROLLER:
                {
                    if (side == facing)
                    {
                        boolean active = state.getValue(PropertyHolder.ACTIVE);
                        TextureAtlasSprite sprite = specialSprites.get(BlockReactorComponent.EnumType.CONTROLLER.toString() + (formed ? ("_" + active) : "")).get(connection);
                        quads.add(createNewQuadFromExisting(quad, sprite));
                        break;
                    }
                    else
                    {
                        if (formed && connection != EnumConnection.NONE)
                        {
                            quads.add(createNewQuadFromExisting(quad, baseSprites.get(connection)));
                            break;
                        }
                        else
                        {
                            quads.add(quad);
                            break;
                        }
                    }
                }
                case COMPUTER:
                {
                    if (side == facing && formed)
                    {
                        TextureAtlasSprite sprite = specialSprites.get(BlockReactorComponent.EnumType.COMPUTER.toString()).get(connection);
                        quads.add(createNewQuadFromExisting(quad, sprite));
                        break;
                    }
                    else
                    {
                        if (formed && connection != EnumConnection.NONE)
                        {
                            quads.add(createNewQuadFromExisting(quad, baseSprites.get(connection)));
                            break;
                        }
                        else
                        {
                            quads.add(quad);
                            break;
                        }
                    }
                }
                case PORT:
                {
                    if (side == facing)
                    {
                        boolean input = state.getValue(PropertyHolder.INPUT);
                        TextureAtlasSprite sprite = specialSprites.get(BlockReactorComponent.EnumType.PORT.toString() + (formed ? ("_" + input) : "")).get(connection);
                        quads.add(createNewQuadFromExisting(quad, sprite));
                        break;
                    }
                    else
                    {
                        if (formed && connection != EnumConnection.NONE)
                        {
                            quads.add(createNewQuadFromExisting(quad, baseSprites.get(connection)));
                            break;
                        }
                        else
                        {
                            quads.add(quad);
                            break;
                        }
                    }
                }
                case FLUID_PORT:
                {
                    if (side == facing)
                    {
                        boolean input = state.getValue(PropertyHolder.INPUT);
                        TextureAtlasSprite sprite = specialSprites.get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + (formed ? ("_" + input) : "")).get(connection);
                        quads.add(createNewQuadFromExisting(quad, sprite));
                        break;
                    }
                    else
                    {
                        if (formed && connection != EnumConnection.NONE)
                        {
                            quads.add(createNewQuadFromExisting(quad, baseSprites.get(connection)));
                            break;
                        }
                        else
                        {
                            quads.add(quad);
                            break;
                        }
                    }
                }
                case GLASS:
                {
                    if (connection != EnumConnection.NONE)
                    {
                        quads.add(createNewQuadFromExisting(quad, specialSprites.get(BlockReactorComponent.EnumType.GLASS.toString()).get(connection)));
                        break;
                    }
                    else
                    {
                        quads.add(quad);
                        break;
                    }
                }
                case CONTROL_ROD:
                {
                    if ((side == EnumFacing.UP || side == EnumFacing.DOWN) && formed && connection != EnumConnection.NONE)
                    {
                        TextureAtlasSprite sprite = specialSprites.get(BlockReactorComponent.EnumType.COMPUTER.toString()).get(connection);
                        quads.add(createNewQuadFromExisting(quad, sprite));
                        break;
                    }
                    else
                    {
                        quads.add(quad);
                        break;
                    }
                }
                case REDSTONE:
                {
                    if (side == facing)
                    {
                        boolean active = state.getValue(PropertyHolder.ACTIVE);
                        TextureAtlasSprite sprite = specialSprites.get(BlockReactorComponent.EnumType.REDSTONE.toString() + (formed ? ("_" + active) : "")).get(connection);
                        quads.add(createNewQuadFromExisting(quad, sprite));
                        break;
                    }
                    else
                    {
                        if (formed && connection != EnumConnection.NONE)
                        {
                            quads.add(createNewQuadFromExisting(quad, baseSprites.get(connection)));
                            break;
                        }
                        else
                        {
                            quads.add(quad);
                            break;
                        }
                    }
                }
                default:
                {
                    quads.addAll(baseModel.getQuads(state, side, rand));
                }
            }
            return quads;
        }
        return baseModel.getQuads(state, side, rand);
    }

    @Override
    public boolean isGui3d()
    {
        return true;
    }

    @Override
    public boolean isAmbientOcclusion()
    {
        return baseModel.isAmbientOcclusion();
    }

    @Override
    public boolean isBuiltInRenderer()
    {
        return false;
    }

    @Override
    public ItemCameraTransforms getItemCameraTransforms()
    {
        return baseModel.getItemCameraTransforms();
    }

    @Override
    public TextureAtlasSprite getParticleTexture()
    {
        return baseModel.getParticleTexture();
    }

    private BakedQuad createNewQuadFromExisting(BakedQuad quad, TextureAtlasSprite sprite)
    {
        int[] vd = changeTextureUV(quad.getVertexData(), sprite);
        return new BakedQuad(vd, quad.getTintIndex(), quad.getFace(), sprite, quad.shouldApplyDiffuseLighting(), quad.getFormat());
    }

    private int[] changeTextureUV(int[] vd, TextureAtlasSprite sprite)
    {
        int[] vertices = new int[28];
        vertices[0]  = vd[0]; //x
        vertices[1]  = vd[1]; //y
        vertices[2]  = vd[2]; //z
        vertices[3]  = vd[3]; //color
        vertices[4]  = Float.floatToRawIntBits(sprite.getInterpolatedU(16)); //u
        vertices[5]  = Float.floatToRawIntBits(sprite.getInterpolatedV(16)); //v
        vertices[6]  = vd[6]; //unused

        vertices[7]  = vd[7]; //x
        vertices[8]  = vd[8]; //y
        vertices[9]  = vd[9]; //z
        vertices[10] = vd[10]; //color
        vertices[11] = Float.floatToRawIntBits(sprite.getInterpolatedU(16)); //u
        vertices[12] = Float.floatToRawIntBits(sprite.getInterpolatedV(0)); //v
        vertices[13] = vd[13]; //unused

        vertices[14] = vd[14]; //x
        vertices[15] = vd[15]; //y
        vertices[16] = vd[16]; //z
        vertices[17] = vd[17]; //color
        vertices[18] = Float.floatToRawIntBits(sprite.getInterpolatedU(0)); //u
        vertices[19] = Float.floatToRawIntBits(sprite.getInterpolatedV(0)); //v
        vertices[20] = vd[20]; //unused

        vertices[21] = vd[21]; //x
        vertices[22] = vd[22]; //y
        vertices[23] = vd[23]; //z
        vertices[24] = vd[24]; //color
        vertices[25] = Float.floatToRawIntBits(sprite.getInterpolatedU(0)); //u
        vertices[26] = Float.floatToRawIntBits(sprite.getInterpolatedV(16)); //v
        vertices[27] = vd[27]; //unused
        return vertices;
    }
}

 

I already checked that the sprites exist and the model is replaced with the custom one.

Link to comment
Share on other sites

I know why I am getting a null IBlockState, that's not the problem. The problem is that it is never called with a non-null IBlockState. I am calling ModelLoader.setCustomModelLocation for every possble metadata value and in the ModelBakeEvent I am replacing the loaded model for every variant with my custom one while using the loaded model in the custom one.

Link to comment
Share on other sites

As I said the block has the right model when placed but the special stuff done by the custom IBakedModel doesn't work. As the ModelResourceLocations of the blocks are all stored in a map and those ModelResourceLocations are also used to register the models to the itemblocks and if I hold the itemblock, the getQuads method is called and the model has the right variant.

Link to comment
Share on other sites

Every variant of the block has a basic appearance (no connections, the controller is grey, etc) and under certain circumstances they should change there appearance. The controller turns red when the multiblock is formed and green when the machine is active and every texture has various versions for smooth connections. If I now place the custom glass block it has the right base model but when multiple of them are adjacent to each other the textures do not connect. I also checked that the booleans for the block checks on each side of the block are correct.

Link to comment
Share on other sites

The fact that the getQuads method is never called with a non-null IBlockState meaning that it is never called for a block placed in the world.

Link to comment
Share on other sites

In my block class I override:

@Override
    protected BlockBaseTR registerCustomModelLocations(HashMap<BlockBaseTR, ArrayList<ModelResourceLocation>> locations)
    {
        ArrayList<ModelResourceLocation> list = new ArrayList<ModelResourceLocation>();
        for (EnumType type : EnumType.values())
        {
            list.add(new ModelResourceLocation(this.getRegistryName(), type.getName()));
        }
        locations.get(this).addAll(list);
        return this;
    }

The method is called from the constructor in the base block class (BlockBaseTR)

 

This is called in preInit in TRClient to bind the models to the items:

ModelLoader.setCustomStateMapper(TRContent.blockReactorComponent, new StateMap.Builder().ignore(PropertyHolder.CONNECTED_UP, PropertyHolder.CONNECTED_DOWN,
        PropertyHolder.CONNECTED_NORTH, PropertyHolder.CONNECTED_EAST, PropertyHolder.CONNECTED_SOUTH, PropertyHolder.CONNECTED_WEST).build());
        for (BlockReactorComponent.EnumType type : BlockReactorComponent.EnumType.values())
        {
            ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TRContent.blockReactorComponent), type.getMeta(), new ModelResourceLocation(Reference.MOD_ID + ":blockReactorComponent", type.getName()));
        }

 

In the ModelBakeEvent in my ModelBakeHandler I replace the models:

for (ModelResourceLocation location : locations.get(TRContent.blockReactorComponent))
        {
            LogHelper.info("Location: " + location.getResourceDomain() + ":" + location.getResourcePath() + ", Variant: " + location.getVariant());
            IBakedModel baseModel = event.getModelRegistry().getObject(location);
            ModelReactorComponent replacement = new ModelReactorComponent(baseModel,
                    ClientEventHandler.INSTANCE.getBaseSprites(TRContent.blockReactorComponent),
                    ClientEventHandler.INSTANCE.getSpecialSprites(TRContent.blockReactorComponent),
                    BlockReactorComponent.EnumType.valueOf(location.getVariant().toUpperCase()));
            event.getModelRegistry().putObject(location, replacement);
        }

 

I know that I am not using the ModelResourceLocations from the HashMap I have in my ModelBakeHandler class but because the item models call getQuads in my custom IBakedModel I think I can safely asume that the ModelResourceLocations stored in the HashMap are correct.

Link to comment
Share on other sites

My block has an property of type EnumFacing, 6 of type boolean for the connected textures, one of type EnumType (custom enum for the different sub blocks), one of type boolean for the activity of the machine and one of type boolean for the input status of two sub blocks.

 

I will look into the ModelResourceLocations the StateMapper produces. How should I ideally go about doing this?

 

I have not yet put a breakpoint into the ModelBakeHandler but I assume that it does what I expect it to do. I will look into this nontheless.

 

This is my ModelBakeHandler:

package XFactHD.thermalreactors.client.render.utils;

import XFactHD.thermalreactors.client.render.models.ModelFuelRod;
import XFactHD.thermalreactors.client.render.models.ModelReactorComponent;
import XFactHD.thermalreactors.client.utils.ClientEventHandler;
import XFactHD.thermalreactors.common.TRContent;
import XFactHD.thermalreactors.common.blocks.BlockBaseTR;
import XFactHD.thermalreactors.common.blocks.machine.fissionReactor.BlockReactorComponent;
import XFactHD.thermalreactors.common.utils.LogHelper;
import XFactHD.thermalreactors.common.utils.Reference;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.ArrayList;
import java.util.HashMap;

@SuppressWarnings("unused")
public enum  ModelBakeHandler
{
    INSTANCE;

    public static HashMap<BlockBaseTR, ArrayList<ModelResourceLocation>> locations = new HashMap<BlockBaseTR, ArrayList<ModelResourceLocation>>();

    @SubscribeEvent
    public void bake(ModelBakeEvent event)
    {
        IBakedModel uranium_0 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_0"));
        IBakedModel uranium_1 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_1"));
        IBakedModel uranium_2 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_2"));
        IBakedModel uranium_3 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_3"));
        IBakedModel uranium_4 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_4"));
        IBakedModel[] modelsUranium = new IBakedModel[5];
        modelsUranium[0] = uranium_0;
        modelsUranium[1] = uranium_1;
        modelsUranium[2] = uranium_2;
        modelsUranium[3] = uranium_3;
        modelsUranium[4] = uranium_4;
        IBakedModel newModelUranium = new ModelFuelRod(modelsUranium);
        event.getModelRegistry().putObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium"), newModelUranium);

        IBakedModel mox_0 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_0"));
        IBakedModel mox_1 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_1"));
        IBakedModel mox_2 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_2"));
        IBakedModel mox_3 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_3"));
        IBakedModel mox_4 = event.getModelRegistry().getObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_4"));
        IBakedModel[] modelsMOX = new IBakedModel[5];
        modelsMOX[0] = mox_0;
        modelsMOX[1] = mox_1;
        modelsMOX[2] = mox_2;
        modelsMOX[3] = mox_3;
        modelsMOX[4] = mox_4;
        IBakedModel newModelMOX = new ModelFuelRod(modelsMOX);
        event.getModelRegistry().putObject(new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox"), newModelMOX);

        for (ModelResourceLocation location : locations.get(TRContent.blockReactorComponent))
        {
            LogHelper.info("Location: " + location.getResourceDomain() + ":" + location.getResourcePath() + ", Variant: " + location.getVariant());
            IBakedModel baseModel = event.getModelRegistry().getObject(location);
            ModelReactorComponent replacement = new ModelReactorComponent(baseModel,
                    ClientEventHandler.INSTANCE.getBaseSprites(TRContent.blockReactorComponent),
                    ClientEventHandler.INSTANCE.getSpecialSprites(TRContent.blockReactorComponent),
                    BlockReactorComponent.EnumType.valueOf(location.getVariant().toUpperCase()));
            event.getModelRegistry().putObject(location, replacement);
        }
    }
}

 

This is my ClientEventHandler:

package XFactHD.thermalreactors.client.utils;

import XFactHD.thermalreactors.client.render.utils.EnumConnection;
import XFactHD.thermalreactors.common.TRContent;
import XFactHD.thermalreactors.common.blocks.BlockBaseTR;
import XFactHD.thermalreactors.common.blocks.machine.fissionReactor.BlockReactorComponent;
import XFactHD.thermalreactors.common.blocks.machine.turbine.BlockTurbineComponent;
import XFactHD.thermalreactors.common.utils.Reference;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.HashMap;

@SuppressWarnings({"unused", "unchecked"})
public enum ClientEventHandler
{
    INSTANCE;

    private HashMap<BlockBaseTR, HashMap<EnumConnection, TextureAtlasSprite>> baseSprites = new HashMap<BlockBaseTR, HashMap<EnumConnection, TextureAtlasSprite>>();
    private HashMap<BlockBaseTR, HashMap<String, HashMap<EnumConnection, TextureAtlasSprite>>> specialSprites = new HashMap<BlockBaseTR, HashMap<String, HashMap<EnumConnection, TextureAtlasSprite>>>();
    public TextureAtlasSprite connectionIn = null;
    public TextureAtlasSprite connectionOut = null;
    public TextureAtlasSprite connectionNone = null;
    public TextureAtlasSprite[] energyLevel = new TextureAtlasSprite[9];

    @SubscribeEvent
    public void stitch(TextureStitchEvent.Pre event)
    {
        stitchEnergyCellSprites(event);
        stitchFissionReactorSprites(event);
        stitchFusionReactorSprites(event);
        stitchTurbineSprites(event);
    }

    private void stitchEnergyCellSprites(TextureStitchEvent.Pre event)
    {
        connectionIn = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/connection_in"));
        connectionOut = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/connection_out"));
        connectionNone = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/connection_none"));

        energyLevel[0] = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/display_0"));
        energyLevel[1] = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/display_1"));
        energyLevel[2] = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/display_2"));
        energyLevel[3] = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/display_3"));
        energyLevel[4] = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/display_4"));
        energyLevel[5] = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/display_5"));
        energyLevel[6] = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/display_6"));
        energyLevel[7] = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/display_7"));
        energyLevel[8] = event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/miscellaneous/energyCell/display_8"));
    }

    private void stitchFissionReactorSprites(TextureStitchEvent.Pre event)
    {
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.T   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_T")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.B   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_B")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.R   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_R")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.L   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_L")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.TB  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_TB")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.RL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_RL")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.TR  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_TR")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.TL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_TL")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.BR  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_BR")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.BL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_BL")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.TBR , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_TBR")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.TBL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_TBL")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.TRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_TRL")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.BRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_BRL")));
        baseSprites.get(TRContent.blockReactorComponent).put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Base_TBRL")));

        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.COMPUTER.toString()).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ComputerFront")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.COMPUTER.toString()).put(EnumConnection.TRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ComputerFront_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.COMPUTER.toString()).put(EnumConnection.BRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ComputerFront_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.COMPUTER.toString()).put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ComputerFront_TBRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.COMPUTER.toString()).put(EnumConnection.RL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ComputerFront_RL")));

        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.CONTROLLER.toString()).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ControllerFront")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_false").put(EnumConnection.RL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ControllerFrontActive_RL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_false").put(EnumConnection.TRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ControllerFrontActive_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_false").put(EnumConnection.BRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ControllerFrontActive_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_false").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ControllerFrontActive_TBRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_true").put(EnumConnection.RL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ControllerFrontInactive_RL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_true").put(EnumConnection.TRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ControllerFrontInactive_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_true").put(EnumConnection.BRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ControllerFrontInactive_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_true").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_ControllerFrontInactive_TBRL")));

        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.T   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_T")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.B   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_B")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.R   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_R")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.L   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_L")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.TB  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_TB")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.RL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_RL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.TR  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_TR")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.TL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_TL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.BR  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_BR")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.BL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_BL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.TBR , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_TBR")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.TBL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_TBL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.TRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.BRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.GLASS.toString()).put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_Glass_TBRL")));

        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.REDSTONE.toString()).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_RedstoneFront")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.REDSTONE.toString() + "_false").put(EnumConnection.RL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_RedstoneFront_Off_RL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.REDSTONE.toString() + "_false").put(EnumConnection.TRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_RedstoneFront_Off_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.REDSTONE.toString() + "_false").put(EnumConnection.BRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_RedstoneFront_Off_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.REDSTONE.toString() + "_false").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_RedstoneFront_Off_TBRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.REDSTONE.toString() + "_true").put(EnumConnection.RL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_RedstoneFront_On_RL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.REDSTONE.toString() + "_true").put(EnumConnection.TRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_RedstoneFront_On_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.REDSTONE.toString() + "_true").put(EnumConnection.BRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_RedstoneFront_On_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.REDSTONE.toString() + "_true").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_RedstoneFront_On_TBRL")));

        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_true").put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontIn")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_true").put(EnumConnection.RL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontIn_Formed_RL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_true").put(EnumConnection.TRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontIn_Formed_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_true").put(EnumConnection.BRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontIn_Formed_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_true").put(EnumConnection.TBR , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontIn_Formed_TBR")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_true").put(EnumConnection.TBL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontIn_Formed_TBL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_true").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontIn_Formed_TBRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_false").put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontOut")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_false").put(EnumConnection.RL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontOut_Formed_RL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_false").put(EnumConnection.TRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontOut_Formed_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_false").put(EnumConnection.BRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontOut_Formed_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_false").put(EnumConnection.TBR , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontOut_Formed_TBR")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_false").put(EnumConnection.TBL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontOut_Formed_TBL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.PORT.toString() + "_false").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_PortFrontOut_Formed_TBRL")));

        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_true").put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontIn")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_true").put(EnumConnection.RL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontIn_Formed_RL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_true").put(EnumConnection.TRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontIn_Formed_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_true").put(EnumConnection.BRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontIn_Formed_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_true").put(EnumConnection.TBR , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontIn_Formed_TBR")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_true").put(EnumConnection.TBL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontIn_Formed_TBL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_true").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontIn_Formed_TBRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_false").put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontOut")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_false").put(EnumConnection.RL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontOut_Formed_RL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_false").put(EnumConnection.TRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontOut_Formed_TRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_false").put(EnumConnection.BRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontOut_Formed_BRL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_false").put(EnumConnection.TBR , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontOut_Formed_TBR")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_false").put(EnumConnection.TBL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontOut_Formed_TBL")));
        specialSprites.get(TRContent.blockReactorComponent).get(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_false").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/reactorFission/blockReactorComponent_FluidPortFrontOut_Formed_TBRL")));
    }

    private void stitchFusionReactorSprites(TextureStitchEvent.Pre event)
    {

    }

    private void stitchTurbineSprites(TextureStitchEvent.Pre event)
    {
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.T   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_T")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.B   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_B")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.R   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_R")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.L   , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_L")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.TB  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_TB")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.RL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_RL")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.TR  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_TR")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.TL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_TL")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.BR  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_BR")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.BL  , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_BL")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.TBR , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_TBR")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.TBL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_TBL")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.TRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_TRL")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.BRL , event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_BRL")));
        baseSprites.get(TRContent.blockTurbineComponent).put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Base_TBRL")));

        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COIL.toString()).put(EnumConnection.BR, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Coil_BR")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COIL.toString()).put(EnumConnection.BRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Coil_BRL")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COIL.toString()).put(EnumConnection.BL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Coil_BL")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COIL.toString()).put(EnumConnection.TBR, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Coil_TBR")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COIL.toString()).put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Coil_TBRL")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COIL.toString()).put(EnumConnection.TBL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Coil_TBL")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COIL.toString()).put(EnumConnection.TR, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Coil_TR")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COIL.toString()).put(EnumConnection.TRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Coil_TRL")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COIL.toString()).put(EnumConnection.TL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_Coil_TL")));

        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.CONTROLLER.toString()).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_ControllerFront")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.CONTROLLER.toString() + "_false").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_ControllerFrontInactive_TBRL")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.CONTROLLER.toString() + "_true").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_ControllerFrontActive_TBRL")));

        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.ENERGY_PORT.toString()).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_EnergyFront")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.ENERGY_PORT.toString()).put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_EnergyFront_TBRL")));

        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.REDSTONE.toString()).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_RedstoneFront")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.REDSTONE.toString() + "_false").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_RedstoneFront_Off_TBRL")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.REDSTONE.toString() + "_true").put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_RedstoneFront_On_TBRL")));

        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.FLUID_PORT.toString() + "_true").put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_FluidPortFrontIn")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.FLUID_PORT.toString() + "_true").put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_FluidPortFrontIn_TBRL")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.FLUID_PORT.toString() + "_false").put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_FluidPortFrontOut")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.FLUID_PORT.toString() + "_false").put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_FluidPortFrontOut_TBRL")));

        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COMPUTER.toString()).put(EnumConnection.NONE, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_ComputerFront")));
        specialSprites.get(TRContent.blockTurbineComponent).get(BlockTurbineComponent.EnumType.COMPUTER.toString()).put(EnumConnection.TBRL, event.getMap().registerSprite(new ResourceLocation(Reference.MOD_ID, "blocks/turbine/blockTurbineComponent_ComputerFront_TBRL")));
    }

    private void stitchFluidSprites(TextureStitchEvent.Pre event)
    {
        //TODO: check if this is needed
    }

    public HashMap<EnumConnection, TextureAtlasSprite> getBaseSprites(BlockBaseTR block)
    {
        return baseSprites.get(block);
    }

    public HashMap<String, HashMap<EnumConnection, TextureAtlasSprite>> getSpecialSprites(BlockBaseTR block)
    {
        return specialSprites.get(block);
    }

    public void setupTextureMaps(BlockBaseTR block)
    {
        HashMap<EnumConnection, TextureAtlasSprite> connection = new HashMap<EnumConnection, TextureAtlasSprite>();
        connection.put(EnumConnection.NONE, null);
        connection.put(EnumConnection.T, null);
        connection.put(EnumConnection.B, null);
        connection.put(EnumConnection.R, null);
        connection.put(EnumConnection.L, null);
        connection.put(EnumConnection.TB, null);
        connection.put(EnumConnection.RL, null);
        connection.put(EnumConnection.TR, null);
        connection.put(EnumConnection.TL, null);
        connection.put(EnumConnection.BR, null);
        connection.put(EnumConnection.BL, null);
        connection.put(EnumConnection.TBR, null);
        connection.put(EnumConnection.TBL, null);
        connection.put(EnumConnection.TRL, null);
        connection.put(EnumConnection.BRL, null);
        connection.put(EnumConnection.TBRL, null);
        baseSprites.put(block, connection);
        HashMap<String, HashMap<EnumConnection, TextureAtlasSprite>> special = new HashMap<String, HashMap<EnumConnection, TextureAtlasSprite>>();
        if (block.getSpecialsEnum() != null)
        {
            for (String value : block.getSpecialsEnum())
            {
                special.put(value, (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
            }
            if (block instanceof BlockReactorComponent)
            {
                special.put(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_false", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockReactorComponent.EnumType.CONTROLLER.toString() + "_true", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockReactorComponent.EnumType.REDSTONE.toString() + "_false", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockReactorComponent.EnumType.REDSTONE.toString() + "_true", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockReactorComponent.EnumType.PORT.toString() + "_false", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockReactorComponent.EnumType.PORT.toString() + "_true", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_false", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockReactorComponent.EnumType.FLUID_PORT.toString() + "_true", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
            }
            else if (block instanceof BlockTurbineComponent)
            {
                special.put(BlockTurbineComponent.EnumType.CONTROLLER.toString() + "_false", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockTurbineComponent.EnumType.CONTROLLER.toString() + "_true", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockTurbineComponent.EnumType.REDSTONE.toString() + "_false", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockTurbineComponent.EnumType.REDSTONE.toString() + "_true", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockTurbineComponent.EnumType.FLUID_PORT.toString() + "_false", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
                special.put(BlockTurbineComponent.EnumType.FLUID_PORT.toString() + "_true", (HashMap<EnumConnection, TextureAtlasSprite>) connection.clone());
            }
            specialSprites.put(block, special);
        }
    }
}

 

This is my TRClient class:

public class TRClient
{
    static void preInit()
    {
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TRContent.blockEnergyCellPlutonium), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockEnergyCellPlutonium", "inventory"));
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TRContent.blockEnergyCellPlasma), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockEnergyCellPlasma", "inventory"));
        ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEnergyCellPlasma.class, new TileEntityEnergyCellPlasmaRenderer());
        ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEnergyCellPlutonium.class, new TileEntityEnergyCellPlutoniumRenderer());

        ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLeadChest.class, new TileEntityLeadChestRenderer());
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TRContent.blockLeadChest), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockLeadChest", "inventory"));

        ModelLoader.setCustomStateMapper(TRContent.blockReactorComponent, new StateMap.Builder().ignore(PropertyHolder.CONNECTED_UP, PropertyHolder.CONNECTED_DOWN,
        PropertyHolder.CONNECTED_NORTH, PropertyHolder.CONNECTED_EAST, PropertyHolder.CONNECTED_SOUTH, PropertyHolder.CONNECTED_WEST).build());
        for (BlockReactorComponent.EnumType type : BlockReactorComponent.EnumType.values())
        {
            ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TRContent.blockReactorComponent), type.getMeta(), new ModelResourceLocation(Reference.MOD_ID + ":blockReactorComponent", type.getName()));
        }

        //ModelLoader.setCustomStateMapper(TRContent.blockFusionComponent, new StateMap.Builder().ignore(PropertyHolder.CONNECTED_UP, PropertyHolder.CONNECTED_DOWN,
        //PropertyHolder.CONNECTED_NORTH, PropertyHolder.CONNECTED_EAST, PropertyHolder.CONNECTED_SOUTH, PropertyHolder.CONNECTED_WEST).build());
        //for (BlockFusionComponent.EnumType type : BlockFusionComponent.EnumType.values())
        //{
        //    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TRContent.blockFusionComponent), type.getMeta(), new ModelResourceLocation(Reference.MOD_ID + ":blockFusionComponent", type.getName()));
        //}

        ModelLoader.setCustomStateMapper(TRContent.blockTurbineComponent, new StateMap.Builder().ignore(PropertyHolder.CONNECTED_UP, PropertyHolder.CONNECTED_DOWN,
        PropertyHolder.CONNECTED_NORTH, PropertyHolder.CONNECTED_EAST, PropertyHolder.CONNECTED_SOUTH, PropertyHolder.CONNECTED_WEST).build());
        for (BlockTurbineComponent.EnumType type : BlockTurbineComponent.EnumType.values())
        {
            ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(TRContent.blockTurbineComponent), type.getMeta(), new ModelResourceLocation(Reference.MOD_ID + ":blockTurbineComponent", type.getName()));
        }

        ModelLoader.setCustomModelResourceLocation(TRContent.itemFuelRod, 0, new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium"));
        ModelLoader.registerItemVariants(TRContent.itemFuelRod,
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_0"),
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_1"),
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_2"),
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_3"),
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "uranium_4"));

        ModelLoader.setCustomModelResourceLocation(TRContent.itemFuelRod, 1, new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox"));
        ModelLoader.registerItemVariants(TRContent.itemFuelRod,
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_0"),
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_1"),
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_2"),
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_3"),
                new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "mox_4"));

        ModelLoader.setCustomModelResourceLocation(TRContent.itemFuelRod, 2, new ModelResourceLocation(Reference.MOD_ID + ":itemFuelRod", "empty"));
    }

    static void init()
    {

    }

    static void postInit()
    {

    }
}

 

This is my base block:

package XFactHD.thermalreactors.common.blocks;

import XFactHD.thermalreactors.api.block.IMultiblockPart;
import XFactHD.thermalreactors.client.render.utils.ModelBakeHandler;
import XFactHD.thermalreactors.client.utils.ClientEventHandler;
import XFactHD.thermalreactors.common.utils.Reference;
import XFactHD.thermalreactors.ThermalReactors;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

public class BlockBaseTR extends Block
{
    private String name;
    private boolean hasSubtypes;
    private String[] specialsEnum;

    public BlockBaseTR(String name, Material material, boolean hasSubtypes, String[] specialsEnum)
    {
        super(material);
        this.name = name;
        this.hasSubtypes = hasSubtypes;
        this.setCreativeTab(ThermalReactors.creativeTab);
        this.setRegistryName(name);
        this.setUnlocalizedName(Reference.MOD_ID + ":" + name);
        this.specialsEnum = specialsEnum;
        if (FMLCommonHandler.instance().getEffectiveSide().isClient())
        {
            if (this instanceof IMultiblockPart)
            {
                this.setupModelsAndTextureMaps();
            }
            this.registerCustomModelLocations(ModelBakeHandler.locations);
        }
        GameRegistry.register(this);
    }

    protected BlockBaseTR addItemBlock()
    {
        return addItemBlock(null);
    }

    protected BlockBaseTR addItemBlock(ItemBlockBaseTR itemBlock)
    {
        if (itemBlock == null)
        {
            itemBlock = new ItemBlockBaseTR(this, hasSubtypes);
        }
        itemBlock.setRegistryName(name);
        GameRegistry.register(itemBlock);
        return this;
    }

    @SideOnly(Side.CLIENT)
    protected BlockBaseTR registerCustomModelLocations(HashMap<BlockBaseTR, ArrayList<ModelResourceLocation>> locations)
    {
        return this;
    }

    @SideOnly(Side.CLIENT)
    private BlockBaseTR setupModelsAndTextureMaps()
    {
        ModelBakeHandler.locations.put(this, new ArrayList<ModelResourceLocation>());
        ClientEventHandler.INSTANCE.setupTextureMaps(this);
        return this;
    }

    @Override
    public int damageDropped(IBlockState state)
    {
        return this.getMetaFromState(state);
    }

    @Override
    public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list)
    {
        if (specialsEnum != null && specialsEnum.length > 1)
        {
            for(int i=0; i < specialsEnum.length; i++)
            {
                list.add(new ItemStack(item, 1, i));
            }
        }
        else
        {
            list.add(new ItemStack(item, 1, 0));
        }
    }

    ArrayList<String> getSubNames()
    {
        ArrayList<String> subnames = new ArrayList<String>();
        subnames.addAll(Arrays.asList(specialsEnum));
        return subnames;
    }

    @Override
    public boolean hasTileEntity(IBlockState state)
    {
        return true;
    }

    @Override
    public boolean canCreatureSpawn(IBlockState state, IBlockAccess world, BlockPos pos, EntityLiving.SpawnPlacementType type)
    {
        return !(state.getBlock() instanceof BlockSimpleTR);
    }
    
    public String[] getSpecialsEnum()
    {
        return specialsEnum;
    }
}

 

This is the block we are talking about:

package XFactHD.thermalreactors.common.blocks.machine.fissionReactor;

import XFactHD.thermalreactors.api.block.IMultiblockPart;
import XFactHD.thermalreactors.api.block.ITileMultiblockPart;
import XFactHD.thermalreactors.common.blocks.BlockBaseTR;
import XFactHD.thermalreactors.common.blocks.ItemBlockBaseTR;
import XFactHD.thermalreactors.common.utils.LogHelper;
import XFactHD.thermalreactors.common.utils.Reference;
import XFactHD.thermalreactors.common.utils.property.PropertyHolder;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@SuppressWarnings("deprecation")
public class BlockReactorComponent extends BlockBaseTR implements IMultiblockPart
{
    public BlockReactorComponent()
    {
        super("blockReactorComponent", Material.IRON, true, EnumType.getValuesAsStrings());
        addItemBlock();
    }

    @Override
    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, PropertyHolder.FISSION_TYPE, PropertyHolder.ORIENTATION_CARDINAL, PropertyHolder.CONNECTED_DOWN, PropertyHolder.CONNECTED_UP,
                PropertyHolder.CONNECTED_NORTH, PropertyHolder.CONNECTED_SOUTH, PropertyHolder.CONNECTED_WEST, PropertyHolder.CONNECTED_EAST, PropertyHolder.ACTIVE,
                PropertyHolder.INPUT);
    }

    @Override
    public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
    {
        boolean up;
        boolean down;
        boolean north;
        boolean south;
        boolean west;
        boolean east;
        if (state.getValue(PropertyHolder.FISSION_TYPE) == EnumType.GLASS)
        {
            up    = world.getBlockState( pos.up()    ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.up()    ).getValue(PropertyHolder.FISSION_TYPE) == EnumType.GLASS;
            down  = world.getBlockState( pos.down()  ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.down()  ).getValue(PropertyHolder.FISSION_TYPE) == EnumType.GLASS;
            north = world.getBlockState( pos.north() ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.north() ).getValue(PropertyHolder.FISSION_TYPE) == EnumType.GLASS;
            south = world.getBlockState( pos.south() ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.south() ).getValue(PropertyHolder.FISSION_TYPE) == EnumType.GLASS;
            west  = world.getBlockState( pos.west()  ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.west()  ).getValue(PropertyHolder.FISSION_TYPE) == EnumType.GLASS;
            east  = world.getBlockState( pos.east()  ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.east()  ).getValue(PropertyHolder.FISSION_TYPE) == EnumType.GLASS;
        }
        else
        {
            up    = world.getBlockState( pos.up()    ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.up()    ).getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS;
            down  = world.getBlockState( pos.down()  ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.down()  ).getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS;
            north = world.getBlockState( pos.north() ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.north() ).getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS;
            south = world.getBlockState( pos.south() ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.south() ).getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS;
            west  = world.getBlockState( pos.west()  ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.west()  ).getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS;
            east  = world.getBlockState( pos.east()  ).getBlock() instanceof BlockReactorComponent && world.getBlockState( pos.east()  ).getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS;
        }

        EnumFacing facing = /*((TileEntityOrientable)world.getTileEntity(pos)).getFacing()*/EnumFacing.NORTH;

        IBlockState blockState = state.withProperty(PropertyHolder.CONNECTED_UP, up).withProperty(PropertyHolder.CONNECTED_DOWN, down).withProperty(PropertyHolder.CONNECTED_NORTH, north)
                .withProperty(PropertyHolder.CONNECTED_SOUTH, south).withProperty(PropertyHolder.CONNECTED_WEST, west).withProperty(PropertyHolder.CONNECTED_EAST, east)
                .withProperty(PropertyHolder.ORIENTATION_CARDINAL, facing);

        if (state.getValue(PropertyHolder.FISSION_TYPE) == EnumType.GLASS)
        {
            return blockState;
        }

        if (state.getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS)
        {
            //TODO: readd once TileEntitys exist
            //blockState = blockState.withProperty(PropertyHolder.FORMED, ((ITileMultiblockPart)world.getTileEntity(pos)).getIsFormed());
            EnumType type = state.getValue(PropertyHolder.FISSION_TYPE);
            //if (type == EnumType.CONTROLLER)
            //{
            //    TileEntityReactorController tile = (TileEntityReactorController)world.getTileEntity(pos);
            //    return blockState.withProperty(PropertyHolder.ACTIVE, tile.getActive());
            //}
            //else if (type == EnumType.PORT)
            //{
            //    TileEntityReactorPort tile = (TileEntityReactorPort)world.getTileEntity(pos);
            //    return blockState.withProperty(PropertyHolder.INPUT, tile.isInput);
            //}
            //else if (type == EnumType.FLUID_PORT)
            //{
            //    TileEntityReactorFluidPort tile = (TileEntityReactorFluidPort)world.getTileEntity(pos);
            //    return blockState.withProperty(PropertyHolder.INPUT, tile.isInput);
            //}
            //else if (type == EnumType.REDSTONE)
            //{
            //    TileEntityReactorRedstonePort tile = (TileEntityReactorRedstonePort)world.getTileEntity(pos);
            //    return blockState.withProperty(PropertyHolder.ACTIVE, tile.isActive);
            //}
            //else
            //{
                return blockState;
            //}
        }
        else
        {
            return blockState;
        }
    }

    @Override
    public IBlockState getStateFromMeta(int meta)
    {
        return getDefaultState().withProperty(PropertyHolder.FISSION_TYPE, EnumType.getByMeta(meta));
    }

    @Override
    public int getMetaFromState(IBlockState state)
    {
        return state.getValue(PropertyHolder.FISSION_TYPE).getMeta();
    }

    @Override
    public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
    {
        world.markBlockRangeForRenderUpdate(pos.add(-1, -1, -1), pos.add(1, 1, 1));
    }

    @Override
    public boolean isBlockSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
    {
        return world.getBlockState(pos).getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS;
    }

    @Override
    public boolean isOpaqueCube(IBlockState state)
    {
        return state.getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS;
    }

    @Override
    public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
    {
        if (blockState.getValue(PropertyHolder.FISSION_TYPE) == EnumType.GLASS)
        {
            IBlockState adjacentBlock = blockAccess.getBlockState(pos.offset(side));
            if (adjacentBlock.getBlock() != Blocks.AIR && !(adjacentBlock.getBlock() instanceof BlockReactorComponent))
            {
                return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
            }
            else if (adjacentBlock.getBlock() instanceof BlockReactorComponent)
            {
                return adjacentBlock.getValue(PropertyHolder.FISSION_TYPE) != EnumType.GLASS;
            }
        }
        return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
    }

    @Override
    public BlockRenderLayer getBlockLayer()
    {
        return BlockRenderLayer.CUTOUT_MIPPED;
    }

    @Override
    public TileEntity createTileEntity(World world, IBlockState state)
    {
        switch (state.getValue(PropertyHolder.FISSION_TYPE))
        {
            default: return super.createTileEntity(world, state);
        }
    }

    @Override
    protected BlockBaseTR registerCustomModelLocations(HashMap<BlockBaseTR, ArrayList<ModelResourceLocation>> locations)
    {
        ArrayList<ModelResourceLocation> list = new ArrayList<ModelResourceLocation>();
        for (EnumType type : EnumType.values())
        {
            list.add(new ModelResourceLocation(this.getRegistryName(), type.getName()));
        }
        locations.get(this).addAll(list);
        return this;
    }

    public enum EnumType implements IStringSerializable
    {
        CASING      (0, "casing",      "Casing"),
        GLASS       (1, "glass",       "Glass"),
        CONTROLLER  (2, "controller",  "Controller"),
        CORE        (3, "core",        "Core"),
        PORT        (4, "port",        "Port"),
        FLUID_PORT  (5, "fluid_port",  "FluidPort"),
        CONTROL_ROD (6, "control_rod", "ControlRod"),
        REDSTONE    (7, "redstone",    "Redstone"),
        COMPUTER    (8, "computer",    "Computer");

        private int meta;
        private String name;
        private String camelCase;

        EnumType(int meta, String name, String camelCase)
        {
            this.meta = meta;
            this.name = name;
            this.camelCase = camelCase;
        }

        public int getMeta()
        {
            return meta;
        }

        @Override
        public String getName()
        {
            return name;
        }

        public String getNameCamelCase()
        {
            return camelCase;
        }

        public static EnumType getByMeta(int meta)
        {
            switch (meta)
            {
                case 0: return CASING;
                case 1: return GLASS;
                case 2: return CONTROLLER;
                case 3: return CORE;
                case 4: return PORT;
                case 5: return FLUID_PORT;
                case 6: return CONTROL_ROD;
                case 7: return REDSTONE;
                case 8: return COMPUTER;
                default: return null;
            }
        }

        public static String[] getValuesAsStrings()
        {
            String[] strings = new String[values().length];
            for (int i = 0; i < values().length; i++)
            {
                strings[i] = values()[i].toString();
            }
            return strings;
        }
    }
}

Link to comment
Share on other sites

To your first question:

  • The ModelBakeHandler replaces the models loaded from the json files with custom ones that handle special behaviour
  • The ClientEventHandler currently only handles the stitching of additional textures that are needed for the visualisation of the special behaviour
  • The TRClient class handles the stuff that needs to be done in preInit, init or postInit like model registration
  • The base block has two special methods: setupModelsAndTextureMaps prepares the maps were the TextureAtlasSprites will be stored and registerCustomModelLocations adds all ModelResourceLocations needed by the ModelBakeHandler to a list

 

With your second comment you opened my eyes. If I declare a variant without its name (like "type=controller" without the "type=") nothing is gonna work :-\ . And now, what a wonder, the getQuads method is called for the blocks placed in the world.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.