Jump to content

HappleAcks

Members
  • Posts

    124
  • Joined

  • Last visited

Everything posted by HappleAcks

  1. This looks very helpful, but it might be a bit much just to make my pet sit. :\
  2. I did define them above as variables, at the top in the code I pasted earlier.
  3. What I did was this: I know the state function works because it is used inside the entity file to change behaviour and that part works fine.
  4. Tried this, but the model doesn't seem to update.
  5. So I just had this issue again, and with the previous fixes. Particle spawn: Particle code:
  6. So if I wanted to change a mob model depending on a state (using a method getState() in the entity file). My current render file:
  7. My bad.. So now it works. I forgot that I removed my random number generator at one point when I implemented the data watcher methods.
  8. I'm still having the same problem as before where it only does whatever is the 'default:' in the switch, and without default there it has an error as it thinks it has a chance of not returning anything and thus would want void on the function. My related code: In Render File:
  9. I haven't worked with the Data Watchers much before, so I got lost a little bit. So I'll create the method, but how do I save and read from the watcher [in order to call from 1 of my 6 possible textures]. First, you need to register a field ("object") inside the DataWatcher with the DataWatcher#addObject(id, initialValue) method, preferably inside the entityInit() method in your entity. id is an unique object id which you need to reference the object. Please note that there are pre-occupied IDs already, so if it crashes with the ID, try another one. Also there's a cap of max. 32 objects within a DataWatcher. initialValue is pretty self-explanatory. Possible data types can be: ItemStack, String, Integer, Short, Byte, Float, ChunkCoordinates . Either use new DataType() (e.g. new ItemStack(...) ) or, for primitive datatypes, cast it (e.g. to have a short, use (short) 10 ) Second, to get an object from the DataWatcher, use DataWatcher#getWatchableObject[DataType](id) , where [DataType] is the datatype you've defined previously (e.g. for integer, use getWatchableObjectInt(id)). The only exceptions where you can't use this is ChunkCoordinates. Here's a list of datatypes and getters: ItemStack : getWatchableObjectItemStack String : getWatchableObjectString Float : getWatchableObjectFloat Integer : getWatchableObjectInt Short : getWatchableObjectShort Byte : getWatchableObjectByte Third, to write to the defined object, use DataWatcher#updateObject(id, newValue) , which follows the same rules as the in initialValue from the registration for the newValue. Also make sure to only update values on the server (worldObj.isRemote == false), or you get discrepancies with client and server. This was very helpful, but I can't seem to get it to work at all. I've run into a lot of things such as: 1) It won't let me access the value from the render class because it wants it to be static to do that, but a this.x cannot be static [in this case, x is the datawatcher]. 2)I don't know how data watchers will help me get any more of a random number than it did before. Because I understand I can generate a random number, saved it in the data watcher and then use it, but I can just do that without a data watcher by generating a random number and using that directly.
  10. I haven't worked with the Data Watchers much before, so I got lost a little bit. So I'll create the method, but how do I save and read from the watcher [in order to call from 1 of my 6 possible textures].
  11. So if I have a mob and a few possible textures, how would I make it have a random texture [from my list] each time it spawns. I've tried doing a switch and generating a random int, but both times it determined the texture for all of them upon startup.
  12. Okay good to know. Thank you.
  13. Is the new place where I placed the isRemote [in previous post] correct? Also, in all my Render files I always have @SideOnly(Side.CLIENT) at the beginning because I was told a while back that's how you make things properly work for SMP. I assume this is okay for the render files though [like the mob render files]. However, for an entity I should always use the isRemote (I already had the isRemote in the weapon code for spawning the entity too)?
  14. My bad for B, I didn't actually copy this part, but right before the on update there is: @SideOnly(Side.CLIENT) <--- This @Override public void onUpdate() { super.onUpdate(); --- So I can assume the client only thing wasn't a problem. Now, for checking if the world is remote, I do this in the entity projectile file correct? So something like the following:
  15. Still unsolved. Mod works fine in 1024, and grants 0 errors in 1060 so I'm not sure why I'm getting the crash.
  16. The code spawning it from the projectile: And the actual particle code:
  17. So I got this out of bounds error, and I see it's with the particle effects. I was shooting a weapon that leaves a particle effect trail, so I'm not sure how it got out of bounds.
  18. Still haven't been able to solve this, if it helps anyone here is my class path [if that is the issue] to my main class: ForgeFolder\src\main\java\com\darkMod\common\DarkMod.java
  19. So I just updated to forge build 1060 and I don't have any errors in the mod, but I get this error [and a crash] upon trying to start up MC within development now. The building and updating was successful in gradle. It only happens when my mod source is in the src folder. Was something changed about the class path that I don't know about?
  20. So I just updated to forge build 1060 and I don't have any errors in the mod, but I get this error [and a crash] upon trying to start up MC within development now. The building and updating was successful in gradle. It only happens when my mod source is in the src folder. Was something changed about the class path that I don't know about?
  21. So I currently have a ranged mob, which will fire at me and then fire in that direction 5ish times before deciding to change it's direction and fire at me again. It repeats this at all times.
  22. So, I noticed that I keep getting a reoccuring bug whenever I used the new AI. The mob will walk towards me but it will be facing on an angle (slightly away from me) while it does it. My entity class: public class EntityRunner extends EntityMob { public EntityRunner (World par1World) { super(par1World); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false)); this.setSize(1.0F, 1.0F); // TODO Auto-generated constructor stub } protected String getLivingSound(){ return "darkMod:RunnerLiving"; } protected String getDeathSound(){ return "darkMod:RunnerDeath"; } protected String getHurtSound(){ return "darkMod:RunnerHurt"; } protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { this.playSound("mob.pig.step", 0.15F, 1.0F); } protected Entity findPlayerToAttack(){ EntityPlayer entityPlayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 32.0D); return entityPlayer != null && this.canEntityBeSeen(entityPlayer) ? entityPlayer : null; } public void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(52.0D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.54D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(13.0D); } @Override protected boolean isAIEnabled() { return true; } }
  23. Which link? I was under the impression this was phased out when they separated the images a few updates ago, but if it still works that's great! Where do I put the "animation" though? (Also is that the actual code or is it a form of suedocode?)
  24. So, if I have a block, how can I make the texture on it animate (if I have a bunch of images for each frame). I know Minecraft added support for it, but I don't know how to make it cycle through the textures.
×
×
  • Create New...

Important Information

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