Jump to content

Recommended Posts

Posted

Its hard to say without seeing what you have actually done.

Maybe? (the same as IRON_BARS)

ItemBlockRenderTypes.setRenderLayer(YOUR_BLOCK, RenderType.cutoutMipped());

in your client setup.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

 alredy try that 

<code>
    public static final RegistryObject<Block> MESH_BLOCK = registerBlock( "mesh_block", 
            () -> new mesh_block( AbstractBlock.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).noOcclusion() ));</code>

in the minecraft blocks class  iron bars and glass are like this 

<code>
    
    //public static final Block IRON_BARS = register("iron_bars", new PaneBlock(AbstractBlock.Properties.of(Material.METAL, MaterialColor.NONE).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).noOcclusion()));
    //public static final Block GLASS_PANE = register("glass_pane", new PaneBlock(AbstractBlock.Properties.of(Material.GLASS).strength(0.3F).sound(SoundType.GLASS).noOcclusion()));

</code>

rejasnotransparentes.png

 

 

 

this is the full class it has some garbage coze i been doing experiments on it 

 

<code>

package baseMmod.block;

import java.util.stream.IntStream;

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.IWaterLoggable;
import net.minecraft.block.PaneBlock;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.DoorHingeSide;
import net.minecraft.state.properties.Half;
import net.minecraft.state.properties.SlabType;
import net.minecraft.state.properties.StairsShape;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraft.item.BlockItemUseContext;
//import net.minecraft.item.Item;

//########## ########## ########## ##########
public class mesh_block extends Block implements IWaterLoggable  {

    // ########## ########## ########## ##########
    public mesh_block(Block.Properties properties) {
        super(properties);

        this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH));
        
        
        
    }

    // ########## ########## ########## ##########
    public static final DirectionProperty FACING = HorizontalBlock.FACING;


    // ########## ########## ########## ##########
    @Override
    protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) {
        builder.add(FACING, WATERLOGGED );
        // builder.add(FACING, OPEN, HALF, POWERED, WATERLOGGED);
    }

    public boolean useShapeForLightOcclusion(BlockState p_220074_1_) {
        // return p_220074_1_.getValue(TYPE) != SlabType.DOUBLE;
        return true;
    }

    // ########## ########## ########## ##########
    // hitbox
    public static final EnumProperty<SlabType> TYPE = BlockStateProperties.SLAB_TYPE;
    public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;

    // estos dos son los bordes para el blocke
    
       @OnlyIn(Dist.CLIENT)
       public static boolean shouldRenderFace(BlockState p_176225_0_, IBlockReader p_176225_1_, BlockPos p_176225_2_, Direction p_176225_3_) {
       return true;
       }
    

    /* A 3uNIDADES
    protected static final VoxelShape TOP_AABB = Block.box(0.0D, 8.0D, 0.0D, 16.0D, 16.0D, 16.0D);
    protected static final VoxelShape BOTTOM_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
    protected static final VoxelShape SOUTH_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 3.0D);
    protected static final VoxelShape NORTH_AABB = Block.box(0.0D, 0.0D, 13.0D, 16.0D, 16.0D, 16.0D);
    protected static final VoxelShape WEST_AABB = Block.box(13.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D);
    protected static final VoxelShape EAST_AABB = Block.box(0.0D, 0.0D, 0.0D, 3.0D, 16.0D, 16.0D);
    */
    
    // a una unidad
    protected static final Double     thickness = 1.5D;
    protected static final VoxelShape TOP_AABB = Block.box(0.0D, (16.0D - thickness), 0.0D, 16.0D, 16.0D, 16.0D);
    protected static final VoxelShape BOTTOM_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, thickness, 16.0D);
    protected static final VoxelShape SOUTH_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, thickness);
    protected static final VoxelShape NORTH_AABB = Block.box(0.0D, 0.0D, (16.0D - thickness), 16.0D, 16.0D, 16.0D);
    protected static final VoxelShape WEST_AABB = Block.box( (16.0D - thickness), 0.0D, 0.0D, 16.0D, 16.0D, 16.0D);
    protected static final VoxelShape EAST_AABB = Block.box(0.0D, 0.0D, 0.0D, thickness, 16.0D, 16.0D);    
    
     protected static final VoxelShape ALL_SHAPES = VoxelShapes.or( VoxelShapes.or( NORTH_AABB, SOUTH_AABB ), VoxelShapes.or( EAST_AABB, WEST_AABB )); 
     
          
     
     
     
     
     
    
    // aqui es donde se selecciona que bordes va a tener el pblocke basado en el
    // block state
    public VoxelShape getShape(BlockState blkstate, IBlockReader blockreader, BlockPos blockpos,
            ISelectionContext iselectioncontext) {
        Direction direction = blkstate.getValue(FACING);
        // boolean flag = !blkstate.getValue(OPEN);
        // boolean flag1 = blkstate.getValue(HINGE) == DoorHingeSide.RIGHT;
        return ALL_SHAPES;
        
        /* return ALL_SHAPES;
        
        switch (direction) {
        case EAST:
        default:
            return EAST_AABB;
        case SOUTH:
            return SOUTH_AABB;
        case WEST:
            return WEST_AABB;
        case NORTH:
            return NORTH_AABB;
        }
        */
    }

    // ########## ########## ########## ##########
    @Override
    public BlockState getStateForPlacement(BlockItemUseContext context) {
        return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());
    }

    // ########## ########## ########## ##########
    // Onright click
    @Override
    public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand,
            BlockRayTraceResult hit) {
        ItemStack held = player.getItemInHand(hand);

        /*
         * if (!world.isClientSide() && held.getItem() == Items.GUNPOWDER){
         * world.explode(player, pos.getX(), pos.getY(), pos.getZ(), 4.0F, true,
         * Explosion.Mode.DESTROY); held.shrink(1); return ActionResultType.CONSUME; }
         */

        return super.use(state, world, pos, player, hand, hit);
    }

    // ########## ########## ########## ##########
    public static boolean isFaceFull(VoxelShape p_208061_0_, Direction p_208061_1_) {
        VoxelShape voxelshape = p_208061_0_.getFaceShape(p_208061_1_);
        return isShapeFullBlock(voxelshape);
    }

    public boolean hasDynamicShape() {
        return this.dynamicShape;
    }
    // ########## ########## ########## ##########
}

</code>

 

 

I miss the times of 1.7 when you define all the properties recipes drops textures subblocks inside the same custome block class

 

Posted

Your code looks very different to the iron bars block.

I don't think most of your shape stuff is relevant to this problem, mostly I think the shapes get used for things like entity collision and drawing hit boxes, etc.

The real stuff for the rendering will be in your blockstates and models json.

To check you have all the code in the right place for a transparent block, it might be easier to try to code something like a new leaves block which has a much simpler block model, but it still uses cutoutMipped.

Sometimes the problem is not that you don't have the right code, instead the code is in wrong place, or it has a typo, etc. Doing something simpler helps to get rid of irrelevant complications.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

first of all why did you not extending the vanilla IronBarsBlock?
second do not use @OnlyIn it's only for vanilla

11 hours ago, perromercenary00 said:

alredy try that

the code you showed does not include a FMLClientSetupEvent

And for the next time you post code on the Forum use the code Feature or use a paste side but it's highly recommended to use a Git repo to share the code

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.