Posted December 2, 201212 yr Hey, I'm Schilcote, and I'm just getting started with Forge/Minecraft modding (I dabbled in it a little bit a long time ago, but didn't learn much). I need a few pointers on where to get started with my first mod. I've got the basics down- I know how to make an item and a block, and I somewhat understand the idea of these sided proxy thingies, so now I'm getting down into mechanics code. The first thing I need advice as to how to do is this: I have an item that I want to drop once the player breaks his 1024th stone block. I need it to spawn exactly once. How would I go about this?
December 2, 201212 yr Listen for PlayerEvent.HarvestCheck, make sure the block is Stone, and save the number...somewhere...would probably be the easier. I'm not familiar with saving data to player's, but it can probably be done.
December 2, 201212 yr Author Okay, makes sense so far. So how do I make the item drop into the world?
December 2, 201212 yr new EntityItem(event.entityPlayer.worldObj,event.entityPlayer.posX,event.entityPlayer.posY, event.entityPlayer.posZ, new ItemStack(IDHERE,1));
December 2, 201212 yr Author Ah, that makes sense. Surprisingly straight-forward. Lemme try writing some code now... EDIT: Though I'm 99.9% sure you can't just stick fields on things willy-nilly like you can in Python. So how would I store this information?
December 2, 201212 yr That's what I was just trying to figure out... You could either store to a config file, which I guess would work but would be ugly, or maybe save to player data, which I don't know how to do =/
December 2, 201212 yr Made some mock up code, and couple of problems: 1)HarvestCheck is apparently called a lot. Like, every time out click on it. Also, only called when you try to harvest without a tool, which is odd. 2)HashMap wouldn't work, since you still need to be able to save inbetween server restarts.
December 2, 201212 yr Author Huh. Well, I think we ought to wait for someone who knows how to do these sort of things to show up, then.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.