-
[1.7.2] NBT tags not saving
Thanks for the quick reply! That fixed my problem.
-
[1.7.2] NBT tags not saving
So, I'm having a little trouble with NBT. I want to have this TileEntity store 3 values that it'll need in order to run how I want it to. However, it doesn't seem to want to save and/or load the values for some reason. This is my code: @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setFloat("powerPrev", this.prevPower); nbt.setFloat("powerLevel", this.power); nbt.setByte("powerState", this.state); } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.prevPower = nbt.getFloat("powerPrev"); this.power = nbt.getFloat("powerLevel"); this.state = nbt.getByte("powerState"); } I really don't see what's wrong with it. This is what vanilla TileEntities seem to use as well.
-
[1.7.2] registerItemRenderer
Is there a way I can use registerItemRenderer on a block in a simple way in 1.7.2? I'm trying to make my block render as a model in item form.
-
[1.7.2] Assets?
And that fixed the rest of my problems! Thanks!
-
[1.7.2] Assets?
The name is working now. Thanks. However, the texture is still broken. Still not sure how to fix that. The code is a little bit sloppy but I did. I just set it in the variable in Test.java instead of the declaration in TestItem.java.
-
[1.7.2] Assets?
It's been such a long time since I've last modded. There are only a couple 1.7.2 tutorials I could find, but I just can't seem to find out how to use assets correctly. Here's my code: Test.java package com.travoos.test; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.*; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid = Test.MODID, version = Test.VERSION, name = Test.NAME) public class Test { public static final String NAME = "Test Mod"; public static final String MODID = "test"; public static final String VERSION = "1.0"; public static Item testItem; @EventHandler public void preinit(FMLPreInitializationEvent event) { Test.testItem = new TestItem().setUnlocalizedName("testItem"); } @EventHandler public void init(FMLInitializationEvent event) { ItemStack gravelStack = new ItemStack(Blocks.gravel); ItemStack dirtStack = new ItemStack(Blocks.dirt); GameRegistry.registerItem(testItem, "testItem"); GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt, 23), gravelStack, dirtStack); GameRegistry.addSmelting(Items.diamond, new ItemStack(Test.testItem, 2), 5f); } } TestItem.java package com.travoos.test; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class TestItem extends Item { public TestItem() { super(); this.setMaxStackSize(14); this.setCreativeTab(CreativeTabs.tabRedstone); this.setTextureName("test:testItem"); } @Override public void registerIcons(IIconRegister register) { this.itemIcon = register.registerIcon("test:testItem"); } } And here's my project layout for the mod project (Probably incorrect): testItem.png is a 16x16 sprite. en_US.txt is just "item.testItem.name=Test" When I smelt the diamond, the 2 stack of the item comes out, but it crashes when I try to take that item out. I'd also like to point out that the item doesn't even appear in the creative menu. So basically all I'm asking is, how would I do this correctly? What am I doing wrong?
IPS spam blocked by CleanTalk.