Hello. I seem to have run into an issue with my slabs not showing their name in the GUI.
I added the LanguageRegistry.addName for it but it still shows as a Blank in eclipse and as Unnamed in the actual Minecraft Client (Outside of Eclipse)
Please Help!
Mod Code
package rubymod.muscleman1234.common;
import java.io.File;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.block.BlockStep;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandManager;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.ServerCommandManager;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.Mod.ServerStarting;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid="RubyModMuscleMan1234", name="The Ruby Mod", version="1.5.2B_2")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class RubyMod {
//Handles the /rubymod Command.
public class CommandRubyMod extends CommandBase{
public String getCommandName()
{
return "rubymod";
}
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
EntityPlayerMP var3 = getCommandSenderAsPlayer(par1ICommandSender);
par1ICommandSender.sendChatToPlayer("[Ruby Mod] Version 1.5.2B_2. Check http://goo.gl/9i0G4 for updates. Hosted by the Minecraft Forums.");
}
}
// The instance of your mod that Forge uses.
@Instance("RubyMod")
public static RubyMod instance;
// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="rubymod.muscleman1234.client.ClientProxyRubyMod", serverSide="rubymod.muscleman1234.common.CommonProxyRubyMod")
public static CommonProxyRubyMod proxy;
//Items
//Weapons
public static Item RubySword;
public static Item RubyAxe;
public static Item RubyPick;
public static Item RubyShovel;
public static Item RubyHoe;
//Armor Items
public static Item rubyhelmet;
public static Item rubychestplate;
public static Item rubyleggings;
public static Item rubyboots;
//Basic Items
public static Item rubygem;
public static Item paperstick;
public static Item lifegem;
//Food/Drink Items
public static Item redpie;
public static Item lollipop;
public static Item candy;
public static Item wine;
//Music Disc
public static Item rubydisk;
//Blocks (Finally!)
//Ore
public static Block rubyore;
public static Block hellrubyore;
//Decoration Blocks
public static Block rubyfence;
public static Block rubydecor;
public static Block rubyglass;
public static Block rubygate;
//Special/Technical Blocks
//slabs
public static Block rubysingle;
public static Block rubydouble;
@PreInit
public void preInit(FMLPreInitializationEvent event) {
// Stub Method
}
//Starts Entity ID
static int startEntityId=300;
@Init
public void load(FMLInitializationEvent event) {
proxy.registerRenderThings();
//Armor Registration
rubyhelmet = new ItemRubyArmor(6000, EnumArmorMaterial.IRON, proxy.addArmor("ruby"), 0).setUnlocalizedName("rubyMod:rubyhelmet");
rubychestplate = new ItemRubyArmor(6001, EnumArmorMaterial.IRON, proxy.addArmor("ruby"), 1).setUnlocalizedName("rubyMod:rubychest");
rubyleggings = new ItemRubyArmor(6002, EnumArmorMaterial.IRON, proxy.addArmor("ruby"), 2).setUnlocalizedName("rubyMod:rubypants");
rubyboots = new ItemRubyArmor(6003, EnumArmorMaterial.IRON, proxy.addArmor("ruby"), 3).setUnlocalizedName("rubyMod:rubyboots");
//Tools and Weapons
RubySword = new ItemSword(8005, EnumToolMaterial.IRON).setUnlocalizedName("rubyMod:sword");
RubyShovel = new ItemSpade(8006, EnumToolMaterial.IRON).setUnlocalizedName("rubyMod:shovel");
RubyPick = new ItemPickaxe(8007, EnumToolMaterial.IRON).setUnlocalizedName("rubyMod:pickaxe");
RubyHoe = new ItemHoe(8008, EnumToolMaterial.IRON).setUnlocalizedName("rubyMod:hoe");
RubyAxe = new ItemAxe(8009, EnumToolMaterial.IRON).setUnlocalizedName("rubyMod:axe");
//Food/Drink Items
redpie = new ItemFood(8010, 5, false).setUnlocalizedName("rubyMod:pie");
wine = new ItemRedWine(8011).setUnlocalizedName("rubyMod:wine").setCreativeTab(CreativeTabs.tabFood);
lollipop = new ItemFood(8012, 5, false).setUnlocalizedName("rubyMod:lollipop");
candy = new ItemFood(8013, 3, false).setUnlocalizedName("rubyMod:candy");
//Misc Items
rubygem = new Item(8014).setUnlocalizedName("rubyMod:rubygem").setCreativeTab(CreativeTabs.tabMaterials);
paperstick = new Item(8015).setUnlocalizedName("rubyMod:stickofpaper").setCreativeTab(CreativeTabs.tabMisc);
lifegem = new ItemLifeGem(8016).setUnlocalizedName("rubyMod:life").setCreativeTab(CreativeTabs.tabMisc);
//Blocks
rubyore = new BlockRubyOre(1096, 0).setStepSound(Block.soundStoneFootstep).setHardness(15.0F).setResistance(10F).setLightValue(0.000F).setUnlocalizedName("ore");
hellrubyore = new BlockNetherRubyOre(1097, 0).setStepSound(Block.soundStoneFootstep).setHardness(15.0F).setResistance(10F).setLightValue(0.000F).setUnlocalizedName("netherore");
rubydecor = new BlockRubyBlock(1098, 0).setStepSound(Block.soundMetalFootstep).setHardness(15.0F).setResistance(10F).setLightValue(0.000F).setUnlocalizedName("decblock");
rubyglass = new BlockRubyGlass(1099, Material.glass, false).setStepSound(Block.soundGlassFootstep).setHardness(0.3F).setResistance(90F).setLightValue(0.2F).setUnlocalizedName("redglass");
rubyfence = new BlockFence(1100,"rubyMod:fence",Material.iron).setStepSound(Block.soundMetalFootstep).setHardness(0.5F).setUnlocalizedName("fence");
//Slabs
rubydouble = (BlockHalfSlab)(new BlockRubySlab(1101, true)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("rubydouble");
rubysingle = (BlockHalfSlab)(new BlockRubySlab(1102, false)).setHardness(1.6F).setResistance(7.5F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("rubysingle").setCreativeTab(CreativeTabs.tabBlock);
//Game Registry (For Blocks)
GameRegistry.registerBlock(rubyore,"ore");
GameRegistry.registerBlock(hellrubyore,"nether");
GameRegistry.registerBlock(rubydecor, "decor");
GameRegistry.registerBlock(rubyglass,"glass");
GameRegistry.registerBlock(rubyfence,"fence");
GameRegistry.registerBlock(rubysingle,"rubysingle");
GameRegistry.registerBlock(rubydouble,"rubydouble");
//Mob Registration
EntityRegistry.registerModEntity(EntityWitherMan.class, "Wither Man", 1, this, 80, 3, true);
EntityRegistry.addSpawn(EntityWitherMan.class, 10,2,4, EnumCreatureType.monster, BiomeGenBase.hell);
//Language Registry for Mob Kill Messages (Handles Server Bug)
LanguageRegistry.instance().addStringLocalization("entity.RubyModMuscleMan1234.Wither Man.name", "en_US", "Wither Man");
//Textures (Just in case)
rubyfence.setUnlocalizedName("rubyMod:fence");
//Effective Tools
MinecraftForge.setBlockHarvestLevel(rubyore, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(hellrubyore, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(rubydecor, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(rubyfence, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(rubysingle, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(rubydouble, "pickaxe", 2);
//Vanilla Chest Generation Hooks.
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(rubygem),1,3,95));
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(new WeightedRandomChestContent(new ItemStack(rubygem),1,3,95));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(rubygem),1,3,95));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(rubygem),1,3,100));
//Language Registry
LanguageRegistry.addName(rubyore, "Ruby Ore");
LanguageRegistry.addName(hellrubyore, "Nether Ruby Ore");
LanguageRegistry.addName(rubydecor, "Ruby Block");
LanguageRegistry.addName(rubyglass, "Ruby Reinforced Glass");
LanguageRegistry.addName(rubyfence, "Ruby Fence");
LanguageRegistry.addName(rubysingle, "Ruby Slab");
//Armor Items
LanguageRegistry.addName(rubyhelmet, "Ruby Helmet");
LanguageRegistry.addName(rubychestplate, "Ruby Chestplate");
LanguageRegistry.addName(rubyleggings, "Ruby Leggings");
LanguageRegistry.addName(rubyboots, "Ruby Boots");
//Weapons/Tools
LanguageRegistry.addName(RubySword, "Ruby Sword");
LanguageRegistry.addName(RubyShovel, "Ruby Shovel");
LanguageRegistry.addName(RubyPick, "Ruby Pickaxe");
LanguageRegistry.addName(RubyHoe, "Ruby Hoe");
LanguageRegistry.addName(RubyAxe, "Ruby Axe");
//Items
//Food and Drink Items
LanguageRegistry.addName(redpie,"Ruby Red Pie");
LanguageRegistry.addName(wine,"Ruby Rum");
LanguageRegistry.addName(lollipop,"Lollipop");
LanguageRegistry.addName(candy, "Ruby Candy");
//Misc. Items
LanguageRegistry.addName(rubygem, "Ruby");
LanguageRegistry.addName(paperstick,"Paper Stick");
LanguageRegistry.addName(lifegem, "Life Gem");
//Crafting Recipes
//Smelting
GameRegistry.addSmelting(rubyore.blockID, new ItemStack(rubygem), 0.1f);
GameRegistry.addSmelting(hellrubyore.blockID, new ItemStack(rubygem), 1.0f);
//Armor Crafting
GameRegistry.addRecipe(new ItemStack(rubyhelmet), "xxx", "x x",'x', rubygem);
GameRegistry.addRecipe(new ItemStack(rubychestplate), "x x", "xxx","xxx",'x', rubygem);
GameRegistry.addRecipe(new ItemStack(rubyleggings), "xxx", "x x","x x",'x', rubygem);
GameRegistry.addRecipe(new ItemStack(rubyboots),"x x","x x",'x', rubygem);
//Tool and Weapon Crafting
GameRegistry.addRecipe(new ItemStack(RubySword), "x", "x", "y",
'x', rubygem, 'y', Item.stick);
GameRegistry.addRecipe(new ItemStack(RubyPick), "xxx", " y ", " y ",
'x', rubygem, 'y', Item.stick);
GameRegistry.addRecipe(new ItemStack(RubyShovel), "x", "y", "y",
'x', rubygem, 'y', Item.stick);
GameRegistry.addRecipe(new ItemStack(RubyHoe), "xx", " y", " y",
'x', rubygem, 'y', Item.stick);
GameRegistry.addRecipe(new ItemStack(RubyAxe), "xx", "xy", " y",
'x', rubygem, 'y', Item.stick);
//Block Crafting
GameRegistry.addRecipe(new ItemStack(rubydecor), "xxx", "xxx", "xxx",
'x', rubygem);
GameRegistry.addRecipe(new ItemStack(rubyglass), "xxx", "xyx", "xxx",
'x', rubygem, 'y', Block.glass);
GameRegistry.addRecipe(new ItemStack(rubyfence), "xxx", "xxx",
'x', rubygem);
GameRegistry.addRecipe(new ItemStack(rubysingle), "xxx",
'x', rubygem);
//Spawn Egg Crafting (Wither Man)
GameRegistry.addRecipe(new ItemStack(Item.monsterPlacer,3,301), "xxx", "xyx", "xxx",
'x', Block.obsidian, 'y', lifegem);
//"Recycling" Recipes (NOTE THAT THEY ARE SHAPELESS!)
GameRegistry.addShapelessRecipe(new ItemStack(rubygem, 9), new ItemStack(rubydecor));
GameRegistry.addShapelessRecipe(new ItemStack(rubygem, 3), new ItemStack(rubysingle));
//Food Crafting
GameRegistry.addRecipe(new ItemStack(lollipop), "x", "y",
'x', candy, 'y', paperstick);
GameRegistry.addRecipe(new ItemStack(candy), " x ", "xyx", " x ",
'x', Item.sugar, 'y', rubygem);
GameRegistry.addShapelessRecipe(new ItemStack(wine, 1), new ItemStack(Item.sugar), new ItemStack(rubygem), new ItemStack(Item.wheat), new ItemStack(Item.potion), new ItemStack(Item.appleRed));
GameRegistry.addShapelessRecipe(new ItemStack(wine, 1), new ItemStack(Item.sugar), new ItemStack(rubygem), new ItemStack(Item.wheat), new ItemStack(Item.potion), new ItemStack(Item.melon));
GameRegistry.addShapelessRecipe(new ItemStack(redpie, 1), new ItemStack(Item.sugar), new ItemStack(rubygem), new ItemStack(Item.egg));
//Misc Item Crafting
GameRegistry.addRecipe(new ItemStack(paperstick), "x", "x",
'x', Item.paper);
GameRegistry.addRecipe(new ItemStack(lifegem), " x ", "xyx", " x ",
'x', rubygem, 'y',Item.diamond);
//Music Disc
GameRegistry.addRecipe(new ItemStack(Item.recordWait), " x ", "xyx", " x ",
'x', Block.obsidian, 'y',Item.diamond);
//Ore Generator
GameRegistry.registerWorldGenerator(new RubyGen());
//Add Spawn Egg
registerEntityEgg(EntityWitherMan.class, 0x000000, 0xffffff);
}
//Handles Unique Entity ID's
public static int getUniqueEntityId()
{
do
{
startEntityId++;
}
while (EntityList.getStringFromID(startEntityId) != null);
return startEntityId;
}
//Eggs
public static void registerEntityEgg(Class<? extends Entity> entity, int primaryColor, int secondaryColor)
{
int id = getUniqueEntityId();
EntityList.IDtoClassMapping.put(id, entity);
EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor));
}
@ServerStarting
public void serverStart(FMLServerStartingEvent event)
{
MinecraftServer server = MinecraftServer.getServer(); //Gets current server
ICommandManager command = server.getCommandManager(); //Gets the command manager to use for server
ServerCommandManager serverCommand = ((ServerCommandManager) command); //Turns it into another form to use
serverCommand.registerCommand(new CommandRubyMod());
}
@PostInit
public void postInit(FMLPostInitializationEvent event) {
// Stub Method
//HOLY ING IT WORKS!!!!
Item.itemsList[rubysingle.blockID] = (new ItemSlab(rubysingle.blockID - 256, (BlockHalfSlab)rubysingle, (BlockHalfSlab)rubydouble, false)).setUnlocalizedName("rubyMod:decor"); }
}
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; Failed to start game
A full error report has been saved to C:\Users\Chris\Desktop\1.5.1 to 1.5.2\Ruby Mod\mcp\jars\.\crash-reports\crash-2013-05-11_18.16.56-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash
--- BEGIN ERROR REPORT f6ec876c --------
Full report at:
C:\Users\Chris\Desktop\1.5.1 to 1.5.2\Ruby Mod\mcp\jars\.\crash-reports\crash-2013-05-11_18.16.56-client.txt
Please show that file to Mojang, NOT just this screen!
Generated 5/11/13 6:16 PM
-- System Details --
Details:
Minecraft Version: 1.5.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_17, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 974655912 bytes (929 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.51 FML v5.2.2.684 Minecraft Forge 7.8.0.684 4 mods loaded, 4 mods active
mcp{7.44} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized
FML{5.2.2.684} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized
Forge{7.8.0.684} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized
RubyModMuscleMan1234{1.5.2B_2} [The Ruby Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Errored
LWJGL: 2.4.2
OpenGL: Intel(R) HD Graphics Family GL version 3.1.0 - Build 8.15.10.2509, Intel
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
cpw.mods.fml.common.LoaderException: java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from Item to ItemSlab
at cpw.mods.fml.common.LoadController.transition(LoadController.java:142)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:696)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:206)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:447)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:732)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from Item to ItemSlab
at rubymod.muscleman1234.common.RubyMod.postInit(RubyMod.java:361)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:494)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:695)
... 5 more
--- END ERROR REPORT 5e57e906 ----------
package rubymod.muscleman1234.common;
import java.util.List;
import java.util.Random;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class BlockRubySlab extends BlockHalfSlab
{
/** The list of the types of step blocks. */
public BlockRubySlab(int par1, boolean par2)
{
super(par1, par2, Material.iron);
setLightOpacity(0);
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return RubyMod.rubysingle.blockID;
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
if(par1World.getBlockId(par2, par3 - 1, par4) == RubyMod.rubysingle.blockID)
{
par1World.setBlock(par2, par3, par4, 0);
par1World.setBlock(par2, par3 - 1, par4, RubyMod.rubydouble.blockID);
}
}
/**
* Returns an item stack containing a single instance of the current block type. 'par1' is the block's subtype/damage
* and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null.
*/
protected ItemStack createStackedBlock(int par1)
{
return new ItemStack(RubyMod.rubydouble.blockID, 2, par1 & 7);
}
public String getFullSlabName(int var1)
{
return null;
}
public int idPicked(World par1World, int par2, int par3, int par4)
{
return RubyMod.rubysingle.blockID;
}
public void registerIcons(IconRegister iconRegister) {
blockIcon = iconRegister.registerIcon("rubyMod:decor");
}
}
package rubymod.muscleman1234.common;
import java.util.List;
import java.util.Random;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class BlockRubySlab extends BlockHalfSlab
{
/** The list of the types of step blocks. */
public BlockRubySlab(int par1, boolean par2)
{
super(par1, par2, Material.iron);
setLightOpacity(0);
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return RubyMod.rubysingle.blockID;
}
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
{
if(par1World.getBlockId(par2, par3 - 1, par4) == RubyMod.rubysingle.blockID)
{
par1World.setBlock(par2, par3, par4, 0);
par1World.setBlock(par2, par3 - 1, par4, RubyMod.rubydouble.blockID);
}
}
/**
* Returns an item stack containing a single instance of the current block type. 'par1' is the block's subtype/damage
* and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null.
*/
protected ItemStack createStackedBlock(int par1)
{
return new ItemStack(RubyMod.rubydouble.blockID, 2, par1 & 7);
}
public String getFullSlabName(int var1)
{
return null;
}
public int idPicked(World par1World, int par2, int par3, int par4)
{
return RubyMod.rubysingle.blockID;
}
public void registerIcons(IconRegister iconRegister) {
blockIcon = iconRegister.registerIcon("rubyMod:decor");
}
}
I do have it
I think I know the problem. Make a new class and copy BlockHalfSlab and change necessary things, and cast to that.
I added the LanguageRegistry.addName for it but it still shows as a Blank in eclipse and as Unnamed in the actual Minecraft Client (Outside of Eclipse)
Please Help!
Mod Code
Thanks
Subscribe to my YouTube Channel
Follow me on Twitter
to this
Subscribe to my YouTube Channel
Follow me on Twitter
Now eclipse is throwing errors
The error is ("Type mismatch: cannot convert from Item to ItemSlab")
I have the code in my @PostInt method.
Subscribe to my YouTube Channel
Follow me on Twitter
There isn't an ItemRubySlab, Only BlockRubySlab
I changed it to this
and the error went away...but still no Tooltip name
Sorry. Forge Slabs are a very difficult beast to tame.
Subscribe to my YouTube Channel
Follow me on Twitter
Sorry, thats what I meant
I changed it to this
and the error went away...but still no Tooltip name
Sorry. Forge Slabs are a very difficult beast to tame.I did this
The name works but now the slabs don't stack properly
Subscribe to my YouTube Channel
Follow me on Twitter
To
They still don't stack to form a single block
I hate how forge implements slabs
Subscribe to my YouTube Channel
Follow me on Twitter
Make sure your doing everything right in your slab class. Look at slab code in vanilla minecraft for reference. Make sure you have this:
In your slab block class
Here
I do have it
Subscribe to my YouTube Channel
Follow me on Twitter
I think I know the problem. Make a new class and copy BlockHalfSlab and change necessary things, and cast to that.
I tried that and now I'm getting errors in my main Mod Class because it cannot cast to BlockRubySlab Please help!
Subscribe to my YouTube Channel
Follow me on Twitter
What are the errors?
Cannot instantiate the type BlockRubySlab (Lines 179 and 180, as well as 361)
Subscribe to my YouTube Channel
Follow me on Twitter
Subscribe to my YouTube Channel
Follow me on Twitter
Sorry. But now change:
To
it works
Subscribe to my YouTube Channel
Follow me on Twitter