Posted December 10, 20159 yr I want my entity to stay where it is no matter what collides with it or anything (besides gravity and moving by itself), however, setting #canBePushed to false doesn't do anything. How do I do this? Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
December 11, 20159 yr Author Please help It's been at least a day already Thanks Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
December 11, 20159 yr Could you post your code? – Money can't buy everything but I'd rather cry in a mansion...
December 13, 20159 yr Author I don't need to post any code. I have an entity with canBePushed set to false. That's it. Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
December 14, 20159 yr Author Does anyone know how to do this? Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
December 14, 20159 yr Dunno if this helps, but there's an attribute called knockback resistance I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.
December 14, 20159 yr Author Nope doesn't help. That only comes into effect if you hit it, not web. You collide with it. Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
December 15, 20159 yr Author Bump again Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
December 16, 20159 yr Well it's not really that hard to accomplish, just override all methods containing collide and or push. Any how, here is the fix: // if your entity is an instance of entityliving, you can disable leashing as well. @Override public boolean allowLeashing() { return false; } // I think this is used when the player has attacked this entity, could be wrong. @Override public void onCollideWithPlayer(EntityPlayer entityIn) {} // this actually allows for damaging the entity, when it get hit it knocks the entity back, // if you'd want to prevent that you have to override EnitityLivingBase#knockBack. @Override public boolean canBeCollidedWith() { return false; } // obviously we dont want this @Override public boolean canBePushed() { return false; } // not any entity can collide. if you want projectiles to still be // effective, you will have to handle those yourself @Override protected void collideWithEntity(Entity p_82167_1_) {} // checks for any entity within a certain boundingbox, eg minecarts @Override protected void collideWithNearbyEntities() {}
December 17, 20159 yr Author I have tried that, however that makes it so anything can walk through it. I want it to be solid so nothing can go through it and it won't move. Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
December 17, 20159 yr I have tried that, however that makes it so anything can walk through it. I want it to be solid so nothing can go through it and it won't move. Nowhere in your thread have you asked for the above, anyway, entities derived from EntityLivingBase can be walked through. By looking at the boats class you can see you can't walk through a boat, rather you walk on top of it like a halfslab. Some collision method(s) in the Entity class does not allow another entity to walk through it, I don't have time to search for it right now, maybe when I get back and remember it I can update this post. But I'd suggest to look into anything related to colliding in the Entity class or better, check what methods are overriden in the EntityLivingBase class containing something relevant to colliding. If you have not found anything, you could do something dirty using the collideWithNearByEntities method. Check for entities in your entity's AABB, if that entity is inside of the AABB 'teleport' it back 1 position in the entity's current position. Something like this could create a jittery effect when the player keeps colliding with your entity, but that's like I said a dirty solution.
December 18, 20159 yr I also think that the collideWithEntity() method might be able to be used (also with canBeCollidedWith returning true) to adjust the position and keep it fixed and bounce the entity back. You could probably copy the code for how an entity collides with a block. Another, different approach might be to create an invisible block at the same location. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
December 21, 20159 yr Author I also think that the collideWithEntity() method might be able to be used (also with canBeCollidedWith returning true) to adjust the position and keep it fixed and bounce the entity back. You could probably copy the code for how an entity collides with a block. Another, different approach might be to create an invisible block at the same location. Yes I looked at that, however when the entity that collides with mine runs collideWithEntity(), that entity pushes back both itself and whatever it collided with. So even if I don't push my entity back, the other entity will. Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.
December 21, 20159 yr Does the entity have to move (by itself)? If not, then maybe a TileEntity is a better approach. Otherwise, you need to look at vanilla entities that resist pushing. Maybe minecart would be interesting. It looks like the applyEntityCollisions() is the method you need to look at. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.