22
33import ebf .tim .entities .EntitySeat ;
44import ebf .tim .utility .CommonUtil ;
5- import ebf .tim .utility .DebugUtil ;
65import fexcraft .tmt .slim .Vec3d ;
76import fexcraft .tmt .slim .Vec3f ;
87import net .minecraft .entity .Entity ;
@@ -77,7 +76,8 @@ public void manageCollision(){
7776 CommonUtil .atan2degreesf (host .posZ - e .posZ , host .posX - e .posX ));
7877 e .addVelocity (motion [0 ], 0.05 , motion [2 ]);
7978 }
80- } else {
79+ }
80+ else {
8181 if (e instanceof CollisionBox ) {
8282 if (((CollisionBox ) e ).host ==null ){
8383 continue ;
@@ -142,13 +142,15 @@ public void manageCollision(){
142142 }
143143 }
144144
145- } else if (e instanceof EntityPlayer || e instanceof EntityLiving ) {
145+ }
146+ else if (e instanceof EntityPlayer || e instanceof EntityLiving ) {
146147 //hurt entity if going fast
147148 if (Math .abs (host .motionX ) + Math .abs (host .motionZ ) > 0.25f ) {
148149 e .attackEntityFrom (new EntityDamageSource (
149150 host instanceof Locomotive ? "Locomotive" : "rollingstock" , host ),
150151 (float ) (Math .abs (host .motionX ) + Math .abs (host .motionZ )) * 0.5f );
151- } else if (Math .abs (host .motionX ) + Math .abs (host .motionZ ) <0.05 ) {
152+ }
153+ else if (Math .abs (host .motionX ) + Math .abs (host .motionZ ) <0.05 ) {
152154 double distanceFront = Math .sqrt ((e .posX - front .posX ) * (e .posX - front .posX )
153155 + (e .posZ - front .posZ ) * (e .posZ - front .posZ ));
154156 double distanceBack = Math .sqrt ((e .posX - back .posX ) * (e .posX - back .posX )
@@ -195,8 +197,9 @@ public void updateCollidingEntities(EntityRollingStock host){
195197 }
196198
197199 //No matter what, we don't want to push a locomotive.
198- //If the config is disabled, we don't want to push ANYTHING
199- if (!ConfigHandler .PUSHABLE_ROLLINGSTOCK || host instanceof Locomotive ) {
200+ //If the config is disabled, we don't want to push ANYTHING.
201+ //If the cart is in a consist containing a locomotive, we do not want to push it.
202+ if (!ConfigHandler .PUSHABLE_ROLLINGSTOCK || host instanceof Locomotive || (host .consistLeadID != null && host .worldObj .getEntityByID (host .consistLeadID ) instanceof Locomotive )) {
200203 //still need to push the player back though
201204 if (containsEntity ((Entity )obj )) {
202205 ((Entity )obj ).applyEntityCollision (host );
@@ -216,7 +219,7 @@ public void updateCollidingEntities(EntityRollingStock host){
216219 }
217220
218221 //we don't want to collide with our own CollisionBoxes, or the CollisionBoxes of our own consist either
219- if (obj instanceof CollisionBox && (((CollisionBox ) obj ).host == host || host .consist .contains (((CollisionBox ) obj ).host ))){
222+ if (obj instanceof CollisionBox && (((CollisionBox ) obj ).host == host || host .consist .contains (((CollisionBox ) obj ).host ))){
220223 continue ;
221224 }
222225
0 commit comments