Posted February 6, 201411 yr Does anyone know how to make a block so that some sides is textured differently (ex: Crafting table, furnace, piston)? Here's the related coding. Mod file: package vgt.material_paint; import vgt.material_paint.block.VGTBlockSketchingTable; import vgt.material_paint.proxy.ProxyCommon; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; import net.minecraft.stats.AchievementList; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod( modid = VGTmod_MaterialPaint.MODID, version = VGTmod_MaterialPaint.VERSION) public class VGTmod_MaterialPaint { public static final String MODID = "vgt_materialpaint"; public static final String VERSION = "1.0"; @SidedProxy( clientSide = "vgt.material_paint.proxy.ProxyClient", serverSide = "vgt.material_paint.proxy.ProxyCommon") public static ProxyCommon proxy; // Create the 'Sketching Table' block public static final Block sketchingTable = new VGTBlockSketchingTable(500, Material.wood).setStepSound(Block.soundTypeWood).setHardness(3.0F).setResistance(2.5F).setBlockName("sketchingTable").setBlockTextureName("vgt_materialpaint:sketchTable"); // Create the 'Drawn to Life' achievement public static final Achievement drawnToLife = new Achievement("Drawn to Life", "Craft a sketching table.", -1, 2, sketchingTable, AchievementList.buildWorkBench); @EventHandler public void Preinit(FMLPreInitializationEvent event){ // Register 'Sketching Table' block GameRegistry.registerBlock(sketchingTable, "Sketching Table"); } @EventHandler public void init(FMLInitializationEvent event){ // Create recipe for 'Sketching Table' GameRegistry.addShapedRecipe(new ItemStack(sketchingTable), new Object[]{ "PPP","WDW","WSW", 'P',Items.paper,'W',Blocks.planks,'D',Items.diamond,'S',Items.stick }); } @EventHandler public void load(FMLInitializationEvent event){ proxy.registerRenderers(); } } Block file: package vgt.material_paint.block; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class VGTBlockSketchingTable extends Block{ public VGTBlockSketchingTable(int id, Material material) { super(material); this.setCreativeTab(CreativeTabs.tabDecorations); } } Also, I'm positive my /assets/{domain}/textures/blocks directory is in the correct spot.
February 6, 201411 yr If you don't know how to do something that's already in vanilla, look at the vanilla code. If you really want help, give that modder a thank you. Modders LOVE thank yous.
February 6, 201411 yr Author I would have done that already, but I don't know where to view the source code. It's not possible in this version of forge.
February 7, 201411 yr Or look at the source for an old version of Minecraft. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 7, 201411 yr Author I did what you said, diesieben0, but I don't know how to view the source classes.
February 7, 201411 yr If you're in eclipse and you see the name of a class, you can either right click on it and click open declaration, or control click on the name itself. Both will bring you to the class. If you really want help, give that modder a thank you. Modders LOVE thank yous.
February 7, 201411 yr If you're in eclipse and you see the name of a class, you can either right click on it and click open declaration, or control click on the name itself. Both will bring you to the class. To store your icons use an array of how many textures you want, so for example public IIcon[] icons = new IIcon[3]; For 3 Textures, e.g: Top, Bottom, and One for all sides To register your textures: @Override public void func_149651_a(IIconRegister i) { icons[0] = i.registerIcon("modid:block_top"); icons[1] = i.registerIcon("modid:block_bottom"); icons[2] = i.registerIcon("modid:block_sides"); } And to declare them so it works ingame: @Override public IIcon func_149673_e(IBlockAccess block, int x, int y, int z, int side) { switch(side) { case 0 : return icons[0]; //Top case 1 : return icons[1]; //Bottom default : return icons[2]; //Sides } } //Switch switches depending on what case; //Case is basically saying if(side == 0); // If the case is 0 then return the top texture // If the case is 1 then return the bottom texture // Default basically says else{} // So if it is not 0 or 1, then return the side texture. // 0 is top, 1 is bottom, 2, 3, 4 and 5 are 4 of the sides, you can figure out what is what easily enoguh.
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.