Everything posted by NuclearFej
-
Custom Glass Pane
If you absolutely must override it, you will have to use an access transformer. www.minecraftforge.net/wiki/Using_Access_Transformers
-
[SOLVED]GUI Not Opening
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.
-
[SOLVED]GUI Not Opening
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.
-
Controlling crafting
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!
-
Controlling crafting
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.
-
Controlling crafting
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!
-
Coding Error Eclipse
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.
-
[Solved] Saving data about a player
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.
-
[Solved] Saving data about a player
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
-
[Solved] Saving data about a player
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.
-
No Block Textures Since 1.5.1
Can you post the entire file location for one of your block.pngs?
-
[Solved] Saving data about a player
In that case, how would I save NBT tags to players, um, normally? Thanks!
-
[Solved] Saving data about a player
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");
-
No Block Textures Since 1.5.1
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?
-
No Block Textures Since 1.5.1
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!
-
[Solved] Saving data about a player
Can you give an example, if possible? It's still unclear exactly what I need to extend/override. Thanks!
-
[Solved] Saving data about a player
How, exactly? I can't find any information whatsoever on this interface. Thanks!
-
[Solved] Saving data about a player
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.)
-
just updated from 1.5 to 1.51
That looks about right, yes. Don't forget the @Override though.
-
Simple teleportation
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!
-
just updated from 1.5 to 1.51
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!
IPS spam blocked by CleanTalk.