Posted October 1, 201411 yr Hello, I have a custom slab class, these custom slabs function normally. Aside from two things; One: The slabs do not stack, when I place them on each-other there's a big empty space. Two: When I click in with the scroll wheel of my mouse, it gives me a stone slab instead. It's the same thing with any custom block that extends a vanilla block, is there a method to fix this? Picture of my problem: http://postimg.org/image/g97zuc2fp/ I have also tried to register the "ItemSlab" in postInit from the following tutorial (Changing the syntax to 1.7.10 myself), but it was of no use, my blocks simply wouldn't stack. Here's my registry and slab class. Registering: orangeHalfSlab = new OrangeSlab(false, CreativeTabs.tabBlock, "orangehalfslab"); orangeDoubleSlab = new OrangeSlab(true, null, "orangefullslab"); Slab Class (Cut out import statements): public class OrangeSlab extends BlockSlab { public OrangeSlab(boolean isFullBlock, CreativeTabs tab, String blockName) { super(isFullBlock, Material.wood); if(tab != null){ setCreativeTab(tab); } setBlockName(Constants.MODID + "_" + blockName); setHardness(1.5F); GameRegistry.registerBlock(this, blockName); } @Override public void registerBlockIcons(IIconRegister iconRegister){ this.blockIcon = iconRegister.registerIcon(Constants.MODID + ":" + "orangeplank"); } @Override public String func_150002_b(int p_150002_1_) { return getUnlocalizedName(); } } To reiterate, the issue is not with texturing, but the fact the slabs do not change to doubleslabs when placed together, thank you for your time.
October 1, 201411 yr For double slabs, you need to register a custom ItemBlock with the block. Have a look at ItemSlab in vanilla. Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
October 1, 201411 yr Author Okay, so, I implemented a class that extends ItemSlab. The issue is that I'm getting an ID overlap. (Two of the same Id, I think) So it crashes Minecraft upon startup. ItemSlab class: public class OrangeItemSlab extends ItemSlab{ String name = "orangeitemslab"; public OrangeItemSlab(Block block){ super(block, (BlockSlab)ModBlocks.orangeHalfSlab, (BlockSlab)ModBlocks.orangeDoubleSlab, false); setUnlocalizedName(Constants.MODID + "_" + name); this.setMaxDamage(0); this.setHasSubtypes(true); GameRegistry.registerItem(this, name); } } The use of the class: OrangeItemSlab orangeSlab = new OrangeItemSlab(ModBlocks.orangePlank); Error Log (Some of it): [00:12:36] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ---- // My bad. Time: 10/1/14 12:12 AM Description: Initializing game java.lang.IllegalStateException: Can't free registry slot 167 occupied by net.minecraft.item.ItemBlock@6f1762d0 at cpw.mods.fml.common.registry.GameData.freeSlot(GameData.java:926) at cpw.mods.fml.common.registry.GameData.registerItem(GameData.java:832) at cpw.mods.fml.common.registry.GameData.registerItem(GameData.java:802) at cpw.mods.fml.common.registry.GameRegistry.registerItem(GameRegistry.java:143) at cpw.mods.fml.common.registry.GameRegistry.registerItem(GameRegistry.java:131) at com.zacharysturtz.OrangeItemSlab.<init>(OrangeItemSlab.java:17) at com.zacharysturtz.ModItems.init(ModItems.java:17) at com.zacharysturtz.Main.preInit(Main.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at GradleStart.bounce(GradleStart.java:107) at GradleStart.startClient(GradleStart.java:100) at GradleStart.main(GradleStart.java:55) Et Cetera... (Edit) For additional reference, here is the source GameData.class method where the error points to: private void freeSlot(int id, Object obj) { FMLControlledNamespacedRegistry<?> registry = (obj instanceof Block) ? iBlockRegistry : iItemRegistry; Object thing = registry.getRaw(id); if (thing != null && thing != obj) { throw new IllegalStateException(String.format("Can't free registry slot %d occupied by %s", id, thing)); //----This is thrown } availabilityMap.clear(id); }
October 1, 201411 yr When you are registering your block, you need to specify the ItemBlock too. GameRegistry.registerBlock(block,CustomItemBlock.class,name); Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
October 1, 201411 yr Author Solved, took me awhile because I am slightly retarded. Finished slab class: import cpw.mods.fml.common.registry.GameRegistry; 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.util.IIcon; public class OrangeSlab extends BlockSlab { String name; public OrangeSlab(boolean isFullBlock, CreativeTabs tab, String blockName) { super(isFullBlock, Material.wood); if(tab != null){ setCreativeTab(tab); } name = blockName; setBlockName(Constants.MODID + "_" + blockName); setHardness(1.5F); } @Override public void registerBlockIcons(IIconRegister iconRegister){ this.blockIcon = iconRegister.registerIcon(Constants.MODID + ":" + "orangeplank"); } @Override public String func_150002_b(int p_150002_1_) { // TODO Auto-generated method stub return getUnlocalizedName(); } } Finished ItemSlab class: package com.zacharysturtz; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.item.ItemSlab; import net.minecraft.item.ItemStack; public class OrangeItemSlab extends ItemSlab{ public OrangeItemSlab(Block block){ super(block, (BlockSlab)ModBlocks.orangeHalfSlab, (BlockSlab)ModBlocks.orangeDoubleSlab, false); this.setMaxDamage(0); this.setHasSubtypes(true); setUnlocalizedName(Constants.MODID + "_orangeitemslab"); } } Finished slab creation: Block orangeHalfSlab = new OrangeSlab(false, CreativeTabs.tabBlock, "orangehalfslab"); Block orangeDoubleSlab = new OrangeSlab(true, null, "orangefullslab"); Finished Registery (Inside of preinit): GameRegistry.registerBlock(ModBlocks.orangeHalfSlab, OrangeItemSlab.class, "orangehalfslab"); GameRegistry.registerBlock(ModBlocks.orangeDoubleSlab, OrangeItemSlab.class, "orangefullslab");
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.