I've been trying forever, looking through different code to try to find a method that would work. I'm trying to get any mob to freeze when hit with a custom item, WITHOUT modding base classes. It may be really simple and I may just not have enough modding experiance, but I've been trying for a couple days now. If you happen to know I'd really like to learn. Any help would be appreciated.
Haha, that's okay. Thanks. I actually got it to work. Super easy. I can now fill all 8 buckets with one click! I still don't know however if this is the same as Base Class modding, which is what my question was.
no, I copied the ItemBucket class. The only method in there, onItemRightClick, changes the bucket depending on what liquid you right clicked. So I'm trying to find a way to change it so it knows how many are in the Itemstack, and change the x number of empty buckets to x number of buckets of water. Easy way to fill 8 buckets.
huh? I only get one bucket when crafted. because that recipe only makes 1 bucket. I can just now stack them in 8. I do have to check, however, that if i try to use a stack of bucket on water, if it all turns to water buckets or something.
Yep, all buckets in the stack change to 1 bucket of water. need to change that.
Well, it does work! But I could have easily done the same thing by modding the base class, so im wondering if this is just as bad. And you get the bucket back after crafting what?
So the issue is i needed to be able to stack empty buckets, lava buckets, and water buckets for my mod. I copied the ItemBucket class and called it ItemBucketCustom. I then copied the Item declarations from the Item class and just pasted them in my mod_whatever class. It worked, they now stack in 8's, but I'm curious as whether or not this is the same as Base Class modding. Here's the classes just in case:
mod_whatever(not the whole thing)
public class mod_LavaAndIce extends BaseMod {
public static final Item bucketEmpty = new ItemBucketCustom(69, 0).setIconCoord(10, 4).setItemName("bucket");
public static final Item bucketWater = new ItemBucketCustom(70, Block.waterMoving.blockID).setIconCoord(11, 4).setItemName("bucketWater").setContainerItem(bucketEmpty);
public static final Item bucketLava = new ItemBucketCustom(71, Block.lavaMoving.blockID).setIconCoord(12, 4).setItemName("bucketLava").setContainerItem(bucketEmpty);
ItemBucketCustom(again, not whole thing)
public class ItemBucketCustom extends Item
{
/** field for checking if the bucket has been filled. */
private int isFull;
public ItemBucketCustom(int par1, int par2)
{
super(par1);
maxStackSize = 8;
isFull = par2;
}
Haha, I was just using the pig as an example. The mod is being made to freeze entities when hit with a custom item, so... idk. I've seen people when modifying arrow that it's a normal arrow until they shoot it with a custom bow, then it's a modded arrow. Don't know if the same logic applies to the pig thing, I've never dealed with arrows.
It's not that I need help. It would be nice to see somebody elses code for help. Of course it makes it easy for people to "steal" somebody elses code. But if you think about it, how many people have made new block mods? Almost everybody. If you were to take somebody elses code block code, no one would know, becuase your gonna change it to make it yours. Stealing wasn't my main point anyway, but I actually thought about that. Put something in the code that is yours. Like a recipe or something. Then take it out when you release the sourcecode. Then if your worried about people stealing, you still have that piece of "you" in your code that no one else does.
People should have a, "I don't care whether or not my code is taken," because it's all for the advancement of cooler mods. If people kept the block thing to themselves, it would be difficult to get people started on modding because that's one of the first things people do, yet now because people didn't care, it's in almost everybodys mod.
I don't mean to be rude, or say anybody's wrong, I just have this idea that all information should be free to the public for the greater good of society.
Maybe I haven't been on here long enough then. I've seen a lot of people who say no to giving their code away though. Not on here though, just anywhere in general. Maybe it's not that they don't give it out, but that it's not easily accessible to the public. Like, the download source code should come with it. I'm glad people actually do provide their code though.
Just for future reference, your code will look a lot nicer if you use the little coding paster-thing in the post editor. Looks like a <>.
Are you using eclipse to code? If you are, you can put your images inside of MCP\eclipse\Client\bin folder. If you do this, you don't have to load your code into your jar every time you recompile. (I don't actually know if you were doing that or not, but that's what it sounded like).
If your using eclipse and you put your images in the folder above, you can actually just click the Run button within eclipse and it'll start a client with your mod loaded in it. No recompiling needed either. If you get that to work, you can even hit the Debug button. It does the same thing, only you don't need to close the client and reclick the run button every time you change code. You just need to save it and go back to client. Pretty much the most productive feature ever!
Haha, that actually sounds quite interesting. I like it. Sadly, western is not my idea of fun (I hate western stuff) so I won't be making it. Still sounds cool though. Very different than what's out there.
I've seen numerous posts where people want to learn from others who have more experience. I've seen multiple mods that would really help me if I knew how to do a certain aspect of the mod, but the mod's code wasn't open to the public. I think it would help tons of people who were stuck on a part of their mod they just couldn't understand or for some reason just could not accomplish without help. Just something I've wondered. So why not make it public?
0
0
0
0
Yep, all buckets in the stack change to 1 bucket of water. need to change that.
0
0
mod_whatever(not the whole thing)
ItemBucketCustom(again, not whole thing)
0
0
0
People should have a, "I don't care whether or not my code is taken," because it's all for the advancement of cooler mods. If people kept the block thing to themselves, it would be difficult to get people started on modding because that's one of the first things people do, yet now because people didn't care, it's in almost everybodys mod.
I don't mean to be rude, or say anybody's wrong, I just have this idea that all information should be free to the public for the greater good of society.
0
0
Are you using eclipse to code? If you are, you can put your images inside of MCP\eclipse\Client\bin folder. If you do this, you don't have to load your code into your jar every time you recompile. (I don't actually know if you were doing that or not, but that's what it sounded like).
If your using eclipse and you put your images in the folder above, you can actually just click the Run button within eclipse and it'll start a client with your mod loaded in it. No recompiling needed either. If you get that to work, you can even hit the Debug button. It does the same thing, only you don't need to close the client and reclick the run button every time you change code. You just need to save it and go back to client. Pretty much the most productive feature ever!
0
0
0
0