
Rui
Members-
Posts
49 -
Joined
-
Last visited
Everything posted by Rui
-
I'll agree it's not a very elegant solution, but it's the only one I could come up with given the knowledge base I have right now. I'm not sure how else to get the render to differentiate between entities... Even the !entity.isDead conditional for the breathing doesn't work. The renderer seems very insistent on using the same values for every entity.
-
Figured it out! I'll update the first post with the solution. MrCaracal, though I didn't use the ID for the actual breathing value, your reply gave me the idea of differentiating between entities in the Model class with their UUIDs, so I'll give you a thank you for that.
-
See, that's the thing though. I need to have some sort of way to have that part of the method called only once within the render function, or else it'd keep adding and make the animation all jerky. I can actually call .getRNG() if I cast the entity passed into a LivingEntityBase, so I've taken care of that problem. Or... hopefully I did? I don't exactly remember the rules of downcasting.
-
[1.7.10] Vanilla Mobs follow when holding custom item
Rui replied to Major_Mints's topic in Modder Support
There's a task called EntityAITempt, which handles animals following you when you hold wheat/seeds/whatever. So I believe you would actually have to add the tasks to the entities you want to respond to your item. The item is one of the arguments for the constructor of the task, actually, so you shouldn't have any problem. To add the task to the vanilla animals though, you'd need to make an event handler to get the animal when it joins the world and check if it's the right species, and then add it to each animal as it is created. I used this tutorial by coolAlias to make such a handler and did so without a hitch. Hope that helps! -
I need it in render, with my breathing block: if(!entity.isDead) { GL11.glPushMatrix(); float breath = MathHelper.cos(entity.ticksExisted * .1F + startingBreath) * 0.05F + 1F; GL11.glScalef(breath, breath, breath); GL11.glTranslatef(0.0F, 1.0F - breath, 0.0F); } body.render(f5); if(!entity.isDead) { GL11.glPopMatrix(); } Although now I realize that it won't work that way since it will keep adding startingBreath. But yeah, I need it initialized for every entity and then added just once.
-
main render entity model
-
I have four methods from which I can call EntityPig: render setRotation setRotationAngles setLivingAnimations To my understanding, all of these methods will loop until the pig is dead, unloaded or what-have-you. So I repeatedly assign the same random to the Model, so what. Well, I have to assign the value of startingBreath in that method as well. But I need to call startingBreath = rand.nextFloat() only once. I mean, I guess I could just have it change to random numbers infinitely until the pig leaves the world, but I still need to have startingBreath added to the breathing formula only at the start.
-
Okay, here's how my mod is set up. I have a class called LAEntityPig, but maybe it should be called ModifyPig or something instead. It doesn't extend entity because I'm not actually making an LAEntityPig; that's the class where I modify the EntityPig upon its joining the world. RenderLAPig and ModelLAPig don't call LAEntityPig, just the vanilla EntityPig. So I have no way of getting information directly from the instantiation of LAEntityPig.
-
Looks like I'm going to have to use NBT tags after all. I can't use entity.getRand() in the Model because the only places that have an entity passed in are called continuously, and I can't cast EntityPig to LAEntityPig since it's not a subclass of EntityLivingBase. Unless maybe if I can add a function to EntityPigs that lets me access the corresponding LAEntityPig? Is there a (relatively) easy way to do this?
-
I couldn't find that function. I also went through the other accessible variables and functions and couldn't seem to find anything that would give me the Random object.
-
IExtendedEntityProperties not saving after death
Rui replied to starwarsmace's topic in Modder Support
[strikeout]There's a tutorial for that. See Step 5. If you're still having problems, I suggest posting directly to the thread, as the OP frequents it and is happy to help anyone having issues.[/strikeout] God I swear I can read. I still suggest you post directly to the thread though! -
The consistency of the random isn't as important as the fact that I have a random object to pass around and that it is connected to a particularly entity, so that when I do the model it does random for each individual entity, and not just once for all of them. Diesieben, you said there is only one renderer for all models, but I'm doing this in the model file, not the render file. Shouldn't each entity have its own model object then? That's why I was confused when putting it in the constructor didn't work.
-
A Random object. Literally Random().
-
Man, now you've lost me. I did some searching and the most I could find was code to serialize one's inventory, but I wouldn't even know where to begin on making my own code to serialize a Random object. Not sure where I could look to find one either-- this is my first time really messing around with NBT tags.
-
How would I do something like that?
-
Hmmm, I see that can be used to store primitive values, but can you also store entire objects?
-
Okay, but how? The entity's not really "mine" per say-- it's the vanilla pig entity. So I can't add the value into the class or anything.
-
I got the Random object by casting down the passed in Entity to EntityLivingBase. To actually ensure that each entity had its own starting breath value, however, I had to make a Hashmap to keep track of each unique pig's starting breath (and created that value if it wasn't in the Hashmap yet). I then added it into my formula for breathing. Voila! ---- SOLUTION ABOVE ---- So I am currently working on making my models "breathe". It's working just like I want, except all entities that are rendered at the same time breathe at the same time (for example, when you join the world). So I tried this-- public class LAModelPig extends ModelBase { [boxes and all that good stuff] Random rand; float startingBreath; public LAModelPig() { rand = new Random(); startingBreath = rand.nextFloat(); [...] } Nope, they still all breathe in perfect synchronization. I tried initializing both values in the global values, and just random in the globals; nothing worked. I would like for this value to be connected to the entity so that each person sees the same thing. Entity has a rand Random object, buuut it's protected and as I'm working with the vanilla pig entity, I have no way of accessing that. I hear you can access protected fields through reflection? Would this cause a lot of overhead? I may potentially be calling .nextFloat() in the doRender function for other things. Is there maybe an easier way to do this?
-
[1.7.10] [SOLVED] Attempting to Change Vanilla Animal Models
Rui replied to Rui's topic in Modder Support
Sorry, but I'm still not sure what to put. I tried to put the full path name and it failed. -
[1.7.10] [SOLVED] Attempting to Change Vanilla Animal Models
Rui replied to Rui's topic in Modder Support
Okay, whatever. mcmod.info is pretty much the least important part of the mod anyway. New problem: Can't seem to find my texture. LARenderPig (same as RenderPig, just with the texture locations swapped) Folder layout: I've also tried "assets/textures/animals/LAPig.png" and "ruirui/assets/textures/animals/LAPig.png". LivelyAnimals.AID is just "livelyanimals". -
[1.7.10] [SOLVED] Attempting to Change Vanilla Animal Models
Rui replied to Rui's topic in Modder Support
Moved the files as suggested, but it still does not work unfortunately. Oh Eclipse, you are a piece of work. I took out my files and then did refresh-dependencies to see if I could fix it that way, and now the only thing that shows up in the workspace is HerdCraft and when I go to add existing projects into the workspace, it says "No projects are found to import". -
[1.7.10] [SOLVED] Attempting to Change Vanilla Animal Models
Rui replied to Rui's topic in Modder Support
I see! Gotcha. Also I don't want to spam up the forums, so can I get help on something unrelated? For some reason, my mcmod.info file refuses to work. I have a screenshot of the file and my mod setup here. Also made the silly mistake of putting my constants as string literals rather than fields of a class, but upon taking out the parentheses, my main class is unable to find the Constants class. Here is how the file shows up on the console (before I took out the parentheses): And here is my (very short) Constants class from my lib folder: -
[1.7.10] [SOLVED] Attempting to Change Vanilla Animal Models
Rui replied to Rui's topic in Modder Support
Wow, I'm pretty surprised at how simple a change that was! How did you find that bug, if you don't mind me asking? Was it just by looking through the Model base that I made? Because I can't seem to find it in the crash log at all. -
Hello! I just joined the forums. Nice to meet you all. c: I have just gotten started on this project, and as I'm fairly new to Minecraft modding am running into quite a few kinks. One of the suggestions were to override the entity renderer hashmap with the model that I wanted to use. However, I am getting this crash log, and I... don't even know where to begin with it, to be honest. Here are my classes so far: main: LAModelPig: Thank you for your time and help!