Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Crow

Forge Modder
  • Joined

  • Last visited

Everything posted by Crow

  1. ID's shouldn't be a problem anymore once we get a 1.8 update right? and i know absolutely nothing about TileEntitys... Might be time to learn.
  2. Seems that is what I would use if I were to have a class for each block. But am predicting little over 1000 blocks. So I would prefer to just have all of them pass through one block class. What if I already have the hex for all the colors I need? couldn't I take that from the constructor as a string? I would prefer to use RGB personally but if its easier to use hex without conversion I can, just don't know how. lol.. I am still a noob at all this but learning fast. Thanks for helping.
  3. I was editing my post when you replied. and you'll have to forgive me, I don't know what to do with that exactly..
  4. Error.. java.util.IllegalFormatConversionException: x != java.lang.String on String hex = String.format("#%02x%02x%02x", red, green, blue); Just to make sure you know I am calling the RGB values from the constructor as in the op. I changed the int to String and added private Strings for red, green and blue. Blue = new MODBlocks("Blue", Material.iron, 1.5F, 10F, Block.soundTypeMetal, "0", "0", "255"); public class MODBlocks extends Block { private String red; private String green; private String blue; public MODBlocks(String name, Material mat, float hard, float resi, SoundType sound, String R, String G, String B) { super(mat); this.setBlockName(name); this.setHardness(hard); this.setResistance(resi); this.setStepSound(sound); this.setCreativeTab(NEC.tabNECTabs); red = R; green = G; blue = B;
  5. That's what I was thinking but I don't know how...
  6. I wouldn't know how to translate it from being texture & biome dependent to being dependent on only RGB.
  7. I am adding alot of blocks to my mod. 1000+. All just solid colors. I am wondering, is there a way to have the texture generate for each block using RGB without each block needing a texture? Idea is something like this... whiteBlock = new ModBlocks("White"), Material.iron, 1.5F, 10F, Block.soundTypeMetal, 255, 255, 255); public class MODBlocks extends Block { protected MODBlocks(String name, Material mat, float hard, float resi, SoundType sound, int R, int G, int B) { super(mat); this.setBlockName(name); this.setHardness(hard); this.setResistance(resi); this.setStepSound(sound); this.setCreativeTab(MOD.tabMODTabs); GameRegistry.registerBlock(this, this.getUnlocalizedName().substring(5)); } /* ????? @SideOnly(Side.CLIENT) protected IIcon blockIcon; @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister p_149651_1_) { blockIcon = p_149651_1_.registerIcon(MOD.modid + ":" + this.getUnlocalizedName().substring(5)); } @SideOnly(Side.CLIENT) @Override public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return blockIcon; } ?????*/ }
  8. Yep. Well that was almost 7 days of hell. Can someone point me in the direction of the one who created slabs so I can punch them in the face? lol [sOLVED] Thanks imadnsn
  9. ok I decided to try the code I was using for another solid block and it works perfect. Don't know it works but it does. So I figure I wouldn't argue with it. lol @SideOnly(Side.CLIENT) protected IIcon blockIcon; @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister p_149651_1_) { blockIcon = p_149651_1_.registerIcon(minecraft:stone); } @SideOnly(Side.CLIENT) @Override public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return blockIcon; }
  10. right now for testing I am just using the minecraft stone texture and have it as this.blockIcon = par1IconRegister.registerIcon("minecraft:stone"); still not working
  11. Still no texture and now name is tile.MySlab.blockMaySlab.name
  12. ok I have it just unlocalizedName() and not super. I add public String blockName = unlocalizedName(); and func_150002_b return blockName it still doesnt have texture and its now tile.null.name
  13. ok I think I understand what you're saying but how do I go about doing that?
  14. I've been trying to get the slab to work for almost 5 days. I'm sure it's something so small and stupid.. Any help would be appreciated.
  15. Ok, now I have the slab working as a slab. It stacks. BUT now I have lost the texture and it is just showing up as .name in game. Registry blockMySlab = new MySlab(false, Material.rock).setBlockName("MySlab"); blockMySlabDouble = new MySlab(true, Material.rock).setBlockName("MySlabDouble"); GameRegistry.registerBlock(blockMySlab, ItemMySlab.class, "blockMySlab"); GameRegistry.registerBlock(blockMySlabDouble, ItemMySlab.class, "blockMySlabDouble"); ItemMySlab.class package com.blackbirdgaming.MyMod.items; import com.blackbirdgaming.MyMod.blocks.MyBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.item.Item; import net.minecraft.item.ItemSlab; public class ItemMySlab extends ItemSlab { public ItemMySlab(Block block) { super(block, (BlockSlab)MyBlocks.blockMySlab, (BlockSlab)MyBlocks.blockMySlabDouble, false); this.setMaxDamage(0); this.setHasSubtypes(true); } } MySlab.class package com.blackbirdgaming.MyMod.blocks.MySlab; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class MySlab extends BlockSlab { public static final String[] woodType = { "blockMySlab" }; public MySlab(boolean isDouble, Material mat) { super(isDouble, mat); useNeighborBrightness = true; } public void registerIcons(IIconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("mm:myslab"); } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(MyBlocks.blockMySlab); } public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) { if(par1World.getBlock(par2, par3 - 1, par4) == MyBlocks.blockMySlab) { par1World.setBlock(par2, par3 - 1, par4, MyBlocks.blockMySlabDouble); } if(par1World.getBlock(par2, par3 + 1, par4) == MyBlocks.blockMySlab) { par1World.setBlock(par2, par3 + 1, par4, MyBlocks.blockMySlabDouble); } } protected ItemStack createStackedBlock(int par1) { return new ItemStack(MyBlocks.blockMySlab, 2, par1 & 7); } public String getFullSlabName(int par1) { if ((par1 < 0) || (par1 >= woodType.length)) { par1 = 0; } return super.getUnlocalizedName() + "." + woodType[par1]; } public void getSubBlocks(Block block, CreativeTabs par2CreativeTabs, List par3List) { if (block != MyBlocks.blockMySlabDouble) { par3List.add(new ItemStack(block, 1, 0)); } } @Override public String func_150002_b(int p_150002_1_) { // TODO Auto-generated method stub return null; } }
  16. Ignore this....
  17. I have been messing with it for over 3 hours and still can't figure it out. I copied everything from the stone slab class, took out everything to do with multiple blocks, mines only one slab, and replaced everything referring to stone with my block and nothing. It's still in the creative inventory along with the double slab and still cant place another to make double.
  18. I have checked out the BlockSlab class but I cant really make heads or tales of it.
  19. I am looking for some help with creating custom slabs for my mod. I have searched around and can only find tutorials and samples for 1.6 or earlier. Does someone have a sample class I could take a look? Yes, I am new to coding and modding and yes I do know the basics of java though my knowledge is a drop in the bucket of what I need to know. I learn by doing. Taking code and ripping it apart to learn how everything works I just can't find anything for slabs. I have the slab in the game and it works as a normal block. I need to know how to make it act as a slab, double slab ect... Thanks in advanced.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.