Jump to content

1.5.1 Custom Block render problem, Invisible blocks


Jade_Knightblazer

Recommended Posts

Hmm, with the new 1.5.1 seems my Custom Blocks no longer render in the world....

 

Here is the Code I use:

 

Render Class

package mod_HarkenScythe.client;

import mod_HarkenScythe.common.BlockHSBloodCrucible;
import mod_HarkenScythe.common.BlockHSSoulCrucible;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.SideOnly;
import mod_HarkenScythe.common.mod_HarkenScythe;

public class RenderHSCrucible implements ISimpleBlockRenderingHandler
{

@Override
public boolean shouldRender3DInInventory() {
	// TODO Auto-generated method stub
	return false;
}

@Override
public int getRenderId() {
	// TODO Auto-generated method stub
	return mod_HarkenScythe.HSCrucibleRenderID;
}


@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
	// TODO Auto-generated method stub
}

@Override
public boolean renderWorldBlock(IBlockAccess blockAccess, int par2, int par3, int par4, Block par1BlockHSCrucible, int modelId, RenderBlocks renderer)
{
	// TODO Auto-generated method stub

	////Added*********************
	renderer.renderStandardBlock(par1BlockHSCrucible, par2, par3, par4);
        Tessellator tessellator = Tessellator.instance;
        tessellator.setBrightness(par1BlockHSCrucible.getMixedBrightnessForBlock(blockAccess, par2, par3, par4));
        float f = 1.0F;
        int l = par1BlockHSCrucible.colorMultiplier(renderer.blockAccess, par2, par3, par4);
        float f1 = (float)(l >> 16 & 255) / 255.0F;
        float f2 = (float)(l >> 8 & 255) / 255.0F;
        float f3 = (float)(l & 255) / 255.0F;
        float f4;

        if (EntityRenderer.anaglyphEnable)
        {
            float f5 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
            f4 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
            float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
            f1 = f5;
            f2 = f4;
            f3 = f6;
        }

        tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
        Icon icon = par1BlockHSCrucible.getBlockTextureFromSide(2);
        f4 = 0.125F;
        renderer.renderSouthFace(par1BlockHSCrucible, (double)((float)par2 - 1.0F + f4), (double)par3, (double)par4, icon);
        renderer.renderNorthFace(par1BlockHSCrucible, (double)((float)par2 + 1.0F - f4), (double)par3, (double)par4, icon);
        renderer.renderWestFace(par1BlockHSCrucible, (double)par2, (double)par3, (double)((float)par4 - 1.0F + f4), icon);
        renderer.renderEastFace(par1BlockHSCrucible, (double)par2, (double)par3, (double)((float)par4 + 1.0F - f4), icon);
        
        Icon icon1;
        if (par1BlockHSCrucible == mod_HarkenScythe.HSBloodCrucible){icon1 = BlockHSBloodCrucible.iconInner;}
        else{icon1 = BlockHSSoulCrucible.iconInner;}
        
        renderer.renderTopFace(par1BlockHSCrucible, (double)par2, (double)((float)par3 - 1.0F + 0.25F), (double)par4, icon1);
        renderer.renderBottomFace(par1BlockHSCrucible, (double)par2, (double)((float)par3 + 1.0F - 0.75F), (double)par4, icon1);
        int i1 = blockAccess.getBlockMetadata(par2, par3, par4);

        if (i1 > 0)
        {
            Icon icon2;
            if (par1BlockHSCrucible == mod_HarkenScythe.HSBloodCrucible){icon2 = BlockHSBloodCrucible.iconLiquid;}
            else{icon2 = BlockHSSoulCrucible.iconLiquid;}

            if (i1 > 10)
            {
                i1 = 10;
            }
            
            renderer.renderTopFace(par1BlockHSCrucible, (double)par2, (double)((float)par3 - 1.0F + (3.6875F + (float)i1 * 1.1F) / 16.0F), (double)par4, icon2);
        }

        return true;
}
}

 

In my Client Proxy

RenderingRegistry.registerBlockHandler(mod_HarkenScythe.HSCrucibleRenderID, new RenderHSCrucible());

 

And in my mod_Class

//Setup Render IDs

    public static int HSCrucibleRenderID = RenderingRegistry.getNextAvailableRenderId();

 

 

The block is there, just invisible...

Link to comment
Share on other sites

I can confirm this. The hook in RenderBlocks that allows for custom rendering of world blocks using new render types seems to have just disappeared in the new version... There's no way Forge would remove such an important feature as this, so I would suggest waiting until a new version comes out and resolves the problem.

Link to comment
Share on other sites

I'm a first-time modder (though not a new programmer) and I was trying to do this the other day and am having the same issue, but I understand that a lot apparently just changed within Minecraft graphics-wise so I figured I'd wait it out. I've been stalking this forum and minecraftforum.net looking for info since then, glad it's not just me.

 

I based the part of my mod (the custom model rendering) I'm having trouble with on this post over at the minecraft forums, which for the most part was really helpful, unless it's just that outdated :P

 

I have the block/item coded properly, but it renders invisibly (or not at all, whichever).

 

I've gone through all sorts of code for existing blocks/items but I am kind of at a loss as to what parts of the vanilla minecraft code are appropriate to use in a forge mod because I've never done this before.

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

    • One of my players is suddenly unable to join a locally hosted MC Eternal server. We have been playing on this server for about 2-3 weeks now. I have tried erasing his player files and his reputation file, and now it just coughs up this and kicks him out: [User Authenticator #5/INFO] [minecraft/NetHandlerLoginServer]: UUID of player EthosTheGod is 7692d8db-02c3-424f-a4ab-0e4e259b106b [20:25:36] [User Authenticator #4/INFO] [minecraft/NetHandlerLoginServer]: UUID of player EthosTheGod is 7692d8db-02c3-424f-a4ab-0e4e259b106b [20:29:35] [Server thread/WARN] [minecraft/MinecraftServer]: Can't keep up! Did the system time change, or is the server overloaded? Running 575849ms behind, skipping 11516 tick(s) [20:29:35] [Server thread/INFO] [minecraft/NetHandlerLoginServer]: com.mojang.authlib.GameProfile@4a6c63f1[id=7692d8db-02c3-424f-a4ab-0e4e259b106b,name=EthosTheGod,properties={textures=[com.mojang.authlib.properties.Property@241ea89e]},legacy=false] (/IP.ADDRESS) lost connection: Disconnected [20:29:35] [Server thread/INFO] [minecraft/NetHandlerLoginServer]: com.mojang.authlib.GameProfile@6ab6c661[id=7692d8db-02c3-424f-a4ab-0e4e259b106b,name=EthosTheGod,properties={textures=[com.mojang.authlib.properties.Property@7f19aae3]},legacy=false] (/IP.ADDRESS) lost connection: Disconnected It just says "connection timed out" on his end. Any ideas?
    • I'm trying to migrate my mod from 1.20 to 1.21. Some packages in the forge api were changed so my mod did have some classes not working. I've changed everything i needed but still is getting me the following error error: cannot access Registry DeferredRegister.create(ForgeRegistries.BLOCKS, FarmMod.MOD_ID); ^ class file for net.minecraft.core.Registry not found The piece of code that is wrong is   public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, FarmMod.MOD_ID); And here are my imports   import com.lucas.farmmod.FarmMod; import com.lucas.farmmod.block.custom.BaseIrrigatorBlock; import com.lucas.farmmod.item.ModItems; import com.lucas.farmmod.item.custom.BaseIrrigatorBlockItem; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; The class DeferredRegister is throwing the error in the print below     I've tried running rebuilding my project in every way possible, tried refreshing my dependencies but nothing works. What can i do?
    • It sounds like there might be a synchronization issue with your PartEntity. Ensure that the part entity’s position is updated in your entity's tick method to continuously match the main entity’s location.
    • For keyboard and mouse inputs, Minecraft Forge utilizes the event system to manage interactions, making it easier to handle across different mods. If you’re looking to bypass this and read inputs directly, you’d typically look into the KeyboardListener and MouseListener classes in the game's code. These classes process input events directly from the user's hardware. If you're experimenting with inputs a lot, you might find a compact keypad handy for quick commands. Check out numeric keyboard . It can speed up your coding workflow! Good luck!
  • Topics

×
×
  • Create New...

Important Information

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