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.

Erfurt

Members
  • Joined

  • Last visited

Everything posted by Erfurt

  1. Hey guys, I'm having some difficulty updating my custom walls, and i was hoping that someone could help me. Here's the code for my base wall class ( this worked in 1.8 ), I use this because I have different types of wall that have different properties, for example some of my walls emits light. I extend my other classes from the base class. public abstract class BaseBlockWall extends BlockWall { public BaseBlockWall(Block block) { super(block); } public int damageDropped(int meta) { return meta; } public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos) { return true; } public boolean canConnectTo(IBlockAccess world, BlockPos pos) { IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); return block == Blocks.BARRIER ? false : (((block != this && !(block instanceof BlockFenceGate) && !(block instanceof BlockWall))) ? (block.getMaterial(state).isOpaque() && state.isFullCube() ? block.getMaterial(state) != Material.GOURD : false) : true); } } At first glans everything seems to work. But none of my walls want to connect to each other. It only want to connect to itself. I want to have all of the different classes connecting to eachother. A second thing that isn't working is that I can't place torches on top of the walls. This is the code for my basic walls class. public class EadoreWall extends BaseBlockWall { public EadoreWall(Block block, String name) { super(block); this.setUnlocalizedName(name); this.setRegistryName(name); } @Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) { list.add(new ItemStack(item, 1, 0)); } } To my knowledge this should work. However it does not, maybe someone can see something I can't.
  2. Okay, so I've done some changes now, but it doesn't seem to work. Just to be sure that I have got this right. This is how my blockstate files should look like, when I use ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName() + "_" + name, "normal")) in my block class, right? { "variants": { "normal": { "model": "em:planks_maple" } } } BTW how do I specify a variant like "normal" for logs and walls, as their json files are somewhat different. Vanilla json for acacia log { "variants": { "axis=y": { "model": "acacia_log" }, "axis=z": { "model": "acacia_log", "x": 90 }, "axis=x": { "model": "acacia_log", "x": 90, "y": 90 }, "axis=none": { "model": "acacia_bark" } } } Vanilla json for cobblestone wall { "multipart": [ { "when": { "up": "true" }, "apply": { "model": "cobblestone_wall_post" } }, { "when": { "north": "true" }, "apply": { "model": "cobblestone_wall_side", "uvlock": true } }, { "when": { "east": "true" }, "apply": { "model": "cobblestone_wall_side", "y": 90, "uvlock": true } }, { "when": { "south": "true" }, "apply": { "model": "cobblestone_wall_side", "y": 180, "uvlock": true } }, { "when": { "west": "true" }, "apply": { "model": "cobblestone_wall_side", "y": 270, "uvlock": true } } ] }
  3. I have just made a github for the code. (I hope it works) https://github.com/Erfurt92/src EDIT: BTW I know that some of the json files never will work at this point in time, still working on those
  4. I got that working now. Just one last thing, it doesn't want to render the blocks... I don't understand why that is, as I have done everything you told me to. Most be something I do with my json files, only thing I can think might be the problem
  5. Well I have a few issues right now. First is that my subBlocks, seem to have the same name, so my lang file doesn't work anymore. Second is that the subBlocks still doesn't render when placed, but is rendered as items, in the inventory. I use the methods I mentioned above for the registering, I believe that I need to do something with the unlocalized names. Not sure how to do it at this time, but I will be working on that. I know you most be frustrated with me at this point, at least I would be... But I am learning a lot from this, so thank you
  6. I just thought it looked cleaner that way, but I have chanced it to be two different methods now, still doesn't work with the subBlocks. These are my current methods in my block class public static void registerBlock(Block block) { GameRegistry.register(block); GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName())); } public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } public static void registerSubBlocksRender(Block block, int meta, String name) { Item item = Item.getItemFromBlock(block); ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName() + "_" + name, "inventory")); } And this is how my client-proxy class looks like public class ClientProxy extends CommonProxy { @Override public void preInit() { myItems.init(); myItems.register(); myBlocks.init(); myBlocks.register(); registerRenders(); } @Override public void init() { } @Override public void registerRenders() { myItems.registerRenders(); myBlocks.registerRenders(); }
  7. I have made this method that creates the ItemBlock, as well as giving it the resourcelocation. public static void registerBlock(Block block) { GameRegistry.register(block); GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName())); Item item = Item.getItemFromBlock(block); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } Now I kinda want to know how I can make similarly method for subBlocks? What I have worked on, but it doesn't seem to work. public static void registerSubBlock(Block block, int meta, String name) { GameRegistry.register(block); GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName())); Item item = Item.getItemFromBlock(block); ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName() + "_" + name, "inventory")); }
  8. Okay, so I have managed to get this to work with all my items. But for some reason the game crashes when I do it with my blocks. Is there something special that I need to do for blocks? Here's the crash report I use this code for registering render public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); }
  9. This might be a silly question, but can the unlocalized name and the registry name be the same? Or do they have to be different?
  10. I believe I got it now, but I will have to do it tomorrow. But once again thanks for your help, I hope I can get it to work now
  11. I just tried to do what you suggested, and now everything is fucked None of my block have any textures, should I be using .setRegistryName() instead of .setUnlocalizedName() on my blocks aswell. Sorry for being such a huge noob, right now. It's just that the other way have always worked for me without any problems, and most tutorials I have seen seems to be doing the same thing. So I have actually never used .getRegistryName()
  12. I appreciate your help, but I just can't get this to work. I strongly believe that I'm doing something wrong, but I have been working with this problem most of the day. So I can't really concentrate any more, so I will get back to it tomorrow, maybe the issue will just pop up. But after looking at it a bit closer, I can see that the code is looking a lot like the code I use for registering. public static void registerSubBlocksRender(Block block, int meta, String name) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5) + "_" + name, "inventory")); } Maybe they do the same thing? I really don't know at this point.
  13. Okay, so just to be sure. I should replace the registerItemVariants with this? ModelLoader.setCustomModelResourceLocation(leaf, 0, new ModelResourceLocation("em:leaves_maple")); ModelLoader.setCustomModelResourceLocation(leaf, 1, new ModelResourceLocation("em:leaves_poplar")); And is that all? I can't seem to get this to work at all
  14. Hey guys, I'm having some problems getting some subBlocks to work properly. At them moment I have everything working texture and render-wise for when the blocks is in the inventory. But as soon as I place them, they just show up as the purple/black blocks. I use this code to set a resource location for each subBlock Item leaf = Item.getItemFromBlock(myBlocks.leaves); ModelBakery.registerItemVariants(leaf, new ResourceLocation("em:leaves_maple"), new ResourceLocation("em:leaves_poplar")); But I think that only adds a resource location for the item. And the block itself still doesn't know where to look for it's resource. I'm having a hard time figuring out how to fix this, maybe someone here knows what to do, and can help me.
  15. I see, and how would I go about doing that, if I may ask? Call OreDictionary.registerOre in init. Forge registers vanilla planks as "plankWood" and uses this as a replacement ingredient for planks when it replaces vanilla recipes with ore recipes; so register your planks as "plankWood" as well. Awesome thanks alot, that did the trick
  16. I see, and how would I go about doing that, if I may ask?
  17. Hey guys, So I just wanted to know if there's a easy way to add my custom planks to crafting recipes like, beds, chests, and stuff like that, so that they will work if I'm using my custom planks with vanilla planks. I know I can do something like this. GameRegistry.addRecipe(new ItemStack(Blocks.crafting_table, 1), "ww", "ww", 'w', new ItemStack(myBlocks.planks, 1, OreDictionary.WILDCARD_VALUE)); But that will only allow me to use my own custom planks in the crafting recipe, if I use any vanilla planks, the recipe won't work. I know this is a newbi question, but you know
  18. Nevermind, I got it working
  19. I feel stupid, but I can't get this to work. Could you maybe give me an example of this in use?
  20. I have a hard time understanding blockstate fully, without trying it ☺️ I will try your suggestion, when I get home from work
  21. Hey guys, so I'm working on some new trees, and now I have a problem. I'm adding trees as subblocks, and I can't get the .json files to work. Here's my code My main problem is that the logs look for a .json file with the name log.json. Whereas I want the maple log to look for either maple_log.json or log_maple.json, and the poplar log to look for either poplar_log.json or log_poplar.json. I don't know how to use .json files with subBlocks/metadata, but I want to learn, that's why I haven't just added two new blocks instead of subBlocks/metadata. I hope someone here with better understanding of .json files or subBlocks/metadata can help me out.
  22. I'll give it a try, and see if I can make it work.
  23. Would it be easier to make 'custom' blocks and replace the orignal mobspawner? Or should I just forget about this?
  24. I have been able to change the spawner that is dropped, using the example code you linked. Now I just need to get the tag from the block that is being mined. At the moment all spawners drop a Zombie spawner in stead of a Pig spawner
  25. Hey guys, So as the title says, I want to know if it's possible to make vanilla mob spawners drop, with the correct mob inside. I believe that mob spawners use NBT tags, but I'm not sure. And I have no idea if it's possible to make blocks drop with NBT tags, or whatever else mob spawners use to determin what kind of mob spawner it is. I haven't tried to code this yet, because I would like to know if it's possible or if I have to make custom spawners.

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.