--- a/net/minecraft/block/DetectorRailBlock.java
+++ b/net/minecraft/block/DetectorRailBlock.java
@@ -129,6 +129,8 @@
          }
 
          List<AbstractMinecartEntity> list1 = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.field_96566_b);
+         List<AbstractMinecartEntity> carts = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null);
+         if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel();
          if (!list1.isEmpty()) {
             return Container.func_94526_b((IInventory)list1.get(0));
          }
