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.

Travoos

Members
  • Joined

  • Last visited

  1. Thanks for the quick reply! That fixed my problem.
  2. 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.
  3. 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.
  4. And that fixed the rest of my problems! Thanks!
  5. 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.
  6. 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?

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.