
Rui
Members-
Posts
49 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
Author of Lively Animals (Not Yet Released)
Rui's Achievements

Tree Puncher (2/8)
1
Reputation
-
I've done this before, but it's been awhile and I can't seem to figure out how I got it to work the first time. I'm trying to look through the Biomes o Plenty source files. I made a new project with it and imported the necessary files. However, it's acting a bit strangely. http://i61.tinypic.com/6o339j.png The folders do not cascade but are all bunched together like this, and of course, it can't find the minecraft and forge files because they are not in there. I believe there was some way to simply import a file like this and look at all its contents and be able to hop around with F3 like a normal project without actually having to go through the process of making an entirely new forgegradle project. Having this mod in my testing environment is not important. All I want to do is be able to look at the files with all the convenience of Eclispe. Please do not come in and point out obvious things like "of course it won't work if you don't have forge/eclipse on there". I do have it, but it's in a separate project. If I need to set up an entirely new folder for it like I were making one for my own mod, then that's fine; I can do that. I was just wondering if there was a simpler way of doing this, because I swear I was able to do this before without having to go through all that, but I can't remember how or even what tutorial taught me that. I've searched and come up with nothing myself.
-
How do I set it to accessible if I can't access it in the first place? Edit: Nevermind, figured it out. I got the method to fire but unfortunately it didn't do anything. Thanks anyway, though.
-
Still doesn't work. if (rider != null && rider.ridingEntity != null) { if (rider.getHeldItem() != null && rider.getHeldItem().isItemEqual(new ItemStack(Items.carrot_on_a_stick))) { System.out.println("Rider is holding carrot on a stick."); Class clazz = EntityPig.class; Method method = null; try { method = clazz.getMethod("updateAITasks"); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (method != null) { try { method.invoke(pig); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Success!"); } } System.out.println("CheckRiderThread: ridingEntity set."); } } @diesieben: If you join the game on a mounted pig and are holding a carrot on a stick, you have to wait a significant amount of time before it registers and the pig starts walking. I'm attempting to eliminate the wait time.
-
Trying reflection for the first time, and something which seemed very simple eludes me. if (rider != null && rider.ridingEntity != null) { if (rider.getHeldItem() != null && rider.getHeldItem().isItemEqual(new ItemStack(Items.carrot_on_a_stick))) { System.out.println("Rider is holding carrot on a stick."); Class clazz = EntityPig.class; Method method = null; try { method = clazz.getMethod("updateAITasks", (Class) null); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (method != null) { try { method.invoke(pig, (Class) null); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Success!"); } } System.out.println("CheckRiderThread: ridingEntity set."); } } Here is the corresponding method I am trying to access from EntityPig: protected void updateAITasks() { super.updateAITasks(); } So, why is it throwing a NoSuchMethodException when I try to access the method?
-
[1.7.10] [SOLVED] ridingEntity and riddenByEntity return null
Rui replied to Rui's topic in Modder Support
code is a mysterious thing that works in mysterious ways see OP for solution -
Makes sense. How do I cancel it?
-
Can you elaborate, please?
-
Did, but nothing changed.
-
I am trying to make it so that when the player shift+right clicks the pig, the pig is unsaddled and the player gets the saddle back. This is my current code: @SubscribeEvent public void removeSaddle(EntityInteractEvent event) { if (event.target instanceof EntityPig && event.entity instanceof EntityPlayer) { EntityPig pig = (EntityPig) event.target; EntityPlayer player = (EntityPlayer) event.entity; if (pig.getSaddled() && player.getHeldItem() == null && player.isSneaking()) { player.inventory.setInventorySlotContents((player.inventory.currentItem), new ItemStack(Items.saddle)); pig.setSaddled(false); } } } Right now, the pig doesn't get unsaddled, and the player only gets the saddle if they're in creative mode. If I comment out the part adding the saddle to the player's inventory, the pig does get unsaddled.
-
[1.7.10] [SOLVED] ridingEntity and riddenByEntity return null
Rui replied to Rui's topic in Modder Support
Alright, I'm an idiot. Of course you don't put a check for the server, because then the client has no idea that you've moved. A hurr durr. New problem: For some reason if you enter the world already mounted on a pig, the pig refuses to move. It can turn, but not move. Otherwise, when you mount a pig the pig's body jerks awkwardly as it moves. I tried doing setLocationAndAngles() for the pig, but then the render wouldn't update to reflect the pig's movement and yaw/pitch. Relevant class: http://pastebin.com/q3aNZ5wq -
[1.7.10] [SOLVED] ridingEntity and riddenByEntity return null
Rui replied to Rui's topic in Modder Support
Excellent, thank you! Well, with some more testing I found that the position of the player DOES change... but the render doesn't. I don't... <i>why doesn't the render update to reflect the position</i>. Guess that means I'll have to do it myself. Um... any ideas? -
On Techne: New Model -> Base Class: Pick whichever entity you'd like to mess with.
-
[1.7.10] [SOLVED] ridingEntity and riddenByEntity return null
Rui replied to Rui's topic in Modder Support
While I'm at it, could someone tell me how to add mods to eclipse? I tried just shoving the mods into the "mods" folder, but it crashed because it couldn't find the appropriate classes. -
[1.7.10] [SOLVED] ridingEntity and riddenByEntity return null
Rui replied to Rui's topic in Modder Support
Ah, thank you for that first answer, I'll definitely change that. I can't override updateRiderPosition though. I'm kind of hacking the original pig entity with events and such, so unfortunately method overriding is unavailable for me. -
[1.7.10] [SOLVED] ridingEntity and riddenByEntity return null
Rui replied to Rui's topic in Modder Support
Made the change to check for EntityPlayerMP instead of EntityPlayer. It cuts it down to one call, but is it an acceptable way of dealing with that problem? Meanwhile, I'm having trouble actually updating the rider's position. Using setLocation and setLocationAndAngles don't seem to have any effect (other than making my computer's fans whirr). Not particularly happy about the position being coded in on the Player's side... who's wise idea was that? Anyway, if anyone can give me an idea for how to change the player's position, that would be great.