Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.9.4][SOLVED] Transparent Stairs Rendering Logic Problems


SuperGeniusZeb
 Share

Recommended Posts

Warning: This is kind of complex to explain, so get ready for some lengthy paragraphs and lots of code to read.

 

I'm trying to add transparent stairs to my mod. They work flawlessly functionally, but rendering them properly has been a bit difficult. I've written the code properly to prevent x-raying and stuff like that, but the challenge I'm dealing with is determining when to render a side of a stairs. I'm basically taking the same approach as vanilla glass blocks, so that only the front textures render and you get a clear view through several stairs. Obviously, due to the many different shapes of stairs there are some combinations for which this is not possible and you are forced to render the sides, but I wanted to do as much as I could to make the transparent stairs as seamless as possible.

 

I've written out all the logic for rendering of sides based on the orientation, shape, and half (right-side-up or upside-down) of the stairs and the stairs or other blocks adjacent to that side and their rotations, shapes, and etc. and I've checked the logic multiple times and I believe it is fully robust and perfected. However, the actual implementation of that logic is where my problem is. Below you can see all the relevant classes, with StairsSideRenderLogic being the utility class I created to keep all the rendering logic outside of the custom stairs class (for readability's sake). This is where the flaw in my code (or Forge, but I'll get to that later) shows up. Through debugging I believe I have narrowed down the core of the problem being this: trying to get the value of the SHAPE property from the stairs is not giving the expected results. I'm basically taking an IBlockAccess, getting an IBlockState from it, and trying to get the value of the SHAPE property from it. But it keeps returning either the lowest possible value (STRAIGHT) or the highest possible value (OUTER_RIGHT), which of course makes the majority of my checks in the rendering logic fail.

 

When I try to get the values of the FACING or HALF properties of either the stairs being rendered or the adjacent block, it works without a problem. When I try to get the shape of the stairs being rendered, it works. But when I try to get the shape of the adjacent block, it never returns anything other than the aforementioned values. The only differences I can think of is that:

[*]I have an IBlockState for the block whose sides are being rendered, but only an IBlockAccess for the adjacent block, and...

[*]The SHAPE property is not saved to the metadata like the other 2 properties, as it is determined based on adjacent blocks. I don't have a complete understanding of what the difference between an IBlockAccess and an IBlockState is, but I have heard that the former is more limiting, which leads me to believe that an IBlockAccess doesn't know what its complete blockstate is, and only knows what is saved to metadata. If this is the case then I'm not sure what I should do in order to determine the info I need.

 

I should also mention and clarify that all the cases for rendering that don't involve trying to get the SHAPE of the adjacent block work entirely as expected, that everything else concerning rendering works fine and the problem only involves deciding when to render the side of one of the blocks, and this problem, as stated before, does not affect trying to get the SHAPE of the block to be rendered, but only the adjacent block, which is the one I only have an IBlockAccess for.

 

Any ideas? Here are all the classes you'd need to look at to fully understand how my stairs work. Again, StairsSideRenderLogic is the most important one as it is where the problem is, with the others included for context. As I've said before, I believe the logic for rendering is correct, but the ways in which I obtain the info used in the logic is flawed.

 

StairsSideRenderLogic.java (the logic for rendering the sides of stairs.)

package com.supergeniuszeb.colore.utility;

import com.supergeniuszeb.colore.common.blocks.BlockColore;
import com.supergeniuszeb.colore.common.blocks.BlockColoreStairs;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTrans;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTransSlabDouble;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTransSlabHalf;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTransStairs;
import com.supergeniuszeb.colore.common.blocks.EnumShade;
import com.supergeniuszeb.colore.common.blocks.IColorMatcher;

import net.minecraft.block.BlockSlab.EnumBlockHalf;
import net.minecraft.block.BlockStairs.EnumHalf;
import net.minecraft.block.BlockStairs.EnumShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;

public class StairsSideRenderLogic implements IColorMatcher {
//Used to get the side of a stairs relative to its FACING property.
public static EnumFacing getRelativeSide(EnumFacing facing1, EnumFacing facing2) {
	if (facing1 == EnumFacing.EAST) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.WEST;
			case EAST:
				return EnumFacing.NORTH;
			case SOUTH:
				return EnumFacing.EAST;
			case WEST:
				return EnumFacing.SOUTH;
			default:
				break; //Assuming this method is used right, this should never happen.
		}
	}
	if (facing1 == EnumFacing.SOUTH) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.SOUTH;
			case EAST:
				return EnumFacing.WEST;
			case SOUTH:
				return EnumFacing.NORTH;
			case WEST:
				return EnumFacing.EAST;
			default:
				break;
		}
	}
	if (facing1 == EnumFacing.WEST) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.EAST;
			case EAST:
				return EnumFacing.SOUTH;
			case SOUTH:
				return EnumFacing.WEST;
			case WEST:
				return EnumFacing.NORTH;
			default:
				break;
		}
	}
	return facing2;
}
//Used to get which way the adjacent stairs is facing, relative to the block it is adjacent to.
public static EnumFacing getRelativeFacing(EnumFacing facing1, EnumFacing facing2) {
	if (facing1 == EnumFacing.EAST) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.WEST;
			case EAST:
				return EnumFacing.NORTH;
			case SOUTH:
				return EnumFacing.EAST;
			case WEST:
				return EnumFacing.SOUTH;
			default:
				break; //Assuming this method is used right, this should never happen.
		}
	}
	if (facing1 == EnumFacing.SOUTH) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.SOUTH;
			case EAST:
				return EnumFacing.EAST;
			case SOUTH:
				return EnumFacing.NORTH;
			case WEST:
				return EnumFacing.WEST;
			default:
				break;
		}
	}
	if (facing1 == EnumFacing.WEST) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.EAST;
			case EAST:
				return EnumFacing.SOUTH;
			case SOUTH:
				return EnumFacing.WEST;
			case WEST:
				return EnumFacing.NORTH;
			default:
				break;
		}
	}
	return facing2;
}

//Logic method that decides whether or not to render a side of a stairs block depending on
//what block is adjacent to it and what their blockstates are.
public static boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
	IBlockState adjBlockState = blockAccess.getBlockState(pos.offset(side));
	if (adjBlockState.getBlock() instanceof BlockColoreTransStairs) {

		EnumFacing blockFacing = blockState.getValue(BlockColoreTransStairs.FACING);
		EnumFacing adjBlockRelativeFacing = getRelativeFacing(blockFacing, adjBlockState.getValue(BlockColoreTransStairs.FACING));

		EnumFacing blockRelativeSide = getRelativeSide(blockFacing, side);

		EnumHalf blockHalf = blockState.getValue(BlockColoreTransStairs.HALF);
		EnumHalf adjBlockHalf = adjBlockState.getValue(BlockColoreTransStairs.HALF);

		EnumShape blockShape = blockState.getValue(BlockColoreTransStairs.SHAPE);
		EnumShape adjBlockShape = adjBlockState.getValue(BlockColoreTransStairs.SHAPE);
		System.out.println(adjBlockShape);
		if (side == EnumFacing.UP) {
			if (blockHalf == EnumHalf.TOP && adjBlockHalf == EnumHalf.BOTTOM) {
				return false;
			}
			if (blockHalf == EnumHalf.BOTTOM && adjBlockHalf == EnumHalf.TOP) {
				if (blockShape == adjBlockShape && adjBlockRelativeFacing == EnumFacing.NORTH) {
					return false;
				}
			}
		}
		if (side == EnumFacing.DOWN) {
			if (blockHalf == EnumHalf.BOTTOM && adjBlockHalf == EnumHalf.TOP) {
				return false;
			}
			if (blockHalf == EnumHalf.TOP && adjBlockHalf == EnumHalf.BOTTOM) {
				if (blockShape == adjBlockShape && adjBlockRelativeFacing == EnumFacing.NORTH) {
					return false;
				}
			}
		}

		if (blockRelativeSide == EnumFacing.NORTH && adjBlockRelativeFacing == EnumFacing.SOUTH) {
			if (adjBlockShape == EnumShape.STRAIGHT || adjBlockShape == EnumShape.INNER_LEFT || adjBlockShape == EnumShape.INNER_RIGHT) {
				return false;
			}
		}
		if (blockHalf == adjBlockHalf) {
			if (blockRelativeSide == EnumFacing.SOUTH && adjBlockRelativeFacing == EnumFacing.SOUTH) {
				return false;
			}
			if (blockShape == EnumShape.STRAIGHT) { //Tested with debugging and this works.
				if (blockRelativeSide == EnumFacing.NORTH) { //This also works.
					if (adjBlockRelativeFacing == EnumFacing.EAST) { //This does too.
						if (adjBlockShape == EnumShape.INNER_RIGHT) { //This doesn't.
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
				}
				if (blockRelativeSide == EnumFacing.EAST) {
					if (adjBlockRelativeFacing == EnumFacing.NORTH) {
						return false;
					}
					if (adjBlockRelativeFacing == EnumFacing.EAST) {
						//When called, this always prints out "straight" or "outer_right", which makes no sense.
						System.out.println(blockAccess.getBlockState(pos.offset(side)).getValue(BlockColoreTransStairs.SHAPE).toString());
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							System.out.println("2Test successful! BLAH BLAH BLAH!");
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
				if (blockRelativeSide == EnumFacing.SOUTH) {
					return false;
				}
				if (blockRelativeSide == EnumFacing.WEST) {
					if (adjBlockRelativeFacing == EnumFacing.NORTH) {
						return false;
					}
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
				if (blockShape == EnumShape.INNER_LEFT) {
					if (blockRelativeSide == EnumFacing.NORTH) {
						if (adjBlockRelativeFacing == EnumFacing.EAST) {
							if (adjBlockShape == EnumShape.INNER_RIGHT) {
								return false;
							}
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST) {
							if (adjBlockShape == EnumShape.INNER_LEFT) {
								return false;
							}
						}
					}
					if (blockRelativeSide == EnumFacing.EAST) {
						if (adjBlockRelativeFacing == EnumFacing.NORTH) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.EAST) {
							if (adjBlockShape == EnumShape.INNER_LEFT) {
								return false;
							}
						}
						if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
							if (adjBlockShape == EnumShape.INNER_RIGHT) {
								return false;
							}
						}
					}
					if (blockRelativeSide == EnumFacing.SOUTH) {
						if (adjBlockShape != EnumShape.OUTER_LEFT) {
							return false;
						}
					}
					if (blockRelativeSide == EnumFacing.WEST) {
						if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
							if (adjBlockShape == EnumShape.INNER_LEFT) {
								return false;
							}
						}
					}
				}
				if (blockShape == EnumShape.INNER_RIGHT) {
					if (blockRelativeSide == EnumFacing.NORTH) {
						if (adjBlockRelativeFacing == EnumFacing.EAST) {
							if (adjBlockShape == EnumShape.INNER_RIGHT) {
								return false;
							}
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST) {
							if (adjBlockShape == EnumShape.INNER_LEFT) {
								return false;
							}
						}
					}
					if (blockRelativeSide == EnumFacing.EAST) {
						if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
							if (adjBlockShape == EnumShape.INNER_RIGHT) {
								return false;
							}
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST) {
							if (adjBlockShape != EnumShape.OUTER_RIGHT) {
								return false;
							}
						}
					}
					if (blockRelativeSide == EnumFacing.SOUTH) {
						if (adjBlockShape != EnumShape.OUTER_RIGHT) {
							return false;
						}
					}
					if (blockRelativeSide == EnumFacing.WEST) {
						if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
							if (adjBlockShape == EnumShape.INNER_LEFT) {
								return false;
							}
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST) {
							if (adjBlockShape == EnumShape.INNER_RIGHT) {
								return false;
							}
						}
					}
				}
				if (blockShape == EnumShape.OUTER_LEFT) {
					if (blockRelativeSide == EnumFacing.NORTH) {
						if (adjBlockShape != EnumShape.OUTER_RIGHT) {
							return false;
						}
					}
					if (blockRelativeSide == EnumFacing.EAST || blockRelativeSide == EnumFacing.SOUTH) {
						return false;
					}
					if (blockRelativeSide == EnumFacing.WEST) {
						if (adjBlockRelativeFacing == EnumFacing.NORTH) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
							if (adjBlockShape == EnumShape.INNER_LEFT) {
								return false;
							}
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST) {
							if (adjBlockShape == EnumShape.INNER_RIGHT) {
								return false;
							}
						}
					}
				}
				if (blockShape == EnumShape.OUTER_RIGHT) {
					if (blockRelativeSide == EnumFacing.NORTH) {
						if (adjBlockShape != EnumShape.OUTER_LEFT) {
							return false;
						}
					}
					if (blockRelativeSide == EnumFacing.EAST) {
						if (adjBlockRelativeFacing == EnumFacing.NORTH) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.EAST) {
							if (adjBlockShape == EnumShape.INNER_LEFT) {
								return false;
							}
						}
						if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
							if (adjBlockShape == EnumShape.INNER_RIGHT) {
								return false;
							}
						}
					}
					if (blockRelativeSide == EnumFacing.SOUTH || blockRelativeSide == EnumFacing.WEST) {
						return false;
					}
				}
			}
		}
	}

	if (adjBlockState.getBlock() instanceof BlockColoreTrans || adjBlockState.getBlock() instanceof BlockColoreTransSlabDouble) {
		if (doShadeAndColorMatch(blockState, adjBlockState)) {
			return false;
		}
	}
	if (adjBlockState.getBlock() instanceof BlockColoreTransSlabHalf) {
		if ((side == EnumFacing.UP && adjBlockState.getValue(BlockColoreTransSlabHalf.HALF) == EnumBlockHalf.BOTTOM) ||
				(side == EnumFacing.DOWN && adjBlockState.getValue(BlockColoreTransSlabHalf.HALF) == EnumBlockHalf.TOP)) {
			if (doShadeAndColorMatch(blockState, adjBlockState)) {
				return false;
			}
		}
	}
        return true;
    }

//Used to check if the shade & color of the stairs matches that of the adjacent normal block, half-slab, or double-slab.
public static boolean doShadeAndColorMatch(IBlockState blockState, IBlockState adjBlockState) {
	for (String shade : UtilityLists.shadeList) {
		if (blockState.getBlock().getRegistryName().toString().contains(shade) && adjBlockState.getValue(BlockColore.SHADE) == EnumShade.valueOf(shade.toUpperCase())) {
			if (IColorMatcher.isSameColor(blockState, adjBlockState)) {
				return true;
			}
		}
	}
	return false;
}
}

 

BlockColoreTransStairs.java

package com.supergeniuszeb.colore.common.blocks;

import com.supergeniuszeb.colore.utility.StairsSideRenderLogic;

import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockColoreTransStairs extends BlockColoreStairs {

public BlockColoreTransStairs(String name, EnumColor color) {
	super(name, color);
	this.setLightOpacity(0);
}

@SideOnly(Side.CLIENT)
    public BlockRenderLayer getBlockLayer()
    {
        return BlockRenderLayer.TRANSLUCENT;
    }

/**
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
     */
@Override
    public boolean isOpaqueCube(IBlockState state)
    {
        return false;
    }
    
//Determines whether or not a side of the stairs should be rendered.
@Override
@SideOnly(Side.CLIENT)
    public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
        return StairsSideRenderLogic.shouldSideBeRendered(blockState, blockAccess, pos, side);
    }

@Override
    public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) {
        return false;
    }

}

 

BlockColoreStairs.java (regular opaque custom stairs class that is extended by BlockColoreTransStairs)

package com.supergeniuszeb.colore.common.blocks;

import com.supergeniuszeb.colore.common.init.ModCreativeTabs;

import net.minecraft.block.BlockStairs;
import net.minecraft.init.Blocks;

public class BlockColoreStairs extends BlockStairs implements IBlockName, IColoreColor {

private EnumColor color;

public BlockColoreStairs(String name, EnumColor color) {
	super(Blocks.COBBLESTONE.getDefaultState()); //Just getting the most generic state I can think of. 
	this.setHardness(1.5f);
	this.setHarvestLevel("pickaxe", 0);
	this.setResistance(10.0f);
	this.useNeighborBrightness = true;
	IBlockName.setBlockName(this, name);
	this.color = color;
	this.setCreativeTab(ModCreativeTabs.stairsTab);
}

@Override
public EnumColor getColor() {
	return color;
}

}

 

Thanks in advance for your help, and once this is sorted out, hopefully this rendering code will help others who want to make transparent stairs in their mods! (Transparency + non-full-cubes + different shapes depending on blockstates = really difficult! :P)

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

Link to comment
Share on other sites

To clarify:

  • IBlockAccess

    is an interface implemented by

    World

    that provides access to blocks,

    TileEntities

    , biomes, etc.

  • IBlockState

    is a collection of properties and values representing the current state of a

    Block


Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

1. You can use Block#getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) or Block#getExtendedState(IBlockState state, IBlockAccess worldIn, BlockPos pos).

I can't see any better way in performance, since the block state is not saved into the world itself.

2. I think the code could be easily cleaned further by using for loops and maps.

 

EDIT: Gotten from BlockStairs code, the stairs also use this way.

public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn)
    {
        state = this.getActualState(state, worldIn, pos);

        for (AxisAlignedBB axisalignedbb : getCollisionBoxList(state))
        {
            addCollisionBoxToList(pos, entityBox, collidingBoxes, axisalignedbb);
        }
    }

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

To clarify:

  • IBlockAccess

    is an interface implemented by

    World

    that provides access to blocks,

    TileEntities

    , biomes, etc.

  • IBlockState

    is a collection of properties and values representing the current state of a

    Block


1. You can use Block#getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) or Block#getExtendedState(IBlockState state, IBlockAccess worldIn, BlockPos pos).

I can't see any better way in performance, since the block state is not saved into the world itself.

2. I think the code could be easily cleaned further by using for loops and maps.

 

Thanks! Changing my code to get the actual-state fixed the problem! The stairs now render entirely as intended. It actually makes a lot of sense that since IBlockAccess is implemented and used by World, you wouldn't be able to directly get the full blockstate of a block from it, since the actual/extended state isn't saved to the world. (While fixing it I also discovered another minor unrelated problem where I accidentally mis-nested some of the if statements, which I've fixed now.)

 

Abastro, could you explain how I could use for loops and maps to make the code cleaner? I'm not sure what you mean. As for optimizing the logic, I've already made it relative to the orientation of the stairs being rendered, which has reduced the size of the logic to be 4x smaller than what it would be otherwise. (A north-facing stairs with an east-facing stairs on its east side = an east-facing stairs with a south-facing stairs on its south side.) If you take a look at the code you'll see I check for the most general cases (like bottom-half-stairs on top of top-half stairs) which should always return false before I check for more specific cases that are more difficult to determine, and I don't think there are any redundant checks left in the logic that could be abstracted, but correct me if I'm wrong.

 

The updated StairsSideRenderLogic.java

package com.supergeniuszeb.colore.utility;

import com.supergeniuszeb.colore.common.blocks.BlockColore;
import com.supergeniuszeb.colore.common.blocks.BlockColoreStairs;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTrans;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTransSlabDouble;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTransSlabHalf;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTransStairs;
import com.supergeniuszeb.colore.common.blocks.EnumShade;
import com.supergeniuszeb.colore.common.blocks.IColorMatcher;

import net.minecraft.block.BlockSlab.EnumBlockHalf;
import net.minecraft.block.BlockStairs.EnumHalf;
import net.minecraft.block.BlockStairs.EnumShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.property.IExtendedBlockState;

public class StairsSideRenderLogic implements IColorMatcher {
//Used to get the side of a stairs relative to its FACING property.
public static EnumFacing getRelativeSide(EnumFacing facing1, EnumFacing facing2) {
	if (facing1 == EnumFacing.EAST) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.WEST;
			case EAST:
				return EnumFacing.NORTH;
			case SOUTH:
				return EnumFacing.EAST;
			case WEST:
				return EnumFacing.SOUTH;
			default:
				break; //Assuming this method is used right, this should never happen.
		}
	}
	if (facing1 == EnumFacing.SOUTH) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.SOUTH;
			case EAST:
				return EnumFacing.WEST;
			case SOUTH:
				return EnumFacing.NORTH;
			case WEST:
				return EnumFacing.EAST;
			default:
				break;
		}
	}
	if (facing1 == EnumFacing.WEST) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.EAST;
			case EAST:
				return EnumFacing.SOUTH;
			case SOUTH:
				return EnumFacing.WEST;
			case WEST:
				return EnumFacing.NORTH;
			default:
				break;
		}
	}
	return facing2;
}
//Used to get which way the adjacent stairs is facing, relative to the block it is adjacent to.
public static EnumFacing getRelativeFacing(EnumFacing facing1, EnumFacing facing2) {
	if (facing1 == EnumFacing.EAST) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.WEST;
			case EAST:
				return EnumFacing.NORTH;
			case SOUTH:
				return EnumFacing.EAST;
			case WEST:
				return EnumFacing.SOUTH;
			default:
				break; //Assuming this method is used right, this should never happen.
		}
	}
	if (facing1 == EnumFacing.SOUTH) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.SOUTH;
			case EAST:
				return EnumFacing.WEST;
			case SOUTH:
				return EnumFacing.NORTH;
			case WEST:
				return EnumFacing.EAST;
			default:
				break;
		}
	}
	if (facing1 == EnumFacing.WEST) {
		switch (facing2) {
			case NORTH:
				return EnumFacing.EAST;
			case EAST:
				return EnumFacing.SOUTH;
			case SOUTH:
				return EnumFacing.WEST;
			case WEST:
				return EnumFacing.NORTH;
			default:
				break;
		}
	}
	return facing2;
}

//Logic method that decides whether or not to render a side of a stairs block depending on
//what block is adjacent to it and what their blockstates are.
public static boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {

	IBlockState adjBlockState = blockAccess.getBlockState(pos.offset(side)).getActualState(blockAccess, pos.offset(side));

	if (adjBlockState.getBlock() instanceof BlockColoreTransStairs) {

		EnumFacing blockFacing = blockState.getValue(BlockColoreTransStairs.FACING);
		EnumFacing adjBlockRelativeFacing = getRelativeFacing(blockFacing, adjBlockState.getValue(BlockColoreTransStairs.FACING));

		EnumFacing blockRelativeSide = getRelativeSide(blockFacing, side);

		EnumHalf blockHalf = blockState.getValue(BlockColoreTransStairs.HALF);
		EnumHalf adjBlockHalf = adjBlockState.getValue(BlockColoreTransStairs.HALF);

		EnumShape blockShape = blockState.getValue(BlockColoreTransStairs.SHAPE);
		EnumShape adjBlockShape = adjBlockState.getValue(BlockColoreTransStairs.SHAPE);

		if (side == EnumFacing.UP) {
			if (blockHalf == EnumHalf.TOP && adjBlockHalf == EnumHalf.BOTTOM) {
				return false;
			}
			if (blockHalf == EnumHalf.BOTTOM && adjBlockHalf == EnumHalf.TOP) {
				if (blockShape == adjBlockShape && adjBlockRelativeFacing == EnumFacing.NORTH) {
					return false;
				}
			}
		}
		if (side == EnumFacing.DOWN) {
			if (blockHalf == EnumHalf.BOTTOM && adjBlockHalf == EnumHalf.TOP) {
				return false;
			}
			if (blockHalf == EnumHalf.TOP && adjBlockHalf == EnumHalf.BOTTOM) {
				if (blockShape == adjBlockShape && adjBlockRelativeFacing == EnumFacing.NORTH) {
					return false;
				}
			}
		}
		for (EnumFacing facing : EnumFacing.HORIZONTALS) {
			if (blockRelativeSide == facing && adjBlockRelativeFacing == facing.getOpposite()) {
				if (adjBlockShape == EnumShape.STRAIGHT || adjBlockShape == EnumShape.INNER_LEFT || adjBlockShape == EnumShape.INNER_RIGHT) {
					return false;
				}
			}
		}

		if (blockHalf == adjBlockHalf) {
			if (blockRelativeSide == EnumFacing.SOUTH && adjBlockRelativeFacing == EnumFacing.SOUTH) {
				return false;
			}
			if (blockShape == EnumShape.STRAIGHT) {
				if (blockRelativeSide == EnumFacing.NORTH) {
					if (adjBlockRelativeFacing == EnumFacing.EAST) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
				}
				if (blockRelativeSide == EnumFacing.EAST) {
					if (adjBlockRelativeFacing == EnumFacing.NORTH) {
						return false;
					}
					if (adjBlockRelativeFacing == EnumFacing.EAST) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape == EnumShape.OUTER_RIGHT) {
							return false;
						}
					}
				}
				if (blockRelativeSide == EnumFacing.SOUTH) {
					return false;
				}
				if (blockRelativeSide == EnumFacing.WEST) {
					if (adjBlockRelativeFacing == EnumFacing.NORTH) {
						return false;
					}
					if (adjBlockRelativeFacing == EnumFacing.EAST) {
						if (adjBlockShape == EnumShape.OUTER_LEFT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
			}
			if (blockShape == EnumShape.INNER_LEFT) {
				if (blockRelativeSide == EnumFacing.NORTH) {
					if (adjBlockRelativeFacing == EnumFacing.EAST) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
				}
				if (blockRelativeSide == EnumFacing.EAST) {
					if (adjBlockRelativeFacing == EnumFacing.NORTH) {
						return false;
					}
					if (adjBlockRelativeFacing == EnumFacing.EAST) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
				if (blockRelativeSide == EnumFacing.SOUTH) {
					if (adjBlockShape != EnumShape.OUTER_LEFT) {
						return false;
					}
				}
				if (blockRelativeSide == EnumFacing.WEST) {
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
				}
			}
			if (blockShape == EnumShape.INNER_RIGHT) {
				if (blockRelativeSide == EnumFacing.NORTH) {
					if (adjBlockRelativeFacing == EnumFacing.EAST) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
				}
				if (blockRelativeSide == EnumFacing.EAST) {
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape != EnumShape.OUTER_RIGHT) {
							return false;
						}
					}
				}
				if (blockRelativeSide == EnumFacing.SOUTH) {
					if (adjBlockShape != EnumShape.OUTER_RIGHT) {
						return false;
					}
				}
				if (blockRelativeSide == EnumFacing.WEST) {
					if (adjBlockRelativeFacing == EnumFacing.NORTH) {
						return false;
					}
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
			}
			if (blockShape == EnumShape.OUTER_LEFT) {
				if (blockRelativeSide == EnumFacing.NORTH) {
					if (adjBlockShape != EnumShape.OUTER_RIGHT) {
						return false;
					}
				}
				if (blockRelativeSide == EnumFacing.EAST || blockRelativeSide == EnumFacing.SOUTH) {
					return false;
				}
				if (blockRelativeSide == EnumFacing.WEST) {
					if (adjBlockRelativeFacing == EnumFacing.NORTH) {
						return false;
					}
					if (adjBlockRelativeFacing == EnumFacing.EAST) {
						if (adjBlockShape == EnumShape.OUTER_LEFT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.WEST) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
			}
			if (blockShape == EnumShape.OUTER_RIGHT) {
				if (blockRelativeSide == EnumFacing.NORTH) {
					if (adjBlockShape != EnumShape.OUTER_LEFT) {
						return false;
					}
				}
				if (blockRelativeSide == EnumFacing.EAST) {
					if (adjBlockRelativeFacing == EnumFacing.NORTH) {
						return false;
					}
					if (adjBlockRelativeFacing == EnumFacing.EAST) {
						if (adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
					if (adjBlockRelativeFacing == EnumFacing.SOUTH) {
						if (adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
				if (blockRelativeSide == EnumFacing.SOUTH || blockRelativeSide == EnumFacing.WEST) {
					return false;
				}
			}
		}
	}
	if (adjBlockState.getBlock() instanceof BlockColoreTrans || adjBlockState.getBlock() instanceof BlockColoreTransSlabDouble) {
		if (doShadeAndColorMatch(blockState, adjBlockState)) {
			return false;
		}
	}
	if (adjBlockState.getBlock() instanceof BlockColoreTransSlabHalf) {
		if ((side == EnumFacing.UP && adjBlockState.getValue(BlockColoreTransSlabHalf.HALF) == EnumBlockHalf.BOTTOM) ||
				(side == EnumFacing.DOWN && adjBlockState.getValue(BlockColoreTransSlabHalf.HALF) == EnumBlockHalf.TOP)) {
			if (doShadeAndColorMatch(blockState, adjBlockState)) {
				return false;
			}
		}
	}
        return true;
    }

//Used to check if the shade & color of the stairs matches that of the adjacent normal block, half-slab, or double-slab.
public static boolean doShadeAndColorMatch(IBlockState blockState, IBlockState adjBlockState) {
	for (String shade : UtilityLists.shadeList) {
		if (blockState.getBlock().getRegistryName().toString().contains(shade) && adjBlockState.getValue(BlockColore.SHADE) == EnumShade.valueOf(shade.toUpperCase())) {
			if (IColorMatcher.isSameColor(blockState, adjBlockState)) {
				return true;
			}
		}
	}
	return false;
}
}

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

Link to comment
Share on other sites

I call IBlockAccess "world lite."  The interface is everything that a World object is, except that you can't change anything.  It's effectively read-only.  But because it's a read-only world object you can get any information you want or need from the world.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I call IBlockAccess "world lite."  The interface is everything that a World object is, except that you can't change anything.  It's effectively read-only.  But because it's a read-only world object you can get any information you want or need from the world.

Thanks, that's a very useful description. Given that context, it makes sense why a lot of methods that take an IBlockAccess as a parameter call the parameter "world".

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

Link to comment
Share on other sites

I did another run-through of my stair-rendering logic and optimized it some more, combining several if-statements with &&, abstracting others that applied to multiple shapes, and removing unnecessary if-statements. I also made the stair-side-rendering work properly with the other stairs so that sides will render if the color & shade of the stairs don't match. Hopefully this code will benefit other people trying to make translucent stairs.

 

package com.supergeniuszeb.colore.utility;

import com.supergeniuszeb.colore.common.blocks.BlockColore;
import com.supergeniuszeb.colore.common.blocks.BlockColoreSlab;
import com.supergeniuszeb.colore.common.blocks.BlockColoreStairs;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTrans;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTransSlabDouble;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTransSlabHalf;
import com.supergeniuszeb.colore.common.blocks.BlockColoreTransStairs;
import com.supergeniuszeb.colore.common.blocks.EnumShade;
import com.supergeniuszeb.colore.common.blocks.IColorMatcher;

import net.minecraft.block.BlockSlab.EnumBlockHalf;
import net.minecraft.block.BlockStairs.EnumHalf;
import net.minecraft.block.BlockStairs.EnumShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;

public class StairsSideRenderLogic implements IColorMatcher {
//Used to get the side of a stairs relative to its FACING property.
//Also used to get the FACING of an adjacent stairs relative to the block it is adjacent to.
public static EnumFacing getRelativeFacing(EnumFacing facing1, EnumFacing facing2) {
	if (facing2.getAxis() == Axis.X || facing2.getAxis() == Axis.Z) {
		if (facing1 == EnumFacing.EAST) {
			return facing2.rotateYCCW();
		}
		if (facing1 == EnumFacing.SOUTH) {
			return facing2.getOpposite();
		}
		if (facing1 == EnumFacing.WEST) {
			return facing2.rotateY();
		}
	}
	return facing2;
}

//Logic method that decides whether or not to render a side of a stairs block depending on
//what block is adjacent to it and what their blockstates are.
public static boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {

	IBlockState adjBlockState = blockAccess.getBlockState(pos.offset(side)).getActualState(blockAccess, pos.offset(side));

	EnumFacing blockFacing = blockState.getValue(BlockColoreStairs.FACING);
	EnumFacing blockRelativeSide = getRelativeFacing(blockFacing, side);
	EnumHalf blockHalf = blockState.getValue(BlockColoreTransStairs.HALF);
	EnumShape blockShape = blockState.getValue(BlockColoreTransStairs.SHAPE);

	if (doShadeAndColorMatch(blockState, adjBlockState)) {
		if (adjBlockState.getBlock() instanceof BlockColoreTransStairs) {
			EnumFacing adjBlockRelativeFacing = getRelativeFacing(blockFacing, adjBlockState.getValue(BlockColoreTransStairs.FACING));
			EnumHalf adjBlockHalf = adjBlockState.getValue(BlockColoreTransStairs.HALF);
			EnumShape adjBlockShape = adjBlockState.getValue(BlockColoreTransStairs.SHAPE);

			if (side == EnumFacing.UP) {
				if (blockHalf == EnumHalf.TOP && adjBlockHalf == EnumHalf.BOTTOM) {
					return false;
				}
				if (blockHalf == EnumHalf.BOTTOM && adjBlockHalf == EnumHalf.TOP
						&& blockShape == adjBlockShape && adjBlockRelativeFacing == EnumFacing.NORTH) {
					return false;
				}
			}
			if (side == EnumFacing.DOWN) {
				if (blockHalf == EnumHalf.BOTTOM && adjBlockHalf == EnumHalf.TOP) {
					return false;
				}
				if (blockHalf == EnumHalf.TOP && adjBlockHalf == EnumHalf.BOTTOM
						&& blockShape == adjBlockShape && adjBlockRelativeFacing == EnumFacing.NORTH) {
					return false;
				}
			}
			for (EnumFacing facing : EnumFacing.HORIZONTALS) {
				if (blockRelativeSide == facing) {
					if (adjBlockRelativeFacing == facing.rotateY() && adjBlockShape == EnumShape.INNER_RIGHT) {
						return false;
					}
					if (adjBlockRelativeFacing == facing.getOpposite()
							&& (adjBlockShape == EnumShape.STRAIGHT || adjBlockShape == EnumShape.INNER_LEFT || adjBlockShape == EnumShape.INNER_RIGHT)) {
						return false;
					}
					if (adjBlockRelativeFacing == facing.rotateYCCW() && adjBlockShape == EnumShape.INNER_LEFT) {
						return false;
					}
				}
			}

			if (blockHalf == adjBlockHalf) {
				if (blockRelativeSide == EnumFacing.SOUTH && adjBlockRelativeFacing == EnumFacing.SOUTH) {
					return false;
				}
				if (blockShape == EnumShape.STRAIGHT) {
					if (blockRelativeSide == EnumFacing.EAST) {
						if (adjBlockRelativeFacing == EnumFacing.NORTH) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.EAST && adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST && adjBlockShape == EnumShape.OUTER_RIGHT) {
							return false;
						}
					}
					if (blockRelativeSide == EnumFacing.SOUTH) {
						return false;
					}
					if (blockRelativeSide == EnumFacing.WEST) {
						if (adjBlockRelativeFacing == EnumFacing.NORTH) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.EAST && adjBlockShape == EnumShape.OUTER_LEFT) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST && adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
				if (blockShape == EnumShape.INNER_LEFT) {
					if (blockRelativeSide == EnumFacing.EAST) {
						if (adjBlockRelativeFacing == EnumFacing.NORTH) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.EAST && adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
					}
					if (blockRelativeSide == EnumFacing.SOUTH && adjBlockShape != EnumShape.OUTER_LEFT) {
						return false;
					}
				}
				if (blockShape == EnumShape.INNER_RIGHT) {
					if (blockRelativeSide == EnumFacing.SOUTH && adjBlockShape != EnumShape.OUTER_RIGHT) {
						return false;
					}
					if (blockRelativeSide == EnumFacing.WEST) {
						if (adjBlockRelativeFacing == EnumFacing.NORTH) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST && adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
				if (blockShape == EnumShape.OUTER_LEFT) {
					if (blockRelativeSide == EnumFacing.NORTH && adjBlockShape != EnumShape.OUTER_RIGHT) {
						return false;
					}
					if (blockRelativeSide == EnumFacing.EAST || blockRelativeSide == EnumFacing.SOUTH) {
						return false;
					}
					if (blockRelativeSide == EnumFacing.WEST) {
						if (adjBlockRelativeFacing == EnumFacing.NORTH) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.EAST && adjBlockShape == EnumShape.OUTER_LEFT) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST && adjBlockShape == EnumShape.INNER_RIGHT) {
							return false;
						}
					}
				}
				if (blockShape == EnumShape.OUTER_RIGHT) {
					if (blockRelativeSide == EnumFacing.NORTH && adjBlockShape != EnumShape.OUTER_LEFT) {
						return false;
					}
					if (blockRelativeSide == EnumFacing.EAST) {
						if (adjBlockRelativeFacing == EnumFacing.NORTH) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.EAST && adjBlockShape == EnumShape.INNER_LEFT) {
							return false;
						}
						if (adjBlockRelativeFacing == EnumFacing.WEST && adjBlockShape == EnumShape.OUTER_RIGHT) {
							return false;
						}
					}
					if (blockRelativeSide == EnumFacing.SOUTH || blockRelativeSide == EnumFacing.WEST) {
						return false;
					}
				}
			}
		}
		if (adjBlockState.getBlock() instanceof BlockColoreTrans || adjBlockState.getBlock() instanceof BlockColoreTransSlabDouble) {
			return false;
		}
		if (adjBlockState.getBlock() instanceof BlockColoreTransSlabHalf) {
			if ((side == EnumFacing.UP && adjBlockState.getValue(BlockColoreSlab.HALF) == EnumBlockHalf.BOTTOM)
					|| (side == EnumFacing.DOWN && adjBlockState.getValue(BlockColoreSlab.HALF) == EnumBlockHalf.TOP)) {
				return false;
			}
			if ((blockHalf == EnumHalf.BOTTOM && adjBlockState.getValue(BlockColoreSlab.HALF) == EnumBlockHalf.BOTTOM)
					|| (blockHalf == EnumHalf.TOP && adjBlockState.getValue(BlockColoreSlab.HALF) == EnumBlockHalf.TOP)) {
				if (blockShape != EnumShape.INNER_LEFT && blockShape != EnumShape.INNER_RIGHT && blockRelativeSide == EnumFacing.SOUTH) {
					return false;
				}
				if (blockShape == EnumShape.OUTER_LEFT && blockRelativeSide == EnumFacing.EAST) {
					return false;
				}
				if (blockShape == EnumShape.OUTER_RIGHT && blockRelativeSide == EnumFacing.WEST) {
					return false;
				}
			}
		}
	}
        return true;
    }

//Used to check if the shade & color of the stairs matches that of the adjacent normal block, half-slab, or double-slab.
public static boolean doShadeAndColorMatch(IBlockState blockState, IBlockState adjBlockState) {
	if (IColorMatcher.isSameColor(blockState, adjBlockState)) {
		for (String shade : UtilityLists.shadeList) {
			if (adjBlockState.getBlock() instanceof BlockColoreStairs) {
				if (blockState.getBlock().getRegistryName().toString().contains(shade) && adjBlockState.getBlock().getRegistryName().toString().contains(shade)) {
					return true;
				}
			} else if (blockState.getBlock().getRegistryName().toString().contains(shade) && adjBlockState.getValue(BlockColore.SHADE) == EnumShade.valueOf(shade.toUpperCase())) {
				return true;
			}
		}
	}
	return false;
}
}

 

Still curious if there's anything I can do to improve it even more, though. Also, there's this other problem(?) I'm having with my mod. Whenever I start up the game, I get a bunch of identical errors saying:

[Client thread/ERROR] [FML]: MultiModel minecraft:builtin/missing is empty (no base model or parts were provided/resolved)

But I can't find any problems with any of my item or block models, and they all work and look as intended. Is this a Forge bug or am I doing something wrong?

 

EDIT: Updated the code above again - simplified the functions used to convert an EnumFacing to one relative to the stairs being rendered.

Colore - The mod that adds monochrome blocks in every color of the rainbow!

http://www.minecraftforge.net/forum/index.php?topic=35149

 

If you're looking to learn how to make mods for 1.9.4, I wrote a helpful article with links to a lot of useful resources for learning Minecraft 1.9.4 modding!

 

http://supergeniuszeb.com/mods/a-helpful-list-of-minecraft-1-9-4-modding-resources/

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
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.

 Share



×
×
  • Create New...

Important Information

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