Jump to content

kauan99

Members
  • Posts

    210
  • Joined

  • Last visited

Everything posted by kauan99

  1. Sorry, I have no idea. I didn't try actions yet. I just had to say this: your signature is AWESOME!!
  2. Haha! Thanks, I'm happy to hear that I helped! This community is helping me a lot for the past few days (I think it's been a week now since I started playing mod programmer). I want to help people too! I was gonna write some sort of speach on how I love this forum (I actually deleted 5 lines of text that were already written). But I think it suffices to say: "I love this forum". As much as I love minecraft.
  3. That's probably not it, but when I had that error it was because I had installed different versions of Forge src and Forge Universal (universal was the more recent version, and the src was the recommended, stable version). Probably not your case, but just saying that this happened to me.
  4. Hi all! Again, pardon my English, and any noobish stuff I may say. I've been looking for some good explanation on Entities in general and I can't find any. I've found lots of tutorials on how to make mob Entities (apparently that's a popular thing), but none on Entities as a whole. I'm much more interested in entities like the minecart. I want to know what I can do with entities and how far I can go. I want to test and experiment as much as possible. But I really dont have any interest at all in living Entities (I think vanilla has enough of those). I tryed to read the classes themselves. But minecraft was coded in a very unusual way. I even think that a lot of it's code should have been written in a radically different form. Anyway, it's quite confusing without some explanation on the code, so I was hoping someone could maybe give me a link to a good tutorial on Entities. Thanks a lot!
  5. Hi! I didn't read the code entirely, and although I don't know exactly how to fix the problem, maybe you don't need to deal with that problem at all, because usually implementing new swords is quite simple. And what strikes my eye about that line of code is the fact that you are trying to register your sword with the same name of an already registered item. Read on, nevertheless, because maybe you will decide to change the implementation of your sword after reading this: Unless your ZanofiteSword does something that other swords don't, I dont think you need a class for implementing it. All you need is a new ToolMaterial. You'd need a field like this: public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial ( "Zanofite", [harvestLevel here (int)], [maxUses here (int)], [eficiency here (float)], [damage here (int)], [enchantability here (int)] ); EnumHelper is a Forge class, meant to help us cheat on something: You can't extend an Enum type. Forge does it anyway through that class, using something called Reflection (which is basically the ability to inspect a type and change anything you want about in on runtime.) As for the method EnumHelper.addToolMaterial, the arguments you need to pass are the propreties of the new ToolMaterial you are making up: harvestLevel: It's an integer number that kinda says how strong are the tools made from this material when used to break other things and get their drop. This is how minecraft implements the "minimum tool material" you need to use to harvest something (for example, to harvest obsidian you need at least diamond). The harvestLevels for the minecraft existing ToolMaterials are: WOOD = 0 GOLD = 0 STONE = 1 IRON = 2 EMERALD = 3 (this is the name of diamond as a ToolMaterial, for some reason) maxUses: Another integer, it's how much damage your item can sustain before it breaks (-1 if unbreakable, I think. Not sure). For the vanilla ToolMaterials, these are the values: GOLD = 32 WOOD = 59 STONE = 131 IRON = 250 EMERALD = 1561 eficiency: this is a float value that states how fast the tools made from this ToolMaterial harvest/break things. The vanilla values are listed below: WOOD = 2.0 STONE = 4.0 IRON = 6.0 EMERALD = 8.0 GOLD = 12.0 damage: How much is the basic damage this ToolMaterial deals on things like mobs and players. Swords get like a greater multiplier (see ItemSword class to know exactly how that damage is altered before it turns into the sword's real damage). Again, the vanilla values: WOOD = 0 GOLD = 0 STONE = 1 IRON = 2 EMERALD = 3 enchantability: That's another integer. It's used for calculating how strong are the enchantments you can get on a Tool when putting it on an enchanting table. The higher this number, the better the enchantments (other things as bookshelves around the enchanting table also aply, of course. I don't know what are the exact calculations minecraft does to select a random enchantment when you are using an enchanting table. All I know is that this number gets involved in the way i said). To know more about the EnumToolMaterial enum go see it for yourself. It's fully qualified name is net.minecraft.item.EnumToolMaterial So, basically, I think you should first add your new tool material and then you should make an ItemSword of that material. It should look something like this: public static final EnumToolMaterial ZanofiteToolMaterial = EnumHelper.addToolMaterial ( "Zanofite", [harvestLevel here (int)], [maxUses here (int)], [eficiency here (float)], [damage here (int)], [enchantability here (int)] ); public static final Item ZanofiteSword = (new ItemSword(itemzanofitesword, ZanofiteToolMaterial).setUnlocalizedName([your sword's unlocalized name here (String)]); and as for registering it: GameRegistry.registerItem(ZanofiteSword, [the same unlocalized name you gave to this sword before goes here]); LanguageRegistry.addName(ZanofiteSword, [now the language name, the one that will show as the in-game sword's name]); I think that's it. And I hope I didn't say something wrong. Please do check it all for yourself anyway, cause I may have made mistakes. Good Luck!
  6. Sorry I'm posting a doubt instead of a solution but I'm also learning and I must take this oportunity to ask a question: you don't have a constructor for your ItemZanofite that takes an Item as an argument. Is that somehow allowed in Java? Is there like an implicit constructor for a base class that takes an instance of super class as argument? EDIT:You know what, I believe that's the error. I think you have to instantiate your ItemZanofite as in your constructor: by passing It's unique ID (some number you will make up that won't conflict with the other already established IDs in minecraft. I guess something like 1000 would be ok).
  7. Thanks! I already have Forge, and I've already been coding for a few days now. Got a few recipes, blocks (some of them do really crazy stuff like changing day to night and shine to rain and vice versa), got a few items, new tool material, one tile entity, one GUI and one container (that's all I got so far). Then after, from my experiments I begin to realize how powerful a mod can be, and this thought about mods being used for evil purposes strikes me, and then I created this thread. Anyway, I'll follow your instructions regarding the decompiling of minecraft_server.jar. I only have one question: do I need to put minecraft_server.jar under any specific folder? I ask because I'm not sure how the decompiler thing will know where it is. That's all, thanks again.
  8. Thanks! Download done. But that wiki article doesn't really have anything useful on what exactlty is this minecraft_server.jar, where do I put it, how do I decompile it, and finally how do I use it to make a server mod. It's actually pretty basic stuff on how to code an extremely simple mod that doesn't do anything, to be used with ModLoader. I'll try to figure it out though, thanks again. It can't be that hard. At least now I have the file.
  9. Thanks for all the answers. I don't know what you meant. (sorry, I don't know how to quote more than one person. Actually all my editor shortcuts are missing, I have only this text box to type in, and the buttons to post, preview and spell check. Something's wrong with the forums, I suppose). @RANKSHANK You mean: If it is not a Forge mod theres no way a Forge server mod can know what mods each client has installed? @jordan30001 I think I'd be ready to drop a few niceties in the name of a clean honest game (that of course depending on what is the purpose of the server). For example, imagine a server where the gameplay revolves around economics, like obtaining currency, trading with other players and NPCs, aquiring raw materials and processing them, putting money in banks and etc. A server with that orientation would have to be very strict about which mods are allowed and would have a list of "ok mods". Every other mod, no matter how harmless, would be "not ok". So, jordan30001, considering what you said, would a player still be able to change the name of his/her "cheat" mod to the name of an ok mod and just connect his/her client without the server ever having any way to detect anything wrong? In my opinion, if the server can't have absolute control over what exactly each and every connected client can do, there's no way to have a serious multiplayer experience with strangers in minecraft. Which is gonna be a big disappointment for me. finally, @Draco18s, sorry, this is probably a stupid question, but how to I decompile server.jar? And where do I find that file? I'm a noob, sorry
  10. Thanks for your reply! Yeah I'm sure a lot of mods out there are just like cheating... I think I can make mods that are not cheats, like requiring the server to have the same mod installed (I think Forge API has an annotation that does that, doesn't it?). But we have no control over what will other people put in ther mods. So this is why I think it would be nice for the server to have that type of control. Although I do not own a server, I'd like to make a mod to help those who do to keep it clean from undesired mods. I'm thinking more of vanilla styled servers, not those capture the flag things and etc that probably have plugins or something like that to keep things under control. So since we established some mods can be considered cheating in a multiplayer enviroment, can anyone give me a hint on where to start building a server mod that would allow connection just to clients that had installed mods from a set of aproved mods? And also, How would I run and test such a mod? I don't have a minecraft server myself...
  11. Hi all! Continuing the series "When Dummies Mod Minecraft" here goes another stupid question: I was thinking, some mods give some advantages to their users compared to someone playing without that mod. With that in mind, I was wondering if there's a way for the server to "know" what mods someone have installed. Then the server would maybe decide whether that client can join or not. Is that an already existing feature of servers? If not, Is it possible to make a server mod to do that? Thanks in advance!
  12. I had this same error and for me the problem was different versions of forge src and forge universal. That's probably not your case but if you didn't check that you should.
  13. if he overrides getDropBlocked he will add possible drops. I think he always wants to drop 2 blocks. So he has to override also either Block.dropBlockAsItemWithChance or Block.dropBlockAsItem or both. That's what my limited understanding makes me believe
  14. I'm not an expert, and I don't quite understand your problem, and maybe this is not the solution. But maybe you could override Block.dropBlockAsItemWithChance and possibly Block.getBlockDropped and put your logic in those 2 methods?
  15. I'm still confused about deobfuscation and all that, but I think that's not critical knowledge for mod codding, so I'm not gonna try to learn any further about that. I totally understand EntityItem now, thank you very much for clarifying that, SanAndreasP!
  16. Oh, so that's the names of things prior to deobfuscation! It makes perfect sense now (I was not sure of the meaning of obfuscation/deobfuscation before now. God, I'm stupid). Ok, so EntityItem is a dropped ItemStack. Still weird, but ok. I can live with that. Thanks!!
  17. Here I am again, with my poor English and poorer mod coding skills, to bother you guys once more. So, I've completed some successful tests, creating a few blocks that do crazy stuff like making it rain and turning night into day and vice versa. Preparing the way so one day I can master GUI, TileEntities, NBT and Containers and all that circus. I've been reading the code for BlockContainer, and BlockChest for hours now (didn't touch the TileEntity code itself, but I'm being able to figure out it's role everytime it appears in the code - thanks to Senitiel and specially Mazetar for his brief crystal clear explanation on a lot of complex concepts). Suddenly, a wild EntityItem appears. I read it's code. There's not much of it. But I can't understand what it is. Maybe it's something simple that I can't understand due to exaustion? It's like some kind of "box" around an ItemStack, I think? but I can't understand why it exists. What's even more amazing is that I understood the rest of the code so far! With all those par1, par2, par3, parFuckYouCode... Who's to blame for those cursed meaningless names? Forge? MCP? Notch? So, to make it clear, what is an EntityItem? Why do we need that class? Thanks! edit: yeah... at the end of the method I'm reading (BlockChest.breakBlock()) there's yet another surprise: at the very last line of the method there's a call to World.func_96440_m(). What the hell? :'(
  18. Thank you very much! You both helped a lot! I have a much better understanding on all those things after reading your posts than I had after reading a whole bunch of tutorials (I'm even gonna ctrl+D this thread). I will start small, as Senitiel said, but I'll try to incorporate TileEntities, Containers and NBT from the begining. Building something simple, that has an inventory and needs to keep its state between sessions. Those brief descriptions Mazetar gave me on Containers, NBT and GUI's were awesome. Now I know what to look for and where I'm going to. I never imagined I could learn so much by asking such an abstract question. Again, thanks a lot, you guys!
  19. Hello! (First of all, pardon my English) Again, I'm sorry if this is a dumb question (I'm sure it is). I'm new to mod coding and programing (specially Java). And I'm definetly also sorry for this not being an objective question about a practical problem. I understand too little about the problem to even formulate a proper objective question on it. I have this idea of creating and engine. It would run on coal and water (or maybe I'll come up with something else to power it), and it would output a different kind of energy than that of redstone circuits. I'd use it to power other things, like a grinder for example (a block-like thing with an inventory similar to the one of a furnace, but without the coal slot. I'd input something like, say, an emerald, and it would output emerald dust), and maybe even vehicles. I'm not sure if it's even possible. Is more like a wild dream. Looking around the tutorials, the minecraft classes and google I began to think that for me to even begin to conceive how to implement that, I'd have to learn about NBT (whatever that is), Containers, GUI, Tile Entities, and probably much more. Is that true? Or could I just make up a few blocks and add fields to them to handle their logic and I'd be done...? There are no complete tutorials on those subjects and the incomplete ones are outdatted and obscure and they just made things worse (I wish I never learned about the existence of such beasts such as Tile Entities). In short: is it possible to live without learning about NBT and Tile Entities, etc and still be able to code neat mods with stuff like the aforementioned engine and grinder? (Forget about the vehicles, that's probably going too far). And if I absolutely must learn those things to code decent mods, where do I find tutorials in a style more like "Tile Entities and NBT For Dummies"? Thanks for any comments!!
  20. That sounds just perfect! I'll look into that as soon as I have the time. Got to finish some homework and then get ready for school. Thank you diesieben07 and thank you Forge for what sounds like a neat feature.
  21. Hi everybody! (crowd: Hi doctor Nick!) Well, I wanted to create some other material from which I could craft tools. I don't want my new material to have the exact same properties as any of the other tool materials (wood, stone, iron, gold and diamond ). I'd like to customize things such as the combining the enchantability of gold with the max uses of diamond. Or even making it even more enchantable than gold. Basically, I'd like to have my own arbitrary values for my tool material properties. Since I can't extend an Enum (and EnumToolMaterial is an Enum), I was thinking of extending each and every tool item (ItemSword, ItemSpade, ItemAxe, etc) with a version for my material (MyMaterialItemSword, MyMaterialItemSpade, etc) and then I would override any method that would make use of EnumToolMaterial. That's a very cumbersome approach, and some of those methods are really complicated, such as: boolean ItemTool.getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) That method is used in a most cryptic way by the unreadable method net.minecraft.inventory.ContainerRepair.updateRepairOutput() So I have no idea of how to override ItemTool.getIsRepairable(...) just to mention one. There must be a better way to simulate your own materials. Has anyone done that before? Any help is much appreciated. Thanks in advance.
  22. It doesn't work for me. That's pretty much my original problem. When I register a recipe for Block.leaves (the argument being either new ItemStack(Block.leaves) or just Block.leaves, as you just taught me) I only get the recipe registered for the oak leaf (which has the metadata of 0). I just tested it just now. Unless there's something wrong with my forge release or theres a neater way of doing this, I'm stuck with that awful for loop. Back to the subject of not needing to create instances of ItemStack to use them as the ingredients part of a call to GameRegistry.addShapelessRecipe(ItemStack output, Object[] ingredients). Just now reading some stuff on Java performance, I learned the Java JIT compiler is not as smart as I expected and every single time you reference a class field (be it static or not) a thing called "field lookup" occurs, which is similar to a method call, and that gets the field value for you (unless it's a value field, like int, float, etc, and it's marked as final). So, my guess is that the final version of the code should be: temStack mossyCobblestoneOutput = new ItemStack(Block.cobblestoneMossy); Block cobblestoneBlock = Block.cobblestone; //this line is new for(int i = 0; i <= 3; ++i) { ItemStack leaves = new ItemStack(Block.leaves.blockID, 1, i); GameRegistry.addShapelessRecipe(mossyCobblestoneOutput, leaves, cobblestoneBlock); //this line changed } That will avoid 4 field lookups and perform just 1 instead. Even better if you use cobblestoneBlock other times throughout your code, avoiding more field lookups and improving performance.
  23. Thanks! According to the tutorial I was following, the Object parameters should be of type ItemStack, but as you showed me, they can be of type Block too (or mixing ItemStack and Block). I don't know why the tutorial does that. It's a lot of wasted code. Well, when the last argument of a Java method is of type Object[], you can either call it by explicitly passing an Object[] like you did (array of elements of type Object, that is) or do it implicitly, by passing any number of arguments each of them of any type, in a comma separated list, just like a regular method call. Object[] is a way for the method to say "I accept a varying number of arguments of any type". The arguments can be of any type, because the type Object (more specifically java.lang.Object) is like "the mother of all classes", the topmost class of the inheritance hierarchy. If a class doesn't extend any other class, then by default it extends Object. And if it happens to extend some other class, that other class it extends also can extend another class or not. You can keep going up that tree hierarchy until a point where you will find a class that won't extend any other class explicity. It still implicitly extends java.lang.Object. In short, everything is an Object. Of course, inside the method implementation, some types will make sense while others will not. You won't know it until the method gets called and causes an error and probably a crash (For example, even though a cow is an Object, remember everything is an object, the method GameRegistry.addShapelessRecipe(ItemStack output, Object[] ingredients) will probably cause a crash if one of your ingredients is a cow). Anyway, you helped me save a lot of useless ItemStack instantiations (damn you tutorial! Kidding, I love you, tutorial. Now kiss). But the code you suggested doesn't take into account the very problem my post was about, that is, I need one recipe for every type of leaf, or it will only work on the type of leaves that has 0 as metadata (oak leaves, that is). So thanks to you my code is now as follows: ItemStack mossyCobblestoneOutput = new ItemStack(Block.cobblestoneMossy); for(int i = 0; i <= 3; ++i) { ItemStack leaves = new ItemStack(Block.leaves.blockID, 1, i); GameRegistry.addShapelessRecipe(mossyCobblestoneOutput, leaves, Block.cobblestone); } I still need the mossyCobblestoneOutput to be an ItemStack, because the signature of GameRegistry.addShapelessRecipe requires the first argument to be of type ItemStack, but I no longer need all my ingredients arguments to be of type ItemStack! (Although in the case of leaves I still have that extra step, because I need the metadata, which tells what kind of leaf I'm talking about, and I don't think theres a constructor of the type Block that accepts metadata, which is pretty strange...) That will save me A LOT of coding throughout my project, thanks again!
  24. Thanks a lot! I didn't quite understand the tutorial, that's really complicated stuff! But it put me in the right way to find the solution (I think there should be an easier way to do this. This for statement adding the exact same recipe for every subblock is just dreadful. Either minecraft or forge should implement this thing better). Anyway, through this tutorial I found out about the constructor I needed: ItemStack(int blockID, int stackSize, int metadata). So my final code is: ItemStack cobbleStoneBlock = new ItemStack(Block.cobblestone); ItemStack mossyCobblestoneOutput = new ItemStack(Block.cobblestoneMossy); for(int i = 0; i <= 3; ++i) { ItemStack leaves = new ItemStack(Block.leaves.blockID, 1, i); GameRegistry.addShapelessRecipe(mossyCobblestoneOutput, leaves, cobbleStoneBlock); } Thank you!!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.