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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I’m working on a Manta Ray entity in MCreator using GeckoLib animations, and my goal is to have a looping (flip) animation that ends at −360°, then transitions seamlessly into a swim animation starting at 0°. However, every method I’ve tried—like quickly interpolating the angle, inserting a brief keyframe at 0°, or using a micro “bridge” animation—still causes a visible “flash” https://imgur.com/a/5ucjUb9 or "jump" when the rotation resets. I want a perfectly smooth motion from the flip’s final rotation to the swim’s initial rotation. If anyone has solved this in MCreator/GeckoLib, or found a better trick for handling the −360° →0° gap without a snap, I’d appreciate some advice ! P.S.- I cannot set swim to start at -360 because I would have the same issue but in reverse. Here's the custom LoopingAnimationGoal :   class LoopingAnimationGoal extends Goal { private final MantaRayEntity entity; private final int cooldownTime; private int animationTimer; private int cooldownTimer; // New boolean to prevent double calls private boolean isLoopingActive = false; public LoopingAnimationGoal(MantaRayEntity entity, int cooldownTime) { this.entity = entity; this.cooldownTime = cooldownTime; this.animationTimer = 0; this.cooldownTimer = 0; this.setFlags(EnumSet.of(Flag.MOVE, Flag.LOOK)); } @Override public boolean canUse() { System.out.println("[DEBUG] LoopingGoal canUse => cooldownTimer=" + cooldownTimer); if (cooldownTimer > 0) { cooldownTimer--; return false; } BlockPos entityPos = entity.blockPosition(); boolean canUse = entity.isWaterAbove(entityPos, 4); System.out.println("[DEBUG] LoopingGoal canUse => WATER " + (canUse ? "DETECTED" : "NOT DETECTED") + " at " + entityPos + ", returning " + canUse); return canUse; } @Override public void start() { entity.setAnimation("looping"); animationTimer = 63; isLoopingActive = true; System.out.println("[DEBUG] Looping animation STARTED. Timer=" + animationTimer + ", gameTime=" + entity.level().getGameTime()); } @Override public boolean canContinueToUse() { System.out.println("[DEBUG] LoopingGoal canContinueToUse => animationTimer=" + animationTimer); return animationTimer > 0; } @Override public void tick() { animationTimer--; System.out.println("[DEBUG] LoopingGoal TICK => animationTimer=" + animationTimer); // We stop ONLY if we are still looping if (animationTimer <= 0 && isLoopingActive) { System.out.println("[DEBUG] condition => animationTimer <= 0 && isLoopingActive"); stop(); } } @Override public void stop() { // Check if already stopped if (!isLoopingActive) { System.out.println("[DEBUG] stop() called again, but isLoopingActive = false. Doing nothing."); return; } System.out.println("[DEBUG] Looping STOP at tick=" + entity.level().getGameTime() + ", last known rotation=" + entity.getXRot() + "/" + entity.getYRot() + ", animationTimer=" + animationTimer); // Immediately switch to "swim" entity.setAnimation("swim"); // Reset cooldown cooldownTimer = cooldownTime; // Disable looping to prevent a second stop isLoopingActive = false; System.out.println("[DEBUG] Looping STOP => setAnimation('swim'), cooldownTimer=" + cooldownTimer); } }  
    • So is the intention of the crusher for ores meant to be used with a silk touch pickaxe or something? Cause that seems like too much effort just to profit off of the machine, when everything drops as raw materials now. Am I just missing something? 
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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