Пример #1
0
 public PhysicsEntity ItemToEntity(ItemStack item)
 {
     if (item.Info is BlockItem)
     {
         return new BlockItemEntity(this, BlockInternal.FromItemDatum(item.Datum), Location.Zero);
     }
     if (item.Info is GlowstickItem)
     {
         return new GlowstickEntity(item.DrawColor, this);
     }
     if (item.Info is SmokegrenadeItem)
     {
         return new SmokeGrenadeEntity(item.DrawColor, this, item.GetAttributeI("big_smoke", 0) == 0 ? ParticleEffectNetType.SMOKE : ParticleEffectNetType.BIG_SMOKE)
         {
             SmokeLeft = item.GetAttributeI("max_smoke", 300)
         };
     }
     if (item.Info is ExplosivegrenadeItem)
     {
         return new ExplosiveGrenadeEntity(this);
     }
     if (item.Info is PaintbombItem)
     {
         int paint = item.Datum;
         return new PaintBombEntity((byte)paint, this);
     }
     return new ItemEntity(item, this);
 }