-
Posts
1283 -
Joined
-
Last visited
-
Days Won
2
Everything posted by jeffryfisher
-
That "no item" error message happens when the entityItem has no itemStack associated with it. It is probably solved by d7's suggestion, but in general, I think a call to setEntityItemStack is in order for all entityItems (something that happens in the NBT methods). It's this setting of the itemStack that one entityItem might be able to handle the entire life cycle of your entity from blaze rod to cooling to pick up without being replaced again. PS: Operate on the old and new entities inside your event handler where you have both at hand.
-
[SOLVED] [1.7.10] Ore generation not generating
jeffryfisher replied to Koas's topic in Modder Support
For starters, I am leery of "new WorldGenMinable" appearing inside a loop in which its arguments do not change value. I'd hoist this up to a higher level, assigning its result to an object var that you use in its place inside the loop. However, I don't think that's the problem. Set a breakpoint at or inside addOreSpawn and then step through it. Step into the generate call. Examine variables as you go. Something should jump out at you. Maybe something wasn't initialized somewhere else. The debugger can reveal that real quick. -
I suspect that the addRecipe method scrubs away NBT tags, leaving only item and its "damage" (metadata). You might be able to inject your NBT tag from a crafting event. While you're at it, you could define an achievement and award it in the same event handler. Search for tutorials on crafting achievements (there are several).
-
I think he was using a descriptive name where you would put your name for the entityItem to spawn in water. However, that is not quite the item (cooledBlazeRod). An entityItem is a subclass of Entity, not Item. You don't actually get to the itemStack of your Item until picking up the Entity. Clear as mud right? BTW, Another source of confusion is that MC and Forge often offer multiple ways to solve various similar problems, with some techniques enabling a mod to do more (but usually paying a penalty in more coding or something). Depending on how readers interpreted what you're trying to do, they may have offered up solutions to the wrong problem. Me, I would have started by trying to detect wetness of the entityItem rather than trying to intercept the initial spawning in the world (because the entityItem can move, fall, or have blocks change around it). However, I probably would have run into problems and ended up doing what your onto now. I have to say that immediately substituting one's own entityItem at spawning gives you many more ways to control it. In fact, you might not even need to replace it when it cools. It might just need to change color and remember that it has cooled so that it returns the right kind of itemStack when it is picked up. Also see combineItems in EntityItem to make sure that dissimilar rods do not combine.
-
You're gonna need to compromise somewhere, and it's gonna take some work. 1) Find a mod that will add disc items to the game and allow you to insert your own music files for those discs to play. I just happen to have such a project on my to-do list. I might even get to it before the end of 2016, but don't hold your breath. However, you'd still need to get your music into ogg format (prolly require conversion, which will require an app like VLC and learning how to use it). Then the ogg files would prolly need special names, and they'd need to be moved to a special place so that the mod would use them. 2) Go learn Java. This forum assumes you already know Java and just need a little help to understand a Forge feature, so you'll need to look beyond. Fortunately, there are many online tutorials and manuals and forum discussions. Java's essential-level features are also amazingly easy to acquire if you have experience in another O-O language, esp once you come up to speed in Eclipse for Java (an IDE). 3) Hire a professional. When "between contracts" (i.e. unemployed), we can be had for about $50/hr (or you could hire an amateur for $30/hr, maybe even less, but he would take forever and still get it wrong). I estimate this project will take about 1 week coding and another of debugging. So basically, you're asking for about $4000 worth of help here. Scrape together $4000, and you'll find help coming out of the woodwork.
-
Copy pasted? Why not extend? And, having created this class, when will the world ever spawn one so it can do something for you? I think you want to extend EntityItem so the objects of your custom class will still count as EntityItem in vanilla code that might operate on them. Otherwise some things may break.
-
Aha, for methods in CommonProxy to always execute, you must make sure that ClientProxy and (in your case) ServerProxy call their supers from any methods that they override. Otherwise the overrides intercept the calls so that they never reach common. Welcome to O-O programming
-
To see the other FML events you might handle, just jump to the definition of preInit, init and/or postInit event type that you're already using as the input parameter to each main handler (in Eclipse that's easy). You should find yourself in a place that defines those three and some others.
-
Start reading the vanilla code for entities, living entities etc. As I recall, they reach terminal velocity rather rapidly. They also interact with water. If you're going to "have fun", then you should not only have gravity give an impetus, but you should also have air and water resist per speed in a way that results in equilibrium (terminal velocity in air or water). Once that's done, then you'll be ready to simulate gravity on the Moon or Mars (good luck finding air or water there).
-
A tool is a subclass of ItemTool, which is a subclass of Item. Start by reading the source code for an example tool (e.g. class ItemAxe) and the whole of the shared class ItemTool. Then make your own subclass. If your tool is idiosyncratic, then you might subclass ItemTool or even Item (see how vanilla shears and hoe are coded). If your tool is yet another axe, pick etc, then you may subclass from the vanilla one you want to imitate. Override the methods and adjust properties you want to do differently (e.g. tool material, effectiveBlocks). Other than that, tools are much like other items.
-
Set breakpoints in the methods you think are relevant, and then run in the debugger to see what's happening. If the ores appear to be generating somewhere, write down the block coords and then go see what's actually there.
-
1) Your sided proxy annotation mentions "ClientProxy" and "ServerProxy", but you showed us only CommonProxy. There are potential problems here if they're not tied together properly, and we can't see them. 2) If you're going to put something vital into a common proxy method, then make sure that your client proxy method (and server proxy method) calls super. 3) When you say "won't work", please be more specific. Did it report an error? did the line even execute? Have you stepped through in the debugger and seen some wrong data or found data missing? 4) If you haven't stepped through the errant code in a debugger, please do so. Many puzzling errors become head-slappers in the debugger. Even if not, there's SO much more you can tell us after examining what's actually happening in the order it happens. 5) I'm looking at "new ItemStack(Modblocks.eff1...)" and trying to see Modblocks to check its declaration and instantiation of this other eff1. Where is it? What is it? Is it a block that becomes an specific enchanted book in a crafting table? The recipe "won't work" if this input object is out of order. 6) Which enchantment, input or output? When and where was "matches" called? Was it operating on recipe inputs or output? If you were hoping for an input item to confer an enchantment upon an output, then you need an anvil, not a crafting table. Crafting tables do indeed drop enchantments (which is why you should never repair magic items in ordinary crafting spaces unless you want to scrub them -- making a palimpsest ready for new enchantments). 7) Tell us what you are trying to do.
-
How often does LivingUpdateEvent get called? I may be wrong, but it looks like every update is going to multiply the player's speed again and again until it overflows. Am I reading your expression wrong? I trust you've looked at how a speed potion (or running) produces its effect in vanilla code. Do they use such multiplication in effectively the same place that this event fires? Also, you mention boots but your loop looks at all four armor slots. Is speed intended to work on helms etc?
-
Did you use Eclipse to see the vanilla code that prints this message? I suspect that you're looking at the stack either too soon or too late to get a valid return value. You might need to use a different event. To which did you subscribe? Show more code for context. You already got a zero in your stack, and stone follows from zero (that's its ID). When you fix the first problem, this one should clear up. However, your cauldron workaround is nice -- it creates a use for cauldrons.
-
If ModelHelper is client side only, and you call its registerItem from main init, won't that raise an error on the server? I'm surprised you can even include the class at compile time. Wait a second... Why would you have your item and block registration hiding inside a SideOnly class? Shouldn't a client side class hold only rendering stuff? Did I read the source incorrectly? If so then I apologize.
-
In other words: An item is an exemplar for all items of that sort in the game. An item stack is like an instance, so it has identifying information such as damage and/or enchantment (or the number of objects in the stack). Therefore, itemDropped will simply return the item Items.enchanted_book (and that's all your call to getItem leaves you with -- the enchantment is left behind in the stack hidden in your class). Trace the return from itemDropped and see where the item is used to create a stack for dropping. Look for an opportunity to add your enchantment to that stack. Be aware that it might be a Forge event.
-
Read class ItemEnchantedBook, especially the public method addEnchantment.
-
In other words, have you tried adding your recipes during init and removing others during post-init? Also, there are more, lesser-known, FML stages even after post-init. Just in case some mod injected its recipes during post-init, you could still trump them.
-
Could you replace the existing TE instance with one of your own? Your replacement would need to do all of the work of the original plus whatever data and logic you want to add (hopefully by extending the class). The trick would be to extract the data from the original TE before it's trashed. The risk is that something somewhere else will cough up a lung because the TE class isn't quite what it expected to see there.
-
[1.7.10] Modifying Base Classes and some other stuff...
jeffryfisher replied to Arkyd's topic in Modder Support
For "merchant system", could you add some villager professions with more reasonable trades? I haven't done so in a mod yet, but I have used op commands to spawn villagers offering specific trades in particular villages / places. If you're setting up a one-off adventure world, you could use commands rather than code-modding to put the trades you want where you want. Villager spawning commands are easy to Google, just be careful about what MC version you use. You can edit / perfect / save commands in a simple text editor and then paste them into the console / command line as needed. -
[1.7.10][Solved] EntityItem not spawning in world
jeffryfisher replied to yorkeMC's topic in Modder Support
If you're not willing to use the debugger to get more info about your problem, then you can't expect us to put in much effort either. Get into the debugger and see what's happening. -
[1.7.10] Changing the volume of a sound while it is playing
jeffryfisher replied to Earthcomputer's topic in Modder Support
It's an unpopular naming convention to alert me that something is a class and not an instance. It's mainly for those times when a class is used to invoke a static method or data member, because I'm forgetful and might misunderstand otherwise. And yes, with "class" as a prefix, it's obviously not vanilla, because vanilla classes are not named that way. I'm so used to it after so many years that I don't notice it until I read one of those static references. -
Let's get more output, like the coords of the entity when it updates and prints status. Turn on bounding boxes too, so you can "see" it even if it's not rendered. What are your symptoms exactly?
-
[1.7.10][Solved] EntityItem not spawning in world
jeffryfisher replied to yorkeMC's topic in Modder Support
Where's your debugger experience? What happened when you set a break-point and walked through this whole process? Where did it deviate from what you expected, and what variable(s) had values you didn't expect?