Jump to content

[1.8.9] Rendering TnT?


Recable

Recommended Posts

So far I've made my TnT classes, both the blocks and the entity, using the java code that is, and so for I have it exploding correctly and I can change the radius of the explosion and fuse timer too, so that's perfect, however the texture won't work, and when I light it, it just goes invisible and still blows up after the correct amount of seconds.

 

Here is my Blocks class:

package com.TestMod.mod.blocks;

import com.TestMod.mod.ModGlobal;
import com.TestMod.mod.nukes.ModTestBlockTnt;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModBlocks {

public static Block TestBlockTnt;

public static void initBlocks() {
	GameRegistry.registerBlock(TestBlockTnt = new ModTestBlockTnt("TestBlockTnt", Material.grass, 0, 0), "TestBlockTnt");
}	
}

 

 

Here is my Block Rendering Class:

package com.TestMod.mod.render;

import com.TestMod.mod.MODGlobal;
import com.TestMod.mod.blocks.ModBlocks;
import com.TestMod.mod.init.ModBlocks;
import com.TestMod.mod.ores.MODOres;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class MODBlockRender {

public static void registerBlockRender() {

	regBlock(ModBlocks.TestBlockTnt);


}

public static void regBlock(Block block) {
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(MODGlobal.MOD_ID + ":" + block.getUnlocalizedName().substring(5), "inventory"));
}
}

 

 

Here is my Client Proxy:

package com.TestMod.mod.proxy;

import com.TestMod.mod.blocks.ModBlock;
import com.TestMod.mod.blocks.ModBlocks;
import com.TestMod.mod.init.ModBlocks;


import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

public class ClientProxy extends CommonProxy {

public void preInit(FMLPreInitializationEvent preEvent) {

	super.preInit(preEvent);

	}


public void init(FMLInitializationEvent event) {

	super.init(event);

	ModBlockRender.registerBlockRender();
;
	ModBlocks.registerRenders();
}

@Override
public void registerModelBakery() {
	//Gears

	ModelBakery.registerItemVariants(Item.getItemFromBlock(ModBlocks.TestBlockTnt), new ResourceLocation ("mod:TestBlockTnt_top"));
	ModelBakery.registerItemVariants(Item.getItemFromBlock(ModBlocks.TestBlockTnt), new ResourceLocation ("mod:TestBlockTnt_bottom"));
	ModelBakery.registerItemVariants(Item.getItemFromBlock(ModBlocks.TestBlockTnt), new ResourceLocation ("mod:TestBlockTnt_side"));


}

public void postInit(FMLPostInitializationEvent postEvent) {

	super.postInit(postEvent);

}

}

 

 

Here is my Blockstate json (Named: ' TestBlockTnt.json '):

 

{

    "variants": {

        "normal": [

            { "model": "mod:TestBlockTnt" },

            { "model": "mod:TestBlockTnt", "y": 90 },

            { "model": "mod:TestBlockTnt", "y": 180 },

            { "model": "mod:TestBlockTnt", "y": 270 }

        ]

    }

}

 

 

 

 

Here is my Block json (Named: ' TestBlockTnt.json '):

 

{

    "parent": "block/cube_bottom_top",

    "textures": {

        "bottom": "mod:blocks/TestBlockTnt_bottom",

        "top": "mod:blocks/TestBlockTnt_top",

        "side": "mod:blocks/TestBlockTnt_side"

    }

}

 

 

 

 

Here is my Item json (Named: ' TestBlockTnt.json '):

 

{

    "parent": "mod:block/TestBlockTnt",

    "display": {

        "thirdperson": {

            "rotation": [ 10, -45, 170 ],

            "translation": [ 0, 1.5, -2.75 ],

            "scale": [ 0.375, 0.375, 0.375 ]

        }

    }

}

 

 

Link to comment
Share on other sites

IIRC, when a TNT block is activated, it is replaced by an activated TNT entity. That entity can fall and be affected by any other mods moving entities (like my fan/blower mod). In any case, it is no longer a block. I don't see any code for your invisible TNT entity, so I can't guess what its problem is.

 

How does your entity compare to the vanilla TNT entity? Also see [urlhttp://www.minecraftforge.net/forum/index.php?topic=38445.0]Problem with rendering entities[/url].

 

PS: There's no lower case 'n' in "TNT". It stands for Tri-Nitro-Toluene, a semi-stable improvement over the much more temperamental nitroglycerin.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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



×
×
  • Create New...

Important Information

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