Everything posted by Kwibble
-
How to get the width and height of the image stored at a ResourceLocation?
This seems like it should be a well used thing, and isn't. It is confusing me greatly. Any ideas/suggestions on how?
-
Making a tameable mob sit
^^^ What he said. The methods I was referring to though were: /** * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { if (this.isEntityInvulnerable()) { return false; } else { Entity entity = par1DamageSource.getEntity(); this.aiSit.setSitting(false); if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1.0F) / 2.0F; } return super.attackEntityFrom(par1DamageSource, par2); } } public boolean attackEntityAsMob(Entity par1Entity) { int i = this.isTamed() ? 4 : 2; return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i); } Those are exact copies from EntityWolf.
-
Render Image on Screen rippling
Could it be lighting issues? Try enabling/disabling lighting or disabling/enabling lighting. It could work (guesswork for the win)
-
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Good job on that fix It probably isn't the most efficient, but it works right? No worries mate, questions are the only way you can learn really. Keep asking away!
-
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
No, your crash has to do with your NBT tag/and or the return from getString("Owner") being null. How about you change your check to: @Override @SideOnly(Side.CLIENT) public Icon getIcon(ItemStack itemstack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining){ NBTTagCompound properties = itemstack.stackTagCompound; if (properties != null) { if (!properties.getString("Owner").equals("none")) { return iconIndex[1]; } return iconIndex[0]; } return this.itemIcon; } And if that still crashes with a NullPointerException again, change: if (!properties.getString("Owner").equals("none")) { to: if (properties.getString("Owner") != null && !properties.getString("Owner").equals("none")) { Hope that helps
-
Questions concerning entities, and biome/tree generation
No one has any answers...? That's... Saddening.
-
Making a tameable mob sit
Like I said, there is a method something along the lines of attackEntityAsMob() and you have to return an int which is your damage look around for a method similar to that in EntityWolf
-
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
That's because you are trying to access it from somewhere it isn't. Try this: @SideOnly(Side.CLIENT( private Icon[] iconArray; @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister register) { iconArray = new Icon[2]; //registering the two icons iconArray[0] = register.registerIcon(BCMInfo.ID + ":" + getUnlocalizedName()); iconArray[1] = register.registerIcon(BCMInfo.ID + ":" + getUnlocalizedName() + "Active"); } @Override @SideOnly(Side.CLIENT) public Icon getIcon(ItemStack itemstack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining){ NBTTagCompound properties = itemstack.stackTagCompound; if (!properties.getString("Owner").isEmpty()){ return iconArray[1]; } else { return iconArray[0]; } }
-
[1.7.2]creating an api
Don't forget the thank you and applauds And your welcome. The whole API concept threw me on a bum steer when I first started too.
-
Making a tameable mob sit
...not what meant. I'm not at my computer right now so I can't give you the method names. But for the AI, you need to add targetTasks for attacking (look at EntityWilf's constructor). Aside from that, hit ctrl + f in while in the EntityWolf file and search for "attack". Then see what methods have it in their name and copy those and modify them.
-
[1.7.2]creating an api
That's why the are in the list. I would suggest googling tutorials on lists in Java - very helpful in this situation. Lists have add(Object object) and get(index) methods. So if after all the vampires have been registered, to access all of them you would go: for (int i = 0; i < vampiresList.size(); i++) { IVampire vampire = vampiresList.get(i); // do stuff here }
-
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
Hmm... Well, you probably could do that You could modify what I said to suit that. Just store all the information you would need in the config file (I would suggest creating your own way of handling this config file though) and then make the Job class more generic. You would make the Job class so that it has multiple parameters passed to it that are taken from the config - same for the custom recipe class. A lot of helper methods would need writing, but its doable.
-
Making a tameable mob sit
Okay. Open up the code for EntiyWolf. Read through the AI it has, read the methods for attacking it has, copy and modify them to your needs.
-
[1.6.4] Attaching NBT Data to Crafting Result Based on Recipe Items
It seems you are trying to over complicate things just a tad. You know, just a teensy weensy bit. After reading what you have said, it seems you are wanting to make it so certain jobs have certain recipes right? Well, if that's the case, time to harness the power of object orientated programming I would make a class called Job, and that class has all the basic stuff in it that every job will have. So an array of recipes etc.. Then, for each job, subclass Job (e.g. JobKnight, JobMage) and implement the job only stuff you need. You may need to make your own custom 'recipe' class as well that creates the special recipes you want. Just my thoughts
-
[1.7.2]creating an api
For the registery, you would have a public static method, maybe something like: public static void registerVampire(IVampire vamipre) { vampiresList.add(vampire); } That list would then contain every single vampire registered. (list has to be created elsewhere) For retrieving the text from that method, you could go: IVampire vampire = new SomeClassThatImplementsIVampire(); String string = vampire.string(); // gets the string from the class.
-
[1.7.2] Recipe in custom furnace is taking the bucket instead of giving it back
You could check to see if a bucket of any kind was smelted and then add a bucket back into the players inventory?
-
NullPointerException but it isn't null!
Umm.. I am pretty sure that Minecraft.getMinecraft().thePlayer is the client side player. And since there is only one player per client, thePlayer is the player for that client.
-
[1.7.2]creating an api
API's are actually quite confusing. But only in the misconception people seem to have about them. What I would do, is make an interface that is called say, IVampire. This interface contains all the methods needed for a vampire in your mod. Then, for every vampire that gets added in, make it implement your IVampire interface. After this, create a method for registering a vampire. Then you just keep track of all the registered vampires etc..
-
Questions concerning entities, and biome/tree generation
Entities: 1. Is it possible to have an entity 'snap to the grid' on the x/z axis? As in, make the entity stand in centered on a block? 2. Is it possible to 'tell' an entity to walk to a given position? E.g. Move from current position to point c? Biome/Tree generation: 3. Is it possible to hook into the generation of a biome and replace blocks? 4. Is it possible to hook into the generation of trees and replace wood blocks?
-
[1.6.4] Create a machine block which can contain water
Yeah, pretty much. Look through this code for how to do packet handling I guess. You should be able to pull what you need from it. https://github.com/ModderPenguin/MinePG/tree/master/source/minepg/rpg_common/rpg
-
[1.6.4] Create a machine block which can contain water
* blinks in surprise * * looks at title * * facepalms * It's 1.7... Why aren't you using forge1.7.x by the way? Update your forge and then continue from there maybe?
-
Oddity in wiki's render tutorial: adjustLightFixture, adjustRotatePivotViaMeta
Whoops >.> I read that as protected.
-
Misspelled word in profiles
I am not sure if this should be here, but I just noticed a spelling mistake while browsing through my profile on this link: http://www.minecraftforge.net/forum/index.php?action=profile;area=showThankYouPosts;u=54268 The spelling mistake is that Topics (become) is actually spelt Topcis (become) on the website. And to prove it: https://onedrive.live.com/redir?resid=361B44D022EA75F6!182&authkey=!AEZqyf0nvTixeEE&v=3&ithint=photo%2c.png Thanks
-
Oddity in wiki's render tutorial: adjustLightFixture, adjustRotatePivotViaMeta
Have you placed a System.out.println(); call in those two methods to see if the are called by a super class anywhere? That would probably answer your question as to whether or not they are called. If in doubt, use System.out
-
[1.7.2]Packet Handler Illegal State Exception
Go to the tutorials sub forums of modder support (at the top of the page). Click on either of the SimpleNetworkWrapper tutorials. Read.
IPS spam blocked by CleanTalk.