• 0

    posted a message on [1.16.3] Transparency Issue

    No... I'm sorry this is only my second mod, and I'm kinda mediocre at modding. I just searched the source and found the file you mentioned. Tried calling setRenderLayer() before registering, seemed to make sense; didn't work. Got it working though when I called the method after registering. Thank you so much!

    Posted in: Modification Development
  • 0

    posted a message on [1.16.3] Transparency Issue

    Hello, I'm trying to make a mod with a block with a custom model and a partly transparent texture. Problem is, parts of the texture which are supposed to be transparent are showing as black.

    Here's the image I'm using as the texture for the models. I made it in GIMP and exported it in 8-bit RGBA.

    Actual image:

    Screenshot from image editor:

    Originally my block used the same model as the cocoa bean block, but I had the same issue somehow, which leads me to believe it is a code issue. I included the images as background information. Here is the full source code for my block, which is modified from the source for the cocoa block:

    package com.spazz0.notjustpotions;
    import java.util.Random;
    import javax.annotation.Nullable;
    import net.minecraft.block.AbstractBlock;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockState;
    import net.minecraft.block.Blocks;
    import net.minecraft.block.HorizontalBlock;
    import net.minecraft.block.IGrowable;
    import net.minecraft.item.BlockItemUseContext;
    import net.minecraft.pathfinding.PathType;
    import net.minecraft.state.IntegerProperty;
    import net.minecraft.state.StateContainer;
    import net.minecraft.state.properties.BlockStateProperties;
    import net.minecraft.tags.BlockTags;
    import net.minecraft.util.Direction;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.util.math.shapes.ISelectionContext;
    import net.minecraft.util.math.shapes.VoxelShape;
    import net.minecraft.world.IBlockReader;
    import net.minecraft.world.IWorld;
    import net.minecraft.world.IWorldReader;
    import net.minecraft.world.World;
    import net.minecraft.world.server.ServerWorld;
    public class CoffeeBlock extends HorizontalBlock implements IGrowable {
    	public static final IntegerProperty AGE = BlockStateProperties.AGE_0_3;
    	protected static final VoxelShape COFFEE_EAST_AABB = Block.makeCuboidShape(11.0D, 7.0D, 6.0D, 15.0D, 12.0D, 10.0D);
    	protected static final VoxelShape COFFEE_WEST_AABB = Block.makeCuboidShape(1.0D, 7.0D, 6.0D, 5.0D, 12.0D, 10.0D);
    	protected static final VoxelShape COFFEE_NORTH_AABB = Block.makeCuboidShape(6.0D, 7.0D, 1.0D, 10.0D, 12.0D, 5.0D);
    	protected static final VoxelShape COFFEE_SOUTH_AABB = Block.makeCuboidShape(6.0D, 7.0D, 11.0D, 10.0D, 12.0D, 15.0D);
    	public CoffeeBlock(AbstractBlock.Properties properties) {
    		this.setDefaultState(this.stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH).with(AGE, Integer.valueOf(0)));
    	public boolean ticksRandomly(BlockState state) {
    		return state.get(AGE) < 3;
    	public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
    		if (true) {
    			int i = state.get(AGE);
    			if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, pos, state, worldIn.rand.nextInt(5) == 0)) {
    				worldIn.setBlockState(pos, state.with(AGE, Integer.valueOf(i + 1)), 2);
    				net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state);
    	public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
    		Block block = worldIn.getBlockState(pos.offset(state.get(HORIZONTAL_FACING))).getBlock();
    		return block.isIn(BlockTags.ACACIA_LOGS);
    	public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
    		switch((Direction)state.get(HORIZONTAL_FACING)) {
    		case SOUTH:
    			return COFFEE_SOUTH_AABB;
    		case NORTH:
    			return COFFEE_NORTH_AABB;
    		case WEST:
    			return COFFEE_WEST_AABB;
    		case EAST:
    			return COFFEE_EAST_AABB;
    	public BlockState getStateForPlacement(BlockItemUseContext context) {
    		BlockState blockstate = this.getDefaultState();
    		IWorldReader iworldreader = context.getWorld();
    		BlockPos blockpos = context.getPos();
    		for(Direction direction : context.getNearestLookingDirections()) {
    			if (direction.getAxis().isHorizontal()) {
    				blockstate = blockstate.with(HORIZONTAL_FACING, direction);
    				if (blockstate.isValidPosition(iworldreader, blockpos)) {
    					return blockstate;
    		return null;
    	public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) {
    		return facing == stateIn.get(HORIZONTAL_FACING) && !stateIn.isValidPosition(worldIn, currentPos) ? Blocks.AIR.getDefaultState() : super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos);
    	public boolean canGrow(IBlockReader worldIn, BlockPos pos, BlockState state, boolean isClient) {
    		return state.get(AGE) < 3;
    	public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, BlockState state) {
    		return true;
    	public void grow(ServerWorld worldIn, Random rand, BlockPos pos, BlockState state) {
    		worldIn.setBlockState(pos, state.with(AGE, Integer.valueOf(state.get(AGE) + 1)), 2);
    	protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
    		builder.add(HORIZONTAL_FACING, AGE);
    	public boolean allowsMovement(BlockState state, IBlockReader worldIn, BlockPos pos, PathType type) {
    		return false;

    The block is registered with the same properties as the cocoa block. Could it be an issue with Forge or is there something I'm doing wrong?

    Posted in: Modification Development
  • To post a comment, please or register a new account.