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.

NuclearFej

Members
  • Joined

  • Last visited

Everything posted by NuclearFej

  1. If you absolutely must override it, you will have to use an access transformer. www.minecraftforge.net/wiki/Using_Access_Transformers
  2. java.lang.ArrayIndexOutOfBoundsException: 0 at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:458) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) Check each time you access arrays to make sure that this does not happen. Strings, too.
  3. java.lang.ArrayIndexOutOfBoundsException: 0 at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:458) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) Check each time you access arrays to make sure that this does not happen. Strings, too.
  4. I've run into a problem. When I need to access the private fields eventHandler and thePlayer, well, they're private. (Duh.) Am I going to need to use access transformers to get this to work? (Not quite familiar with them. Although it seems it's time for me to learn.) Or am I missing something obvious? Thanks!
  5. This is going to be fun. The ones I need to wrap? All of them! (Well, not all of them, but a lot) I'll let you know if this works.
  6. How can I stop a player from crafting any particular item? Including vanilla items? There doesn't seem to be any Event for this particular purpose. I figured I'd just be able to cancel an event but no dice. Thanks!
  7. In addition to Mazetar's suggestion, I highly suggest that you download the javadocs. They will tell you what a huge chunk of the Forge methods do. Also, be aware that func_94581_a was renamed to updateIcon in the newer builds. You will need to change the method name once you update.
  8. Wow. That was so easy, especially compared to the IExtendedEntityProperties! Thank you so much! I think I'll write a tutorial about it as well, as long as that kind of thing is wanted by the community.
  9. How do you write to a custom NBT file? I can't find anything even similar to a filename in the NBT code. I'm probably missing something
  10. Much better question: I assume I cannot attach a TileEntity to a player, as TileEntities have a fixed position in the world. So, then, I need to attach the NBTs to something else. What can I attach them to in order to have them attached to the player, and what method can I use to get the object from a EntityPlayer? This is assuming I don't use IExtendedEntityProperties.
  11. Can you post the entire file location for one of your block.pngs?
  12. In that case, how would I save NBT tags to players, um, normally? Thanks!
  13. How does this look to you guys? Thanks for all the help! import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; public class DataSaver extends TileEntity implements IExtendedEntityProperties { String testString = ""; @Override public void saveNBTData(NBTTagCompound compound) { super.writeToNBT(compound); compound.setString("test01", testString); } @Override public void loadNBTData(NBTTagCompound compound) { super.readFromNBT(compound); testString = compound.getString("test01"); System.out.println(testString + " loaded."); } @Override public void init(Entity entity, World world) { } public void writeString(String par1) { testString = par1; } public String getString() { return testString; } } and when I need to access or save data... ((DataSaver)player.getExtendedProperties("FejProperties")).writeString("xyz");
  14. No, it is not. This is the code net.minecraft.block.Block: @SideOnly(Side.CLIENT) /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(this.unlocalizedName); } So, why is he not getting compile-time errors?
  15. I might be insane, but it's worth posting anyway. When you overrode the registerIcons method, you capitalized the first R in registerIcons. The method as it is written is uncapitalized (standard camelCase). I'm not sure if this will cause a problem though. Best of luck!
  16. Can you give an example, if possible? It's still unclear exactly what I need to extend/override. Thanks!
  17. How, exactly? I can't find any information whatsoever on this interface. Thanks!
  18. How can you save data about a player? For example, money. I assume this would be done through NBTTagCompound but I can't find anything relevant about saving tags to players. Thanks! (Saving data to an external text file or the like would work as well, if that is possible.)
  19. That looks about right, yes. Don't forget the @Override though.
  20. Hi. I'm writing a really simple test mod to create an item that teleports the player upwards. Here is the relevant code: public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { par1ItemStack.stackSize--; ((EntityPlayerMP)par3EntityPlayer).setPositionAndUpdate(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ + 5 ); return par1ItemStack; } It throws a ClassCastException because the player entity object is not of the type it requires. I'm sure that this isn't the right way to do this (I just found the line that throws the exception on another website), my question is, what is the correct way to do this? Thanks!
  21. Block code has changed to: public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(this.unlocalizedName); } Item code has changed to: public void updateIcons(IconRegister par1IconRegister) { this.iconIndex = par1IconRegister.registerIcon(this.unlocalizedName); } Hope this helps!

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.