Jump to content

Recommended Posts

Posted (edited)

Hi! I'm creating a block that needs to be translucent, bc the model isn't a perfect cube. When I put it in the ground, the bottom become trasparent. I know it's a well knowed issue, but everything I could find told me to set its render layer with RenderTypeLookup#setRenderLayer (I also found topics which solved this problem overriding the Block#getRenderLayer(), but it doesnt exist anymore in this version) , so, I did it, but nothing changed and the bottom of the block still invisible, I tried getCutout(), getTranslucent() and a bunch of other methods but nothing worked (Yeah, the SetupClient#onClientSetupEvent is being called). Any ideas?

 

(I'm sorry if there is any english grammar mistake or something like that)

 

Here are the code and the block printscreen:

package net.threader.generatorsmod;

import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.threader.generatorsmod.init.SetupClient;
import net.threader.generatorsmod.init.SetupCommon;

@Mod(GeneratorMod.MODID)
public class GeneratorMod {

    public static final String MODID = "generators";
    public static IEventBus MOD_EVENT_BUS;

    public GeneratorMod() {

        MOD_EVENT_BUS = FMLJavaModLoadingContext.get().getModEventBus();

        MOD_EVENT_BUS.register(SetupCommon.class);

        DistExecutor.runWhenOn(Dist.CLIENT, () -> GeneratorMod::registerClientOnlyEvents);

    }

    public static void registerClientOnlyEvents() {
        MOD_EVENT_BUS.register(SetupClient.class);
    }
}
package net.threader.generatorsmod;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.threader.generatorsmod.init.SetupCommon;

public class GeneratorBlock extends Block {

    public GeneratorBlock() {
        super(Block.Properties.create(Material.ROCK));
    }

    @Override
    public boolean hasTileEntity(BlockState state) {
        return true;
    }
    
    @Override
    public TileEntity createTileEntity(BlockState state, IBlockReader world) {
        return SetupCommon.tileEntityType.create();
    }
}
package net.threader.generatorsmod.init;

import net.minecraft.block.GlassBlock;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

public class SetupClient {
    @SubscribeEvent
    public static void onClientSetupEvent(FMLClientSetupEvent event) {
        RenderTypeLookup.setRenderLayer(SetupCommon.generatorBlock, RenderType.getCutout());
    }

}

 

unknown.png

Edited by threader

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.