candlemaster
-
Posts
9 -
Joined
-
Last visited
Posts posted by candlemaster
-
-
So, I want to make a new block that uses a custom model, and I have no idea where to begin. I have Techne, but I'm not entirely sure how it works, almost all the tutorials that I found for it are for making mobs. I would like to avoid using a Tile Entity, so my custom block can be pushed and pulled by a piston, like cauldrons and stairs can.
Almost all of the tutorials for this that I've seen are either so outdated that I can't figure out how to make them work in 1.5.2, or they use tile entities.
Any idea where I can start?
-
It works! Thank you thank you sooo much!
-
I had this problem too. Use "setUnlocalizedName()" instead of "setBlockName()"/"setItemName()".
-
It works great (I had to use setUnlocalizedName() instead of setItemName()), but now I have working double slabs. Problem is, now my double slab has a name, but my single slabs have a blank tooltip.
Here's some bits of code that might be relevant:
public static BlockHalfSlab haySlab = (BlockHalfSlab) new SlabHay(505, false) .setUnlocalizedName("haySlab") .setCreativeTab(CreativeTabs.tabBlock); public static BlockHalfSlab hayDoubleSlab = (BlockHalfSlab) new SlabHay(506, true) .setUnlocalizedName("hayDoubleSlab"); @Init public void load(FMLInitializationEvent event) { proxy.registerRenderers(); //// Register the block, it's name, and it's harvest level // Hay Double Slab GameRegistry.registerBlock(hayDoubleSlab, "hayDoubleSlab"); LanguageRegistry.addName(hayDoubleSlab, "Hay Double Slab"); MinecraftForge.setBlockHarvestLevel(hayDoubleSlab, "hatchet", 0); // Hay Slab GameRegistry.registerBlock(haySlab, "haySlab"); LanguageRegistry.addName(haySlab, "Hay Slab"); MinecraftForge.setBlockHarvestLevel(haySlab, "hatchet", 0); //// Register the recipes // Hay Slab GameRegistry.addRecipe(new ItemStack(haySlab, 6), "xxx", 'x', new ItemStack(hayBlock)); } @PostInit public void postInit(FMLPostInitializationEvent event) { Item.itemsList[haySlab.blockID] = new ItemSlab(haySlab.blockID - 256, (BlockHalfSlab)haySlab, (BlockHalfSlab)hayDoubleSlab, false) .setUnlocalizedName("haySlab"); }
Any idea why my single slab has no name? I tried using
LanguageRegistry.addName(Item.itemsList[haySlab.blockID], "Hay Slab");
to no avail.
-
So, I managed to create a half slab that works nicely, but when I try to put another one on top of it, it doesn't create a double slab; instead it creates a new slab above it. It inherits from BlockHalfSlab, and I used that class as well as BlockWoodSlab as examples, but I can't seem to figure this out. Here's what I have so far:
public class SlabHay extends BlockHalfSlab { protected static Icon iconSide; public SlabHay(int id, boolean doubleslab) { super(id, doubleslab, Material.wood); setHardness(1.5f); setResistance(4.0f); setStepSound(Block.soundGrassFootstep); setUnlocalizedName("haySlab"); useNeighborBrightness[id] = true; } public int idDropped(int par1, Random par2Random, int par3) { return HayMod.haySlab.blockID; } public String getFullSlabName(int i) { if (!isDoubleSlab) return super.getUnlocalizedName() + "haySlab"; else return super.getUnlocalizedName() + "hayDoubleSlab"; } @Override public void func_94332_a(IconRegister par1IconRegister) { iconSide = par1IconRegister.func_94245_a("hvh:hay_side"); field_94336_cN = par1IconRegister.func_94245_a("hvh:hay_top"); } @SideOnly(Side.CLIENT) public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { if (par1 == 0 || par1 == 1) return field_94336_cN; else return iconSide; } }
Is there a method that I missed? Am I supposed to register it with something?
-
That fixed it! Thank you so much!
-
I tried registering the blocks before adding the names, but nothing changed. They were both still called "Generic Block".
-
So, I'm just starting out learning the forge api (7.7.0), following the basic tutorials on the forge wiki (which have been extremely helpful, even with 1.5 being so new). I was able to get a couple of blocks and items working, even with new textures (it wasn't hard to figure out from the wiki, though I'm still not sure how to handle side textures). However, a big problem I'm having, is that both of my items have the same name, and likewise both of my blocks have the same name, despite them being different in code.
Here's an except from my Generic.java:
public final static Block genericDirt = new GenericBlock(500, Material.rock); public final static Block genericOre = new GenericOre(501, Material.iron); public final static Item genericGem = new GenericItem(5000); public final static Item genericThingy = new GenericThingy(5001); @Init public void load(FMLInitializationEvent event) { proxy.registerRenderers(); LanguageRegistry.addName(genericGem, "Generic Gem"); LanguageRegistry.addName(genericThingy, "Generic Thingy"); LanguageRegistry.addName(genericOre, "Generic Ore"); MinecraftForge.setBlockHarvestLevel(genericOre, "pickaxe", 3); GameRegistry.registerBlock(genericOre, "genericOre"); LanguageRegistry.addName(genericDirt, "Generic Block"); MinecraftForge.setBlockHarvestLevel(genericDirt, "pickaxe", 0); GameRegistry.registerBlock(genericDirt, "genericDirt"); }
In-game, both of my blocks are named "Generic Block", when one of them is supposed to be named "Generic Ore". Both of my items are named "Generic Thingy", when one of them is supposed to be named "Generic Gem". Everything else - materials, sounds, textures, item drops, etc. - works as intended. What am I doing wrong?
SOLVED:
I fixed it by using setUnlocalizedName() with the blocks and items. In the tutorials, setBlockName()/setItemName() was used, but these methods no longer exist, so I simply removed them. Using setUnlocalizedName() in their placed fixed everything.
Problems with block using grass shading
in Modder Support
Posted
I'm making a "grass cover" block, which is meant to mimic the behavior of snow (except melting) but look like grass. So far I have the snow behavior working perfectly, but the grass shading has problem to be a bit challenging. The top of the block uses the correct color, but the sides are all completely gray! What am I doing wrong? Here's the source code for the block:
Any advice? Thanks in advance.